53 #ifndef BSP430_SERIAL__H
54 #define BSP430_SERIAL__H
73 #ifndef BSP430_SERIAL_ENABLE_RESOURCE
74 #define BSP430_SERIAL_ENABLE_RESOURCE 0
77 #if defined(BSP430_DOXYGEN) || (BSP430_SERIAL_ENABLE_RESOURCE - 0)
84 #define BSP430_SERIAL_HAL_HPL_VARIANT_USCI 1
89 #define BSP430_SERIAL_HAL_HPL_VARIANT_USCI5 2
94 #define BSP430_SERIAL_HAL_HPL_VARIANT_EUSCIA 3
99 #define BSP430_SERIAL_HAL_HPL_VARIANT_EUSCIB 4
105 #define BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI(hal_) (BSP430_SERIAL_HAL_HPL_VARIANT_USCI == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
110 #define BSP430_SERIAL_HAL_GET_HPL_USCI(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI(hal_)) ? (hal_)->hpl.usci : (void *)0)
113 #define BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI5(hal_) (BSP430_SERIAL_HAL_HPL_VARIANT_USCI5 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
118 #define BSP430_SERIAL_HAL_GET_HPL_USCI5(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI5(hal_)) ? (hal_)->hpl.usci5 : (void *)0)
121 #define BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIA(hal_) (BSP430_SERIAL_HAL_HPL_VARIANT_EUSCIA == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
126 #define BSP430_SERIAL_HAL_GET_HPL_EUSCIA(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIA(hal_)) ? (hal_)->hpl.euscia : (void *)0)
129 #define BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIB(hal_) (BSP430_SERIAL_HAL_HPL_VARIANT_EUSCIB == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
134 #define BSP430_SERIAL_HAL_GET_HPL_EUSCIB(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIB(hal_)) ? (hal_)->hpl.euscib : (void *)0)
143 #define BSP430_SERIAL_HAL_GET_HPLAUX_USCI(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI(hal_)) ? (hal_)->hpl_aux.usci : (void *)0)
148 #define BSP430_SERIAL_HAL_GET_HPLAUX_USCI5(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_USCI5(hal_)) ? (hal_)->hpl_aux.usci5 : (void *)0)
153 #define BSP430_SERIAL_HAL_GET_HPLAUX_EUSCIA(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIA(hal_)) ? (hal_)->hpl_aux.euscia : (void *)0)
158 #define BSP430_SERIAL_HAL_GET_HPLAUX_EUSCIB(hal_) ((BSP430_SERIAL_HAL_HPL_VARIANT_IS_EUSCIB(hal_)) ? (hal_)->hpl_aux.euscib : (void *)0)
179 #ifndef BSP430_SERIAL_SPI_READ_TX_BYTE
180 #define BSP430_SERIAL_SPI_READ_TX_BYTE(i_) (i_)
185 struct sBSP430usciHPLAux;
189 struct sBSP430serialDispatch;
198 #if defined(BSP430_DOXYGEN) || (BSP430_SERIAL_ENABLE_RESOURCE - 0)
245 struct sBSP430usciHPLAux *
usci;
297 #if (BSP430_SERIAL - 0)
299 const struct sBSP430serialDispatch *
const dispatch;
308 struct sBSP430serialDispatch {
309 #if (configBSP430_SERIAL_ENABLE_UART - 0)
311 unsigned char ctl0_byte,
312 unsigned char ctl1_byte,
314 int (* uartRxByte_rh) (hBSP430halSERIAL hal);
315 int (* uartTxByte_rh) (hBSP430halSERIAL hal,
317 int (* uartTxData_rh) (hBSP430halSERIAL hal,
318 const uint8_t * data,
320 int (* uartTxASCIIZ_rh) (hBSP430halSERIAL hal,
const char * str);
322 #if (configBSP430_SERIAL_ENABLE_SPI - 0)
324 unsigned char ctl0_byte,
325 unsigned char ctl1_byte,
326 unsigned int prescaler);
327 int (* spiTxRx_rh) (hBSP430halSERIAL hal,
const uint8_t * tx_data,
size_t tx_len,
size_t rx_len, uint8_t * rx_data);
329 #if (configBSP430_SERIAL_ENABLE_I2C - 0)
331 unsigned char ctl0_byte,
332 unsigned char ctl1_byte,
333 unsigned int prescaler);
334 int (* i2cSetAddresses_rh) (hBSP430halSERIAL hal,
int own_address,
int slave_address);
335 int (* i2cRxData_rh) (hBSP430halSERIAL hal, uint8_t * rx_data,
size_t rx_len);
336 int (* i2cTxData_rh) (hBSP430halSERIAL hal,
const uint8_t * tx_data,
size_t tx_len);
338 int (* setReset_rh) (hBSP430halSERIAL hal,
int resetp);
339 int (* setHold_rh) (hBSP430halSERIAL hal,
int holdp);
340 int (* close) (hBSP430halSERIAL hal);
341 void (* wakeupTransmit_rh) (hBSP430halSERIAL hal);
342 void (* flush_ni) (hBSP430halSERIAL hal);
343 unsigned long (* rate) (hBSP430halSERIAL hal);
volatile struct sBSP430hplUSCI5 * usci5
Definition: serial_.h:219
uint8_t rx_byte
Definition: serial_.h:250
struct sBSP430usciHPLAux * usci
Definition: serial_.h:245
Definition: resource.h:78
Common header included by all BSP430 leaf headers.
const struct sBSP430halISRVoidChainNode *volatile rx_cbchain_ni
Definition: serial_.h:267
volatile struct sBSP430hplEUSCIA * euscia
Definition: serial_.h:222
volatile struct sBSP430hplUSCI * usci
Definition: serial_.h:216
uint8_t tx_byte
Definition: serial_.h:254
Definition: serial_.h:193
unsigned long num_tx
Definition: serial_.h:295
volatile struct sBSP430hplEUSCIB * euscib
Definition: serial_.h:225
unsigned long num_rx
Definition: serial_.h:292
struct sBSP430halSERIAL * hBSP430halSERIAL
Definition: serial_.h:305
union sBSP430halSERIAL::@63 hpl
Generic peripheral support for MSP430 MCUs.
Support for resource management in BSP430.
volatile void * any
Definition: serial_.h:213
const struct sBSP430halISRVoidChainNode *volatile tx_cbchain_ni
Definition: serial_.h:289
struct sBSP430halSERIAL sBSP430halSERIAL
sBSP430hplHALStatePrefix hal_state
Definition: serial_.h:196
sBSP430resource resource
Definition: serial_.h:202
union sBSP430halSERIAL::@64 hpl_aux
void * any
Definition: serial_.h:242