[dee5246] | 1 | #include "config.h" |
---|
[11c6677] | 2 | #include "stddefs.h" |
---|
[dee5246] | 3 | #include "cpuio.h" |
---|
| 4 | #include "genlib.h" |
---|
[11c6677] | 5 | #include "cache.h" |
---|
[dee5246] | 6 | #include "warmstart.h" |
---|
[11c6677] | 7 | #include "timer.h" |
---|
[dee5246] | 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 | |
---|
[11c6677] | 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 |
---|
[dee5246] | 22 | devInit(int baud) |
---|
| 23 | { |
---|
[11c6677] | 24 | /* ADD_CODE_HERE */ |
---|
[dee5246] | 25 | } |
---|
| 26 | |
---|
[11c6677] | 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. |
---|
[dee5246] | 33 | */ |
---|
[11c6677] | 34 | /*int |
---|
| 35 | ConsoleBaudSet(int baud) |
---|
[dee5246] | 36 | { |
---|
[11c6677] | 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) |
---|
[dee5246] | 50 | { |
---|
[11c6677] | 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. |
---|
[dee5246] | 59 | */ |
---|
[11c6677] | 60 | ulong |
---|
| 61 | intsoff(void) |
---|
[dee5246] | 62 | { |
---|
[d6c7226] | 63 | ulong status = 0; |
---|
[dee5246] | 64 | |
---|
[11c6677] | 65 | /* ADD_CODE_HERE */ |
---|
| 66 | return(status); |
---|
[dee5246] | 67 | } |
---|
| 68 | |
---|
[11c6677] | 69 | /* intsrestore(): |
---|
| 70 | * Re-establish system interrupts here by using the status value |
---|
| 71 | * that was returned by an earlier call to intsoff(). |
---|
| 72 | */ |
---|
[dee5246] | 73 | void |
---|
[11c6677] | 74 | intsrestore(ulong status) |
---|
[dee5246] | 75 | { |
---|
[11c6677] | 76 | /* ADD_CODE_HERE */ |
---|
[dee5246] | 77 | } |
---|
| 78 | |
---|
[11c6677] | 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. |
---|
[dee5246] | 89 | */ |
---|
[11c6677] | 90 | void |
---|
| 91 | cacheInitForTarget(void) |
---|
[dee5246] | 92 | { |
---|
[11c6677] | 93 | /* ADD_CODE_HERE */ |
---|
[dee5246] | 94 | } |
---|
| 95 | |
---|
[11c6677] | 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... |
---|
[dee5246] | 101 | */ |
---|
| 102 | void |
---|
[11c6677] | 103 | target_reset(void) |
---|
[dee5246] | 104 | { |
---|
[11c6677] | 105 | // flushDcache(0,0); |
---|
| 106 | // disableDcache(); |
---|
| 107 | // invalidateIcache(0,0); |
---|
| 108 | // disableIcache(); |
---|
| 109 | monrestart(INITIALIZE); |
---|
[dee5246] | 110 | } |
---|
| 111 | |
---|
[11c6677] | 112 | /* If any CPU IO wasn't initialized in reset.S, do it here... |
---|
| 113 | * This just provides a "C-level" IO init opportunity. |
---|
[dee5246] | 114 | */ |
---|
| 115 | void |
---|
[11c6677] | 116 | initCPUio(void) |
---|
[dee5246] | 117 | { |
---|
[11c6677] | 118 | /* ADD_CODE_HERE */ |
---|
[dee5246] | 119 | } |
---|