-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
220 lines (194 loc) · 3.53 KB
/
main.c
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*
* Copyright (c) 2015-2021, Renesas Electronics Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "common.h"
#include "main.h"
#include "dgtable.h"
#include "bit.h"
#include "cpudrv.h"
#if EMMC == 1
#include "dgemmc.h"
#endif /* EMMC == 1 */
#include "scifdrv.h"
#include "devdrv.h"
#include "rpcqspidrv.h"
#include "dgmodul1.h"
#include "dgmodul4.h"
#include "tzc_400.h"
#include "mmio.h"
#include "cpg.h"
#include "pfc.h"
#include "syc.h"
#include "ddr.h"
#include "sysc.h"
#define RZG2L_DEVID (0x841C447)
#define RZV2L_DEVID (0x8447447)
#define RZG2UL_DEVID (0x8450447)
extern const char *const StartMessMonitorG2[START_MESS_MON_LINE];
extern const char *const StartMessMonitorV2[START_MESS_MON_LINE];
extern const char *const StartMessMonitorA[START_MESS_MON_LINE];
extern const com_menu MonCom[COMMAND_UNIT];
extern uint8_t gCOMMAND_Area[COMMAND_BUFFER_SIZE];
char gKeyBuf[64];
int32_t gComNo;
extern uintptr_t gUDump[3];
extern uintptr_t gUMem[3];
extern uint32_t gDumpMode;
uint32_t gDumpStatus;
#define RZG2L_SYC_INCK_HZ (24000000)
void Main(void)
{
uint32_t readDevId;
init_tzc_400_spimulti();
/* early setup Clock and Reset */
cpg_early_setup();
/* initialize SYC */
syc_init(RZG2L_SYC_INCK_HZ);
/* setup PFC */
pfc_setup();
/* setup Clock and Reset */
cpg_setup();
udelay(100);
#if (INTERNAL_MEMORY_ONLY == 0)
ddr_setup();
#endif
gUDump[0] = gUMem[0] = 0;
gUDump[1] = gUMem[1] = 255;
gDumpMode = SIZE_8BIT;
gDumpStatus = DISABLE;
#if SERIAL_FLASH == 1
InitRPC_Mode();
ReadQspiFlashID(&readDevId); /* dummy */
#endif
InitMain();
StartMess();
DecCom();
}
void InitMain(void)
{
#if EMMC == 1
dg_init_emmc();
#endif /* EMMC == 1 */
}
void StartMess( void )
{
unsigned int devceid;
devceid = sysc_get_device_id();
PutStr(" ",1);
switch(devceid)
{
case RZG2L_DEVID:
PutMess(StartMessMonitorG2);
PutStr(" Product Code : ", 0);
#if (RZG2L == 1)
PutStr("RZ/G2L" ,1);
#endif
#if (RZG2LC == 1)
PutStr("RZ/G2LC" ,1);
#endif
break;
case RZV2L_DEVID:
PutMess(StartMessMonitorV2);
PutStr(" Product Code : ", 0);
PutStr("RZ/V2L" ,1);
break;
case RZG2UL_DEVID:
#if (RZA3UL == 1)
PutMess(StartMessMonitorA);
PutStr(" Product Code : ", 0);
PutStr("RZ/A3UL" ,1);
#else
PutMess(StartMessMonitorG2);
PutStr(" Product Code : ", 0);
#if (DEVICE_TYPE == 1)
PutStr("RZ/G2UL Type1" ,1);
#else
PutStr("RZ/G2UL Type2" ,1);
#endif
#endif
break;
default:
break;
}
PutStr(">", 0);
}
void DecCom(void)
{
char tmp[64], chCnt, chPtr;
uint32_t rtn = 0;
uint32_t res;
chCnt = 1;
while (rtn == 0)
{
if (rtn == 0)
{
rtn = SCIF_TerminalInputCheck(gKeyBuf);
}
if (0 < rtn)
{
if (gKeyBuf[0] == CR_CODE)
{
PutChar(LF_CODE);
PutChar(CR_CODE);
PutStr(">", 0);
chCnt = 0;
}
else if (gKeyBuf[0] != LF_CODE)
{
PutChar(gKeyBuf[0]);
}
}
}
while(1)
{
GetStr(gKeyBuf+chCnt,&chCnt);
chPtr = 0;
GetStrBlk(gKeyBuf,tmp,&chPtr,0);
if (chPtr != 1)
{
ChgLtl2Lrg(tmp);
if (!CmpCom(tmp))
{
(MonCom[gComNo].comProg)();
}
else
{
PutStr("command not found",1);
}
}
PutStr(">",0);
chCnt = 0;
}
}
long CmpCom(char *str)
{
char *cmpStr, *tmpStr, err;
gComNo = 0;
while(TBL_END != MonCom[gComNo].comStr)
{
err=0;
tmpStr = str;
cmpStr = MonCom[gComNo].comStr;
while(*tmpStr!=0)
{
if (*tmpStr == *cmpStr)
{
tmpStr++;
cmpStr++;
}
else
{
err = 1;
break;
}
}
if ((!err) && (*cmpStr == 0))
{
return(0);
}
gComNo++;
}
return(1);
}