Hello everybody!
I might be asking a stupid question, but I didn't find the answer in any of the posts in here... I've been fiddling around emc_sm.prx, and this is what I found out about sceNandReadId and sceNandLock:
(not standard ANSI C syntax...)
int sceNandReadId(int *id, int len){
//probably the command to send. reading ID?
#define nand_hw_addr1 0xbd101008
//maybe the position to start from.
#define nand_hw_addr2 0xbd10100c
//this might be the reset of the buffer, or anything else...
#define nand_hw_addr3 0xbd101014
//the buffer to read from.
#define nand_hw_addr4 0xbd101300
*nand_hw_addr1 = 0x90;
*nand_hw_addr2 = 0;
if (len <= 0){
*nand_hw_addr3 = 1;
return 0;
}
i = 0;
do{
if(&id == 0) continue;
//read only one byte at a time and store to given buffer.
id[i] = *0xbd101300 & 0xff;
i++;
}while (i<len);
*nand_hw_addr3 = 1;
return 0;
}
Well, my question is, does anyone know what these addresses are for: 0xbd101008, 0xbd10100c, 0xbd101014, 0xbd101300 ? I have made rough guesses as you can see in the comments of the code, but I'm still unsure... :(
Last edited by adrahil on Fri Sep 22, 2006 5:17 pm, edited 1 time in total.
adrahil wrote:Hmm, I'm really blind... I found three of the addresses in groepaz's doc...
0xbd101008 = Command
0xbd101014 = Address
0xbd101300 = Data (read)
However, there is one which is not inside: 0xbd10100c.
Does anybody know what it is for?
0xbd10100c = address;
0xbd101014 != address; 0xbd101014 = end transition (if i don't remember bad)
do{
if (id[0] == 0) continue;
//read only one byte at a time and store to given buffer.
id[i] = *0xbd101300 & 0xff;
i++;
}while (i<len);
Are you sure about id[0] == 0 ? that code must be wrong for it makes no sense to do so : if your id[0] is '\0' you will loop without reading any byte instead of breaking...
for (int i = 0; i<len; ++i)
if ((id[i] = ((*0xbd101300) & 255)) == 0)
break;
Maybe you was not considering delay slot instruction (the instruction following an branch instruction is always executed BEFORE branching), reading that code the wrong way.
Oops, I had a closer look on my source, and I realize I'm missing pretty significant chunks of the callback routine that handles the hardware access. I'll have a look at the psp-doc and see if I can add something though.
Moonlight: do you mean hardware register writing or just using the sceNandWrite syscalls? The latter should be known by know, isn't it?
For hardware way, the controller uses the same commands as descibed in the nand datasheet as far as I recall.
EDIT: Moonlight, here's a NID you seem to be missing for sceNand: 0x3f76bc21 sceNandDumpWearBBMSize
ryoko_no_usagi wrote:Oops, I had a closer look on my source, and I realize I'm missing pretty significant chunks of the callback routine that handles the hardware access. I'll have a look at the psp-doc and see if I can add something though.
Moonlight: do you mean hardware register writing or just using the sceNandWrite syscalls? The latter should be known by know, isn't it?
For hardware way, the controller uses the same commands as descibed in the nand datasheet as far as I recall.
EDIT: Moonlight, here's a NID you seem to be missing for sceNand: 0x3f76bc21 sceNandDumpWearBBMSize
Thanks ryoko. i will add it to the docs :).
I meant hardware register of course :)