| 77 | #endif |
| 78 | |
| 79 | static void eject_insert(u8 eject, u8 insert) |
| 80 | { |
| 81 | u8 atapi_cmnd2[56]; |
| 82 | u8 *atapi_cmnd = atapi_cmnd2; |
| 83 | int dev_id; |
| 84 | |
| 85 | {system_call_4(SC_STORAGE_OPEN, BDVD_DRIVE, 0, (u64)(u32) &dev_id, 0);} |
| 86 | |
| 87 | if(eject) |
| 88 | { |
| 89 | _memset(atapi_cmnd, sizeof(atapi_cmnd2)); |
| 90 | atapi_cmnd[0x00] = 0x1b; // OPERATION CODE (1Bh) |
| 91 | atapi_cmnd[0x01] = 0x01; // IMMED (Immediate) bit |
| 92 | atapi_cmnd[0x04] = 0x02; // LOEJ (2) + START (0) = Eject Disc |
| 93 | atapi_cmnd[0x23] = 0x0c; |
| 94 | |
| 95 | // Eject disc |
| 96 | {system_call_7(SC_STORAGE_INSERT_EJECT, dev_id, 1, (u64)(u32) atapi_cmnd, 56, NULL, 0, NULL);} |
| 97 | |
| 98 | if(insert) sys_ppu_thread_sleep(2); |
| 99 | } |
| 100 | |
| 101 | if(insert) |
| 102 | { |
| 103 | _memset(atapi_cmnd, sizeof(atapi_cmnd2)); |
| 104 | atapi_cmnd[0x00] = 0x1b; // OPERATION CODE (1Bh) |
| 105 | atapi_cmnd[0x01] = 0x01; // IMMED (Immediate) bit |
| 106 | atapi_cmnd[0x04] = 0x03; // LOEJ (2) + START (1) = Load Disc |
| 107 | atapi_cmnd[0x23] = 0x0c; |
| 108 | |
| 109 | // Insert disc |
| 110 | {system_call_7(SC_STORAGE_INSERT_EJECT, dev_id, 1, (u64)(u32) atapi_cmnd, 56, NULL, 0, NULL);} |
| 111 | } |
| 112 | |
| 113 | {system_call_1(SC_STORAGE_CLOSE, dev_id);} |
| 114 | } |
| 115 | |
| 116 | static void usb_keep_awake(u8 sector) |
| 117 | { |
no test coverage detected