BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Functions
port.h File Reference

Hardware presentation/abstraction for Digital I/O Port (PORT#/PORT#_R) More...

#include <bsp430/periph.h>

Go to the source code of this file.

Data Structures

struct  sBSP430hplPORT_IE_8
 
struct  sBSP430hplPORT_8
 
union  uBSP430hplPORT_16
 
struct  sBSP430hplPORT_16
 
struct  sBSP430hplPORT_5XX_16
 
struct  sBSP430hplPORT_5XX_8
 
struct  sBSP430halPORT
 

Macros

#define BSP430_MODULE_PORT
 
#define BSP430_PORT_SUPPORTS_REN   0
 
#define BSP430_PORT_REN_HIGH_Z   -1
 
#define BSP430_PORT_REN_PULL_DOWN   0
 
#define BSP430_PORT_REN_PULL_UP   1
 
#define BSP430_PORT_HAL_SET_REN(hal_, bit_, rv_)
 
#define BSP430_PORT_HPL_SET_REN(hpl_, bit_, rv_)
 
#define BSP430_PORT_SUPPORTS_SEL2_2XX
 
#define BSP430_PORT_SUPPORTS_SEL2_47XX
 
#define BSP430_PORT_SUPPORTS_SEL2_5XX
 
#define BSP430_PORT_SUPPORTS_SEL2C_5XX
 
#define BSP430_PORT_SUPPORTS_SEL2
 
#define BSP430_PORT_HPL_SET_SEL(hpl_, bit_, sel_)
 
#define BSP430_PORT_HAL_SET_SEL(hal_, bit_, sel_)
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8   1
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT_8   2
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT_16   3
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_8   4
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_16   5
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORTIE   BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORT   BSP430_PORT_HAL_HPL_VARIANT_PORT_8
 
#define BSP430_PORT_HAL_HPL_VARIANT_PORTW   BSP430_PORT_HAL_HPL_VARIANT_PORT_16
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_IE_8(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT_IE_8(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_IE_8(hal_)) ? (hal_)->hpl.port_ie_8 : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_8(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT_8(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_8(hal_)) ? (hal_)->hpl.port_8 : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_16(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT_16 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT_16(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_16(hal_)) ? (hal_)->hpl.port_16 : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_8(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT_5XX_8(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_8(hal_)) ? (hal_)->hpl.port_5xx_8 : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_16(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_16 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT_5XX_16(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_16(hal_)) ? (hal_)->hpl.port_5xx_16 : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORT == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORT(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT(hal_)) ? (hal_)->hpl.port : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORTIE == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_)) ? (hal_)->hpl.portie : (void *)0)
 
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORTW(hal_)   (BSP430_PORT_HAL_HPL_VARIANT_PORTW == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))
 
#define BSP430_PORT_HAL_GET_HPL_PORTW(hal_)   ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORTW(hal_)) ? (hal_)->hpl.portw : (void *)0)
 
#define BSP430_PORT_HAL_GET_PERIPH_HANDLE(hal_)   xBSP430periphFromHPL((hal_)->hpl.any)
 
#define BSP430_PORT_HAL_HPL_IN(hal_)   (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->in : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->in))
 
#define BSP430_PORT_HAL_HPL_OUT(hal_)   (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->out : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->out))
 
#define BSP430_PORT_HAL_HPL_DIR(hal_)   (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->dir : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->dir))
 
#define BSP430_PORT_HAL_HPL_SEL(hal_)   (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->sel : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->sel))
 
#define BSP430_PORT_HAL_HPL_REN(hal_)   (*(hal_)->renp)
 
#define configBSP430_HAL_PORT1   0
 
#define BSP430_HAL_PORT1   (&xBSP430hal_PORT1_)
 
#define configBSP430_HAL_PORT2   0
 
#define BSP430_HAL_PORT2   (&xBSP430hal_PORT2_)
 
#define configBSP430_HAL_PORT3   0
 
#define BSP430_HAL_PORT3   (&xBSP430hal_PORT3_)
 
#define configBSP430_HAL_PORT4   0
 
#define BSP430_HAL_PORT4   (&xBSP430hal_PORT4_)
 
#define configBSP430_HAL_PORT5   0
 
#define BSP430_HAL_PORT5   (&xBSP430hal_PORT5_)
 
#define configBSP430_HAL_PORT6   0
 
#define BSP430_HAL_PORT6   (&xBSP430hal_PORT6_)
 
#define configBSP430_HAL_PORT7   0
 
#define BSP430_HAL_PORT7   (&xBSP430hal_PORT7_)
 
#define configBSP430_HAL_PORT8   0
 
#define BSP430_HAL_PORT8   (&xBSP430hal_PORT8_)
 
#define configBSP430_HAL_PORT9   0
 
#define BSP430_HAL_PORT9   (&xBSP430hal_PORT9_)
 
#define configBSP430_HAL_PORT10   0
 
#define BSP430_HAL_PORT10   (&xBSP430hal_PORT10_)
 
#define configBSP430_HAL_PORT11   0
 
#define BSP430_HAL_PORT11   (&xBSP430hal_PORT11_)
 
#define configBSP430_HPL_PORT1   (configBSP430_HAL_PORT1 - 0)
 
#define BSP430_PERIPH_PORT1   ((tBSP430periphHandle)(BSP430_PERIPH_PORT1_BASEADDRESS_))
 
#define configBSP430_HPL_PORT2   (configBSP430_HAL_PORT2 - 0)
 
#define BSP430_PERIPH_PORT2   ((tBSP430periphHandle)(BSP430_PERIPH_PORT2_BASEADDRESS_))
 
#define configBSP430_HPL_PORT3   (configBSP430_HAL_PORT3 - 0)
 
#define BSP430_PERIPH_PORT3   ((tBSP430periphHandle)(BSP430_PERIPH_PORT3_BASEADDRESS_))
 
#define configBSP430_HPL_PORT4   (configBSP430_HAL_PORT4 - 0)
 
#define BSP430_PERIPH_PORT4   ((tBSP430periphHandle)(BSP430_PERIPH_PORT4_BASEADDRESS_))
 
#define configBSP430_HPL_PORT5   (configBSP430_HAL_PORT5 - 0)
 
#define BSP430_PERIPH_PORT5   ((tBSP430periphHandle)(BSP430_PERIPH_PORT5_BASEADDRESS_))
 
#define configBSP430_HPL_PORT6   (configBSP430_HAL_PORT6 - 0)
 
#define BSP430_PERIPH_PORT6   ((tBSP430periphHandle)(BSP430_PERIPH_PORT6_BASEADDRESS_))
 
#define configBSP430_HPL_PORT7   (configBSP430_HAL_PORT7 - 0)
 
#define BSP430_PERIPH_PORT7   ((tBSP430periphHandle)(BSP430_PERIPH_PORT7_BASEADDRESS_))
 
#define configBSP430_HPL_PORT8   (configBSP430_HAL_PORT8 - 0)
 
#define BSP430_PERIPH_PORT8   ((tBSP430periphHandle)(BSP430_PERIPH_PORT8_BASEADDRESS_))
 
#define configBSP430_HPL_PORT9   (configBSP430_HAL_PORT9 - 0)
 
#define BSP430_PERIPH_PORT9   ((tBSP430periphHandle)(BSP430_PERIPH_PORT9_BASEADDRESS_))
 
#define configBSP430_HPL_PORT10   (configBSP430_HAL_PORT10 - 0)
 
#define BSP430_PERIPH_PORT10   ((tBSP430periphHandle)(BSP430_PERIPH_PORT10_BASEADDRESS_))
 
#define configBSP430_HPL_PORT11   (configBSP430_HAL_PORT11 - 0)
 
#define BSP430_PERIPH_PORT11   ((tBSP430periphHandle)(BSP430_PERIPH_PORT11_BASEADDRESS_))
 
#define BSP430_HPL_PORT1   ((volatile sBSP430hplPORTIE *)BSP430_PERIPH_PORT1)
 
#define BSP430_HPL_PORT2   ((volatile sBSP430hplPORTIE *)BSP430_PERIPH_PORT2)
 
#define BSP430_HPL_PORT3   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT3)
 
#define BSP430_HPL_PORT4   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT4)
 
#define BSP430_HPL_PORT5   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT5)
 
#define BSP430_HPL_PORT6   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT6)
 
#define BSP430_HPL_PORT7   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT7)
 
#define BSP430_HPL_PORT8   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT8)
 
#define BSP430_HPL_PORT9   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT9)
 
#define BSP430_HPL_PORT10   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT10)
 
#define BSP430_HPL_PORT11   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT11)
 
#define configBSP430_HAL_PORT1_ISR   ((configBSP430_HAL_PORT1 - 0) && defined(PORT1_VECTOR))
 
#define configBSP430_HAL_PORT2_ISR   ((configBSP430_HAL_PORT2 - 0) && defined(PORT2_VECTOR))
 
#define configBSP430_HAL_PORT3_ISR   ((configBSP430_HAL_PORT3 - 0) && defined(PORT3_VECTOR))
 
#define configBSP430_HAL_PORT4_ISR   ((configBSP430_HAL_PORT4 - 0) && defined(PORT4_VECTOR))
 
#define configBSP430_HAL_PORT5_ISR   ((configBSP430_HAL_PORT5 - 0) && defined(PORT5_VECTOR))
 
#define configBSP430_HAL_PORT6_ISR   ((configBSP430_HAL_PORT6 - 0) && defined(PORT6_VECTOR))
 
#define configBSP430_HAL_PORT7_ISR   ((configBSP430_HAL_PORT7 - 0) && defined(PORT7_VECTOR))
 
#define configBSP430_HAL_PORT8_ISR   ((configBSP430_HAL_PORT8 - 0) && defined(PORT8_VECTOR))
 
#define configBSP430_HAL_PORT9_ISR   ((configBSP430_HAL_PORT9 - 0) && defined(PORT9_VECTOR))
 
#define configBSP430_HAL_PORT10_ISR   ((configBSP430_HAL_PORT10 - 0) && defined(PORT10_VECTOR))
 
#define configBSP430_HAL_PORT11_ISR   ((configBSP430_HAL_PORT11 - 0) && defined(PORT11_VECTOR))
 

Typedefs

typedef struct sBSP430hplPORT_IE_8 sBSP430hplPORT_IE_8
 
typedef struct sBSP430hplPORT_8 sBSP430hplPORT_8
 
typedef union uBSP430hplPORT_16 uBSP430hplPORT_16
 
typedef struct sBSP430hplPORT_16 sBSP430hplPORT_16
 
typedef struct sBSP430hplPORT_5XX_16 sBSP430hplPORT_5XX_16
 
typedef struct sBSP430hplPORT_5XX_8 sBSP430hplPORT_5XX_8
 
typedef sBSP430hplPORT_IE_8 sBSP430hplPORTIE
 
typedef sBSP430hplPORT_8 sBSP430hplPORT
 
typedef sBSP430hplPORT_16 sBSP430hplPORTW
 
typedef struct sBSP430halPORT sBSP430halPORT
 
typedef struct sBSP430halPORThBSP430halPORT
 

Functions

static BSP430_CORE_INLINE volatile sBSP430hplPORTIExBSP430hplLookupPORTIE (tBSP430periphHandle periph)
 
static BSP430_CORE_INLINE volatile sBSP430hplPORTxBSP430hplLookupPORT (tBSP430periphHandle periph)
 
static BSP430_CORE_INLINE hBSP430halPORT hBSP430portLookup (tBSP430periphHandle periph)
 
const char * xBSP430portName (tBSP430periphHandle periph)
 
static BSP430_CORE_INLINE int iBSP430portBitPosition (unsigned int bitx)
 

Detailed Description

Hardware presentation/abstraction for Digital I/O Port (PORT#/PORT#_R)

A Digital I/O port capability exists on every MSP430 MCU. Differences between families are reflected in the HPL structures below.

Conventional peripheral handles are BSP430_PERIPH_PORT1. The handles are available only when the corresponding HPL is requested. The peripheral handle can be used with xBSP430hplLookupPORT() and xBSP430hplLookupPORTIE() to obtain the HPL handles, and with hBSP430halPORT() to obtain the HAL handle.

Module Configuration Options

Substitute other 8-bit port identifiers (e.g., PORT7) as necessary.

Hardware Presentation Layer

The module defines five distinct HPL structures:

The 16 bit port structures are provided for reference only. All HPL and HAL access in BSP430 is done using the 8-bit structures.

Note
On pre-5xx targets not all register capabilities may be accessible through the HPL structures. Specifically, the ability to control pullup/pulldown resistors and to select secondary or tertiary peripheral functions may require registers that are not contiguous with the remaining registers. That functionality must be accessed through the HAL structure.

As a convenience, the following two typedefs are provided and resolve to the appropriate underlying structure supported by the target MCU:

Hardware Adaptation Layer

The port HAL uses the sBSP430halPORT structure. All variant HPL structures are accessible through this structure.

When enabled by configBSP430_HAL_PORT1_ISR the sBSP430halPORT.pin_cbchain_ni array is used by a provided HAL ISR is enabled to notify application and library code of events that occur on a particular port pin. It is the responsibility of that code to register a callback and to configure the corresponding interrupt enable and edge select bits (e.g. using BSP430_PORT_HAL_GET_HPL_PORTIE to get the sBSP430hplPORTIE handle).

Homepage
http://github.com/pabigot/bsp430

Macro Definition Documentation

#define BSP430_HAL_PORT1   (&xBSP430hal_PORT1_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT1.

This pointer may be used only if configBSP430_HAL_PORT1 is defined to a true value.

Dependency:
configBSP430_HAL_PORT1
#define BSP430_HAL_PORT10   (&xBSP430hal_PORT10_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT10.

This pointer may be used only if configBSP430_HAL_PORT10 is defined to a true value.

Dependency:
configBSP430_HAL_PORT10
#define BSP430_HAL_PORT11   (&xBSP430hal_PORT11_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT11.

This pointer may be used only if configBSP430_HAL_PORT11 is defined to a true value.

Dependency:
configBSP430_HAL_PORT11
#define BSP430_HAL_PORT2   (&xBSP430hal_PORT2_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT2.

This pointer may be used only if configBSP430_HAL_PORT2 is defined to a true value.

Dependency:
configBSP430_HAL_PORT2
#define BSP430_HAL_PORT3   (&xBSP430hal_PORT3_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT3.

This pointer may be used only if configBSP430_HAL_PORT3 is defined to a true value.

Dependency:
configBSP430_HAL_PORT3
#define BSP430_HAL_PORT4   (&xBSP430hal_PORT4_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT4.

This pointer may be used only if configBSP430_HAL_PORT4 is defined to a true value.

Dependency:
configBSP430_HAL_PORT4
#define BSP430_HAL_PORT5   (&xBSP430hal_PORT5_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT5.

This pointer may be used only if configBSP430_HAL_PORT5 is defined to a true value.

Dependency:
configBSP430_HAL_PORT5
#define BSP430_HAL_PORT6   (&xBSP430hal_PORT6_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT6.

This pointer may be used only if configBSP430_HAL_PORT6 is defined to a true value.

Dependency:
configBSP430_HAL_PORT6
#define BSP430_HAL_PORT7   (&xBSP430hal_PORT7_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT7.

This pointer may be used only if configBSP430_HAL_PORT7 is defined to a true value.

Dependency:
configBSP430_HAL_PORT7
#define BSP430_HAL_PORT8   (&xBSP430hal_PORT8_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT8.

This pointer may be used only if configBSP430_HAL_PORT8 is defined to a true value.

Dependency:
configBSP430_HAL_PORT8
#define BSP430_HAL_PORT9   (&xBSP430hal_PORT9_)

sBSP430halPORT HAL handle for BSP430_PERIPH_PORT9.

This pointer may be used only if configBSP430_HAL_PORT9 is defined to a true value.

Dependency:
configBSP430_HAL_PORT9
#define BSP430_HPL_PORT1   ((volatile sBSP430hplPORTIE *)BSP430_PERIPH_PORT1)

HPL pointer for PORT1.

Typed pointer to a volatile structure overlaying the PORT1 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT1 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT1
#define BSP430_HPL_PORT10   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT10)

HPL pointer for PORT10.

Typed pointer to a volatile structure overlaying the PORT10 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT10 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT10
#define BSP430_HPL_PORT11   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT11)

HPL pointer for PORT11.

Typed pointer to a volatile structure overlaying the PORT11 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT11 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT11
#define BSP430_HPL_PORT2   ((volatile sBSP430hplPORTIE *)BSP430_PERIPH_PORT2)

HPL pointer for PORT2.

Typed pointer to a volatile structure overlaying the PORT2 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT2 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT2
#define BSP430_HPL_PORT3   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT3)

HPL pointer for PORT3.

Typed pointer to a volatile structure overlaying the PORT3 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT3 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT3
#define BSP430_HPL_PORT4   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT4)

HPL pointer for PORT4.

Typed pointer to a volatile structure overlaying the PORT4 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT4 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT4
#define BSP430_HPL_PORT5   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT5)

HPL pointer for PORT5.

Typed pointer to a volatile structure overlaying the PORT5 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT5 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT5
#define BSP430_HPL_PORT6   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT6)

HPL pointer for PORT6.

Typed pointer to a volatile structure overlaying the PORT6 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT6 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT6
#define BSP430_HPL_PORT7   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT7)

HPL pointer for PORT7.

Typed pointer to a volatile structure overlaying the PORT7 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT7 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT7
#define BSP430_HPL_PORT8   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT8)

HPL pointer for PORT8.

Typed pointer to a volatile structure overlaying the PORT8 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT8 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT8
#define BSP430_HPL_PORT9   ((volatile sBSP430hplPORT *)BSP430_PERIPH_PORT9)

HPL pointer for PORT9.

Typed pointer to a volatile structure overlaying the PORT9 peripheral register map.

The pointer may be used only if configBSP430_HPL_PORT9 is defined to a true value.

Note
The underlying type is sBSP430hplPORTIE for ports 1 and 2 and ports on 5xx/6xx MCUs, and is sBSP430hplPORT for ports 3 and higher on pre-5xx MCUs. The generated documentation may not reflect the correct structure.
Dependency:
configBSP430_HPL_PORT9
#define BSP430_MODULE_PORT
Value:
(defined(__MSP430_HAS_PORT1__) \
|| defined(__MSP430_HAS_PORT1_R__))

Defined on inclusion of <bsp430/periph/port.h>. The value evaluates to true if the target MCU supports the Digital I/O Module, and false if it does not.

C Preprocessor Only:
This macro may have a value that restricts its use to C preprocessor conditional directives.
#define BSP430_PERIPH_PORT1   ((tBSP430periphHandle)(BSP430_PERIPH_PORT1_BASEADDRESS_))

Handle for the raw PORT1 device.

The handle may be used only if configBSP430_HPL_PORT1 is defined to a true value.

Dependency:
configBSP430_HPL_PORT1
#define BSP430_PERIPH_PORT10   ((tBSP430periphHandle)(BSP430_PERIPH_PORT10_BASEADDRESS_))

Handle for the raw PORT10 device.

The handle may be used only if configBSP430_HPL_PORT10 is defined to a true value.

Dependency:
configBSP430_HPL_PORT10
#define BSP430_PERIPH_PORT11   ((tBSP430periphHandle)(BSP430_PERIPH_PORT11_BASEADDRESS_))

Handle for the raw PORT11 device.

The handle may be used only if configBSP430_HPL_PORT11 is defined to a true value.

Dependency:
configBSP430_HPL_PORT11
#define BSP430_PERIPH_PORT2   ((tBSP430periphHandle)(BSP430_PERIPH_PORT2_BASEADDRESS_))

Handle for the raw PORT2 device.

The handle may be used only if configBSP430_HPL_PORT2 is defined to a true value.

Dependency:
configBSP430_HPL_PORT2
#define BSP430_PERIPH_PORT3   ((tBSP430periphHandle)(BSP430_PERIPH_PORT3_BASEADDRESS_))

Handle for the raw PORT3 device.

The handle may be used only if configBSP430_HPL_PORT3 is defined to a true value.

Dependency:
configBSP430_HPL_PORT3
#define BSP430_PERIPH_PORT4   ((tBSP430periphHandle)(BSP430_PERIPH_PORT4_BASEADDRESS_))

Handle for the raw PORT4 device.

The handle may be used only if configBSP430_HPL_PORT4 is defined to a true value.

Dependency:
configBSP430_HPL_PORT4
#define BSP430_PERIPH_PORT5   ((tBSP430periphHandle)(BSP430_PERIPH_PORT5_BASEADDRESS_))

Handle for the raw PORT5 device.

The handle may be used only if configBSP430_HPL_PORT5 is defined to a true value.

Dependency:
configBSP430_HPL_PORT5
#define BSP430_PERIPH_PORT6   ((tBSP430periphHandle)(BSP430_PERIPH_PORT6_BASEADDRESS_))

Handle for the raw PORT6 device.

The handle may be used only if configBSP430_HPL_PORT6 is defined to a true value.

Dependency:
configBSP430_HPL_PORT6
#define BSP430_PERIPH_PORT7   ((tBSP430periphHandle)(BSP430_PERIPH_PORT7_BASEADDRESS_))

Handle for the raw PORT7 device.

The handle may be used only if configBSP430_HPL_PORT7 is defined to a true value.

Dependency:
configBSP430_HPL_PORT7
#define BSP430_PERIPH_PORT8   ((tBSP430periphHandle)(BSP430_PERIPH_PORT8_BASEADDRESS_))

Handle for the raw PORT8 device.

The handle may be used only if configBSP430_HPL_PORT8 is defined to a true value.

Dependency:
configBSP430_HPL_PORT8
#define BSP430_PERIPH_PORT9   ((tBSP430periphHandle)(BSP430_PERIPH_PORT9_BASEADDRESS_))

Handle for the raw PORT9 device.

The handle may be used only if configBSP430_HPL_PORT9 is defined to a true value.

Dependency:
configBSP430_HPL_PORT9
#define BSP430_PORT_HAL_GET_HPL_PORT (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT(hal_)) ? (hal_)->hpl.port : (void *)0)

Get the port HPL pointer if the HAL is a PORT variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORT_16 (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_16(hal_)) ? (hal_)->hpl.port_16 : (void *)0)

Get the port HPL pointer if the HAL is a PORT_16 variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORT_5XX_16 (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_16(hal_)) ? (hal_)->hpl.port_5xx_16 : (void *)0)

Get the port HPL pointer if the HAL is a PORT_5XX_16 variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORT_5XX_8 (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_8(hal_)) ? (hal_)->hpl.port_5xx_8 : (void *)0)

Get the port HPL pointer if the HAL is a PORT_5XX_8 variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORT_8 (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_8(hal_)) ? (hal_)->hpl.port_8 : (void *)0)

Get the port HPL pointer if the HAL is a PORT_8 variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORT_IE_8 (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_IE_8(hal_)) ? (hal_)->hpl.port_ie_8 : (void *)0)

Get the port HPL pointer if the HAL is a PORT_IE_8 variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_HPL_PORTIE (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_)) ? (hal_)->hpl.portie : (void *)0)

Get the port HPL pointer if the HAL is a PORTIE variant.

Value is a null pointer if the HAL references a different HPL type.

Examples:
bootstrap/applpm/main.c, and bootstrap/button/main.c.
#define BSP430_PORT_HAL_GET_HPL_PORTW (   hal_)    ((BSP430_PORT_HAL_HPL_VARIANT_IS_PORTW(hal_)) ? (hal_)->hpl.portw : (void *)0)

Get the port HPL pointer if the HAL is a PORTW variant.

Value is a null pointer if the HAL references a different HPL type.

#define BSP430_PORT_HAL_GET_PERIPH_HANDLE (   hal_)    xBSP430periphFromHPL((hal_)->hpl.any)

Get the port HPL peripheral handle.

This bypasses any structural interpretation of the HPL pointer, converting it to the underlying tBSP430periphHandle value directly.

Examples:
sensors/ds18b20/main.c.
#define BSP430_PORT_HAL_HPL_DIR (   hal_)    (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->dir : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->dir))

Macro to reference a port DIR register regardless of HPL layout.

Examples:
rf/cc110x/main.c, sensors/ds18b20/main.c, and sensors/hh10d/main.c.
#define BSP430_PORT_HAL_HPL_IN (   hal_)    (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->in : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->in))

Macro to reference a port IN register regardless of HPL layout.

Examples:
rf/cc110x/main.c.
#define BSP430_PORT_HAL_HPL_OUT (   hal_)    (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->out : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->out))

Macro to reference a port OUT register regardless of HPL layout.

Examples:
rf/cc110x/main.c, and sensors/ds18b20/main.c.
#define BSP430_PORT_HAL_HPL_REN (   hal_)    (*(hal_)->renp)

Macro to reference a port REN register regardless of HPL layout.

Dependency:
Selected MCU must support REN function
#define BSP430_PORT_HAL_HPL_SEL (   hal_)    (*(BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE(hal_) ? &BSP430_PORT_HAL_GET_HPL_PORTIE(hal_)->sel : &BSP430_PORT_HAL_GET_HPL_PORT(hal_)->sel))

Macro to reference a port SEL register regardless of HPL layout.

Examples:
rf/cc110x/main.c, and sensors/hh10d/main.c.
#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_16 (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT_16 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT_16 variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_16 (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_16 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT_5XX_16 variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_5XX_8 (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT_5XX_8 variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_8 (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT_8 variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORT_IE_8 (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8 == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORT_IE_8 variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORTIE (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORTIE == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORTIE variant.

#define BSP430_PORT_HAL_HPL_VARIANT_IS_PORTW (   hal_)    (BSP430_PORT_HAL_HPL_VARIANT_PORTW == BSP430_PERIPH_HAL_STATE_CFLAGS_VARIANT(hal_))

True iff the HPL pointer of the port HAL is a PORTW variant.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT   BSP430_PORT_HAL_HPL_VARIANT_PORT_8

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to a byte-accessed port without interrupt capabilities.

This identifies the appropriate structure-specific variant value based on the MCU capabilities.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT_16   3

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to an sBSP430hplPORT_16.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_16   5

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to an sBSP430hplPORT_5XX_16.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT_5XX_8   4

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to an sBSP430hplPORT_5XX_8.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT_8   2

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to an sBSP430hplPORT_8.

#define BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8   1

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to an sBSP430hplPORT_IE_8.

#define BSP430_PORT_HAL_HPL_VARIANT_PORTIE   BSP430_PORT_HAL_HPL_VARIANT_PORT_IE_8

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to a byte-accessed port without interrupt capabilities.

This identifies the appropriate structure-specific variant value based on the MCU capabilities.

#define BSP430_PORT_HAL_HPL_VARIANT_PORTW   BSP430_PORT_HAL_HPL_VARIANT_PORT_16

Field value for variant stored in sBSP430halPORT.hal_state.cflags when HPL reference is to a word-accessed port.

This identifies the appropriate structure-specific variant value based on the MCU capabilities.

#define BSP430_PORT_HAL_SET_REN (   hal_,
  bit_,
  rv_ 
)
Value:
do { \
if ((BSP430_PORT_REN_PULL_UP == (rv_)) \
|| (BSP430_PORT_REN_PULL_DOWN == (rv_))) { \
if (BSP430_PORT_REN_PULL_UP == (rv_)) { \
BSP430_PORT_HAL_HPL_OUT(hal_) |= (bit_); \
} else { \
BSP430_PORT_HAL_HPL_OUT(hal_) &= ~(bit_); \
} \
BSP430_PORT_HAL_HPL_REN(hal_) |= (bit_); \
} else { \
BSP430_PORT_HAL_HPL_REN(hal_) &= ~(bit_); \
} \
} while (0)
#define BSP430_PORT_REN_PULL_UP
Definition: port.h:218
#define BSP430_PORT_REN_PULL_DOWN
Definition: port.h:213
#define BSP430_PORT_HAL_HPL_OUT(hal_)
Definition: port.h:907
#define BSP430_PORT_HAL_HPL_REN(hal_)
Definition: port.h:928

Set port resistor-enabled configuration via HAL handle.

On MCUs that support internal pullup and pulldown resistors this function macro can be used to configure between those choices and floating inputs. This version is suited for all families, and is required for 2xx/4xx devices where resistor-enable capability is not present within the HPL structure.

See also
BSP430_PORT_HPL_SET_REN()
Note
This does not reconfigure the pin for input. It only affects internal pullup configuration.
If BSP430_PORT_SUPPORTS_REN is false, this macro does nothing.
Parameters
hal_the handle for the port HAL
bit_the bit for which resistor/impedance is to be configured
rv_the selected configuration, one of BSP430_PORT_REN_HIGH_Z, BSP430_PORT_REN_PULL_DOWN, BSP430_PORT_REN_PULL_UP.
Examples:
bootstrap/applpm/main.c, bootstrap/button/main.c, and rf/cc110x/main.c.
#define BSP430_PORT_HAL_SET_SEL (   hal_,
  bit_,
  sel_ 
)
Value:
do { \
if (0x01 & (sel_)) { \
BSP430_PORT_HAL_HPL_SEL(hal_) |= (bit_); \
} else { \
BSP430_PORT_HAL_HPL_SEL(hal_) &= ~(bit_); \
} \
if (0x02 & (sel_)) { \
*(hal_)->sel2p |= (bit_); \
} else { \
*(hal_)->sel2p &= ~(bit_); \
} \
} while (0)
#define BSP430_PORT_HAL_HPL_SEL(hal_)
Definition: port.h:919

Set port function selection value via HAL handle.

MSP430 ports support peripheral functions that are enabled through port-specific function selector registers. In some MCUs a second and third function may be selected with a second port-specific function selector register. This function simplifies selecting the peripheral function. It exists to allow a macro to identify the desired function as a single value, and to resolve inconsistencies in selection register naming across the MSP430 product line.

See also
BSP430_PORT_SUPPORTS_SEL2_2XX, BSP430_PORT_SUPPORTS_SEL2_47XX, BSP430_PORT_SUPPORTS_SEL2_5XX, BSP430_PORT_SUPPORTS_SEL2C_5XX

The sel_ parameter value 0 clears all sel registers for the specified port and bit, leaving the pin in its digital i/o role.

Non-zero values are treated as binary numbers, where the least significant bit corresponds to the setting for PxSEL (PxSEL0 on FRAM devices), the next most significant bit to the setting for PxSEL2 (normally, PxSEL1 on FRAM devices)

Note
Setting a new selection that requires changing bit values in two registers is safe only on BSP430_PORT_SUPPORTS_SEL2C_5XX systems. For all other systems the register will be configured to an intermediate selection before the final bit is set correctly.
Warning
This function macro currently does not support sel_ values above 1 under BSP430_PORT_SUPPORTS_SEL2_47XX. Request support if you need this.
Parameters
hal_the handle for the port HAL
bit_the bit identifing the pin for which the function is desired
sel_the selection function index, with 0 selecting digital input/output (no peripheral function)
Platform-Specific Value:
The value here is an example, and may differ from the actual value used depending on platform information.
#define BSP430_PORT_HPL_SET_REN (   hpl_,
  bit_,
  rv_ 
)
Value:
do { \
if ((BSP430_PORT_REN_PULL_UP == (rv_)) \
|| (BSP430_PORT_REN_PULL_DOWN == (rv_))) { \
if (BSP430_PORT_REN_PULL_UP == (rv_)) { \
(hpl_)->out |= (bit_); \
} else { \
(hpl_)->out &= ~(bit_); \
} \
(hpl_)->ren |= (bit_); \
} else { \
(hpl_)->ren &= ~(bit_); \
} \
} while (0)
#define BSP430_PORT_REN_PULL_UP
Definition: port.h:218
#define BSP430_PORT_REN_PULL_DOWN
Definition: port.h:213

Set port resistor-enabled configuration via HPL handle.

On MCUs that support internal pullup and pulldown resistors this function macro can be used to configure between those choices and floating inputs. This version is suited for 5xx-family devices for which the resistor-enable functionality is within the port HPL.

Note
This does not reconfigure the pin for input. It only affects internal pullup configuration.
If BSP430_PORT_SUPPORTS_REN is false, this macro does nothing.
See also
BSP430_PORT_HAL_SET_REN()
Parameters
hpl_the handle for the port HPL
bit_the bit for which resistor/impedance is to be configured
rv_the selected configuration, one of BSP430_PORT_REN_HIGH_Z, BSP430_PORT_REN_PULL_DOWN, BSP430_PORT_REN_PULL_UP.
Dependency:
BSP430_CORE_FAMILY_IS_5XX
#define BSP430_PORT_HPL_SET_SEL (   hpl_,
  bit_,
  sel_ 
)
Value:
do { \
if (0x01 & (sel_)) { \
(hpl_)->sel |= (bit_); \
} else { \
(hpl_)->sel &= ~(bit_); \
} \
} while (0)

Set port function selection value via HPL handle.

As with BSP430_PORT_HAL_SET_SEL(), but not fully supported for families where the necessary registers cannot be reached from the HPL handle.

Warning
For BSP430_PORT_SUPPORTS_SEL2_2XX and BSP430_PORT_SUPPORTS_SEL2_47XX this function macro does not correctly process sel_ values above 1.
Parameters
hpl_the handle for the port HPL
bit_the bit identifing the pin for which the function is desired
sel_the selection function index, with 0 selecting digital input/output (no peripheral function)
Platform-Specific Value:
The value here is an example, and may differ from the actual value used depending on platform information.
#define BSP430_PORT_REN_HIGH_Z   -1

Value for BSP430_PORT_HAL_SET_REN() for high impedance input.

This disables any port resistor enabled capability. It corresponds to REN reset, OUT dontcare.

#define BSP430_PORT_REN_PULL_DOWN   0

Value for BSP430_PORT_HAL_SET_REN() for pulldown resistor.

This corresponds to REN set, OUT reset.

#define BSP430_PORT_REN_PULL_UP   1

Value for BSP430_PORT_HAL_SET_REN() for pullup resistor.

This corresponds to REN set, OUT set.

Examples:
bootstrap/applpm/main.c, bootstrap/button/main.c, and rf/cc110x/main.c.
#define BSP430_PORT_SUPPORTS_REN   0

A macro that is defined to a true value if the port peripheral supports a resistor-enable register, and to a false value if it does not.

This can be used in application and library code to use or avoid reference to the ren field of HPL structures, either directly or though the BSP430_PORT_HAL_HPL_REN() macro.

Support for the PxREN register is determined by the MSP430_HAS_PORT1_R functional presence indicator for <msp430.h>; in all MCUs, if P1 has the feature, so do any other ports.

#define BSP430_PORT_SUPPORTS_SEL2
Value:
#define BSP430_PORT_SUPPORTS_SEL2C_5XX
Definition: port.h:359
#define BSP430_PORT_SUPPORTS_SEL2_5XX
Definition: port.h:345
#define BSP430_PORT_SUPPORTS_SEL2_47XX
Definition: port.h:330
#define BSP430_PORT_SUPPORTS_SEL2_2XX
Definition: port.h:315

Defined to true value if MCU supports multiple peripheral function selections.

#define BSP430_PORT_SUPPORTS_SEL2_2XX
Value:
&& (defined(P1SEL2_) || defined(P1SEL)) \
&& (defined(P2SEL2_) || defined(P2SEL2)))
#define BSP430_CORE_FAMILY_IS_5XX
Definition: core.h:264

Defined to true value if MCU supports multiple peripheral function selections with 2xx API (P1SEL, P1SEL2, no complement, all ports).

The value may be overridden in platform-specific bsp430_config.h files when the toolchain does not allow inferring the correct setting, as with Code Composer Studio for some families.

Defaulted:
The value here is superseded by previously encountered definitions.
#define BSP430_PORT_SUPPORTS_SEL2_47XX
Value:
&& (defined(P1SEL2_) || defined(P1SEL2)) \
&& ! (defined(P2SEL2_) || defined(P2SEL2)))
#define BSP430_CORE_FAMILY_IS_5XX
Definition: core.h:264

Defined to true value if MCU supports multiple peripheral function selections with 4xx API (P1SEL, P1SEL2, no complement, only PORT1).

The value may be overridden in platform-specific bsp430_config.h files when the toolchain does not allow inferring the correct setting, as with Code Composer Studio for some families.

Defaulted:
The value here is superseded by previously encountered definitions.
#define BSP430_PORT_SUPPORTS_SEL2_5XX
Value:
&& (defined(PASEL0_) || defined(PASEL0)) \
&& ! (defined(PASELC_) || defined(PASELC)))
#define BSP430_CORE_FAMILY_IS_5XX
Definition: core.h:264

Defined to true value if MCU supports multiple peripheral function selections with the base 5xx API (PxSEL0, PxSEL1, no complement function).

The value may be overridden in platform-specific bsp430_config.h files when the toolchain does not allow inferring the correct setting, as with Code Composer Studio for some families.

Defaulted:
The value here is superseded by previously encountered definitions.
#define BSP430_PORT_SUPPORTS_SEL2C_5XX
Value:
&& (defined(PASEL0_) || defined(PASEL0)) \
&& (defined(PASELC_) || defined(PASELC)))
#define BSP430_CORE_FAMILY_IS_5XX
Definition: core.h:264

Defined to true value if MCU supports multiple peripheral function selections with the FR5xx API (PxSEL0, PxSEL1, PxSELC).

The value may be overridden in platform-specific bsp430_config.h files when the toolchain does not allow inferring the correct setting, as with Code Composer Studio for some families.

Defaulted:
The value here is superseded by previously encountered definitions.

Typedef Documentation

typedef struct sBSP430halPORT* hBSP430halPORT

Handle for a port HAL instance

Examples:
bootstrap/button/main.c.

Structure holding hardware abstraction layer state for digital I/O ports.

Structure used to access ports without interrupt capability.

The underlying structure selected depends on the MCU family.

Layout for 2xx/4xx family 16-bit ports not supporting interrupts.

Access to SEL2 and REN capability for these ports is not available in the hardware-presentation layer.

Layout for 5xx family ports, 16-bit access

Layout for 5xx family ports, 8-bit access

This structure includes the necessary padding to maintain alignment when referencing the second 8-bit register in a 16-bit bank.

Layout for pre-5xx–family 8-bit ports not supporting interrupts.

Access to SEL2 and REN capability for these ports is not available in the hardware-presentation layer.

Layout for pre-5xx–family ports supporting interrupts.

Access to SEL2 capability for these ports is not available in the hardware-presentation layer.

Structure used to access ports with interrupt capability.

The underlying structure selected depends on the MCU family.

Structure used to access 16-bit ports.

The underlying structure selected depends on the MCU family.

Helper for accessing 8-bit registers within 16-bit registers

Function Documentation

static BSP430_CORE_INLINE hBSP430halPORT hBSP430portLookup ( tBSP430periphHandle  periph)
static

Get the HAL handle for a specific port.

Parameters
periphThe handle identifier, such as BSP430_PERIPH_TA0.
Returns
the HAL handle for the port. A null pointer is returned if the handle does not correspond to a port for which the HAL interface has been enabled (e.g., with configBSP430_HAL_PORT1).
Examples:
bootstrap/applpm/main.c, bootstrap/button/main.c, rf/cc110x/main.c, and sensors/hh10d/main.c.
static BSP430_CORE_INLINE int iBSP430portBitPosition ( unsigned int  bitx)
static

Convert from a bit value to a pin value.

Mostly used for informational messages, but also for ISR IFG queries. The reverse operation is simply a left shift.

Parameters
bitxThe value of a bit within a byte-addressed port
Returns
the index of the first bit that is set within bitx; 0 for a bitx value of 0x01, 3 for a bitx value of 0x08, etc. The return value is -1 if no bit is set in the low byte of bitx.
Warning
This function is explicitly intended for support of 8-bit ports, and cannot be used to detect the position of the lowest set bit in a wider integer.
Examples:
bootstrap/applpm/main.c, bootstrap/button/main.c, rf/cc110x/main.c, rf/cc3000/cli/main.c, sensors/ds18b20/main.c, sensors/hh10d/main.c, sensors/venus6pps/main.c, and utility/m25p/main.c.
static BSP430_CORE_INLINE volatile sBSP430hplPORT* xBSP430hplLookupPORT ( tBSP430periphHandle  periph)
static

Get the peripheral register pointer for a non-interrupt-enabled port.

Parameters
periphThe handle identifier, such as BSP430_PERIPH_PORT1.
Returns
A typed pointer that can be used to manipulate the port. A null pointer is returned if the handle does not correspond to a timer which has been enabled (e.g., with configBSP430_HPL_PORT1), or if the specified port supports interrupts (see xBSP430hplLookupPORTIE)
Examples:
utility/m25p/main.c.
static BSP430_CORE_INLINE volatile sBSP430hplPORTIE* xBSP430hplLookupPORTIE ( tBSP430periphHandle  periph)
static

Get the peripheral register pointer for an interrupt-enabled port.

Note
All ports on 5xx-family devices are interrupt-enabled.
Parameters
periphThe handle identifier, such as BSP430_PERIPH_PORT1.
Returns
A typed pointer that can be used to manipulate the port. A null pointer is returned if the handle does not correspond to a timer which has been enabled (e.g., with configBSP430_HPL_PORT1), or if the specified port does not support interrupts (see xBSP430hplLookupPORT)
Examples:
rf/cc110x/main.c.
const char* xBSP430portName ( tBSP430periphHandle  periph)

Get a human-readable identifier for the port

Parameters
periphThe handle identifier, such as BSP430_PERIPH_PORT1.
Returns
The short name of the port, e.g. "P1". If the peripheral is not recognized as a port, a null pointer is returned.
Examples:
bootstrap/button/main.c, rf/cc110x/main.c, rf/cc3000/cli/main.c, sensors/ds18b20/main.c, sensors/hh10d/main.c, sensors/venus6pps/main.c, and utility/m25p/main.c.