1 | #include "config.h" |
---|
2 | #include "stddefs.h" |
---|
3 | #include "cpuio.h" |
---|
4 | #include "genlib.h" |
---|
5 | #include "cache.h" |
---|
6 | #include "warmstart.h" |
---|
7 | #include "timer.h" |
---|
8 | |
---|
9 | int |
---|
10 | getUartDivisor(int baud, unsigned char *hi, unsigned char *lo) |
---|
11 | { |
---|
12 | *lo = ((48000000/16)/baud) & 0x00ff; |
---|
13 | *hi = (((48000000/16)/baud) & 0xff00) >> 8; |
---|
14 | return(0); |
---|
15 | } |
---|
16 | |
---|
17 | /* devInit(): |
---|
18 | * As a bare minimum, initialize the console UART here using the |
---|
19 | * incoming 'baud' value as the baud rate. |
---|
20 | */ |
---|
21 | void |
---|
22 | devInit(int baud) |
---|
23 | { |
---|
24 | /* ADD_CODE_HERE */ |
---|
25 | } |
---|
26 | |
---|
27 | /* ConsoleBaudSet(): |
---|
28 | * Provide a means to change the baud rate of the running |
---|
29 | * console interface. If the incoming value is not a valid |
---|
30 | * baud rate, then default to 9600. |
---|
31 | * In the early stages of a new port this can be left empty. |
---|
32 | * Return 0 if successful; else -1. |
---|
33 | */ |
---|
34 | /*int |
---|
35 | ConsoleBaudSet(int baud) |
---|
36 | { |
---|
37 | // ADD_CODE_HERE |
---|
38 | return(0); |
---|
39 | }*/ |
---|
40 | |
---|
41 | /* target_console_empty(): |
---|
42 | * Target-specific portion of flush_console() in chario.c. |
---|
43 | * This function returns 1 if there are no characters waiting to |
---|
44 | * be put out on the UART; else return 0 indicating that the UART |
---|
45 | * is still busy outputting characters from its FIFO. |
---|
46 | * In the early stages of a new port this can simply return 1. |
---|
47 | */ |
---|
48 | /*int |
---|
49 | target_console_empty(void) |
---|
50 | { |
---|
51 | // if (UART_OUTPUT_BUFFER_IS_EMPTY()) <- FIX CODE HERE |
---|
52 | return(0); |
---|
53 | return(1); |
---|
54 | }*/ |
---|
55 | |
---|
56 | /* intsoff(): |
---|
57 | * Disable all system interrupts here and return a value that can |
---|
58 | * be used by intsrestore() (later) to restore the interrupt state. |
---|
59 | */ |
---|
60 | ulong |
---|
61 | intsoff(void) |
---|
62 | { |
---|
63 | ulong status = 0; |
---|
64 | |
---|
65 | /* ADD_CODE_HERE */ |
---|
66 | return(status); |
---|
67 | } |
---|
68 | |
---|
69 | /* intsrestore(): |
---|
70 | * Re-establish system interrupts here by using the status value |
---|
71 | * that was returned by an earlier call to intsoff(). |
---|
72 | */ |
---|
73 | void |
---|
74 | intsrestore(ulong status) |
---|
75 | { |
---|
76 | /* ADD_CODE_HERE */ |
---|
77 | } |
---|
78 | |
---|
79 | /* cacheInitForTarget(): |
---|
80 | * Establish target specific function pointers and |
---|
81 | * enable i-cache... |
---|
82 | * Refer to $core/cache.c for a description of the function pointers. |
---|
83 | * NOTE: |
---|
84 | * If cache (either I or D or both) is enabled, then it is important |
---|
85 | * that the appropriate cacheflush/invalidate function be established. |
---|
86 | * This is very important because programs (i.e. cpu instructions) are |
---|
87 | * transferred to memory using data memory accesses and could |
---|
88 | * potentially result in cache coherency problems. |
---|
89 | */ |
---|
90 | void |
---|
91 | cacheInitForTarget(void) |
---|
92 | { |
---|
93 | /* ADD_CODE_HERE */ |
---|
94 | } |
---|
95 | |
---|
96 | /* target_reset(): |
---|
97 | * The default (absolute minimum) action to be taken by this function |
---|
98 | * is to call monrestart(INITIALIZE). It would be better if there was |
---|
99 | * some target-specific function that would really cause the target |
---|
100 | * to reset... |
---|
101 | */ |
---|
102 | void |
---|
103 | target_reset(void) |
---|
104 | { |
---|
105 | // flushDcache(0,0); |
---|
106 | // disableDcache(); |
---|
107 | // invalidateIcache(0,0); |
---|
108 | // disableIcache(); |
---|
109 | monrestart(INITIALIZE); |
---|
110 | } |
---|
111 | |
---|
112 | /* If any CPU IO wasn't initialized in reset.S, do it here... |
---|
113 | * This just provides a "C-level" IO init opportunity. |
---|
114 | */ |
---|
115 | void |
---|
116 | initCPUio(void) |
---|
117 | { |
---|
118 | /* ADD_CODE_HERE */ |
---|
119 | } |
---|