Software Library API naibrd 1.62
See all documentation at naii.docs.com
naibrd_dsw.c File Reference
#include <stdlib.h>
#include "functions/naibrd_dsw.h"
#include "maps/nai_map_dsw.h"
#include "advanced/naibrd_adv.h"
#include "naibrd_config.h"
#include "boards/naibrd_gen5.h"

Macros

#define NAI_DSW_MAX_THRESHOLD   80.0 /* Volt */
 
#define NAI_DSW_VOLTAGE_LSB_VOLT   0.163 /* Volt (163 mV) */
 
#define NAI_DSW_DT2_VOLTAGE_LSB_VOLT   0.100
 
#define NAI_DSW_CURRENT_LSB_AMP   0.00391 /* Amps, +/-2A / 2^10 or 4A/2^10 */
 
#define NAI_DSW_DT2_CURRENT_LSB_AMP   0.00200 /* 500uA */
 
#define NAI_DSW_MAX_DEBOUNCE_TIME_MSEC   167.76704 /* msec (0.16776704 sec) */
 
#define NAI_DSW_DEBOUNCE_TIME_LSB_MSEC   0.00512 /* msec ((5.12 us) */
 
#define NAI_DSW_DT2_DEBOUNCE_TIME_LSB_MSEC   0.010 /* msec (10 us) */
 
#define NAI_DSW_GEN3_REG_CAL_CHANNEL   0x3A8u
 
#define NAI_DSW_GEN3_REG_CAL_TYPE   0x3AAu /* *0:Voltage 1:Current */
 
#define NAI_DSW_GEN3_REG_CAL_OFFSET   0x3AEu
 
#define NAI_DSW_GEN3_REG_CAL_GAIN   0x3B2u /* For gain cal factor */
 
#define NAI_DSW_GEN5_TIMER_STD_LSB_MSEC   0.009984
 
#define Hw_Rev_1   0x3u
 

Functions

nai_status_t NAIINLINE verify_dsw_status_type (uint32_t modid, nai_dsw_status_type_t type)
 
NAIBRDFUNC int32_t NAIAPI naibrd_DSW_GetChannelCount (uint32_t modid)
 Returns the number of channels for the specified Discrete Switch Module ID.
 
NAIBRDFUNC int32_t NAIAPI naibrd_DSW_GetGroupCount (uint32_t modid)
 Returns the number of channel groups for the specified Discrete Switch Module ID.
 
NAIBRDFUNC int32_t NAIAPI naibrd_DSW_GetGroupSize (uint32_t modid)
 Returns the number of channels in each group for the specified Discrete Switch Module ID.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetVoltageLSB (int32_t cardIndex, int32_t module, float64_t *outvoltageLSB)
 Retrieves the Voltage LSB unit value for the all the DSW channels on the module.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetCurrentLSB (int32_t cardIndex, int32_t module, float64_t *outcurrentLSB)
 Retrieves the Current LSB unit value for the all the DSW channels on the module.
 
NAIBRDFUNC float64_t NAIAPI naibrd_DSW_GetTimebaseLSB (uint32_t modid)
 Returns the LSB for the timer interval for Measurement, PWM and Pattern Generator clocks for the specified DSW Module ID.
 
NAIBRDFUNC uint32_t NAIAPI naibrd_DSW_GetValidPatternGenStart (uint32_t modid)
 Returns the LSB for the timer interval for Measurement, PWM and Pattern Generator clocks for the specified DSW Module ID.
 
NAIBRDFUNC uint32_t NAIAPI naibrd_DSW_GetValidPatternGenEnd (uint32_t modid)
 Returns the LSB for the timer interval for Measurement, PWM and Pattern Generator clocks for the specified DSW Module ID.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetSwitchState (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_switch_state_t switchstate)
 Sets the switch closure state for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetSwitchState (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_switch_state_t *outswitchstate)
 Retrieves the Output State for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetInputState (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_state_t *outstate)
 Retrieves the Input State for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetVoltage (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outvoltage)
 Retrieves the voltage measurement for the specified Discrete Switch channel. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetCurrent (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outcurrent)
 Retrieves the current measurement for the specified Discrete Switch channel. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetOverCurrent (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outovercurrent)
 Retrieves the current measurement for the specified Discrete Switch channel. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetOverCurrent (int32_t cardIndex, int32_t module, int32_t channel, float64_t overcurrent)
 Retrieves the current measurement for the specified Discrete Switch channel. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetAvgVoltage (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outvoltage)
 Retrieves the RMS voltage measurement for the specified Discrete Switch channel. Reading will be positive for both pos and neg polarity. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetAvgCurrent (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outcurrent)
 Retrieves the average current measurement for the specified Discrete Switch channel. releases.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetStatus (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type, nai_status_bit_t *outstatusBit)
 Retrieves the status for the specified Discrete Switch channel and status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ClearStatus (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type)
 Clears the latched status for the specified channel and status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetThreshold (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_thresh_type_t type, float64_t threshold)
 Sets the threshold value for the specified Discrete Switch channel and threshold type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetThreshold (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_thresh_type_t type, float64_t *outthreshold)
 Sets the threshold value for the specified Discrete Switch channel and threshold type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetDebounceTime (int32_t cardIndex, int32_t module, int32_t channel, float64_t debounceTime)
 Sets the debounce time for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetDebounceTime (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outdebounceTime)
 Retrieves the debounce time for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPullUpSourceEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t enable)
 Sets the Pull Up Source enable for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPullUpSourceEnable (int32_t cardIndex, int32_t module, int32_t channel, bool_t *outenable)
 Retrieves the Pull Up Enable for the specified Discrete Switch channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_Reset (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_reset_type_t resetType)
 Resets the DSW channel as specified by the reset type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetInterruptEnable (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type, bool_t enable)
 Sets the Interrupt Enable for the specified Discrete Switch channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetInterruptEnable (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type, bool_t *outenable)
 Retrieves the Interrupt Enable for the specified Discrete Switch channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetEdgeLevelInterrupt (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type, nai_dsw_interrupt_t interruptType)
 Sets the Interrupt Edge/Level property for the specified Discrete channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetEdgeLevelInterrupt (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_status_type_t type, nai_dsw_interrupt_t *outinterruptType)
 Retrieves the Interrupt Edge/Level property for the specified Discrete channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetGroupInterruptVector (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t vector)
 Sets the Interrupt Vector for the specified Discrete Switch channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetGroupInterruptVector (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t *outvector)
 Retrieves the Interrupt Vector for the specified Discrete channel and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetGroupInterruptSteering (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, naibrd_int_steering_t steering)
 Sets the Interrupt Steering which indicates the interrupt direction for the specified Discrete group and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetGroupInterruptSteering (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, naibrd_int_steering_t *outsteering)
 Retrieves the Interrupt Steering which indicates the interrupt direction for the specified Discrete group and interrupt status type.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ConvertToVoltage (uint32_t modid, uint32_t rawdata, float64_t *outvoltage)
 Calculates the voltage in volts associated with the Discrete Switch Module ID from the given raw data.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ConvertToVoltageRaw (uint32_t modid, float64_t voltage, uint32_t *outrawdata)
 Calculates the raw data associated with the Discrete Switch Module ID and a given voltage.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ConvertToCurrent (uint32_t modid, uint32_t rawdata, float64_t *outcurrent)
 Calculates the current in Amps associated with the Discrete Switch Module ID and given raw data.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ConvertToCurrentRaw (uint32_t modid, float64_t current, uint32_t *outrawdata)
 Calculates the raw current associated with the Discrete Switch Module ID and given current.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetOpMode (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_enhanced_mode_t mode)
 Sets the Operation mode in Enhanced mode for the specified Discrete channel. Default configuration for the channels is Enhanced Input. For KA and K6 modules, valid modes will be limited to PWM_FOREVER and basic modes only.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetOpMode (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_enhanced_mode_t *outmode)
 Retrieves the Operation mode in Enhanced mode for the specified Discrete channel. Default configuration for the channels is Enhanced Input.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetEnhanceTriggerEnable (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_enable_t enable)
 Sets enhanced operation to disabled or enabled for specified Discrete channel.

 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetEnhanceTriggerEnable (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_enable_t *outenable)
 Retrieves the present enhance operation enable state for the specified Discrete channel. Power on default configuration for the channels is Enhanced Input.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_pwm_polarity_t polarity)
 Sets the polarity for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive indicates the high state corresponds to the pulsewidth setting, and negative inverts it for a negative going pulse output.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_pwm_polarity_t *outpolarity)
 Retrieves the polarity setting for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive setting indicates the high state corresponds to the pulsewidth setting, and negative setting inverts it for a negative going pulse output.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_Pulsewidth (int32_t cardIndex, int32_t module, int32_t channel, float64_t pulsewidth)
 Sets the PWM pulsewidth for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Pulsewidth (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outpulsewidth)
 Retrieves the PWM pulsewidth value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_Period (int32_t cardIndex, int32_t module, int32_t channel, float64_t period)
 Sets the PWM period for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Period (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outperiod)
 Retrieves the PWM period value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_BurstNum (int32_t cardIndex, int32_t module, int32_t channel, uint32_t burstNum)
 Sets the number of cycles to output in the PWM burst mode for the specified Discrete channel. The set value is applicable for enhanced IO PWM burst mode (mode 12).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_BurstNum (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *outburstNum)
 Retrieves the number of cycles set to output in the PWM burst mode for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_StartPWM (int32_t cardIndex, int32_t module, int32_t channel)
 Starts the PWM output for the selected channel on the module. For GEN5 module, PWM mode should be set up first, to the desired mode (continuous or burst).
The PWM mode setup will need to be done before each start command.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_StopPWM (int32_t cardIndex, int32_t module, int32_t channel)
 Stops the PWM output for the selected channel on the module. For Gen5 modules, this is done by taking the channel out of PWM mode and resetting to the input mode. To restart PWM, the PWM mode setting will need to be independently set up again.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenStartAddr (int32_t cardIndex, int32_t module, uint32_t startAddr)
 Sets the starting address to look at for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenStartAddr (int32_t cardIndex, int32_t module, uint32_t *outstartAddr)
 Gets the starting address to look at for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenEndAddr (int32_t cardIndex, int32_t module, uint32_t EndAddr)
 Sets the Ending address to look at for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenEndAddr (int32_t cardIndex, int32_t module, uint32_t *outEndAddr)
 Gets the Ending address to look at for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenPeriod (int32_t cardIndex, int32_t module, float64_t period_mS)
 Sets the period for the Pattern Generator for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenPeriod (int32_t cardIndex, int32_t module, float64_t *outperiod_mS)
 Retrieves the period for the Pattern Generator for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGen_BurstNum (int32_t cardIndex, int32_t module, uint32_t burstNum)
 Sets the number of cycles to output in the PatternGen burst mode for the specified Discrete module. The set value is applicable for enhanced IO PatternGen burst mode.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGen_BurstNum (int32_t cardIndex, int32_t module, uint32_t *outburstNum)
 Retrieves the number of cycles set to output in the PatternGen burst mode for the specified Discrete module.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenCtrl (int32_t cardIndex, int32_t module, nai_dsw_pattern_ctrl_t controlBit, nai_dsw_enable_t state)
 Sets the state for the RAM Pattern Generator for the selected control bit on the module. Options are enable and disable.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenCtrl (int32_t cardIndex, int32_t module, nai_dsw_pattern_ctrl_t controlBit, nai_dsw_enable_t *outstate)
 Gets the state for the RAM Pattern Generator for the selected control bit on the module. Options are enable and disable.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenBuf (int32_t cardIndex, int32_t module, int32_t dataPatternLen, uint32_t *dataPattern)
 Sets the pattern for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenBuf (int32_t cardIndex, int32_t module, int32_t dataPatternLen, uint32_t *dataPattern)
 Retrieves the pattern for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPatternGenCtrlRaw (int32_t cardIndex, int32_t module, uint32_t controlRaw)
 Sets the control bits for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPatternGenCtrlRaw (int32_t cardIndex, int32_t module, uint32_t *outcontrolRaw)
 Retrieves the control bits for RAM Pattern Generator.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetTimebaseInterval (int32_t cardIndex, int32_t module, int32_t channel, float64_t interval)
 Sets the timebase for frequency measurements for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetTimebaseInterval (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outinterval)
 Retrieves the timebase for frequency measurements for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ReadFIFORaw (int32_t cardIndex, int32_t module, int32_t channel, uint32_t count, uint32_t outdata[], uint32_t *outread)
 Retrieves the data elements from the Discrete channel's FIFO buffer.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ReadFIFORawEx (int32_t cardIndex, int32_t module, int32_t channel, uint32_t count, uint32_t timeout, uint32_t outdata[], uint32_t *outread, uint32_t *countRemaining)
 Retrieves the data elements from the Discrete channel's FIFO buffer.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetCountData (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *outcount)
 Retrieves the measurement count data for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetFIFOCount (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *outcount)
 Retrieves the number of elements in FIFO for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ClearCountData (int32_t cardIndex, int32_t module, int32_t channel)
 Clears the measurement count data for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ClearFIFO (int32_t cardIndex, int32_t module, int32_t channel)
 Clears the FIFO Data for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetFIFOStatus (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *outcount, nai_dsw_fifo_status_t *outstatus)
 Retrieves the Discrete channel's FIFO Buffer Status.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetGroupRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_group_raw_t type, uint32_t rawdata)
 Sets the raw data value in the register associated to the group and register type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetGroupRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_group_raw_t type, uint32_t *outrawdata)
 Retrieves the raw data value in the register associated to the group and register type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetChannelRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_channel_raw_t type, uint32_t rawdata)
 Sets the raw data value in the register associated to the channel and register type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetChannelRaw (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_channel_raw_t type, uint32_t *outrawdata)
 Retrieves the raw data value in the register associated to the channel and register type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetGroupStatusRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t *outrawdata)
 Retrieves the raw status data value in the register associated to the group and status type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_ClearGroupStatusRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t rawdata)
 Clears the status data value in the register associated to the group and status type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetGroupInterruptEnableRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t rawdata)
 Sets the raw interrupt enable data value in the register associated to the group and status type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetGroupInterruptEnableRaw (int32_t cardIndex, int32_t module, int32_t group, nai_dsw_status_type_t type, uint32_t *outrawdata)
 Retrieves the raw interrupt enable data value in the register associated to the group and status type specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPullUpSourceEnableRaw (int32_t cardIndex, int32_t module, int32_t group, uint32_t rawdata)
 Retrieves the raw data value in the pull up source enable register.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPullUpSourceEnableRaw (int32_t cardIndex, int32_t module, int32_t group, uint32_t *outrawdata)
 Retrieves the raw Pull Up enable data value in the register associated to the group specified.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetVoltageCalFactors (int32_t cardIndex, int32_t module, int32_t channel, int32_t offset, uint32_t gain)
 Update the calibration factors for the voltage measurement function for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetCurrentCalFactors (int32_t cardIndex, int32_t module, int32_t channel, int32_t offset, uint32_t gain)
 Update the calibration factors for the current measurement function for the specified Discrete channel.
 

Macro Definition Documentation

◆ Hw_Rev_1

#define Hw_Rev_1   0x3u

◆ NAI_DSW_CURRENT_LSB_AMP

#define NAI_DSW_CURRENT_LSB_AMP   0.00391 /* Amps, +/-2A / 2^10 or 4A/2^10 */

◆ NAI_DSW_DEBOUNCE_TIME_LSB_MSEC

#define NAI_DSW_DEBOUNCE_TIME_LSB_MSEC   0.00512 /* msec ((5.12 us) */

◆ NAI_DSW_DT2_CURRENT_LSB_AMP

#define NAI_DSW_DT2_CURRENT_LSB_AMP   0.00200 /* 500uA */

◆ NAI_DSW_DT2_DEBOUNCE_TIME_LSB_MSEC

#define NAI_DSW_DT2_DEBOUNCE_TIME_LSB_MSEC   0.010 /* msec (10 us) */

◆ NAI_DSW_DT2_VOLTAGE_LSB_VOLT

#define NAI_DSW_DT2_VOLTAGE_LSB_VOLT   0.100

◆ NAI_DSW_GEN3_REG_CAL_CHANNEL

#define NAI_DSW_GEN3_REG_CAL_CHANNEL   0x3A8u

◆ NAI_DSW_GEN3_REG_CAL_GAIN

#define NAI_DSW_GEN3_REG_CAL_GAIN   0x3B2u /* For gain cal factor */

◆ NAI_DSW_GEN3_REG_CAL_OFFSET

#define NAI_DSW_GEN3_REG_CAL_OFFSET   0x3AEu

◆ NAI_DSW_GEN3_REG_CAL_TYPE

#define NAI_DSW_GEN3_REG_CAL_TYPE   0x3AAu /* *0:Voltage 1:Current */

◆ NAI_DSW_GEN5_TIMER_STD_LSB_MSEC

#define NAI_DSW_GEN5_TIMER_STD_LSB_MSEC   0.009984

◆ NAI_DSW_MAX_DEBOUNCE_TIME_MSEC

#define NAI_DSW_MAX_DEBOUNCE_TIME_MSEC   167.76704 /* msec (0.16776704 sec) */

◆ NAI_DSW_MAX_THRESHOLD

#define NAI_DSW_MAX_THRESHOLD   80.0 /* Volt */

◆ NAI_DSW_VOLTAGE_LSB_VOLT

#define NAI_DSW_VOLTAGE_LSB_VOLT   0.163 /* Volt (163 mV) */

Function Documentation

◆ naibrd_DSW_SetCurrentCalFactors()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetCurrentCalFactors ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t offset,
uint32_t gain )

Update the calibration factors for the current measurement function for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
offset: (Input) Offset correction (nominally 0x00, correction value will be subtracted from the reading).
gain: (Input) Gain correction (nominally 0x4000, correction value ratio will be used to adjust the base reading by Gain/0x4000).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DSW_SetVoltageCalFactors()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetVoltageCalFactors ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t offset,
uint32_t gain )

Update the calibration factors for the voltage measurement function for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
offset: (Input) Offset correction (nominally 0x00, correction value will be subtracted from the reading).
gain: (Input) Gain correction (nominally 0x4000, correction value ratio will be used to adjust the base reading by Gain/0x4000).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ verify_dsw_status_type()

nai_status_t NAIINLINE verify_dsw_status_type ( uint32_t modid,
nai_dsw_status_type_t type )