Skip to content

Commit

Permalink
ez5n: finish moving to common libtwl_ext functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lifehackerhansol committed Nov 6, 2024
1 parent b9325b5 commit 528a8f6
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions blocksds/source/platform/ez5n/ez5n.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@
static u32 EZ5N_ReadLengthCtrlValues[4] = {EZ5N_CTRL_READ_SD_512, EZ5N_CTRL_READ_SD_1024,
EZ5N_CTRL_READ_SD_2048, EZ5N_CTRL_READ_SD_2048};

static inline void EZ5N_ReadCardData(u64 command, u32 flags, void* buffer, u32 length) {
card_romSetCmd(command);
card_romStartXfer(flags, false);
if ((u32)buffer & 3)
card_romCpuReadUnaligned((u8*)buffer, length);
else
card_romCpuRead(buffer, length);
}

static inline void EZ5N_WriteCardData(u64 command, u32 flags, const void* buffer, u32 length) {
card_romSetCmd(command);
card_romStartXfer(flags, false);
if ((u32)buffer & 3)
card_romCpuWriteUnaligned((u8*)buffer, length);
else
card_romCpuWrite(buffer, length);
}

static inline u32 EZ5N_SendCommand(const u64 command, u32 latency) {
return cardExt_ReadData4Byte(command, (EZ5N_CTRL_SEND_CMD | MCCNT1_LATENCY1(latency)));
}
Expand Down Expand Up @@ -68,7 +50,7 @@ void EZ5N_SDWriteSectors(u32 sector, u32 num_sectors, const void* buffer) {

// Write to buffer
for (u32 i = 0; i < sector_count; i++) {
EZ5N_WriteCardData(EZ5N_CMD_SD_WRITE_BUFFER(i), (EZ5N_CTRL_WRITE_SD | MCCNT1_LEN_512),
cardExt_WriteData(EZ5N_CMD_SD_WRITE_BUFFER(i), (EZ5N_CTRL_WRITE_SD | MCCNT1_LEN_512),
buffer, 128);
buffer = (u8*)buffer + 0x200;
}
Expand Down

0 comments on commit 528a8f6

Please sign in to comment.