xPCI-1710 API
xPCI-1710 82c54 timer counter management functions

Functions

_INT_ i_PCI1710_InitTimer (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, BYTE_ b_TimerMode, DWORD_ dw_ReloadValue, BYTE_ b_InputClockSelection, BYTE_ b_InputClockLevel, BYTE_ b_OutputLevel, BYTE_ b_HardwareGateLevel)
 
_INT_ i_PCI1710_EnableTimer (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, BYTE_ b_InterruptEnable)
 
_INT_ i_PCI1710_DisableTimer (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr)
 
_INT_ i_PCI1710_ReadTimerValue (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, PDWORD_ pdw_Value)
 
_INT_ i_PCI1710_ReadAllTimerValue (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, DWORD pdw_Values[3])
 
_INT_ i_PCI1710_GetTimerOutputLevel (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, PBYTE_ pb_Value)
 
_INT_ i_PCI1710_GetTimerProgressStatus (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, PBYTE_ pb_Status)
 
_INT_ i_PCI1710_GetTimerProgressStatusEx (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, PBYTE_ pb_Status)
 
_INT_ i_PCI1710_WriteTimerValue (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_TimerNbr, DWORD_ dw_Value)
 

Detailed Description

Function Documentation

_INT_ i_PCI1710_InitTimer ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
BYTE_  b_TimerMode,
DWORD_  dw_ReloadValue,
BYTE_  b_InputClockSelection,
BYTE_  b_InputClockLevel,
BYTE_  b_OutputLevel,
BYTE_  b_HardwareGateLevel 
)

Initialize the 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[in]b_TimerModeMode in which the timer is to be initialized
Mode Description
0 Interrupt at the end of the counting process.
At the beginning the output is low. At the end of the counting process the output is put high. Then it begins a new counting process at the end of which the output will be switched low, and so on.
1 Monoflop, retriggerable through hardware.
This mode is the same as the first except that the GATE triggers the timer instead of enabling or disabling it.
2 Pulse generator.
The output is set to high after the initialization. Then when the counter reaches 0 the output is set to low during one clock signal. The signal is then put high again and this cycle is repeated.
Time calculation = (dw_ReloadValue + 2) x input clock.
3 Square-wave generator.
This mode is similar to the mode 2 except that the output is not set to low for one clock signal. The counter is reloaded and the output stays to low until it has reached 0 again. This cycle is automatically repeated.
4 Strobe, Triggered through software.
The signal is initialy put high. When the counter reaches 0 the output is set low for one clock period. The signal is then reset to high. The counting sequence is triggered when a new value is written in.
When a new value is written in during a counting cycle, this value will be loaded at the next clock pulse.
5 Strobe, trigger through hardware (retriggerable).
This mode is the same as the fourth except that the GATE is used to trigger the timer.
[in]dw_ReloadValueReload value of the timer (0 to 4 294 967 295)
[in]b_InputClockSelectionSelect the clock to be used (0 -> PCI bus clock, 1 -> external clock, 2 -> internal 10MHz clock)
For timer 0 only PCI bus clock and internal 10 MHz clock are available (0 and 2)
[in]b_InputClockLevelLevel of the clock (0 -> active at low level, 1 -> active at high level (input iverted))
[in]b_OutputLevelSelection of the output clock level (0 -> active at low, 1 -> active at high (output inverted))
[in]b_HardwareGateLevelSelection of the hardware gate level (0 -> active at low (inverted), 1 -> active at high)
If the external gate is not used, must be set to 0.
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : Wrong timer mode
-5 : Wrong input clock
-6 : Wrong input clock level
-7 : Wrong output level
-8 : Wrong hardware gate level
-9 : An error occured during the initialization
_INT_ i_PCI1710_EnableTimer ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
BYTE_  b_InterruptEnable 
)

Enable and start the 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[in]b_InterruptEnableEnable interrupt flag (0 -> interrupt disabled, 1 -> interrupt enabled)
The mask given to the user interrupt routine is determinated as follow :
Timer Mask
0 0000 0000 0001 0000
1 0000 0000 0010 0000
2 0000 0000 0100 0000
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : Wrong interrupt flag
-5 : An error occured while starting the timer
_INT_ i_PCI1710_DisableTimer ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr 
)

Stop and release the 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occured while stopping the timer
_INT_ i_PCI1710_ReadTimerValue ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
PDWORD_  pdw_Value 
)

Read the current value of a given 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[out]pdw_ValueValue of the timer
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occured while reading the value
_INT_ i_PCI1710_ReadAllTimerValue ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
DWORD  pdw_Values[3] 
)

Read the values of the three 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[out]pdw_ValuesArray containing the three current values of the timers (0 -> timer 0 etc)
The array must be allocated before to call this function.
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : An error occured while reading the values
_INT_ i_PCI1710_GetTimerOutputLevel ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
PBYTE_  pb_Value 
)

Return the output level of a given 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[out]pb_ValueLevel of the output (0 -> low, 1 -> high)
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occured while reading the output level
_INT_ i_PCI1710_GetTimerProgressStatus ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
PBYTE_  pb_Status 
)

Return the status of the timer value for a given 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[out]pb_StatusStatus of the timer (1 -> timer value is 0, 0 -> timer value differs from 0 (i.e. timer runs or is initialized))
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occured while reading the status
_INT_ i_PCI1710_GetTimerProgressStatusEx ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
PBYTE_  pb_Status 
)

Return the status of a given 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[out]pb_StatusStatus of the timer (0 -> stopped, 1 -> running)
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occured while reading the status
_INT_ i_PCI1710_WriteTimerValue ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_TimerNbr,
DWORD_  dw_Value 
)

Write the value of a given 82c54 timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrNumber of the module in which the timer is located (0 to 3)
[in]b_TimerNbrNumber of the timer (0 to 2)
[in]dw_Valuevalue to be written
Returns
> 0 : Warning
0 : No Error
-1 : The device handle parameter is wrong
-2 : Wrong module number
-3 : Wrong timer
-4 : An error occurend while writing the value