xPCI-3120 API
xPCI-3120 timer/watchdog functions

Functions

_INT_ i_PCI3120_InitAndStartTimerWatchdog (HANDLE h_DeviceHandle, BYTE b_TimerMode, DWORD dw_DelayValue, BYTE b_InterruptFlag)
 
_INT_ i_PCI3120_StopTimerWatchdog (HANDLE h_DeviceHandle)
 
_INT_ i_PCI3120_ReadWatchdogStatus (HANDLE h_DeviceHandle, PBYTE pb_WatchdogStatus)
 
_INT_ i_PCI3120_ReadTimerValue (HANDLE h_DeviceHandle, PDWORD pdw_ReadValue)
 
_INT_ i_PCI3120_WriteTimerValue (HANDLE h_DeviceHandle, DWORD dw_WriteValue)
 

Detailed Description

Function Documentation

◆ i_PCI3120_InitAndStartTimerWatchdog()

_INT_ i_PCI3120_InitAndStartTimerWatchdog ( HANDLE  h_DeviceHandle,
BYTE  b_TimerMode,
DWORD  dw_DelayValue,
BYTE  b_InterruptFlag 
)

Initializes and starts the timer / watchdog component

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerModeDefines the mode of the timer (APCI3120_TIMER or APCI3120_WATCHDOG)
[in]dw_DelayValueTime interval ( or watchdog time) of the timer / watchdog
N.B. : The time value has to be a multiple of 50
  • Timer : 100us to 838860850us (~838.86s)
  • Watchdog : 50us to 838860850us (~838.86s)
[in]b_InterruptFlagEnable or disable the interrupt at the end of a timer/watchdog count
  • APCI3120_ENABLE :
    - Timer : an interrupt is generated at the end of each time interval
    - Watchdog : an interrupt is generated when the watchdog has run down
  • APCI3120_DISABLE: No interrupt is generated
Returns
0 : No error
-1 : The device handle parameter is wrong
-2 : The timer is already running
-3 : b_TimerMode is invalid
-4 : Timer mode choosen. dw_DelayValue is too low
-5 : Timer mode choosen. dw_DelayValue is too high
-6 : Watchdog mode choosen. dw_DelayValue is too low
-7 : Watchdog mode choosen. dw_DelayValue is too high
-8 : dw_DelayValue must be a multiple of 50
-9 : b_InterruptFlag is APCI3120_ENABLE but no interrupt handler is installed. Please call i_PCI3120_SetBoardIntRoutine before calling this function
-10 : Error while calling IOCTL function (wrong handle ?)
-101 : b_TimerNb is invalid (if PCIe3121 DLL wrapper is used)
-102 : b_TimerMode is invalid (if PCIe3121 DLL wrapper is used)
-103 : b_TimeBase is invalid (if PCIe3121 DLL wrapper is used)
-104 : b_OutputMode is invalid (if PCIe3121 DLL wrapper is used)
-105 : b_InterruptEnabled is invalid (if PCIe3121 DLL wrapper is used)
-106 : b_WatchdogEnabled is invalid (if PCIe3121 DLL wrapper is used)
-107 : Error while calling IOCTL function (wrong handle ?)(if PCIe3121 DLL wrapper is used)
-65535 : Error function doesn't exist in the DLL(if PCIe3121 DLL wrapper is used)

◆ i_PCI3120_StopTimerWatchdog()

_INT_ i_PCI3120_StopTimerWatchdog ( HANDLE  h_DeviceHandle)

Stops the timer/watchdog

Parameters
[in]h_DeviceHandleHandle of the board
Returns
0 : No error
-1 : The device handle parameter is wrong
-2 : The timer / watchdog is not running
-3 : Error while calling IOCTL function (wrong handle ?)
-101: b_TimerNb is invalid (if PCIe3121 DLL wrapper is used)
-65535 : Error function doesn't exist in the DLL(if PCIe3121 DLL wrapper is used)

◆ i_PCI3120_ReadWatchdogStatus()

_INT_ i_PCI3120_ReadWatchdogStatus ( HANDLE  h_DeviceHandle,
PBYTE  pb_WatchdogStatus 
)

Reads the current value of the watchdog

Parameters
[in]h_DeviceHandleHandle of the board
[out]pb_WatchdogStatusStatus of the watchdog (0: Watchdog is still running, 1: Watchdog has expired)
Returns
0 : No error
-1 : The device handle parameter is wrong
-2 : The timer / watchdog is not running as a watchdog at the moment
-3 : Error while calling IOCTL function (wrong handle ?)
-65535 : Error function doesn't exist in the DLL(if PCIe3121 DLL wrapper is used)

◆ i_PCI3120_ReadTimerValue()

_INT_ i_PCI3120_ReadTimerValue ( HANDLE  h_DeviceHandle,
PDWORD  pdw_ReadValue 
)

Reads the current value of the timer

Parameters
[in]h_DeviceHandleHandle of the board
[out]pdw_ReadValueCurrent timer value
Returns
0 : No error
-1 : The device handle parameter is wrong
-2 : The timer / watchdog is not running as a timer at the moment
-3 : Error while calling IOCTL function (wrong handle ?)
-65535 : Error function doesn t exist in the DLL (if PCIe3121 DLL wrapper is used)

◆ i_PCI3120_WriteTimerValue()

_INT_ i_PCI3120_WriteTimerValue ( HANDLE  h_DeviceHandle,
DWORD  dw_WriteValue 
)

Writes a value to the timer

Parameters
[in]h_DeviceHandleHandle of the board
[out]dw_WriteValueValue to write
Returns
0 : No error
-1 : The device handle parameter is wrong
-2 : The timer / watchdog is not running as a timer at the moment
-3 : Error while calling IOCTL function (wrong handle ?)
-65535 : Error function doesn't exist in the DLL (if PCIe3121 DLL wrapper is used)