/*
  Public definitions for the Giant Slalom SCSI driver
*/

#include <linux/ioctl.h>

typedef struct {
    unsigned long  address;
    unsigned long  length;
    void          *data;
} ElmoIODescriptor;

typedef struct {
    unsigned long  length;
    void          *data;
} ElmoPLDDescriptor;

typedef struct {
  unsigned long address;
  unsigned short mask;
  unsigned short bits;
} ElmoMaskDescriptor;

#define kPLDMaxImageSize 0x20000

// ioctl selectors

#define     kElmoReadBridge        _IOW('G', 0, ElmoIODescriptor)
#define     kElmoWriteBridge       _IOW('G', 1, ElmoIODescriptor)
#define     kElmoReadWindow        _IOW('G', 2, ElmoIODescriptor)
#define     kElmoWriteWindow       _IOW('G', 3, ElmoIODescriptor)
#define     kElmoDownloadPLD       _IOW('G', 4, ElmoPLDDescriptor)
#define     kElmoInitDone          _IO('G', 5)
#define     kElmoSetDebugMode      _IOR('G', 6, unsigned long)
#define     kElmoResetFIFOs        _IO('G', 7)
#define     kElmoReserve           _IO('G', 8)
#define     kElmoRelease           _IO('G', 9)
#define     kElmoReadFifoReset     _IO('G', 10)
#define     kElmoReportDiagMode    _IOR('G', 11, unsigned long)
#define     kElmoWriteBridgeMasked _IOW('G', 12, ElmoMaskDescriptor)
#define     kElmoResetESS          _IO('G', 13)

// Exported functions for other drivers to use

#ifdef __KERNEL__

int ElmoReadBridge(unsigned long address, unsigned long length, void *data );
int ElmoWriteBridge(unsigned long address, unsigned long length, void *data );
int ElmoWriteBridgeMasked(unsigned long address, unsigned short mask, unsigned short bits );

#define kElmoBControlRegAddr (unsigned long) 0x00000000

#define kElmoBControlRegSpdifInputMask (unsigned short) 0xFFBF
#define kElmoBControlRegSpdifInput7020  (unsigned short) 0x0000
#define kElmoBControlRegSpdifInputCDDA  (unsigned short) 0x0040

#define kElmoBControlRegAudioClkMask (unsigned short) 0xFE7F
#define kElmoBControlRegAudioClk96KHz  (unsigned short) 0x0000
#define kElmoBControlRegAudioClk441KHz  (unsigned short) 0x0080
#define kElmoBControlRegAudioClk32KHz  (unsigned short) 0x0100
#define kElmoBControlRegAudioClk48KHz  (unsigned short) 0x0180

#define kElmoBControlRegAudioOutMask (unsigned short) 0xFDFF
#define kElmoBControlRegAudioOutMute (unsigned short) 0x0000
#define kElmoBControlRegAudioOutUnmute (unsigned short) 0x0200

#endif


