{
enum NI_660x_Register ni_660x_register;
switch (reg) {
- case NITIO_G0_Autoincrement_Reg:
+ case NITIO_G0_AUTO_INC:
ni_660x_register = G0AutoincrementRegister;
break;
- case NITIO_G1_Autoincrement_Reg:
+ case NITIO_G1_AUTO_INC:
ni_660x_register = G1AutoincrementRegister;
break;
- case NITIO_G2_Autoincrement_Reg:
+ case NITIO_G2_AUTO_INC:
ni_660x_register = G2AutoincrementRegister;
break;
- case NITIO_G3_Autoincrement_Reg:
+ case NITIO_G3_AUTO_INC:
ni_660x_register = G3AutoincrementRegister;
break;
- case NITIO_G0_Command_Reg:
+ case NITIO_G0_CMD:
ni_660x_register = G0CommandRegister;
break;
- case NITIO_G1_Command_Reg:
+ case NITIO_G1_CMD:
ni_660x_register = G1CommandRegister;
break;
- case NITIO_G2_Command_Reg:
+ case NITIO_G2_CMD:
ni_660x_register = G2CommandRegister;
break;
- case NITIO_G3_Command_Reg:
+ case NITIO_G3_CMD:
ni_660x_register = G3CommandRegister;
break;
- case NITIO_G0_HW_Save_Reg:
+ case NITIO_G0_HW_SAVE:
ni_660x_register = G0HWSaveRegister;
break;
- case NITIO_G1_HW_Save_Reg:
+ case NITIO_G1_HW_SAVE:
ni_660x_register = G1HWSaveRegister;
break;
- case NITIO_G2_HW_Save_Reg:
+ case NITIO_G2_HW_SAVE:
ni_660x_register = G2HWSaveRegister;
break;
- case NITIO_G3_HW_Save_Reg:
+ case NITIO_G3_HW_SAVE:
ni_660x_register = G3HWSaveRegister;
break;
- case NITIO_G0_SW_Save_Reg:
+ case NITIO_G0_SW_SAVE:
ni_660x_register = G0SWSaveRegister;
break;
- case NITIO_G1_SW_Save_Reg:
+ case NITIO_G1_SW_SAVE:
ni_660x_register = G1SWSaveRegister;
break;
- case NITIO_G2_SW_Save_Reg:
+ case NITIO_G2_SW_SAVE:
ni_660x_register = G2SWSaveRegister;
break;
- case NITIO_G3_SW_Save_Reg:
+ case NITIO_G3_SW_SAVE:
ni_660x_register = G3SWSaveRegister;
break;
- case NITIO_G0_Mode_Reg:
+ case NITIO_G0_MODE:
ni_660x_register = G0ModeRegister;
break;
- case NITIO_G1_Mode_Reg:
+ case NITIO_G1_MODE:
ni_660x_register = G1ModeRegister;
break;
- case NITIO_G2_Mode_Reg:
+ case NITIO_G2_MODE:
ni_660x_register = G2ModeRegister;
break;
- case NITIO_G3_Mode_Reg:
+ case NITIO_G3_MODE:
ni_660x_register = G3ModeRegister;
break;
- case NITIO_G0_LoadA_Reg:
+ case NITIO_G0_LOADA:
ni_660x_register = G0LoadARegister;
break;
- case NITIO_G1_LoadA_Reg:
+ case NITIO_G1_LOADA:
ni_660x_register = G1LoadARegister;
break;
- case NITIO_G2_LoadA_Reg:
+ case NITIO_G2_LOADA:
ni_660x_register = G2LoadARegister;
break;
- case NITIO_G3_LoadA_Reg:
+ case NITIO_G3_LOADA:
ni_660x_register = G3LoadARegister;
break;
- case NITIO_G0_LoadB_Reg:
+ case NITIO_G0_LOADB:
ni_660x_register = G0LoadBRegister;
break;
- case NITIO_G1_LoadB_Reg:
+ case NITIO_G1_LOADB:
ni_660x_register = G1LoadBRegister;
break;
- case NITIO_G2_LoadB_Reg:
+ case NITIO_G2_LOADB:
ni_660x_register = G2LoadBRegister;
break;
- case NITIO_G3_LoadB_Reg:
+ case NITIO_G3_LOADB:
ni_660x_register = G3LoadBRegister;
break;
- case NITIO_G0_Input_Select_Reg:
+ case NITIO_G0_INPUT_SEL:
ni_660x_register = G0InputSelectRegister;
break;
- case NITIO_G1_Input_Select_Reg:
+ case NITIO_G1_INPUT_SEL:
ni_660x_register = G1InputSelectRegister;
break;
- case NITIO_G2_Input_Select_Reg:
+ case NITIO_G2_INPUT_SEL:
ni_660x_register = G2InputSelectRegister;
break;
- case NITIO_G3_Input_Select_Reg:
+ case NITIO_G3_INPUT_SEL:
ni_660x_register = G3InputSelectRegister;
break;
- case NITIO_G01_Status_Reg:
+ case NITIO_G01_STATUS:
ni_660x_register = G01StatusRegister;
break;
- case NITIO_G23_Status_Reg:
+ case NITIO_G23_STATUS:
ni_660x_register = G23StatusRegister;
break;
- case NITIO_G01_Joint_Reset_Reg:
+ case NITIO_G01_RESET:
ni_660x_register = G01JointResetRegister;
break;
- case NITIO_G23_Joint_Reset_Reg:
+ case NITIO_G23_RESET:
ni_660x_register = G23JointResetRegister;
break;
- case NITIO_G01_Joint_Status1_Reg:
+ case NITIO_G01_STATUS1:
ni_660x_register = G01JointStatus1Register;
break;
- case NITIO_G23_Joint_Status1_Reg:
+ case NITIO_G23_STATUS1:
ni_660x_register = G23JointStatus1Register;
break;
- case NITIO_G01_Joint_Status2_Reg:
+ case NITIO_G01_STATUS2:
ni_660x_register = G01JointStatus2Register;
break;
- case NITIO_G23_Joint_Status2_Reg:
+ case NITIO_G23_STATUS2:
ni_660x_register = G23JointStatus2Register;
break;
- case NITIO_G0_Counting_Mode_Reg:
+ case NITIO_G0_CNT_MODE:
ni_660x_register = G0CountingModeRegister;
break;
- case NITIO_G1_Counting_Mode_Reg:
+ case NITIO_G1_CNT_MODE:
ni_660x_register = G1CountingModeRegister;
break;
- case NITIO_G2_Counting_Mode_Reg:
+ case NITIO_G2_CNT_MODE:
ni_660x_register = G2CountingModeRegister;
break;
- case NITIO_G3_Counting_Mode_Reg:
+ case NITIO_G3_CNT_MODE:
ni_660x_register = G3CountingModeRegister;
break;
- case NITIO_G0_Second_Gate_Reg:
+ case NITIO_G0_GATE2:
ni_660x_register = G0SecondGateRegister;
break;
- case NITIO_G1_Second_Gate_Reg:
+ case NITIO_G1_GATE2:
ni_660x_register = G1SecondGateRegister;
break;
- case NITIO_G2_Second_Gate_Reg:
+ case NITIO_G2_GATE2:
ni_660x_register = G2SecondGateRegister;
break;
- case NITIO_G3_Second_Gate_Reg:
+ case NITIO_G3_GATE2:
ni_660x_register = G3SecondGateRegister;
break;
- case NITIO_G0_DMA_Config_Reg:
+ case NITIO_G0_DMA_CFG:
ni_660x_register = G0DMAConfigRegister;
break;
- case NITIO_G0_DMA_Status_Reg:
+ case NITIO_G0_DMA_STATUS:
ni_660x_register = G0DMAStatusRegister;
break;
- case NITIO_G1_DMA_Config_Reg:
+ case NITIO_G1_DMA_CFG:
ni_660x_register = G1DMAConfigRegister;
break;
- case NITIO_G1_DMA_Status_Reg:
+ case NITIO_G1_DMA_STATUS:
ni_660x_register = G1DMAStatusRegister;
break;
- case NITIO_G2_DMA_Config_Reg:
+ case NITIO_G2_DMA_CFG:
ni_660x_register = G2DMAConfigRegister;
break;
- case NITIO_G2_DMA_Status_Reg:
+ case NITIO_G2_DMA_STATUS:
ni_660x_register = G2DMAStatusRegister;
break;
- case NITIO_G3_DMA_Config_Reg:
+ case NITIO_G3_DMA_CFG:
ni_660x_register = G3DMAConfigRegister;
break;
- case NITIO_G3_DMA_Status_Reg:
+ case NITIO_G3_DMA_STATUS:
ni_660x_register = G3DMAStatusRegister;
break;
- case NITIO_G0_Interrupt_Acknowledge_Reg:
+ case NITIO_G0_INT_ACK:
ni_660x_register = G0InterruptAcknowledge;
break;
- case NITIO_G1_Interrupt_Acknowledge_Reg:
+ case NITIO_G1_INT_ACK:
ni_660x_register = G1InterruptAcknowledge;
break;
- case NITIO_G2_Interrupt_Acknowledge_Reg:
+ case NITIO_G2_INT_ACK:
ni_660x_register = G2InterruptAcknowledge;
break;
- case NITIO_G3_Interrupt_Acknowledge_Reg:
+ case NITIO_G3_INT_ACK:
ni_660x_register = G3InterruptAcknowledge;
break;
- case NITIO_G0_Status_Reg:
+ case NITIO_G0_STATUS:
ni_660x_register = G0StatusRegister;
break;
- case NITIO_G1_Status_Reg:
+ case NITIO_G1_STATUS:
ni_660x_register = G1StatusRegister;
break;
- case NITIO_G2_Status_Reg:
+ case NITIO_G2_STATUS:
ni_660x_register = G2StatusRegister;
break;
- case NITIO_G3_Status_Reg:
+ case NITIO_G3_STATUS:
ni_660x_register = G3StatusRegister;
break;
- case NITIO_G0_Interrupt_Enable_Reg:
+ case NITIO_G0_INT_ENA:
ni_660x_register = G0InterruptEnable;
break;
- case NITIO_G1_Interrupt_Enable_Reg:
+ case NITIO_G1_INT_ENA:
ni_660x_register = G1InterruptEnable;
break;
- case NITIO_G2_Interrupt_Enable_Reg:
+ case NITIO_G2_INT_ENA:
ni_660x_register = G2InterruptEnable;
break;
- case NITIO_G3_Interrupt_Enable_Reg:
+ case NITIO_G3_INT_ENA:
ni_660x_register = G3InterruptEnable;
break;
default:
{
unsigned stc_register;
switch (reg) {
- case NITIO_G0_Autoincrement_Reg:
+ case NITIO_G0_AUTO_INC:
stc_register = G_Autoincrement_Register(0);
break;
- case NITIO_G1_Autoincrement_Reg:
+ case NITIO_G1_AUTO_INC:
stc_register = G_Autoincrement_Register(1);
break;
- case NITIO_G0_Command_Reg:
+ case NITIO_G0_CMD:
stc_register = G_Command_Register(0);
break;
- case NITIO_G1_Command_Reg:
+ case NITIO_G1_CMD:
stc_register = G_Command_Register(1);
break;
- case NITIO_G0_HW_Save_Reg:
+ case NITIO_G0_HW_SAVE:
stc_register = G_HW_Save_Register(0);
break;
- case NITIO_G1_HW_Save_Reg:
+ case NITIO_G1_HW_SAVE:
stc_register = G_HW_Save_Register(1);
break;
- case NITIO_G0_SW_Save_Reg:
+ case NITIO_G0_SW_SAVE:
stc_register = G_Save_Register(0);
break;
- case NITIO_G1_SW_Save_Reg:
+ case NITIO_G1_SW_SAVE:
stc_register = G_Save_Register(1);
break;
- case NITIO_G0_Mode_Reg:
+ case NITIO_G0_MODE:
stc_register = G_Mode_Register(0);
break;
- case NITIO_G1_Mode_Reg:
+ case NITIO_G1_MODE:
stc_register = G_Mode_Register(1);
break;
- case NITIO_G0_LoadA_Reg:
+ case NITIO_G0_LOADA:
stc_register = G_Load_A_Register(0);
break;
- case NITIO_G1_LoadA_Reg:
+ case NITIO_G1_LOADA:
stc_register = G_Load_A_Register(1);
break;
- case NITIO_G0_LoadB_Reg:
+ case NITIO_G0_LOADB:
stc_register = G_Load_B_Register(0);
break;
- case NITIO_G1_LoadB_Reg:
+ case NITIO_G1_LOADB:
stc_register = G_Load_B_Register(1);
break;
- case NITIO_G0_Input_Select_Reg:
+ case NITIO_G0_INPUT_SEL:
stc_register = G_Input_Select_Register(0);
break;
- case NITIO_G1_Input_Select_Reg:
+ case NITIO_G1_INPUT_SEL:
stc_register = G_Input_Select_Register(1);
break;
- case NITIO_G01_Status_Reg:
+ case NITIO_G01_STATUS:
stc_register = G_Status_Register;
break;
- case NITIO_G01_Joint_Reset_Reg:
+ case NITIO_G01_RESET:
stc_register = Joint_Reset_Register;
break;
- case NITIO_G01_Joint_Status1_Reg:
+ case NITIO_G01_STATUS1:
stc_register = Joint_Status_1_Register;
break;
- case NITIO_G01_Joint_Status2_Reg:
+ case NITIO_G01_STATUS2:
stc_register = Joint_Status_2_Register;
break;
- case NITIO_G0_Interrupt_Acknowledge_Reg:
+ case NITIO_G0_INT_ACK:
stc_register = Interrupt_A_Ack_Register;
break;
- case NITIO_G1_Interrupt_Acknowledge_Reg:
+ case NITIO_G1_INT_ACK:
stc_register = Interrupt_B_Ack_Register;
break;
- case NITIO_G0_Status_Reg:
+ case NITIO_G0_STATUS:
stc_register = AI_Status_1_Register;
break;
- case NITIO_G1_Status_Reg:
+ case NITIO_G1_STATUS:
stc_register = AO_Status_1_Register;
break;
- case NITIO_G0_Interrupt_Enable_Reg:
+ case NITIO_G0_INT_ENA:
stc_register = Interrupt_A_Enable_Register;
break;
- case NITIO_G1_Interrupt_Enable_Reg:
+ case NITIO_G1_INT_ENA:
stc_register = Interrupt_B_Enable_Register;
break;
default:
switch (reg) {
/* m-series-only registers */
- case NITIO_G0_Counting_Mode_Reg:
+ case NITIO_G0_CNT_MODE:
ni_writew(bits, M_Offset_G0_Counting_Mode);
break;
- case NITIO_G1_Counting_Mode_Reg:
+ case NITIO_G1_CNT_MODE:
ni_writew(bits, M_Offset_G1_Counting_Mode);
break;
- case NITIO_G0_Second_Gate_Reg:
+ case NITIO_G0_GATE2:
ni_writew(bits, M_Offset_G0_Second_Gate);
break;
- case NITIO_G1_Second_Gate_Reg:
+ case NITIO_G1_GATE2:
ni_writew(bits, M_Offset_G1_Second_Gate);
break;
- case NITIO_G0_DMA_Config_Reg:
+ case NITIO_G0_DMA_CFG:
ni_writew(bits, M_Offset_G0_DMA_Config);
break;
- case NITIO_G1_DMA_Config_Reg:
+ case NITIO_G1_DMA_CFG:
ni_writew(bits, M_Offset_G1_DMA_Config);
break;
- case NITIO_G0_ABZ_Reg:
+ case NITIO_G0_ABZ:
ni_writew(bits, M_Offset_G0_MSeries_ABZ);
break;
- case NITIO_G1_ABZ_Reg:
+ case NITIO_G1_ABZ:
ni_writew(bits, M_Offset_G1_MSeries_ABZ);
break;
/* 32 bit registers */
- case NITIO_G0_LoadA_Reg:
- case NITIO_G1_LoadA_Reg:
- case NITIO_G0_LoadB_Reg:
- case NITIO_G1_LoadB_Reg:
+ case NITIO_G0_LOADA:
+ case NITIO_G1_LOADA:
+ case NITIO_G0_LOADB:
+ case NITIO_G1_LOADB:
stc_register = ni_gpct_to_stc_register(reg);
devpriv->stc_writel(dev, bits, stc_register);
break;
/* 16 bit registers */
- case NITIO_G0_Interrupt_Enable_Reg:
+ case NITIO_G0_INT_ENA:
BUG_ON(bits & ~gpct_interrupt_a_enable_mask);
ni_set_bitfield(dev, Interrupt_A_Enable_Register,
gpct_interrupt_a_enable_mask, bits);
break;
- case NITIO_G1_Interrupt_Enable_Reg:
+ case NITIO_G1_INT_ENA:
BUG_ON(bits & ~gpct_interrupt_b_enable_mask);
ni_set_bitfield(dev, Interrupt_B_Enable_Register,
gpct_interrupt_b_enable_mask, bits);
break;
- case NITIO_G01_Joint_Reset_Reg:
+ case NITIO_G01_RESET:
BUG_ON(bits & ~gpct_joint_reset_mask);
/* fall-through */
default:
switch (reg) {
/* m-series only registers */
- case NITIO_G0_DMA_Status_Reg:
+ case NITIO_G0_DMA_STATUS:
return ni_readw(M_Offset_G0_DMA_Status);
- break;
- case NITIO_G1_DMA_Status_Reg:
+ case NITIO_G1_DMA_STATUS:
return ni_readw(M_Offset_G1_DMA_Status);
- break;
/* 32 bit registers */
- case NITIO_G0_HW_Save_Reg:
- case NITIO_G1_HW_Save_Reg:
- case NITIO_G0_SW_Save_Reg:
- case NITIO_G1_SW_Save_Reg:
+ case NITIO_G0_HW_SAVE:
+ case NITIO_G1_HW_SAVE:
+ case NITIO_G0_SW_SAVE:
+ case NITIO_G1_SW_SAVE:
stc_register = ni_gpct_to_stc_register(reg);
return devpriv->stc_readl(dev, stc_register);
- break;
/* 16 bit registers */
default:
struct ni_gpct_device;
enum ni_gpct_register {
- NITIO_G0_Autoincrement_Reg,
- NITIO_G1_Autoincrement_Reg,
- NITIO_G2_Autoincrement_Reg,
- NITIO_G3_Autoincrement_Reg,
- NITIO_G0_Command_Reg,
- NITIO_G1_Command_Reg,
- NITIO_G2_Command_Reg,
- NITIO_G3_Command_Reg,
- NITIO_G0_HW_Save_Reg,
- NITIO_G1_HW_Save_Reg,
- NITIO_G2_HW_Save_Reg,
- NITIO_G3_HW_Save_Reg,
- NITIO_G0_SW_Save_Reg,
- NITIO_G1_SW_Save_Reg,
- NITIO_G2_SW_Save_Reg,
- NITIO_G3_SW_Save_Reg,
- NITIO_G0_Mode_Reg,
- NITIO_G1_Mode_Reg,
- NITIO_G2_Mode_Reg,
- NITIO_G3_Mode_Reg,
- NITIO_G0_LoadA_Reg,
- NITIO_G1_LoadA_Reg,
- NITIO_G2_LoadA_Reg,
- NITIO_G3_LoadA_Reg,
- NITIO_G0_LoadB_Reg,
- NITIO_G1_LoadB_Reg,
- NITIO_G2_LoadB_Reg,
- NITIO_G3_LoadB_Reg,
- NITIO_G0_Input_Select_Reg,
- NITIO_G1_Input_Select_Reg,
- NITIO_G2_Input_Select_Reg,
- NITIO_G3_Input_Select_Reg,
- NITIO_G0_Counting_Mode_Reg,
- NITIO_G1_Counting_Mode_Reg,
- NITIO_G2_Counting_Mode_Reg,
- NITIO_G3_Counting_Mode_Reg,
- NITIO_G0_Second_Gate_Reg,
- NITIO_G1_Second_Gate_Reg,
- NITIO_G2_Second_Gate_Reg,
- NITIO_G3_Second_Gate_Reg,
- NITIO_G01_Status_Reg,
- NITIO_G23_Status_Reg,
- NITIO_G01_Joint_Reset_Reg,
- NITIO_G23_Joint_Reset_Reg,
- NITIO_G01_Joint_Status1_Reg,
- NITIO_G23_Joint_Status1_Reg,
- NITIO_G01_Joint_Status2_Reg,
- NITIO_G23_Joint_Status2_Reg,
- NITIO_G0_DMA_Config_Reg,
- NITIO_G1_DMA_Config_Reg,
- NITIO_G2_DMA_Config_Reg,
- NITIO_G3_DMA_Config_Reg,
- NITIO_G0_DMA_Status_Reg,
- NITIO_G1_DMA_Status_Reg,
- NITIO_G2_DMA_Status_Reg,
- NITIO_G3_DMA_Status_Reg,
- NITIO_G0_ABZ_Reg,
- NITIO_G1_ABZ_Reg,
- NITIO_G0_Interrupt_Acknowledge_Reg,
- NITIO_G1_Interrupt_Acknowledge_Reg,
- NITIO_G2_Interrupt_Acknowledge_Reg,
- NITIO_G3_Interrupt_Acknowledge_Reg,
- NITIO_G0_Status_Reg,
- NITIO_G1_Status_Reg,
- NITIO_G2_Status_Reg,
- NITIO_G3_Status_Reg,
- NITIO_G0_Interrupt_Enable_Reg,
- NITIO_G1_Interrupt_Enable_Reg,
- NITIO_G2_Interrupt_Enable_Reg,
- NITIO_G3_Interrupt_Enable_Reg,
- NITIO_Num_Registers,
+ NITIO_G0_AUTO_INC,
+ NITIO_G1_AUTO_INC,
+ NITIO_G2_AUTO_INC,
+ NITIO_G3_AUTO_INC,
+ NITIO_G0_CMD,
+ NITIO_G1_CMD,
+ NITIO_G2_CMD,
+ NITIO_G3_CMD,
+ NITIO_G0_HW_SAVE,
+ NITIO_G1_HW_SAVE,
+ NITIO_G2_HW_SAVE,
+ NITIO_G3_HW_SAVE,
+ NITIO_G0_SW_SAVE,
+ NITIO_G1_SW_SAVE,
+ NITIO_G2_SW_SAVE,
+ NITIO_G3_SW_SAVE,
+ NITIO_G0_MODE,
+ NITIO_G1_MODE,
+ NITIO_G2_MODE,
+ NITIO_G3_MODE,
+ NITIO_G0_LOADA,
+ NITIO_G1_LOADA,
+ NITIO_G2_LOADA,
+ NITIO_G3_LOADA,
+ NITIO_G0_LOADB,
+ NITIO_G1_LOADB,
+ NITIO_G2_LOADB,
+ NITIO_G3_LOADB,
+ NITIO_G0_INPUT_SEL,
+ NITIO_G1_INPUT_SEL,
+ NITIO_G2_INPUT_SEL,
+ NITIO_G3_INPUT_SEL,
+ NITIO_G0_CNT_MODE,
+ NITIO_G1_CNT_MODE,
+ NITIO_G2_CNT_MODE,
+ NITIO_G3_CNT_MODE,
+ NITIO_G0_GATE2,
+ NITIO_G1_GATE2,
+ NITIO_G2_GATE2,
+ NITIO_G3_GATE2,
+ NITIO_G01_STATUS,
+ NITIO_G23_STATUS,
+ NITIO_G01_RESET,
+ NITIO_G23_RESET,
+ NITIO_G01_STATUS1,
+ NITIO_G23_STATUS1,
+ NITIO_G01_STATUS2,
+ NITIO_G23_STATUS2,
+ NITIO_G0_DMA_CFG,
+ NITIO_G1_DMA_CFG,
+ NITIO_G2_DMA_CFG,
+ NITIO_G3_DMA_CFG,
+ NITIO_G0_DMA_STATUS,
+ NITIO_G1_DMA_STATUS,
+ NITIO_G2_DMA_STATUS,
+ NITIO_G3_DMA_STATUS,
+ NITIO_G0_ABZ,
+ NITIO_G1_ABZ,
+ NITIO_G0_INT_ACK,
+ NITIO_G1_INT_ACK,
+ NITIO_G2_INT_ACK,
+ NITIO_G3_INT_ACK,
+ NITIO_G0_STATUS,
+ NITIO_G1_STATUS,
+ NITIO_G2_STATUS,
+ NITIO_G3_STATUS,
+ NITIO_G0_INT_ENA,
+ NITIO_G1_INT_ENA,
+ NITIO_G2_INT_ENA,
+ NITIO_G3_INT_ENA,
+ NITIO_NUM_REGS,
};
enum ni_gpct_variant {
enum ni_gpct_variant variant;
struct ni_gpct *counters;
unsigned num_counters;
- unsigned regs[NITIO_Num_Registers];
+ unsigned regs[NITIO_NUM_REGS];
spinlock_t regs_lock;
};
#include "ni_tio.h"
-static inline enum ni_gpct_register NITIO_Gi_Autoincrement_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Autoincrement_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Autoincrement_Reg;
- break;
+ return NITIO_G0_AUTO_INC;
case 1:
- return NITIO_G1_Autoincrement_Reg;
- break;
+ return NITIO_G1_AUTO_INC;
case 2:
- return NITIO_G2_Autoincrement_Reg;
- break;
+ return NITIO_G2_AUTO_INC;
case 3:
- return NITIO_G3_Autoincrement_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_AUTO_INC;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Command_Reg(unsigned counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Command_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Command_Reg;
- break;
+ return NITIO_G0_CMD;
case 1:
- return NITIO_G1_Command_Reg;
- break;
+ return NITIO_G1_CMD;
case 2:
- return NITIO_G2_Command_Reg;
- break;
+ return NITIO_G2_CMD;
case 3:
- return NITIO_G3_Command_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_CMD;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Counting_Mode_Reg;
- break;
+ return NITIO_G0_CNT_MODE;
case 1:
- return NITIO_G1_Counting_Mode_Reg;
- break;
+ return NITIO_G1_CNT_MODE;
case 2:
- return NITIO_G2_Counting_Mode_Reg;
- break;
+ return NITIO_G2_CNT_MODE;
case 3:
- return NITIO_G3_Counting_Mode_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_CNT_MODE;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Input_Select_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Input_Select_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Input_Select_Reg;
- break;
+ return NITIO_G0_INPUT_SEL;
case 1:
- return NITIO_G1_Input_Select_Reg;
- break;
+ return NITIO_G1_INPUT_SEL;
case 2:
- return NITIO_G2_Input_Select_Reg;
- break;
+ return NITIO_G2_INPUT_SEL;
case 3:
- return NITIO_G3_Input_Select_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_INPUT_SEL;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gxx_Joint_Reset_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gxx_Joint_Reset_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
case 1:
- return NITIO_G01_Joint_Reset_Reg;
- break;
+ return NITIO_G01_RESET;
case 2:
case 3:
- return NITIO_G23_Joint_Reset_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G23_RESET;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gxx_Joint_Status1_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gxx_Joint_Status1_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
case 1:
- return NITIO_G01_Joint_Status1_Reg;
- break;
+ return NITIO_G01_STATUS1;
case 2:
case 3:
- return NITIO_G23_Joint_Status1_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G23_STATUS1;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gxx_Joint_Status2_Reg(unsigned
- counter_index)
+static inline enum ni_gpct_register NITIO_Gxx_Joint_Status2_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
case 1:
- return NITIO_G01_Joint_Status2_Reg;
- break;
+ return NITIO_G01_STATUS2;
case 2:
case 3:
- return NITIO_G23_Joint_Status2_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G23_STATUS2;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gxx_Status_Reg(unsigned counter_index)
+static inline enum ni_gpct_register NITIO_Gxx_Status_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
case 1:
- return NITIO_G01_Status_Reg;
- break;
+ return NITIO_G01_STATUS;
case 2:
case 3:
- return NITIO_G23_Status_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G23_STATUS;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_LoadA_Reg(unsigned counter_index)
+static inline enum ni_gpct_register NITIO_Gi_LoadA_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_LoadA_Reg;
- break;
+ return NITIO_G0_LOADA;
case 1:
- return NITIO_G1_LoadA_Reg;
- break;
+ return NITIO_G1_LOADA;
case 2:
- return NITIO_G2_LoadA_Reg;
- break;
+ return NITIO_G2_LOADA;
case 3:
- return NITIO_G3_LoadA_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_LOADA;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned counter_index)
+static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_LoadB_Reg;
- break;
+ return NITIO_G0_LOADB;
case 1:
- return NITIO_G1_LoadB_Reg;
- break;
+ return NITIO_G1_LOADB;
case 2:
- return NITIO_G2_LoadB_Reg;
- break;
+ return NITIO_G2_LOADB;
case 3:
- return NITIO_G3_LoadB_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_LOADB;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Mode_Reg(unsigned counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Mode_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Mode_Reg;
- break;
+ return NITIO_G0_MODE;
case 1:
- return NITIO_G1_Mode_Reg;
- break;
+ return NITIO_G1_MODE;
case 2:
- return NITIO_G2_Mode_Reg;
- break;
+ return NITIO_G2_MODE;
case 3:
- return NITIO_G3_Mode_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_MODE;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_SW_Save_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_SW_Save_Reg(int idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_SW_Save_Reg;
- break;
+ return NITIO_G0_SW_SAVE;
case 1:
- return NITIO_G1_SW_Save_Reg;
- break;
+ return NITIO_G1_SW_SAVE;
case 2:
- return NITIO_G2_SW_Save_Reg;
- break;
+ return NITIO_G2_SW_SAVE;
case 3:
- return NITIO_G3_SW_Save_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_SW_SAVE;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Second_Gate_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Second_Gate_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Second_Gate_Reg;
- break;
+ return NITIO_G0_GATE2;
case 1:
- return NITIO_G1_Second_Gate_Reg;
- break;
+ return NITIO_G1_GATE2;
case 2:
- return NITIO_G2_Second_Gate_Reg;
- break;
+ return NITIO_G2_GATE2;
case 3:
- return NITIO_G3_Second_Gate_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_GATE2;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_DMA_Config_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_DMA_Config_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_DMA_Config_Reg;
- break;
+ return NITIO_G0_DMA_CFG;
case 1:
- return NITIO_G1_DMA_Config_Reg;
- break;
+ return NITIO_G1_DMA_CFG;
case 2:
- return NITIO_G2_DMA_Config_Reg;
- break;
+ return NITIO_G2_DMA_CFG;
case 3:
- return NITIO_G3_DMA_Config_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_DMA_CFG;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_DMA_Status_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_DMA_Status_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_DMA_Status_Reg;
- break;
+ return NITIO_G0_DMA_STATUS;
case 1:
- return NITIO_G1_DMA_Status_Reg;
- break;
+ return NITIO_G1_DMA_STATUS;
case 2:
- return NITIO_G2_DMA_Status_Reg;
- break;
+ return NITIO_G2_DMA_STATUS;
case 3:
- return NITIO_G3_DMA_Status_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_DMA_STATUS;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_ABZ_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_ABZ_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_ABZ_Reg;
- break;
+ return NITIO_G0_ABZ;
case 1:
- return NITIO_G1_ABZ_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G1_ABZ;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Interrupt_Acknowledge_Reg(
- int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Interrupt_Acknowledge_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Interrupt_Acknowledge_Reg;
- break;
+ return NITIO_G0_INT_ACK;
case 1:
- return NITIO_G1_Interrupt_Acknowledge_Reg;
- break;
+ return NITIO_G1_INT_ACK;
case 2:
- return NITIO_G2_Interrupt_Acknowledge_Reg;
- break;
+ return NITIO_G2_INT_ACK;
case 3:
- return NITIO_G3_Interrupt_Acknowledge_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_INT_ACK;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Status_Reg(int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Status_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Status_Reg;
- break;
+ return NITIO_G0_STATUS;
case 1:
- return NITIO_G1_Status_Reg;
- break;
+ return NITIO_G1_STATUS;
case 2:
- return NITIO_G2_Status_Reg;
- break;
+ return NITIO_G2_STATUS;
case 3:
- return NITIO_G3_Status_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_STATUS;
}
return 0;
}
-static inline enum ni_gpct_register NITIO_Gi_Interrupt_Enable_Reg(
- int counter_index)
+static inline enum ni_gpct_register NITIO_Gi_Interrupt_Enable_Reg(unsigned idx)
{
- switch (counter_index) {
+ switch (idx) {
case 0:
- return NITIO_G0_Interrupt_Enable_Reg;
- break;
+ return NITIO_G0_INT_ENA;
case 1:
- return NITIO_G1_Interrupt_Enable_Reg;
- break;
+ return NITIO_G1_INT_ENA;
case 2:
- return NITIO_G2_Interrupt_Enable_Reg;
- break;
+ return NITIO_G2_INT_ENA;
case 3:
- return NITIO_G3_Interrupt_Enable_Reg;
- break;
- default:
- BUG();
- break;
+ return NITIO_G3_INT_ENA;
}
return 0;
}
static inline void write_register(struct ni_gpct *counter, unsigned bits,
enum ni_gpct_register reg)
{
- BUG_ON(reg >= NITIO_Num_Registers);
+ BUG_ON(reg >= NITIO_NUM_REGS);
counter->counter_dev->write_register(counter, bits, reg);
}
static inline unsigned read_register(struct ni_gpct *counter,
enum ni_gpct_register reg)
{
- BUG_ON(reg >= NITIO_Num_Registers);
+ BUG_ON(reg >= NITIO_NUM_REGS);
return counter->counter_dev->read_register(counter, reg);
}
struct ni_gpct_device *counter_dev = counter->counter_dev;
unsigned long flags;
- BUG_ON(register_index >= NITIO_Num_Registers);
+ BUG_ON(register_index >= NITIO_NUM_REGS);
spin_lock_irqsave(&counter_dev->regs_lock, flags);
counter_dev->regs[register_index] &= ~bit_mask;
counter_dev->regs[register_index] |= (bit_values & bit_mask);
unsigned long flags;
unsigned value;
- BUG_ON(register_index >= NITIO_Num_Registers);
+ BUG_ON(register_index >= NITIO_NUM_REGS);
spin_lock_irqsave(&counter_dev->regs_lock, flags);
value = counter_dev->regs[register_index];
spin_unlock_irqrestore(&counter_dev->regs_lock, flags);