Skip to content

Commit

Permalink
discover dldi allocated space
Browse files Browse the repository at this point in the history
  • Loading branch information
ahezard committed Oct 17, 2016
1 parent be26934 commit ffa565f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dldi/source/dldi_header.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.global word_params
.global words_msg
.global tmp_buf_addr
.global allocated_space
.align 4
.arm

Expand All @@ -28,6 +29,7 @@
.byte 0x01 @ Version number
.byte 0x0d @ 8KiB @ Log [base-2] of the size of this driver in bytes.
.byte FIX_GOT | FIX_BSS | FIX_GLUE | FIX_ALL @ Sections to fix
allocated_space:
.byte 0x00 @ Space allocated in the application, not important here.

@---------------------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions dldi/source/iointerface.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern vu32 words_msg;

// Use the dldi remaining space as temporary buffer : 28k usually available
extern vu32* tmp_buf_addr;
extern vu8 allocated_space;

void sendValue32(u32 value32) {
nocashMessage("sendValue32");
Expand Down Expand Up @@ -137,8 +138,7 @@ bool sd_ReadSectors(sec_t sector, sec_t numSectors,void* buffer) {

//__custom_mpu_setup();

//int max_reads = ((2 ^ io_dldi_data->allocatedSize) / 512) - 11;
int max_reads = MAX_READ;
int max_reads = ((1 << allocated_space) / 512) - 11;

for(int numreads =0; numreads<numSectors; numreads+=max_reads) {
startsector = sector+numreads;
Expand Down Expand Up @@ -177,8 +177,7 @@ bool sd_WriteSectors(sec_t sector, sec_t numSectors,const void* buffer) {

//__custom_mpu_setup();

//int max_reads = ((2 ^ io_dldi_data->allocatedSize) / 512) - 11;
int max_reads = MAX_READ;
int max_reads = ((1 << allocated_space) / 512) - 11;

for(int numreads =0; numreads<numSectors; numreads+=max_reads) {
startsector = sector+numreads;
Expand Down

0 comments on commit ffa565f

Please sign in to comment.