flashreadid.c
1.49 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*---------------------------------------------------------------------
Copyright (C) 1998 Nintendo.
File flash.c
Coded by Atushi Watanabe. Dec 1, 1998.
Modified by Atushi Watanabe. Apr 4, 2000.
Comments 1M Flash ROM access functions(Ver.7.6)
$Id: flashreadid.c,v 1.1.1.1 2002/10/29 08:06:43 blythe Exp $
---------------------------------------------------------------------*/
/**************************************************************************
*
* $Revision: 1.1.1.1 $
* $Date: 2002/10/29 08:06:43 $
* $Source:
*
**************************************************************************/
#include <ultra64.h>
#include "osint_flash.h"
/* READ ID */
void osFlashReadId(u32 *flash_type, u32 *flash_maker)
{
u8 tmp;
/* Read Status */
/* コマンドコンビネーションバグの(2)を回避するためのダミーコマンド */
osFlashReadStatus(&tmp);
/* Set Read ID */
osEPiWriteIo(&__osFlashHandler,(__osFlashHandler.baseAddress|0x10000),0xe1000000);
/* Read ID */
__osFlashMsg.hdr.pri = OS_MESG_PRI_NORMAL;
__osFlashMsg.hdr.retQueue = &__osFlashMessageQ;
__osFlashMsg.dramAddr = &__osFlashID[0];
__osFlashMsg.devAddr = 0;
__osFlashMsg.size = 0x8;
osInvalDCache(&__osFlashID[0], 16);
osEPiStartDma(&__osFlashHandler, &__osFlashMsg, OS_READ);
(void)osRecvMesg(&__osFlashMessageQ, NULL, OS_MESG_BLOCK);
*flash_type = __osFlashID[0];
*flash_maker = __osFlashID[1];
return;
}