LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Data Structures | Macros | Functions
CHIP: LPC18xx/43xx SCU Driver (configures pin functions)

Detailed Description

Data Structures

struct  PINMUX_GRP_T
 Array of pin definitions passed to Chip_SCU_SetPinMuxing() must be in this format. More...
 
struct  LPC_SCU_T
 System Control Unit register block. More...
 

Macros

#define SCU_MODE_PULLUP   (0x0 << 3)
 
#define SCU_MODE_REPEATER   (0x1 << 3)
 
#define SCU_MODE_INACT   (0x2 << 3)
 
#define SCU_MODE_PULLDOWN   (0x3 << 3)
 
#define SCU_MODE_HIGHSPEEDSLEW_EN   (0x1 << 5)
 
#define SCU_MODE_INBUFF_EN   (0x1 << 6)
 
#define SCU_MODE_ZIF_DIS   (0x1 << 7)
 
#define SCU_MODE_4MA_DRIVESTR   (0x0 << 8)
 
#define SCU_MODE_8MA_DRIVESTR   (0x1 << 8)
 
#define SCU_MODE_14MA_DRIVESTR   (0x2 << 8)
 
#define SCU_MODE_20MA_DRIVESTR   (0x3 << 8)
 
#define SCU_MODE_FUNC0   0x0
 
#define SCU_MODE_FUNC1   0x1
 
#define SCU_MODE_FUNC2   0x2
 
#define SCU_MODE_FUNC3   0x3
 
#define SCU_MODE_FUNC4   0x4
 
#define SCU_MODE_FUNC5   0x5
 
#define SCU_MODE_FUNC6   0x6
 
#define SCU_MODE_FUNC7   0x7
 
#define SCU_PINIO_FAST   (SCU_MODE_INACT | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS)
 
#define MD_PUP   (0x0 << 3) /** Enable pull-up resistor at pad */
 
#define MD_BUK   (0x1 << 3) /** Enable pull-down and pull-up resistor at resistor at pad (repeater mode) */
 
#define MD_PLN   (0x2 << 3) /** Disable pull-down and pull-up resistor at resistor at pad */
 
#define MD_PDN   (0x3 << 3) /** Enable pull-down resistor at pad */
 
#define MD_EHS   (0x1 << 5) /** Enable fast slew rate */
 
#define MD_EZI   (0x1 << 6) /** Input buffer enable */
 
#define MD_ZI   (0x1 << 7) /** Disable input glitch filter */
 
#define MD_EHD0   (0x1 << 8) /** EHD driver strength low bit */
 
#define MD_EHD1   (0x1 << 8) /** EHD driver strength high bit */
 
#define MD_PLN_FAST   (MD_PLN | MD_EZI | MD_ZI | MD_EHS)
 
#define I2C0_STANDARD_FAST_MODE   (1 << 3 | 1 << 11) /** Pin configuration for STANDARD/FAST mode I2C */
 
#define I2C0_FAST_MODE_PLUS   (2 << 1 | 1 << 3 | 1 << 7 | 1 << 10 | 1 << 11) /** Pin configuration for Fast-mode Plus I2C */
 
#define FUNC0   0x0 /** Pin function 0 */
 
#define FUNC1   0x1 /** Pin function 1 */
 
#define FUNC2   0x2 /** Pin function 2 */
 
#define FUNC3   0x3 /** Pin function 3 */
 
#define FUNC4   0x4 /** Pin function 4 */
 
#define FUNC5   0x5 /** Pin function 5 */
 
#define FUNC6   0x6 /** Pin function 6 */
 
#define FUNC7   0x7 /** Pin function 7 */
 
#define PORT_OFFSET   0x80 /** Port offset definition */
 
#define PIN_OFFSET   0x04 /** Pin offset definition */
 
#define LPC_SCU_PIN(LPC_SCU_BASE, po, pi)   (*(volatile int *) ((LPC_SCU_BASE) + ((po) * 0x80) + ((pi) * 0x4))
 
#define LPC_SCU_CLK(LPC_SCU_BASE, c)   (*(volatile int *) ((LPC_SCU_BASE) +0xC00 + ((c) * 0x4)))
 

Functions

STATIC INLINE void Chip_SCU_PinMuxSet (uint8_t port, uint8_t pin, uint16_t modefunc)
 Sets I/O Control pin mux. More...
 
STATIC INLINE void Chip_SCU_PinMux (uint8_t port, uint8_t pin, uint16_t mode, uint8_t func)
 Configure pin function. More...
 
STATIC INLINE void Chip_SCU_ClockPinMuxSet (uint8_t clknum, uint16_t modefunc)
 Configure clock pin function (pins SFSCLKx) More...
 
STATIC INLINE void Chip_SCU_ClockPinMux (uint8_t clknum, uint16_t mode, uint8_t func)
 Configure clock pin function (pins SFSCLKx) More...
 
STATIC INLINE void Chip_SCU_GPIOIntPinSel (uint8_t PortSel, uint8_t PortNum, uint8_t PinNum)
 GPIO Interrupt Pin Select. More...
 
STATIC INLINE void Chip_SCU_I2C0PinConfig (uint32_t I2C0Mode)
 I2C Pin Configuration. More...
 
STATIC INLINE void Chip_SCU_ADC_Channel_Config (uint32_t ADC_ID, uint8_t channel)
 ADC Pin Configuration. More...
 
STATIC INLINE void Chip_SCU_DAC_Analog_Config (void)
 DAC Pin Configuration. More...
 
STATIC INLINE void Chip_SCU_SetPinMuxing (const PINMUX_GRP_T *pinArray, uint32_t arrayLength)
 Set all I/O Control pin muxing. More...
 

Macro Definition Documentation

#define FUNC0   0x0 /** Pin function 0 */

Definition at line 108 of file scu_18xx_43xx.h.

#define FUNC1   0x1 /** Pin function 1 */

Definition at line 109 of file scu_18xx_43xx.h.

#define FUNC2   0x2 /** Pin function 2 */

Definition at line 110 of file scu_18xx_43xx.h.

#define FUNC3   0x3 /** Pin function 3 */

Definition at line 111 of file scu_18xx_43xx.h.

#define FUNC4   0x4 /** Pin function 4 */

Definition at line 112 of file scu_18xx_43xx.h.

#define FUNC5   0x5 /** Pin function 5 */

Definition at line 113 of file scu_18xx_43xx.h.

#define FUNC6   0x6 /** Pin function 6 */

Definition at line 114 of file scu_18xx_43xx.h.

#define FUNC7   0x7 /** Pin function 7 */

Definition at line 115 of file scu_18xx_43xx.h.

#define I2C0_FAST_MODE_PLUS   (2 << 1 | 1 << 3 | 1 << 7 | 1 << 10 | 1 << 11) /** Pin configuration for Fast-mode Plus I2C */

Definition at line 107 of file scu_18xx_43xx.h.

#define I2C0_STANDARD_FAST_MODE   (1 << 3 | 1 << 11) /** Pin configuration for STANDARD/FAST mode I2C */

Definition at line 106 of file scu_18xx_43xx.h.

#define LPC_SCU_CLK (   LPC_SCU_BASE,
 
)    (*(volatile int *) ((LPC_SCU_BASE) +0xC00 + ((c) * 0x4)))

Returns the address in the SCU for a SFSCLK clock register, recommend using (*(volatile int *) &LPC_SCU->SFSCLK[c];)

Definition at line 124 of file scu_18xx_43xx.h.

#define LPC_SCU_PIN (   LPC_SCU_BASE,
  po,
  pi 
)    (*(volatile int *) ((LPC_SCU_BASE) + ((po) * 0x80) + ((pi) * 0x4))

Returns the SFSP register address in the SCU for a pin and port, recommend using (*(volatile int *) &LPC_SCU->SFSP[po][pi];)

Definition at line 121 of file scu_18xx_43xx.h.

#define MD_BUK   (0x1 << 3) /** Enable pull-down and pull-up resistor at resistor at pad (repeater mode) */

Definition at line 97 of file scu_18xx_43xx.h.

#define MD_EHD0   (0x1 << 8) /** EHD driver strength low bit */

Definition at line 103 of file scu_18xx_43xx.h.

#define MD_EHD1   (0x1 << 8) /** EHD driver strength high bit */

Definition at line 104 of file scu_18xx_43xx.h.

#define MD_EHS   (0x1 << 5) /** Enable fast slew rate */

Definition at line 100 of file scu_18xx_43xx.h.

#define MD_EZI   (0x1 << 6) /** Input buffer enable */

Definition at line 101 of file scu_18xx_43xx.h.

#define MD_PDN   (0x3 << 3) /** Enable pull-down resistor at pad */

Definition at line 99 of file scu_18xx_43xx.h.

#define MD_PLN   (0x2 << 3) /** Disable pull-down and pull-up resistor at resistor at pad */

Definition at line 98 of file scu_18xx_43xx.h.

#define MD_PLN_FAST   (MD_PLN | MD_EZI | MD_ZI | MD_EHS)

Definition at line 105 of file scu_18xx_43xx.h.

#define MD_PUP   (0x0 << 3) /** Enable pull-up resistor at pad */

SCU function and mode selection definitions (old) For backwards compatibility.

Definition at line 96 of file scu_18xx_43xx.h.

#define MD_ZI   (0x1 << 7) /** Disable input glitch filter */

Definition at line 102 of file scu_18xx_43xx.h.

#define PIN_OFFSET   0x04 /** Pin offset definition */

Definition at line 118 of file scu_18xx_43xx.h.

#define PORT_OFFSET   0x80 /** Port offset definition */

Definition at line 117 of file scu_18xx_43xx.h.

#define SCU_MODE_14MA_DRIVESTR   (0x2 << 8)

High drive: 14mA drive strength

Definition at line 80 of file scu_18xx_43xx.h.

#define SCU_MODE_20MA_DRIVESTR   (0x3 << 8)

Ultra high- drive: 20mA drive strength

Definition at line 81 of file scu_18xx_43xx.h.

#define SCU_MODE_4MA_DRIVESTR   (0x0 << 8)

Normal drive: 4mA drive strength

Definition at line 78 of file scu_18xx_43xx.h.

#define SCU_MODE_8MA_DRIVESTR   (0x1 << 8)

Medium drive: 8mA drive strength

Definition at line 79 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC0   0x0

Selects pin function 0

Definition at line 82 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC1   0x1

Selects pin function 1

Definition at line 83 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC2   0x2

Selects pin function 2

Definition at line 84 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC3   0x3

Selects pin function 3

Definition at line 85 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC4   0x4

Selects pin function 4

Definition at line 86 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC5   0x5

Selects pin function 5

Definition at line 87 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC6   0x6

Selects pin function 6

Definition at line 88 of file scu_18xx_43xx.h.

#define SCU_MODE_FUNC7   0x7

Selects pin function 7

Definition at line 89 of file scu_18xx_43xx.h.

#define SCU_MODE_HIGHSPEEDSLEW_EN   (0x1 << 5)

Enable high-speed slew

Definition at line 75 of file scu_18xx_43xx.h.

#define SCU_MODE_INACT   (0x2 << 3)

Disable pull-down and pull-up resistor at resistor at pad

Definition at line 73 of file scu_18xx_43xx.h.

#define SCU_MODE_INBUFF_EN   (0x1 << 6)

Enable Input buffer

Definition at line 76 of file scu_18xx_43xx.h.

#define SCU_MODE_PULLDOWN   (0x3 << 3)

Enable pull-down resistor at pad

Definition at line 74 of file scu_18xx_43xx.h.

#define SCU_MODE_PULLUP   (0x0 << 3)

SCU function and mode selection definitions See the User Manual for specific modes and functions supoprted by the various LPC18xx/43xx devices. Functionality can vary per device.Enable pull-up resistor at pad

Definition at line 71 of file scu_18xx_43xx.h.

#define SCU_MODE_REPEATER   (0x1 << 3)

Enable pull-down and pull-up resistor at resistor at pad (repeater mode)

Definition at line 72 of file scu_18xx_43xx.h.

#define SCU_MODE_ZIF_DIS   (0x1 << 7)

Disable input glitch filter

Definition at line 77 of file scu_18xx_43xx.h.

Definition at line 90 of file scu_18xx_43xx.h.

Function Documentation

STATIC INLINE void Chip_SCU_ADC_Channel_Config ( uint32_t  ADC_ID,
uint8_t  channel 
)

ADC Pin Configuration.

Parameters
ADC_ID: ADC number
channel: ADC channel
Returns
Nothing

Definition at line 210 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_ClockPinMux ( uint8_t  clknum,
uint16_t  mode,
uint8_t  func 
)

Configure clock pin function (pins SFSCLKx)

Parameters
clknum: Clock pin number, should be: 0..3
mode: OR'ed values or type SCU_MODE_*
func: Pin function, value of type SCU_MODE_FUNC0 to SCU_MODE_FUNC7
Returns
Nothing

Definition at line 173 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_ClockPinMuxSet ( uint8_t  clknum,
uint16_t  modefunc 
)

Configure clock pin function (pins SFSCLKx)

Parameters
clknum: Clock pin number, should be: 0..3
modefunc: OR'ed values or type SCU_MODE_*
Returns
Nothing

Definition at line 161 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_DAC_Analog_Config ( void  )

DAC Pin Configuration.

Returns
Nothing

Definition at line 219 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_GPIOIntPinSel ( uint8_t  PortSel,
uint8_t  PortNum,
uint8_t  PinNum 
)

GPIO Interrupt Pin Select.

Parameters
PortSel: GPIO PINTSEL interrupt, should be: 0 to 7
PortNum: GPIO port number interrupt, should be: 0 to 7
PinNum: GPIO pin number Interrupt , should be: 0 to 31
Returns
Nothing

Definition at line 185 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_I2C0PinConfig ( uint32_t  I2C0Mode)

I2C Pin Configuration.

Parameters
I2C0Mode: I2C0 mode, should be:
  • I2C0_STANDARD_FAST_MODE: Standard/Fast mode transmit
  • I2C0_FAST_MODE_PLUS: Fast-mode Plus transmit
Returns
Nothing

Definition at line 199 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_PinMux ( uint8_t  port,
uint8_t  pin,
uint16_t  mode,
uint8_t  func 
)

Configure pin function.

Parameters
port: Port number, should be: 0..15
pin: Pin number, should be: 0..31
mode: OR'ed values or type SCU_MODE_*
func: Pin function, value of type SCU_MODE_FUNC0 to SCU_MODE_FUNC7
Returns
Nothing
Note
Do not use for clock pins (SFSCLK0 .. SFSCLK4). Use Chip_SCU_ClockPinMux() function for SFSCLKx clock pins.

Definition at line 150 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_PinMuxSet ( uint8_t  port,
uint8_t  pin,
uint16_t  modefunc 
)

Sets I/O Control pin mux.

Parameters
port: Port number, should be: 0..15
pin: Pin number, should be: 0..31
modefunc: OR'ed values or type SCU_MODE_*
Returns
Nothing
Note
Do not use for clock pins (SFSCLK0 .. SFSCLK4). Use Chip_SCU_ClockPinMux() function for SFSCLKx clock pins.

Definition at line 135 of file scu_18xx_43xx.h.

STATIC INLINE void Chip_SCU_SetPinMuxing ( const PINMUX_GRP_T pinArray,
uint32_t  arrayLength 
)

Set all I/O Control pin muxing.

Parameters
pinArray: Pointer to array of pin mux selections
arrayLength: Number of entries in pinArray
Returns
Nothing

Definition at line 231 of file scu_18xx_43xx.h.