Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/msp430: reorganize code #19733

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/common/msb-430/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CPU = msp430fxyz
CPU = msp430
CPU_MODEL = msp430f1612
20 changes: 8 additions & 12 deletions boards/msb-430/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq
#define CLOCK_CORECLOCK msp430_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.target_dco_frequency = 7372800U,
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
Expand All @@ -49,7 +49,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -61,14 +61,12 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_BASE (USART_1)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USART_1)
#define UART_SFR (&USART_1_SFR)
#define UART_IE_RX_BIT (1 << 4)
#define UART_IE_TX_BIT (1 << 5)
#define UART_ME (SFR->ME2)
#define UART_ME_BITS (0x30)
#define UART_PORT (PORT_3)
#define UART_PORT (&PORT_3)
#define UART_RX_PIN (1 << 6)
#define UART_TX_PIN (1 << 7)
#define UART_RX_ISR (USART1RX_VECTOR)
Expand All @@ -82,12 +80,10 @@ static const msp430_fxyz_clock_params_t clock_params = {
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_BASE (USART_0)
#define SPI_IE (SFR->IE1)
#define SPI_IF (SFR->IFG1)
#define SPI_BASE (&USART_0)
#define SPI_SFR (&USART_0_SFR)
#define SPI_IE_RX_BIT (1 << 6)
#define SPI_IE_TX_BIT (1 << 7)
#define SPI_ME (SFR->ME1)
#define SPI_ME_BIT (1 << 6)
#define SPI_PIN_MISO GPIO_PIN(P5, 2)
#define SPI_PIN_MOSI GPIO_PIN(P5, 1)
Expand Down
18 changes: 7 additions & 11 deletions boards/msb-430h/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extern "C" {
/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.xt2_frequency = CLOCK_CORECLOCK,
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_XT2CLK,
Expand All @@ -48,7 +48,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -60,14 +60,12 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_BASE (USART_1)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USART_1)
#define UART_SFR (&USART_1_SFR)
#define UART_IE_RX_BIT (1 << 4)
#define UART_IE_TX_BIT (1 << 5)
#define UART_ME (SFR->ME2)
#define UART_ME_BITS (0x30)
#define UART_PORT (PORT_3)
#define UART_PORT (&PORT_3)
#define UART_RX_PIN (1 << 6)
#define UART_TX_PIN (1 << 7)
#define UART_RX_ISR (USART1RX_VECTOR)
Expand All @@ -81,12 +79,10 @@ static const msp430_fxyz_clock_params_t clock_params = {
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_BASE (USART_0)
#define SPI_IE (SFR->IE1)
#define SPI_IF (SFR->IFG1)
#define SPI_BASE (&USART_0)
#define SPI_SFR (&USART_0_SFR)
#define SPI_IE_RX_BIT (1 << 6)
#define SPI_IE_TX_BIT (1 << 7)
#define SPI_ME (SFR->ME1)
#define SPI_ME_BIT (1 << 6)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
#define SPI_PIN_MOSI GPIO_PIN(P3, 1)
Expand Down
2 changes: 1 addition & 1 deletion boards/olimex-msp430-h1611/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CPU = msp430fxyz
CPU = msp430
CPU_MODEL = msp430f1611

# Put defined MCU peripherals here (in alphabetical order)
Expand Down
20 changes: 8 additions & 12 deletions boards/olimex-msp430-h1611/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq
#define CLOCK_CORECLOCK msp430_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.target_dco_frequency = MHZ(8),
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
Expand All @@ -48,7 +48,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -60,14 +60,12 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_BASE (USART_1)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USART_1)
#define UART_SFR (&USART_1_SFR)
#define UART_IE_RX_BIT (1 << 4)
#define UART_IE_TX_BIT (1 << 5)
#define UART_ME (SFR->ME2)
#define UART_ME_BITS (0x30)
#define UART_PORT (PORT_3)
#define UART_PORT (&PORT_3)
#define UART_RX_PIN (1 << 6)
#define UART_TX_PIN (1 << 7)
#define UART_RX_ISR (USART1RX_VECTOR)
Expand All @@ -81,12 +79,10 @@ static const msp430_fxyz_clock_params_t clock_params = {
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_BASE (USART_0)
#define SPI_IE (SFR->IE1)
#define SPI_IF (SFR->IFG1)
#define SPI_BASE (&USART_0)
#define SPI_SFR (&USART_0_SFR)
#define SPI_IE_RX_BIT (1 << 6)
#define SPI_IE_TX_BIT (1 << 7)
#define SPI_ME (SFR->ME1)
#define SPI_ME_BIT (1 << 6)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
#define SPI_PIN_MOSI GPIO_PIN(P3, 1)
Expand Down
2 changes: 1 addition & 1 deletion boards/olimex-msp430-h2618/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CPU = msp430fxyz
CPU = msp430
CPU_MODEL = msp430f2618

# Put defined MCU peripherals here (in alphabetical order)
Expand Down
24 changes: 11 additions & 13 deletions boards/olimex-msp430-h2618/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq
#define CLOCK_CORECLOCK msp430_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.target_dco_frequency = MHZ(16),
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
Expand All @@ -47,7 +47,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -59,15 +59,14 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_USE_USCI
#define UART_BASE (USCI_0)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USCI_A0)
#define UART_IE (IE2)
#define UART_IF (IFG2)
#define UART_IE_RX_BIT (1 << 0)
#define UART_IE_TX_BIT (1 << 1)
#define UART_RX_PORT ((msp_port_t *)PORT_3)
#define UART_RX_PORT (&PORT_3)
#define UART_RX_PIN (1 << 5)
#define UART_TX_PORT ((msp_port_t *)PORT_3)
#define UART_TX_PORT (&PORT_3)
#define UART_TX_PIN (1 << 4)
#define UART_RX_ISR (USCIAB0RX_VECTOR)
#define UART_TX_ISR (USCIAB0TX_VECTOR)
Expand All @@ -80,10 +79,9 @@ static const msp430_fxyz_clock_params_t clock_params = {
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_USE_USCI
#define SPI_BASE (USCI_0_B_SPI)
#define SPI_IE (SFR->IE2)
#define SPI_IF (SFR->IFG2)
#define SPI_BASE (&USCI_B0)
#define SPI_IE (IE2)
#define SPI_IF (IFG2)
#define SPI_IE_RX_BIT (1 << 2)
#define SPI_IE_TX_BIT (1 << 3)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
Expand Down
2 changes: 1 addition & 1 deletion boards/telosb/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CPU = msp430fxyz
CPU = msp430
CPU_MODEL = msp430f1611

# Put defined MCU peripherals here (in alphabetical order)
Expand Down
21 changes: 8 additions & 13 deletions boards/telosb/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq
#define CLOCK_CORECLOCK msp430_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.target_dco_frequency = 2457600U,
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
Expand All @@ -48,7 +48,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -60,14 +60,12 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_BASE (USART_1)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USART_1)
#define UART_SFR (&USART_1_SFR)
#define UART_IE_RX_BIT (1 << 4)
#define UART_IE_TX_BIT (1 << 5)
#define UART_ME (SFR->ME2)
#define UART_ME_BITS (0x30)
#define UART_PORT (PORT_3)
#define UART_PORT (&PORT_3)
#define UART_RX_PIN (1 << 6)
#define UART_TX_PIN (1 << 7)
#define UART_RX_ISR (USART1RX_VECTOR)
Expand All @@ -80,13 +78,10 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_BASE (USART_0)
#define SPI_IE (SFR->IE1)
#define SPI_IF (SFR->IFG1)
#define SPI_BASE (&USART_0)
#define SPI_SFR (&USART_0_SFR)
#define SPI_IE_RX_BIT (1 << 6)
#define SPI_IE_TX_BIT (1 << 7)
#define SPI_ME (SFR->ME1)
#define SPI_ME_BIT (1 << 6)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
#define SPI_PIN_MOSI GPIO_PIN(P3, 1)
Expand Down
2 changes: 1 addition & 1 deletion boards/z1/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CPU = msp430fxyz
CPU = msp430
CPU_MODEL = msp430f2617

# Put defined MCU peripherals here (in alphabetical order)
Expand Down
24 changes: 11 additions & 13 deletions boards/z1/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
extern "C" {
#endif

#define CLOCK_CORECLOCK msp430_fxyz_dco_freq
#define CLOCK_CORECLOCK msp430_dco_freq

/**
* @brief Clock configuration
*/
static const msp430_fxyz_clock_params_t clock_params = {
static const msp430_clock_params_t clock_params = {
.target_dco_frequency = MHZ(8),
.lfxt1_frequency = 32768,
.main_clock_source = MAIN_CLOCK_SOURCE_DCOCLK,
Expand All @@ -48,7 +48,7 @@ static const msp430_fxyz_clock_params_t clock_params = {
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_BASE (TIMER_A)
#define TIMER_BASE (&TIMER_A)
#define TIMER_CHAN (3)
#define TIMER_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER_ISR_CCX (TIMERA1_VECTOR)
Expand All @@ -60,15 +60,14 @@ static const msp430_fxyz_clock_params_t clock_params = {
*/
#define UART_NUMOF (1U)

#define UART_USE_USCI
#define UART_BASE (USCI_0)
#define UART_IE (SFR->IE2)
#define UART_IF (SFR->IFG2)
#define UART_BASE (&USCI_A0)
#define UART_IE (IE2)
#define UART_IF (IFG2)
#define UART_IE_RX_BIT (1 << 0)
#define UART_IE_TX_BIT (1 << 1)
#define UART_RX_PORT ((msp_port_t *)PORT_3)
#define UART_RX_PORT (&PORT_3)
#define UART_RX_PIN (1 << 5)
#define UART_TX_PORT ((msp_port_t *)PORT_3)
#define UART_TX_PORT (&PORT_3)
#define UART_TX_PIN (1 << 4)
#define UART_RX_ISR (USCIAB0RX_VECTOR)
#define UART_TX_ISR (USCIAB0TX_VECTOR)
Expand All @@ -81,10 +80,9 @@ static const msp430_fxyz_clock_params_t clock_params = {
#define SPI_NUMOF (1U)

/* SPI configuration */
#define SPI_USE_USCI
#define SPI_BASE (USCI_0_B_SPI)
#define SPI_IE (SFR->IE2)
#define SPI_IF (SFR->IFG2)
#define SPI_BASE (&USCI_B0)
#define SPI_IE (IE2)
#define SPI_IF (IFG2)
#define SPI_IE_RX_BIT (1 << 2)
#define SPI_IE_TX_BIT (1 << 3)
#define SPI_PIN_MISO GPIO_PIN(P3, 2)
Expand Down
Loading