AVR32: sync with latest Atmel source (closes #3371)
[openwrt.git] / target / linux / at91 / image / dfboot / src / embedded_services.h
1 //*----------------------------------------------------------------------------
2 //* ATMEL Microcontroller Software Support - ROUSSET -
3 //*----------------------------------------------------------------------------
4 //* The software is delivered "AS IS" without warranty or condition of any
5 //* kind, either express, implied or statutory. This includes without
6 //* limitation any warranty or condition with respect to merchantability or
7 //* fitness for any particular purpose, or against the infringements of
8 //* intellectual property rights of others.
9 //*----------------------------------------------------------------------------
10 //* File Name : embedded_sevices.h
11 //* Object : Header File with all the embedded software services definitions
12 //*
13 //* 1.0 24 Jan 2003 FB : Creation
14 //*----------------------------------------------------------------------------
15 #ifndef embedded_sevices_h
16 #define embedded_sevices_h
17
18 #include "AT91RM9200.h"
19
20 #define AT91C_BASE_ROM (char *)0x00100000
21
22 /* Return values */
23 #define AT91C_BUFFER_SUCCESS 0
24 #define AT91C_BUFFER_ERROR_SHIFT 16
25 #define AT91C_BUFFER_ERROR (0x0F << AT91C_BUFFER_ERROR_SHIFT)
26
27 #define AT91C_BUFFER_OVERFLOW (0x01 << AT91C_BUFFER_ERROR_SHIFT)
28 #define AT91C_BUFFER_UNDERRUN (0x02 << AT91C_BUFFER_ERROR_SHIFT)
29
30 typedef unsigned int AT91S_BufferStatus;
31
32 struct _AT91S_Pipe;
33
34 // This structure is a virtual object of a buffer
35 typedef struct _AT91S_Buffer
36 {
37 struct _AT91S_Pipe *pPipe;
38 void *pChild;
39
40 // Functions invoked by the pipe
41 AT91S_BufferStatus (*SetRdBuffer) (struct _AT91S_Buffer *pSBuffer, char *pBuffer, unsigned int Size);
42 AT91S_BufferStatus (*SetWrBuffer) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer, unsigned int Size);
43 AT91S_BufferStatus (*RstRdBuffer) (struct _AT91S_Buffer *pSBuffer);
44 AT91S_BufferStatus (*RstWrBuffer) (struct _AT91S_Buffer *pSBuffer);
45 char (*MsgWritten) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer);
46 char (*MsgRead) (struct _AT91S_Buffer *pSBuffer, char const *pBuffer);
47 // Functions invoked by the peripheral
48 AT91S_BufferStatus (*GetWrBuffer) (struct _AT91S_Buffer *pSBuffer, char const **pData, unsigned int *pSize);
49 AT91S_BufferStatus (*GetRdBuffer) (struct _AT91S_Buffer *pSBuffer, char **pData, unsigned int *pSize);
50 AT91S_BufferStatus (*EmptyWrBuffer) (struct _AT91S_Buffer *pSBuffer, unsigned int size);
51 AT91S_BufferStatus (*FillRdBuffer) (struct _AT91S_Buffer *pSBuffer, unsigned int size);
52 char (*IsWrEmpty) (struct _AT91S_Buffer *pSBuffer);
53 char (*IsRdFull) (struct _AT91S_Buffer *pSBuffer);
54 } AT91S_Buffer, *AT91PS_Buffer;
55
56 // ===========================================================================================
57 // SimpleBuffer definition
58 //
59 // This structure is pointed by pRealBuffer field in the SBuffer
60 // It contains usefull information for a real implementation of
61 // a SBuffer object.
62 // The application just create an instance of SSBUffer and SBuffer,
63 // call OpenSimpleBuffer, and continue using SBuffer instance
64
65 typedef struct _AT91S_SBuffer
66 {
67 AT91S_Buffer parent;
68 char *pRdBuffer;
69 char const *pWrBuffer;
70 unsigned int szRdBuffer;
71 unsigned int szWrBuffer;
72 unsigned int stRdBuffer;
73 unsigned int stWrBuffer;
74 } AT91S_SBuffer, *AT91PS_SBuffer;
75
76 typedef AT91PS_Buffer (*AT91PF_OpenSBuffer) (AT91PS_SBuffer);
77
78 // This function is called by the application
79 extern AT91PS_Buffer AT91F_OpenSBuffer(AT91PS_SBuffer pBuffer);
80
81 // Functions invoked by the pipe
82 extern AT91S_BufferStatus AT91F_SbSetRdBuffer (AT91PS_Buffer pBuffer, char *pData, unsigned int Size);
83 extern AT91S_BufferStatus AT91F_SbSetWrBuffer (AT91PS_Buffer pBuffer, char const *pData, unsigned int Size);
84 extern AT91S_BufferStatus AT91F_SbRstRdBuffer (AT91PS_Buffer pBuffer);
85 extern AT91S_BufferStatus AT91F_SbRstWrBuffer (AT91PS_Buffer pBuffer);
86 extern char AT91F_SbMsgWritten (AT91PS_Buffer pBuffer, char const *pMsg);
87 extern char AT91F_SbMsgRead (AT91PS_Buffer pBuffer, char const *pMsg);
88 // Functions invoked by the peripheral
89 extern AT91S_BufferStatus AT91F_SbGetWrBuffer (AT91PS_Buffer pBuffer, char const **pData, unsigned int *pSize);
90 extern AT91S_BufferStatus AT91F_SbGetRdBuffer (AT91PS_Buffer pBuffer, char **pData, unsigned int *pSize);
91 extern AT91S_BufferStatus AT91F_SbEmptyWrBuffer(AT91PS_Buffer pBuffer, unsigned int size);
92 extern AT91S_BufferStatus AT91F_SbFillRdBuffer (AT91PS_Buffer pBuffer, unsigned int size);
93 extern char AT91F_SbIsWrEmpty (AT91PS_Buffer pBuffer);
94 extern char AT91F_SbIsRdFull (AT91PS_Buffer pBuffer);
95
96 #ifdef DBG_DRV_BUFFER
97 extern char const *AT91F_SbGetError(AT91S_BufferStatus errorNumber);
98 #endif
99
100
101 #define AT91C_OPEN_CTRLTEMPO_SUCCESS 0
102 #define AT91C_ERROR_OPEN_CTRLTEMPO 1
103 #define AT91C_START_OK 2
104 #define AT91C_STOP_OK 3
105 #define AT91C_TIMEOUT_REACHED 4
106
107 typedef enum _AT91E_SvcTempo {
108 AT91E_SVCTEMPO_DIS,
109 AT91E_SVCTEMPO_EN
110 } AT91E_SvcTempo;
111
112 typedef unsigned int AT91S_TempoStatus;
113
114 // AT91S_SvcTempo
115 typedef struct _AT91S_SvcTempo
116 {
117
118 // Methods:
119 AT91S_TempoStatus (*Start) (
120 struct _AT91S_SvcTempo *pSvc,
121 unsigned int timeout,
122 unsigned int reload,
123 void (*callback) (AT91S_TempoStatus, void *),
124 void *pData);
125 AT91S_TempoStatus (*Stop) (struct _AT91S_SvcTempo *pSvc);
126
127 struct _AT91S_SvcTempo *pPreviousTempo;
128 struct _AT91S_SvcTempo *pNextTempo;
129
130 // Data
131 unsigned int TickTempo; //* timeout value
132 unsigned int ReloadTempo;//* Reload value for periodic execution
133 void (*TempoCallback)(AT91S_TempoStatus, void *);
134 void *pPrivateData;
135 AT91E_SvcTempo flag;
136 } AT91S_SvcTempo, *AT91PS_SvcTempo;
137
138
139 // AT91S_CtrlTempo
140 typedef struct _AT91S_CtlTempo
141 {
142 // Members:
143
144 // Start and stop for Timer hardware
145 AT91S_TempoStatus (*CtlTempoStart) (void *pTimer);
146 AT91S_TempoStatus (*CtlTempoStop) (void *pTimer);
147
148 // Start and stop for Tempo service
149 AT91S_TempoStatus (*SvcTempoStart) (
150 struct _AT91S_SvcTempo *pSvc,
151 unsigned int timeout,
152 unsigned int reload,
153 void (*callback) (AT91S_TempoStatus, void *),
154 void *pData);
155 AT91S_TempoStatus (*SvcTempoStop) (struct _AT91S_SvcTempo *pSvc);
156 AT91S_TempoStatus (*CtlTempoSetTime)(struct _AT91S_CtlTempo *pCtrl, unsigned int NewTime);
157 AT91S_TempoStatus (*CtlTempoGetTime)(struct _AT91S_CtlTempo *pCtrl);
158 AT91S_TempoStatus (*CtlTempoIsStart)(struct _AT91S_CtlTempo *pCtrl);
159 AT91S_TempoStatus (*CtlTempoCreate) (
160 struct _AT91S_CtlTempo *pCtrl,
161 struct _AT91S_SvcTempo *pTempo);
162 AT91S_TempoStatus (*CtlTempoRemove) (
163 struct _AT91S_CtlTempo *pCtrl,
164 struct _AT91S_SvcTempo *pTempo);
165 AT91S_TempoStatus (*CtlTempoTick) (struct _AT91S_CtlTempo *pCtrl);
166
167 // Data:
168
169 void *pPrivateData; // Pointer to devived class
170 void const *pTimer; // hardware
171 AT91PS_SvcTempo pFirstTempo;
172 AT91PS_SvcTempo pNewTempo;
173 } AT91S_CtlTempo, *AT91PS_CtlTempo;
174 typedef AT91S_TempoStatus (*AT91PF_OpenCtlTempo) ( AT91PS_CtlTempo, void const *);
175
176 // This function is called by the application.
177 extern AT91S_TempoStatus AT91F_OpenCtlTempo( AT91PS_CtlTempo pCtrlTempo, void const *pTempoTimer );
178
179 extern AT91S_TempoStatus AT91F_STStart (void *);
180 extern AT91S_TempoStatus AT91F_STStop (void *);
181 extern AT91S_TempoStatus AT91F_STSetTime (AT91PS_CtlTempo, unsigned int);
182 extern AT91S_TempoStatus AT91F_STGetTime (AT91PS_CtlTempo);
183 extern AT91S_TempoStatus AT91F_STIsStart (AT91PS_CtlTempo);
184 extern AT91S_TempoStatus AT91F_CtlTempoCreate (AT91PS_CtlTempo, AT91PS_SvcTempo);
185 extern AT91S_TempoStatus AT91F_CtlTempoRemove (AT91PS_CtlTempo, AT91PS_SvcTempo);
186 extern AT91S_TempoStatus AT91F_CtlTempoTick (AT91PS_CtlTempo);
187 extern AT91S_TempoStatus AT91F_SvcTempoStart (
188 AT91PS_SvcTempo pSvc,
189 unsigned int timeout,
190 unsigned int reload,
191 void (*callback) (AT91S_TempoStatus, void *),
192 void *pData);
193 extern AT91S_TempoStatus AT91F_SvcTempoStop (AT91PS_SvcTempo);
194
195
196 // Following types are defined in another header files
197 struct _AT91S_Buffer;
198
199 // Constants:
200 #define AT91C_COMMSVC_SUCCESS 0
201 #define AT91C_COMMSVC_ERROR_SHIFT 8
202 #define AT91C_COMMSVC_ERROR (0x0f << AT91C_COMMSVC_ERROR_SHIFT)
203
204 typedef unsigned int AT91S_SvcCommStatus;
205
206 // AT91S_Service definition
207 // This structure is an abstraction of a communication peripheral
208 typedef struct _AT91S_Service
209 {
210 // Methods:
211 AT91S_SvcCommStatus (*Reset) (struct _AT91S_Service *pService);
212 AT91S_SvcCommStatus (*StartTx)(struct _AT91S_Service *pService);
213 AT91S_SvcCommStatus (*StartRx)(struct _AT91S_Service *pService);
214 AT91S_SvcCommStatus (*StopTx) (struct _AT91S_Service *pService);
215 AT91S_SvcCommStatus (*StopRx) (struct _AT91S_Service *pService);
216 char (*TxReady)(struct _AT91S_Service *pService);
217 char (*RxReady)(struct _AT91S_Service *pService);
218 // Data:
219 struct _AT91S_Buffer *pBuffer; // Link to a buffer object
220 void *pChild;
221 } AT91S_SvcComm, *AT91PS_SvcComm;
222
223 // Constants:
224 #define AT91C_XMODEM_SOH 0x01 /* Start of Heading for 128 bytes */
225 #define AT91C_XMODEM_STX 0x02 /* Start of heading for 1024 bytes */
226 #define AT91C_XMODEM_EOT 0x04 /* End of transmission */
227 #define AT91C_XMODEM_ACK 0x06 /* Acknowledge */
228 #define AT91C_XMODEM_NAK 0x15 /* Negative Acknowledge */
229 #define AT91C_XMODEM_CRCCHR 'C'
230
231 #define AT91C_XMODEM_PACKET_SIZE 2 // packet + packetCRC
232 #define AT91C_XMODEM_CRC_SIZE 2 // crcLSB + crcMSB
233 #define AT91C_XMODEM_DATA_SIZE_SOH 128 // data 128 corresponding to SOH header
234 #define AT91C_XMODEM_DATA_SIZE_STX 1024 // data 1024 corresponding to STX header
235
236 //* Following structure is used by SPipe to refer to the USB device peripheral endpoint
237 typedef struct _AT91PS_SvcXmodem {
238
239 // Public Methods:
240 AT91S_SvcCommStatus (*Handler) (struct _AT91PS_SvcXmodem *, unsigned int);
241 AT91S_SvcCommStatus (*StartTx) (struct _AT91PS_SvcXmodem *, unsigned int);
242 AT91S_SvcCommStatus (*StopTx) (struct _AT91PS_SvcXmodem *, unsigned int);
243
244 // Private Methods:
245 AT91S_SvcCommStatus (*ReadHandler) (struct _AT91PS_SvcXmodem *, unsigned int csr);
246 AT91S_SvcCommStatus (*WriteHandler) (struct _AT91PS_SvcXmodem *, unsigned int csr);
247 unsigned short (*GetCrc) (char *ptr, unsigned int count);
248 char (*CheckHeader) (unsigned char currentPacket, char *packet);
249 char (*CheckData) (struct _AT91PS_SvcXmodem *);
250
251 AT91S_SvcComm parent; // Base class
252 AT91PS_USART pUsart;
253
254 AT91S_SvcTempo tempo; // Link to a AT91S_Tempo object
255
256 char *pData;
257 unsigned int dataSize; // = XMODEM_DATA_STX or XMODEM_DATA_SOH
258 char packetDesc[AT91C_XMODEM_PACKET_SIZE];
259 unsigned char packetId; // Current packet
260 char packetStatus;
261 char isPacketDesc;
262 char eot; // end of transmition
263 } AT91S_SvcXmodem, *AT91PS_SvcXmodem;
264
265 typedef AT91PS_SvcComm (*AT91PF_OpenSvcXmodem) ( AT91PS_SvcXmodem, AT91PS_USART, AT91PS_CtlTempo);
266
267 // This function is called by the application.
268 extern AT91PS_SvcComm AT91F_OpenSvcXmodem( AT91PS_SvcXmodem, AT91PS_USART, AT91PS_CtlTempo);
269
270 extern unsigned short AT91F_SvcXmodemGetCrc (char *ptr, unsigned int count);
271 extern char AT91F_SvcXmodemCheckHeader(unsigned char currentPacket, char *packet);
272 extern char AT91F_SvcXmodemCheckData (AT91PS_SvcXmodem pSvcXmodem);
273 extern AT91S_SvcCommStatus AT91F_SvcXmodemReadHandler(AT91PS_SvcXmodem pSvcXmodem, unsigned int csr);
274 extern AT91S_SvcCommStatus AT91F_SvcXmodemWriteHandler(AT91PS_SvcXmodem pSvcXmodem, unsigned int csr);
275 extern AT91S_SvcCommStatus AT91F_SvcXmodemStartTx(AT91PS_SvcComm pSvcComm);
276 extern AT91S_SvcCommStatus AT91F_SvcXmodemStopTx(AT91PS_SvcComm pSvcComm);
277 extern AT91S_SvcCommStatus AT91F_SvcXmodemStartRx(AT91PS_SvcComm pSvcComm);
278 extern AT91S_SvcCommStatus AT91F_SvcXmodemStopRx(AT91PS_SvcComm pSvcComm);
279 extern char AT91F_SvcXmodemTxReady(AT91PS_SvcComm pService);
280 extern char AT91F_SvcXmodemRxReady(AT91PS_SvcComm pSvcComm);
281
282
283 // Constants:
284 #define AT91C_PIPE_SUCCESS 0
285 #define AT91C_PIPE_ERROR_SHIFT 8
286 #define AT91C_PIPE_ERROR (0x0F << AT91C_PIPE_ERROR_SHIFT)
287
288 #define AT91C_PIPE_OPEN_FAILED (1 << AT91C_PIPE_ERROR_SHIFT)
289 #define AT91C_PIPE_WRITE_FAILED (2 << AT91C_PIPE_ERROR_SHIFT)
290 #define AT91C_PIPE_WRITE_ABORTED (3 << AT91C_PIPE_ERROR_SHIFT)
291 #define AT91C_PIPE_READ_FAILED (4 << AT91C_PIPE_ERROR_SHIFT)
292 #define AT91C_PIPE_READ_ABORTED (5 << AT91C_PIPE_ERROR_SHIFT)
293 #define AT91C_PIPE_ABORT_FAILED (6 << AT91C_PIPE_ERROR_SHIFT)
294 #define AT91C_PIPE_RESET_FAILED (7 << AT91C_PIPE_ERROR_SHIFT)
295
296 /* _AT91S_Pipe stucture */
297 typedef unsigned int AT91S_PipeStatus;
298
299 typedef struct _AT91S_Pipe
300 {
301 // A pipe is linked with a peripheral and a buffer
302 AT91PS_SvcComm pSvcComm;
303 AT91PS_Buffer pBuffer;
304
305 // Callback functions with their arguments
306 void (*WriteCallback) (AT91S_PipeStatus, void *);
307 void (*ReadCallback) (AT91S_PipeStatus, void *);
308 void *pPrivateReadData;
309 void *pPrivateWriteData;
310
311 // Pipe methods
312 AT91S_PipeStatus (*Write) (
313 struct _AT91S_Pipe *pPipe,
314 char const * pData,
315 unsigned int size,
316 void (*callback) (AT91S_PipeStatus, void *),
317 void *privateData);
318 AT91S_PipeStatus (*Read) (
319 struct _AT91S_Pipe *pPipe,
320 char *pData,
321 unsigned int size,
322 void (*callback) (AT91S_PipeStatus, void *),
323 void *privateData);
324 AT91S_PipeStatus (*AbortWrite) (
325 struct _AT91S_Pipe *pPipe);
326 AT91S_PipeStatus (*AbortRead) (
327 struct _AT91S_Pipe *pPipe);
328 AT91S_PipeStatus (*Reset) (
329 struct _AT91S_Pipe *pPipe);
330 char (*IsWritten) (
331 struct _AT91S_Pipe *pPipe,
332 char const *pVoid);
333 char (*IsReceived) (
334 struct _AT91S_Pipe *pPipe,
335 char const *pVoid);
336 } AT91S_Pipe, *AT91PS_Pipe;
337
338 // types used in AT91S_Pipe
339 typedef AT91PS_Pipe (*AT91PF_OpenPipe) (AT91PS_Pipe, AT91PS_SvcComm, AT91PS_Buffer);
340 typedef void (*AT91PF_PipeWriteCallBack) (AT91S_PipeStatus, void *);
341 typedef void (*AT91PF_PipeReadCallBack) (AT91S_PipeStatus, void *);
342 typedef AT91S_PipeStatus (*AT91PF_PipeWrite) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
343 typedef AT91S_PipeStatus (*AT91PF_PipeRead) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
344 typedef AT91S_PipeStatus (*AT91PF_PipeAbortWrite) (AT91PS_Pipe);
345 typedef AT91S_PipeStatus (*AT91PF_PipeAbortRead) (AT91PS_Pipe);
346 typedef AT91S_PipeStatus (*AT91PF_PipeReset) (AT91PS_Pipe);
347 typedef char (*AT91PF_PipeIsWritten) (AT91PS_Pipe, char const *);
348 typedef char (*AT91PF_PipeIsReceived) (AT91PS_Pipe, char const *);
349
350 // This function is called by the application
351 extern AT91PS_Pipe AT91F_OpenPipe(
352 AT91PS_Pipe pPipe,
353 AT91PS_SvcComm pSvcComm,
354 AT91PS_Buffer pBuffer);
355
356 // Following functions are called through AT91S_Pipe pointers
357
358 extern AT91S_PipeStatus AT91F_PipeWrite(
359 AT91PS_Pipe pPipe,
360 char const *pVoid,
361 unsigned int size,
362 AT91PF_PipeWriteCallBack callback,
363 void *privateData);
364 extern AT91S_PipeStatus AT91F_PipeRead(
365 AT91PS_Pipe pPipe,
366 char *pVoid,
367 unsigned int Size,
368 AT91PF_PipeReadCallBack callback,
369 void *privateData);
370 extern AT91S_PipeStatus AT91F_PipeAbortWrite(AT91PS_Pipe pPipe);
371 extern AT91S_PipeStatus AT91F_PipeAbortRead(AT91PS_Pipe pPipe);
372 extern AT91S_PipeStatus AT91F_PipeReset(AT91PS_Pipe pPipe);
373 extern char AT91F_PipeMsgWritten(AT91PS_Pipe pPipe, char const *pVoid);
374 extern char AT91F_PipeMsgReceived(AT91PS_Pipe pPipe, char const *pVoid);
375
376 #ifdef DBG_DRV_PIPE
377 // This function parse the error number and return a string
378 // describing the error message
379 extern char const *AT91F_PipeGetError(AT91S_PipeStatus msgId);
380 #endif
381
382 extern const unsigned char bit_rev[256];
383
384 extern void CalculateCrc32(const unsigned char *,unsigned int, unsigned int *);
385 extern void CalculateCrc16(const unsigned char *, unsigned int , unsigned short *);
386 extern void CalculateCrcHdlc(const unsigned char *, unsigned int, unsigned short *);
387 extern void CalculateCrc16ccitt(const unsigned char *, unsigned int , unsigned short *);
388
389 typedef const unsigned char* AT91PS_SVC_CRC_BIT_REV ;
390
391 typedef void (*AT91PF_SVC_CRC32) (const unsigned char *, unsigned int, unsigned int *);
392 typedef void (*AT91PF_SVC_CRC16) (const unsigned char *, unsigned int, unsigned short *);
393 typedef void (*AT91PF_SVC_CRCHDLC) (const unsigned char *, unsigned int, unsigned short *);
394 typedef void (*AT91PF_SVC_CRCCCITT)(const unsigned char *, unsigned int , unsigned short *);
395
396
397 typedef short (*AT91PF_Sinus) (int angle);
398 typedef const short * AT91PS_SINE_TAB;
399
400 extern short AT91F_Sinus(int angle);
401 extern const short AT91C_SINUS180_TAB[256];
402
403
404 typedef void (TypeAICHandler) (void) ;
405
406
407 // ROM BOOT Structure Element Definition (liv v2)
408 typedef struct _AT91S_MEMCDesc
409 {
410 AT91PS_MC memc_base ; /* Peripheral base */
411 unsigned char periph_id ; /* MC Peripheral Identifier */
412 } AT91S_MEMCDesc, *AT91PS_MEMCDesc ;
413
414 typedef struct _AT91S_Pio2Desc
415 {
416 AT91PS_PIO pio_base ; /* Base Address */
417 unsigned char periph_id ; /* Peripheral Identifier */
418 unsigned char pio_number ; /* Total Pin Number */
419 } AT91S_Pio2Desc, *AT91PS_Pio2Desc ;
420
421 typedef struct _AT91S_SPIDesc
422 {
423 AT91PS_SPI spi_base ;
424 const AT91PS_PIO pio_base ;
425 unsigned char periph_id ;
426 unsigned char pin_spck ;
427 unsigned char pin_miso ;
428 unsigned char pin_mosi ;
429 unsigned char pin_npcs[4] ;
430 } AT91S_SPIDesc, *AT91PS_SPIDesc ;
431
432 typedef struct _AT91S_USART2Desc
433 {
434 AT91PS_USART usart_base ; /* Peripheral base */
435 const AT91PS_PIO pio_base ; /* IO controller descriptor */
436 unsigned int pin_rxd ; /* RXD pin number in the PIO */
437 unsigned int pin_txd ; /* TXD pin number in the PIO */
438 unsigned int pin_sck ; /* SCK pin number in the PIO */
439 unsigned int pin_rts ; /* RTS pin number in the PIO */
440 unsigned int pin_cts ; /* CTS pin number in the PIO */
441 unsigned int pin_dtr ; /* DTR pin number in the PIO */
442 unsigned int pin_ri ; /* RI pin number in the PIO */
443 unsigned int pin_dsr ; /* DSR pin number in the PIO */
444 unsigned int pin_dcd ; /* DCD pin number in the PIO */
445 unsigned int periph_id ; /* USART Peripheral Identifier */
446 } AT91S_USART2Desc, *AT91PS_USART2Desc ;
447
448 typedef struct _AT91S_TWIDesc
449 {
450 AT91PS_TWI TWI_base ;
451 const AT91PS_PIO pio_base ;
452 unsigned int pin_sck ;
453 unsigned int pin_sda ;
454 unsigned int periph_id;
455 }AT91S_TWIDesc, *AT91PS_TWIDesc;
456
457 typedef struct _AT91S_STDesc
458 {
459 AT91PS_ST st_base ; /* Peripheral base address */
460 TypeAICHandler *AsmSTHandler ; /* Assembly interrupt handler */
461 unsigned char PeriphId ; /* Peripheral Identifier */
462 } AT91S_STDesc, *AT91PS_STDesc;
463
464 typedef struct _AT91S_RomBoot {
465 const unsigned int version;
466 // Peripheral descriptors
467 const AT91S_MEMCDesc MEMC_DESC;
468 const AT91S_STDesc SYSTIMER_DESC;
469 const AT91S_Pio2Desc PIOA_DESC;
470 const AT91S_Pio2Desc PIOB_DESC;
471 const AT91S_USART2Desc DBGU_DESC;
472 const AT91S_USART2Desc USART0_DESC;
473 const AT91S_USART2Desc USART1_DESC;
474 const AT91S_USART2Desc USART2_DESC;
475 const AT91S_USART2Desc USART3_DESC;
476 const AT91S_TWIDesc TWI_DESC;
477 const AT91S_SPIDesc SPI_DESC;
478
479 // Objects entry
480 const AT91PF_OpenPipe OpenPipe;
481 const AT91PF_OpenSBuffer OpenSBuffer;
482 const unsigned int reserved1;
483 const AT91PF_OpenSvcXmodem OpenSvcXmodem;
484 const AT91PF_OpenCtlTempo OpenCtlTempo;
485 const unsigned int reserved2;
486 const unsigned int reserved3;
487 const unsigned int reserved4;
488 const AT91PF_SVC_CRC16 CRC16;
489 const AT91PF_SVC_CRCCCITT CRCCCITT;
490 const AT91PF_SVC_CRCHDLC CRCHDLC;
491 const AT91PF_SVC_CRC32 CRC32;
492 const AT91PS_SVC_CRC_BIT_REV Bit_Reverse_Array;
493 const AT91PS_SINE_TAB SineTab;
494 const AT91PF_Sinus Sine;
495 } AT91S_RomBoot, *AT91PS_RomBoot;
496
497 #define AT91C_ROM_BOOT_ADDRESS ((const AT91S_RomBoot *) ( *((unsigned int *) (AT91C_BASE_ROM + 0x20))) )
498
499 #endif
500
This page took 0.079024 seconds and 5 git commands to generate.