MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations | Functions
TIMER

## Data Structures
struct | _TIMER_Obj_
| Defines the timer (TIMER) object. More...

## Macros
#define | TIMER0_BASE_ADDR (0x00000C00)
| Defines the base address of the timer (TIMER) 0 registers. More...
#define | TIMER1_BASE_ADDR (0x00000C08)
| Defines the base address of the timer (TIMER) 1 registers. More...
#define | TIMER2_BASE_ADDR (0x00000C10)
| Defines the base address of the timer (TIMER) 2 registers. More...
#define | TIMER_TCR_TSS_BITS (1 << 4)
| Defines the location of the TSS bits in the TCR register. More...
#define | TIMER_TCR_TRB_BITS (1 << 5)
| Defines the location of the TRB bits in the TCR register. More...
#define | TIMER_TCR_FREESOFT_BITS (3 << 10)
| Defines the location of the FREESOFT bits in the TCR register. More...
#define | TIMER_TCR_TIE_BITS (1 << 14)
| Defines the location of the TIE bits in the TCR register. More...
#define | TIMER_TCR_TIF_BITS (1 << 15)
| Defines the location of the TIF bits in the TCR register. More...

## Typedefs
typedef struct _TIMER_Obj_ | TIMER_Obj
| Defines the timer (TIMER) object. More...
typedef struct _TIMER_Obj_ * | TIMER_Handle
| Defines the timer (TIMER) handle. More...

## Enumerations
enum | TIMER_EmulationMode_e { TIMER_EmulationMode_StopAfterNextDecrement =(0 << 10), TIMER_EmulationMode_StopAtZero =(1 << 10), TIMER_EmulationMode_RunFree =(2 << 10) }
| Enumeration to define the timer (TIMER) emulation mode. More...
enum | TIMER_Status_e { TIMER_Status_CntIsNotZero =(0 << 15), TIMER_Status_CntIsZero =(1 << 15) }
| Enumeration to define the timer (TIMER) status. More...

## Functions
void | TIMER_clearFlag (TIMER_Handle timerHandle)
| Clears the timer (TIMER) flag. More...
void | TIMER_disableInt (TIMER_Handle timerHandle)
| Disables the timer (TIMER) interrupt. More...
void | TIMER_enableInt (TIMER_Handle timerHandle)
| Enables the timer (TIMER) interrupt. More...
static uint32_t | TIMER_getCount (TIMER_Handle timerHandle)
| Gets the timer (TIMER) count. More...
TIMER_Status_e | TIMER_getStatus (TIMER_Handle timerHandle)
| Gets the timer (TIMER) status. More...
TIMER_Handle | TIMER_init (void *pMemory, const size_t numBytes)
| Initializes the timer (TIMER) object handle. More...
static void | TIMER_reload (TIMER_Handle timerHandle)
| Reloads the timer (TIMER) value. More...
void | TIMER_setDecimationFactor (TIMER_Handle timerHandle, const uint16_t decFactor)
| Sets the timer (TIMER) decimation factor. More...
void | TIMER_setEmulationMode (TIMER_Handle timerHandle, const TIMER_EmulationMode_e mode)
| Sets the timer (TIMER) emulation mode. More...
static uint32_t | TIMER_getPeriod (TIMER_Handle timerHandle)
| Gets the timer (TIMER) period. More...
static void | TIMER_setPeriod (TIMER_Handle timerHandle, const uint32_t period)
| Sets the timer (TIMER) period. More...
void | TIMER_setPreScaler (TIMER_Handle timerHandle, const uint16_t preScaler)
| Sets the timer (TIMER) prescaler. More...
static void | TIMER_start (TIMER_Handle timerHandle)
| Starts the timer (TIMER) More...
static void | TIMER_stop (TIMER_Handle timerHandle)
| Stops the timer (TIMER) More...

## Detailed Description

## Data Structure Documentation

struct _TIMER_Obj_

Defines the timer (TIMER) object.

Definition at line 122 of file timer.h.

Data Fields
volatile uint32_t | PRD | Period Register.
volatile uint16_t | resvd_1 | Reserved.
volatile uint16_t | TCR | Timer Control Register.
volatile uint32_t | TIM | Timer Counter Register.
volatile uint32_t | TPR | Timer Prescaler Register.

## Macro Definition Documentation

#define TIMER0_BASE_ADDR (0x00000C00)

Defines the base address of the timer (TIMER) 0 registers.

Definition at line 65 of file timer.h.

#define TIMER1_BASE_ADDR (0x00000C08)

Defines the base address of the timer (TIMER) 1 registers.

Definition at line 69 of file timer.h.

#define TIMER2_BASE_ADDR (0x00000C10)

Defines the base address of the timer (TIMER) 2 registers.

Definition at line 73 of file timer.h.

#define TIMER_TCR_FREESOFT_BITS (3 << 10)

Defines the location of the FREESOFT bits in the TCR register.

Definition at line 86 of file timer.h.

Referenced by TIMER_setEmulationMode().

#define TIMER_TCR_TIE_BITS (1 << 14)

Defines the location of the TIE bits in the TCR register.

Definition at line 90 of file timer.h.

Referenced by TIMER_disableInt(), and TIMER_enableInt().

#define TIMER_TCR_TIF_BITS (1 << 15)

Defines the location of the TIF bits in the TCR register.

Definition at line 94 of file timer.h.

Referenced by TIMER_clearFlag(), and TIMER_getStatus().

#define TIMER_TCR_TRB_BITS (1 << 5)

Defines the location of the TRB bits in the TCR register.

Definition at line 82 of file timer.h.

Referenced by TIMER_reload().

#define TIMER_TCR_TSS_BITS (1 << 4)

Defines the location of the TSS bits in the TCR register.

Definition at line 78 of file timer.h.

Referenced by TIMER_start(), and TIMER_stop().

## Typedef Documentation

typedef struct _TIMER_Obj_* TIMER_Handle

Defines the timer (TIMER) handle.

Definition at line 134 of file timer.h.

typedef struct _TIMER_Obj_ TIMER_Obj

Defines the timer (TIMER) object.

## Enumeration Type Documentation

enum TIMER_EmulationMode_e

Enumeration to define the timer (TIMER) emulation mode.

Enumerator
TIMER_EmulationMode_StopAfterNextDecrement | Denotes that the timer will stop after the next decrement.
TIMER_EmulationMode_StopAtZero | Denotes that the timer will stop when it reaches zero.
TIMER_EmulationMode_RunFree | Denotes that the timer will run free.

Definition at line 103 of file timer.h.

enum TIMER_Status_e

Enumeration to define the timer (TIMER) status.

Enumerator
TIMER_Status_CntIsNotZero | Denotes that the counter is non-zero.
TIMER_Status_CntIsZero | Denotes that the counter is zero.

Definition at line 113 of file timer.h.

## Function Documentation

void TIMER_clearFlag | ( | TIMER_Handle | timerHandle | ) |

Clears the timer (TIMER) flag.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 55 of file timer.c.

References _TIMER_Obj_::TCR, and TIMER_TCR_TIF_BITS.

void TIMER_disableInt | ( | TIMER_Handle | timerHandle | ) |

Disables the timer (TIMER) interrupt.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 67 of file timer.c.

References _TIMER_Obj_::TCR, and TIMER_TCR_TIE_BITS.

void TIMER_enableInt | ( | TIMER_Handle | timerHandle | ) |

Enables the timer (TIMER) interrupt.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 79 of file timer.c.

References _TIMER_Obj_::TCR, and TIMER_TCR_TIE_BITS.

static uint32_t TIMER_getCount | ( | TIMER_Handle | timerHandle | ) |
| inline static

Gets the timer (TIMER) count.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Returns
  The timer (TIMER) count

Definition at line 163 of file timer.h.

References _TIMER_Obj_::TIM.

static uint32_t TIMER_getPeriod | ( | TIMER_Handle | timerHandle | ) |
| inline static

Gets the timer (TIMER) period.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Returns
  The timer (TIMER) period

Definition at line 219 of file timer.h.

References _TIMER_Obj_::PRD.

TIMER_Status_e TIMER_getStatus | ( | TIMER_Handle | timerHandle | ) |

Gets the timer (TIMER) status.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Returns
  The timer (TIMER) status

Definition at line 91 of file timer.c.

References _TIMER_Obj_::TCR, and TIMER_TCR_TIF_BITS.

TIMER_Handle TIMER_init | ( | void * | pMemory,
|  | const size_t | numBytes
| ) |  |

Initializes the timer (TIMER) object handle.

Parameters

  [in] | pMemory | A pointer to the base address of the TIMER registers
  [in] | numBytes | The number of bytes allocated for the TIMER object, bytes

Returns
  The timer (CLK) object handle

Definition at line 103 of file timer.c.

static void TIMER_reload | ( | TIMER_Handle | timerHandle | ) |
| inline static

Reloads the timer (TIMER) value.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 190 of file timer.h.

References _TIMER_Obj_::TCR, and TIMER_TCR_TRB_BITS.

void TIMER_setDecimationFactor | ( | TIMER_Handle | timerHandle,
|  | const uint16_t | decFactor
| ) |  |

Sets the timer (TIMER) decimation factor.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle
  [in] | decFactor | The timer decimation factor

Definition at line 118 of file timer.c.

References _TIMER_Obj_::TPR.

void TIMER_setEmulationMode | ( | TIMER_Handle | timerHandle,
|  | const TIMER_EmulationMode_e | mode
| ) |  |

Sets the timer (TIMER) emulation mode.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle
  [in] | mode | The emulation mode

Definition at line 132 of file timer.c.

References _TIMER_Obj_::TCR, and TIMER_TCR_FREESOFT_BITS.

static void TIMER_setPeriod | ( | TIMER_Handle | timerHandle,
|  | const uint32_t | period
| ) |  |
| inline static

Sets the timer (TIMER) period.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle
  [in] | period | The period

Definition at line 234 of file timer.h.

References _TIMER_Obj_::PRD.

void TIMER_setPreScaler | ( | TIMER_Handle | timerHandle,
|  | const uint16_t | preScaler
| ) |  |

Sets the timer (TIMER) prescaler.

Parameters

  [in] | timerHandle | The timer (TIMER) object handle
  [in] | preScaler | The preScaler value

Definition at line 148 of file timer.c.

References _TIMER_Obj_::TPR.

static void TIMER_start | ( | TIMER_Handle | timerHandle | ) |
| inline static

Starts the timer (TIMER)

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 256 of file timer.h.

References _TIMER_Obj_::TCR, and TIMER_TCR_TSS_BITS.

static void TIMER_stop | ( | TIMER_Handle | timerHandle | ) |
| inline static

Stops the timer (TIMER)

Parameters

  [in] | timerHandle | The timer (TIMER) object handle

Definition at line 270 of file timer.h.

References _TIMER_Obj_::TCR, and TIMER_TCR_TSS_BITS.