blob: 3112d746c7ae9c40d4d2f69855659896181d776b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "ultra64.h"
#include "PR/os_internal_flash.h"
void osFlashReadId(u32* flash_type, u32* flash_maker) {
u8 tmp;
// why read status ?
osFlashReadStatus(&tmp);
// select silicon id read mode
osEPiWriteIo(&__osFlashHandler, __osFlashHandler.baseAddress | FLASH_CMD_REG, FLASH_CMD_ID);
// read silicon id using DMA
__osFlashMsg.hdr.pri = OS_MESG_PRI_NORMAL;
__osFlashMsg.hdr.retQueue = &__osFlashMessageQ;
__osFlashMsg.dramAddr = __osFlashID;
__osFlashMsg.devAddr = 0;
__osFlashMsg.size = 2 * sizeof(u32);
osInvalDCache(__osFlashID, sizeof(__osFlashID));
osEPiStartDma(&__osFlashHandler, &__osFlashMsg, OS_READ);
osRecvMesg(&__osFlashMessageQ, NULL, OS_MESG_BLOCK);
*flash_type = __osFlashID[0];
*flash_maker = __osFlashID[1];
return;
}
|