MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / sys_command_cd_read

Function sys_command_cd_read

src/blkdev.cpp:961–982  ·  view source on GitHub ↗

read one cd sector */

Source from the content-addressed store, hash-verified

959
960/* read one cd sector */
961int sys_command_cd_read (int unitnum, uae_u8 *data, int block, int size)
962{
963 int v;
964 if (failunit (unitnum))
965 return 0;
966 if (!getsem (unitnum))
967 return 0;
968 if (state[unitnum].device_func->read == NULL) {
969 uae_u8 cmd1[12] = { 0x28, 0, (uae_u8)(block >> 24), (uae_u8)(block >> 16), (uae_u8)(block >> 8), (uae_u8)(block >> 0), 0, (uae_u8)(size >> 8), (uae_u8)(size >> 0), 0, 0, 0 };
970 v = do_scsi (unitnum, cmd1, sizeof cmd1, data, size * 2048);
971#if 0
972 if (!v) {
973 uae_u8 cmd2[12] = { 0xbe, 0, block >> 24, block >> 16, block >> 8, block >> 0, size >> 16, size >> 8, size >> 0, 0x10, 0, 0 };
974 v = do_scsi (unitnum, cmd2, sizeof cmd2, data, size * 2048);
975 }
976#endif
977 } else {
978 v = state[unitnum].device_func->read (unitnum, data, block, size);
979 }
980 freesem (unitnum);
981 return v;
982}
983int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int sectorsize)
984{
985 int v;

Callers 6

command_cd_readFunction · 0.85
getunitinfoFunction · 0.85
sys_command_infoFunction · 0.85
dma_do_threadFunction · 0.85
cdtvcr_read_dataFunction · 0.85
sb_breadFunction · 0.85

Calls 5

failunitFunction · 0.85
getsemFunction · 0.85
do_scsiFunction · 0.85
freesemFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected