CPU specific definitions for internal peripheral handling. More...
CPU specific definitions for internal peripheral handling.
Definition in file periph_cpu.h.
#include <stdbool.h>#include "compiler_hints.h"#include "periph_cpu_common.h"#include "macros/units.h" Include dependency graph for periph_cpu.h:
 Include dependency graph for periph_cpu.h:Go to the source code of this file.
| Data Structures | |
| struct | msp430_usart_params_t | 
| MSP430 x1xx USART configuration.  More... | |
| struct | msp430_usart_prescaler_t | 
| MSP430 x1xx USART prescaler configuration.  More... | |
| struct | msp430_usart_conf_t | 
| MSP430 x1xx USART configuration registers.  More... | |
| struct | msp430_usart_uart_params_t | 
| MSP430 x1xx UART configuration, CPU level.  More... | |
| struct | uart_conf_t | 
| UART device configuration.  More... | |
| struct | msp430_usart_spi_params_t | 
| MSP430 x1xx SPI configuration, CPU level.  More... | |
| struct | spi_conf_t | 
| SPI device configuration.  More... | |
| Enumerations | |
| enum | msp430_usart_clk_t { USART_CLK_UCLKI = UXTCTL_SSEL_UCLKI , USART_CLK_AUX = UXTCTL_SSEL_ACLK , USART_CLK_SUBMAIN = UXTCTL_SSEL_SMCLK } | 
| MSP430 x1xx USART clock source.  More... | |
| Functions | |
| static void | msp430_usart_enable_tx_irq (const msp430_usart_params_t *usart_conf) | 
| Enable the TX interrupt on the given USART. | |
| static void | msp430_usart_enable_rx_irq (const msp430_usart_params_t *usart_conf) | 
| Enable the RX interrupt on the given USART. | |
| static void | msp430_usart_disable_tx_irq (const msp430_usart_params_t *usart_conf) | 
| Disable the TX interrupt on the given USART. | |
| static void | msp430_usart_disable_rx_irq (const msp430_usart_params_t *usart_conf) | 
| Disable the RX interrupt on the given USART. | |
| static bool | msp430_usart_get_tx_irq_flag (const msp430_usart_params_t *usart_conf) | 
| Get the TX IRQ flag of the given USART. | |
| static bool | msp430_usart_get_rx_irq_flag (const msp430_usart_params_t *usart_conf) | 
| Get the RX IRQ flag of the given USART. | |
| static bool | msp430_usart_are_both_irq_flags_set (const msp430_usart_params_t *usart_conf) | 
| Check if both TX and RX IRQ flags are set on the given USART. | |
| static void | msp430_usart_clear_tx_irq_flag (const msp430_usart_params_t *usart_conf) | 
| Clear the TX IRQ flag of the given USART. | |
| static void | msp430_usart_clear_rx_irq_flag (const msp430_usart_params_t *usart_conf) | 
| Clear the RX IRQ flag of the given USART. | |
| void | msp430_usart_acquire (const msp430_usart_params_t *params, const msp430_usart_conf_t *conf, uint8_t enable_mask) | 
| Get exclusive access to an USART peripheral and initialize it for operation as configured. | |
| void | msp430_usart_release (const msp430_usart_params_t *params) | 
| Release exclusive access to an USART peripheral and turn it off again. | |
| msp430_usart_prescaler_t | msp430_usart_prescale (uint32_t clock, uint16_t min_br) | 
| Compute a suitable prescaler. | |
| Variables | |
| const msp430_usart_uart_params_t | usart0_as_uart | 
| MSP430 x1xx USART0 in UART configuration. | |
| const msp430_usart_uart_params_t | usart1_as_uart | 
| MSP430 x1xx USART1 in UART configuration. | |
| const msp430_usart_spi_params_t | usart0_as_spi | 
| MSP430 x1xx USART0 in SPI configuration. | |
| const msp430_usart_spi_params_t | usart1_as_spi | 
| MSP430 x1xx USART1 in SPI configuration. | |
| #define | USART_NUMOF 2 | 
| All MSP430 x1xx MCUs have two USART peripherals. | |
| #define | USART_MIN_BR_SPI 2 | 
| The clock divider of the UASRT (BR register) must be at least 2 when in SPI mode. | |
| #define | USART_MIN_BR_UART 3 | 
| The clock divider of the UASRT (BR register) must be at least 3 when in UART mode. | |
| Override SPI mode selection values | |
| #define | HAVE_SPI_MODE_T | 
| MSP430 x1xx has a custom spi_mode_t. | |
| enum | spi_mode_t { SPI_MODE_0 = (CKPH) , SPI_MODE_1 = 0 , SPI_MODE_2 = (CKPL | CKPH) , SPI_MODE_3 = (CKPL) } | 
| Support SPI modes.  More... | |
| Override SPI clock speed selection values | |
| #define | HAVE_SPI_CLK_T | 
| MSP430 x1xx has a custom spi_clock_t. | |
| enum | spi_clk_t { SPI_CLK_100KHZ = KHZ(100) , SPI_CLK_400KHZ = KHZ(400) , SPI_CLK_1MHZ = MHZ(1) , SPI_CLK_5MHZ = MHZ(5) , SPI_CLK_10MHZ = SPI_CLK_5MHZ } | 
| Support SPI clock frequencies.  More... | |
| declare needed generic SPI functions | |
| #define | PERIPH_SPI_NEEDS_INIT_CS | 
| use shared spi_init_cs() | |
| #define | PERIPH_SPI_NEEDS_TRANSFER_BYTE | 
| use shared spi_transfer_byte() | |
| #define | PERIPH_SPI_NEEDS_TRANSFER_REG | 
| use shared spi_transfer_reg() | |
| #define | PERIPH_SPI_NEEDS_TRANSFER_REGS | 
| use shared spi_transfer_regs() | |
| #define HAVE_SPI_CLK_T | 
MSP430 x1xx has a custom spi_clock_t.
Definition at line 70 of file periph_cpu.h.
| #define HAVE_SPI_MODE_T | 
MSP430 x1xx has a custom spi_mode_t.
Definition at line 49 of file periph_cpu.h.
| #define PERIPH_SPI_NEEDS_INIT_CS | 
use shared spi_init_cs()
Definition at line 227 of file periph_cpu.h.
| #define PERIPH_SPI_NEEDS_TRANSFER_BYTE | 
use shared spi_transfer_byte()
Definition at line 228 of file periph_cpu.h.
| #define PERIPH_SPI_NEEDS_TRANSFER_REG | 
use shared spi_transfer_reg()
Definition at line 229 of file periph_cpu.h.
| #define PERIPH_SPI_NEEDS_TRANSFER_REGS | 
use shared spi_transfer_regs()
Definition at line 230 of file periph_cpu.h.
| #define USART_MIN_BR_SPI 2 | 
The clock divider of the UASRT (BR register) must be at least 2 when in SPI mode.
Definition at line 37 of file periph_cpu.h.
| #define USART_MIN_BR_UART 3 | 
The clock divider of the UASRT (BR register) must be at least 3 when in UART mode.
Definition at line 43 of file periph_cpu.h.
| #define USART_NUMOF 2 | 
All MSP430 x1xx MCUs have two USART peripherals.
Definition at line 31 of file periph_cpu.h.
| enum msp430_usart_clk_t | 
MSP430 x1xx USART clock source.
The UC
| Enumerator | |
|---|---|
| USART_CLK_UCLKI | UCLKI clock source (not supported yet) | 
| USART_CLK_AUX | auxiliary clock source | 
| USART_CLK_SUBMAIN | sub-system master clock source | 
Definition at line 103 of file periph_cpu.h.
| enum spi_clk_t | 
Support SPI clock frequencies.
| Enumerator | |
|---|---|
| SPI_CLK_100KHZ | 100 kHz | 
| SPI_CLK_400KHZ | 400 kHz | 
| SPI_CLK_1MHZ | 1 MHz | 
| SPI_CLK_5MHZ | 5 MHz | 
| SPI_CLK_10MHZ | 10 MHz not supported, falling back to 5 MHz | 
Definition at line 74 of file periph_cpu.h.
| enum spi_mode_t | 
Support SPI modes.
| Field | Name | Description | 
|---|---|---|
| CKPH | Clock phase select | 0 = capture on second edge, 1 = capture on first | 
| CKPL | Clock polarity select | 0 = clock is idle-low, 1 = clock is high idle-high | 
| Enumerator | |
|---|---|
| SPI_MODE_0 | CPOL=0, CPHA=0. | 
| SPI_MODE_1 | CPOL=0, CPHA=1. | 
| SPI_MODE_2 | CPOL=1, CPHA=0. | 
| SPI_MODE_3 | CPOL=1, CPHA=1. | 
Definition at line 58 of file periph_cpu.h.
| void msp430_usart_acquire | ( | const msp430_usart_params_t * | params, | 
| const msp430_usart_conf_t * | conf, | ||
| uint8_t | enable_mask ) | 
Get exclusive access to an USART peripheral and initialize it for operation as configured.
| [in] | params | Static USART configuration | 
| [in] | conf | Dynamic USART configuration | 
| [in] | enable_mask | Bitmask to write to the SFR register to enable the peripheral in the intended mode. | 
| 
 | inlinestatic | 
Check if both TX and RX IRQ flags are set on the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
| true | The interrupt flag both TX and RX is set | 
| false | Either TX IRQ flag not set, or RX not set, or neither set | 
Definition at line 313 of file periph_cpu.h.
| 
 | inlinestatic | 
Clear the RX IRQ flag of the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
Definition at line 332 of file periph_cpu.h.
| 
 | inlinestatic | 
Clear the TX IRQ flag of the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
Definition at line 323 of file periph_cpu.h.
| 
 | inlinestatic | 
Disable the RX interrupt on the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
Definition at line 280 of file periph_cpu.h.
| 
 | inlinestatic | 
Disable the TX interrupt on the given USART.
| [in] | usart_conf | USART config of the USART to disable the TX IRQ on | 
Definition at line 267 of file periph_cpu.h.
| 
 | inlinestatic | 
Enable the RX interrupt on the given USART.
| [in] | usart_conf | USART config of the USART to enable the RX IRQ on | 
Definition at line 254 of file periph_cpu.h.
| 
 | inlinestatic | 
Enable the TX interrupt on the given USART.
| [in] | usart_conf | USART config of the USART to enable the TX IRQ on | 
Definition at line 241 of file periph_cpu.h.
| 
 | inlinestatic | 
Get the RX IRQ flag of the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
| true | The interrupt flag is set | 
| false | The interrupt flag is NOT set | 
Definition at line 302 of file periph_cpu.h.
| 
 | inlinestatic | 
Get the TX IRQ flag of the given USART.
| [in] | usart_conf | USART config of the USART to disable the RX IRQ on | 
| true | The interrupt flag is set | 
| false | The interrupt flag is NOT set | 
Definition at line 291 of file periph_cpu.h.
| msp430_usart_prescaler_t msp430_usart_prescale | ( | uint32_t | clock, | 
| uint16_t | min_br ) | 
Compute a suitable prescaler.
| [in] | clock | SPI clock in Hz or UART symbol rate in Baud | 
| [in] | min_br | Smallest BR0/BR1 value supported by hardware (USART_MIN_BR_SPI or USART_MIN_BR_UART) | 
clock. It may generate a frequency higher than requested, if this is closer to the target frequency than the next lower frequency. This makes bit-timings better in UART struct field in the result may be non-zero. Callers must clear this, if the intend to use the USART in modes other than UART. | void msp430_usart_release | ( | const msp430_usart_params_t * | params | ) | 
Release exclusive access to an USART peripheral and turn it off again.
| [in] | params | Configuration specifying the USART to release |