BSPACM  20150113
Board Support Package for ARM Cortex-M Microcontrollers
Variables
periphs.h File Reference

Mapping between peripheral base address and shift offset. More...

#include <bspacm/core.h>

Go to the source code of this file.

Variables

const uint32_t wBSPACMdeviceTM4CperiphGPIO []
 
const uint8_t nBSPACMdeviceTM4CperiphGPIO
 
const uint32_t wBSPACMdeviceTM4CperiphI2C []
 
const uint8_t nBSPACMdeviceTM4CperiphI2C
 
const uint32_t wBSPACMdeviceTM4CperiphSSI []
 
const uint8_t nBSPACMdeviceTM4CperiphSSI
 
const uint32_t wBSPACMdeviceTM4CperiphTIMER []
 
const uint8_t nBSPACMdeviceTM4CperiphTIMER
 
const uint32_t wBSPACMdeviceTM4CperiphUART []
 
const uint8_t nBSPACMdeviceTM4CperiphUART
 
const uint32_t wBSPACMdeviceTM4CperiphWTIMER []
 
const uint8_t nBSPACMdeviceTM4CperiphWTIMER
 

Detailed Description

Mapping between peripheral base address and shift offset.

There are a variety of peripherals in the TM4C series for which more than two instances may be present on any given device. Unfortunately, even though a particular peripheral instance has the same address on any device that supports it, there is no clean mechanism to calculate the base address from the instance number or vice versa (especially for GPIOs, of which there are two flavors with discontinuous strides).

This matters because on some cases we know the base address, but need to figure out which bit in a register such as SYSCTL->RCGCGUART corresponds to the instance. In most cases, the ordinal of the peripheral (3 for UART3) is the same as the shift amount to locate the corresponding bit.

For GPIOs it is more complex. These peripherals do not use index numbers, but index letters. While GPIOC might have been called GPIO2 and uniformly uses shift 2, GPIOI and GPIOO do not exist and are skipped in the ordering. Thus ports map to instances (shifts) as:

// PA 0 PB 1 PC 2 PD 3
// PE 4 PF 5 PG 6 PH 7
// *PJ 8 PK 9 PL 10 PM 11
// PN 12 *PP 13 PQ 14 PR 15
// PS 16 PT 17

This file declares arrays, indexed by shift count or instance number, holding for each peripheral type the base address of each peripheral available on the device for which the array was constructed. So obtaining the base address of a given instance is a simple lookup, and calculating the instance from the base address is a linear search.

Be aware that it is technically possible that some instances are skipped on some devices (e.g., GPIOG may be followed by GPION). At the time these data were created the shift counts were not adjusted for any such case, so if this can happen there will be zero-valued base addresses in the arrays.

These arrays can also be used to iterate through the available peripherals on a device to inspect their configuration.

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

Variable Documentation

const uint8_t nBSPACMdeviceTM4CperiphGPIO

Number of GPIO peripherals available on specific device

const uint8_t nBSPACMdeviceTM4CperiphI2C

Number of I2C peripherals available on specific device

const uint8_t nBSPACMdeviceTM4CperiphSSI

Number of SSI peripherals available on specific device

const uint8_t nBSPACMdeviceTM4CperiphTIMER

Number of TIMER peripherals available on specific device

const uint8_t nBSPACMdeviceTM4CperiphUART

Number of UART peripherals available on specific device

const uint8_t nBSPACMdeviceTM4CperiphWTIMER

Number of WTIMER peripherals available on specific device

const uint32_t wBSPACMdeviceTM4CperiphGPIO[]

Ordered BASE addresses of GPIO peripherals

const uint32_t wBSPACMdeviceTM4CperiphI2C[]

Ordered BASE addresses of I2C peripherals

const uint32_t wBSPACMdeviceTM4CperiphSSI[]

Ordered BASE addresses of SSI peripherals

const uint32_t wBSPACMdeviceTM4CperiphTIMER[]

Ordered BASE addresses of TIMER peripherals

const uint32_t wBSPACMdeviceTM4CperiphUART[]

Ordered BASE addresses of UART peripherals

const uint32_t wBSPACMdeviceTM4CperiphWTIMER[]

Ordered BASE addresses of WTIMER peripherals