1 /* -*- Mode: c++ -*-
2  *
3  *  Copyright 2000 Massachusetts Institute of Technology
4  *
5  *  Permission to use, copy, modify, distribute, and sell this software and its
6  *  documentation for any purpose is hereby granted without fee, provided that
7  *  the above copyright notice appear in all copies and that both that
8  *  copyright notice and this permission notice appear in supporting
9  *  documentation, and that the name of M.I.T. not be used in advertising or
10  *  publicity pertaining to distribution of the software without specific,
11  *  written prior permission.  M.I.T. makes no representations about the
12  *  suitability of this software for any purpose.  It is provided "as is"
13  *  without express or implied warranty.
14  *
15  */
16 
17 #ifndef OMNIMETER_H
18 #define OMNIMETER_H
19 // use the address of the second socket for both sockets
20 // (divide address space in half and use offsets to wrap second card accesses back to start of address space)
21 // Following values for programming Cirrus Logic chip
22 #define Socket1Base 0x40
23 
24 #define SocketMemoryWindowLen    (0x00400000)
25 #define Socket0MemoryWindowStart (0x00800000)
26 #define Socket1MemoryWindowStart (Socket0MemoryWindowStart + SocketMemoryWindowLen)
27 
28 #define SocketIOWindowLen        (0x00008000)
29 #define Socket1IOWindowStart     (SocketIOWindowLen)
30 #define Socket1IOWindowOffset    (0x00010000 - Socket1IOWindowStart)
31 
32 // Following values for run-time access
33 
34 //#define PCCardBase     (0xe4000000) //jca (0x30000000)
35 //#define PCCardBase     (0x30000000)
36 #define PCCardBase     (0xe0000000)  //jag
37 
38 #define PCCard0IOBase (PCCardBase)
39 //#define PCCard0AttrBase (0xec000000) //jca (PCCardBase + 0x08000000)
40 #define PCCard0AttrBase (0xe8000000)
41 //#define PCCard0AttrBase (PCCardBase + 0x08000000)
42 //#define PCCard0MemBase (0xf4000000) //jca (PCCardBase + 0x0C000000)
43 //#define PCCard0MemBase (PCCardBase + 0x0C000000)
44 #define PCCard0MemBase (0xf0000000)
45 
46 //#define PCCard1IOBase (PCCardBase + SocketIOWindowLen)  //jag
47 #define PCCard1IOBase (0xe4000000)
48 //#define PCCard1AttrBase (0xec000000 + SocketMemoryWindowLen)  //jag
49 #define PCCard1AttrBase (0xec000000)
50 //#define PCCard1MemBase (0xf4000000 + SocketMemoryWindowLen)  //jag
51 #define PCCard1MemBase (0xf4000000)
52 
53 #define PCCardIndexRegister (PCCard0IOBase + 0x000003E0) //altered
54 #define PCCardDataRegister  (PCCardIndexRegister + 1)
55 
56 /* interrupts */
57 #define PIN_cardInt2	13
58 #define PIN_cardInt1	5
59 
60 void SMBOn(unsigned char SMBaddress);
61 void SetSMB(unsigned char SMBaddress, unsigned int dacValue);
62 
63 #define GPIO_key6	0x00040000
64 #define GPIO_scl	0x01000000  // output,   SMB clock
65 #define GPIO_sda	0x02000000  // bidirect, SMB data
66 #define SMB_LCDVEE 0x2C
67 #define DefaultLCDContrast	16
68 
69 #define LEDBacklightOn()	ClearGPIOpin(GPIO_key6)
70 #define LEDBacklightOff()	SetGPIOpin(GPIO_key6)
71 #define LCDPowerOn()			SMBOn(SMB_LCDVEE)
72 #define LCDPowerOff()			SMBOff(SMB_LCDVEE)
73 #define SetLCDContrast(d)		SetSMB(SMB_LCDVEE, d)
74 #define WritePort32(port,value) (port = (value))
75 #define ReadPort32(port) (port)
76 #define SetGPIOpin(pin)		WritePort32(GPSR,pin)
77 #define ClearGPIOpin(pin)	WritePort32(GPCR,pin)
78 
79 void jcaoutb(long p, unsigned char data);
80 unsigned char jcainb(long p);
81 void jcaoutw(long p, unsigned short data);
82 unsigned short jcainw_p(long p);
83 
84 #endif
85