LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IP: SCT register block and driver

Detailed Description

State Configurable Timer

Data Structures

struct  IP_SCT_001_T
 State Configurable Timer register block structure. More...
 

Macros

#define CONFIG_SCT_nEV   (16)
 SCT Module configuration.
 
#define CONFIG_SCT_nRG   (16)
 
#define CONFIG_SCT_nOU   (16)
 
#define SCT_CONFIG_16BIT_COUNTER   0x00000000
 Macro defines for SCT configuration register.
 
#define SCT_CONFIG_32BIT_COUNTER   0x00000001
 
#define SCT_CONFIG_CLKMODE_BUSCLK   (0x0 << 1)
 
#define SCT_CONFIG_CLKMODE_SCTCLK   (0x1 << 1)
 
#define SCT_CONFIG_CLKMODE_INCLK   (0x2 << 1)
 
#define SCT_CONFIG_CLKMODE_INEDGECLK   (0x3 << 1)
 
#define SCT_CONFIG_NORELOADL_U   (0x1 << 7)
 
#define SCT_CONFIG_NORELOADH   (0x1 << 8)
 
#define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO   0
 
#define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO   0
 
#define COUNTUP_TO   LIMIT_THEN_COUNTDOWN_TO_ZERO 1
 
#define COUNTUP_TO   LIMIT_THEN_COUNTDOWN_TO_ZERO 1
 
#define SCT_CTRL_STOP_L   (1 << 1)
 
#define SCT_CTRL_HALT_L   (1 << 2)
 
#define SCT_CTRL_CLRCTR_L   (1 << 3)
 
#define SCT_CTRL_BIDIR_L(x)   (((x) & 0x01) << 4)
 
#define SCT_CTRL_PRE_L(x)   (((x) & 0xFF) << 5)
 
#define SCT_CTRL_STOP_H   (1 << 17)
 
#define SCT_CTRL_HALT_H   (1 << 18)
 
#define SCT_CTRL_CLRCTR_H   (1 << 19)
 
#define SCT_CTRL_BIDIR_H(x)   (((x) & 0x01) << 20)
 
#define SCT_CTRL_PRE_H(x)   (((x) & 0xFF) << 21)
 
#define SCT_RES_NOCHANGE   (0)
 
#define SCT_RES_SET_OUTPUT   (1)
 
#define SCT_RES_CLEAR_OUTPUT   (2)
 
#define SCT_RES_TOGGLE_OUTPUT   (3)
 

Functions

STATIC INLINE void IP_SCT_SetCount (IP_SCT_001_T *pSCT, uint32_t count)
 Set the value in SCT unified count register.
 
STATIC INLINE void IP_SCT_SetCountL (IP_SCT_001_T *pSCT, uint16_t count)
 Set the value in SCT Lower count register.
 
STATIC INLINE void IP_SCT_SetCountH (IP_SCT_001_T *pSCT, uint16_t count)
 Set the value in SCT Higher count register.
 
STATIC INLINE void IP_SCT_SetMatchCount (IP_SCT_001_T *pSCT, uint32_t n, uint32_t count)
 Set the match value in SCT Unified match register.
 
STATIC INLINE void IP_SCT_SetMatchReload (IP_SCT_001_T *pSCT, uint32_t n, uint32_t count)
 Set the match reload value in SCT Unified match reload register.
 
STATIC INLINE void IP_SCT_EventIntEnable (IP_SCT_001_T *pSCT, uint32_t evt)
 Enable the interrupt for the specified event.
 
STATIC INLINE void IP_SCT_EventIntDisable (IP_SCT_001_T *pSCT, uint32_t evt)
 Disable the interrupt for the specified event.
 
STATIC INLINE void IP_SCT_ClearEventFlag (IP_SCT_001_T *pSCT, uint32_t evt)
 Clear the specified event flag.
 
void IP_SCT_Config (IP_SCT_001_T *pSCT, uint32_t value)
 Configure SCT.
 
void IP_SCT_ControlSetClr (IP_SCT_001_T *pSCT, uint32_t value, FunctionalState ena)
 Set or Clear the Control register.
 
void IP_SCT_ConflictResolutionSet (IP_SCT_001_T *pSCT, uint8_t outnum, uint8_t value)
 Set the conflict resolution.
 
void IP_SCT_EventFlagClear (IP_SCT_001_T *pSCT, uint8_t even_num)
 Clear the SCT event flag.
 

Macro Definition Documentation

#define CONFIG_SCT_nEV   (16)

SCT Module configuration.

Number of events

Definition at line 51 of file sct_001.h.

#define CONFIG_SCT_nOU   (16)

Number of outputs

Definition at line 53 of file sct_001.h.

#define CONFIG_SCT_nRG   (16)

Number of match/compare registers

Definition at line 52 of file sct_001.h.

#define COUNTUP_TO   LIMIT_THEN_COUNTDOWN_TO_ZERO 1

Definition at line 212 of file sct_001.h.

#define COUNTUP_TO   LIMIT_THEN_COUNTDOWN_TO_ZERO 1

Definition at line 212 of file sct_001.h.

#define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO   0

Direction for low or unified counter

Direction for high counter

Definition at line 211 of file sct_001.h.

#define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO   0

Direction for low or unified counter

Direction for high counter

Definition at line 211 of file sct_001.h.

#define SCT_CONFIG_16BIT_COUNTER   0x00000000

Macro defines for SCT configuration register.

Operate as 2 16-bit counters

Definition at line 188 of file sct_001.h.

#define SCT_CONFIG_32BIT_COUNTER   0x00000001

Operate as 1 32-bit counter

Definition at line 189 of file sct_001.h.

#define SCT_CONFIG_CLKMODE_BUSCLK   (0x0 << 1)

Bus clock

Definition at line 191 of file sct_001.h.

#define SCT_CONFIG_CLKMODE_INCLK   (0x2 << 1)

Input clock selected in CLKSEL field

Definition at line 193 of file sct_001.h.

#define SCT_CONFIG_CLKMODE_INEDGECLK   (0x3 << 1)

Input clock edge selected in CLKSEL field

Definition at line 194 of file sct_001.h.

#define SCT_CONFIG_CLKMODE_SCTCLK   (0x1 << 1)

SCT clock

Definition at line 192 of file sct_001.h.

#define SCT_CONFIG_NORELOADH   (0x1 << 8)

Operate as 1 32-bit counter

Definition at line 197 of file sct_001.h.

#define SCT_CONFIG_NORELOADL_U   (0x1 << 7)

Operate as 1 32-bit counter

Definition at line 196 of file sct_001.h.

#define SCT_CTRL_BIDIR_H (   x)    (((x) & 0x01) << 20)

Definition at line 216 of file sct_001.h.

#define SCT_CTRL_BIDIR_L (   x)    (((x) & 0x01) << 4)

Bidirectional bit

Definition at line 208 of file sct_001.h.

#define SCT_CTRL_CLRCTR_H   (1 << 19)

Clear high counter

Definition at line 215 of file sct_001.h.

#define SCT_CTRL_CLRCTR_L   (1 << 3)

Clear low or unified counter

Definition at line 207 of file sct_001.h.

#define SCT_CTRL_HALT_H   (1 << 18)

Halt high counter

Definition at line 214 of file sct_001.h.

#define SCT_CTRL_HALT_L   (1 << 2)

Halt low counter

Definition at line 206 of file sct_001.h.

#define SCT_CTRL_PRE_H (   x)    (((x) & 0xFF) << 21)

Prescale clock for high counter

Definition at line 217 of file sct_001.h.

#define SCT_CTRL_PRE_L (   x)    (((x) & 0xFF) << 5)

Prescale clock for low or unified counter

Definition at line 209 of file sct_001.h.

#define SCT_CTRL_STOP_H   (1 << 17)

Stop high counter

Definition at line 213 of file sct_001.h.

#define SCT_CTRL_STOP_L   (1 << 1)

Stop low counter

Definition at line 205 of file sct_001.h.

#define SCT_RES_CLEAR_OUTPUT   (2)

Definition at line 224 of file sct_001.h.

#define SCT_RES_NOCHANGE   (0)

Definition at line 222 of file sct_001.h.

#define SCT_RES_SET_OUTPUT   (1)

Definition at line 223 of file sct_001.h.

#define SCT_RES_TOGGLE_OUTPUT   (3)

Definition at line 225 of file sct_001.h.

Function Documentation

STATIC INLINE void IP_SCT_ClearEventFlag ( IP_SCT_001_T pSCT,
uint32_t  evt 
)

Clear the specified event flag.

Parameters
pSCT: Pointer to SCT register block
evt: Event value
Returns
Nothing

Definition at line 316 of file sct_001.h.

void IP_SCT_Config ( IP_SCT_001_T pSCT,
uint32_t  value 
)

Configure SCT.

Parameters
pSCT: Pointer to SCT register block
value: SCT Configuration register value
Returns
Nothing
Note
Initialise the SCT configuration register with the value

Definition at line 51 of file sct_001.c.

void IP_SCT_ConflictResolutionSet ( IP_SCT_001_T pSCT,
uint8_t  outnum,
uint8_t  value 
)

Set the conflict resolution.

Parameters
pSCT: Pointer to SCT register block
outnum: Output number
value: Output value
  • SCT_RES_NOCHANGE :No change
  • SCT_RES_SET_OUTPUT :Set output
  • SCT_RES_CLEAR_OUTPUT :Clear output
  • SCT_RES_TOGGLE_OUTPUT :Toggle output : SCT_RES_NOCHANGE : DISABLE - To clear the field specified by value
    Returns
    Nothing
    Note
    Set conflict resolution value for the output outnum

Definition at line 73 of file sct_001.c.

void IP_SCT_ControlSetClr ( IP_SCT_001_T pSCT,
uint32_t  value,
FunctionalState  ena 
)

Set or Clear the Control register.

Parameters
pSCT: Pointer to SCT register block
value: SCT Control register value
ena: ENABLE - To set the fields specified by value : DISABLE - To clear the field specified by value
Returns
Nothing
Note
Set or clear the control register bits as specified by value. If ena is set to ENABLE, the mentioned register fields will be set. If a\ ena is set to DISABLE, the mentioned register fields will be cleared

Definition at line 57 of file sct_001.c.

void IP_SCT_EventFlagClear ( IP_SCT_001_T pSCT,
uint8_t  even_num 
)

Clear the SCT event flag.

Parameters
pSCT: Pointer to SCT register block
even_num: SCT Event number
Returns
Nothing
Note
Clear the SCT event flag for the event even_num

Definition at line 84 of file sct_001.c.

STATIC INLINE void IP_SCT_EventIntDisable ( IP_SCT_001_T pSCT,
uint32_t  evt 
)

Disable the interrupt for the specified event.

Parameters
pSCT: Pointer to SCT register block
evt: Event value
Returns
Nothing

Definition at line 305 of file sct_001.h.

STATIC INLINE void IP_SCT_EventIntEnable ( IP_SCT_001_T pSCT,
uint32_t  evt 
)

Enable the interrupt for the specified event.

Parameters
pSCT: Pointer to SCT register block
evt: Event value
Returns
Nothing

Definition at line 294 of file sct_001.h.

STATIC INLINE void IP_SCT_SetCount ( IP_SCT_001_T pSCT,
uint32_t  count 
)

Set the value in SCT unified count register.

Parameters
pSCT: Pointer to SCT register block
count: SCT count value
Returns
Nothing
Note
Writes 32-bit value into SCT unified count register

Definition at line 234 of file sct_001.h.

STATIC INLINE void IP_SCT_SetCountH ( IP_SCT_001_T pSCT,
uint16_t  count 
)

Set the value in SCT Higher count register.

Parameters
pSCT: Pointer to SCT register block
count: SCT count value
Returns
Nothing
Note
Writes 16-bit value into SCT Higher count register

Definition at line 258 of file sct_001.h.

STATIC INLINE void IP_SCT_SetCountL ( IP_SCT_001_T pSCT,
uint16_t  count 
)

Set the value in SCT Lower count register.

Parameters
pSCT: Pointer to SCT register block
count: SCT count value
Returns
Nothing
Note
Writes 16-bit value into SCT Lower count register

Definition at line 246 of file sct_001.h.

STATIC INLINE void IP_SCT_SetMatchCount ( IP_SCT_001_T pSCT,
uint32_t  n,
uint32_t  count 
)

Set the match value in SCT Unified match register.

Parameters
pSCT: Pointer to SCT register block
n: Match register number
count: SCT match count value
Returns
Nothing
Note
Writes 32-bit value into SCT unified match register

Definition at line 271 of file sct_001.h.

STATIC INLINE void IP_SCT_SetMatchReload ( IP_SCT_001_T pSCT,
uint32_t  n,
uint32_t  count 
)

Set the match reload value in SCT Unified match reload register.

Parameters
pSCT: Pointer to SCT register block
n: Match register number
count: SCT match reload count value
Returns
Nothing

Definition at line 283 of file sct_001.h.