]> oss.titaniummirror.com Git - tinyos-2.x.git/blob - tos/chips/msp430/usci/HplMsp430UsciReg.nc
msp430 usci: add setIfgTx(), setIfgRx()
[tinyos-2.x.git] / tos / chips / msp430 / usci / HplMsp430UsciReg.nc
1 /*
2 * Copyright (c) 2008, Titanium Mirror, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * - Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * - Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * - Neither the name of the Titanium Mirror, Inc. nor the names
14 * of its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /**
31 * HPL interface to a USCI peripheral device in UART mode.
32 *
33 * @author R. Steve McKown <rsmckown@gmail.com>
34 */
35
36 #include "Msp430Usci.h"
37
38 interface HplMsp430UsciReg {
39 /**
40 * Return the current mode.
41 */
42 async command msp430_usci_mode_t getMode();
43
44 /**
45 * Prepare to set the mode. If the device supports the requested mode, its
46 * UCxxCTL1.UCSWRST bit is set and TRUE is returned. If the device does not
47 * support the requested mode, no operations are performed and FALSE is
48 * returned.
49 *
50 * @param msp430usci_mode_t The desired USCI mode.
51 * @return bool TRUE if the device supports the requested mode, else FALSE.
52 */
53 async command bool setMode(msp430_usci_mode_t mode);
54
55 /**
56 * Get pointer to the UCxxCTL0 register associated with the USCI device.
57 *
58 * @return The pointer to the device's UCxxCTL0 register.
59 */
60 async command volatile uint8_t* ptrCtl0();
61
62 /**
63 * Get bits from the UCxxCTL0 register associated with the USCI device.
64 *
65 * @parm mask The bits upon which the operation is to be performed must be
66 * set in <t>mask</t>.
67 * @return The value of the device's UCxxCTL0 register ANDed with
68 * <t>mask</t>.
69 */
70 async command uint8_t getCtl0(uint8_t mask);
71
72 /**
73 * Set bits in the UCxxCTL0 register associated with the USCI device.
74 * The operation is equivalent to: <t>UCxxCTL0 |= mask</t>.
75 *
76 * @parm mask The bits in set in <t>mask</t> to set in UCxxCTL0.
77 */
78 async command void setCtl0(uint8_t mask);
79
80 /**
81 * Clear bits in the UCxxCTL0 register associated with the USCI device.
82 * The operation is equivalent to: <t>UCxxCTL0 &= ~mask</t>.
83 *
84 * @parm mask The bits in set in <t>mask</t> to clear in UCxxCTL0.
85 */
86 async command void clrCtl0(uint8_t mask);
87
88 /**
89 * Assign the values of the bits in <t>value</t>, whose corresponding bits in
90 * <t>mask</t> are set, in the UCxxCTL0 register. The operation is
91 * equivalent to: <t>UCxxCTL0 = (UCxxCTL0 & ~mask) | (value & mask)</t>.
92 */
93 //async command void assignCtl0(uint8_t mask, uint8_t value);
94 async command void assignCtl0(uint8_t value);
95
96 /**
97 * Manipulate bits in the UCxxCTL1 register. See the methods that manipulate
98 * UCxxCTL0 for more information.
99 */
100 async command volatile uint8_t* ptrCtl1();
101 async command uint8_t getCtl1(uint8_t mask);
102 async command void setCtl1(uint8_t mask);
103 async command void clrCtl1(uint8_t mask);
104 //async command void assignCtl1(uint8_t mask, uint8_t value);
105 async command void assignCtl1(uint8_t value);
106
107 /**
108 * Manipulate bits in the UCxxBR0 register. See the methods that manipulate
109 * UCxxCTL0 for more information.
110 */
111 async command volatile uint8_t* ptrBr0();
112 async command uint8_t getBr0(uint8_t mask);
113 async command void setBr0(uint8_t mask);
114 async command void clrBr0(uint8_t mask);
115 //async command void assignBr0(uint8_t mask, uint8_t value);
116 async command void assignBr0(uint8_t value);
117
118 /**
119 * Manipulate bits in the UCxxBR1 register. See the methods that manipulate
120 * UCxxCTL0 for more information.
121 */
122 async command volatile uint8_t* ptrBr1();
123 async command uint8_t getBr1(uint8_t mask);
124 async command void setBr1(uint8_t mask);
125 async command void clrBr1(uint8_t mask);
126 //async command void assignBr1(uint8_t mask, uint8_t value);
127 async command void assignBr1(uint8_t value);
128
129 /**
130 * Manipulate bits in the UCxxMCTL register. See the methods that manipulate
131 * UCxxCTL0 for more information. These methods perform no operation on
132 * providers implementing a USCI_Bx device.
133 */
134 async command volatile uint8_t* ptrMctl();
135 async command uint8_t getMctl(uint8_t mask);
136 async command void setMctl(uint8_t mask);
137 async command void clrMctl(uint8_t mask);
138 //async command void assignMctl(uint8_t mask, uint8_t value);
139 async command void assignMctl(uint8_t value);
140
141 /**
142 * Manipulate bits in the UCxxI2CIE register. See the methods that
143 * manipulate UCxxCTL0 for more information. These methods perform no
144 * operation on providers implementing a USCI_Ax device.
145 */
146 async command volatile uint8_t* ptrI2Cie();
147 async command uint8_t getI2Cie(uint8_t mask);
148 async command void setI2Cie(uint8_t mask);
149 async command void clrI2Cie(uint8_t mask);
150 //async command void assignI2Cie(uint8_t mask, uint8_t value);
151 async command void assignI2Cie(uint8_t value);
152
153 /**
154 * Manipulate bits in the UCxxSTAT register. See the methods that manipulate
155 * UCxxCTL0 for more information.
156 */
157 async command volatile uint8_t* ptrStat();
158 async command uint8_t getStat(uint8_t mask);
159 async command void setStat(uint8_t mask);
160 async command void clrStat(uint8_t mask);
161 //async command void assignStat(uint8_t mask, uint8_t value);
162 async command void assignStat(uint8_t value);
163
164 /**
165 * Return pointer to the UCAxxRXBUF register used by the USCI device.
166 */
167 async command volatile uint8_t* ptrRxbuf();
168
169 /**
170 * Read the contents of the UCAxxRXBUF register. This register cannot be
171 * written.
172 */
173 async command uint8_t getRxbuf();
174
175 /**
176 * Return pointer to the UCAxxTXBUF register used by the USCI device.
177 */
178 async command volatile uint8_t* ptrTxbuf();
179
180 /**
181 * Read the contents of the UCAxxTXBUF register.
182 */
183 async command uint8_t getTxbuf();
184
185 /**
186 * Write a byte to the UCAxxTXBUF register.
187 */
188 async command void setTxbuf(uint8_t byte);
189
190 /**
191 * Manipulate bits in the UCxxABCTL register. See the methods that
192 * manipulate UCxxCTL0 for more information. These methods perform no
193 * operation on providers implementing a USCI_Bx device.
194 */
195 async command volatile uint8_t* ptrAbctl();
196 async command uint8_t getAbctl(uint8_t mask);
197 async command void setAbctl(uint8_t mask);
198 async command void clrAbctl(uint8_t mask);
199 //async command void assignAbctl(uint8_t mask, uint8_t value);
200 async command void assignAbctl(uint8_t value);
201
202 /**
203 * Manipulate bits in the UCxxIRTCTL register. See the methods that
204 * manipulate UCxxCTL0 for more information. These methods perform no
205 * operation on providers implementing a USCI_Bx device.
206 */
207 async command volatile uint8_t* ptrIrtctl();
208 async command uint8_t getIrtctl(uint8_t mask);
209 async command void setIrtctl(uint8_t mask);
210 async command void clrIrtctl(uint8_t mask);
211 //async command void assignIrtctl(uint8_t mask, uint8_t value);
212 async command void assignIrtctl(uint8_t value);
213
214 /**
215 * Manipulate bits in the UCxxIRRCTL register. See the methods that
216 * manipulate UCxxCTL0 for more information. These methods perform no
217 * operation on providers implementing a USCI_Bx device.
218 */
219 async command volatile uint8_t* ptrIrrctl();
220 async command uint8_t getIrrctl(uint8_t mask);
221 async command void setIrrctl(uint8_t mask);
222 async command void clrIrrctl(uint8_t mask);
223 //async command void assignIrrctl(uint8_t mask, uint8_t value);
224 async command void assignIrrctl(uint8_t value);
225
226 /**
227 * Access to the UCBxI2COA register.
228 */
229 async command volatile uint8_t* ptrI2Coa();
230 async command uint16_t readI2Coa();
231 async command void assignI2Coa(uint16_t addr);
232
233 /**
234 * Access to the UCBxI2SA register.
235 */
236 async command volatile uint8_t* ptrI2Csa();
237 async command uint16_t readI2Csa();
238 async command void assignI2Csa(uint16_t addr);
239
240 /**
241 * Manipulate bits in the UCxxIE register. See the methods that manipulate
242 * UCxxCTL0 for more information.
243 */
244 async command bool getIeRx();
245 async command void setIeRx();
246 async command void clrIeRx();
247 async command bool getIeTx();
248 async command void setIeTx();
249 async command void clrIeTx();
250
251 /**
252 * Manipulate bits in the UCxxIFG register. See the methods that manipulate
253 * UCxxCTL0 for more information.
254 */
255 async command bool getIfgRx();
256 async command void setIfgRx();
257 async command void clrIfgRx();
258 async command bool getIfgTx();
259 async command void setIfgTx();
260 async command void clrIfgTx();
261 }