source: rtems/c/src/lib/libbsp/powerpc/ep1a/console/m68360.h @ fb557a9

4.9
Last change on this file since fb557a9 was fb557a9, checked in by Joel Sherrill <joel.sherrill@…>, on 10/16/09 at 16:42:03

2009-10-16 Jennifer Averett <jennifer@…>

  • Makefile.am, configure.ac, preinstall.am, console/alloc360.c, console/config.c, console/console.c, console/m68360.h, console/mc68360_scc.c, console/rsPMCQ1.c, console/rsPMCQ1.h, include/bsp.h, irq/irq_init.c, irq/openpic_xxx_irq.c, start/start.S, startup/bspstart.c, startup/linkcmds, vme/VMEConfig.h: Updated and tested against RTEMS 4.9. Updated README file to latest source status. Modified to use the shared irq source code. Turned off debugging, cleaned up warnings, removed unused code. Tested with two PMCQ1 serial cards. Tested MC68360 serial ports and VME using external tests.
  • README, irq/irq.h, vme/vmeconfig.c: New files.
  • Property mode set to 100644
File size: 33.7 KB
Line 
1/*
2 *  MOTOROLA MC68360 QUAD INTEGRATED COMMUNICATIONS CONTROLLER (QUICC) 
3 *                                                                     
4 *                        HARDWARE DECLARATIONS                       
5 *                                                                   
6 *                                                                 
7 *  Submitted By:                                                 
8 *                                                               
9 *      W. Eric Norum                                           
10 *      Saskatchewan Accelerator Laboratory                     
11 *      University of Saskatchewan                             
12 *      107 North Road                                       
13 *      Saskatoon, Saskatchewan, CANADA                   
14 *      S7N 5C6                                         
15 *                                                   
16 *      eric@skatter.usask.ca                     
17 *                                           
18 *
19 *  COPYRIGHT (c) 1989-2009.
20 *  On-Line Applications Research Corporation (OAR).
21 *
22 *  The license and distribution terms for this file may be
23 *  found in the file LICENSE in this distribution or at
24 *  http://www.rtems.com/license/LICENSE.
25 *
26 *  $Id$
27 */
28
29#ifndef __MC68360_h
30#define __MC68360_h
31
32#include "rsPMCQ1.h"
33
34/*
35 *************************************************************************
36 *                         REGISTER SUBBLOCKS                            *
37 *************************************************************************
38 */
39
40/*
41 * Memory controller registers
42 */
43typedef struct m360MEMCRegisters_ {
44  uint32_t         br;
45  uint32_t         or;
46  uint32_t         _pad[2];
47} m360MEMCRegisters_t;
48
49
50#define M360_GSMR_RFW            0x00000020
51
52#define M360_GSMR_RINV           0x02000000
53#define M360_GSMR_TINV           0x01000000
54#define M360_GSMR_TDCR_16X       0x00020000
55#define M360_GSMR_RDCR_16X       0x00008000
56#define M360_GSMR_DIAG_LLOOP     0x00000040
57#define M360_GSMR_ENR            0x00000020
58#define M360_GSMR_ENT            0x00000010
59#define M360_GSMR_MODE_UART      0x00000004
60
61#define  M360_PSMR_FLC           0x8000
62#define  M360_PSMR_SL_1          0x0000
63#define  M360_PSMR_SL_2          0x4000
64#define  M360_PSMR_CL5           0x0000
65#define  M360_PSMR_CL6           0x1000
66#define  M360_PSMR_CL7           0x2000
67#define  M360_PSMR_CL8           0x3000
68#define  M360_PSMR_UM_NORMAL     0x0000
69#define  M360_PSMR_FRZ           0x0200
70#define  M360_PSMR_RZS           0x0100
71#define  M360_PSMR_SYN           0x0080
72#define  M360_PSMR_DRT           0x0040
73#define  M360_PSMR_PEN           0x0010
74#define  M360_PSMR_RPM_ODD       0x0000
75#define  M360_PSMR_RPM_LOW       0x0004
76#define  M360_PSMR_RPM_EVEN      0x0008
77#define  M360_PSMR_RPM_HI        0x000c
78#define  M360_PSMR_TPM_ODD       0x0000
79#define  M360_PSMR_TPM_LOW       0x0001
80#define  M360_PSMR_TPM_EVEN      0x0002
81#define  M360_PSMR_TPM_HI        0x0003
82
83/*
84 * Serial Communications Controller registers
85 */
86typedef struct m360SCCRegisters_ {
87  uint32_t         gsmr_l;
88  uint32_t         gsmr_h;
89  uint16_t          psmr;
90  uint16_t          _pad0;
91  uint16_t          todr;
92  uint16_t          dsr;
93  uint16_t          scce;
94  uint16_t          _pad1;
95  uint16_t          sccm;
96  uint8_t          _pad2;
97  uint8_t          sccs;
98  uint32_t         _pad3[2];
99} m360SCCRegisters_t;
100
101/*
102 * Serial Management Controller registers
103 */
104typedef struct m360SMCRegisters_ {
105  uint16_t          _pad0;
106  uint16_t          smcmr;
107  uint16_t          _pad1;
108  uint8_t          smce;
109  uint8_t          _pad2;
110  uint16_t          _pad3;
111  uint8_t          smcm;
112  uint8_t          _pad4;
113  uint32_t         _pad5;
114} m360SMCRegisters_t;
115
116
117/*
118 *************************************************************************
119 *                         Miscellaneous Parameters                      *
120 *************************************************************************
121 */
122typedef struct m360MiscParms_ {
123  uint16_t          rev_num;
124  uint16_t          _res1;
125  uint32_t         _res2;
126  uint32_t         _res3;
127} m360MiscParms_t;
128
129/*
130 *************************************************************************
131 *                              RISC Timers                              *
132 *************************************************************************
133 */
134typedef struct m360TimerParms_ {
135  uint16_t          tm_base;
136  uint16_t          _tm_ptr;
137  uint16_t          _r_tmr;
138  uint16_t          _r_tmv;
139  uint32_t         tm_cmd;
140  uint32_t         tm_cnt;
141} m360TimerParms_t;
142
143/*
144 * RISC Controller Configuration Register (RCCR)
145 * All other bits in this register are either reserved or
146 * used only with a Motorola-supplied RAM microcode packge.
147 */
148#define M360_RCCR_TIME    (1<<15)  /* Enable timer */
149#define M360_RCCR_TIMEP(x)  ((x)<<8)  /* Timer period */
150
151/*
152 * Command register
153 * Set up this register before issuing a M360_CR_OP_SET_TIMER command.
154 */
155#define M360_TM_CMD_V    (1<<31)    /* Set to enable timer */
156#define M360_TM_CMD_R    (1<<30)    /* Set for automatic restart */
157#define M360_TM_CMD_TIMER(x)  ((x)<<16)  /* Select timer */
158#define M360_TM_CMD_PERIOD(x)  (x)    /* Timer period (16 bits) */
159
160/*
161 *************************************************************************
162 *                               DMA Controllers                         *
163 *************************************************************************
164 */
165typedef struct m360IDMAparms_ {
166  uint16_t          ibase;
167  uint16_t          ibptr;
168  uint32_t         _istate;
169  uint32_t         _itemp;
170} m360IDMAparms_t;
171
172/*
173 *************************************************************************
174 *                   Serial Communication Controllers                    *
175 *************************************************************************
176 */
177typedef struct m360SCCparms_ {
178  uint16_t          rbase;
179  uint16_t          tbase;
180  uint8_t          rfcr;
181  uint8_t          tfcr;
182  uint16_t          mrblr;
183  uint32_t         _rstate;
184  uint32_t         _pad0;
185  uint16_t          _rbptr;
186  uint16_t          _pad1;
187  uint32_t         _pad2;
188  uint32_t         _tstate;
189  uint32_t         _pad3;
190  uint16_t          _tbptr;
191  uint16_t          _pad4;
192  uint32_t         _pad5;
193  uint32_t         _rcrc;
194  uint32_t         _tcrc;
195  union {
196    struct {
197      uint32_t         _res0;
198      uint32_t         _res1;
199      uint16_t          max_idl;
200      uint16_t          _idlc;
201      uint16_t          brkcr;
202      uint16_t          parec;
203      uint16_t          frmec;
204      uint16_t          nosec;
205      uint16_t          brkec;
206      uint16_t          brklen;
207      uint16_t          uaddr[2];
208      uint16_t          _rtemp;
209      uint16_t          toseq;
210      uint16_t          character[8];
211      uint16_t          rccm;
212      uint16_t          rccr;
213      uint16_t          rlbc;
214    } uart;
215    struct {
216      uint32_t         crc_p;
217      uint32_t         crc_c;
218    } transparent;
219
220  } un;
221} m360SCCparms_t;
222
223typedef struct m360SCCENparms_ {
224  uint16_t          rbase;
225  uint16_t          tbase;
226  uint8_t          rfcr;
227  uint8_t          tfcr;
228  uint16_t          mrblr;
229  uint32_t         _rstate;
230  uint32_t         _pad0;
231  uint16_t          _rbptr;
232  uint16_t          _pad1;
233  uint32_t         _pad2;
234  uint32_t         _tstate;
235  uint32_t         _pad3;
236  uint16_t          _tbptr;
237  uint16_t          _pad4;
238  uint32_t         _pad5;
239  uint32_t         _rcrc;
240  uint32_t         _tcrc;
241  union {
242    struct {
243      uint32_t         _res0;
244      uint32_t         _res1;
245      uint16_t          max_idl;
246      uint16_t          _idlc;
247      uint16_t          brkcr;
248      uint16_t          parec;
249      uint16_t          frmec;
250      uint16_t          nosec;
251      uint16_t          brkec;
252      uint16_t          brklen;
253      uint16_t          uaddr[2];
254      uint16_t          _rtemp;
255      uint16_t          toseq;
256      uint16_t          character[8];
257      uint16_t          rccm;
258      uint16_t          rccr;
259      uint16_t          rlbc;
260    } uart;
261    struct {
262      uint32_t         c_pres;
263      uint32_t         c_mask;
264      uint32_t         crcec;
265      uint32_t         alec;
266      uint32_t         disfc;
267      uint16_t          pads;
268      uint16_t          ret_lim;
269      uint16_t          _ret_cnt;
270      uint16_t          mflr;
271      uint16_t          minflr;
272      uint16_t          maxd1;
273      uint16_t          maxd2;
274      uint16_t          _maxd;
275      uint16_t          dma_cnt;
276      uint16_t          _max_b;
277      uint16_t          gaddr1;
278      uint16_t          gaddr2;
279      uint16_t          gaddr3;
280      uint16_t          gaddr4;
281      uint32_t         _tbuf0data0;
282      uint32_t         _tbuf0data1;
283      uint32_t         _tbuf0rba0;
284      uint32_t         _tbuf0crc;
285      uint16_t          _tbuf0bcnt;
286      uint16_t          paddr_h;
287      uint16_t          paddr_m;
288      uint16_t          paddr_l;
289      uint16_t          p_per;
290      uint16_t          _rfbd_ptr;
291      uint16_t          _tfbd_ptr;
292      uint16_t          _tlbd_ptr;
293      uint32_t         _tbuf1data0;
294      uint32_t         _tbuf1data1;
295      uint32_t         _tbuf1rba0;
296      uint32_t         _tbuf1crc;
297      uint16_t          _tbuf1bcnt;
298      uint16_t          _tx_len;
299      uint16_t          iaddr1;
300      uint16_t          iaddr2;
301      uint16_t          iaddr3;
302      uint16_t          iaddr4;
303      uint16_t          _boff_cnt;
304      uint16_t          taddr_h;
305      uint16_t          taddr_m;
306      uint16_t          taddr_l;
307    } ethernet;
308    struct {
309      uint32_t         crc_p;
310      uint32_t         crc_c;
311    } transparent;
312  } un;
313} m360SCCENparms_t;
314
315/*
316 * Receive and transmit function code register bits
317 * These apply to the function code registers of all devices, not just SCC.
318 */
319#define M360_RFCR_MOT    (1<<4)
320#define M360_RFCR_DMA_SPACE  0x8
321#define M360_TFCR_MOT    (1<<4)
322#define M360_TFCR_DMA_SPACE  0x8
323
324/*
325 *************************************************************************
326 *                     Serial Management Controllers                     *
327 *************************************************************************
328 */
329typedef struct m360SMCparms_ {
330  uint16_t          rbase;
331  uint16_t          tbase;
332  uint8_t          rfcr;
333  uint8_t          tfcr;
334  uint16_t          mrblr;
335  uint32_t         _rstate;
336  uint32_t         _pad0;
337  uint16_t          _rbptr;
338  uint16_t          _pad1;
339  uint32_t         _pad2;
340  uint32_t         _tstate;
341  uint32_t         _pad3;
342  uint16_t          _tbptr;
343  uint16_t          _pad4;
344  uint32_t         _pad5;
345  union {
346    struct {
347      uint16_t          max_idl;
348      uint16_t          _pad0;
349      uint16_t          brklen;
350      uint16_t          brkec;
351      uint16_t          brkcr;
352      uint16_t          _r_mask;
353    } uart;
354    struct {
355      uint16_t          _pad0[5];
356    } transparent;
357  } un;
358} m360SMCparms_t;
359
360/*
361 * Mode register
362 */
363#define M360_SMCMR_CLEN(x)    ((x)<<11)  /* Character length */
364#define M360_SMCMR_2STOP    (1<<10)  /* 2 stop bits */
365#define M360_SMCMR_PARITY    (1<<9)  /* Enable parity */
366#define M360_SMCMR_EVEN      (1<<8)  /* Even parity */
367#define M360_SMCMR_SM_GCI    (0<<4)  /* GCI Mode */
368#define M360_SMCMR_SM_UART    (2<<4)  /* UART Mode */
369#define M360_SMCMR_SM_TRANSPARENT  (3<<4)  /* Transparent Mode */
370#define M360_SMCMR_DM_LOOPBACK    (1<<2)  /* Local loopback mode */
371#define M360_SMCMR_DM_ECHO    (2<<2)  /* Echo mode */
372#define M360_SMCMR_TEN      (1<<1)  /* Enable transmitter */
373#define M360_SMCMR_REN      (1<<0)  /* Enable receiver */
374
375/*
376 * Event and mask registers (SMCE, SMCM)
377 */
378#define M360_SMCE_BRK  (1<<4)
379#define M360_SMCE_BSY  (1<<2)
380#define M360_SMCE_TX  (1<<1)
381#define M360_SMCE_RX  (1<<0)
382
383/*
384 *************************************************************************
385 *                      Serial Peripheral Interface                      *
386 *************************************************************************
387 */
388typedef struct m360SPIparms_ {
389  uint16_t          rbase;
390  uint16_t          tbase;
391  uint8_t          rfcr;
392  uint8_t          tfcr;
393  uint16_t          mrblr;
394  uint32_t         _rstate;
395  uint32_t         _pad0;
396  uint16_t          _rbptr;
397  uint16_t          _pad1;
398  uint32_t         _pad2;
399  uint32_t         _tstate;
400  uint32_t         _pad3;
401  uint16_t          _tbptr;
402  uint16_t          _pad4;
403  uint32_t         _pad5;
404} m360SPIparms_t;
405
406/*
407 * Mode register (SPMODE)
408 */
409#define M360_SPMODE_LOOP    (1<<14)  /* Local loopback mode */
410#define M360_SPMODE_CI      (1<<13)  /* Clock invert */
411#define M360_SPMODE_CP      (1<<12)  /* Clock phase */
412#define M360_SPMODE_DIV16    (1<<11)  /* Divide BRGCLK by 16 */
413#define M360_SPMODE_REV      (1<<10)  /* Reverse data */
414#define M360_SPMODE_MASTER    (1<<9)  /* SPI is master */
415#define M360_SPMODE_EN      (1<<8)  /* Enable SPI */
416#define M360_SPMODE_CLEN(x)    ((x)<<4)  /* Character length */
417#define M360_SPMODE_PM(x)    (x)  /* Prescaler modulus */
418
419/*
420 * Mode register (SPCOM)
421 */
422#define M360_SPCOM_STR      (1<<7)  /* Start transmit */
423
424/*
425 * Event and mask registers (SPIE, SPIM)
426 */
427#define M360_SPIE_MME  (1<<5)    /* Multi-master error */
428#define M360_SPIE_TXE  (1<<4)    /* Tx error */
429#define M360_SPIE_BSY  (1<<2)    /* Busy condition*/
430#define M360_SPIE_TXB  (1<<1)    /* Tx buffer */
431#define M360_SPIE_RXB  (1<<0)    /* Rx buffer */
432
433/*
434 *************************************************************************
435 *                 SDMA (SCC, SMC, SPI) Buffer Descriptors               *
436 *************************************************************************
437 */
438typedef struct m360BufferDescriptor_ {
439  uint16_t          status;
440  uint16_t          length;
441  uint32_t          buffer;  /* this is a void * to the 360 */
442} m360BufferDescriptor_t;
443
444/*
445 * Bits in receive buffer descriptor status word
446 */
447#define M360_BD_EMPTY    (1<<15)  /* Ethernet, SCC UART, SMC UART, SPI */
448#define M360_BD_WRAP    (1<<13)  /* Ethernet, SCC UART, SMC UART, SPI */
449#define M360_BD_INTERRUPT  (1<<12)  /* Ethernet, SCC UART, SMC UART, SPI */
450#define M360_BD_LAST    (1<<11)  /* Ethernet, SPI */
451#define M360_BD_CONTROL_CHAR  (1<<11)  /* SCC UART */
452#define M360_BD_FIRST_IN_FRAME  (1<<10)  /* Ethernet */
453#define M360_BD_ADDRESS    (1<<10)  /* SCC UART */
454#define M360_BD_CONTINUOUS  (1<<9)  /* SCC UART, SMC UART, SPI */
455#define M360_BD_MISS    (1<<8)  /* Ethernet */
456#define M360_BD_IDLE    (1<<8)  /* SCC UART, SMC UART */
457#define M360_BD_ADDRSS_MATCH  (1<<7)  /* SCC UART */
458#define M360_BD_LONG    (1<<5)  /* Ethernet */
459#define M360_BD_BREAK    (1<<5)  /* SCC UART, SMC UART */
460#define M360_BD_NONALIGNED  (1<<4)  /* Ethernet */
461#define M360_BD_FRAMING_ERROR  (1<<4)  /* SCC UART, SMC UART */
462#define M360_BD_SHORT    (1<<3)  /* Ethernet */
463#define M360_BD_PARITY_ERROR  (1<<3)  /* SCC UART, SMC UART */
464#define M360_BD_CRC_ERROR  (1<<2)  /* Ethernet */
465#define M360_BD_OVERRUN    (1<<1)  /* Ethernet, SCC UART, SMC UART, SPI */
466#define M360_BD_COLLISION  (1<<0)  /* Ethernet */
467#define M360_BD_CARRIER_LOST  (1<<0)  /* SCC UART */
468#define M360_BD_MASTER_ERROR  (1<<0)  /* SPI */
469
470/*
471 * Bits in transmit buffer descriptor status word
472 * Many bits have the same meaning as those in receiver buffer descriptors.
473 */
474#define M360_BD_READY    (1<<15)  /* Ethernet, SCC UART, SMC UART, SPI */
475#define M360_BD_PAD    (1<<14)  /* Ethernet */
476#define M360_BD_CTS_REPORT  (1<<11)  /* SCC UART */
477#define M360_BD_TX_CRC    (1<<10)  /* Ethernet */
478#define M360_BD_DEFER    (1<<9)  /* Ethernet */
479#define M360_BD_HEARTBEAT  (1<<8)  /* Ethernet */
480#define M360_BD_PREAMBLE  (1<<8)  /* SCC UART, SMC UART */
481#define M360_BD_LATE_COLLISION  (1<<7)  /* Ethernet */
482#define M360_BD_NO_STOP_BIT  (1<<7)  /* SCC UART */
483#define M360_BD_RETRY_LIMIT  (1<<6)  /* Ethernet */
484#define M360_BD_RETRY_COUNT(x)  (((x)&0x3C)>>2)  /* Ethernet */
485#define M360_BD_UNDERRUN  (1<<1)  /* Ethernet, SPI */
486#define M360_BD_CARRIER_LOST  (1<<0)  /* Ethernet */
487#define M360_BD_CTS_LOST  (1<<0)  /* SCC UART */
488
489/*
490 *************************************************************************
491 *                           IDMA Buffer Descriptors                     *
492 *************************************************************************
493 */
494typedef struct m360IDMABufferDescriptor_ {
495  uint16_t          status;
496  uint16_t          _pad;
497  uint32_t         length;
498  void      *source;
499  void      *destination;
500} m360IDMABufferDescriptor_t;
501
502/*
503 *************************************************************************
504 *       RISC Communication Processor Module Command Register (CR)       *
505 *************************************************************************
506 */
507#define M360_CR_RST    (1<<15)  /* Reset communication processor */
508#define M360_CR_OP_INIT_RX_TX  (0<<8)  /* SCC, SMC UART, SMC GCI, SPI */
509#define M360_CR_OP_INIT_RX  (1<<8)  /* SCC, SMC UART, SPI */
510#define M360_CR_OP_INIT_TX  (2<<8)  /* SCC, SMC UART, SPI */
511#define M360_CR_OP_INIT_HUNT  (3<<8)  /* SCC, SMC UART */
512#define M360_CR_OP_STOP_TX  (4<<8)  /* SCC, SMC UART */
513#define M360_CR_OP_GR_STOP_TX  (5<<8)  /* SCC */
514#define M360_CR_OP_INIT_IDMA  (5<<8)  /* IDMA */
515#define M360_CR_OP_RESTART_TX  (6<<8)  /* SCC, SMC UART */
516#define M360_CR_OP_CLOSE_RX_BD  (7<<8)  /* SCC, SMC UART, SPI */
517#define M360_CR_OP_SET_GRP_ADDR  (8<<8)  /* SCC */
518#define M360_CR_OP_SET_TIMER  (8<<8)  /* Timer */
519#define M360_CR_OP_GCI_TIMEOUT  (9<<8)  /* SMC GCI */
520#define M360_CR_OP_RESERT_BCS  (10<<8)  /* SCC */
521#define M360_CR_OP_GCI_ABORT  (10<<8)  /* SMC GCI */
522#define M360_CR_CHAN_SCC1  (0<<4)  /* Channel selection */
523#define M360_CR_CHAN_SCC2  (4<<4)
524#define M360_CR_CHAN_SPI  (5<<4)
525#define M360_CR_CHAN_TIMER  (5<<4)
526#define M360_CR_CHAN_SCC3  (8<<4)
527#define M360_CR_CHAN_SMC1  (9<<4)
528#define M360_CR_CHAN_IDMA1  (9<<4)
529#define M360_CR_CHAN_SCC4  (12<<4)
530#define M360_CR_CHAN_SMC2  (13<<4)
531#define M360_CR_CHAN_IDMA2  (13<<4)
532#define M360_CR_FLG    (1<<0)  /* Command flag */
533
534/*
535 *************************************************************************
536 *                 System Protection Control Register (SYPCR)            *
537 *************************************************************************
538 */
539#define M360_SYPCR_SWE    (1<<7)  /* Software watchdog enable */
540#define M360_SYPCR_SWRI    (1<<6)  /* Software watchdog reset select */
541#define M360_SYPCR_SWT1    (1<<5)  /* Software watchdog timing bit 1 */
542#define M360_SYPCR_SWT0    (1<<4)  /* Software watchdog timing bit 0 */
543#define M360_SYPCR_DBFE    (1<<3)  /* Double bus fault monitor enable */
544#define M360_SYPCR_BME    (1<<2)  /* Bus monitor external enable */
545#define M360_SYPCR_BMT1    (1<<1)  /* Bus monitor timing bit 1 */
546#define M360_SYPCR_BMT0    (1<<0)  /* Bus monitor timing bit 0 */
547
548/*
549 *************************************************************************
550 *                        Memory Control Registers                       *
551 *************************************************************************
552 */
553#define M360_GMR_RCNT(x)  ((x)<<24)  /* Refresh count */
554#define M360_GMR_RFEN    (1<<23)  /* Refresh enable */
555#define M360_GMR_RCYC(x)  ((x)<<21)  /* Refresh cycle length */
556#define M360_GMR_PGS(x)    ((x)<<18)  /* Page size */
557#define M360_GMR_DPS_32BIT  (0<<16)  /* DRAM port size */
558#define M360_GMR_DPS_16BIT  (1<<16)
559#define M360_GMR_DPS_8BIT  (2<<16)
560#define M360_GMR_DPS_DSACK  (3<<16)
561#define M360_GMR_WBT40    (1<<15)  /* Wait between 040 transfers */
562#define M360_GMR_WBTQ    (1<<14)  /* Wait between 360 transfers */
563#define M360_GMR_SYNC    (1<<13)  /* Synchronous external access */
564#define M360_GMR_EMWS    (1<<12)  /* External master wait state */
565#define M360_GMR_OPAR    (1<<11)  /* Odd parity */
566#define M360_GMR_PBEE    (1<<10)  /* Parity bus error enable */
567#define M360_GMR_TSS40    (1<<9)  /* TS* sample for 040 */
568#define M360_GMR_NCS    (1<<8)  /* No CPU space */
569#define M360_GMR_DWQ    (1<<7)  /* Delay write for 360 */
570#define M360_GMR_DW40    (1<<6)  /* Delay write for 040 */
571#define M360_GMR_GAMX    (1<<5)  /* Global address mux enable */
572
573#define M360_MEMC_BR_FC(x)  ((x)<<7)  /* Function code limit */
574#define M360_MEMC_BR_TRLXQ  (1<<6)  /* Relax timing requirements */
575#define M360_MEMC_BR_BACK40  (1<<5)  /* Burst acknowledge to 040 */
576#define M360_MEMC_BR_CSNT40  (1<<4)  /* CS* negate timing for 040 */
577#define M360_MEMC_BR_CSNTQ  (1<<3)  /* CS* negate timing for 360 */
578#define M360_MEMC_BR_PAREN  (1<<2)  /* Enable parity checking */
579#define M360_MEMC_BR_WP    (1<<1)  /* Write Protect */
580#define M360_MEMC_BR_V    (1<<0)  /* Base/Option register are valid */
581
582#define M360_MEMC_OR_TCYC(x)  ((x)<<28)  /* Cycle length (clocks) */
583#define M360_MEMC_OR_WAITS(x)  M360_MEMC_OR_TCYC((x)+1)
584#define M360_MEMC_OR_2KB  0x0FFFF800  /* Address range */
585#define M360_MEMC_OR_4KB  0x0FFFF000
586#define M360_MEMC_OR_8KB  0x0FFFE000
587#define M360_MEMC_OR_16KB  0x0FFFC000
588#define M360_MEMC_OR_32KB  0x0FFF8000
589#define M360_MEMC_OR_64KB  0x0FFF0000
590#define M360_MEMC_OR_128KB  0x0FFE0000
591#define M360_MEMC_OR_256KB  0x0FFC0000
592#define M360_MEMC_OR_512KB  0x0FF80000
593#define M360_MEMC_OR_1MB  0x0FF00000
594#define M360_MEMC_OR_2MB  0x0FE00000
595#define M360_MEMC_OR_4MB  0x0FC00000
596#define M360_MEMC_OR_8MB  0x0F800000
597#define M360_MEMC_OR_16MB  0x0F000000
598#define M360_MEMC_OR_32MB  0x0E000000
599#define M360_MEMC_OR_64MB  0x0C000000
600#define M360_MEMC_OR_128MB  0x08000000
601#define M360_MEMC_OR_256MB  0x00000000
602#define M360_MEMC_OR_FCMC(x)  ((x)<<7)  /* Function code mask */
603#define M360_MEMC_OR_BCYC(x)  ((x)<<5)  /* Burst cycle length (clocks) */
604#define M360_MEMC_OR_PGME  (1<<3)    /* Page mode enable */
605#define M360_MEMC_OR_32BIT  (0<<1)    /* Port size */
606#define M360_MEMC_OR_16BIT  (1<<1)
607#define M360_MEMC_OR_8BIT  (2<<1)
608#define M360_MEMC_OR_DSACK  (3<<1)
609#define M360_MEMC_OR_DRAM  (1<<0)    /* Dynamic RAM select */
610
611/*
612 *************************************************************************
613 *                         SI Mode Register (SIMODE)                     *
614 *************************************************************************
615 */
616#define M360_SI_SMC2_BITS  0xFFFF0000  /* All SMC2 bits */
617#define M360_SI_SMC2_TDM  (1<<31)  /* Multiplexed SMC2 */
618#define M360_SI_SMC2_BRG1  (0<<28)  /* SMC2 clock souce */
619#define M360_SI_SMC2_BRG2  (1<<28)
620#define M360_SI_SMC2_BRG3  (2<<28)
621#define M360_SI_SMC2_BRG4  (3<<28)
622#define M360_SI_SMC2_CLK5  (0<<28)
623#define M360_SI_SMC2_CLK6  (1<<28)
624#define M360_SI_SMC2_CLK7  (2<<28)
625#define M360_SI_SMC2_CLK8  (3<<28)
626#define M360_SI_SMC1_BITS  0x0000FFFF  /* All SMC1 bits */
627#define M360_SI_SMC1_TDM  (1<<15)  /* Multiplexed SMC1 */
628#define M360_SI_SMC1_BRG1  (0<<12)  /* SMC1 clock souce */
629#define M360_SI_SMC1_BRG2  (1<<12)
630#define M360_SI_SMC1_BRG3  (2<<12)
631#define M360_SI_SMC1_BRG4  (3<<12)
632#define M360_SI_SMC1_CLK1  (0<<12)
633#define M360_SI_SMC1_CLK2  (1<<12)
634#define M360_SI_SMC1_CLK3  (2<<12)
635#define M360_SI_SMC1_CLK4  (3<<12)
636
637/*
638 *************************************************************************
639 *                  SDMA Configuration Register (SDMA)                   *
640 *************************************************************************
641 */
642#define M360_SDMA_FREEZE  (2<<13)  /* Freeze on next bus cycle */
643#define M360_SDMA_SISM_7  (7<<8)  /* Normal interrupt service mask */
644#define M360_SDMA_SAID_4  (4<<4)  /* Normal arbitration ID */
645#define M360_SDMA_INTE    (1<<1)  /* SBER interrupt enable */
646#define M360_SDMA_INTB    (1<<0)  /* SBKP interrupt enable */
647
648/*
649 *************************************************************************
650 *                      Baud (sic) Rate Generators                       *
651 *************************************************************************
652 */
653#define M360_BRG_RST    (1<<17)    /* Reset generator */
654#define M360_BRG_EN    (1<<16)    /* Enable generator */
655#define M360_BRG_EXTC_BRGCLK  (0<<14)    /* Source is BRGCLK */
656#define M360_BRG_EXTC_CLK2  (1<<14)    /* Source is CLK2 pin */
657#define M360_BRG_EXTC_CLK6  (2<<14)    /* Source is CLK6 pin */
658#define M360_BRG_ATB    (1<<13)    /* Autobaud */
659#define M360_BRG_115200    (13<<1)    /* Assume 25 MHz clock */
660#define M360_BRG_57600    (26<<1)
661#define M360_BRG_38400    (40<<1)
662#define M360_BRG_19200    (80<<1)
663#define M360_BRG_9600    (162<<1)
664#define M360_BRG_4800    (324<<1)
665#define M360_BRG_2400    (650<<1)
666#define M360_BRG_1200    (1301<<1)
667#define M360_BRG_600    (2603<<1)
668#define M360_BRG_300    ((324<<1) | 1)
669#define M360_BRG_150    ((650<<1) | 1)
670#define M360_BRG_75    ((1301<<1) | 1)
671
672/*
673 *************************************************************************
674 *                sccm  Bit Settings                                     *
675 *************************************************************************
676 */
677#define M360_SCCE_TX              0x02
678#define M360_SCCE_RX              0x01
679
680#define M360_CR_INIT_TX_RX_PARAMS  0x0000
681#define M360_CR_CH_NUM             0x0040
682
683#define M360_NUM_DPRAM_REAGONS     4
684/*
685 *************************************************************************
686 *                 MC68360 DUAL-PORT RAM AND REGISTERS                   *
687 *************************************************************************
688 */
689typedef struct m360_ {
690  /*
691   * Dual-port RAM
692   */
693  volatile uint8_t          dpram0[0x400];  /* Microcode program */
694  volatile uint8_t          dpram1[0x200];
695  volatile uint8_t          dpram2[0x100];  /* Microcode scratch */
696  volatile uint8_t          dpram3[0x100];  /* Not on REV A or B masks */
697  volatile uint8_t          _rsv0[0xC00-0x800];
698  volatile m360SCCENparms_t  scc1p;
699  volatile uint8_t          _rsv1[0xCB0-0xC00-sizeof(m360SCCENparms_t)];
700  volatile m360MiscParms_t  miscp;
701  volatile uint8_t          _rsv2[0xD00-0xCB0-sizeof(m360MiscParms_t)];
702  volatile m360SCCparms_t    scc2p;
703  volatile uint8_t          _rsv3[0xD80-0xD00-sizeof(m360SCCparms_t)];
704  volatile m360SPIparms_t    spip;
705  volatile uint8_t          _rsv4[0xDB0-0xD80-sizeof(m360SPIparms_t)];
706  volatile m360TimerParms_t  tmp;
707  volatile uint8_t          _rsv5[0xE00-0xDB0-sizeof(m360TimerParms_t)];
708  volatile m360SCCparms_t    scc3p;
709  volatile uint8_t          _rsv6[0xE70-0xE00-sizeof(m360SCCparms_t)];
710  volatile m360IDMAparms_t  idma1p;
711  volatile uint8_t          _rsv7[0xE80-0xE70-sizeof(m360IDMAparms_t)];
712  volatile m360SMCparms_t    smc1p;
713  volatile uint8_t          _rsv8[0xF00-0xE80-sizeof(m360SMCparms_t)];
714  volatile m360SCCparms_t    scc4p;
715  volatile uint8_t          _rsv9[0xF70-0xF00-sizeof(m360SCCparms_t)];
716  volatile m360IDMAparms_t  idma2p;
717  volatile uint8_t          _rsv10[0xF80-0xF70-sizeof(m360IDMAparms_t)];
718  volatile m360SMCparms_t    smc2p;
719  volatile uint8_t          _rsv11[0x1000-0xF80-sizeof(m360SMCparms_t)];
720
721  /*
722   * SIM Block
723   */
724  volatile uint32_t         mcr;
725  volatile uint32_t         _pad00;
726  volatile uint8_t          avr;
727  volatile uint8_t          rsr;
728  volatile uint16_t          _pad01;
729  volatile uint8_t          clkocr;
730  volatile uint8_t          _pad02;
731  volatile uint16_t          _pad03;
732  volatile uint16_t          pllcr;
733  volatile uint16_t          _pad04;
734  volatile uint16_t          cdvcr;
735  volatile uint16_t          pepar;
736  volatile uint32_t         _pad05[2];
737  volatile uint16_t          _pad06;
738  volatile uint8_t          sypcr;
739  volatile uint8_t          swiv;
740  volatile uint16_t          _pad07;
741  volatile uint16_t          picr;
742  volatile uint16_t          _pad08;
743  volatile uint16_t          pitr;
744  volatile uint16_t          _pad09;
745  volatile uint8_t          _pad10;
746  volatile uint8_t          swsr;
747  volatile uint32_t         bkar;
748  volatile uint32_t         bcar;
749  volatile uint32_t         _pad11[2];
750
751  /*
752   * MEMC Block
753   */
754  volatile uint32_t         gmr;
755  volatile uint16_t          mstat;
756  volatile uint16_t          _pad12;
757  volatile uint32_t         _pad13[2];
758  volatile m360MEMCRegisters_t  memc[8];
759  volatile uint8_t          _pad14[0xF0-0xD0];
760  volatile uint8_t          _pad15[0x100-0xF0];
761  volatile uint8_t          _pad16[0x500-0x100];
762 
763  /*
764   * IDMA1 Block
765   */
766  volatile uint16_t          iccr;
767  volatile uint16_t          _pad17;
768  volatile uint16_t          cmr1;
769  volatile uint16_t          _pad18;
770  volatile uint32_t         sapr1;
771  volatile uint32_t         dapr1;
772  volatile uint32_t         bcr1;
773  volatile uint8_t          fcr1;
774  volatile uint8_t          _pad19;
775  volatile uint8_t          cmar1;
776  volatile uint8_t          _pad20;
777  volatile uint8_t          csr1;
778  volatile uint8_t          _pad21;
779  volatile uint16_t          _pad22;
780 
781  /*
782   * SDMA Block
783   */
784  volatile uint8_t          sdsr;
785  volatile uint8_t          _pad23;
786  volatile uint16_t          sdcr;
787  volatile uint32_t         sdar;
788 
789  /*
790   * IDMA2 Block
791   */
792  volatile uint16_t          _pad24;
793  volatile uint16_t          cmr2;
794  volatile uint32_t         sapr2;
795  volatile uint32_t         dapr2;
796  volatile uint32_t         bcr2;
797  volatile uint8_t          fcr2;
798  volatile uint8_t          _pad26;
799  volatile uint8_t          cmar2;
800  volatile uint8_t          _pad27;
801  volatile uint8_t          csr2;
802  volatile uint8_t          _pad28;
803  volatile uint16_t          _pad29;
804  volatile uint32_t         _pad30;
805 
806  /*
807   * CPIC Block
808   */
809  volatile uint32_t         cicr;
810  volatile uint32_t         cipr;
811  volatile uint32_t         cimr;
812  volatile uint32_t         cisr;
813
814  /*
815   * Parallel I/O Block
816   */
817  volatile uint16_t          padir;
818  volatile uint16_t          papar;
819  volatile uint16_t          paodr;
820  volatile uint16_t          padat;
821  volatile uint32_t         _pad31[2];
822  volatile uint16_t          pcdir;
823  volatile uint16_t          pcpar;
824  volatile uint16_t          pcso;
825  volatile uint16_t          pcdat;
826  volatile uint16_t          pcint;
827  volatile uint16_t          _pad32;
828  volatile uint32_t         _pad33[5];
829 
830  /*
831   * TIMER Block
832   */
833  volatile uint16_t          tgcr;
834  volatile uint16_t          _pad34;
835  volatile uint32_t         _pad35[3];
836  volatile uint16_t          tmr1;
837  volatile uint16_t          tmr2;
838  volatile uint16_t          trr1;
839  volatile uint16_t          trr2;
840  volatile uint16_t          tcr1;
841  volatile uint16_t          tcr2;
842  volatile uint16_t          tcn1;
843  volatile uint16_t          tcn2;
844  volatile uint16_t          tmr3;
845  volatile uint16_t          tmr4;
846  volatile uint16_t          trr3;
847  volatile uint16_t          trr4;
848  volatile uint16_t          tcr3;
849  volatile uint16_t          tcr4;
850  volatile uint16_t          tcn3;
851  volatile uint16_t          tcn4;
852  volatile uint16_t          ter1;
853  volatile uint16_t          ter2;
854  volatile uint16_t          ter3;
855  volatile uint16_t          ter4;
856  volatile uint32_t         _pad36[2];
857 
858  /*
859   * CP Block
860   */
861  volatile uint16_t          cr;
862  volatile uint16_t          _pad37;
863  volatile uint16_t          rccr;
864  volatile uint16_t          _pad38;
865  volatile uint32_t         _pad39[3];
866  volatile uint16_t          _pad40;
867  volatile uint16_t          rter;
868  volatile uint16_t          _pad41;
869  volatile uint16_t          rtmr;
870  volatile uint32_t         _pad42[5];
871
872  /*
873   * BRG Block
874   */
875  volatile uint32_t         brgc1;
876  volatile uint32_t         brgc2;
877  volatile uint32_t         brgc3;
878  volatile uint32_t         brgc4;
879
880  /*
881   * SCC Block
882   */
883  volatile m360SCCRegisters_t  scc1;
884  volatile m360SCCRegisters_t  scc2;
885  volatile m360SCCRegisters_t  scc3;
886  volatile m360SCCRegisters_t  scc4;
887
888  /*
889   * SMC Block
890   */
891  volatile m360SMCRegisters_t  smc1;
892  volatile m360SMCRegisters_t  smc2;
893
894  /*
895   * SPI Block
896   */
897  volatile uint16_t          spmode;
898  volatile uint16_t          _pad43[2];
899  volatile uint8_t          spie;
900  volatile uint8_t          _pad44;
901  volatile uint16_t          _pad45;
902  volatile uint8_t          spim;
903  volatile uint8_t          _pad46[2];
904  volatile uint8_t          spcom;
905  volatile uint16_t          _pad47[2];
906
907  /*
908   * PIP Block
909   */
910  volatile uint16_t          pipc;
911  volatile uint16_t          _pad48;
912  volatile uint16_t          ptpr;
913  volatile uint32_t         pbdir;
914  volatile uint32_t         pbpar;
915  volatile uint16_t          _pad49;
916  volatile uint16_t          pbodr;
917  volatile uint32_t         pbdat;
918  volatile uint32_t         _pad50[6];
919
920  /*
921   * SI Block
922   */
923  volatile uint32_t         simode;
924  volatile uint8_t          sigmr;
925  volatile uint8_t          _pad51;
926  volatile uint8_t          sistr;
927  volatile uint8_t          sicmr;
928  volatile uint32_t         _pad52;
929  volatile uint32_t         sicr;
930  volatile uint16_t          _pad53;
931  volatile uint16_t          sirp[2];
932  volatile uint16_t          _pad54;
933  volatile uint32_t         _pad55[2];
934  volatile uint8_t          siram[256];
935} m360_t;
936
937struct bdregions_t {
938  uint8_t     *base;
939  uint32_t    size;
940  uint32_t    used;
941};
942
943#define M68360_RX_BUF_SIZE        1
944#define M68360_TX_BUF_SIZE        0x100
945
946struct _m68360_per_chip;
947typedef struct _m68360_per_chip *M68360_t;
948
949typedef struct _m68360_per_port {
950  uint32_t                         channel;
951  M68360_t                         chip;
952  volatile uint32_t               *pBRGC;      /* m360->brgc#             */
953  volatile m360SCCparms_t         *pSCCB;      /* m360->scc#p             */
954  volatile m360SCCRegisters_t     *pSCCR;      /* m360->scc#              */
955  uint32_t                         baud;
956  int                              minor;
957  volatile uint8_t                *rxBuf;
958  volatile uint8_t                *txBuf;
959  volatile m360BufferDescriptor_t *sccRxBd;
960  volatile m360BufferDescriptor_t *sccTxBd;
961}m68360_per_port_t, *M68360_serial_ports_t;
962
963typedef struct _m68360_per_chip {
964  struct _m68360_per_chip        *next;
965  struct bdregions_t              bdregions[4];
966  volatile m360_t                *m360;       /* Pointer to base Address */
967  int                             m360_interrupt;
968  int                             m360_clock_rate;
969  PPMCQ1BoardData                 board_data;
970  m68360_per_port_t               port[4];
971} m68360_per_chip_t;
972
973extern M68360_t M68360_chips;
974
975void M360SetupMemory( M68360_t ptr );
976void *M360AllocateBufferDescriptors (M68360_t ptr, int count);
977void M360ExecuteRISC( volatile m360_t *m360, uint16_t command);
978int mc68360_scc_create_chip( PPMCQ1BoardData BoardData, uint8_t int_vector );
979
980void mc68360_sccInterruptHandler( void *ptr);
981
982#if 0
983extern volatile m360_t *m360;
984#endif
985
986#endif /* __MC68360_h */
Note: See TracBrowser for help on using the repository browser.