source: umon/ports/beagleboneblack/cpuio.c @ a5f94c8

Last change on this file since a5f94c8 was a5f94c8, checked in by Jarielle Catbagan <jcatbagan93@…>, on Jul 3, 2015 at 5:54:49 PM

BBB: Migrate custom exception handler mapping from rom_reset.S to ram_vector_install() in cpuio.c

  • Property mode set to 100644
File size: 3.5 KB
Line 
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
9int
10getUartDivisor(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 */
21void
22devInit(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
35ConsoleBaudSet(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
49target_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 */
60ulong
61intsoff(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 */
73void
74intsrestore(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 */
90void
91cacheInitForTarget(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 */
102void
103target_reset(void)
104{
105//      flushDcache(0,0);
106//      disableDcache();
107//      invalidateIcache(0,0);
108//      disableIcache();
109        monrestart(INITIALIZE);
110}
111
112/* Override the default exception handlers provided by the AM335x
113 * internal ROM code with uMon's custom exception handlers
114 */
115void
116ram_vector_install(void)
117{
118        extern unsigned long abort_data;
119        extern unsigned long abort_prefetch;
120        extern unsigned long undefined_instruction;
121        extern unsigned long software_interrupt;
122        extern unsigned long interrupt_request;
123        extern unsigned long fast_interrupt_request;
124        extern unsigned long not_assigned;
125
126        *(ulong **)0x4030ce24 = &undefined_instruction;
127        *(ulong **)0x4030ce28 = &software_interrupt;
128        *(ulong **)0x4030ce2c = &abort_prefetch;
129        *(ulong **)0x4030ce30 = &abort_data;
130        *(ulong **)0x4030ce34 = &not_assigned;
131        *(ulong **)0x4030ce38 = &interrupt_request;
132        *(ulong **)0x4030ce3c = &fast_interrupt_request;
133}
134
135/* If any CPU IO wasn't initialized in reset.S, do it here...
136 * This just provides a "C-level" IO init opportunity.
137 */
138void
139initCPUio(void)
140{
141        ram_vector_install();
142}
Note: See TracBrowser for help on using the repository browser.