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 * ======== SysUart ========
40 * Implementation of `{@link xdc.runtime.ISystemSupport}` using
41 * ANSI C Standard Library
42 *
43 * This implementation provides a fully functional implementation of
44 * all methods specified by `ISystemSupport`. As with all
45 * `ISystemSupport` modules, this module is the back-end for the
46 * `{@link xdc.runtime.System}` module.
47 *
48 * This implementation relies on the target's runtime support libraries
49 * (i.e. `fflush()` and `putchar()`). Therefore the functions are re-entrant
50 * (thread-safe) if the underlying rts library is re-entrant.
51 */
52 @ModuleStartup
53 module SysUart inherits xdc.runtime.ISystemSupport {
54
55 /*!
56 * UART peripheral base address.
57 *
58 * These enumerations are the base addresses of the different
59 * UART peripherals.
60 */
61 enum Uart {
62 Uart0 = 0x42300000, /*! UART0 Base Address */
63 Uart1 = 0x40A00000, /*! UART1 Base Address */
64 Uart2 = 0x02800000, /*! UART2 Base Address */
65 Uart3 = 0x02810000, /*! UART3 Base Address */
66 Uart4 = 0x02820000 /*! UART4 Base Address */
67 };
68
69 config Ptr uartBaseAddr;
70
71 /*!
72 * ======== abort ========
73 * Backend for `{@link xdc.runtime.System#abort()}`
74 *
75 * This abort function writes the string via `putchar()`
76 * and flushes via `fflush()` to `stdout`.
77 *
78 * @see xdc.runtime.ISystemSupport#abort
79 */
80 override Void abort(CString str);
81
82 /*!
83 * ======== exit ========
84 * Backend for `{@link xdc.runtime.System#exit()}`
85 *
86 * This exit function flushes via `fflush()` to `stdout`.
87 *
88 * @see xdc.runtime.ISystemSupport#exit
89 */
90 override Void exit(Int stat);
91
92 /*!
93 * ======== flush ========
94 * Backend for `{@link xdc.runtime.System#flush()}`
95 *
96 * This flush function flushes via `fflush()` to `stdout`.
97 *
98 * @see xdc.runtime.ISystemSupport#flush
99 */
100 override Void flush();
101
102 /*!
103 * ======== putch ========
104 * Backend for `{@link xdc.runtime.System#printf()}` and `{@link xdc.runtime.System#putch()}`
105 *
106 * This function outputs the character via `putchar()`.
107 *
108 * @see xdc.runtime.ISystemSupport#putch
109 */
110 override Void putch(Char ch);
111
112 /*!
113 * ======== ready ========
114 * Test if character output can proceed
115 *
116 * This always returns TRUE.
117 *
118 * @see xdc.runtime.ISystemSupport#ready
119 */
120 override Bool ready();
121 }