OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [WizNET_DEMO_TERN_186/] [include/] [ae.H] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 585 jeremybenn
#ifndef _AE_H_
2
#define _AE_H_
3
 
4
/*********************************************************************
5
        ae.h            headers for AM188ES   6-20-99   7-16-98
6
*********************************************************************/
7
/*  Data structure for Serial operation */
8
 
9
typedef struct  {
10
        unsigned char ready;          /* TRUE when ready */
11
        unsigned char baud;
12
        unsigned int mode;
13
        unsigned char iflag;     /* interrupt status     */
14
        unsigned char* in_buf;        /* Input buffer */
15
        unsigned int in_tail;        /* Input buffer TAIL ptr */
16
        unsigned int in_head;        /* Input buffer HEAD ptr */
17
        unsigned int in_size;        /* Input buffer size */
18
        unsigned int in_crcnt;       /* Input  count */
19
        unsigned char in_mt;          /* Input buffer FLAG */
20
        unsigned char in_full;        /* input buffer full */
21
        unsigned char* out_buf;       /* Output buffer */
22
        unsigned int out_tail;       /* Output buffer TAIL ptr */
23
        unsigned int out_head;       /* Output buffer HEAD ptr */
24
        unsigned int out_size;       /* Output buffer size */
25
        unsigned char out_full;       /* Output buffer FLAG */
26
        unsigned char out_mt;         /* Output buffer MT */
27
        unsigned char tmso;     // transmit macro service operation
28
        unsigned char rts;
29
        unsigned char dtr;
30
        unsigned char en485;
31
        unsigned char err;
32
        unsigned char node;
33
        unsigned char cr; /* scc CR register    */
34
        unsigned char slave;
35
        unsigned int in_segm;       /* input buffer segment */
36
        unsigned int in_offs;       /* input buffer offset */
37
        unsigned int out_segm;       /* output buffer segment */
38
        unsigned int out_offs;       /* output buffer offset */
39
        unsigned char byte_delay;       /* V25 macro service byte delay */
40
} COM;
41
 
42
 
43
typedef struct{
44
        unsigned char sec1;
45
        unsigned char sec10;
46
        unsigned char min1;
47
        unsigned char min10;
48
        unsigned char hour1;
49
        unsigned char hour10;
50
        unsigned char day1;
51
        unsigned char day10;
52
        unsigned char mon1;
53
        unsigned char mon10;
54
        unsigned char year1;
55
        unsigned char year10;
56
        unsigned char wk;
57
} TIM;
58
 
59
void ae_init(void);
60
void ae_reset(void);
61
void led(int i);      //P12 used for led
62
void delay_ms(int m);
63
void delay0(unsigned int t);
64
void    HLPRsetvect(
65
                                unsigned int    wVec,           /* Interrupt vector number */
66
                                void    far             *ih             /* Interrupt handler to install */
67
                        );
68
 
69
void clka_en(int i);
70
void clkb_en(int i);
71
void pwr_save_en(int i);
72
void hitwd(void);
73
 
74
//
75
//      reset ee to remain enabled for reads
76
//      where s = segment register value pointing to ee starting addr.
77
//              for example = 0x8000
78
//
79
void amd_ee_read_reset(unsigned int s);
80
 
81
//
82
//      sec=0x00-0x07 for AM29F010, 16K/sector
83
//              sec=0   0x00000-0x03fff
84
//              sec=1   0x04000-0x07fff
85
//              sec=2   0x08000-0x0bfff
86
//              sec=3   0x0c000-0x0ffff
87
//              sec=4   0x10000-0x13fff
88
//              sec=5   0x14000-0x17fff
89
//              sec=6   0x18000-0x1bfff
90
//              sec=7   0x1c000-0x1ffff
91
//
92
//      sec=0x10-0x17 for AM29F040
93
//              sec=10  0x00000-0x0ffff
94
//              sec=11  0x10000-0x1ffff
95
//              sec=12  0x20000-0x2ffff
96
//              sec=13  0x30000-0x3ffff
97
//              sec=14  0x40000-0x4ffff
98
//              sec=15  0x50000-0x5ffff
99
//              sec=16  0x60000-0x6ffff
100
//              sec=17  0x70000-0x7ffff
101
//      segm=segment register value pointing to ee address 0
102
// returns:             if pass, return(0);
103
//                              if fail, return(1);
104
//
105
int amd_ee_sec_erase(unsigned int segm, unsigned char sec );
106
 
107
//
108
//      write one byte dat to AM29F040, at address of s:o
109
//      Approximately 70 us for 0 wait, 80us for 1 wait.
110
//              where s=segment register, it is fixed to 0x8000
111
//                              o=offset register
112
// returns:             if pass, return(0);
113
//                              if fail, return(1);
114
//
115
// Be aware of that a data bit "0" can not be programmed back to a "1" !!!
116
// Attempting to do so will hang up the system !!!
117
// you can program the "1"s to "0"s.
118
// Only erase operation can convert "0"s to "1"s
119
//
120
//
121
 
122
int amd_ee_byte_pro_512(unsigned int s, unsigned int o, unsigned char dat);
123
 
124
//
125
//      write one byte dat to AM29F010, at address of s:o, 80us per byte approx.
126
//              where s=segment register, you may use s=0x8000-0xe000
127
//                              o=offset register
128
// returns:             if pass, return(0);
129
//                              if fail, return(1);
130
//
131
// Be aware of that a data bit "0" can not be programmed back to a "1" !!!
132
// Attempting to do so will hang up the system !!!
133
// you can program the "1"s to "0"s.
134
// Only erase operation can convert "0"s to "1"s
135
//
136
 
137
int amd_ee_byte_pro_128(unsigned int s, unsigned int o, unsigned char dat);
138
 
139
//
140
// unsigned char rtc_rds(char* time_string);
141
// put a time string into time_string, based on the reading of RTC.
142
//      At least 15 bytes of buffer must be available for the time_string
143
//      returns 0, if RTC OK, or returns 1, if problem
144
//
145
unsigned char rtc_rds(char* time_string);
146
int rtc_rd(TIM *r);
147
void rtc_init(unsigned char*);
148
unsigned char r_rd(void);
149
int r_out(unsigned char v);
150
 
151
 
152
void t2_init(unsigned int tm,unsigned int ta,void interrupt far(*t2_isr)());
153
void t1_init(unsigned int tm,unsigned int ta,unsigned int tb,void interrupt far(*t1_isr)());
154
void t0_init(unsigned int tm,unsigned int ta,unsigned int tb,void interrupt far(*t0_isr)());
155
unsigned int t2_rd(void);
156
unsigned int t1_rd(void);
157
unsigned int t0_rd(void);
158
 
159
//      Analog to Digital conversion using TLC2543 on the A-Engine-88/86
160
//      Input:
161
//              unsigned char c = input channel
162
//              c = 0,  input ch = AD0
163
//              c = 1,  input ch = AD1
164
//              c = 2,  input ch = AD2
165
//              c = 3,  input ch = AD3
166
//              c = 4,  input ch = AD4
167
//              c = 5,  input ch = AD5
168
//              c = 6,  input ch = AD6
169
//              c = 7,  input ch = AD7
170
//              c = 8,  input ch = AD8
171
//              c = 9,  input ch = AD9
172
//              c = a,  input ch = AD10
173
//      In order to operate ADC, P11 must be input.
174
//      P11 is shared by RTC, EE. It must be high while power on/reset
175
//      For AE88, using PPI for ADC, I20,I21,I22 must be output
176
//      For AE86, using PAL for ADC, T0=CLK, T1=DIN, T2=ADCS
177
//              Enter the ae_ad12(unsigned char c);  EE is stopped first.
178
//              Enter the ae86_ad12(unsigned char c);  EE is stopped first.
179
//
180
//      Output: 12 bit AD data of the previous channel !
181
//              Unipolar:
182
//              (Vref+ - Vref-)=0x7ff
183
//              Vref- = 0x000
184
//              Vref+ = 0xfff
185
//
186
//
187
int ae_ad12(unsigned char c);
188
 
189
//      outportb(0x120,1);  // T0=0, CLK
190
//      outportb(0x128,1);  // T1=0, DIN
191
//      outportb(0x130,1);  // T2=0, ADCS
192
int ae86_ad12(unsigned char c);
193
 
194
void nmi_init(void interrupt far (* nmi_isr)());
195
void int0_init(unsigned char i, void interrupt far (*int0_isr)());
196
void int1_init(unsigned char i, void interrupt far (*int1_isr)());
197
void int2_init(unsigned char i, void interrupt far (*int2_isr)());
198
void int3_init(unsigned char i, void interrupt far (*int3_isr)());
199
void int4_init(unsigned char i, void interrupt far (*int4_isr)());
200
void int5_init(unsigned char i, void interrupt far (*int5_isr)());
201
void int6_init(unsigned char i, void interrupt far (*int6_isr)());
202
 
203
 
204
//
205
// void pio_init(char bit, char mode)
206
//      where bit=0-31
207
//                      mode=0, Normal operation
208
//                      mode=1, Input with pullup/down
209
//                      mode=2, Output
210
//                      mode=3, input without pull
211
//
212
void pio_init(char bit, char mode);
213
 
214
 
215
//
216
//      void pio_wr(char bit, char dat)
217
//      where bit=0-31
218
//              dat=0/1
219
//
220
void pio_wr(char bit, char dat);
221
 
222
//
223
// unsigned int pio_rd(char port)
224
//      return P15-P0, if port=0
225
//      return P31-P16, if port=1
226
//
227
unsigned int pio_rd(char port);
228
 
229
// setup I/O wait states for I/O instructions
230
//      where wait = 0-7
231
//      wait=0,                 wait states = 0, I/O enable for 100 ns
232
//      wait=1,                 wait states = 1, I/O enable for 100+25 ns
233
//      wait=2,                 wait states = 2, I/O enable for 100+50 ns
234
//      wait=3,                 wait states = 3, I/O enable for 100+75 ns
235
//      wait=4,                 wait states = 5, I/O enable for 100+125 ns
236
//      wait=5,                 wait states = 7, I/O enable for 100+175 ns
237
//      wait=6,                 wait states = 9, I/O enable for 100+225 ns
238
//      wait=7,                 wait states = 15, I/O enable for 100+375 ns
239
void io_wait(char wait);
240
 
241
unsigned int crc16(unsigned char *wptr, unsigned int count);
242
 
243
/******************************************************
244
        void ae_da(int dat1, int dat2)
245
        output dat to U11 DAC of AE88
246
        Requires P12=CLK, P26=DI, P29=LD/CS as output pins !
247
        where dat1 for channel A, dat2 for channel B;   dat1/2 = 0-4095
248
*******************************************************/
249
void ae_da(int dat1, int dat2);
250
 
251
/******************************************************
252
        void ae86_da(int dat1, int dat2)
253
        output dat to U15 DAC of AE86
254
        Requires T0=CLK=0x120, T1=DI=0x128, T3=LD/CS=0x138
255
        where dat1 for channel A, dat2 for channel B;   dat1/2 = 0-4095
256
        Output 0-2.5V at VA=J4.16, VB=J4.18
257
*******************************************************/
258
void ae86_da(int dat1, int dat2);
259
void interrupt reset_io_trap();
260
 
261
#endif
262
 
263
 
264


powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.