162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Register descriptions for NI DAQ-STC chip 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * COMEDI - Linux Control and Measurement Device Interface 662306a36Sopenharmony_ci * Copyright (C) 1998-9 David A. Schleef <ds@schleef.org> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci/* 1062306a36Sopenharmony_ci * References: 1162306a36Sopenharmony_ci * DAQ-STC Technical Reference Manual 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#ifndef _COMEDI_NI_STC_H 1562306a36Sopenharmony_ci#define _COMEDI_NI_STC_H 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include "ni_tio.h" 1862306a36Sopenharmony_ci#include "ni_routes.h" 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/* 2162306a36Sopenharmony_ci * Registers in the National Instruments DAQ-STC chip 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define NISTC_INTA_ACK_REG 2 2562306a36Sopenharmony_ci#define NISTC_INTA_ACK_G0_GATE BIT(15) 2662306a36Sopenharmony_ci#define NISTC_INTA_ACK_G0_TC BIT(14) 2762306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_ERR BIT(13) 2862306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_STOP BIT(12) 2962306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_START BIT(11) 3062306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_START2 BIT(10) 3162306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_START1 BIT(9) 3262306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_SC_TC BIT(8) 3362306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_SC_TC_ERR BIT(7) 3462306a36Sopenharmony_ci#define NISTC_INTA_ACK_G0_TC_ERR BIT(6) 3562306a36Sopenharmony_ci#define NISTC_INTA_ACK_G0_GATE_ERR BIT(5) 3662306a36Sopenharmony_ci#define NISTC_INTA_ACK_AI_ALL (NISTC_INTA_ACK_AI_ERR | \ 3762306a36Sopenharmony_ci NISTC_INTA_ACK_AI_STOP | \ 3862306a36Sopenharmony_ci NISTC_INTA_ACK_AI_START | \ 3962306a36Sopenharmony_ci NISTC_INTA_ACK_AI_START2 | \ 4062306a36Sopenharmony_ci NISTC_INTA_ACK_AI_START1 | \ 4162306a36Sopenharmony_ci NISTC_INTA_ACK_AI_SC_TC | \ 4262306a36Sopenharmony_ci NISTC_INTA_ACK_AI_SC_TC_ERR) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define NISTC_INTB_ACK_REG 3 4562306a36Sopenharmony_ci#define NISTC_INTB_ACK_G1_GATE BIT(15) 4662306a36Sopenharmony_ci#define NISTC_INTB_ACK_G1_TC BIT(14) 4762306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_ERR BIT(13) 4862306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_STOP BIT(12) 4962306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_START BIT(11) 5062306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_UPDATE BIT(10) 5162306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_START1 BIT(9) 5262306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_BC_TC BIT(8) 5362306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_UC_TC BIT(7) 5462306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_UI2_TC BIT(6) 5562306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_UI2_TC_ERR BIT(5) 5662306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_BC_TC_ERR BIT(4) 5762306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_BC_TC_TRIG_ERR BIT(3) 5862306a36Sopenharmony_ci#define NISTC_INTB_ACK_G1_TC_ERR BIT(2) 5962306a36Sopenharmony_ci#define NISTC_INTB_ACK_G1_GATE_ERR BIT(1) 6062306a36Sopenharmony_ci#define NISTC_INTB_ACK_AO_ALL (NISTC_INTB_ACK_AO_ERR | \ 6162306a36Sopenharmony_ci NISTC_INTB_ACK_AO_STOP | \ 6262306a36Sopenharmony_ci NISTC_INTB_ACK_AO_START | \ 6362306a36Sopenharmony_ci NISTC_INTB_ACK_AO_UPDATE | \ 6462306a36Sopenharmony_ci NISTC_INTB_ACK_AO_START1 | \ 6562306a36Sopenharmony_ci NISTC_INTB_ACK_AO_BC_TC | \ 6662306a36Sopenharmony_ci NISTC_INTB_ACK_AO_UC_TC | \ 6762306a36Sopenharmony_ci NISTC_INTB_ACK_AO_BC_TC_ERR | \ 6862306a36Sopenharmony_ci NISTC_INTB_ACK_AO_BC_TC_TRIG_ERR) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define NISTC_AI_CMD2_REG 4 7162306a36Sopenharmony_ci#define NISTC_AI_CMD2_END_ON_SC_TC BIT(15) 7262306a36Sopenharmony_ci#define NISTC_AI_CMD2_END_ON_EOS BIT(14) 7362306a36Sopenharmony_ci#define NISTC_AI_CMD2_START1_DISABLE BIT(11) 7462306a36Sopenharmony_ci#define NISTC_AI_CMD2_SC_SAVE_TRACE BIT(10) 7562306a36Sopenharmony_ci#define NISTC_AI_CMD2_SI_SW_ON_SC_TC BIT(9) 7662306a36Sopenharmony_ci#define NISTC_AI_CMD2_SI_SW_ON_STOP BIT(8) 7762306a36Sopenharmony_ci#define NISTC_AI_CMD2_SI_SW_ON_TC BIT(7) 7862306a36Sopenharmony_ci#define NISTC_AI_CMD2_SC_SW_ON_TC BIT(4) 7962306a36Sopenharmony_ci#define NISTC_AI_CMD2_STOP_PULSE BIT(3) 8062306a36Sopenharmony_ci#define NISTC_AI_CMD2_START_PULSE BIT(2) 8162306a36Sopenharmony_ci#define NISTC_AI_CMD2_START2_PULSE BIT(1) 8262306a36Sopenharmony_ci#define NISTC_AI_CMD2_START1_PULSE BIT(0) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define NISTC_AO_CMD2_REG 5 8562306a36Sopenharmony_ci#define NISTC_AO_CMD2_END_ON_BC_TC(x) (((x) & 0x3) << 14) 8662306a36Sopenharmony_ci#define NISTC_AO_CMD2_START_STOP_GATE_ENA BIT(13) 8762306a36Sopenharmony_ci#define NISTC_AO_CMD2_UC_SAVE_TRACE BIT(12) 8862306a36Sopenharmony_ci#define NISTC_AO_CMD2_BC_GATE_ENA BIT(11) 8962306a36Sopenharmony_ci#define NISTC_AO_CMD2_BC_SAVE_TRACE BIT(10) 9062306a36Sopenharmony_ci#define NISTC_AO_CMD2_UI_SW_ON_BC_TC BIT(9) 9162306a36Sopenharmony_ci#define NISTC_AO_CMD2_UI_SW_ON_STOP BIT(8) 9262306a36Sopenharmony_ci#define NISTC_AO_CMD2_UI_SW_ON_TC BIT(7) 9362306a36Sopenharmony_ci#define NISTC_AO_CMD2_UC_SW_ON_BC_TC BIT(6) 9462306a36Sopenharmony_ci#define NISTC_AO_CMD2_UC_SW_ON_TC BIT(5) 9562306a36Sopenharmony_ci#define NISTC_AO_CMD2_BC_SW_ON_TC BIT(4) 9662306a36Sopenharmony_ci#define NISTC_AO_CMD2_MUTE_B BIT(3) 9762306a36Sopenharmony_ci#define NISTC_AO_CMD2_MUTE_A BIT(2) 9862306a36Sopenharmony_ci#define NISTC_AO_CMD2_UPDATE2_PULSE BIT(1) 9962306a36Sopenharmony_ci#define NISTC_AO_CMD2_START1_PULSE BIT(0) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define NISTC_G0_CMD_REG 6 10262306a36Sopenharmony_ci#define NISTC_G1_CMD_REG 7 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci#define NISTC_AI_CMD1_REG 8 10562306a36Sopenharmony_ci#define NISTC_AI_CMD1_ATRIG_RESET BIT(14) 10662306a36Sopenharmony_ci#define NISTC_AI_CMD1_DISARM BIT(13) 10762306a36Sopenharmony_ci#define NISTC_AI_CMD1_SI2_ARM BIT(12) 10862306a36Sopenharmony_ci#define NISTC_AI_CMD1_SI2_LOAD BIT(11) 10962306a36Sopenharmony_ci#define NISTC_AI_CMD1_SI_ARM BIT(10) 11062306a36Sopenharmony_ci#define NISTC_AI_CMD1_SI_LOAD BIT(9) 11162306a36Sopenharmony_ci#define NISTC_AI_CMD1_DIV_ARM BIT(8) 11262306a36Sopenharmony_ci#define NISTC_AI_CMD1_DIV_LOAD BIT(7) 11362306a36Sopenharmony_ci#define NISTC_AI_CMD1_SC_ARM BIT(6) 11462306a36Sopenharmony_ci#define NISTC_AI_CMD1_SC_LOAD BIT(5) 11562306a36Sopenharmony_ci#define NISTC_AI_CMD1_SCAN_IN_PROG_PULSE BIT(4) 11662306a36Sopenharmony_ci#define NISTC_AI_CMD1_EXTMUX_CLK_PULSE BIT(3) 11762306a36Sopenharmony_ci#define NISTC_AI_CMD1_LOCALMUX_CLK_PULSE BIT(2) 11862306a36Sopenharmony_ci#define NISTC_AI_CMD1_SC_TC_PULSE BIT(1) 11962306a36Sopenharmony_ci#define NISTC_AI_CMD1_CONVERT_PULSE BIT(0) 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci#define NISTC_AO_CMD1_REG 9 12262306a36Sopenharmony_ci#define NISTC_AO_CMD1_ATRIG_RESET BIT(15) 12362306a36Sopenharmony_ci#define NISTC_AO_CMD1_START_PULSE BIT(14) 12462306a36Sopenharmony_ci#define NISTC_AO_CMD1_DISARM BIT(13) 12562306a36Sopenharmony_ci#define NISTC_AO_CMD1_UI2_ARM_DISARM BIT(12) 12662306a36Sopenharmony_ci#define NISTC_AO_CMD1_UI2_LOAD BIT(11) 12762306a36Sopenharmony_ci#define NISTC_AO_CMD1_UI_ARM BIT(10) 12862306a36Sopenharmony_ci#define NISTC_AO_CMD1_UI_LOAD BIT(9) 12962306a36Sopenharmony_ci#define NISTC_AO_CMD1_UC_ARM BIT(8) 13062306a36Sopenharmony_ci#define NISTC_AO_CMD1_UC_LOAD BIT(7) 13162306a36Sopenharmony_ci#define NISTC_AO_CMD1_BC_ARM BIT(6) 13262306a36Sopenharmony_ci#define NISTC_AO_CMD1_BC_LOAD BIT(5) 13362306a36Sopenharmony_ci#define NISTC_AO_CMD1_DAC1_UPDATE_MODE BIT(4) 13462306a36Sopenharmony_ci#define NISTC_AO_CMD1_LDAC1_SRC_SEL BIT(3) 13562306a36Sopenharmony_ci#define NISTC_AO_CMD1_DAC0_UPDATE_MODE BIT(2) 13662306a36Sopenharmony_ci#define NISTC_AO_CMD1_LDAC0_SRC_SEL BIT(1) 13762306a36Sopenharmony_ci#define NISTC_AO_CMD1_UPDATE_PULSE BIT(0) 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci#define NISTC_DIO_OUT_REG 10 14062306a36Sopenharmony_ci#define NISTC_DIO_OUT_SERIAL(x) (((x) & 0xff) << 8) 14162306a36Sopenharmony_ci#define NISTC_DIO_OUT_SERIAL_MASK NISTC_DIO_OUT_SERIAL(0xff) 14262306a36Sopenharmony_ci#define NISTC_DIO_OUT_PARALLEL(x) ((x) & 0xff) 14362306a36Sopenharmony_ci#define NISTC_DIO_OUT_PARALLEL_MASK NISTC_DIO_OUT_PARALLEL(0xff) 14462306a36Sopenharmony_ci#define NISTC_DIO_SDIN BIT(4) 14562306a36Sopenharmony_ci#define NISTC_DIO_SDOUT BIT(0) 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#define NISTC_DIO_CTRL_REG 11 14862306a36Sopenharmony_ci#define NISTC_DIO_SDCLK BIT(11) 14962306a36Sopenharmony_ci#define NISTC_DIO_CTRL_HW_SER_TIMEBASE BIT(10) 15062306a36Sopenharmony_ci#define NISTC_DIO_CTRL_HW_SER_ENA BIT(9) 15162306a36Sopenharmony_ci#define NISTC_DIO_CTRL_HW_SER_START BIT(8) 15262306a36Sopenharmony_ci#define NISTC_DIO_CTRL_DIR(x) ((x) & 0xff) 15362306a36Sopenharmony_ci#define NISTC_DIO_CTRL_DIR_MASK NISTC_DIO_CTRL_DIR(0xff) 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci#define NISTC_AI_MODE1_REG 12 15662306a36Sopenharmony_ci#define NISTC_AI_MODE1_CONVERT_SRC(x) (((x) & 0x1f) << 11) 15762306a36Sopenharmony_ci#define NISTC_AI_MODE1_SI_SRC(x) (((x) & 0x1f) << 6) 15862306a36Sopenharmony_ci#define NISTC_AI_MODE1_CONVERT_POLARITY BIT(5) 15962306a36Sopenharmony_ci#define NISTC_AI_MODE1_SI_POLARITY BIT(4) 16062306a36Sopenharmony_ci#define NISTC_AI_MODE1_START_STOP BIT(3) 16162306a36Sopenharmony_ci#define NISTC_AI_MODE1_RSVD BIT(2) 16262306a36Sopenharmony_ci#define NISTC_AI_MODE1_CONTINUOUS BIT(1) 16362306a36Sopenharmony_ci#define NISTC_AI_MODE1_TRIGGER_ONCE BIT(0) 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci#define NISTC_AI_MODE2_REG 13 16662306a36Sopenharmony_ci#define NISTC_AI_MODE2_SC_GATE_ENA BIT(15) 16762306a36Sopenharmony_ci#define NISTC_AI_MODE2_START_STOP_GATE_ENA BIT(14) 16862306a36Sopenharmony_ci#define NISTC_AI_MODE2_PRE_TRIGGER BIT(13) 16962306a36Sopenharmony_ci#define NISTC_AI_MODE2_EXTMUX_PRESENT BIT(12) 17062306a36Sopenharmony_ci#define NISTC_AI_MODE2_SI2_INIT_LOAD_SRC BIT(9) 17162306a36Sopenharmony_ci#define NISTC_AI_MODE2_SI2_RELOAD_MODE BIT(8) 17262306a36Sopenharmony_ci#define NISTC_AI_MODE2_SI_INIT_LOAD_SRC BIT(7) 17362306a36Sopenharmony_ci#define NISTC_AI_MODE2_SI_RELOAD_MODE(x) (((x) & 0x7) << 4) 17462306a36Sopenharmony_ci#define NISTC_AI_MODE2_SI_WR_SWITCH BIT(3) 17562306a36Sopenharmony_ci#define NISTC_AI_MODE2_SC_INIT_LOAD_SRC BIT(2) 17662306a36Sopenharmony_ci#define NISTC_AI_MODE2_SC_RELOAD_MODE BIT(1) 17762306a36Sopenharmony_ci#define NISTC_AI_MODE2_SC_WR_SWITCH BIT(0) 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci#define NISTC_AI_SI_LOADA_REG 14 18062306a36Sopenharmony_ci#define NISTC_AI_SI_LOADB_REG 16 18162306a36Sopenharmony_ci#define NISTC_AI_SC_LOADA_REG 18 18262306a36Sopenharmony_ci#define NISTC_AI_SC_LOADB_REG 20 18362306a36Sopenharmony_ci#define NISTC_AI_SI2_LOADA_REG 23 18462306a36Sopenharmony_ci#define NISTC_AI_SI2_LOADB_REG 25 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci#define NISTC_G0_MODE_REG 26 18762306a36Sopenharmony_ci#define NISTC_G1_MODE_REG 27 18862306a36Sopenharmony_ci#define NISTC_G0_LOADA_REG 28 18962306a36Sopenharmony_ci#define NISTC_G0_LOADB_REG 30 19062306a36Sopenharmony_ci#define NISTC_G1_LOADA_REG 32 19162306a36Sopenharmony_ci#define NISTC_G1_LOADB_REG 34 19262306a36Sopenharmony_ci#define NISTC_G0_INPUT_SEL_REG 36 19362306a36Sopenharmony_ci#define NISTC_G1_INPUT_SEL_REG 37 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define NISTC_AO_MODE1_REG 38 19662306a36Sopenharmony_ci#define NISTC_AO_MODE1_UPDATE_SRC(x) (((x) & 0x1f) << 11) 19762306a36Sopenharmony_ci#define NISTC_AO_MODE1_UPDATE_SRC_MASK NISTC_AO_MODE1_UPDATE_SRC(0x1f) 19862306a36Sopenharmony_ci#define NISTC_AO_MODE1_UI_SRC(x) (((x) & 0x1f) << 6) 19962306a36Sopenharmony_ci#define NISTC_AO_MODE1_UI_SRC_MASK NISTC_AO_MODE1_UI_SRC(0x1f) 20062306a36Sopenharmony_ci#define NISTC_AO_MODE1_MULTI_CHAN BIT(5) 20162306a36Sopenharmony_ci#define NISTC_AO_MODE1_UPDATE_SRC_POLARITY BIT(4) 20262306a36Sopenharmony_ci#define NISTC_AO_MODE1_UI_SRC_POLARITY BIT(3) 20362306a36Sopenharmony_ci#define NISTC_AO_MODE1_UC_SW_EVERY_TC BIT(2) 20462306a36Sopenharmony_ci#define NISTC_AO_MODE1_CONTINUOUS BIT(1) 20562306a36Sopenharmony_ci#define NISTC_AO_MODE1_TRIGGER_ONCE BIT(0) 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci#define NISTC_AO_MODE2_REG 39 20862306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE(x) (((x) & 0x3) << 14) 20962306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE_MASK NISTC_AO_MODE2_FIFO_MODE(3) 21062306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE_E NISTC_AO_MODE2_FIFO_MODE(0) 21162306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE_HF NISTC_AO_MODE2_FIFO_MODE(1) 21262306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE_F NISTC_AO_MODE2_FIFO_MODE(2) 21362306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_MODE_HF_F NISTC_AO_MODE2_FIFO_MODE(3) 21462306a36Sopenharmony_ci#define NISTC_AO_MODE2_FIFO_REXMIT_ENA BIT(13) 21562306a36Sopenharmony_ci#define NISTC_AO_MODE2_START1_DISABLE BIT(12) 21662306a36Sopenharmony_ci#define NISTC_AO_MODE2_UC_INIT_LOAD_SRC BIT(11) 21762306a36Sopenharmony_ci#define NISTC_AO_MODE2_UC_WR_SWITCH BIT(10) 21862306a36Sopenharmony_ci#define NISTC_AO_MODE2_UI2_INIT_LOAD_SRC BIT(9) 21962306a36Sopenharmony_ci#define NISTC_AO_MODE2_UI2_RELOAD_MODE BIT(8) 22062306a36Sopenharmony_ci#define NISTC_AO_MODE2_UI_INIT_LOAD_SRC BIT(7) 22162306a36Sopenharmony_ci#define NISTC_AO_MODE2_UI_RELOAD_MODE(x) (((x) & 0x7) << 4) 22262306a36Sopenharmony_ci#define NISTC_AO_MODE2_UI_WR_SWITCH BIT(3) 22362306a36Sopenharmony_ci#define NISTC_AO_MODE2_BC_INIT_LOAD_SRC BIT(2) 22462306a36Sopenharmony_ci#define NISTC_AO_MODE2_BC_RELOAD_MODE BIT(1) 22562306a36Sopenharmony_ci#define NISTC_AO_MODE2_BC_WR_SWITCH BIT(0) 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci#define NISTC_AO_UI_LOADA_REG 40 22862306a36Sopenharmony_ci#define NISTC_AO_UI_LOADB_REG 42 22962306a36Sopenharmony_ci#define NISTC_AO_BC_LOADA_REG 44 23062306a36Sopenharmony_ci#define NISTC_AO_BC_LOADB_REG 46 23162306a36Sopenharmony_ci#define NISTC_AO_UC_LOADA_REG 48 23262306a36Sopenharmony_ci#define NISTC_AO_UC_LOADB_REG 50 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci#define NISTC_CLK_FOUT_REG 56 23562306a36Sopenharmony_ci#define NISTC_CLK_FOUT_ENA BIT(15) 23662306a36Sopenharmony_ci#define NISTC_CLK_FOUT_TIMEBASE_SEL BIT(14) 23762306a36Sopenharmony_ci#define NISTC_CLK_FOUT_DIO_SER_OUT_DIV2 BIT(13) 23862306a36Sopenharmony_ci#define NISTC_CLK_FOUT_SLOW_DIV2 BIT(12) 23962306a36Sopenharmony_ci#define NISTC_CLK_FOUT_SLOW_TIMEBASE BIT(11) 24062306a36Sopenharmony_ci#define NISTC_CLK_FOUT_G_SRC_DIV2 BIT(10) 24162306a36Sopenharmony_ci#define NISTC_CLK_FOUT_TO_BOARD_DIV2 BIT(9) 24262306a36Sopenharmony_ci#define NISTC_CLK_FOUT_TO_BOARD BIT(8) 24362306a36Sopenharmony_ci#define NISTC_CLK_FOUT_AI_OUT_DIV2 BIT(7) 24462306a36Sopenharmony_ci#define NISTC_CLK_FOUT_AI_SRC_DIV2 BIT(6) 24562306a36Sopenharmony_ci#define NISTC_CLK_FOUT_AO_OUT_DIV2 BIT(5) 24662306a36Sopenharmony_ci#define NISTC_CLK_FOUT_AO_SRC_DIV2 BIT(4) 24762306a36Sopenharmony_ci#define NISTC_CLK_FOUT_DIVIDER(x) (((x) & 0xf) << 0) 24862306a36Sopenharmony_ci#define NISTC_CLK_FOUT_TO_DIVIDER(x) (((x) >> 0) & 0xf) 24962306a36Sopenharmony_ci#define NISTC_CLK_FOUT_DIVIDER_MASK NISTC_CLK_FOUT_DIVIDER(0xf) 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci#define NISTC_IO_BIDIR_PIN_REG 57 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_DIR_REG 58 25462306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_OLD_CLK_CHAN 7 25562306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_NUM_CHAN(_m) ((_m) ? 8 : 7) 25662306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_DIR(_c, _m) ((_m) ? BIT(8 + (_c)) : BIT(7 + (_c))) 25762306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_DIR_SUB_SEL1 BIT(2) /* only for M-Series */ 25862306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_DIR_SUB_SEL1_SHIFT 2 /* only for M-Series */ 25962306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_USE_CLK BIT(1) 26062306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_DRV_CLK BIT(0) 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define NISTC_INT_CTRL_REG 59 26362306a36Sopenharmony_ci#define NISTC_INT_CTRL_INTB_ENA BIT(15) 26462306a36Sopenharmony_ci#define NISTC_INT_CTRL_INTB_SEL(x) (((x) & 0x7) << 12) 26562306a36Sopenharmony_ci#define NISTC_INT_CTRL_INTA_ENA BIT(11) 26662306a36Sopenharmony_ci#define NISTC_INT_CTRL_INTA_SEL(x) (((x) & 0x7) << 8) 26762306a36Sopenharmony_ci#define NISTC_INT_CTRL_PASSTHRU0_POL BIT(3) 26862306a36Sopenharmony_ci#define NISTC_INT_CTRL_PASSTHRU1_POL BIT(2) 26962306a36Sopenharmony_ci#define NISTC_INT_CTRL_3PIN_INT BIT(1) 27062306a36Sopenharmony_ci#define NISTC_INT_CTRL_INT_POL BIT(0) 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_REG 60 27362306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_START_SEL BIT(10) 27462306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_SCAN_IN_PROG_SEL(x) (((x) & 0x3) << 8) 27562306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_EXTMUX_CLK_SEL(x) (((x) & 0x3) << 6) 27662306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_LOCALMUX_CLK_SEL(x) (((x) & 0x3) << 4) 27762306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_SC_TC_SEL(x) (((x) & 0x3) << 2) 27862306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_CONVERT_SEL(x) (((x) & 0x3) << 0) 27962306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_CONVERT_HIGH_Z NISTC_AI_OUT_CTRL_CONVERT_SEL(0) 28062306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_CONVERT_GND NISTC_AI_OUT_CTRL_CONVERT_SEL(1) 28162306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_CONVERT_LOW NISTC_AI_OUT_CTRL_CONVERT_SEL(2) 28262306a36Sopenharmony_ci#define NISTC_AI_OUT_CTRL_CONVERT_HIGH NISTC_AI_OUT_CTRL_CONVERT_SEL(3) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_REG 61 28562306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_1_ENA BIT(15) 28662306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_0_ENA BIT(14) 28762306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_0_SEL(x) (((x) & 0x7) << 11) 28862306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_0_SEL_TO_SRC(x) (((x) >> 11) & 0x7) 28962306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_1_SEL BIT(7) 29062306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_GPFO_1_SEL_TO_SRC(x) (((x) >> 7) & 0x1) 29162306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_DRV BIT(4) 29262306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_ENA BIT(3) 29362306a36Sopenharmony_ci#define NISTC_ATRIG_ETC_MODE(x) (((x) & 0x7) << 0) 29462306a36Sopenharmony_ci#define NISTC_GPFO_0_G_OUT 0 /* input to GPFO_0_SEL for Ctr0Out */ 29562306a36Sopenharmony_ci#define NISTC_GPFO_1_G_OUT 0 /* input to GPFO_1_SEL for Ctr1Out */ 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci#define NISTC_AI_START_STOP_REG 62 29862306a36Sopenharmony_ci#define NISTC_AI_START_POLARITY BIT(15) 29962306a36Sopenharmony_ci#define NISTC_AI_STOP_POLARITY BIT(14) 30062306a36Sopenharmony_ci#define NISTC_AI_STOP_SYNC BIT(13) 30162306a36Sopenharmony_ci#define NISTC_AI_STOP_EDGE BIT(12) 30262306a36Sopenharmony_ci#define NISTC_AI_STOP_SEL(x) (((x) & 0x1f) << 7) 30362306a36Sopenharmony_ci#define NISTC_AI_START_SYNC BIT(6) 30462306a36Sopenharmony_ci#define NISTC_AI_START_EDGE BIT(5) 30562306a36Sopenharmony_ci#define NISTC_AI_START_SEL(x) (((x) & 0x1f) << 0) 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci#define NISTC_AI_TRIG_SEL_REG 63 30862306a36Sopenharmony_ci#define NISTC_AI_TRIG_START1_POLARITY BIT(15) 30962306a36Sopenharmony_ci#define NISTC_AI_TRIG_START2_POLARITY BIT(14) 31062306a36Sopenharmony_ci#define NISTC_AI_TRIG_START2_SYNC BIT(13) 31162306a36Sopenharmony_ci#define NISTC_AI_TRIG_START2_EDGE BIT(12) 31262306a36Sopenharmony_ci#define NISTC_AI_TRIG_START2_SEL(x) (((x) & 0x1f) << 7) 31362306a36Sopenharmony_ci#define NISTC_AI_TRIG_START1_SYNC BIT(6) 31462306a36Sopenharmony_ci#define NISTC_AI_TRIG_START1_EDGE BIT(5) 31562306a36Sopenharmony_ci#define NISTC_AI_TRIG_START1_SEL(x) (((x) & 0x1f) << 0) 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci#define NISTC_AI_DIV_LOADA_REG 64 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci#define NISTC_AO_START_SEL_REG 66 32062306a36Sopenharmony_ci#define NISTC_AO_START_UI2_SW_GATE BIT(15) 32162306a36Sopenharmony_ci#define NISTC_AO_START_UI2_EXT_GATE_POL BIT(14) 32262306a36Sopenharmony_ci#define NISTC_AO_START_POLARITY BIT(13) 32362306a36Sopenharmony_ci#define NISTC_AO_START_AOFREQ_ENA BIT(12) 32462306a36Sopenharmony_ci#define NISTC_AO_START_UI2_EXT_GATE_SEL(x) (((x) & 0x1f) << 7) 32562306a36Sopenharmony_ci#define NISTC_AO_START_SYNC BIT(6) 32662306a36Sopenharmony_ci#define NISTC_AO_START_EDGE BIT(5) 32762306a36Sopenharmony_ci#define NISTC_AO_START_SEL(x) (((x) & 0x1f) << 0) 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci#define NISTC_AO_TRIG_SEL_REG 67 33062306a36Sopenharmony_ci#define NISTC_AO_TRIG_UI2_EXT_GATE_ENA BIT(15) 33162306a36Sopenharmony_ci#define NISTC_AO_TRIG_DELAYED_START1 BIT(14) 33262306a36Sopenharmony_ci#define NISTC_AO_TRIG_START1_POLARITY BIT(13) 33362306a36Sopenharmony_ci#define NISTC_AO_TRIG_UI2_SRC_POLARITY BIT(12) 33462306a36Sopenharmony_ci#define NISTC_AO_TRIG_UI2_SRC_SEL(x) (((x) & 0x1f) << 7) 33562306a36Sopenharmony_ci#define NISTC_AO_TRIG_START1_SYNC BIT(6) 33662306a36Sopenharmony_ci#define NISTC_AO_TRIG_START1_EDGE BIT(5) 33762306a36Sopenharmony_ci#define NISTC_AO_TRIG_START1_SEL(x) (((x) & 0x1f) << 0) 33862306a36Sopenharmony_ci#define NISTC_AO_TRIG_START1_SEL_MASK NISTC_AO_TRIG_START1_SEL(0x1f) 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci#define NISTC_G0_AUTOINC_REG 68 34162306a36Sopenharmony_ci#define NISTC_G1_AUTOINC_REG 69 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci#define NISTC_AO_MODE3_REG 70 34462306a36Sopenharmony_ci#define NISTC_AO_MODE3_UI2_SW_NEXT_TC BIT(13) 34562306a36Sopenharmony_ci#define NISTC_AO_MODE3_UC_SW_EVERY_BC_TC BIT(12) 34662306a36Sopenharmony_ci#define NISTC_AO_MODE3_TRIG_LEN BIT(11) 34762306a36Sopenharmony_ci#define NISTC_AO_MODE3_STOP_ON_OVERRUN_ERR BIT(5) 34862306a36Sopenharmony_ci#define NISTC_AO_MODE3_STOP_ON_BC_TC_TRIG_ERR BIT(4) 34962306a36Sopenharmony_ci#define NISTC_AO_MODE3_STOP_ON_BC_TC_ERR BIT(3) 35062306a36Sopenharmony_ci#define NISTC_AO_MODE3_NOT_AN_UPDATE BIT(2) 35162306a36Sopenharmony_ci#define NISTC_AO_MODE3_SW_GATE BIT(1) 35262306a36Sopenharmony_ci#define NISTC_AO_MODE3_LAST_GATE_DISABLE BIT(0) /* M-Series only */ 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ci#define NISTC_RESET_REG 72 35562306a36Sopenharmony_ci#define NISTC_RESET_SOFTWARE BIT(11) 35662306a36Sopenharmony_ci#define NISTC_RESET_AO_CFG_END BIT(9) 35762306a36Sopenharmony_ci#define NISTC_RESET_AI_CFG_END BIT(8) 35862306a36Sopenharmony_ci#define NISTC_RESET_AO_CFG_START BIT(5) 35962306a36Sopenharmony_ci#define NISTC_RESET_AI_CFG_START BIT(4) 36062306a36Sopenharmony_ci#define NISTC_RESET_G1 BIT(3) 36162306a36Sopenharmony_ci#define NISTC_RESET_G0 BIT(2) 36262306a36Sopenharmony_ci#define NISTC_RESET_AO BIT(1) 36362306a36Sopenharmony_ci#define NISTC_RESET_AI BIT(0) 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci#define NISTC_INTA_ENA_REG 73 36662306a36Sopenharmony_ci#define NISTC_INTA2_ENA_REG 74 36762306a36Sopenharmony_ci#define NISTC_INTA_ENA_PASSTHRU0 BIT(9) 36862306a36Sopenharmony_ci#define NISTC_INTA_ENA_G0_GATE BIT(8) 36962306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_FIFO BIT(7) 37062306a36Sopenharmony_ci#define NISTC_INTA_ENA_G0_TC BIT(6) 37162306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_ERR BIT(5) 37262306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_STOP BIT(4) 37362306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_START BIT(3) 37462306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_START2 BIT(2) 37562306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_START1 BIT(1) 37662306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_SC_TC BIT(0) 37762306a36Sopenharmony_ci#define NISTC_INTA_ENA_AI_MASK (NISTC_INTA_ENA_AI_FIFO | \ 37862306a36Sopenharmony_ci NISTC_INTA_ENA_AI_ERR | \ 37962306a36Sopenharmony_ci NISTC_INTA_ENA_AI_STOP | \ 38062306a36Sopenharmony_ci NISTC_INTA_ENA_AI_START | \ 38162306a36Sopenharmony_ci NISTC_INTA_ENA_AI_START2 | \ 38262306a36Sopenharmony_ci NISTC_INTA_ENA_AI_START1 | \ 38362306a36Sopenharmony_ci NISTC_INTA_ENA_AI_SC_TC) 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#define NISTC_INTB_ENA_REG 75 38662306a36Sopenharmony_ci#define NISTC_INTB2_ENA_REG 76 38762306a36Sopenharmony_ci#define NISTC_INTB_ENA_PASSTHRU1 BIT(11) 38862306a36Sopenharmony_ci#define NISTC_INTB_ENA_G1_GATE BIT(10) 38962306a36Sopenharmony_ci#define NISTC_INTB_ENA_G1_TC BIT(9) 39062306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_FIFO BIT(8) 39162306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_UI2_TC BIT(7) 39262306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_UC_TC BIT(6) 39362306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_ERR BIT(5) 39462306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_STOP BIT(4) 39562306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_START BIT(3) 39662306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_UPDATE BIT(2) 39762306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_START1 BIT(1) 39862306a36Sopenharmony_ci#define NISTC_INTB_ENA_AO_BC_TC BIT(0) 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_REG 77 40162306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_SHIFTIN_PW BIT(15) 40262306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_EOC_POLARITY BIT(14) 40362306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_SOC_POLARITY BIT(13) 40462306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_SHIFTIN_POL BIT(12) 40562306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_CONVERT_TIMEBASE BIT(11) 40662306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_CONVERT_PW BIT(10) 40762306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_CONVERT_ORIG_PULSE BIT(9) 40862306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_FIFO_FLAGS_POL BIT(8) 40962306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_OVERRUN_MODE BIT(7) 41062306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_EXTMUX_CLK_PW BIT(6) 41162306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_LOCALMUX_CLK_PW BIT(5) 41262306a36Sopenharmony_ci#define NISTC_AI_PERSONAL_AIFREQ_POL BIT(4) 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_REG 78 41562306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_MULTI_DACS BIT(15) /* M-Series only */ 41662306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_NUM_DAC BIT(14) /* 1:single; 0:dual */ 41762306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_FAST_CPU BIT(13) /* M-Series reserved */ 41862306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_TMRDACWR_PW BIT(12) 41962306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_FIFO_FLAGS_POL BIT(11) /* M-Series reserved */ 42062306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_FIFO_ENA BIT(10) 42162306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_AOFREQ_POL BIT(9) /* M-Series reserved */ 42262306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_DMA_PIO_CTRL BIT(8) /* M-Series reserved */ 42362306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_UPDATE_ORIG_PULSE BIT(7) 42462306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_UPDATE_TIMEBASE BIT(6) 42562306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_UPDATE_PW BIT(5) 42662306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_BC_SRC_SEL BIT(4) 42762306a36Sopenharmony_ci#define NISTC_AO_PERSONAL_INTERVAL_BUFFER_MODE BIT(3) 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci#define NISTC_RTSI_TRIGA_OUT_REG 79 43062306a36Sopenharmony_ci#define NISTC_RTSI_TRIGB_OUT_REG 80 43162306a36Sopenharmony_ci#define NISTC_RTSI_TRIGB_SUB_SEL1 BIT(15) /* not for M-Series */ 43262306a36Sopenharmony_ci#define NISTC_RTSI_TRIGB_SUB_SEL1_SHIFT 15 /* not for M-Series */ 43362306a36Sopenharmony_ci#define NISTC_RTSI_TRIG(_c, _s) (((_s) & 0xf) << (((_c) % 4) * 4)) 43462306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_MASK(_c) NISTC_RTSI_TRIG((_c), 0xf) 43562306a36Sopenharmony_ci#define NISTC_RTSI_TRIG_TO_SRC(_c, _b) (((_b) >> (((_c) % 4) * 4)) & 0xf) 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ci#define NISTC_RTSI_BOARD_REG 81 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci#define NISTC_CFG_MEM_CLR_REG 82 44062306a36Sopenharmony_ci#define NISTC_ADC_FIFO_CLR_REG 83 44162306a36Sopenharmony_ci#define NISTC_DAC_FIFO_CLR_REG 84 44262306a36Sopenharmony_ci#define NISTC_WR_STROBE3_REG 85 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_REG 86 44562306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_EXT_GATE_ENA BIT(15) 44662306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_EXT_GATE_SEL(x) (((x) & 0x1f) << 10) 44762306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_CHANS(x) (((x) & 0xf) << 6) 44862306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE2_SEL(x) (((x) & 0x3) << 4) 44962306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_EXT_GATE_POL BIT(3) 45062306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE2_TOGGLE BIT(2) 45162306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE_SEL(x) (((x) & 0x3) << 0) 45262306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE_SEL_HIGHZ NISTC_AO_OUT_CTRL_UPDATE_SEL(0) 45362306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE_SEL_GND NISTC_AO_OUT_CTRL_UPDATE_SEL(1) 45462306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE_SEL_LOW NISTC_AO_OUT_CTRL_UPDATE_SEL(2) 45562306a36Sopenharmony_ci#define NISTC_AO_OUT_CTRL_UPDATE_SEL_HIGH NISTC_AO_OUT_CTRL_UPDATE_SEL(3) 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci#define NISTC_AI_MODE3_REG 87 45862306a36Sopenharmony_ci#define NISTC_AI_MODE3_TRIG_LEN BIT(15) 45962306a36Sopenharmony_ci#define NISTC_AI_MODE3_DELAY_START BIT(14) 46062306a36Sopenharmony_ci#define NISTC_AI_MODE3_SOFTWARE_GATE BIT(13) 46162306a36Sopenharmony_ci#define NISTC_AI_MODE3_SI_TRIG_DELAY BIT(12) 46262306a36Sopenharmony_ci#define NISTC_AI_MODE3_SI2_SRC_SEL BIT(11) 46362306a36Sopenharmony_ci#define NISTC_AI_MODE3_DELAYED_START2 BIT(10) 46462306a36Sopenharmony_ci#define NISTC_AI_MODE3_DELAYED_START1 BIT(9) 46562306a36Sopenharmony_ci#define NISTC_AI_MODE3_EXT_GATE_MODE BIT(8) 46662306a36Sopenharmony_ci#define NISTC_AI_MODE3_FIFO_MODE(x) (((x) & 0x3) << 6) 46762306a36Sopenharmony_ci#define NISTC_AI_MODE3_FIFO_MODE_NE NISTC_AI_MODE3_FIFO_MODE(0) 46862306a36Sopenharmony_ci#define NISTC_AI_MODE3_FIFO_MODE_HF NISTC_AI_MODE3_FIFO_MODE(1) 46962306a36Sopenharmony_ci#define NISTC_AI_MODE3_FIFO_MODE_F NISTC_AI_MODE3_FIFO_MODE(2) 47062306a36Sopenharmony_ci#define NISTC_AI_MODE3_FIFO_MODE_HF_E NISTC_AI_MODE3_FIFO_MODE(3) 47162306a36Sopenharmony_ci#define NISTC_AI_MODE3_EXT_GATE_POL BIT(5) 47262306a36Sopenharmony_ci#define NISTC_AI_MODE3_EXT_GATE_SEL(x) (((x) & 0x1f) << 0) 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci#define NISTC_AI_STATUS1_REG 2 47562306a36Sopenharmony_ci#define NISTC_AI_STATUS1_INTA BIT(15) 47662306a36Sopenharmony_ci#define NISTC_AI_STATUS1_FIFO_F BIT(14) 47762306a36Sopenharmony_ci#define NISTC_AI_STATUS1_FIFO_HF BIT(13) 47862306a36Sopenharmony_ci#define NISTC_AI_STATUS1_FIFO_E BIT(12) 47962306a36Sopenharmony_ci#define NISTC_AI_STATUS1_OVERRUN BIT(11) 48062306a36Sopenharmony_ci#define NISTC_AI_STATUS1_OVERFLOW BIT(10) 48162306a36Sopenharmony_ci#define NISTC_AI_STATUS1_SC_TC_ERR BIT(9) 48262306a36Sopenharmony_ci#define NISTC_AI_STATUS1_OVER (NISTC_AI_STATUS1_OVERRUN | \ 48362306a36Sopenharmony_ci NISTC_AI_STATUS1_OVERFLOW) 48462306a36Sopenharmony_ci#define NISTC_AI_STATUS1_ERR (NISTC_AI_STATUS1_OVER | \ 48562306a36Sopenharmony_ci NISTC_AI_STATUS1_SC_TC_ERR) 48662306a36Sopenharmony_ci#define NISTC_AI_STATUS1_START2 BIT(8) 48762306a36Sopenharmony_ci#define NISTC_AI_STATUS1_START1 BIT(7) 48862306a36Sopenharmony_ci#define NISTC_AI_STATUS1_SC_TC BIT(6) 48962306a36Sopenharmony_ci#define NISTC_AI_STATUS1_START BIT(5) 49062306a36Sopenharmony_ci#define NISTC_AI_STATUS1_STOP BIT(4) 49162306a36Sopenharmony_ci#define NISTC_AI_STATUS1_G0_TC BIT(3) 49262306a36Sopenharmony_ci#define NISTC_AI_STATUS1_G0_GATE BIT(2) 49362306a36Sopenharmony_ci#define NISTC_AI_STATUS1_FIFO_REQ BIT(1) 49462306a36Sopenharmony_ci#define NISTC_AI_STATUS1_PASSTHRU0 BIT(0) 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ci#define NISTC_AO_STATUS1_REG 3 49762306a36Sopenharmony_ci#define NISTC_AO_STATUS1_INTB BIT(15) 49862306a36Sopenharmony_ci#define NISTC_AO_STATUS1_FIFO_F BIT(14) 49962306a36Sopenharmony_ci#define NISTC_AO_STATUS1_FIFO_HF BIT(13) 50062306a36Sopenharmony_ci#define NISTC_AO_STATUS1_FIFO_E BIT(12) 50162306a36Sopenharmony_ci#define NISTC_AO_STATUS1_BC_TC_ERR BIT(11) 50262306a36Sopenharmony_ci#define NISTC_AO_STATUS1_START BIT(10) 50362306a36Sopenharmony_ci#define NISTC_AO_STATUS1_OVERRUN BIT(9) 50462306a36Sopenharmony_ci#define NISTC_AO_STATUS1_START1 BIT(8) 50562306a36Sopenharmony_ci#define NISTC_AO_STATUS1_BC_TC BIT(7) 50662306a36Sopenharmony_ci#define NISTC_AO_STATUS1_UC_TC BIT(6) 50762306a36Sopenharmony_ci#define NISTC_AO_STATUS1_UPDATE BIT(5) 50862306a36Sopenharmony_ci#define NISTC_AO_STATUS1_UI2_TC BIT(4) 50962306a36Sopenharmony_ci#define NISTC_AO_STATUS1_G1_TC BIT(3) 51062306a36Sopenharmony_ci#define NISTC_AO_STATUS1_G1_GATE BIT(2) 51162306a36Sopenharmony_ci#define NISTC_AO_STATUS1_FIFO_REQ BIT(1) 51262306a36Sopenharmony_ci#define NISTC_AO_STATUS1_PASSTHRU1 BIT(0) 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci#define NISTC_G01_STATUS_REG 4 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci#define NISTC_AI_STATUS2_REG 5 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci#define NISTC_AO_STATUS2_REG 6 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ci#define NISTC_DIO_IN_REG 7 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci#define NISTC_G0_HW_SAVE_REG 8 52362306a36Sopenharmony_ci#define NISTC_G1_HW_SAVE_REG 10 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci#define NISTC_G0_SAVE_REG 12 52662306a36Sopenharmony_ci#define NISTC_G1_SAVE_REG 14 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_ci#define NISTC_AO_UI_SAVE_REG 16 52962306a36Sopenharmony_ci#define NISTC_AO_BC_SAVE_REG 18 53062306a36Sopenharmony_ci#define NISTC_AO_UC_SAVE_REG 20 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci#define NISTC_STATUS1_REG 27 53362306a36Sopenharmony_ci#define NISTC_STATUS1_SERIO_IN_PROG BIT(12) 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_ci#define NISTC_DIO_SERIAL_IN_REG 28 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_ci#define NISTC_STATUS2_REG 29 53862306a36Sopenharmony_ci#define NISTC_STATUS2_AO_TMRDACWRS_IN_PROGRESS BIT(5) 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci#define NISTC_AI_SI_SAVE_REG 64 54162306a36Sopenharmony_ci#define NISTC_AI_SC_SAVE_REG 66 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci/* 54462306a36Sopenharmony_ci * PCI E Series Registers 54562306a36Sopenharmony_ci */ 54662306a36Sopenharmony_ci#define NI_E_STC_WINDOW_ADDR_REG 0x00 /* rw16 */ 54762306a36Sopenharmony_ci#define NI_E_STC_WINDOW_DATA_REG 0x02 /* rw16 */ 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_ci#define NI_E_STATUS_REG 0x01 /* r8 */ 55062306a36Sopenharmony_ci#define NI_E_STATUS_AI_FIFO_LOWER_NE BIT(3) 55162306a36Sopenharmony_ci#define NI_E_STATUS_PROMOUT BIT(0) 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci#define NI_E_DMA_AI_AO_SEL_REG 0x09 /* w8 */ 55462306a36Sopenharmony_ci#define NI_E_DMA_AI_SEL(x) (((x) & 0xf) << 0) 55562306a36Sopenharmony_ci#define NI_E_DMA_AI_SEL_MASK NI_E_DMA_AI_SEL(0xf) 55662306a36Sopenharmony_ci#define NI_E_DMA_AO_SEL(x) (((x) & 0xf) << 4) 55762306a36Sopenharmony_ci#define NI_E_DMA_AO_SEL_MASK NI_E_DMA_AO_SEL(0xf) 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci#define NI_E_DMA_G0_G1_SEL_REG 0x0b /* w8 */ 56062306a36Sopenharmony_ci#define NI_E_DMA_G0_G1_SEL(_g, _c) (((_c) & 0xf) << ((_g) * 4)) 56162306a36Sopenharmony_ci#define NI_E_DMA_G0_G1_SEL_MASK(_g) NI_E_DMA_G0_G1_SEL((_g), 0xf) 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci#define NI_E_SERIAL_CMD_REG 0x0d /* w8 */ 56462306a36Sopenharmony_ci#define NI_E_SERIAL_CMD_DAC_LD(x) BIT(3 + (x)) 56562306a36Sopenharmony_ci#define NI_E_SERIAL_CMD_EEPROM_CS BIT(2) 56662306a36Sopenharmony_ci#define NI_E_SERIAL_CMD_SDATA BIT(1) 56762306a36Sopenharmony_ci#define NI_E_SERIAL_CMD_SCLK BIT(0) 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci#define NI_E_MISC_CMD_REG 0x0f /* w8 */ 57062306a36Sopenharmony_ci#define NI_E_MISC_CMD_INTEXT_ATRIG(x) (((x) & 0x1) << 7) 57162306a36Sopenharmony_ci#define NI_E_MISC_CMD_EXT_ATRIG NI_E_MISC_CMD_INTEXT_ATRIG(0) 57262306a36Sopenharmony_ci#define NI_E_MISC_CMD_INT_ATRIG NI_E_MISC_CMD_INTEXT_ATRIG(1) 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_REG 0x10 /* w16 */ 57562306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_LAST_CHAN BIT(15) 57662306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_GEN_TRIG BIT(12) 57762306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_DITHER BIT(9) 57862306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_UNI BIT(8) 57962306a36Sopenharmony_ci#define NI_E_AI_CFG_LO_GAIN(x) ((x) << 0) 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_REG 0x12 /* w16 */ 58262306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_TYPE(x) (((x) & 0x7) << 12) 58362306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_TYPE_DIFF NI_E_AI_CFG_HI_TYPE(1) 58462306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_TYPE_COMMON NI_E_AI_CFG_HI_TYPE(2) 58562306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_TYPE_GROUND NI_E_AI_CFG_HI_TYPE(3) 58662306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_AC_COUPLE BIT(11) 58762306a36Sopenharmony_ci#define NI_E_AI_CFG_HI_CHAN(x) (((x) & 0x3f) << 0) 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ci#define NI_E_AO_CFG_REG 0x16 /* w16 */ 59062306a36Sopenharmony_ci#define NI_E_AO_DACSEL(x) ((x) << 8) 59162306a36Sopenharmony_ci#define NI_E_AO_GROUND_REF BIT(3) 59262306a36Sopenharmony_ci#define NI_E_AO_EXT_REF BIT(2) 59362306a36Sopenharmony_ci#define NI_E_AO_DEGLITCH BIT(1) 59462306a36Sopenharmony_ci#define NI_E_AO_CFG_BIP BIT(0) 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci#define NI_E_DAC_DIRECT_DATA_REG(x) (0x18 + ((x) * 2)) /* w16 */ 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci#define NI_E_8255_BASE 0x19 /* rw8 */ 59962306a36Sopenharmony_ci 60062306a36Sopenharmony_ci#define NI_E_AI_FIFO_DATA_REG 0x1c /* r16 */ 60162306a36Sopenharmony_ci 60262306a36Sopenharmony_ci#define NI_E_AO_FIFO_DATA_REG 0x1e /* w16 */ 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* 60562306a36Sopenharmony_ci * 611x registers (these boards differ from the e-series) 60662306a36Sopenharmony_ci */ 60762306a36Sopenharmony_ci#define NI611X_MAGIC_REG 0x19 /* w8 (new) */ 60862306a36Sopenharmony_ci#define NI611X_CALIB_CHAN_SEL_REG 0x1a /* w16 (new) */ 60962306a36Sopenharmony_ci#define NI611X_AI_FIFO_DATA_REG 0x1c /* r32 (incompatible) */ 61062306a36Sopenharmony_ci#define NI611X_AI_FIFO_OFFSET_LOAD_REG 0x05 /* r8 (new) */ 61162306a36Sopenharmony_ci#define NI611X_AO_FIFO_DATA_REG 0x14 /* w32 (incompatible) */ 61262306a36Sopenharmony_ci#define NI611X_CAL_GAIN_SEL_REG 0x05 /* w8 (new) */ 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci#define NI611X_AO_WINDOW_ADDR_REG 0x18 61562306a36Sopenharmony_ci#define NI611X_AO_WINDOW_DATA_REG 0x1e 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_ci/* 61862306a36Sopenharmony_ci * 6143 registers 61962306a36Sopenharmony_ci */ 62062306a36Sopenharmony_ci#define NI6143_MAGIC_REG 0x19 /* w8 */ 62162306a36Sopenharmony_ci#define NI6143_DMA_G0_G1_SEL_REG 0x0b /* w8 */ 62262306a36Sopenharmony_ci#define NI6143_PIPELINE_DELAY_REG 0x1f /* w8 */ 62362306a36Sopenharmony_ci#define NI6143_EOC_SET_REG 0x1d /* w8 */ 62462306a36Sopenharmony_ci#define NI6143_DMA_AI_SEL_REG 0x09 /* w8 */ 62562306a36Sopenharmony_ci#define NI6143_AI_FIFO_DATA_REG 0x8c /* r32 */ 62662306a36Sopenharmony_ci#define NI6143_AI_FIFO_FLAG_REG 0x84 /* w32 */ 62762306a36Sopenharmony_ci#define NI6143_AI_FIFO_CTRL_REG 0x88 /* w32 */ 62862306a36Sopenharmony_ci#define NI6143_AI_FIFO_STATUS_REG 0x88 /* r32 */ 62962306a36Sopenharmony_ci#define NI6143_AI_FIFO_DMA_THRESH_REG 0x90 /* w32 */ 63062306a36Sopenharmony_ci#define NI6143_AI_FIFO_WORDS_AVAIL_REG 0x94 /* w32 */ 63162306a36Sopenharmony_ci 63262306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_REG 0x42 /* w16 */ 63362306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_RELAY_ON BIT(15) 63462306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_RELAY_OFF BIT(14) 63562306a36Sopenharmony_ci#define NI6143_CALIB_CHAN(x) (((x) & 0xf) << 0) 63662306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_GND_GND NI6143_CALIB_CHAN(0) /* Offset Cal */ 63762306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_2V5_GND NI6143_CALIB_CHAN(2) /* 2.5V ref */ 63862306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_PWM_GND NI6143_CALIB_CHAN(5) /* +-5V Self Cal */ 63962306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_2V5_PWM NI6143_CALIB_CHAN(10) /* PWM Cal */ 64062306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_PWM_PWM NI6143_CALIB_CHAN(13) /* CMRR */ 64162306a36Sopenharmony_ci#define NI6143_CALIB_CHAN_GND_PWM NI6143_CALIB_CHAN(14) /* PWM Cal */ 64262306a36Sopenharmony_ci#define NI6143_CALIB_LO_TIME_REG 0x20 /* w16 */ 64362306a36Sopenharmony_ci#define NI6143_CALIB_HI_TIME_REG 0x22 /* w16 */ 64462306a36Sopenharmony_ci#define NI6143_RELAY_COUNTER_LOAD_REG 0x4c /* w32 */ 64562306a36Sopenharmony_ci#define NI6143_SIGNATURE_REG 0x50 /* w32 */ 64662306a36Sopenharmony_ci#define NI6143_RELEASE_DATE_REG 0x54 /* w32 */ 64762306a36Sopenharmony_ci#define NI6143_RELEASE_OLDEST_DATE_REG 0x58 /* w32 */ 64862306a36Sopenharmony_ci 64962306a36Sopenharmony_ci/* 65062306a36Sopenharmony_ci * 671x, 611x windowed ao registers 65162306a36Sopenharmony_ci */ 65262306a36Sopenharmony_ci#define NI671X_DAC_DIRECT_DATA_REG(x) (0x00 + (x)) /* w16 */ 65362306a36Sopenharmony_ci#define NI611X_AO_TIMED_REG 0x10 /* w16 */ 65462306a36Sopenharmony_ci#define NI671X_AO_IMMEDIATE_REG 0x11 /* w16 */ 65562306a36Sopenharmony_ci#define NI611X_AO_FIFO_OFFSET_LOAD_REG 0x13 /* w32 */ 65662306a36Sopenharmony_ci#define NI67XX_AO_SP_UPDATES_REG 0x14 /* w16 */ 65762306a36Sopenharmony_ci#define NI611X_AO_WAVEFORM_GEN_REG 0x15 /* w16 */ 65862306a36Sopenharmony_ci#define NI611X_AO_MISC_REG 0x16 /* w16 */ 65962306a36Sopenharmony_ci#define NI611X_AO_MISC_CLEAR_WG BIT(0) 66062306a36Sopenharmony_ci#define NI67XX_AO_CAL_CHAN_SEL_REG 0x17 /* w16 */ 66162306a36Sopenharmony_ci#define NI67XX_AO_CFG2_REG 0x18 /* w16 */ 66262306a36Sopenharmony_ci#define NI67XX_CAL_CMD_REG 0x19 /* w16 */ 66362306a36Sopenharmony_ci#define NI67XX_CAL_STATUS_REG 0x1a /* r8 */ 66462306a36Sopenharmony_ci#define NI67XX_CAL_STATUS_BUSY BIT(0) 66562306a36Sopenharmony_ci#define NI67XX_CAL_STATUS_OSC_DETECT BIT(1) 66662306a36Sopenharmony_ci#define NI67XX_CAL_STATUS_OVERRANGE BIT(2) 66762306a36Sopenharmony_ci#define NI67XX_CAL_DATA_REG 0x1b /* r16 */ 66862306a36Sopenharmony_ci#define NI67XX_CAL_CFG_HI_REG 0x1c /* rw16 */ 66962306a36Sopenharmony_ci#define NI67XX_CAL_CFG_LO_REG 0x1d /* rw16 */ 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_ci#define CS5529_CMD_CB BIT(7) 67262306a36Sopenharmony_ci#define CS5529_CMD_SINGLE_CONV BIT(6) 67362306a36Sopenharmony_ci#define CS5529_CMD_CONT_CONV BIT(5) 67462306a36Sopenharmony_ci#define CS5529_CMD_READ BIT(4) 67562306a36Sopenharmony_ci#define CS5529_CMD_REG(x) (((x) & 0x7) << 1) 67662306a36Sopenharmony_ci#define CS5529_CMD_REG_MASK CS5529_CMD_REG(7) 67762306a36Sopenharmony_ci#define CS5529_CMD_PWR_SAVE BIT(0) 67862306a36Sopenharmony_ci 67962306a36Sopenharmony_ci#define CS5529_OFFSET_REG CS5529_CMD_REG(0) 68062306a36Sopenharmony_ci#define CS5529_GAIN_REG CS5529_CMD_REG(1) 68162306a36Sopenharmony_ci#define CS5529_CONV_DATA_REG CS5529_CMD_REG(3) 68262306a36Sopenharmony_ci#define CS5529_SETUP_REG CS5529_CMD_REG(4) 68362306a36Sopenharmony_ci 68462306a36Sopenharmony_ci#define CS5529_CFG_REG CS5529_CMD_REG(2) 68562306a36Sopenharmony_ci#define CS5529_CFG_AOUT(x) BIT(22 + (x)) 68662306a36Sopenharmony_ci#define CS5529_CFG_DOUT(x) BIT(18 + (x)) 68762306a36Sopenharmony_ci#define CS5529_CFG_LOW_PWR_MODE BIT(16) 68862306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE(x) (((x) & 0x7) << 13) 68962306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_MASK CS5529_CFG_WORD_RATE(0x7) 69062306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_2180 CS5529_CFG_WORD_RATE(0) 69162306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_1092 CS5529_CFG_WORD_RATE(1) 69262306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_532 CS5529_CFG_WORD_RATE(2) 69362306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_388 CS5529_CFG_WORD_RATE(3) 69462306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_324 CS5529_CFG_WORD_RATE(4) 69562306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_17444 CS5529_CFG_WORD_RATE(5) 69662306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_8724 CS5529_CFG_WORD_RATE(6) 69762306a36Sopenharmony_ci#define CS5529_CFG_WORD_RATE_4364 CS5529_CFG_WORD_RATE(7) 69862306a36Sopenharmony_ci#define CS5529_CFG_UNIPOLAR BIT(12) 69962306a36Sopenharmony_ci#define CS5529_CFG_RESET BIT(7) 70062306a36Sopenharmony_ci#define CS5529_CFG_RESET_VALID BIT(6) 70162306a36Sopenharmony_ci#define CS5529_CFG_PORT_FLAG BIT(5) 70262306a36Sopenharmony_ci#define CS5529_CFG_PWR_SAVE_SEL BIT(4) 70362306a36Sopenharmony_ci#define CS5529_CFG_DONE_FLAG BIT(3) 70462306a36Sopenharmony_ci#define CS5529_CFG_CALIB(x) (((x) & 0x7) << 0) 70562306a36Sopenharmony_ci#define CS5529_CFG_CALIB_NONE CS5529_CFG_CALIB(0) 70662306a36Sopenharmony_ci#define CS5529_CFG_CALIB_OFFSET_SELF CS5529_CFG_CALIB(1) 70762306a36Sopenharmony_ci#define CS5529_CFG_CALIB_GAIN_SELF CS5529_CFG_CALIB(2) 70862306a36Sopenharmony_ci#define CS5529_CFG_CALIB_BOTH_SELF CS5529_CFG_CALIB(3) 70962306a36Sopenharmony_ci#define CS5529_CFG_CALIB_OFFSET_SYS CS5529_CFG_CALIB(5) 71062306a36Sopenharmony_ci#define CS5529_CFG_CALIB_GAIN_SYS CS5529_CFG_CALIB(6) 71162306a36Sopenharmony_ci 71262306a36Sopenharmony_ci/* 71362306a36Sopenharmony_ci * M-Series specific registers not handled by the DAQ-STC and GPCT register 71462306a36Sopenharmony_ci * remapping. 71562306a36Sopenharmony_ci */ 71662306a36Sopenharmony_ci#define NI_M_CDIO_DMA_SEL_REG 0x007 71762306a36Sopenharmony_ci#define NI_M_CDIO_DMA_SEL_CDO(x) (((x) & 0xf) << 4) 71862306a36Sopenharmony_ci#define NI_M_CDIO_DMA_SEL_CDO_MASK NI_M_CDIO_DMA_SEL_CDO(0xf) 71962306a36Sopenharmony_ci#define NI_M_CDIO_DMA_SEL_CDI(x) (((x) & 0xf) << 0) 72062306a36Sopenharmony_ci#define NI_M_CDIO_DMA_SEL_CDI_MASK NI_M_CDIO_DMA_SEL_CDI(0xf) 72162306a36Sopenharmony_ci#define NI_M_SCXI_STATUS_REG 0x007 72262306a36Sopenharmony_ci#define NI_M_AI_AO_SEL_REG 0x009 72362306a36Sopenharmony_ci#define NI_M_G0_G1_SEL_REG 0x00b 72462306a36Sopenharmony_ci#define NI_M_MISC_CMD_REG 0x00f 72562306a36Sopenharmony_ci#define NI_M_SCXI_SER_DO_REG 0x011 72662306a36Sopenharmony_ci#define NI_M_SCXI_CTRL_REG 0x013 72762306a36Sopenharmony_ci#define NI_M_SCXI_OUT_ENA_REG 0x015 72862306a36Sopenharmony_ci#define NI_M_AI_FIFO_DATA_REG 0x01c 72962306a36Sopenharmony_ci#define NI_M_DIO_REG 0x024 73062306a36Sopenharmony_ci#define NI_M_DIO_DIR_REG 0x028 73162306a36Sopenharmony_ci#define NI_M_CAL_PWM_REG 0x040 73262306a36Sopenharmony_ci#define NI_M_CAL_PWM_HIGH_TIME(x) (((x) & 0xffff) << 16) 73362306a36Sopenharmony_ci#define NI_M_CAL_PWM_LOW_TIME(x) (((x) & 0xffff) << 0) 73462306a36Sopenharmony_ci#define NI_M_GEN_PWM_REG(x) (0x044 + ((x) * 2)) 73562306a36Sopenharmony_ci#define NI_M_AI_CFG_FIFO_DATA_REG 0x05e 73662306a36Sopenharmony_ci#define NI_M_AI_CFG_LAST_CHAN BIT(14) 73762306a36Sopenharmony_ci#define NI_M_AI_CFG_DITHER BIT(13) 73862306a36Sopenharmony_ci#define NI_M_AI_CFG_POLARITY BIT(12) 73962306a36Sopenharmony_ci#define NI_M_AI_CFG_GAIN(x) (((x) & 0x7) << 9) 74062306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE(x) (((x) & 0x7) << 6) 74162306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_MASK NI_M_AI_CFG_CHAN_TYPE(7) 74262306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_CALIB NI_M_AI_CFG_CHAN_TYPE(0) 74362306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_DIFF NI_M_AI_CFG_CHAN_TYPE(1) 74462306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_COMMON NI_M_AI_CFG_CHAN_TYPE(2) 74562306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_GROUND NI_M_AI_CFG_CHAN_TYPE(3) 74662306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_AUX NI_M_AI_CFG_CHAN_TYPE(5) 74762306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_TYPE_GHOST NI_M_AI_CFG_CHAN_TYPE(7) 74862306a36Sopenharmony_ci#define NI_M_AI_CFG_BANK_SEL(x) ((((x) & 0x40) << 4) | ((x) & 0x30)) 74962306a36Sopenharmony_ci#define NI_M_AI_CFG_CHAN_SEL(x) (((x) & 0xf) << 0) 75062306a36Sopenharmony_ci#define NI_M_INTC_ENA_REG 0x088 75162306a36Sopenharmony_ci#define NI_M_INTC_ENA BIT(0) 75262306a36Sopenharmony_ci#define NI_M_INTC_STATUS_REG 0x088 75362306a36Sopenharmony_ci#define NI_M_INTC_STATUS BIT(0) 75462306a36Sopenharmony_ci#define NI_M_ATRIG_CTRL_REG 0x08c 75562306a36Sopenharmony_ci#define NI_M_AO_SER_INT_ENA_REG 0x0a0 75662306a36Sopenharmony_ci#define NI_M_AO_SER_INT_ACK_REG 0x0a1 75762306a36Sopenharmony_ci#define NI_M_AO_SER_INT_STATUS_REG 0x0a1 75862306a36Sopenharmony_ci#define NI_M_AO_CALIB_REG 0x0a3 75962306a36Sopenharmony_ci#define NI_M_AO_FIFO_DATA_REG 0x0a4 76062306a36Sopenharmony_ci#define NI_M_PFI_FILTER_REG 0x0b0 76162306a36Sopenharmony_ci#define NI_M_PFI_FILTER_SEL(_c, _f) (((_f) & 0x3) << ((_c) * 2)) 76262306a36Sopenharmony_ci#define NI_M_PFI_FILTER_SEL_MASK(_c) NI_M_PFI_FILTER_SEL((_c), 0x3) 76362306a36Sopenharmony_ci#define NI_M_RTSI_FILTER_REG 0x0b4 76462306a36Sopenharmony_ci#define NI_M_SCXI_LEGACY_COMPAT_REG 0x0bc 76562306a36Sopenharmony_ci#define NI_M_DAC_DIRECT_DATA_REG(x) (0x0c0 + ((x) * 4)) 76662306a36Sopenharmony_ci#define NI_M_AO_WAVEFORM_ORDER_REG(x) (0x0c2 + ((x) * 4)) 76762306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_REG(x) (0x0c3 + ((x) * 4)) 76862306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_BIPOLAR BIT(7) 76962306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_UPDATE_TIMED BIT(6) 77062306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_REF(x) (((x) & 0x7) << 3) 77162306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_REF_MASK NI_M_AO_CFG_BANK_REF(7) 77262306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_REF_INT_10V NI_M_AO_CFG_BANK_REF(0) 77362306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_REF_INT_5V NI_M_AO_CFG_BANK_REF(1) 77462306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_OFFSET(x) (((x) & 0x7) << 0) 77562306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_OFFSET_MASK NI_M_AO_CFG_BANK_OFFSET(7) 77662306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_OFFSET_0V NI_M_AO_CFG_BANK_OFFSET(0) 77762306a36Sopenharmony_ci#define NI_M_AO_CFG_BANK_OFFSET_5V NI_M_AO_CFG_BANK_OFFSET(1) 77862306a36Sopenharmony_ci#define NI_M_RTSI_SHARED_MUX_REG 0x1a2 77962306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_REG 0x1c4 78062306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_RTSI_10MHZ BIT(7) 78162306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_TIMEBASE3_PLL BIT(6) 78262306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_TIMEBASE1_PLL BIT(5) 78362306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_PLL_SRC(x) (((x) & 0x1f) << 0) 78462306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_PLL_SRC_MASK NI_M_CLK_FOUT2_PLL_SRC(0x1f) 78562306a36Sopenharmony_ci#define NI_M_MAX_RTSI_CHAN 7 78662306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_PLL_SRC_RTSI(x) (((x) == NI_M_MAX_RTSI_CHAN) \ 78762306a36Sopenharmony_ci ? NI_M_CLK_FOUT2_PLL_SRC(0x1b) \ 78862306a36Sopenharmony_ci : NI_M_CLK_FOUT2_PLL_SRC(0xb + (x))) 78962306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_PLL_SRC_STAR NI_M_CLK_FOUT2_PLL_SRC(0x14) 79062306a36Sopenharmony_ci#define NI_M_CLK_FOUT2_PLL_SRC_PXI10 NI_M_CLK_FOUT2_PLL_SRC(0x1d) 79162306a36Sopenharmony_ci#define NI_M_PLL_CTRL_REG 0x1c6 79262306a36Sopenharmony_ci#define NI_M_PLL_CTRL_VCO_MODE(x) (((x) & 0x3) << 13) 79362306a36Sopenharmony_ci#define NI_M_PLL_CTRL_VCO_MODE_200_325MHZ NI_M_PLL_CTRL_VCO_MODE(0) 79462306a36Sopenharmony_ci#define NI_M_PLL_CTRL_VCO_MODE_175_225MHZ NI_M_PLL_CTRL_VCO_MODE(1) 79562306a36Sopenharmony_ci#define NI_M_PLL_CTRL_VCO_MODE_100_225MHZ NI_M_PLL_CTRL_VCO_MODE(2) 79662306a36Sopenharmony_ci#define NI_M_PLL_CTRL_VCO_MODE_75_150MHZ NI_M_PLL_CTRL_VCO_MODE(3) 79762306a36Sopenharmony_ci#define NI_M_PLL_CTRL_ENA BIT(12) 79862306a36Sopenharmony_ci#define NI_M_PLL_MAX_DIVISOR 0x10 79962306a36Sopenharmony_ci#define NI_M_PLL_CTRL_DIVISOR(x) (((x) & 0xf) << 8) 80062306a36Sopenharmony_ci#define NI_M_PLL_MAX_MULTIPLIER 0x100 80162306a36Sopenharmony_ci#define NI_M_PLL_CTRL_MULTIPLIER(x) (((x) & 0xff) << 0) 80262306a36Sopenharmony_ci#define NI_M_PLL_STATUS_REG 0x1c8 80362306a36Sopenharmony_ci#define NI_M_PLL_STATUS_LOCKED BIT(0) 80462306a36Sopenharmony_ci#define NI_M_PFI_OUT_SEL_REG(x) (0x1d0 + ((x) * 2)) 80562306a36Sopenharmony_ci#define NI_M_PFI_CHAN(_c) (((_c) % 3) * 5) 80662306a36Sopenharmony_ci#define NI_M_PFI_OUT_SEL(_c, _s) (((_s) & 0x1f) << NI_M_PFI_CHAN(_c)) 80762306a36Sopenharmony_ci#define NI_M_PFI_OUT_SEL_MASK(_c) (0x1f << NI_M_PFI_CHAN(_c)) 80862306a36Sopenharmony_ci#define NI_M_PFI_OUT_SEL_TO_SRC(_c, _b) (((_b) >> NI_M_PFI_CHAN(_c)) & 0x1f) 80962306a36Sopenharmony_ci#define NI_M_PFI_DI_REG 0x1dc 81062306a36Sopenharmony_ci#define NI_M_PFI_DO_REG 0x1de 81162306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_FIFO_REG 0x218 81262306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_FIFO BIT(31) 81362306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_POLARITY BIT(22) 81462306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_DITHER BIT(21) 81562306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_GAIN(x) (((x) & 0x7) << 18) 81662306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AO_CAL(x) (((x) & 0xf) << 15) 81762306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AO_CAL_MASK NI_M_CFG_BYPASS_AO_CAL(0xf) 81862306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_MODE_MUX(x) (((x) & 0x3) << 13) 81962306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_MODE_MUX_MASK NI_M_CFG_BYPASS_AI_MODE_MUX(3) 82062306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CAL_NEG(x) (((x) & 0x7) << 10) 82162306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CAL_NEG_MASK NI_M_CFG_BYPASS_AI_CAL_NEG(7) 82262306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CAL_POS(x) (((x) & 0x7) << 7) 82362306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CAL_POS_MASK NI_M_CFG_BYPASS_AI_CAL_POS(7) 82462306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CAL_MASK (NI_M_CFG_BYPASS_AI_CAL_POS_MASK | \ 82562306a36Sopenharmony_ci NI_M_CFG_BYPASS_AI_CAL_NEG_MASK | \ 82662306a36Sopenharmony_ci NI_M_CFG_BYPASS_AI_MODE_MUX_MASK | \ 82762306a36Sopenharmony_ci NI_M_CFG_BYPASS_AO_CAL_MASK) 82862306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_BANK(x) (((x) & 0xf) << 3) 82962306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_BANK_MASK NI_M_CFG_BYPASS_AI_BANK(0xf) 83062306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CHAN(x) (((x) & 0x7) << 0) 83162306a36Sopenharmony_ci#define NI_M_CFG_BYPASS_AI_CHAN_MASK NI_M_CFG_BYPASS_AI_CHAN(7) 83262306a36Sopenharmony_ci#define NI_M_SCXI_DIO_ENA_REG 0x21c 83362306a36Sopenharmony_ci#define NI_M_CDI_FIFO_DATA_REG 0x220 83462306a36Sopenharmony_ci#define NI_M_CDO_FIFO_DATA_REG 0x220 83562306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_REG 0x224 83662306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_OVERFLOW BIT(20) 83762306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_OVERRUN BIT(19) 83862306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_ERROR (NI_M_CDIO_STATUS_CDI_OVERFLOW | \ 83962306a36Sopenharmony_ci NI_M_CDIO_STATUS_CDI_OVERRUN) 84062306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_FIFO_REQ BIT(18) 84162306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_FIFO_FULL BIT(17) 84262306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDI_FIFO_EMPTY BIT(16) 84362306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_UNDERFLOW BIT(4) 84462306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_OVERRUN BIT(3) 84562306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_ERROR (NI_M_CDIO_STATUS_CDO_UNDERFLOW | \ 84662306a36Sopenharmony_ci NI_M_CDIO_STATUS_CDO_OVERRUN) 84762306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_FIFO_REQ BIT(2) 84862306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_FIFO_FULL BIT(1) 84962306a36Sopenharmony_ci#define NI_M_CDIO_STATUS_CDO_FIFO_EMPTY BIT(0) 85062306a36Sopenharmony_ci#define NI_M_CDIO_CMD_REG 0x224 85162306a36Sopenharmony_ci#define NI_M_CDI_CMD_SW_UPDATE BIT(20) 85262306a36Sopenharmony_ci#define NI_M_CDO_CMD_SW_UPDATE BIT(19) 85362306a36Sopenharmony_ci#define NI_M_CDO_CMD_F_E_INT_ENA_CLR BIT(17) 85462306a36Sopenharmony_ci#define NI_M_CDO_CMD_F_E_INT_ENA_SET BIT(16) 85562306a36Sopenharmony_ci#define NI_M_CDI_CMD_ERR_INT_CONFIRM BIT(15) 85662306a36Sopenharmony_ci#define NI_M_CDO_CMD_ERR_INT_CONFIRM BIT(14) 85762306a36Sopenharmony_ci#define NI_M_CDI_CMD_F_REQ_INT_ENA_CLR BIT(13) 85862306a36Sopenharmony_ci#define NI_M_CDI_CMD_F_REQ_INT_ENA_SET BIT(12) 85962306a36Sopenharmony_ci#define NI_M_CDO_CMD_F_REQ_INT_ENA_CLR BIT(11) 86062306a36Sopenharmony_ci#define NI_M_CDO_CMD_F_REQ_INT_ENA_SET BIT(10) 86162306a36Sopenharmony_ci#define NI_M_CDI_CMD_ERR_INT_ENA_CLR BIT(9) 86262306a36Sopenharmony_ci#define NI_M_CDI_CMD_ERR_INT_ENA_SET BIT(8) 86362306a36Sopenharmony_ci#define NI_M_CDO_CMD_ERR_INT_ENA_CLR BIT(7) 86462306a36Sopenharmony_ci#define NI_M_CDO_CMD_ERR_INT_ENA_SET BIT(6) 86562306a36Sopenharmony_ci#define NI_M_CDI_CMD_RESET BIT(5) 86662306a36Sopenharmony_ci#define NI_M_CDO_CMD_RESET BIT(4) 86762306a36Sopenharmony_ci#define NI_M_CDI_CMD_ARM BIT(3) 86862306a36Sopenharmony_ci#define NI_M_CDI_CMD_DISARM BIT(2) 86962306a36Sopenharmony_ci#define NI_M_CDO_CMD_ARM BIT(1) 87062306a36Sopenharmony_ci#define NI_M_CDO_CMD_DISARM BIT(0) 87162306a36Sopenharmony_ci#define NI_M_CDI_MODE_REG 0x228 87262306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE(x) (((x) & 0x3) << 12) 87362306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_MASK NI_M_CDI_MODE_DATA_LANE(3) 87462306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_0_15 NI_M_CDI_MODE_DATA_LANE(0) 87562306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_16_31 NI_M_CDI_MODE_DATA_LANE(1) 87662306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_0_7 NI_M_CDI_MODE_DATA_LANE(0) 87762306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_8_15 NI_M_CDI_MODE_DATA_LANE(1) 87862306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_16_23 NI_M_CDI_MODE_DATA_LANE(2) 87962306a36Sopenharmony_ci#define NI_M_CDI_MODE_DATA_LANE_24_31 NI_M_CDI_MODE_DATA_LANE(3) 88062306a36Sopenharmony_ci#define NI_M_CDI_MODE_FIFO_MODE BIT(11) 88162306a36Sopenharmony_ci#define NI_M_CDI_MODE_POLARITY BIT(10) 88262306a36Sopenharmony_ci#define NI_M_CDI_MODE_HALT_ON_ERROR BIT(9) 88362306a36Sopenharmony_ci#define NI_M_CDI_MODE_SAMPLE_SRC(x) (((x) & 0x3f) << 0) 88462306a36Sopenharmony_ci#define NI_M_CDI_MODE_SAMPLE_SRC_MASK NI_M_CDI_MODE_SAMPLE_SRC(0x3f) 88562306a36Sopenharmony_ci#define NI_M_CDO_MODE_REG 0x22c 88662306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE(x) (((x) & 0x3) << 12) 88762306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_MASK NI_M_CDO_MODE_DATA_LANE(3) 88862306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_0_15 NI_M_CDO_MODE_DATA_LANE(0) 88962306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_16_31 NI_M_CDO_MODE_DATA_LANE(1) 89062306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_0_7 NI_M_CDO_MODE_DATA_LANE(0) 89162306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_8_15 NI_M_CDO_MODE_DATA_LANE(1) 89262306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_16_23 NI_M_CDO_MODE_DATA_LANE(2) 89362306a36Sopenharmony_ci#define NI_M_CDO_MODE_DATA_LANE_24_31 NI_M_CDO_MODE_DATA_LANE(3) 89462306a36Sopenharmony_ci#define NI_M_CDO_MODE_FIFO_MODE BIT(11) 89562306a36Sopenharmony_ci#define NI_M_CDO_MODE_POLARITY BIT(10) 89662306a36Sopenharmony_ci#define NI_M_CDO_MODE_HALT_ON_ERROR BIT(9) 89762306a36Sopenharmony_ci#define NI_M_CDO_MODE_RETRANSMIT BIT(8) 89862306a36Sopenharmony_ci#define NI_M_CDO_MODE_SAMPLE_SRC(x) (((x) & 0x3f) << 0) 89962306a36Sopenharmony_ci#define NI_M_CDO_MODE_SAMPLE_SRC_MASK NI_M_CDO_MODE_SAMPLE_SRC(0x3f) 90062306a36Sopenharmony_ci#define NI_M_CDI_MASK_ENA_REG 0x230 90162306a36Sopenharmony_ci#define NI_M_CDO_MASK_ENA_REG 0x234 90262306a36Sopenharmony_ci#define NI_M_STATIC_AI_CTRL_REG(x) ((x) ? (0x260 + (x)) : 0x064) 90362306a36Sopenharmony_ci#define NI_M_AO_REF_ATTENUATION_REG(x) (0x264 + (x)) 90462306a36Sopenharmony_ci#define NI_M_AO_REF_ATTENUATION_X5 BIT(0) 90562306a36Sopenharmony_ci 90662306a36Sopenharmony_cienum { 90762306a36Sopenharmony_ci ai_gain_16 = 0, 90862306a36Sopenharmony_ci ai_gain_8, 90962306a36Sopenharmony_ci ai_gain_14, 91062306a36Sopenharmony_ci ai_gain_4, 91162306a36Sopenharmony_ci ai_gain_611x, 91262306a36Sopenharmony_ci ai_gain_622x, 91362306a36Sopenharmony_ci ai_gain_628x, 91462306a36Sopenharmony_ci ai_gain_6143 91562306a36Sopenharmony_ci}; 91662306a36Sopenharmony_ci 91762306a36Sopenharmony_cienum caldac_enum { 91862306a36Sopenharmony_ci caldac_none = 0, 91962306a36Sopenharmony_ci mb88341, 92062306a36Sopenharmony_ci dac8800, 92162306a36Sopenharmony_ci dac8043, 92262306a36Sopenharmony_ci ad8522, 92362306a36Sopenharmony_ci ad8804, 92462306a36Sopenharmony_ci ad8842, 92562306a36Sopenharmony_ci ad8804_debug 92662306a36Sopenharmony_ci}; 92762306a36Sopenharmony_ci 92862306a36Sopenharmony_cienum ni_reg_type { 92962306a36Sopenharmony_ci ni_reg_normal = 0x0, 93062306a36Sopenharmony_ci ni_reg_611x = 0x1, 93162306a36Sopenharmony_ci ni_reg_6711 = 0x2, 93262306a36Sopenharmony_ci ni_reg_6713 = 0x4, 93362306a36Sopenharmony_ci ni_reg_67xx_mask = 0x6, 93462306a36Sopenharmony_ci ni_reg_6xxx_mask = 0x7, 93562306a36Sopenharmony_ci ni_reg_622x = 0x8, 93662306a36Sopenharmony_ci ni_reg_625x = 0x10, 93762306a36Sopenharmony_ci ni_reg_628x = 0x18, 93862306a36Sopenharmony_ci ni_reg_m_series_mask = 0x18, 93962306a36Sopenharmony_ci ni_reg_6143 = 0x20 94062306a36Sopenharmony_ci}; 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_cistruct ni_board_struct { 94362306a36Sopenharmony_ci const char *name; 94462306a36Sopenharmony_ci const char *alt_route_name; 94562306a36Sopenharmony_ci int device_id; 94662306a36Sopenharmony_ci int isapnp_id; 94762306a36Sopenharmony_ci 94862306a36Sopenharmony_ci int n_adchan; 94962306a36Sopenharmony_ci unsigned int ai_maxdata; 95062306a36Sopenharmony_ci 95162306a36Sopenharmony_ci int ai_fifo_depth; 95262306a36Sopenharmony_ci unsigned int alwaysdither:1; 95362306a36Sopenharmony_ci int gainlkup; 95462306a36Sopenharmony_ci int ai_speed; 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci int n_aochan; 95762306a36Sopenharmony_ci unsigned int ao_maxdata; 95862306a36Sopenharmony_ci int ao_fifo_depth; 95962306a36Sopenharmony_ci const struct comedi_lrange *ao_range_table; 96062306a36Sopenharmony_ci unsigned int ao_speed; 96162306a36Sopenharmony_ci 96262306a36Sopenharmony_ci int reg_type; 96362306a36Sopenharmony_ci unsigned int has_8255:1; 96462306a36Sopenharmony_ci unsigned int has_32dio_chan:1; 96562306a36Sopenharmony_ci unsigned int dio_speed; /* not for e-series */ 96662306a36Sopenharmony_ci 96762306a36Sopenharmony_ci enum caldac_enum caldac[3]; 96862306a36Sopenharmony_ci}; 96962306a36Sopenharmony_ci 97062306a36Sopenharmony_ci#define MAX_N_CALDACS 34 97162306a36Sopenharmony_ci#define MAX_N_AO_CHAN 8 97262306a36Sopenharmony_ci#define NUM_GPCT 2 97362306a36Sopenharmony_ci 97462306a36Sopenharmony_ci#define NUM_PFI_OUTPUT_SELECT_REGS 6 97562306a36Sopenharmony_ci#define NUM_RTSI_SHARED_MUXS (NI_RTSI_BRD(-1) - NI_RTSI_BRD(0) + 1) 97662306a36Sopenharmony_ci 97762306a36Sopenharmony_ci#define M_SERIES_EEPROM_SIZE 1024 97862306a36Sopenharmony_ci 97962306a36Sopenharmony_cistruct ni_private { 98062306a36Sopenharmony_ci unsigned short dio_output; 98162306a36Sopenharmony_ci unsigned short dio_control; 98262306a36Sopenharmony_ci int aimode; 98362306a36Sopenharmony_ci unsigned int ai_calib_source; 98462306a36Sopenharmony_ci unsigned int ai_calib_source_enabled; 98562306a36Sopenharmony_ci /* protects access to windowed registers */ 98662306a36Sopenharmony_ci spinlock_t window_lock; 98762306a36Sopenharmony_ci /* protects interrupt/dma register access */ 98862306a36Sopenharmony_ci spinlock_t soft_reg_copy_lock; 98962306a36Sopenharmony_ci /* protects mite DMA channel request/release */ 99062306a36Sopenharmony_ci spinlock_t mite_channel_lock; 99162306a36Sopenharmony_ci 99262306a36Sopenharmony_ci int changain_state; 99362306a36Sopenharmony_ci unsigned int changain_spec; 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_ci unsigned int caldac_maxdata_list[MAX_N_CALDACS]; 99662306a36Sopenharmony_ci unsigned short caldacs[MAX_N_CALDACS]; 99762306a36Sopenharmony_ci 99862306a36Sopenharmony_ci unsigned short ai_cmd2; 99962306a36Sopenharmony_ci 100062306a36Sopenharmony_ci unsigned short ao_conf[MAX_N_AO_CHAN]; 100162306a36Sopenharmony_ci unsigned short ao_mode1; 100262306a36Sopenharmony_ci unsigned short ao_mode2; 100362306a36Sopenharmony_ci unsigned short ao_mode3; 100462306a36Sopenharmony_ci unsigned short ao_cmd1; 100562306a36Sopenharmony_ci unsigned short ao_cmd2; 100662306a36Sopenharmony_ci 100762306a36Sopenharmony_ci struct ni_gpct_device *counter_dev; 100862306a36Sopenharmony_ci unsigned short an_trig_etc_reg; 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci unsigned int ai_offset[512]; 101162306a36Sopenharmony_ci 101262306a36Sopenharmony_ci unsigned long serial_interval_ns; 101362306a36Sopenharmony_ci unsigned char serial_hw_mode; 101462306a36Sopenharmony_ci unsigned short clock_and_fout; 101562306a36Sopenharmony_ci unsigned short clock_and_fout2; 101662306a36Sopenharmony_ci 101762306a36Sopenharmony_ci unsigned short int_a_enable_reg; 101862306a36Sopenharmony_ci unsigned short int_b_enable_reg; 101962306a36Sopenharmony_ci unsigned short io_bidirection_pin_reg; 102062306a36Sopenharmony_ci unsigned short rtsi_trig_direction_reg; 102162306a36Sopenharmony_ci unsigned short rtsi_trig_a_output_reg; 102262306a36Sopenharmony_ci unsigned short rtsi_trig_b_output_reg; 102362306a36Sopenharmony_ci unsigned short pfi_output_select_reg[NUM_PFI_OUTPUT_SELECT_REGS]; 102462306a36Sopenharmony_ci unsigned short ai_ao_select_reg; 102562306a36Sopenharmony_ci unsigned short g0_g1_select_reg; 102662306a36Sopenharmony_ci unsigned short cdio_dma_select_reg; 102762306a36Sopenharmony_ci 102862306a36Sopenharmony_ci unsigned int clock_ns; 102962306a36Sopenharmony_ci unsigned int clock_source; 103062306a36Sopenharmony_ci 103162306a36Sopenharmony_ci unsigned short pwm_up_count; 103262306a36Sopenharmony_ci unsigned short pwm_down_count; 103362306a36Sopenharmony_ci 103462306a36Sopenharmony_ci unsigned short ai_fifo_buffer[0x2000]; 103562306a36Sopenharmony_ci u8 eeprom_buffer[M_SERIES_EEPROM_SIZE]; 103662306a36Sopenharmony_ci 103762306a36Sopenharmony_ci struct mite *mite; 103862306a36Sopenharmony_ci struct mite_channel *ai_mite_chan; 103962306a36Sopenharmony_ci struct mite_channel *ao_mite_chan; 104062306a36Sopenharmony_ci struct mite_channel *cdo_mite_chan; 104162306a36Sopenharmony_ci struct mite_ring *ai_mite_ring; 104262306a36Sopenharmony_ci struct mite_ring *ao_mite_ring; 104362306a36Sopenharmony_ci struct mite_ring *cdo_mite_ring; 104462306a36Sopenharmony_ci struct mite_ring *gpct_mite_ring[NUM_GPCT]; 104562306a36Sopenharmony_ci 104662306a36Sopenharmony_ci /* ni_pcimio board type flags (based on the boardinfo reg_type) */ 104762306a36Sopenharmony_ci unsigned int is_m_series:1; 104862306a36Sopenharmony_ci unsigned int is_6xxx:1; 104962306a36Sopenharmony_ci unsigned int is_611x:1; 105062306a36Sopenharmony_ci unsigned int is_6143:1; 105162306a36Sopenharmony_ci unsigned int is_622x:1; 105262306a36Sopenharmony_ci unsigned int is_625x:1; 105362306a36Sopenharmony_ci unsigned int is_628x:1; 105462306a36Sopenharmony_ci unsigned int is_67xx:1; 105562306a36Sopenharmony_ci unsigned int is_6711:1; 105662306a36Sopenharmony_ci unsigned int is_6713:1; 105762306a36Sopenharmony_ci 105862306a36Sopenharmony_ci /* 105962306a36Sopenharmony_ci * Boolean value of whether device needs to be armed. 106062306a36Sopenharmony_ci * 106162306a36Sopenharmony_ci * Currently, only NI AO devices are known to be needing arming, since 106262306a36Sopenharmony_ci * the DAC registers must be preloaded before triggering. 106362306a36Sopenharmony_ci * This variable should only be set true during a command operation 106462306a36Sopenharmony_ci * (e.g ni_ao_cmd) and should then be set false by the arming 106562306a36Sopenharmony_ci * function (e.g. ni_ao_arm). 106662306a36Sopenharmony_ci * 106762306a36Sopenharmony_ci * This variable helps to ensure that multiple DMA allocations are not 106862306a36Sopenharmony_ci * possible. 106962306a36Sopenharmony_ci */ 107062306a36Sopenharmony_ci unsigned int ao_needs_arming:1; 107162306a36Sopenharmony_ci 107262306a36Sopenharmony_ci /* device signal route tables */ 107362306a36Sopenharmony_ci struct ni_route_tables routing_tables; 107462306a36Sopenharmony_ci 107562306a36Sopenharmony_ci /* 107662306a36Sopenharmony_ci * Number of clients (RTSI lines) for current RTSI MUX source. 107762306a36Sopenharmony_ci * 107862306a36Sopenharmony_ci * This allows resource management of RTSI board/shared mux lines by 107962306a36Sopenharmony_ci * marking the RTSI line that is using a particular MUX. Currently, 108062306a36Sopenharmony_ci * these lines are only automatically allocated based on source of the 108162306a36Sopenharmony_ci * route requested. Furthermore, the only way that this auto-allocation 108262306a36Sopenharmony_ci * and configuration works is via the globally-named ni signal/terminal 108362306a36Sopenharmony_ci * names. 108462306a36Sopenharmony_ci */ 108562306a36Sopenharmony_ci u8 rtsi_shared_mux_usage[NUM_RTSI_SHARED_MUXS]; 108662306a36Sopenharmony_ci 108762306a36Sopenharmony_ci /* 108862306a36Sopenharmony_ci * softcopy register for rtsi shared mux/board lines. 108962306a36Sopenharmony_ci * For e-series, the bit layout of this register is 109062306a36Sopenharmony_ci * (docs: mhddk/nieseries/ChipObjects/tSTC.{h,ipp}, 109162306a36Sopenharmony_ci * DAQ-STC, Jan 1999, 340934B-01): 109262306a36Sopenharmony_ci * bits 0:2 -- NI_RTSI_BRD(0) source selection 109362306a36Sopenharmony_ci * bits 3:5 -- NI_RTSI_BRD(1) source selection 109462306a36Sopenharmony_ci * bits 6:8 -- NI_RTSI_BRD(2) source selection 109562306a36Sopenharmony_ci * bits 9:11 -- NI_RTSI_BRD(3) source selection 109662306a36Sopenharmony_ci * bit 12 -- NI_RTSI_BRD(0) direction, 0:input, 1:output 109762306a36Sopenharmony_ci * bit 13 -- NI_RTSI_BRD(1) direction, 0:input, 1:output 109862306a36Sopenharmony_ci * bit 14 -- NI_RTSI_BRD(2) direction, 0:input, 1:output 109962306a36Sopenharmony_ci * bit 15 -- NI_RTSI_BRD(3) direction, 0:input, 1:output 110062306a36Sopenharmony_ci * According to DAQ-STC: 110162306a36Sopenharmony_ci * RTSI Board Interface--Configured as an input, each bidirectional 110262306a36Sopenharmony_ci * RTSI_BRD pin can drive any of the seven RTSI_TRIGGER pins. 110362306a36Sopenharmony_ci * RTSI_BRD<0..1> can also be driven by AI STOP and RTSI_BRD<2..3> 110462306a36Sopenharmony_ci * can also be driven by the AI START and SCAN_IN_PROG signals. 110562306a36Sopenharmony_ci * These pins provide a mechanism for additional board-level signals 110662306a36Sopenharmony_ci * to be sent on or received from the RTSI bus. 110762306a36Sopenharmony_ci * Couple of comments: 110862306a36Sopenharmony_ci * - Neither the DAQ-STC nor the MHDDK is clear on what the direction 110962306a36Sopenharmony_ci * of the RTSI_BRD pins actually means. There does not appear to be 111062306a36Sopenharmony_ci * any clear indication on what "output" would mean, since the point 111162306a36Sopenharmony_ci * of the RTSI_BRD lines is to always drive one of the 111262306a36Sopenharmony_ci * RTSI_TRIGGER<0..6> lines. 111362306a36Sopenharmony_ci * - The DAQ-STC also indicates that the NI_RTSI_BRD lines can be 111462306a36Sopenharmony_ci * driven by any of the RTSI_TRIGGER<0..6> lines. 111562306a36Sopenharmony_ci * But, looking at valid device routes, as visually imported from 111662306a36Sopenharmony_ci * NI-MAX, there appears to be only one family (so far) that has the 111762306a36Sopenharmony_ci * ability to route a signal from one TRIGGER_LINE to another 111862306a36Sopenharmony_ci * TRIGGER_LINE: the 653x family of DIO devices. 111962306a36Sopenharmony_ci * 112062306a36Sopenharmony_ci * For m-series, the bit layout of this register is 112162306a36Sopenharmony_ci * (docs: mhddk/nimseries/ChipObjects/tMSeries.{h,ipp}): 112262306a36Sopenharmony_ci * bits 0:3 -- NI_RTSI_BRD(0) source selection 112362306a36Sopenharmony_ci * bits 4:7 -- NI_RTSI_BRD(1) source selection 112462306a36Sopenharmony_ci * bits 8:11 -- NI_RTSI_BRD(2) source selection 112562306a36Sopenharmony_ci * bits 12:15 -- NI_RTSI_BRD(3) source selection 112662306a36Sopenharmony_ci * Note: The m-series does not have any option to change direction of 112762306a36Sopenharmony_ci * NI_RTSI_BRD muxes. Furthermore, there are no register values that 112862306a36Sopenharmony_ci * indicate the ability to have TRIGGER_LINES driving the output of 112962306a36Sopenharmony_ci * the NI_RTSI_BRD muxes. 113062306a36Sopenharmony_ci */ 113162306a36Sopenharmony_ci u16 rtsi_shared_mux_reg; 113262306a36Sopenharmony_ci 113362306a36Sopenharmony_ci /* 113462306a36Sopenharmony_ci * Number of clients (RTSI lines) for current RGOUT0 path. 113562306a36Sopenharmony_ci * Stored in part of in RTSI_TRIG_DIR or RTSI_TRIGB registers 113662306a36Sopenharmony_ci */ 113762306a36Sopenharmony_ci u8 rgout0_usage; 113862306a36Sopenharmony_ci}; 113962306a36Sopenharmony_ci 114062306a36Sopenharmony_cistatic const struct comedi_lrange range_ni_E_ao_ext; 114162306a36Sopenharmony_ci 114262306a36Sopenharmony_ci#endif /* _COMEDI_NI_STC_H */ 1143