0.3.1
CD-Block

Data Structures

struct  cd_block_hardware_info
 Not yet documented. More...
 
struct  cd_block_status
 Not yet documented. More...
 

Macros

#define CDFS_SECTOR_SIZE   (2048U)
 Default CD filesystem sector size (in bytes).
 
#define SECTOR_LENGTH_2048   (0)
 Not yet documented.
 
#define SECTOR_LENGTH_2336   (1)
 Not yet documented.
 
#define SECTOR_LENGTH_2340   (2)
 Not yet documented.
 
#define SECTOR_LENGTH_2352   (3)
 Not yet documented.
 
#define FAD2LBA(x)   ((x) - 150)
 Not yet documented.
 
#define LBA2FAD(x)   ((x) + 150)
 Not yet documented.
 
#define CD_STATUS_BUSY   0x00
 Not yet documented.
 
#define CD_STATUS_PAUSE   0x01
 Not yet documented.
 
#define CD_STATUS_STANDBY   0x02
 Not yet documented.
 
#define CD_STATUS_PLAY   0x03
 Not yet documented.
 
#define CD_STATUS_SEEK   0x04
 Not yet documented.
 
#define CD_STATUS_SCAN   0x05
 Not yet documented.
 
#define CD_STATUS_OPEN   0x06
 Not yet documented.
 
#define CD_STATUS_NO_DISC   0x07
 Not yet documented.
 
#define CD_STATUS_RETRY   0x08
 Not yet documented.
 
#define CD_STATUS_ERROR   0x09
 Not yet documented.
 
#define CD_STATUS_FATAL   0x0A
 Fatal error (hard reset required)
 
#define CD_STATUS_PERI   0x20
 Periodic response if set, else command response.
 
#define CD_STATUS_TRANS   0x40
 Data transfer request if set.
 
#define CD_STATUS_WAIT   0x80
 Not yet documented.
 
#define CD_STATUS_REJECT   0xFF
 Not yet documented.
 

Typedefs

typedef uint32_t fad_t
 Not yet documented.
 
typedef struct cd_block_hardware_info cd_block_hardware_info_t
 Not yet documented.
 
typedef struct cd_block_status cd_block_status_t
 Not yet documented.
 

Functions

int cd_block_init (void)
 
bool cd_block_busy (void)
 Determine if CD-block is busy for commands.
 
int cd_block_security_bypass (void)
 Bypass copy protection (by using JHL and CyberWarriorX exploit).
 
int cd_block_transfer_data (uint16_t offset, uint16_t buffer_number, uint8_t *output_buffer, uint32_t buffer_length)
 Transfer data from CD-block buffer to memory.
 
int cd_block_transfer_data_dmac (uint16_t offset, uint16_t buffer_number, uint8_t *output_buffer, uint32_t buffer_length, cpu_dmac_channel_t ch)
 Transfer data from CD-block buffer to memory using the Direct Memory Access Controller (DMAC).
 
int cd_block_sector_read (fad_t fad, void *output_buffer)
 Read a sector to a memory location.
 
int cd_block_sectors_read (fad_t fad, void *output_buffer, uint32_t length)
 Read multiple sectors to a memory location.
 
int cd_block_cmd_status_get (cd_block_status_t *cd_status)
 Not yet documented.
 
int cd_block_cmd_get_hw_info_get (cd_block_hardware_info_t *info)
 Not yet documented.
 
int cd_block_cmd_toc_get (uint8_t *cd_status, uint16_t *toc_size)
 Not yet documented.
 
int cd_block_cmd_session_info_get (uint8_t session_number, uint8_t *cd_status, uint8_t *num_sessions, uint32_t *session_lba)
 Not yet documented.
 
int cd_block_cmd_cd_system_init (int16_t standby)
 Not yet documented.
 
int cd_block_cmd_tray_open (int16_t standby)
 Not yet documented.
 
int cd_block_cmd_data_transfer_end (void)
 Not yet documented.
 
int cd_block_cmd_disk_play (int32_t mode, fad_t start_fad, int32_t num_sectors)
 Not yet documented.
 
int cd_block_cmd_disk_seek (uint32_t start_play_pos)
 Not yet documented.
 
int cd_block_cmd_disk_scan (uint8_t scan_direction, uint8_t *cd_status)
 Not yet documented.
 
int cd_block_cmd_subcode_get (uint8_t type, uint8_t *cd_status, uint16_t *size_in_words, uint16_t *flags)
 Not yet documented.
 
int cd_block_cmd_cd_dev_connection_set (uint8_t filter)
 Not yet documented.
 
int cd_block_cmd_cd_dev_connection_get (uint8_t *cd_status, uint8_t *filter_number)
 Not yet documented.
 
int cd_block_cmd_last_buffer_destination_get (uint8_t *cd_status, uint8_t *buffer_number)
 Not yet documented.
 
int cd_block_cmd_filter_range_set (uint8_t filter, fad_t fad, uint32_t range)
 Not yet documented.
 
int cd_block_cmd_filter_subheader_conditions_set (uint8_t channel, uint8_t submode_mask, uint8_t code_info_mask, uint8_t filter_number, uint8_t file_id, uint8_t sub_mode_val, uint8_t code_info_val)
 Not yet documented.
 
int cd_block_cmd_filter_mode_set (uint8_t mode, uint16_t filter_number)
 Not yet documented.
 
int cd_block_cmd_filter_connection_set (uint8_t conn_number, uint8_t true_conn, uint8_t false_conn, uint16_t filter_number)
 Not yet documented.
 
int cd_block_cmd_selector_reset (uint8_t flags, uint8_t sel_number)
 Not yet documented.
 
int cd_block_cmd_buffer_size_get (uint8_t *cd_status, uint16_t *block_free_space, uint8_t *max_selectors, uint16_t *max_blocks)
 Not yet documented.
 
int cd_block_cmd_sector_number_get (uint8_t buffer_number)
 Not yet documented.
 
int cd_block_cmd_sector_length_set (uint8_t size)
 Not yet documented.
 
int cd_block_cmd_sector_data_get (uint16_t sector_offset, uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_sector_data_delete (uint16_t sector_position, uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_sector_data_get_delete (uint16_t offset, uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_sector_data_put (uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_sector_data_copy (uint8_t dst_filter, uint16_t sector_offset, uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_sector_data_move (uint8_t dst_filter, uint16_t sector_offset, uint8_t buffer_number, uint16_t sector_number)
 Not yet documented.
 
int cd_block_cmd_file_abort (void)
 Not yet documented.
 
int cd_block_cmd_disk_auth (void)
 Not yet documented.
 
int cd_block_cmd_auth_check (uint16_t *disk_type_auth)
 Not yet documented.
 
int cd_block_cmd_execute (cd_block_ioregs_t *regs, cd_block_ioregs_t *status)
 Not yet documented.
 

Detailed Description


Data Structure Documentation

◆ cd_block_hardware_info

struct cd_block_hardware_info

Not yet documented.

Data Fields
uint8_t cd_status Not yet documented.
uint8_t hw_flag Not yet documented.
uint8_t hw_version Not yet documented.
uint8_t mpeg_version Not yet documented.
uint8_t drive_version Not yet documented.
uint8_t drive_revision Not yet documented.

◆ cd_block_status

struct cd_block_status

Not yet documented.

Data Fields
uint8_t cd_status Not yet documented.
uint8_t flag_and_repeat_count Not yet documented.
uint8_t ctrl_addr Not yet documented.
uint8_t track_number Not yet documented.
uint8_t index_number Not yet documented.
fad_t fad Not yet documented.

Function Documentation

◆ cd_block_init()

int cd_block_init ( void  )

Initialize the CD-block.

Returns
Not yet documented.

◆ cd_block_busy()

bool cd_block_busy ( void  )

Determine if CD-block is busy for commands.

That is,

if ((HIRQ & CMOK) == 0x000) { ... }
#define HIRQ
CD-BLOCK I/O register.
Definition: map.h:26
Returns
true if CD-block is busy.

◆ cd_block_security_bypass()

int cd_block_security_bypass ( void  )

Bypass copy protection (by using JHL and CyberWarriorX exploit).

Returns
Not yet documented.

◆ cd_block_transfer_data()

int cd_block_transfer_data ( uint16_t  offset,
uint16_t  buffer_number,
uint8_t output_buffer,
uint32_t  buffer_length 
)

Transfer data from CD-block buffer to memory.

Parameters
offsetOffset from current FAD.
buffer_numberNumber of buffer to start reading.
[out]output_bufferBuffer where data will be recorded.
buffer_lengthSize of the buffer where data will be recorded.
Returns
Not yet documented.

◆ cd_block_transfer_data_dmac()

int cd_block_transfer_data_dmac ( uint16_t  offset,
uint16_t  buffer_number,
uint8_t output_buffer,
uint32_t  buffer_length,
cpu_dmac_channel_t  ch 
)

Transfer data from CD-block buffer to memory using the Direct Memory Access Controller (DMAC).

Parameters
offsetOffset from current FAD.
buffer_numberNumber of buffer to start reading.
output_bufferBuffer where data will be recorded.
buffer_lengthSize of the buffer where data will be recorded.
chDMA channel to be used on the transfer.
Returns
Not yet documented.

◆ cd_block_sector_read()

int cd_block_sector_read ( fad_t  fad,
void *  output_buffer 
)

Read a sector to a memory location.

This function initialize and spins the disk to retrieve data.

Parameters
fadFAD to start reading from.
[out]output_bufferBuffer where data will be recorded.
Returns
Not yet documented.

◆ cd_block_sectors_read()

int cd_block_sectors_read ( fad_t  fad,
void *  output_buffer,
uint32_t  length 
)

Read multiple sectors to a memory location.

This function initialize and spins the disk to retrieve data.

Parameters
fadFAD to start reading from.
[out]output_bufferBuffer where data will be recorded.
lengthLength of buffer in bytes.
Returns
Not yet documented.

◆ cd_block_cmd_status_get()

int cd_block_cmd_status_get ( cd_block_status_t cd_status)

Not yet documented.

Parameters
cd_status
Returns
Not yet documented.

◆ cd_block_cmd_get_hw_info_get()

int cd_block_cmd_get_hw_info_get ( cd_block_hardware_info_t info)

Not yet documented.

Parameters
info
Returns
Not yet documented.

◆ cd_block_cmd_toc_get()

int cd_block_cmd_toc_get ( uint8_t cd_status,
uint16_t toc_size 
)

Not yet documented.

Parameters
cd_status
toc_size
Returns
Not yet documented.

◆ cd_block_cmd_session_info_get()

int cd_block_cmd_session_info_get ( uint8_t  session_number,
uint8_t cd_status,
uint8_t num_sessions,
uint32_t session_lba 
)

Not yet documented.

Parameters
session_number
cd_status
num_sessions
session_lba
Returns
Not yet documented.

◆ cd_block_cmd_cd_system_init()

int cd_block_cmd_cd_system_init ( int16_t  standby)

Not yet documented.

Parameters
standby
Returns
Not yet documented.

◆ cd_block_cmd_tray_open()

int cd_block_cmd_tray_open ( int16_t  standby)

Not yet documented.

Parameters
standby
Returns
Not yet documented.

◆ cd_block_cmd_data_transfer_end()

int cd_block_cmd_data_transfer_end ( void  )

Not yet documented.

Returns
Not yet documented.

◆ cd_block_cmd_disk_play()

int cd_block_cmd_disk_play ( int32_t  mode,
fad_t  start_fad,
int32_t  num_sectors 
)

Not yet documented.

Parameters
mode
start_fad
num_sectors
Returns
Not yet documented.

◆ cd_block_cmd_disk_seek()

int cd_block_cmd_disk_seek ( uint32_t  start_play_pos)

Not yet documented.

Parameters
start_play_pos
Returns
Not yet documented.

◆ cd_block_cmd_disk_scan()

int cd_block_cmd_disk_scan ( uint8_t  scan_direction,
uint8_t cd_status 
)

Not yet documented.

Parameters
scan_direction
cd_status
Returns
Not yet documented.

◆ cd_block_cmd_subcode_get()

int cd_block_cmd_subcode_get ( uint8_t  type,
uint8_t cd_status,
uint16_t size_in_words,
uint16_t flags 
)

Not yet documented.

Parameters
type
cd_status
size_in_words
flags
Returns
Not yet documented.

◆ cd_block_cmd_cd_dev_connection_set()

int cd_block_cmd_cd_dev_connection_set ( uint8_t  filter)

Not yet documented.

Parameters
filter
Returns
Not yet documented.

◆ cd_block_cmd_cd_dev_connection_get()

int cd_block_cmd_cd_dev_connection_get ( uint8_t cd_status,
uint8_t filter_number 
)

Not yet documented.

Parameters
cd_status
filter_number
Returns
Not yet documented.

◆ cd_block_cmd_last_buffer_destination_get()

int cd_block_cmd_last_buffer_destination_get ( uint8_t cd_status,
uint8_t buffer_number 
)

Not yet documented.

Parameters
cd_status
buffer_number
Returns
Not yet documented.

◆ cd_block_cmd_filter_range_set()

int cd_block_cmd_filter_range_set ( uint8_t  filter,
fad_t  fad,
uint32_t  range 
)

Not yet documented.

Parameters
filter
fad
range
Returns
Not yet documented.

◆ cd_block_cmd_filter_subheader_conditions_set()

int cd_block_cmd_filter_subheader_conditions_set ( uint8_t  channel,
uint8_t  submode_mask,
uint8_t  code_info_mask,
uint8_t  filter_number,
uint8_t  file_id,
uint8_t  sub_mode_val,
uint8_t  code_info_val 
)

Not yet documented.

Parameters
channel
submode_mask
code_info_mask
filter_number
file_id
sub_mode_val
code_info_val
Returns
Not yet documented.

◆ cd_block_cmd_filter_mode_set()

int cd_block_cmd_filter_mode_set ( uint8_t  mode,
uint16_t  filter_number 
)

Not yet documented.

Parameters
mode
filter_number
Returns
Not yet documented.

◆ cd_block_cmd_filter_connection_set()

int cd_block_cmd_filter_connection_set ( uint8_t  conn_number,
uint8_t  true_conn,
uint8_t  false_conn,
uint16_t  filter_number 
)

Not yet documented.

Parameters
conn_number
true_conn
false_conn
filter_number
Returns
Not yet documented.

◆ cd_block_cmd_selector_reset()

int cd_block_cmd_selector_reset ( uint8_t  flags,
uint8_t  sel_number 
)

Not yet documented.

Parameters
flags
sel_number
Returns
Not yet documented.

◆ cd_block_cmd_buffer_size_get()

int cd_block_cmd_buffer_size_get ( uint8_t cd_status,
uint16_t block_free_space,
uint8_t max_selectors,
uint16_t max_blocks 
)

Not yet documented.

Parameters
[in]cd_status
[in]block_free_space
[in]max_selectors
[in]max_blocks
Returns
Not yet documented.

◆ cd_block_cmd_sector_number_get()

int cd_block_cmd_sector_number_get ( uint8_t  buffer_number)

Not yet documented.

Parameters
buffer_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_length_set()

int cd_block_cmd_sector_length_set ( uint8_t  size)

Not yet documented.

Parameters
size
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_get()

int cd_block_cmd_sector_data_get ( uint16_t  sector_offset,
uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
sector_offset
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_delete()

int cd_block_cmd_sector_data_delete ( uint16_t  sector_position,
uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
sector_position
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_get_delete()

int cd_block_cmd_sector_data_get_delete ( uint16_t  offset,
uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
offset
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_put()

int cd_block_cmd_sector_data_put ( uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_copy()

int cd_block_cmd_sector_data_copy ( uint8_t  dst_filter,
uint16_t  sector_offset,
uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
dst_filter
sector_offset
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_sector_data_move()

int cd_block_cmd_sector_data_move ( uint8_t  dst_filter,
uint16_t  sector_offset,
uint8_t  buffer_number,
uint16_t  sector_number 
)

Not yet documented.

Parameters
dst_filter
sector_offset
buffer_number
sector_number
Returns
Not yet documented.

◆ cd_block_cmd_file_abort()

int cd_block_cmd_file_abort ( void  )

Not yet documented.

Returns
Not yet documented.

◆ cd_block_cmd_disk_auth()

int cd_block_cmd_disk_auth ( void  )

Not yet documented.

Returns
Not yet documented.

◆ cd_block_cmd_auth_check()

int cd_block_cmd_auth_check ( uint16_t disk_type_auth)

Not yet documented.

Parameters
disk_type_auth
Returns
Not yet documented.

◆ cd_block_cmd_execute()

int cd_block_cmd_execute ( cd_block_ioregs_t regs,
cd_block_ioregs_t status 
)

Not yet documented.

Parameters
[in]regs
[out]status
Returns
Not yet documented.