#105082 - Lick - Thu Oct 05, 2006 8:38 pm
The following code is a modified version of Stephen (sgstair)'s Read_Flash() function. The modification is that I'm trying to use the FAST instruction instead of the READ instruction. (For info, here.)
The code does not work as wanted, but my question is, does the DS support this instruction at all? Libnds seems to have excluded it from the #defines.
http://rafb.net/paste/results/JTJvtN50.html
_________________
http://licklick.wordpress.com
Last edited by Lick on Sun Oct 08, 2006 3:43 pm; edited 2 times in total
The code does not work as wanted, but my question is, does the DS support this instruction at all? Libnds seems to have excluded it from the #defines.
http://rafb.net/paste/results/JTJvtN50.html
Code: |
void Read_FlashFast(int address, char * destination, int length) {
int i; int dummy = 0; while(REG_SPICNT&0x80); REG_SPICNT=0x8900; REG_SPIDATA=0x0B; // fast read while(REG_SPICNT&0x80); // 3 times REG_SPIDATA=(address>>16)&255; while(REG_SPICNT&0x80); REG_SPIDATA=(address>>8)&255; while(REG_SPICNT&0x80); REG_SPIDATA=(address)&255; while(REG_SPICNT&0x80); // dummy REG_SPIDATA=(dummy)&255; while(REG_SPICNT&0x80); for(i=0;i<length;i++) { REG_SPIDATA=0; while(REG_SPICNT&0x80); destination[i]=REG_SPIDATA; } REG_SPICNT=0; } |
_________________
http://licklick.wordpress.com
Last edited by Lick on Sun Oct 08, 2006 3:43 pm; edited 2 times in total