xpci3xxx: Timer

xpci3xxx 1.00.00

Macros
Timer

## Macros
#define | CMD_xpci3xxx_InitTimer _IOR(xpci3xxx_MAGIC, 80,long)
| Initialize the timer.
#define | CMD_xpci3xxx_ReleaseTimer _IOR(xpci3xxx_MAGIC, 81,long)
| Stop and free the timer.
#define | CMD_xpci3xxx_StartTimer _IOR(xpci3xxx_MAGIC, 82,long)
| Start selected timer.
#define | CMD_xpci3xxx_StartAllTimers _IOR(xpci3xxx_MAGIC, 83,long)
| Start all already initialized timers.
#define | CMD_xpci3xxx_TriggerTimer _IOR(xpci3xxx_MAGIC, 84,long)
| Triggers the selected timer.
#define | CMD_xpci3xxx_TriggerAllTimers _IOR(xpci3xxx_MAGIC, 85,long)
| Triggers all initialized timers.
#define | CMD_xpci3xxx_StopTimer _IOR(xpci3xxx_MAGIC, 86,long)
| Stop the selected timer.
#define | CMD_xpci3xxx_StopAllTimers _IOR(xpci3xxx_MAGIC, 87,long)
| Stop all started timers.
#define | CMD_xpci3xxx_ReadTimerValue _IOR(xpci3xxx_MAGIC, 88,long)
| Read the timer value.
#define | CMD_xpci3xxx_ReadTimerStatus _IOR(xpci3xxx_MAGIC, 89,long)
| Returns the timer status.
#define | CMD_xpci3xxx_EnableDisableTimerInterrupt _IOR(xpci3xxx_MAGIC, 90,long)
| Enable/disable the timer interrupt.
#define | CMD_xpci3xxx_EnableDisableTimerHardwareOutput _IOR(xpci3xxx_MAGIC, 91,long)
| Enable/disable the hardware timer output.
#define | CMD_xpci3xxx_GetTimerHardwareOutputStatus _IOR(xpci3xxx_MAGIC, 92,long)
| Returns the status of the output of the hardware timer.

## Detailed Description

## Macro Definition Documentation

## ◆ CMD_xpci3xxx_EnableDisableTimerHardwareOutput

#define CMD_xpci3xxx_EnableDisableTimerHardwareOutput _IOR(xpci3xxx_MAGIC, 91,long)

Enable/disable the hardware timer output.

Parameters

  [in] | uint8_t | arg[3] Parameters

- arg[0] Selected timer number
- arg[1] Control flag = ADDIDATA_DISABLE : not used | ADDIDATA_ENABLE : active
- arg[2] output Level
  - ADDIDATA_HIGH : when counter overflows, the output is set to high

ADDIDATA_LOW : If the counter overflows, the output is set to low

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog
  6 | : Wrong output flag
  7 | : Wrong output level

Definition at line 1331 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_EnableDisableTimerInterrupt

#define CMD_xpci3xxx_EnableDisableTimerInterrupt _IOR(xpci3xxx_MAGIC, 90,long)

Enable/disable the timer interrupt.

Controls if a timer will or not generate an interrupt.

Parameters

  [in] | uint8_t | *arg Parameters

- arg[0] Timer number
- arg[1] Control flag = ADDIDATA_ENABLE | ADDIDATA_DISABLE

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog
  6 | : Wrong control flag
  7 | : Interrupt call-back not installed

Definition at line 1309 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_GetTimerHardwareOutputStatus

#define CMD_xpci3xxx_GetTimerHardwareOutputStatus _IOR(xpci3xxx_MAGIC, 92,long)

Returns the status of the output of the hardware timer.

Parameters

  [in,out] | uint8_t | *arg Parameter and result

- arg[0] (in) Selected timer number
- arg[1] (out) Status = 0 : output not active | 1: output is active

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1348 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_InitTimer

#define CMD_xpci3xxx_InitTimer _IOR(xpci3xxx_MAGIC, 80,long)

Initialize the timer.

Parameters

  [in] | uint32_t | arg[4] Parameters

- arg[0] Timer number
- arg[1] Timer mode (see below)
- arg[2] Timer Time Unit : Timer unit
  - 0 : nanoseconds
  - 1 : microseconds
  - 2 : milliseconds
  - 3 : seconds
- arg[3] Start value or time interval (depending of the board)

Return values

  0 | : Success
  1 | : Internal error
  2 | : Wrong Timer number
  3 | : Timer already used as counter
  4 | : Timer already used as watchdog
  5 | : Wrong Timer mode
  6 | : Wrong Timer time unit
  7 | : Wrong reload value

# Timer mode description

    Selected                     Mode description                   dw_ReloadValue  Hardware gate
     mode                                                              description   input action
     0       Mode 0 is typically used for event counting. After    Start counting  Hardware gate
             the initialization, OUT is initially low, and remains     value
             low until the counter reaches 0. OUT goes high and
             remains high until a new count is written.
     1       Mode 1 is similar to mode 0 except for the gate       Start counting    Hardware
             input action.                                             value           trigger
             The gate input is not used to enable or disable the
             timer (like in Mode 0), but to trigger it.
     2       This mode functions like a divide-by-                 Divider factor  Hardware gate
             ul_ReloadValue counter. It is used to generate a real
             time clock interrupt. OUT is initially high after the
             initialization. When the initial count has
             decremented to 1, OUT goes low for one CLK pulse.
             OUT then goes high again, the counter reloads the
             initial count (ul_ReloadValue) and the process is
             repeated. This action can generate an interrupt.
     3       Mode 3 is typically used for baud rate generation.    Divider factor  Hardware gate
             This mode is similar to mode 2 except for the duty
             cycle of OUT. OUT will initially be high after the
             initialization. When the initial count
             (ul_ReloadValue) has expired, OUT goes low for
             the next sequence.then the initial count (ul_ReloadValue)
             of that sequence has expired, OUT goes high again for
             the following sequence.
             The mode is periodic;
             the sequence above is repeated indefinitely.
     4       OUT is initially high after the initialization. When  Start counting  Hardware gate
             the initial count expires, OUT will go low for one        value
             CLK pulse and then go high again. The counting
             sequence is triggered by writing a new value. If a
             new count is written during counting, it will be
             loaded on the next CLK pulse.
     5       Mode 5 is similar to mode 4 except for the gate input Start counting    Hardware
             action.                                                   value           trigger
             The gate input is not used to enable or disable the
             timer, but to trigger it.

Definition at line 1159 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_ReadTimerStatus

#define CMD_xpci3xxx_ReadTimerStatus _IOR(xpci3xxx_MAGIC, 89,long)

Returns the timer status.

Parameters

  [in,out] | uint8_t | b_ArgTable[4] Parameter and results

- arg[0] (in) Selected timer number
- arg[1] (out) Timer status = 0 : no overflow | 1 : timer overflow
- arg[2] (out) Software Trigger Status = 0 : none | 1 : software trigger occurred
- arg[3] (out) Hardware Trigger Status = 0 : none | 1 : hardware trigger occurred

Note
  When the status of the software trigger is read, it is automatically reset. At the next call of this command, 0 is returned if no trigger occurred during this period.

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1289 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_ReadTimerValue

#define CMD_xpci3xxx_ReadTimerValue _IOR(xpci3xxx_MAGIC, 88,long)

Read the timer value.

Parameters

  [in,out] | uint32_t | arg[2] Parameters and result

- arg[0] (in) Selected timer number - indexed from 0
- arg[1] (out) current timer value

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1267 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_ReleaseTimer

#define CMD_xpci3xxx_ReleaseTimer _IOR(xpci3xxx_MAGIC, 81,long)

Stop and free the timer.

If a counter has been initialized, it can be reinitialized again only if this command is called before.

Parameters

  [in] | uint8_t | *arg Select the timer

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer is configured as counter
  5 | : Timer is configured as watchdog

Definition at line 1176 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_StartAllTimers

#define CMD_xpci3xxx_StartAllTimers _IOR(xpci3xxx_MAGIC, 83,long)

Start all already initialized timers.

Parameters

  NULL | (ignored)

Return values

  0 | Success
  1 | Internal error

Definition at line 1200 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_StartTimer

#define CMD_xpci3xxx_StartTimer _IOR(xpci3xxx_MAGIC, 82,long)

Start selected timer.

Parameters

  [in] | uint8_t | *arg Selected timer number

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1190 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_StopAllTimers

#define CMD_xpci3xxx_StopAllTimers _IOR(xpci3xxx_MAGIC, 87,long)

Stop all started timers.

Parameters

  NULL | (ignored)

Return values

  0 | : Success
  1 | : Internal error

Definition at line 1249 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_StopTimer

#define CMD_xpci3xxx_StopTimer _IOR(xpci3xxx_MAGIC, 86,long)

Stop the selected timer.

Parameters

  [in] | uint8_t | *arg Selected timer number

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1238 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_TriggerAllTimers

#define CMD_xpci3xxx_TriggerAllTimers _IOR(xpci3xxx_MAGIC, 85,long)

Triggers all initialized timers.

Parameters

  NULL | (ignored)

Return values

  0 | : Success
  1 | : Internal error

Definition at line 1224 of file xpci3xxx.h.

## ◆ CMD_xpci3xxx_TriggerTimer

#define CMD_xpci3xxx_TriggerTimer _IOR(xpci3xxx_MAGIC, 84,long)

Triggers the selected timer.

Parameters

  [in] | uint8_t | *arg Selected timer number

Return values

  0 | : Success
  1 | : Internal error
  2 | : Timer not initialized
  3 | : Wrong Timer number
  4 | : Timer was initialized as counter
  5 | : Timer was initialized as watchdog

Definition at line 1214 of file xpci3xxx.h.