1 /* --COPYRIGHT--,EPL
2 * Copyright (c) 2008 Texas Instruments and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Texas Instruments - initial implementation
10 *
11 * --/COPYRIGHT--*/
12 /*
13 * ======== SysUart.xdc ========
14 */
15 import xdc.runtime.Types;
16
17 /*!
18 * ======== SysUart ========
19 * Implementation of ISystemSupport that sends output to a UART
20 *
21 * This module provides an implementation of the `{@link ISystemSupport}`
22 * interface that simply writes each character to the MSP430's UART.
23 */
24 @ModuleStartup
25 @Template("./SysUart.xdt")
26 module SysUart inherits xdc.runtime.ISystemSupport {
27
28 /*!
29 * ======== GetLineFxn ========
30 * Input a single line
31 */
32 typedef Void (*GetLineFxn)(Char[], Int);
33
34 /*!
35 * ======== getLineFxn ========
36 * User suplied character input function
37 *
38 * If this parameter is set to a non-`null` value, the specified
39 * function will be called to input a line of chars received by
40 * `SysUart`.
41 *
42 * For example, if you define a function named `myGetLineFxn`, the
43 * following configuration fragment will cause `SysUart` to call
44 * `myGetLineFxn` whenever a line is received.
45 * @p(code) 46 * var SysUart = xdc.useModule("xdc.runtime.SysUart");
47 * SysUart.getLineFxn = "&myGetLineFxn";
48 * @p 49 *
50 * If this parameter is not set, a default function will be used which
51 * simply drops the input.
52 *
53 * @see #GetLineFxn
54 */
55 config GetLineFxn getLineFxn = null;
56
57 /*!
58 * ======== lineSize ========
59 * The maximum line buffer size
60 *
61 * The maximum number of characters to buffer before calling
62 * `getLineFxn`. If set to zero, no buffering occurs and each
63 * character received triggers `getLineFxn` (if it's defined).
64 */
65 config Int lineSize = 0;
66
67 internal:
68
69 /*!
70 * ======== rxtxInit ========
71 * Initialize peripheral HW at startup
72 */
73 void rxtxInit();
74
75 /*!
76 * ======== tx ========
77 * Transmit one character
78 */
79 void tx(char c);
80
81 /*!
82 * ======== rx ========
83 * Receive one character
84 */
85 void rx(char c);
86
87 config Char lineBuf[];
88
89 struct Module_State {
90 UInt lineIdx;
91 }
92 }