/* SPDX-License-Identifier: GPL-2.0+ */ /* * comedi/drivers/s626.h * Sensoray s626 Comedi driver, header file * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 2000 David A. Schleef <ds@schleef.org> * * Based on Sensoray Model 626 Linux driver Version 0.2 * Copyright (C) 2002-2004 Sensoray Co., Inc.
*/
#ifndef S626_H_INCLUDED #define S626_H_INCLUDED
#define S626_DMABUF_SIZE 4096 /* 4k pages */
#define S626_ADC_CHANNELS 16 #define S626_DAC_CHANNELS 4 #define S626_ENCODER_CHANNELS 6 #define S626_DIO_CHANNELS 48 #define S626_DIO_BANKS 3 /* Number of DIO groups. */ #define S626_DIO_EXTCHANS 40 /* * Number of extended-capability * DIO channels.
*/
#define S626_NUM_TRIMDACS 12 /* Number of valid TrimDAC channels. */
/* PCI bus interface types. */ #define S626_INTEL 1 /* Intel bus type. */ #define S626_MOTOROLA 2 /* Motorola bus type. */
#define S626_PLATFORM S626_INTEL /* *** SELECT PLATFORM TYPE *** */
#define S626_RANGE_5V 0x10 /* +/-5V range */ #define S626_RANGE_10V 0x00 /* +/-10V range */
#define S626_EOPL 0x80 /* End of ADC poll list marker. */ #define S626_GSEL_BIPOLAR5V 0x00F0 /* S626_LP_GSEL setting 5V bipolar. */ #define S626_GSEL_BIPOLAR10V 0x00A0 /* S626_LP_GSEL setting 10V bipolar. */
/* Error codes that must be visible to this base class. */ #define S626_ERR_ILLEGAL_PARM 0x00010000 /* * Illegal function parameter * value was specified.
*/ #define S626_ERR_I2C 0x00020000 /* I2C error. */ #define S626_ERR_COUNTERSETUP 0x00200000 /* * Illegal setup specified for * counter channel.
*/ #define S626_ERR_DEBI_TIMEOUT 0x00400000 /* DEBI transfer timed out. */
/* * Organization (physical order) and size (in DWORDs) of logical DMA buffers * contained by ANA_DMABUF.
*/ #define S626_ADC_DMABUF_DWORDS 40 /* * ADC DMA buffer must hold 16 samples, * plus pre/post garbage samples.
*/ #define S626_DAC_WDMABUF_DWORDS 1 /* * DAC output DMA buffer holds a single * sample.
*/
/* All remaining space in 4KB DMA buffer is available for the RPS1 program. */
/* Address offsets, in DWORDS, from base of DMA buffer. */ #define S626_DAC_WDMABUF_OS S626_ADC_DMABUF_DWORDS
/* Interrupt enable bit in ISR and IER. */ #define S626_IRQ_GPIO3 0x00000040 /* IRQ enable for GPIO3. */ #define S626_IRQ_RPS1 0x10000000 #define S626_ISR_AFOU 0x00000800 /* Audio fifo under/overflow detected. */
/* RPS clock parameters. */ #define S626_RPSCLK_SCALAR 8 /* * This is apparent ratio of * PCI/RPS clks (undocumented!!).
*/ #define S626_RPSCLK_PER_US (33 / S626_RPSCLK_SCALAR) /* * Number of RPS clocks in one * microsecond.
*/
/* Event counter source addresses. */ #define S626_SBA_RPS_A0 0x27 /* Time of RPS0 busy, in PCI clocks. */
/* GPIO constants. */ #define S626_GPIO_BASE 0x10004000 /* * GPIO 0,2,3 = inputs, * GPIO3 = IRQ; GPIO1 = out.
*/ #define S626_GPIO1_LO 0x00000000 /* GPIO1 set to LOW. */ #define S626_GPIO1_HI 0x00001000 /* GPIO1 set to HIGH. */
/* Bit masks for MISC1 register that are the same for reads and writes. */ #define S626_MISC1_WENABLE 0x8000 /* * enab writes to MISC2 (except Clear * Watchdog bit).
*/ #define S626_MISC1_WDISABLE 0x0000 /* Disable writes to MISC2. */ #define S626_MISC1_EDCAP 0x1000 /* * Enable edge capture on DIO chans * specified by S626_LP_WRCAPSELx.
*/ #define S626_MISC1_NOEDCAP 0x0000 /* * Disable edge capture on specified * DIO chans.
*/
/* Bit masks for MISC1 register reads. */ #define S626_RDMISC1_WDTIMEOUT 0x4000 /* Watchdog timer timed out. */
/* Bit masks for MISC2 register writes. */ #define S626_WRMISC2_WDCLEAR 0x8000 /* Reset watchdog timer to zero. */ #define S626_WRMISC2_CHARGE_ENABLE 0x4000 /* Enable battery trickle charging. */
/* Bit masks for MISC2 register that are the same for reads and writes. */ #define S626_MISC2_BATT_ENABLE 0x0008 /* Backup battery enable. */ #define S626_MISC2_WDENABLE 0x0004 /* Watchdog timer enable. */ #define S626_MISC2_WDPERIOD_MASK 0x0003 /* Watchdog interval select mask. */
/* Bit masks for ACON1 register. */ #define S626_A2_RUN 0x40000000 /* Run A2 based on TSL2. */ #define S626_A1_RUN 0x20000000 /* Run A1 based on TSL1. */ #define S626_A1_SWAP 0x00200000 /* Use big-endian for A1. */ #define S626_A2_SWAP 0x00100000 /* Use big-endian for A2. */ #define S626_WS_MODES 0x00019999 /* * WS0 = TSL1 trigger input, * WS1-WS4 = CS* outputs.
*/
#if (S626_PLATFORM == S626_INTEL) /* * Base ACON1 config: always run * A1 based on TSL1.
*/ #define S626_ACON1_BASE (S626_WS_MODES | S626_A1_RUN) #elif S626_PLATFORM == S626_MOTOROLA #define S626_ACON1_BASE \
(S626_WS_MODES | S626_A1_RUN | S626_A1_SWAP | S626_A2_SWAP) #endif
#define S626_ACON1_ADCSTART S626_ACON1_BASE /* * Start ADC: run A1 * based on TSL1.
*/ #define S626_ACON1_DACSTART (S626_ACON1_BASE | S626_A2_RUN) /* Start transmit to DAC: run A2 based on TSL2. */ #define S626_ACON1_DACSTOP S626_ACON1_BASE /* Halt A2. */
/* Bit masks for timeslot records. */ #define S626_WS1 0x40000000 /* WS output to assert. */ #define S626_WS2 0x20000000 #define S626_WS3 0x10000000 #define S626_WS4 0x08000000 #define S626_RSD1 0x01000000 /* Shift A1 data in on SD1. */ #define S626_SDW_A1 0x00800000 /* * Store rcv'd char at next char * slot of DWORD1 buffer.
*/ #define S626_SIB_A1 0x00400000 /* * Store rcv'd char at next * char slot of FB1 buffer.
*/ #define S626_SF_A1 0x00200000 /* * Write unsigned long * buffer to input FIFO.
*/
/* Select parallel-to-serial converter's data source: */ #define S626_XFIFO_0 0x00000000 /* Data fifo byte 0. */ #define S626_XFIFO_1 0x00000010 /* Data fifo byte 1. */ #define S626_XFIFO_2 0x00000020 /* Data fifo byte 2. */ #define S626_XFIFO_3 0x00000030 /* Data fifo byte 3. */ #define S626_XFB0 0x00000040 /* FB_BUFFER byte 0. */ #define S626_XFB1 0x00000050 /* FB_BUFFER byte 1. */ #define S626_XFB2 0x00000060 /* FB_BUFFER byte 2. */ #define S626_XFB3 0x00000070 /* FB_BUFFER byte 3. */ #define S626_SIB_A2 0x00000200 /* * Store next dword from A2's * input shifter to FB2 * buffer.
*/ #define S626_SF_A2 0x00000100 /* * Store next dword from A2's * input shifter to its input * fifo.
*/ #define S626_LF_A2 0x00000080 /* * Load next dword from A2's * output fifo into its * output dword buffer.
*/ #define S626_XSD2 0x00000008 /* Shift data out on SD2. */ #define S626_RSD3 0x00001800 /* Shift data in on SD3. */ #define S626_RSD2 0x00001000 /* Shift data in on SD2. */ #define S626_LOW_A2 0x00000002 /* * Drive last SD low for 7 clks, * then tri-state.
*/ #define S626_EOS 0x00000001 /* End of superframe. */
/* I2C configuration constants. */ #define S626_I2C_CLKSEL 0x0400 /* * I2C bit rate = * PCIclk/480 = 68.75 KHz.
*/ #define S626_I2C_BITRATE 68.75 /* * I2C bus data bit rate * (determined by * S626_I2C_CLKSEL) in KHz.
*/ #define S626_I2C_WRTIME 15.0 /* * Worst case time, in msec, * for EEPROM internal write * op.
*/
/* 4-bit field that specifies DEBI timeout value in PCI clock cycles: */ #define S626_DEBI_CFG_TOUT_BIT 22 /* * Finish DEBI cycle after this many * clocks.
*/
/* 2-bit field that specifies Endian byte lane steering: */ #define S626_DEBI_CFG_SWAP_NONE 0x00000000 /* * Straight - don't swap any * bytes (Intel).
*/ #define S626_DEBI_CFG_SWAP_2 0x00100000 /* 2-byte swap (Motorola). */ #define S626_DEBI_CFG_SWAP_4 0x00200000 /* 4-byte swap. */ #define S626_DEBI_CFG_SLAVE16 0x00080000 /* * Slave is able to serve * 16-bit cycles.
*/ #define S626_DEBI_CFG_INC 0x00040000 /* * Enable address increment * for block transfers.
*/ #define S626_DEBI_CFG_INTEL 0x00020000 /* Intel style local bus. */ #define S626_DEBI_CFG_TIMEROFF 0x00010000 /* Disable timer. */
/* ******* EXTRA FROM OTHER SENSORAY * .h ******* */
/* LoadSrc values: */ #define S626_LOADSRC_INDX 0 /* Preload core in response to Index. */ #define S626_LOADSRC_OVER 1 /* * Preload core in response to * Overflow.
*/ #define S626_LOADSRCB_OVERA 2 /* * Preload B core in response to * A Overflow.
*/ #define S626_LOADSRC_NONE 3 /* Never preload core. */
/* IntSrc values: */ #define S626_INTSRC_NONE 0 /* Interrupts disabled. */ #define S626_INTSRC_OVER 1 /* Interrupt on Overflow. */ #define S626_INTSRC_INDX 2 /* Interrupt on Index. */ #define S626_INTSRC_BOTH 3 /* Interrupt on Index or Overflow. */
/* LatchSrc values: */ #define S626_LATCHSRC_AB_READ 0 /* Latch on read. */ #define S626_LATCHSRC_A_INDXA 1 /* Latch A on A Index. */ #define S626_LATCHSRC_B_INDXB 2 /* Latch B on B Index. */ #define S626_LATCHSRC_B_OVERA 3 /* Latch B on A Overflow. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.