1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: #include <sys/machine.h>
14: #ifdef IOTE_RX231
15:
16: 17: 18: 19:
20:
21: #include "kernel.h"
22: #include <tm/tmonitor.h>
23:
24: #include "sysdepend.h"
25:
26:
27: 28: 29:
30: typedef struct {
31: UW addr;
32: UW data;
33: } T_SETUP_REG;
34:
35: 36: 37:
38: LOCAL const T_SETUP_REG mstop_tbl[] = {
39: { MSTPCRA, MSTPCRA_INI },
40: { MSTPCRB, MSTPCRB_INI },
41: { MSTPCRC, MSTPCRC_INI },
42: { MSTPCRD, MSTPCRD_INI },
43: {0, 0}
44: };
45:
46: 47: 48:
49: LOCAL const T_SETUP_REG pinfnc_tbl[] = {
50: {MPC_PBnPFS(0), 0x0B},
51: {MPC_PBnPFS(1), 0x0B},
52:
53: #if USE_SDEV_DRV
54: {MPC_P1nPFS(6), 0x0F},
55: {MPC_P1nPFS(7), 0x0F},
56: {MPC_P4nPFS(0), 0x80},
57: {MPC_P4nPFS(1), 0x80},
58: {MPC_P4nPFS(2), 0x80},
59: #endif
60:
61: {0, 0}
62: };
63:
64: 65: 66:
67: LOCAL const T_SETUP_REG portmode_tbl[] = {
68: {PORTB_PMR, 0x03},
69:
70: #if USE_SDEV_DRV
71: {PORT1_PMR, 0xC0},
72: {PORT1_ODR1, 0x50},
73: {PORT4_PMR, 0x00},
74: {PORT4_PDR, 0x00},
75: #endif
76:
77: {0, 0}
78: };
79:
80: 81: 82:
83: EXPORT void knl_startup_hw(void)
84: {
85: const T_SETUP_REG *p;
86:
87:
88: out_h(SYSTEM_PRCR, 0xA502);
89: for(p = mstop_tbl; p->addr != 0; p++) {
90: out_w(p->addr, p->data);
91: }
92: out_h(SYSTEM_PRCR, 0xA500);
93:
94:
95: out_b(MPC_PWPR, 0);
96: out_b(MPC_PWPR, MPC_PWMR_PFSWE);
97: for(p = pinfnc_tbl; p->addr != 0; p++) {
98: out_b(p->addr, (UB)p->data);
99: }
100: out_b(MPC_PWPR, MPC_PWMR_B0WI);
101:
102:
103: for(p = portmode_tbl; p->addr != 0; p++) {
104: out_b(p->addr, (UB)p->data);
105: }
106:
107: startup_clock();
108: }
109:
110: #if USE_SHUTDOWN
111: 112: 113:
114: EXPORT void knl_shutdown_hw( void )
115: {
116: disint();
117: shutdown_clock();
118:
119: while(1);
120: }
121: #endif
122:
123: 124: 125: 126: 127: 128:
129: EXPORT ER knl_restart_hw( W mode )
130: {
131: switch(mode) {
132: case -1:
133: SYSTEM_MESSAGE("\n<< SYSTEM RESET & RESTART >>\n");
134: return E_NOSPT;
135: case -2:
136: SYSTEM_MESSAGE("\n<< SYSTEM FAST RESTART >>\n");
137: return E_NOSPT;
138: case -3:
139: SYSTEM_MESSAGE("\n<< SYSTEM RESTART >>\n");
140: return E_NOSPT;
141: default:
142: return E_PAR;
143: }
144: }
145:
146:
147: #endif