init.c
1.07 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "ddwriteint.h"
/*
* Static variables
*/
static OSMesg diskQBuf;
#define NUM_CMD_MSGS 8
static OSMesg cmdQBuf[8];
static char buffer1[240 * SECPERBLOCK + 15];
static char buffer2[240 * SECPERBLOCK + 15];
/*
* Global variables
*/
OSMesgQueue __ddDiskQ; /* post queue */
void *__ddBufp1;
void *__ddBufp2;
u32 __ddWriteActive = 0;
s32 __ddWriteError = 0;
/*
* ddWrite, ddGetInfo に必要な初期化をする。
* 1回だけでよい。
*/
void __ddInit(void)
{
LEOError error;
__ddWriteActive = 1;
__ddBufp1 = OS_DCACHE_ROUNDUP_ADDR((void *)buffer1);
__ddBufp2 = OS_DCACHE_ROUNDUP_ADDR((void *)buffer2);
osCreateMesgQueue(&__ddDiskQ, &diskQBuf, 1);
error = (LEOError)LeoCreateLeoManager((OSPri)OS_PRIORITY_LEOMGR-1,
(OSPri)OS_PRIORITY_LEOMGR,
cmdQBuf, NUM_CMD_MSGS);
if (error == LEO_ERROR_DEVICE_COMMUNICATION_FAILURE)
{
__ddWriteError = (s32)error;
return;
}
LEO_country_code = 0;
SAVE_COUNTRY(0); /* paranoia */
/*
* Clear "reset" flag.
*/
LeoResetClear();
__ddWriteError = (s32)0;
return;
} /* __ddInit() */