/*
    Device driver for Diamond A/D converter
    Copyright Kristian Mueller 2005
*/

#ifndef AD_CONVERTERINFO_H
#define AD_CONVERTERINFO_H

                   
#define BASE_ADDR                   0x0300
#define DMA_LEVEL                   3
#define AD_GAIN                     6
// TODO - unipolar/bipolar; single-ended/differential mode; reference voltages; clock freq

#define START_CONVERSION            (IOBASE + BASE_ADDR + 0)
#define AD_CHANNEL_REGISTER         (IOBASE + BASE_ADDR + 2)
#define DIGITAL_OUTPUT_PORT         (IOBASE + BASE_ADDR + 3)
#define DA_0_LSB                    (IOBASE + BASE_ADDR + 4)
#define DA_0_MSB                    (IOBASE + BASE_ADDR + 5)
#define DA_1_LSB                    (IOBASE + BASE_ADDR + 6)
#define DA_1_MSB                    (IOBASE + BASE_ADDR + 7)
#define CLR_INTERRUPT               (IOBASE + BASE_ADDR + 8)
#define CONTROL_REGISTER            (IOBASE + BASE_ADDR + 9)
#define TIMER_SELECT                (IOBASE + BASE_ADDR + 10)
#define TIMER0_DATA                 (IOBASE + BASE_ADDR + 12)
#define TIMER1_DATA                 (IOBASE + BASE_ADDR + 13)
#define TIMER2_DATA                 (IOBASE + BASE_ADDR + 14)
#define TIMER_CTR_REGISTER          (IOBASE + BASE_ADDR + 15)

#define AD_LSB                      (IOBASE + BASE_ADDR + 0)
#define AD_MSB                      (IOBASE + BASE_ADDR + 1)
#define DIGITAL_INPUT_PORT          (IOBASE + BASE_ADDR + 3)
#define STATUS_REGISTER             (IOBASE + BASE_ADDR + 8)
#define SPECIAL_REGISTER            (IOBASE + BASE_ADDR + 11)

#define CMD_CLEAR_DOUT              3
#define CMD_SET_DOUT                4
// to read the first input at the first channel
#define CMD_INIT_AD1                5
#define CMD_START_CONVERSATION      6

struct ad_converterinfo{
    long  iPortBase;             // Base address of the A/D-C. Board
    int   iDMALevel;             // indivates the DMA level - 3 would have lowest priority
    int   iADGainSetting;        // the gain [1=User; 2=x10; 3=x5; 4=x2; 5=x1; 6=x0.5] 6 is default
};


#endif   // AD_CONVERTERINFO_H 

