162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * comedi/drivers/s626.h 462306a36Sopenharmony_ci * Sensoray s626 Comedi driver, header file 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * COMEDI - Linux Control and Measurement Device Interface 762306a36Sopenharmony_ci * Copyright (C) 2000 David A. Schleef <ds@schleef.org> 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Based on Sensoray Model 626 Linux driver Version 0.2 1062306a36Sopenharmony_ci * Copyright (C) 2002-2004 Sensoray Co., Inc. 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef S626_H_INCLUDED 1462306a36Sopenharmony_ci#define S626_H_INCLUDED 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define S626_DMABUF_SIZE 4096 /* 4k pages */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define S626_ADC_CHANNELS 16 1962306a36Sopenharmony_ci#define S626_DAC_CHANNELS 4 2062306a36Sopenharmony_ci#define S626_ENCODER_CHANNELS 6 2162306a36Sopenharmony_ci#define S626_DIO_CHANNELS 48 2262306a36Sopenharmony_ci#define S626_DIO_BANKS 3 /* Number of DIO groups. */ 2362306a36Sopenharmony_ci#define S626_DIO_EXTCHANS 40 /* 2462306a36Sopenharmony_ci * Number of extended-capability 2562306a36Sopenharmony_ci * DIO channels. 2662306a36Sopenharmony_ci */ 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define S626_NUM_TRIMDACS 12 /* Number of valid TrimDAC channels. */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* PCI bus interface types. */ 3162306a36Sopenharmony_ci#define S626_INTEL 1 /* Intel bus type. */ 3262306a36Sopenharmony_ci#define S626_MOTOROLA 2 /* Motorola bus type. */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define S626_PLATFORM S626_INTEL /* *** SELECT PLATFORM TYPE *** */ 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define S626_RANGE_5V 0x10 /* +/-5V range */ 3762306a36Sopenharmony_ci#define S626_RANGE_10V 0x00 /* +/-10V range */ 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define S626_EOPL 0x80 /* End of ADC poll list marker. */ 4062306a36Sopenharmony_ci#define S626_GSEL_BIPOLAR5V 0x00F0 /* S626_LP_GSEL setting 5V bipolar. */ 4162306a36Sopenharmony_ci#define S626_GSEL_BIPOLAR10V 0x00A0 /* S626_LP_GSEL setting 10V bipolar. */ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* Error codes that must be visible to this base class. */ 4462306a36Sopenharmony_ci#define S626_ERR_ILLEGAL_PARM 0x00010000 /* 4562306a36Sopenharmony_ci * Illegal function parameter 4662306a36Sopenharmony_ci * value was specified. 4762306a36Sopenharmony_ci */ 4862306a36Sopenharmony_ci#define S626_ERR_I2C 0x00020000 /* I2C error. */ 4962306a36Sopenharmony_ci#define S626_ERR_COUNTERSETUP 0x00200000 /* 5062306a36Sopenharmony_ci * Illegal setup specified for 5162306a36Sopenharmony_ci * counter channel. 5262306a36Sopenharmony_ci */ 5362306a36Sopenharmony_ci#define S626_ERR_DEBI_TIMEOUT 0x00400000 /* DEBI transfer timed out. */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* 5662306a36Sopenharmony_ci * Organization (physical order) and size (in DWORDs) of logical DMA buffers 5762306a36Sopenharmony_ci * contained by ANA_DMABUF. 5862306a36Sopenharmony_ci */ 5962306a36Sopenharmony_ci#define S626_ADC_DMABUF_DWORDS 40 /* 6062306a36Sopenharmony_ci * ADC DMA buffer must hold 16 samples, 6162306a36Sopenharmony_ci * plus pre/post garbage samples. 6262306a36Sopenharmony_ci */ 6362306a36Sopenharmony_ci#define S626_DAC_WDMABUF_DWORDS 1 /* 6462306a36Sopenharmony_ci * DAC output DMA buffer holds a single 6562306a36Sopenharmony_ci * sample. 6662306a36Sopenharmony_ci */ 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci/* All remaining space in 4KB DMA buffer is available for the RPS1 program. */ 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci/* Address offsets, in DWORDS, from base of DMA buffer. */ 7162306a36Sopenharmony_ci#define S626_DAC_WDMABUF_OS S626_ADC_DMABUF_DWORDS 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci/* Interrupt enable bit in ISR and IER. */ 7462306a36Sopenharmony_ci#define S626_IRQ_GPIO3 0x00000040 /* IRQ enable for GPIO3. */ 7562306a36Sopenharmony_ci#define S626_IRQ_RPS1 0x10000000 7662306a36Sopenharmony_ci#define S626_ISR_AFOU 0x00000800 7762306a36Sopenharmony_ci/* Audio fifo under/overflow detected. */ 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define S626_IRQ_COINT1A 0x0400 /* counter 1A overflow interrupt mask */ 8062306a36Sopenharmony_ci#define S626_IRQ_COINT1B 0x0800 /* counter 1B overflow interrupt mask */ 8162306a36Sopenharmony_ci#define S626_IRQ_COINT2A 0x1000 /* counter 2A overflow interrupt mask */ 8262306a36Sopenharmony_ci#define S626_IRQ_COINT2B 0x2000 /* counter 2B overflow interrupt mask */ 8362306a36Sopenharmony_ci#define S626_IRQ_COINT3A 0x4000 /* counter 3A overflow interrupt mask */ 8462306a36Sopenharmony_ci#define S626_IRQ_COINT3B 0x8000 /* counter 3B overflow interrupt mask */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* RPS command codes. */ 8762306a36Sopenharmony_ci#define S626_RPS_CLRSIGNAL 0x00000000 /* CLEAR SIGNAL */ 8862306a36Sopenharmony_ci#define S626_RPS_SETSIGNAL 0x10000000 /* SET SIGNAL */ 8962306a36Sopenharmony_ci#define S626_RPS_NOP 0x00000000 /* NOP */ 9062306a36Sopenharmony_ci#define S626_RPS_PAUSE 0x20000000 /* PAUSE */ 9162306a36Sopenharmony_ci#define S626_RPS_UPLOAD 0x40000000 /* UPLOAD */ 9262306a36Sopenharmony_ci#define S626_RPS_JUMP 0x80000000 /* JUMP */ 9362306a36Sopenharmony_ci#define S626_RPS_LDREG 0x90000100 /* LDREG (1 uint32_t only) */ 9462306a36Sopenharmony_ci#define S626_RPS_STREG 0xA0000100 /* STREG (1 uint32_t only) */ 9562306a36Sopenharmony_ci#define S626_RPS_STOP 0x50000000 /* STOP */ 9662306a36Sopenharmony_ci#define S626_RPS_IRQ 0x60000000 /* IRQ */ 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#define S626_RPS_LOGICAL_OR 0x08000000 /* Logical OR conditionals. */ 9962306a36Sopenharmony_ci#define S626_RPS_INVERT 0x04000000 /* 10062306a36Sopenharmony_ci * Test for negated 10162306a36Sopenharmony_ci * semaphores. 10262306a36Sopenharmony_ci */ 10362306a36Sopenharmony_ci#define S626_RPS_DEBI 0x00000002 /* DEBI done */ 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define S626_RPS_SIG0 0x00200000 /* 10662306a36Sopenharmony_ci * RPS semaphore 0 10762306a36Sopenharmony_ci * (used by ADC). 10862306a36Sopenharmony_ci */ 10962306a36Sopenharmony_ci#define S626_RPS_SIG1 0x00400000 /* 11062306a36Sopenharmony_ci * RPS semaphore 1 11162306a36Sopenharmony_ci * (used by DAC). 11262306a36Sopenharmony_ci */ 11362306a36Sopenharmony_ci#define S626_RPS_SIG2 0x00800000 /* 11462306a36Sopenharmony_ci * RPS semaphore 2 11562306a36Sopenharmony_ci * (not used). 11662306a36Sopenharmony_ci */ 11762306a36Sopenharmony_ci#define S626_RPS_GPIO2 0x00080000 /* RPS GPIO2 */ 11862306a36Sopenharmony_ci#define S626_RPS_GPIO3 0x00100000 /* RPS GPIO3 */ 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define S626_RPS_SIGADC S626_RPS_SIG0 /* 12162306a36Sopenharmony_ci * Trigger/status for 12262306a36Sopenharmony_ci * ADC's RPS program. 12362306a36Sopenharmony_ci */ 12462306a36Sopenharmony_ci#define S626_RPS_SIGDAC S626_RPS_SIG1 /* 12562306a36Sopenharmony_ci * Trigger/status for 12662306a36Sopenharmony_ci * DAC's RPS program. 12762306a36Sopenharmony_ci */ 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* RPS clock parameters. */ 13062306a36Sopenharmony_ci#define S626_RPSCLK_SCALAR 8 /* 13162306a36Sopenharmony_ci * This is apparent ratio of 13262306a36Sopenharmony_ci * PCI/RPS clks (undocumented!!). 13362306a36Sopenharmony_ci */ 13462306a36Sopenharmony_ci#define S626_RPSCLK_PER_US (33 / S626_RPSCLK_SCALAR) 13562306a36Sopenharmony_ci /* 13662306a36Sopenharmony_ci * Number of RPS clocks in one 13762306a36Sopenharmony_ci * microsecond. 13862306a36Sopenharmony_ci */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/* Event counter source addresses. */ 14162306a36Sopenharmony_ci#define S626_SBA_RPS_A0 0x27 /* Time of RPS0 busy, in PCI clocks. */ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/* GPIO constants. */ 14462306a36Sopenharmony_ci#define S626_GPIO_BASE 0x10004000 /* 14562306a36Sopenharmony_ci * GPIO 0,2,3 = inputs, 14662306a36Sopenharmony_ci * GPIO3 = IRQ; GPIO1 = out. 14762306a36Sopenharmony_ci */ 14862306a36Sopenharmony_ci#define S626_GPIO1_LO 0x00000000 /* GPIO1 set to LOW. */ 14962306a36Sopenharmony_ci#define S626_GPIO1_HI 0x00001000 /* GPIO1 set to HIGH. */ 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci/* Primary Status Register (PSR) constants. */ 15262306a36Sopenharmony_ci#define S626_PSR_DEBI_E 0x00040000 /* DEBI event flag. */ 15362306a36Sopenharmony_ci#define S626_PSR_DEBI_S 0x00080000 /* DEBI status flag. */ 15462306a36Sopenharmony_ci#define S626_PSR_A2_IN 0x00008000 /* 15562306a36Sopenharmony_ci * Audio output DMA2 protection 15662306a36Sopenharmony_ci * address reached. 15762306a36Sopenharmony_ci */ 15862306a36Sopenharmony_ci#define S626_PSR_AFOU 0x00000800 /* 15962306a36Sopenharmony_ci * Audio FIFO under/overflow 16062306a36Sopenharmony_ci * detected. 16162306a36Sopenharmony_ci */ 16262306a36Sopenharmony_ci#define S626_PSR_GPIO2 0x00000020 /* 16362306a36Sopenharmony_ci * GPIO2 input pin: 0=AdcBusy, 16462306a36Sopenharmony_ci * 1=AdcIdle. 16562306a36Sopenharmony_ci */ 16662306a36Sopenharmony_ci#define S626_PSR_EC0S 0x00000001 /* 16762306a36Sopenharmony_ci * Event counter 0 threshold 16862306a36Sopenharmony_ci * reached. 16962306a36Sopenharmony_ci */ 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci/* Secondary Status Register (SSR) constants. */ 17262306a36Sopenharmony_ci#define S626_SSR_AF2_OUT 0x00000200 /* 17362306a36Sopenharmony_ci * Audio 2 output FIFO 17462306a36Sopenharmony_ci * under/overflow detected. 17562306a36Sopenharmony_ci */ 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* Master Control Register 1 (MC1) constants. */ 17862306a36Sopenharmony_ci#define S626_MC1_SOFT_RESET 0x80000000 /* Invoke 7146 soft reset. */ 17962306a36Sopenharmony_ci#define S626_MC1_SHUTDOWN 0x3FFF0000 /* 18062306a36Sopenharmony_ci * Shut down all MC1-controlled 18162306a36Sopenharmony_ci * enables. 18262306a36Sopenharmony_ci */ 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci#define S626_MC1_ERPS1 0x2000 /* Enab/disable RPS task 1. */ 18562306a36Sopenharmony_ci#define S626_MC1_ERPS0 0x1000 /* Enab/disable RPS task 0. */ 18662306a36Sopenharmony_ci#define S626_MC1_DEBI 0x0800 /* Enab/disable DEBI pins. */ 18762306a36Sopenharmony_ci#define S626_MC1_AUDIO 0x0200 /* Enab/disable audio port pins. */ 18862306a36Sopenharmony_ci#define S626_MC1_I2C 0x0100 /* Enab/disable I2C interface. */ 18962306a36Sopenharmony_ci#define S626_MC1_A2OUT 0x0008 /* Enab/disable transfer on A2 out. */ 19062306a36Sopenharmony_ci#define S626_MC1_A2IN 0x0004 /* Enab/disable transfer on A2 in. */ 19162306a36Sopenharmony_ci#define S626_MC1_A1IN 0x0001 /* Enab/disable transfer on A1 in. */ 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci/* Master Control Register 2 (MC2) constants. */ 19462306a36Sopenharmony_ci#define S626_MC2_UPLD_DEBI 0x0002 /* Upload DEBI. */ 19562306a36Sopenharmony_ci#define S626_MC2_UPLD_IIC 0x0001 /* Upload I2C. */ 19662306a36Sopenharmony_ci#define S626_MC2_RPSSIG2 0x2000 /* RPS signal 2 (not used). */ 19762306a36Sopenharmony_ci#define S626_MC2_RPSSIG1 0x1000 /* RPS signal 1 (DAC RPS busy). */ 19862306a36Sopenharmony_ci#define S626_MC2_RPSSIG0 0x0800 /* RPS signal 0 (ADC RPS busy). */ 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#define S626_MC2_ADC_RPS S626_MC2_RPSSIG0 /* ADC RPS busy. */ 20162306a36Sopenharmony_ci#define S626_MC2_DAC_RPS S626_MC2_RPSSIG1 /* DAC RPS busy. */ 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/* PCI BUS (SAA7146) REGISTER ADDRESS OFFSETS */ 20462306a36Sopenharmony_ci#define S626_P_PCI_BT_A 0x004C /* Audio DMA burst/threshold control. */ 20562306a36Sopenharmony_ci#define S626_P_DEBICFG 0x007C /* DEBI configuration. */ 20662306a36Sopenharmony_ci#define S626_P_DEBICMD 0x0080 /* DEBI command. */ 20762306a36Sopenharmony_ci#define S626_P_DEBIPAGE 0x0084 /* DEBI page. */ 20862306a36Sopenharmony_ci#define S626_P_DEBIAD 0x0088 /* DEBI target address. */ 20962306a36Sopenharmony_ci#define S626_P_I2CCTRL 0x008C /* I2C control. */ 21062306a36Sopenharmony_ci#define S626_P_I2CSTAT 0x0090 /* I2C status. */ 21162306a36Sopenharmony_ci#define S626_P_BASEA2_IN 0x00AC /* 21262306a36Sopenharmony_ci * Audio input 2 base physical DMAbuf 21362306a36Sopenharmony_ci * address. 21462306a36Sopenharmony_ci */ 21562306a36Sopenharmony_ci#define S626_P_PROTA2_IN 0x00B0 /* 21662306a36Sopenharmony_ci * Audio input 2 physical DMAbuf 21762306a36Sopenharmony_ci * protection address. 21862306a36Sopenharmony_ci */ 21962306a36Sopenharmony_ci#define S626_P_PAGEA2_IN 0x00B4 /* Audio input 2 paging attributes. */ 22062306a36Sopenharmony_ci#define S626_P_BASEA2_OUT 0x00B8 /* 22162306a36Sopenharmony_ci * Audio output 2 base physical DMAbuf 22262306a36Sopenharmony_ci * address. 22362306a36Sopenharmony_ci */ 22462306a36Sopenharmony_ci#define S626_P_PROTA2_OUT 0x00BC /* 22562306a36Sopenharmony_ci * Audio output 2 physical DMAbuf 22662306a36Sopenharmony_ci * protection address. 22762306a36Sopenharmony_ci */ 22862306a36Sopenharmony_ci#define S626_P_PAGEA2_OUT 0x00C0 /* Audio output 2 paging attributes. */ 22962306a36Sopenharmony_ci#define S626_P_RPSPAGE0 0x00C4 /* RPS0 page. */ 23062306a36Sopenharmony_ci#define S626_P_RPSPAGE1 0x00C8 /* RPS1 page. */ 23162306a36Sopenharmony_ci#define S626_P_RPS0_TOUT 0x00D4 /* RPS0 time-out. */ 23262306a36Sopenharmony_ci#define S626_P_RPS1_TOUT 0x00D8 /* RPS1 time-out. */ 23362306a36Sopenharmony_ci#define S626_P_IER 0x00DC /* Interrupt enable. */ 23462306a36Sopenharmony_ci#define S626_P_GPIO 0x00E0 /* General-purpose I/O. */ 23562306a36Sopenharmony_ci#define S626_P_EC1SSR 0x00E4 /* Event counter set 1 source select. */ 23662306a36Sopenharmony_ci#define S626_P_ECT1R 0x00EC /* Event counter threshold set 1. */ 23762306a36Sopenharmony_ci#define S626_P_ACON1 0x00F4 /* Audio control 1. */ 23862306a36Sopenharmony_ci#define S626_P_ACON2 0x00F8 /* Audio control 2. */ 23962306a36Sopenharmony_ci#define S626_P_MC1 0x00FC /* Master control 1. */ 24062306a36Sopenharmony_ci#define S626_P_MC2 0x0100 /* Master control 2. */ 24162306a36Sopenharmony_ci#define S626_P_RPSADDR0 0x0104 /* RPS0 instruction pointer. */ 24262306a36Sopenharmony_ci#define S626_P_RPSADDR1 0x0108 /* RPS1 instruction pointer. */ 24362306a36Sopenharmony_ci#define S626_P_ISR 0x010C /* Interrupt status. */ 24462306a36Sopenharmony_ci#define S626_P_PSR 0x0110 /* Primary status. */ 24562306a36Sopenharmony_ci#define S626_P_SSR 0x0114 /* Secondary status. */ 24662306a36Sopenharmony_ci#define S626_P_EC1R 0x0118 /* Event counter set 1. */ 24762306a36Sopenharmony_ci#define S626_P_ADP4 0x0138 /* 24862306a36Sopenharmony_ci * Logical audio DMA pointer of audio 24962306a36Sopenharmony_ci * input FIFO A2_IN. 25062306a36Sopenharmony_ci */ 25162306a36Sopenharmony_ci#define S626_P_FB_BUFFER1 0x0144 /* Audio feedback buffer 1. */ 25262306a36Sopenharmony_ci#define S626_P_FB_BUFFER2 0x0148 /* Audio feedback buffer 2. */ 25362306a36Sopenharmony_ci#define S626_P_TSL1 0x0180 /* Audio time slot list 1. */ 25462306a36Sopenharmony_ci#define S626_P_TSL2 0x01C0 /* Audio time slot list 2. */ 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci/* LOCAL BUS (GATE ARRAY) REGISTER ADDRESS OFFSETS */ 25762306a36Sopenharmony_ci/* Analog I/O registers: */ 25862306a36Sopenharmony_ci#define S626_LP_DACPOL 0x0082 /* Write DAC polarity. */ 25962306a36Sopenharmony_ci#define S626_LP_GSEL 0x0084 /* Write ADC gain. */ 26062306a36Sopenharmony_ci#define S626_LP_ISEL 0x0086 /* Write ADC channel select. */ 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci/* Digital I/O registers */ 26362306a36Sopenharmony_ci#define S626_LP_RDDIN(x) (0x0040 + (x) * 0x10) /* R: digital input */ 26462306a36Sopenharmony_ci#define S626_LP_WRINTSEL(x) (0x0042 + (x) * 0x10) /* W: int enable */ 26562306a36Sopenharmony_ci#define S626_LP_WREDGSEL(x) (0x0044 + (x) * 0x10) /* W: edge selection */ 26662306a36Sopenharmony_ci#define S626_LP_WRCAPSEL(x) (0x0046 + (x) * 0x10) /* W: capture enable */ 26762306a36Sopenharmony_ci#define S626_LP_RDCAPFLG(x) (0x0048 + (x) * 0x10) /* R: edges captured */ 26862306a36Sopenharmony_ci#define S626_LP_WRDOUT(x) (0x0048 + (x) * 0x10) /* W: digital output */ 26962306a36Sopenharmony_ci#define S626_LP_RDINTSEL(x) (0x004a + (x) * 0x10) /* R: int enable */ 27062306a36Sopenharmony_ci#define S626_LP_RDEDGSEL(x) (0x004c + (x) * 0x10) /* R: edge selection */ 27162306a36Sopenharmony_ci#define S626_LP_RDCAPSEL(x) (0x004e + (x) * 0x10) /* R: capture enable */ 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci/* Counter registers (read/write): 0A 1A 2A 0B 1B 2B */ 27462306a36Sopenharmony_ci#define S626_LP_CRA(x) (0x0000 + (((x) % 3) * 0x4)) 27562306a36Sopenharmony_ci#define S626_LP_CRB(x) (0x0002 + (((x) % 3) * 0x4)) 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci/* Counter PreLoad (write) and Latch (read) Registers: 0A 1A 2A 0B 1B 2B */ 27862306a36Sopenharmony_ci#define S626_LP_CNTR(x) (0x000c + (((x) < 3) ? 0x0 : 0x4) + \ 27962306a36Sopenharmony_ci (((x) % 3) * 0x8)) 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci/* Miscellaneous Registers (read/write): */ 28262306a36Sopenharmony_ci#define S626_LP_MISC1 0x0088 /* Read/write Misc1. */ 28362306a36Sopenharmony_ci#define S626_LP_WRMISC2 0x0090 /* Write Misc2. */ 28462306a36Sopenharmony_ci#define S626_LP_RDMISC2 0x0082 /* Read Misc2. */ 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci/* Bit masks for MISC1 register that are the same for reads and writes. */ 28762306a36Sopenharmony_ci#define S626_MISC1_WENABLE 0x8000 /* 28862306a36Sopenharmony_ci * enab writes to MISC2 (except Clear 28962306a36Sopenharmony_ci * Watchdog bit). 29062306a36Sopenharmony_ci */ 29162306a36Sopenharmony_ci#define S626_MISC1_WDISABLE 0x0000 /* Disable writes to MISC2. */ 29262306a36Sopenharmony_ci#define S626_MISC1_EDCAP 0x1000 /* 29362306a36Sopenharmony_ci * Enable edge capture on DIO chans 29462306a36Sopenharmony_ci * specified by S626_LP_WRCAPSELx. 29562306a36Sopenharmony_ci */ 29662306a36Sopenharmony_ci#define S626_MISC1_NOEDCAP 0x0000 /* 29762306a36Sopenharmony_ci * Disable edge capture on specified 29862306a36Sopenharmony_ci * DIO chans. 29962306a36Sopenharmony_ci */ 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci/* Bit masks for MISC1 register reads. */ 30262306a36Sopenharmony_ci#define S626_RDMISC1_WDTIMEOUT 0x4000 /* Watchdog timer timed out. */ 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci/* Bit masks for MISC2 register writes. */ 30562306a36Sopenharmony_ci#define S626_WRMISC2_WDCLEAR 0x8000 /* Reset watchdog timer to zero. */ 30662306a36Sopenharmony_ci#define S626_WRMISC2_CHARGE_ENABLE 0x4000 /* Enable battery trickle charging. */ 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci/* Bit masks for MISC2 register that are the same for reads and writes. */ 30962306a36Sopenharmony_ci#define S626_MISC2_BATT_ENABLE 0x0008 /* Backup battery enable. */ 31062306a36Sopenharmony_ci#define S626_MISC2_WDENABLE 0x0004 /* Watchdog timer enable. */ 31162306a36Sopenharmony_ci#define S626_MISC2_WDPERIOD_MASK 0x0003 /* Watchdog interval select mask. */ 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci/* Bit masks for ACON1 register. */ 31462306a36Sopenharmony_ci#define S626_A2_RUN 0x40000000 /* Run A2 based on TSL2. */ 31562306a36Sopenharmony_ci#define S626_A1_RUN 0x20000000 /* Run A1 based on TSL1. */ 31662306a36Sopenharmony_ci#define S626_A1_SWAP 0x00200000 /* Use big-endian for A1. */ 31762306a36Sopenharmony_ci#define S626_A2_SWAP 0x00100000 /* Use big-endian for A2. */ 31862306a36Sopenharmony_ci#define S626_WS_MODES 0x00019999 /* 31962306a36Sopenharmony_ci * WS0 = TSL1 trigger input, 32062306a36Sopenharmony_ci * WS1-WS4 = CS* outputs. 32162306a36Sopenharmony_ci */ 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci#if (S626_PLATFORM == S626_INTEL) /* 32462306a36Sopenharmony_ci * Base ACON1 config: always run 32562306a36Sopenharmony_ci * A1 based on TSL1. 32662306a36Sopenharmony_ci */ 32762306a36Sopenharmony_ci#define S626_ACON1_BASE (S626_WS_MODES | S626_A1_RUN) 32862306a36Sopenharmony_ci#elif S626_PLATFORM == S626_MOTOROLA 32962306a36Sopenharmony_ci#define S626_ACON1_BASE \ 33062306a36Sopenharmony_ci (S626_WS_MODES | S626_A1_RUN | S626_A1_SWAP | S626_A2_SWAP) 33162306a36Sopenharmony_ci#endif 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci#define S626_ACON1_ADCSTART S626_ACON1_BASE /* 33462306a36Sopenharmony_ci * Start ADC: run A1 33562306a36Sopenharmony_ci * based on TSL1. 33662306a36Sopenharmony_ci */ 33762306a36Sopenharmony_ci#define S626_ACON1_DACSTART (S626_ACON1_BASE | S626_A2_RUN) 33862306a36Sopenharmony_ci/* Start transmit to DAC: run A2 based on TSL2. */ 33962306a36Sopenharmony_ci#define S626_ACON1_DACSTOP S626_ACON1_BASE /* Halt A2. */ 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci/* Bit masks for ACON2 register. */ 34262306a36Sopenharmony_ci#define S626_A1_CLKSRC_BCLK1 0x00000000 /* A1 bit rate = BCLK1 (ADC). */ 34362306a36Sopenharmony_ci#define S626_A2_CLKSRC_X1 0x00800000 /* 34462306a36Sopenharmony_ci * A2 bit rate = ACLK/1 34562306a36Sopenharmony_ci * (DACs). 34662306a36Sopenharmony_ci */ 34762306a36Sopenharmony_ci#define S626_A2_CLKSRC_X2 0x00C00000 /* 34862306a36Sopenharmony_ci * A2 bit rate = ACLK/2 34962306a36Sopenharmony_ci * (DACs). 35062306a36Sopenharmony_ci */ 35162306a36Sopenharmony_ci#define S626_A2_CLKSRC_X4 0x01400000 /* 35262306a36Sopenharmony_ci * A2 bit rate = ACLK/4 35362306a36Sopenharmony_ci * (DACs). 35462306a36Sopenharmony_ci */ 35562306a36Sopenharmony_ci#define S626_INVERT_BCLK2 0x00100000 /* Invert BCLK2 (DACs). */ 35662306a36Sopenharmony_ci#define S626_BCLK2_OE 0x00040000 /* Enable BCLK2 (DACs). */ 35762306a36Sopenharmony_ci#define S626_ACON2_XORMASK 0x000C0000 /* 35862306a36Sopenharmony_ci * XOR mask for ACON2 35962306a36Sopenharmony_ci * active-low bits. 36062306a36Sopenharmony_ci */ 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci#define S626_ACON2_INIT (S626_ACON2_XORMASK ^ \ 36362306a36Sopenharmony_ci (S626_A1_CLKSRC_BCLK1 | S626_A2_CLKSRC_X2 | \ 36462306a36Sopenharmony_ci S626_INVERT_BCLK2 | S626_BCLK2_OE)) 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ci/* Bit masks for timeslot records. */ 36762306a36Sopenharmony_ci#define S626_WS1 0x40000000 /* WS output to assert. */ 36862306a36Sopenharmony_ci#define S626_WS2 0x20000000 36962306a36Sopenharmony_ci#define S626_WS3 0x10000000 37062306a36Sopenharmony_ci#define S626_WS4 0x08000000 37162306a36Sopenharmony_ci#define S626_RSD1 0x01000000 /* Shift A1 data in on SD1. */ 37262306a36Sopenharmony_ci#define S626_SDW_A1 0x00800000 /* 37362306a36Sopenharmony_ci * Store rcv'd char at next char 37462306a36Sopenharmony_ci * slot of DWORD1 buffer. 37562306a36Sopenharmony_ci */ 37662306a36Sopenharmony_ci#define S626_SIB_A1 0x00400000 /* 37762306a36Sopenharmony_ci * Store rcv'd char at next 37862306a36Sopenharmony_ci * char slot of FB1 buffer. 37962306a36Sopenharmony_ci */ 38062306a36Sopenharmony_ci#define S626_SF_A1 0x00200000 /* 38162306a36Sopenharmony_ci * Write unsigned long 38262306a36Sopenharmony_ci * buffer to input FIFO. 38362306a36Sopenharmony_ci */ 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci/* Select parallel-to-serial converter's data source: */ 38662306a36Sopenharmony_ci#define S626_XFIFO_0 0x00000000 /* Data fifo byte 0. */ 38762306a36Sopenharmony_ci#define S626_XFIFO_1 0x00000010 /* Data fifo byte 1. */ 38862306a36Sopenharmony_ci#define S626_XFIFO_2 0x00000020 /* Data fifo byte 2. */ 38962306a36Sopenharmony_ci#define S626_XFIFO_3 0x00000030 /* Data fifo byte 3. */ 39062306a36Sopenharmony_ci#define S626_XFB0 0x00000040 /* FB_BUFFER byte 0. */ 39162306a36Sopenharmony_ci#define S626_XFB1 0x00000050 /* FB_BUFFER byte 1. */ 39262306a36Sopenharmony_ci#define S626_XFB2 0x00000060 /* FB_BUFFER byte 2. */ 39362306a36Sopenharmony_ci#define S626_XFB3 0x00000070 /* FB_BUFFER byte 3. */ 39462306a36Sopenharmony_ci#define S626_SIB_A2 0x00000200 /* 39562306a36Sopenharmony_ci * Store next dword from A2's 39662306a36Sopenharmony_ci * input shifter to FB2 39762306a36Sopenharmony_ci * buffer. 39862306a36Sopenharmony_ci */ 39962306a36Sopenharmony_ci#define S626_SF_A2 0x00000100 /* 40062306a36Sopenharmony_ci * Store next dword from A2's 40162306a36Sopenharmony_ci * input shifter to its input 40262306a36Sopenharmony_ci * fifo. 40362306a36Sopenharmony_ci */ 40462306a36Sopenharmony_ci#define S626_LF_A2 0x00000080 /* 40562306a36Sopenharmony_ci * Load next dword from A2's 40662306a36Sopenharmony_ci * output fifo into its 40762306a36Sopenharmony_ci * output dword buffer. 40862306a36Sopenharmony_ci */ 40962306a36Sopenharmony_ci#define S626_XSD2 0x00000008 /* Shift data out on SD2. */ 41062306a36Sopenharmony_ci#define S626_RSD3 0x00001800 /* Shift data in on SD3. */ 41162306a36Sopenharmony_ci#define S626_RSD2 0x00001000 /* Shift data in on SD2. */ 41262306a36Sopenharmony_ci#define S626_LOW_A2 0x00000002 /* 41362306a36Sopenharmony_ci * Drive last SD low for 7 clks, 41462306a36Sopenharmony_ci * then tri-state. 41562306a36Sopenharmony_ci */ 41662306a36Sopenharmony_ci#define S626_EOS 0x00000001 /* End of superframe. */ 41762306a36Sopenharmony_ci 41862306a36Sopenharmony_ci/* I2C configuration constants. */ 41962306a36Sopenharmony_ci#define S626_I2C_CLKSEL 0x0400 /* 42062306a36Sopenharmony_ci * I2C bit rate = 42162306a36Sopenharmony_ci * PCIclk/480 = 68.75 KHz. 42262306a36Sopenharmony_ci */ 42362306a36Sopenharmony_ci#define S626_I2C_BITRATE 68.75 /* 42462306a36Sopenharmony_ci * I2C bus data bit rate 42562306a36Sopenharmony_ci * (determined by 42662306a36Sopenharmony_ci * S626_I2C_CLKSEL) in KHz. 42762306a36Sopenharmony_ci */ 42862306a36Sopenharmony_ci#define S626_I2C_WRTIME 15.0 /* 42962306a36Sopenharmony_ci * Worst case time, in msec, 43062306a36Sopenharmony_ci * for EEPROM internal write 43162306a36Sopenharmony_ci * op. 43262306a36Sopenharmony_ci */ 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci/* I2C manifest constants. */ 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/* Max retries to wait for EEPROM write. */ 43762306a36Sopenharmony_ci#define S626_I2C_RETRIES (S626_I2C_WRTIME * S626_I2C_BITRATE / 9.0) 43862306a36Sopenharmony_ci#define S626_I2C_ERR 0x0002 /* I2C control/status flag ERROR. */ 43962306a36Sopenharmony_ci#define S626_I2C_BUSY 0x0001 /* I2C control/status flag BUSY. */ 44062306a36Sopenharmony_ci#define S626_I2C_ABORT 0x0080 /* I2C status flag ABORT. */ 44162306a36Sopenharmony_ci#define S626_I2C_ATTRSTART 0x3 /* I2C attribute START. */ 44262306a36Sopenharmony_ci#define S626_I2C_ATTRCONT 0x2 /* I2C attribute CONT. */ 44362306a36Sopenharmony_ci#define S626_I2C_ATTRSTOP 0x1 /* I2C attribute STOP. */ 44462306a36Sopenharmony_ci#define S626_I2C_ATTRNOP 0x0 /* I2C attribute NOP. */ 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci/* Code macros used for constructing I2C command bytes. */ 44762306a36Sopenharmony_ci#define S626_I2C_B2(ATTR, VAL) (((ATTR) << 6) | ((VAL) << 24)) 44862306a36Sopenharmony_ci#define S626_I2C_B1(ATTR, VAL) (((ATTR) << 4) | ((VAL) << 16)) 44962306a36Sopenharmony_ci#define S626_I2C_B0(ATTR, VAL) (((ATTR) << 2) | ((VAL) << 8)) 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_ci/* DEBI command constants. */ 45262306a36Sopenharmony_ci#define S626_DEBI_CMD_SIZE16 (2 << 17) /* 45362306a36Sopenharmony_ci * Transfer size is always 45462306a36Sopenharmony_ci * 2 bytes. 45562306a36Sopenharmony_ci */ 45662306a36Sopenharmony_ci#define S626_DEBI_CMD_READ 0x00010000 /* Read operation. */ 45762306a36Sopenharmony_ci#define S626_DEBI_CMD_WRITE 0x00000000 /* Write operation. */ 45862306a36Sopenharmony_ci 45962306a36Sopenharmony_ci/* Read immediate 2 bytes. */ 46062306a36Sopenharmony_ci#define S626_DEBI_CMD_RDWORD (S626_DEBI_CMD_READ | S626_DEBI_CMD_SIZE16) 46162306a36Sopenharmony_ci 46262306a36Sopenharmony_ci/* Write immediate 2 bytes. */ 46362306a36Sopenharmony_ci#define S626_DEBI_CMD_WRWORD (S626_DEBI_CMD_WRITE | S626_DEBI_CMD_SIZE16) 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci/* DEBI configuration constants. */ 46662306a36Sopenharmony_ci#define S626_DEBI_CFG_XIRQ_EN 0x80000000 /* 46762306a36Sopenharmony_ci * Enable external interrupt 46862306a36Sopenharmony_ci * on GPIO3. 46962306a36Sopenharmony_ci */ 47062306a36Sopenharmony_ci#define S626_DEBI_CFG_XRESUME 0x40000000 /* Resume block */ 47162306a36Sopenharmony_ci /* 47262306a36Sopenharmony_ci * Transfer when XIRQ 47362306a36Sopenharmony_ci * deasserted. 47462306a36Sopenharmony_ci */ 47562306a36Sopenharmony_ci#define S626_DEBI_CFG_TOQ 0x03C00000 /* Timeout (15 PCI cycles). */ 47662306a36Sopenharmony_ci#define S626_DEBI_CFG_FAST 0x10000000 /* Fast mode enable. */ 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci/* 4-bit field that specifies DEBI timeout value in PCI clock cycles: */ 47962306a36Sopenharmony_ci#define S626_DEBI_CFG_TOUT_BIT 22 /* 48062306a36Sopenharmony_ci * Finish DEBI cycle after this many 48162306a36Sopenharmony_ci * clocks. 48262306a36Sopenharmony_ci */ 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ci/* 2-bit field that specifies Endian byte lane steering: */ 48562306a36Sopenharmony_ci#define S626_DEBI_CFG_SWAP_NONE 0x00000000 /* 48662306a36Sopenharmony_ci * Straight - don't swap any 48762306a36Sopenharmony_ci * bytes (Intel). 48862306a36Sopenharmony_ci */ 48962306a36Sopenharmony_ci#define S626_DEBI_CFG_SWAP_2 0x00100000 /* 2-byte swap (Motorola). */ 49062306a36Sopenharmony_ci#define S626_DEBI_CFG_SWAP_4 0x00200000 /* 4-byte swap. */ 49162306a36Sopenharmony_ci#define S626_DEBI_CFG_SLAVE16 0x00080000 /* 49262306a36Sopenharmony_ci * Slave is able to serve 49362306a36Sopenharmony_ci * 16-bit cycles. 49462306a36Sopenharmony_ci */ 49562306a36Sopenharmony_ci#define S626_DEBI_CFG_INC 0x00040000 /* 49662306a36Sopenharmony_ci * Enable address increment 49762306a36Sopenharmony_ci * for block transfers. 49862306a36Sopenharmony_ci */ 49962306a36Sopenharmony_ci#define S626_DEBI_CFG_INTEL 0x00020000 /* Intel style local bus. */ 50062306a36Sopenharmony_ci#define S626_DEBI_CFG_TIMEROFF 0x00010000 /* Disable timer. */ 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ci#if S626_PLATFORM == S626_INTEL 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci#define S626_DEBI_TOUT 7 /* 50562306a36Sopenharmony_ci * Wait 7 PCI clocks (212 ns) before 50662306a36Sopenharmony_ci * polling RDY. 50762306a36Sopenharmony_ci */ 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci/* Intel byte lane steering (pass through all byte lanes). */ 51062306a36Sopenharmony_ci#define S626_DEBI_SWAP S626_DEBI_CFG_SWAP_NONE 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci#elif S626_PLATFORM == S626_MOTOROLA 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci#define S626_DEBI_TOUT 15 /* 51562306a36Sopenharmony_ci * Wait 15 PCI clocks (454 ns) maximum 51662306a36Sopenharmony_ci * before timing out. 51762306a36Sopenharmony_ci */ 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_ci/* Motorola byte lane steering. */ 52062306a36Sopenharmony_ci#define S626_DEBI_SWAP S626_DEBI_CFG_SWAP_2 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci#endif 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ci/* DEBI page table constants. */ 52562306a36Sopenharmony_ci#define S626_DEBI_PAGE_DISABLE 0x00000000 /* Paging disable. */ 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ci/* ******* EXTRA FROM OTHER SENSORAY * .h ******* */ 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci/* LoadSrc values: */ 53062306a36Sopenharmony_ci#define S626_LOADSRC_INDX 0 /* Preload core in response to Index. */ 53162306a36Sopenharmony_ci#define S626_LOADSRC_OVER 1 /* 53262306a36Sopenharmony_ci * Preload core in response to 53362306a36Sopenharmony_ci * Overflow. 53462306a36Sopenharmony_ci */ 53562306a36Sopenharmony_ci#define S626_LOADSRCB_OVERA 2 /* 53662306a36Sopenharmony_ci * Preload B core in response to 53762306a36Sopenharmony_ci * A Overflow. 53862306a36Sopenharmony_ci */ 53962306a36Sopenharmony_ci#define S626_LOADSRC_NONE 3 /* Never preload core. */ 54062306a36Sopenharmony_ci 54162306a36Sopenharmony_ci/* IntSrc values: */ 54262306a36Sopenharmony_ci#define S626_INTSRC_NONE 0 /* Interrupts disabled. */ 54362306a36Sopenharmony_ci#define S626_INTSRC_OVER 1 /* Interrupt on Overflow. */ 54462306a36Sopenharmony_ci#define S626_INTSRC_INDX 2 /* Interrupt on Index. */ 54562306a36Sopenharmony_ci#define S626_INTSRC_BOTH 3 /* Interrupt on Index or Overflow. */ 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_ci/* LatchSrc values: */ 54862306a36Sopenharmony_ci#define S626_LATCHSRC_AB_READ 0 /* Latch on read. */ 54962306a36Sopenharmony_ci#define S626_LATCHSRC_A_INDXA 1 /* Latch A on A Index. */ 55062306a36Sopenharmony_ci#define S626_LATCHSRC_B_INDXB 2 /* Latch B on B Index. */ 55162306a36Sopenharmony_ci#define S626_LATCHSRC_B_OVERA 3 /* Latch B on A Overflow. */ 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci/* IndxSrc values: */ 55462306a36Sopenharmony_ci#define S626_INDXSRC_ENCODER 0 /* Encoder. */ 55562306a36Sopenharmony_ci#define S626_INDXSRC_DIGIN 1 /* Digital inputs. */ 55662306a36Sopenharmony_ci#define S626_INDXSRC_SOFT 2 /* S/w controlled by IndxPol bit. */ 55762306a36Sopenharmony_ci#define S626_INDXSRC_DISABLED 3 /* Index disabled. */ 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci/* IndxPol values: */ 56062306a36Sopenharmony_ci#define S626_INDXPOL_POS 0 /* Index input is active high. */ 56162306a36Sopenharmony_ci#define S626_INDXPOL_NEG 1 /* Index input is active low. */ 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci/* Logical encoder mode values: */ 56462306a36Sopenharmony_ci#define S626_ENCMODE_COUNTER 0 /* Counter mode. */ 56562306a36Sopenharmony_ci#define S626_ENCMODE_TIMER 2 /* Timer mode. */ 56662306a36Sopenharmony_ci#define S626_ENCMODE_EXTENDER 3 /* Extender mode. */ 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_ci/* Physical CntSrc values (for Counter A source and Counter B source): */ 56962306a36Sopenharmony_ci#define S626_CNTSRC_ENCODER 0 /* Encoder */ 57062306a36Sopenharmony_ci#define S626_CNTSRC_DIGIN 1 /* Digital inputs */ 57162306a36Sopenharmony_ci#define S626_CNTSRC_SYSCLK 2 /* System clock up */ 57262306a36Sopenharmony_ci#define S626_CNTSRC_SYSCLK_DOWN 3 /* System clock down */ 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci/* ClkPol values: */ 57562306a36Sopenharmony_ci#define S626_CLKPOL_POS 0 /* 57662306a36Sopenharmony_ci * Counter/Extender clock is 57762306a36Sopenharmony_ci * active high. 57862306a36Sopenharmony_ci */ 57962306a36Sopenharmony_ci#define S626_CLKPOL_NEG 1 /* 58062306a36Sopenharmony_ci * Counter/Extender clock is 58162306a36Sopenharmony_ci * active low. 58262306a36Sopenharmony_ci */ 58362306a36Sopenharmony_ci#define S626_CNTDIR_UP 0 /* Timer counts up. */ 58462306a36Sopenharmony_ci#define S626_CNTDIR_DOWN 1 /* Timer counts down. */ 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_ci/* ClkEnab values: */ 58762306a36Sopenharmony_ci#define S626_CLKENAB_ALWAYS 0 /* Clock always enabled. */ 58862306a36Sopenharmony_ci#define S626_CLKENAB_INDEX 1 /* Clock is enabled by index. */ 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci/* ClkMult values: */ 59162306a36Sopenharmony_ci#define S626_CLKMULT_4X 0 /* 4x clock multiplier. */ 59262306a36Sopenharmony_ci#define S626_CLKMULT_2X 1 /* 2x clock multiplier. */ 59362306a36Sopenharmony_ci#define S626_CLKMULT_1X 2 /* 1x clock multiplier. */ 59462306a36Sopenharmony_ci#define S626_CLKMULT_SPECIAL 3 /* Special clock multiplier value. */ 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci/* Sanity-check limits for parameters. */ 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci#define S626_NUM_COUNTERS 6 /* 59962306a36Sopenharmony_ci * Maximum valid counter 60062306a36Sopenharmony_ci * logical channel number. 60162306a36Sopenharmony_ci */ 60262306a36Sopenharmony_ci#define S626_NUM_INTSOURCES 4 60362306a36Sopenharmony_ci#define S626_NUM_LATCHSOURCES 4 60462306a36Sopenharmony_ci#define S626_NUM_CLKMULTS 4 60562306a36Sopenharmony_ci#define S626_NUM_CLKSOURCES 4 60662306a36Sopenharmony_ci#define S626_NUM_CLKPOLS 2 60762306a36Sopenharmony_ci#define S626_NUM_INDEXPOLS 2 60862306a36Sopenharmony_ci#define S626_NUM_INDEXSOURCES 2 60962306a36Sopenharmony_ci#define S626_NUM_LOADTRIGS 4 61062306a36Sopenharmony_ci 61162306a36Sopenharmony_ci/* General macros for manipulating bitfields: */ 61262306a36Sopenharmony_ci#define S626_MAKE(x, w, p) (((x) & ((1 << (w)) - 1)) << (p)) 61362306a36Sopenharmony_ci#define S626_UNMAKE(v, w, p) (((v) >> (p)) & ((1 << (w)) - 1)) 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci/* Bit field positions in CRA: */ 61662306a36Sopenharmony_ci#define S626_CRABIT_INDXSRC_B 14 /* B index source. */ 61762306a36Sopenharmony_ci#define S626_CRABIT_CNTSRC_B 12 /* B counter source. */ 61862306a36Sopenharmony_ci#define S626_CRABIT_INDXPOL_A 11 /* A index polarity. */ 61962306a36Sopenharmony_ci#define S626_CRABIT_LOADSRC_A 9 /* A preload trigger. */ 62062306a36Sopenharmony_ci#define S626_CRABIT_CLKMULT_A 7 /* A clock multiplier. */ 62162306a36Sopenharmony_ci#define S626_CRABIT_INTSRC_A 5 /* A interrupt source. */ 62262306a36Sopenharmony_ci#define S626_CRABIT_CLKPOL_A 4 /* A clock polarity. */ 62362306a36Sopenharmony_ci#define S626_CRABIT_INDXSRC_A 2 /* A index source. */ 62462306a36Sopenharmony_ci#define S626_CRABIT_CNTSRC_A 0 /* A counter source. */ 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci/* Bit field widths in CRA: */ 62762306a36Sopenharmony_ci#define S626_CRAWID_INDXSRC_B 2 62862306a36Sopenharmony_ci#define S626_CRAWID_CNTSRC_B 2 62962306a36Sopenharmony_ci#define S626_CRAWID_INDXPOL_A 1 63062306a36Sopenharmony_ci#define S626_CRAWID_LOADSRC_A 2 63162306a36Sopenharmony_ci#define S626_CRAWID_CLKMULT_A 2 63262306a36Sopenharmony_ci#define S626_CRAWID_INTSRC_A 2 63362306a36Sopenharmony_ci#define S626_CRAWID_CLKPOL_A 1 63462306a36Sopenharmony_ci#define S626_CRAWID_INDXSRC_A 2 63562306a36Sopenharmony_ci#define S626_CRAWID_CNTSRC_A 2 63662306a36Sopenharmony_ci 63762306a36Sopenharmony_ci/* Bit field masks for CRA: */ 63862306a36Sopenharmony_ci#define S626_CRAMSK_INDXSRC_B S626_SET_CRA_INDXSRC_B(~0) 63962306a36Sopenharmony_ci#define S626_CRAMSK_CNTSRC_B S626_SET_CRA_CNTSRC_B(~0) 64062306a36Sopenharmony_ci#define S626_CRAMSK_INDXPOL_A S626_SET_CRA_INDXPOL_A(~0) 64162306a36Sopenharmony_ci#define S626_CRAMSK_LOADSRC_A S626_SET_CRA_LOADSRC_A(~0) 64262306a36Sopenharmony_ci#define S626_CRAMSK_CLKMULT_A S626_SET_CRA_CLKMULT_A(~0) 64362306a36Sopenharmony_ci#define S626_CRAMSK_INTSRC_A S626_SET_CRA_INTSRC_A(~0) 64462306a36Sopenharmony_ci#define S626_CRAMSK_CLKPOL_A S626_SET_CRA_CLKPOL_A(~0) 64562306a36Sopenharmony_ci#define S626_CRAMSK_INDXSRC_A S626_SET_CRA_INDXSRC_A(~0) 64662306a36Sopenharmony_ci#define S626_CRAMSK_CNTSRC_A S626_SET_CRA_CNTSRC_A(~0) 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_ci/* Construct parts of the CRA value: */ 64962306a36Sopenharmony_ci#define S626_SET_CRA_INDXSRC_B(x) \ 65062306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_INDXSRC_B, S626_CRABIT_INDXSRC_B) 65162306a36Sopenharmony_ci#define S626_SET_CRA_CNTSRC_B(x) \ 65262306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_CNTSRC_B, S626_CRABIT_CNTSRC_B) 65362306a36Sopenharmony_ci#define S626_SET_CRA_INDXPOL_A(x) \ 65462306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_INDXPOL_A, S626_CRABIT_INDXPOL_A) 65562306a36Sopenharmony_ci#define S626_SET_CRA_LOADSRC_A(x) \ 65662306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_LOADSRC_A, S626_CRABIT_LOADSRC_A) 65762306a36Sopenharmony_ci#define S626_SET_CRA_CLKMULT_A(x) \ 65862306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_CLKMULT_A, S626_CRABIT_CLKMULT_A) 65962306a36Sopenharmony_ci#define S626_SET_CRA_INTSRC_A(x) \ 66062306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_INTSRC_A, S626_CRABIT_INTSRC_A) 66162306a36Sopenharmony_ci#define S626_SET_CRA_CLKPOL_A(x) \ 66262306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_CLKPOL_A, S626_CRABIT_CLKPOL_A) 66362306a36Sopenharmony_ci#define S626_SET_CRA_INDXSRC_A(x) \ 66462306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_INDXSRC_A, S626_CRABIT_INDXSRC_A) 66562306a36Sopenharmony_ci#define S626_SET_CRA_CNTSRC_A(x) \ 66662306a36Sopenharmony_ci S626_MAKE((x), S626_CRAWID_CNTSRC_A, S626_CRABIT_CNTSRC_A) 66762306a36Sopenharmony_ci 66862306a36Sopenharmony_ci/* Extract parts of the CRA value: */ 66962306a36Sopenharmony_ci#define S626_GET_CRA_INDXSRC_B(v) \ 67062306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_INDXSRC_B, S626_CRABIT_INDXSRC_B) 67162306a36Sopenharmony_ci#define S626_GET_CRA_CNTSRC_B(v) \ 67262306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_CNTSRC_B, S626_CRABIT_CNTSRC_B) 67362306a36Sopenharmony_ci#define S626_GET_CRA_INDXPOL_A(v) \ 67462306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_INDXPOL_A, S626_CRABIT_INDXPOL_A) 67562306a36Sopenharmony_ci#define S626_GET_CRA_LOADSRC_A(v) \ 67662306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_LOADSRC_A, S626_CRABIT_LOADSRC_A) 67762306a36Sopenharmony_ci#define S626_GET_CRA_CLKMULT_A(v) \ 67862306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_CLKMULT_A, S626_CRABIT_CLKMULT_A) 67962306a36Sopenharmony_ci#define S626_GET_CRA_INTSRC_A(v) \ 68062306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_INTSRC_A, S626_CRABIT_INTSRC_A) 68162306a36Sopenharmony_ci#define S626_GET_CRA_CLKPOL_A(v) \ 68262306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_CLKPOL_A, S626_CRABIT_CLKPOL_A) 68362306a36Sopenharmony_ci#define S626_GET_CRA_INDXSRC_A(v) \ 68462306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_INDXSRC_A, S626_CRABIT_INDXSRC_A) 68562306a36Sopenharmony_ci#define S626_GET_CRA_CNTSRC_A(v) \ 68662306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRAWID_CNTSRC_A, S626_CRABIT_CNTSRC_A) 68762306a36Sopenharmony_ci 68862306a36Sopenharmony_ci/* Bit field positions in CRB: */ 68962306a36Sopenharmony_ci#define S626_CRBBIT_INTRESETCMD 15 /* (w) Interrupt reset command. */ 69062306a36Sopenharmony_ci#define S626_CRBBIT_CNTDIR_B 15 /* (r) B counter direction. */ 69162306a36Sopenharmony_ci#define S626_CRBBIT_INTRESET_B 14 /* (w) B interrupt reset enable. */ 69262306a36Sopenharmony_ci#define S626_CRBBIT_OVERDO_A 14 /* (r) A overflow routed to dig. out. */ 69362306a36Sopenharmony_ci#define S626_CRBBIT_INTRESET_A 13 /* (w) A interrupt reset enable. */ 69462306a36Sopenharmony_ci#define S626_CRBBIT_OVERDO_B 13 /* (r) B overflow routed to dig. out. */ 69562306a36Sopenharmony_ci#define S626_CRBBIT_CLKENAB_A 12 /* A clock enable. */ 69662306a36Sopenharmony_ci#define S626_CRBBIT_INTSRC_B 10 /* B interrupt source. */ 69762306a36Sopenharmony_ci#define S626_CRBBIT_LATCHSRC 8 /* A/B latch source. */ 69862306a36Sopenharmony_ci#define S626_CRBBIT_LOADSRC_B 6 /* B preload trigger. */ 69962306a36Sopenharmony_ci#define S626_CRBBIT_CLEAR_B 7 /* B cleared when A overflows. */ 70062306a36Sopenharmony_ci#define S626_CRBBIT_CLKMULT_B 3 /* B clock multiplier. */ 70162306a36Sopenharmony_ci#define S626_CRBBIT_CLKENAB_B 2 /* B clock enable. */ 70262306a36Sopenharmony_ci#define S626_CRBBIT_INDXPOL_B 1 /* B index polarity. */ 70362306a36Sopenharmony_ci#define S626_CRBBIT_CLKPOL_B 0 /* B clock polarity. */ 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci/* Bit field widths in CRB: */ 70662306a36Sopenharmony_ci#define S626_CRBWID_INTRESETCMD 1 70762306a36Sopenharmony_ci#define S626_CRBWID_CNTDIR_B 1 70862306a36Sopenharmony_ci#define S626_CRBWID_INTRESET_B 1 70962306a36Sopenharmony_ci#define S626_CRBWID_OVERDO_A 1 71062306a36Sopenharmony_ci#define S626_CRBWID_INTRESET_A 1 71162306a36Sopenharmony_ci#define S626_CRBWID_OVERDO_B 1 71262306a36Sopenharmony_ci#define S626_CRBWID_CLKENAB_A 1 71362306a36Sopenharmony_ci#define S626_CRBWID_INTSRC_B 2 71462306a36Sopenharmony_ci#define S626_CRBWID_LATCHSRC 2 71562306a36Sopenharmony_ci#define S626_CRBWID_LOADSRC_B 2 71662306a36Sopenharmony_ci#define S626_CRBWID_CLEAR_B 1 71762306a36Sopenharmony_ci#define S626_CRBWID_CLKMULT_B 2 71862306a36Sopenharmony_ci#define S626_CRBWID_CLKENAB_B 1 71962306a36Sopenharmony_ci#define S626_CRBWID_INDXPOL_B 1 72062306a36Sopenharmony_ci#define S626_CRBWID_CLKPOL_B 1 72162306a36Sopenharmony_ci 72262306a36Sopenharmony_ci/* Bit field masks for CRB: */ 72362306a36Sopenharmony_ci#define S626_CRBMSK_INTRESETCMD S626_SET_CRB_INTRESETCMD(~0) /* (w) */ 72462306a36Sopenharmony_ci#define S626_CRBMSK_CNTDIR_B S626_CRBMSK_INTRESETCMD /* (r) */ 72562306a36Sopenharmony_ci#define S626_CRBMSK_INTRESET_B S626_SET_CRB_INTRESET_B(~0) /* (w) */ 72662306a36Sopenharmony_ci#define S626_CRBMSK_OVERDO_A S626_CRBMSK_INTRESET_B /* (r) */ 72762306a36Sopenharmony_ci#define S626_CRBMSK_INTRESET_A S626_SET_CRB_INTRESET_A(~0) /* (w) */ 72862306a36Sopenharmony_ci#define S626_CRBMSK_OVERDO_B S626_CRBMSK_INTRESET_A /* (r) */ 72962306a36Sopenharmony_ci#define S626_CRBMSK_CLKENAB_A S626_SET_CRB_CLKENAB_A(~0) 73062306a36Sopenharmony_ci#define S626_CRBMSK_INTSRC_B S626_SET_CRB_INTSRC_B(~0) 73162306a36Sopenharmony_ci#define S626_CRBMSK_LATCHSRC S626_SET_CRB_LATCHSRC(~0) 73262306a36Sopenharmony_ci#define S626_CRBMSK_LOADSRC_B S626_SET_CRB_LOADSRC_B(~0) 73362306a36Sopenharmony_ci#define S626_CRBMSK_CLEAR_B S626_SET_CRB_CLEAR_B(~0) 73462306a36Sopenharmony_ci#define S626_CRBMSK_CLKMULT_B S626_SET_CRB_CLKMULT_B(~0) 73562306a36Sopenharmony_ci#define S626_CRBMSK_CLKENAB_B S626_SET_CRB_CLKENAB_B(~0) 73662306a36Sopenharmony_ci#define S626_CRBMSK_INDXPOL_B S626_SET_CRB_INDXPOL_B(~0) 73762306a36Sopenharmony_ci#define S626_CRBMSK_CLKPOL_B S626_SET_CRB_CLKPOL_B(~0) 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci/* Interrupt reset control bits. */ 74062306a36Sopenharmony_ci#define S626_CRBMSK_INTCTRL (S626_CRBMSK_INTRESETCMD | \ 74162306a36Sopenharmony_ci S626_CRBMSK_INTRESET_A | \ 74262306a36Sopenharmony_ci S626_CRBMSK_INTRESET_B) 74362306a36Sopenharmony_ci 74462306a36Sopenharmony_ci/* Construct parts of the CRB value: */ 74562306a36Sopenharmony_ci#define S626_SET_CRB_INTRESETCMD(x) \ 74662306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_INTRESETCMD, S626_CRBBIT_INTRESETCMD) 74762306a36Sopenharmony_ci#define S626_SET_CRB_INTRESET_B(x) \ 74862306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_INTRESET_B, S626_CRBBIT_INTRESET_B) 74962306a36Sopenharmony_ci#define S626_SET_CRB_INTRESET_A(x) \ 75062306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_INTRESET_A, S626_CRBBIT_INTRESET_A) 75162306a36Sopenharmony_ci#define S626_SET_CRB_CLKENAB_A(x) \ 75262306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_CLKENAB_A, S626_CRBBIT_CLKENAB_A) 75362306a36Sopenharmony_ci#define S626_SET_CRB_INTSRC_B(x) \ 75462306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_INTSRC_B, S626_CRBBIT_INTSRC_B) 75562306a36Sopenharmony_ci#define S626_SET_CRB_LATCHSRC(x) \ 75662306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_LATCHSRC, S626_CRBBIT_LATCHSRC) 75762306a36Sopenharmony_ci#define S626_SET_CRB_LOADSRC_B(x) \ 75862306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_LOADSRC_B, S626_CRBBIT_LOADSRC_B) 75962306a36Sopenharmony_ci#define S626_SET_CRB_CLEAR_B(x) \ 76062306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_CLEAR_B, S626_CRBBIT_CLEAR_B) 76162306a36Sopenharmony_ci#define S626_SET_CRB_CLKMULT_B(x) \ 76262306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_CLKMULT_B, S626_CRBBIT_CLKMULT_B) 76362306a36Sopenharmony_ci#define S626_SET_CRB_CLKENAB_B(x) \ 76462306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_CLKENAB_B, S626_CRBBIT_CLKENAB_B) 76562306a36Sopenharmony_ci#define S626_SET_CRB_INDXPOL_B(x) \ 76662306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_INDXPOL_B, S626_CRBBIT_INDXPOL_B) 76762306a36Sopenharmony_ci#define S626_SET_CRB_CLKPOL_B(x) \ 76862306a36Sopenharmony_ci S626_MAKE((x), S626_CRBWID_CLKPOL_B, S626_CRBBIT_CLKPOL_B) 76962306a36Sopenharmony_ci 77062306a36Sopenharmony_ci/* Extract parts of the CRB value: */ 77162306a36Sopenharmony_ci#define S626_GET_CRB_CNTDIR_B(v) \ 77262306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CNTDIR_B, S626_CRBBIT_CNTDIR_B) 77362306a36Sopenharmony_ci#define S626_GET_CRB_OVERDO_A(v) \ 77462306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_OVERDO_A, S626_CRBBIT_OVERDO_A) 77562306a36Sopenharmony_ci#define S626_GET_CRB_OVERDO_B(v) \ 77662306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_OVERDO_B, S626_CRBBIT_OVERDO_B) 77762306a36Sopenharmony_ci#define S626_GET_CRB_CLKENAB_A(v) \ 77862306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CLKENAB_A, S626_CRBBIT_CLKENAB_A) 77962306a36Sopenharmony_ci#define S626_GET_CRB_INTSRC_B(v) \ 78062306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_INTSRC_B, S626_CRBBIT_INTSRC_B) 78162306a36Sopenharmony_ci#define S626_GET_CRB_LATCHSRC(v) \ 78262306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_LATCHSRC, S626_CRBBIT_LATCHSRC) 78362306a36Sopenharmony_ci#define S626_GET_CRB_LOADSRC_B(v) \ 78462306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_LOADSRC_B, S626_CRBBIT_LOADSRC_B) 78562306a36Sopenharmony_ci#define S626_GET_CRB_CLEAR_B(v) \ 78662306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CLEAR_B, S626_CRBBIT_CLEAR_B) 78762306a36Sopenharmony_ci#define S626_GET_CRB_CLKMULT_B(v) \ 78862306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CLKMULT_B, S626_CRBBIT_CLKMULT_B) 78962306a36Sopenharmony_ci#define S626_GET_CRB_CLKENAB_B(v) \ 79062306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CLKENAB_B, S626_CRBBIT_CLKENAB_B) 79162306a36Sopenharmony_ci#define S626_GET_CRB_INDXPOL_B(v) \ 79262306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_INDXPOL_B, S626_CRBBIT_INDXPOL_B) 79362306a36Sopenharmony_ci#define S626_GET_CRB_CLKPOL_B(v) \ 79462306a36Sopenharmony_ci S626_UNMAKE((v), S626_CRBWID_CLKPOL_B, S626_CRBBIT_CLKPOL_B) 79562306a36Sopenharmony_ci 79662306a36Sopenharmony_ci/* Bit field positions for standardized SETUP structure: */ 79762306a36Sopenharmony_ci#define S626_STDBIT_INTSRC 13 79862306a36Sopenharmony_ci#define S626_STDBIT_LATCHSRC 11 79962306a36Sopenharmony_ci#define S626_STDBIT_LOADSRC 9 80062306a36Sopenharmony_ci#define S626_STDBIT_INDXSRC 7 80162306a36Sopenharmony_ci#define S626_STDBIT_INDXPOL 6 80262306a36Sopenharmony_ci#define S626_STDBIT_ENCMODE 4 80362306a36Sopenharmony_ci#define S626_STDBIT_CLKPOL 3 80462306a36Sopenharmony_ci#define S626_STDBIT_CLKMULT 1 80562306a36Sopenharmony_ci#define S626_STDBIT_CLKENAB 0 80662306a36Sopenharmony_ci 80762306a36Sopenharmony_ci/* Bit field widths for standardized SETUP structure: */ 80862306a36Sopenharmony_ci#define S626_STDWID_INTSRC 2 80962306a36Sopenharmony_ci#define S626_STDWID_LATCHSRC 2 81062306a36Sopenharmony_ci#define S626_STDWID_LOADSRC 2 81162306a36Sopenharmony_ci#define S626_STDWID_INDXSRC 2 81262306a36Sopenharmony_ci#define S626_STDWID_INDXPOL 1 81362306a36Sopenharmony_ci#define S626_STDWID_ENCMODE 2 81462306a36Sopenharmony_ci#define S626_STDWID_CLKPOL 1 81562306a36Sopenharmony_ci#define S626_STDWID_CLKMULT 2 81662306a36Sopenharmony_ci#define S626_STDWID_CLKENAB 1 81762306a36Sopenharmony_ci 81862306a36Sopenharmony_ci/* Bit field masks for standardized SETUP structure: */ 81962306a36Sopenharmony_ci#define S626_STDMSK_INTSRC S626_SET_STD_INTSRC(~0) 82062306a36Sopenharmony_ci#define S626_STDMSK_LATCHSRC S626_SET_STD_LATCHSRC(~0) 82162306a36Sopenharmony_ci#define S626_STDMSK_LOADSRC S626_SET_STD_LOADSRC(~0) 82262306a36Sopenharmony_ci#define S626_STDMSK_INDXSRC S626_SET_STD_INDXSRC(~0) 82362306a36Sopenharmony_ci#define S626_STDMSK_INDXPOL S626_SET_STD_INDXPOL(~0) 82462306a36Sopenharmony_ci#define S626_STDMSK_ENCMODE S626_SET_STD_ENCMODE(~0) 82562306a36Sopenharmony_ci#define S626_STDMSK_CLKPOL S626_SET_STD_CLKPOL(~0) 82662306a36Sopenharmony_ci#define S626_STDMSK_CLKMULT S626_SET_STD_CLKMULT(~0) 82762306a36Sopenharmony_ci#define S626_STDMSK_CLKENAB S626_SET_STD_CLKENAB(~0) 82862306a36Sopenharmony_ci 82962306a36Sopenharmony_ci/* Construct parts of standardized SETUP structure: */ 83062306a36Sopenharmony_ci#define S626_SET_STD_INTSRC(x) \ 83162306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_INTSRC, S626_STDBIT_INTSRC) 83262306a36Sopenharmony_ci#define S626_SET_STD_LATCHSRC(x) \ 83362306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_LATCHSRC, S626_STDBIT_LATCHSRC) 83462306a36Sopenharmony_ci#define S626_SET_STD_LOADSRC(x) \ 83562306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_LOADSRC, S626_STDBIT_LOADSRC) 83662306a36Sopenharmony_ci#define S626_SET_STD_INDXSRC(x) \ 83762306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_INDXSRC, S626_STDBIT_INDXSRC) 83862306a36Sopenharmony_ci#define S626_SET_STD_INDXPOL(x) \ 83962306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_INDXPOL, S626_STDBIT_INDXPOL) 84062306a36Sopenharmony_ci#define S626_SET_STD_ENCMODE(x) \ 84162306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_ENCMODE, S626_STDBIT_ENCMODE) 84262306a36Sopenharmony_ci#define S626_SET_STD_CLKPOL(x) \ 84362306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_CLKPOL, S626_STDBIT_CLKPOL) 84462306a36Sopenharmony_ci#define S626_SET_STD_CLKMULT(x) \ 84562306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_CLKMULT, S626_STDBIT_CLKMULT) 84662306a36Sopenharmony_ci#define S626_SET_STD_CLKENAB(x) \ 84762306a36Sopenharmony_ci S626_MAKE((x), S626_STDWID_CLKENAB, S626_STDBIT_CLKENAB) 84862306a36Sopenharmony_ci 84962306a36Sopenharmony_ci/* Extract parts of standardized SETUP structure: */ 85062306a36Sopenharmony_ci#define S626_GET_STD_INTSRC(v) \ 85162306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_INTSRC, S626_STDBIT_INTSRC) 85262306a36Sopenharmony_ci#define S626_GET_STD_LATCHSRC(v) \ 85362306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_LATCHSRC, S626_STDBIT_LATCHSRC) 85462306a36Sopenharmony_ci#define S626_GET_STD_LOADSRC(v) \ 85562306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_LOADSRC, S626_STDBIT_LOADSRC) 85662306a36Sopenharmony_ci#define S626_GET_STD_INDXSRC(v) \ 85762306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_INDXSRC, S626_STDBIT_INDXSRC) 85862306a36Sopenharmony_ci#define S626_GET_STD_INDXPOL(v) \ 85962306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_INDXPOL, S626_STDBIT_INDXPOL) 86062306a36Sopenharmony_ci#define S626_GET_STD_ENCMODE(v) \ 86162306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_ENCMODE, S626_STDBIT_ENCMODE) 86262306a36Sopenharmony_ci#define S626_GET_STD_CLKPOL(v) \ 86362306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_CLKPOL, S626_STDBIT_CLKPOL) 86462306a36Sopenharmony_ci#define S626_GET_STD_CLKMULT(v) \ 86562306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_CLKMULT, S626_STDBIT_CLKMULT) 86662306a36Sopenharmony_ci#define S626_GET_STD_CLKENAB(v) \ 86762306a36Sopenharmony_ci S626_UNMAKE((v), S626_STDWID_CLKENAB, S626_STDBIT_CLKENAB) 86862306a36Sopenharmony_ci 86962306a36Sopenharmony_ci#endif 870