mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-25 19:36:52 +01:00
Added SuperCard Lite support
This commit is contained in:
parent
1a5766fbd3
commit
c93d8672e1
@ -42,6 +42,9 @@
|
|||||||
|
|
||||||
2006-08-07 - Chishm
|
2006-08-07 - Chishm
|
||||||
* Moved the SD initialization to a common function
|
* Moved the SD initialization to a common function
|
||||||
|
|
||||||
|
2006-08-19 - Chishm
|
||||||
|
* Added SuperCard Lite support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "io_scsd.h"
|
#include "io_scsd.h"
|
||||||
@ -57,6 +60,7 @@
|
|||||||
#define REG_SCSD_DATAWRITE (*(vu16*)(0x09000000))
|
#define REG_SCSD_DATAWRITE (*(vu16*)(0x09000000))
|
||||||
#define REG_SCSD_DATAREAD (*(vu16*)(0x09100000))
|
#define REG_SCSD_DATAREAD (*(vu16*)(0x09100000))
|
||||||
#define REG_SCSD_DATAREAD_32 (*(vu32*)(0x09100000))
|
#define REG_SCSD_DATAREAD_32 (*(vu32*)(0x09100000))
|
||||||
|
#define REG_SCSD_LITE_ENABLE (*(vu16*)(0x09440000))
|
||||||
#define REG_SCSD_LOCK (*(vu16*)(0x09FFFFFE))
|
#define REG_SCSD_LOCK (*(vu16*)(0x09FFFFFE))
|
||||||
/* bit 0: 1 */
|
/* bit 0: 1 */
|
||||||
/* bit 1: enable IO interface (SD,CF) */
|
/* bit 1: enable IO interface (SD,CF) */
|
||||||
@ -87,6 +91,10 @@ static inline void _SCSD_unlock (void) {
|
|||||||
_SC_changeMode (SC_MODE_MEDIA);
|
_SC_changeMode (SC_MODE_MEDIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void _SCSD_enable_lite (void) {
|
||||||
|
REG_SCSD_LITE_ENABLE = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool _SCSD_sendCommand (u8 command, u32 argument) {
|
static bool _SCSD_sendCommand (u8 command, u32 argument) {
|
||||||
u8 databuff[6];
|
u8 databuff[6];
|
||||||
u8 *tempDataPtr = databuff;
|
u8 *tempDataPtr = databuff;
|
||||||
@ -228,6 +236,8 @@ static bool _SCSD_readData (void* buffer) {
|
|||||||
volatile register u32 temp;
|
volatile register u32 temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
_SCSD_enable_lite();
|
||||||
|
|
||||||
i = BUSY_WAIT_TIMEOUT;
|
i = BUSY_WAIT_TIMEOUT;
|
||||||
while ((REG_SCSD_DATAREAD & SCSD_STS_BUSY) && (--i));
|
while ((REG_SCSD_DATAREAD & SCSD_STS_BUSY) && (--i));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@ -329,6 +339,8 @@ bool _SCSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (numSectors--) {
|
while (numSectors--) {
|
||||||
|
_SCSD_enable_lite ();
|
||||||
|
|
||||||
// Calculate the CRC16
|
// Calculate the CRC16
|
||||||
_SD_CRC16 ( data, BYTES_PER_READ, (u8*)crc);
|
_SD_CRC16 ( data, BYTES_PER_READ, (u8*)crc);
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
@ 2006-07-22 - Chishm
|
@ 2006-07-22 - Chishm
|
||||||
@ * First release of stable code
|
@ * First release of stable code
|
||||||
@
|
@
|
||||||
|
@ 2006-08-19 - Chishm
|
||||||
|
@ * Added SuperCard Lite support
|
||||||
|
@
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
.align 4
|
.align 4
|
||||||
@ -86,10 +89,18 @@ _SCSD_writeData_data_loop_unaligned:
|
|||||||
|
|
||||||
@ Write the data to the card
|
@ Write the data to the card
|
||||||
@ 4 halfwords are transmitted to the Supercard at once, for timing purposes
|
@ 4 halfwords are transmitted to the Supercard at once, for timing purposes
|
||||||
@ Only the first halfword needs to contain data
|
@ Only the first halfword needs to contain data for standard SuperCards
|
||||||
|
@ For the SuperCard Lite, the data is split into 4 nibbles, one per halfword
|
||||||
_SCSD_writeData_data_loop:
|
_SCSD_writeData_data_loop:
|
||||||
ldrh r3, [r0], #2
|
ldrh r3, [r0], #2
|
||||||
|
|
||||||
|
@ This bit added for SCLite. Notice that the shift is not the same as in
|
||||||
|
@ the original (buggy) code supplied by Romman
|
||||||
|
add r3, r3, r3, lsl #20
|
||||||
|
mov r4, r3, lsr #8
|
||||||
|
|
||||||
stmia r2, {r3-r4}
|
stmia r2, {r3-r4}
|
||||||
|
|
||||||
subs r5, r5, #2
|
subs r5, r5, #2
|
||||||
bne _SCSD_writeData_data_loop
|
bne _SCSD_writeData_data_loop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user