| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
CHIP: LPC8xx MRT register block and driver
LPC8xx chip specific drivers

## Detailed Description

This driver provides Multi-Rate Timer (MRT) support for the device. The driver requires the following IP drivers:
IP: MRT register block and driver

## Data Structures
struct | LPC_MRT_T
| MRT register block structure. More...

## Macros
#define | LPC_8XX_MRT_CHANNELS (4)
| LPC8xx MRT chip configuration.
#define | LPC_MRT_NO_IDLE_CHANNEL (0x40)
#define | LPC_MRT_CH0 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[0])
#define | LPC_MRT_CH1 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[1])
#define | LPC_MRT_CH2 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[2])
#define | LPC_MRT_CH3 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[3])
#define | MRT0_INTFLAG (1)
#define | MRT1_INTFLAG (2)
#define | MRT2_INTFLAG (4)
#define | MRT3_INTFLAG (8)

## Typedefs
typedef IP_MRT_001_T | LPC_MRT_CHANNEL_T
typedef IP_MRT_001_MODE_T | LPC_MRT_MODE_T

## Functions
STATIC INLINE void | Chip_MRT_Init (void)
| Initializes the MRT.
STATIC INLINE void | Chip_MRT_DeInit (void)
| De-initializes the MRT Channel.
STATIC INLINE uint32_t | Chip_MRT_GetInterval (LPC_MRT_CHANNEL_T *pMRT)
| Returns the timer time interval value.
STATIC INLINE void | Chip_MRT_SetInterval (LPC_MRT_CHANNEL_T *pMRT, uint32_t interval)
| Sets the timer time interval value.
STATIC INLINE uint32_t | Chip_MRT_GetTimer (LPC_MRT_CHANNEL_T *pMRT)
| Returns the current timer value.
STATIC INLINE bool | Chip_MRT_GetEnabled (LPC_MRT_CHANNEL_T *pMRT)
| Returns true if the timer is enabled.
STATIC INLINE void | Chip_MRT_SetEnabled (LPC_MRT_CHANNEL_T *pMRT)
| Enables the timer.
STATIC INLINE LPC_MRT_MODE_T | Chip_MRT_GetMode (LPC_MRT_CHANNEL_T *pMRT)
| Returns the timer mode (repeat or one-shot)
STATIC INLINE void | Chip_MRT_SetMode (LPC_MRT_CHANNEL_T *pMRT, LPC_MRT_MODE_T mode)
| Sets the timer mode (repeat or one-shot)
STATIC INLINE bool | Chip_MRT_IsRepeatMode (LPC_MRT_CHANNEL_T *pMRT)
| Check if the timer is configured in repeat mode.
STATIC INLINE bool | Chip_MRT_IsOneShotMode (LPC_MRT_CHANNEL_T *pMRT)
| Check if the timer is configured in one-shot mode.
STATIC INLINE bool | Chip_MRT_IntPending (LPC_MRT_CHANNEL_T *pMRT)
| Check if the timer has an interrupt pending.
STATIC INLINE void | Chip_MRT_IntClear (LPC_MRT_CHANNEL_T *pMRT)
| Clears the pending interrupt (if any)
STATIC INLINE bool | Chip_MRT_Running (LPC_MRT_CHANNEL_T *pMRT)
| Check if the timer is running.
STATIC INLINE uint8_t | Chip_MRT_GetIdleChannel (void)
| Returns the IDLE channel value.
STATIC INLINE uint32_t | Chip_MRT_GetIntPending (void)
| Returns the channel number of IRQ pending channel.

## Macro Definition Documentation

#define LPC_8XX_MRT_CHANNELS (4)

LPC8xx MRT chip configuration.

Definition at line 50 of file mrt_8xx.h.

#define LPC_MRT_CH0 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[0])

Definition at line 66 of file mrt_8xx.h.

#define LPC_MRT_CH1 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[1])

Definition at line 67 of file mrt_8xx.h.

#define LPC_MRT_CH2 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[2])

Definition at line 68 of file mrt_8xx.h.

#define LPC_MRT_CH3 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[3])

Definition at line 69 of file mrt_8xx.h.

#define LPC_MRT_NO_IDLE_CHANNEL (0x40)

Definition at line 51 of file mrt_8xx.h.

#define MRT0_INTFLAG (1)

Definition at line 71 of file mrt_8xx.h.

#define MRT1_INTFLAG (2)

Definition at line 72 of file mrt_8xx.h.

#define MRT2_INTFLAG (4)

Definition at line 73 of file mrt_8xx.h.

#define MRT3_INTFLAG (8)

Definition at line 74 of file mrt_8xx.h.

## Typedef Documentation

typedef IP_MRT_001_T LPC_MRT_CHANNEL_T

Definition at line 63 of file mrt_8xx.h.

typedef IP_MRT_001_MODE_T LPC_MRT_MODE_T

Definition at line 64 of file mrt_8xx.h.

## Function Documentation

STATIC INLINE void Chip_MRT_DeInit | ( | void |  | ) |

De-initializes the MRT Channel.

Returns
  Nothing

Definition at line 95 of file mrt_8xx.h.

STATIC INLINE bool Chip_MRT_GetEnabled | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Returns true if the timer is enabled.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  True if enabled, Flase if not enabled

Definition at line 142 of file mrt_8xx.h.

STATIC INLINE uint8_t Chip_MRT_GetIdleChannel | ( | void |  | ) |

Returns the IDLE channel value.

Returns
  IDLE channel value

Definition at line 232 of file mrt_8xx.h.

STATIC INLINE uint32_t Chip_MRT_GetInterval | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Returns the timer time interval value.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  Timer time interval value

Definition at line 108 of file mrt_8xx.h.

STATIC INLINE uint32_t Chip_MRT_GetIntPending | ( | void |  | ) |

Returns the channel number of IRQ pending channel.

Returns
  IRQ pending channel number

Definition at line 241 of file mrt_8xx.h.

STATIC INLINE LPC_MRT_MODE_T Chip_MRT_GetMode | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Returns the timer mode (repeat or one-shot)

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  The mode (repeat or one-shot).

Definition at line 162 of file mrt_8xx.h.

STATIC INLINE uint32_t Chip_MRT_GetTimer | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Returns the current timer value.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  The current timer value

Definition at line 132 of file mrt_8xx.h.

STATIC INLINE void Chip_MRT_Init | ( | void |  | ) |

Initializes the MRT.

Returns
  Nothing

Definition at line 80 of file mrt_8xx.h.

STATIC INLINE void Chip_MRT_IntClear | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Clears the pending interrupt (if any)

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  Nothing

Definition at line 213 of file mrt_8xx.h.

STATIC INLINE bool Chip_MRT_IntPending | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Check if the timer has an interrupt pending.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  True if interrupt is pending, False if no interrupt is pending

Definition at line 203 of file mrt_8xx.h.

STATIC INLINE bool Chip_MRT_IsOneShotMode | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Check if the timer is configured in one-shot mode.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  True if in one-shot mode, False if in repeat mode

Definition at line 193 of file mrt_8xx.h.

STATIC INLINE bool Chip_MRT_IsRepeatMode | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Check if the timer is configured in repeat mode.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  True if in repeat mode, False if in one-shot mode

Definition at line 183 of file mrt_8xx.h.

STATIC INLINE bool Chip_MRT_Running | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Check if the timer is running.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  True if running, False if stopped

Definition at line 223 of file mrt_8xx.h.

STATIC INLINE void Chip_MRT_SetEnabled | ( | LPC_MRT_CHANNEL_T * | pMRT | ) |

Enables the timer.

Parameters

  pMRT | : Pointer to selected MRT Channel

Returns
  Nothing

Definition at line 152 of file mrt_8xx.h.

STATIC INLINE void Chip_MRT_SetInterval | ( | LPC_MRT_CHANNEL_T * | pMRT,
|  | uint32_t | interval
| ) |  |

Sets the timer time interval value.

Parameters

  pMRT | : Pointer to selected MRT Channel
  interval | : The interval timeout (24-bits).

Returns
  Nothing

Note
  Setting bit 31 in timer time interval register causes the time interval value to load immediately, otherwise the time interval value will be loaded in next timer cycle

Definition at line 122 of file mrt_8xx.h.

STATIC INLINE void Chip_MRT_SetMode | ( | LPC_MRT_CHANNEL_T * | pMRT,
|  | LPC_MRT_MODE_T | mode
| ) |  |

Sets the timer mode (repeat or one-shot)

Parameters

  pMRT | : Pointer to selected MRT Channel
  mode | : 0 = repeat, 1 = one-shot

Returns
  Nothing

Definition at line 173 of file mrt_8xx.h.