CPU specific definitions for internal peripheral handling. More...
CPU specific definitions for internal peripheral handling.
Definition in file periph_cpu_common.h.
#include <stdbool.h>
#include "bitarithm.h"
#include "compiler_hints.h"
#include "cpu.h"
#include "msp430_regs.h"
Go to the source code of this file.
Data Structures | |
struct | msp430_clock_params_t |
MSP430Fxzy Basic Clock System Parameters. More... | |
struct | timer_conf_t |
Timer device configuration. More... | |
Macros | |
#define | GPIO_UNDEF (0xffff) |
Definition of a fitting UNDEF value. | |
#define | GPIO_PIN(x, y) ((gpio_t)(((x & 0xff) << 8) | (1 << (y & 0x07)))) |
Mandatory function for defining a GPIO pins. | |
#define | SPI_HWCS(x) (SPI_CS_UNDEF) |
No support for HW chip select... | |
#define | TIMER_CHANNEL_NUMOF 7 |
The MSP430 timer peripheral can have up to 8 channels. | |
#define | RAMSTART 0x200 |
Lowest address of the RAM, peripherals are below. | |
Functions | |
void | gpio_periph_mode (gpio_t pin, bool enable) |
Enable or disable a pin to be used by peripheral modules. | |
void | default_clock_init (void) |
Initialize the basic clock system to provide the main clock, the subsystem clock, and the auxiliary clock. | |
void | clock_init (void) |
Call during boot up process to initialize the clock. | |
uint32_t PURE | msp430_submain_clock_freq (void) |
Get the configured submain clock frequency. | |
uint32_t PURE | msp430_auxiliary_clock_freq (void) |
Get the configured auxiliary clock frequency. | |
void | msp430_clock_acquire (msp430_clock_t clock) |
Increase the refcount of the given clock. | |
void | msp430_clock_release (msp430_clock_t clock) |
Decrease the refcount of the subsystem main clock. | |
Variables | |
uint32_t | msp430_dco_freq |
The measured DCO frequency. | |
#define | HAVE_GPIO_T |
Define a custom type for GPIO pins. | |
typedef uint16_t | gpio_t |
Override flank selection values | |
#define | HAVE_GPIO_FLANK_T |
MSP430 has a custom gpio_flank_t. | |
enum | gpio_flank_t { GPIO_FALLING = 0xff , GPIO_RISING = 0x00 , GPIO_BOTH = 0xab } |
Enumeration of supported GPIO flanks. More... | |
MSP430 Common Peripheral Register Maps | |
The addresses will be provided by the linker script using the vendor files. | |
msp430_port_p1_p2_t | PORT_1 |
Register map of GPIO PORT 1. | |
msp430_port_p1_p2_t | PORT_2 |
Register map of GPIO PORT 2. | |
msp430_port_p3_p6_t | PORT_3 |
Register map of GPIO PORT 3. | |
msp430_port_p3_p6_t | PORT_4 |
Register map of GPIO PORT 4. | |
msp430_port_p3_p6_t | PORT_5 |
Register map of GPIO PORT 5. | |
msp430_port_p3_p6_t | PORT_6 |
Register map of GPIO PORT 6. | |
msp430_timer_t | TIMER_A |
Register map of the timer A control registers. | |
REG16 | TIMER_A_IRQFLAGS |
IRQ flags for TIMER_A. | |
REG16 | TIMER_B_IRQFLAGS |
IRQ flags for TIMER_B. | |
msp430_timer_t | TIMER_B |
Register map of the timer B control registers. | |
#define GPIO_PIN | ( | x, | |
y | |||
) | ((gpio_t)(((x & 0xff) << 8) | (1 << (y & 0x07)))) |
Mandatory function for defining a GPIO pins.
Definition at line 49 of file periph_cpu_common.h.
#define GPIO_UNDEF (0xffff) |
Definition of a fitting UNDEF value.
Definition at line 44 of file periph_cpu_common.h.
#define HAVE_GPIO_FLANK_T |
MSP430 has a custom gpio_flank_t.
Definition at line 76 of file periph_cpu_common.h.
#define HAVE_GPIO_T |
Define a custom type for GPIO pins.
Definition at line 37 of file periph_cpu_common.h.
#define RAMSTART 0x200 |
Lowest address of the RAM, peripherals are below.
Definition at line 70 of file periph_cpu_common.h.
#define SPI_HWCS | ( | x | ) | (SPI_CS_UNDEF) |
No support for HW chip select...
Definition at line 54 of file periph_cpu_common.h.
#define TIMER_CHANNEL_NUMOF 7 |
The MSP430 timer peripheral can have up to 8 channels.
Definition at line 65 of file periph_cpu_common.h.
typedef uint16_t gpio_t |
Definition at line 38 of file periph_cpu_common.h.
anonymous enum |
Available ports on MSP430 platforms.
Enumerator | |
---|---|
P1 | PORT 1. |
P2 | PORT 2. |
P3 | PORT 3. |
P4 | PORT 4. |
P5 | PORT 5. |
P6 | PORT 6. |
Definition at line 90 of file periph_cpu_common.h.
enum gpio_flank_t |
Enumeration of supported GPIO flanks.
Enumerator | |
---|---|
GPIO_FALLING | emit interrupt on falling flank |
GPIO_RISING | emit interrupt on rising flank |
GPIO_BOTH | not supported -> random value |
Definition at line 80 of file periph_cpu_common.h.
Clock dividers for the auxiliary clock.
Definition at line 250 of file periph_cpu_common.h.
enum msp430_clock_t |
IDs of the different clock domains on the MSP430.
These can be used as internal clock sources for peripherals
Enumerator | |
---|---|
MSP430_CLOCK_SUBMAIN | Subsystem main clock. |
MSP430_CLOCK_AUXILIARY | Auxiliary clock. |
MSP430_CLOCK_NUMOF | Number of clock domains. |
Definition at line 360 of file periph_cpu_common.h.
Clock dividers for the main clock.
Definition at line 206 of file periph_cpu_common.h.
Possible clock sources to generate the main clock from.
Enumerator | |
---|---|
MAIN_CLOCK_SOURCE_DCOCLK | Internal digitally controlled oscillator (DCO) with RC-type characteristics. |
MAIN_CLOCK_SOURCE_XT2CLK | High frequency crystal between 450 kHz and 8 MHz.
|
MAIN_CLOCK_SOURCE_LFXT1CLK | Low frequency 32.768 kHz or high frequency crystal between 450 kHz and 8 MHz. |
Definition at line 154 of file periph_cpu_common.h.
Clock dividers for the submain clock.
Definition at line 228 of file periph_cpu_common.h.
Possible clock sources to generate the submain clock from.
Enumerator | |
---|---|
SUBMAIN_CLOCK_SOURCE_DCOCLK | Internal digitally controlled oscillator (DCO) with RC-type characteristics. |
SUBMAIN_CLOCK_SOURCE_XT2CLK | High frequency crystal between 450 kHz and 8 MHz.
|
SUBMAIN_CLOCK_SOURCE_LFXT1CLK | Low frequency 32.768 kHz or high frequency crystal between 450 kHz and 8 MHz.
It is recommended to use SUBMAIN_CLOCK_SOURCE_XT2CLK when XT2 is present in the config to avoid confusion. |
Definition at line 177 of file periph_cpu_common.h.
Enumeration of possible clock sources for a timer.
Definition at line 348 of file periph_cpu_common.h.
void clock_init | ( | void | ) |
Call during boot up process to initialize the clock.
clock_init()
can still call default_clock_init if that is useful; or it could do everything from scratch. void default_clock_init | ( | void | ) |
Initialize the basic clock system to provide the main clock, the subsystem clock, and the auxiliary clock.
The main clock, the subsystem clock, and the auxiliary clock will be set up as specified by static const msp430_clock_params_t clock_params
in the periph_conf.h
of the board.
void gpio_periph_mode | ( | gpio_t | pin, |
bool | enable | ||
) |
Enable or disable a pin to be used by peripheral modules.
[in] | pin | pin to (de-)select |
[in] | enable | true for enabling peripheral use, false for disabling it |
uint32_t PURE msp430_auxiliary_clock_freq | ( | void | ) |
Get the configured auxiliary clock frequency.
void msp430_clock_acquire | ( | msp430_clock_t | clock | ) |
Increase the refcount of the given clock.
[in] | clock | clock domain to acquire |
void msp430_clock_release | ( | msp430_clock_t | clock | ) |
Decrease the refcount of the subsystem main clock.
[in] | clock | clock domain to acquire |
uint32_t PURE msp430_submain_clock_freq | ( | void | ) |
Get the configured submain clock frequency.
|
extern |
The measured DCO frequency.
periph_conf.h
|
extern |
IRQ flags for TIMER_A.
Called TAIV in the data sheet / vendor files. This shallow alias makes the name more readable and does impedance matching for the type (volatile uint16_t
vs volatile short
).
|
extern |
IRQ flags for TIMER_B.
Called TBIV in the data sheet / vendor files. This shallow alias makes the name more readable and does impedance matching for the type (volatile uint16_t
vs volatile short
).