Home | History | Annotate | Line # | Download | only in include
      1  1.1  pooka /*	$NetBSD: emipsreg.h,v 1.1 2011/01/26 01:18:51 pooka Exp $	*/
      2  1.1  pooka 
      3  1.1  pooka /*-
      4  1.1  pooka  * Copyright (c) 2010 The NetBSD Foundation, Inc.
      5  1.1  pooka  * All rights reserved.
      6  1.1  pooka  *
      7  1.1  pooka  * This code was written by Alessandro Forin and Neil Pittman
      8  1.1  pooka  * at Microsoft Research and contributed to The NetBSD Foundation
      9  1.1  pooka  * by Microsoft Corporation.
     10  1.1  pooka  *
     11  1.1  pooka  * Redistribution and use in source and binary forms, with or without
     12  1.1  pooka  * modification, are permitted provided that the following conditions
     13  1.1  pooka  * are met:
     14  1.1  pooka  * 1. Redistributions of source code must retain the above copyright
     15  1.1  pooka  *    notice, this list of conditions and the following disclaimer.
     16  1.1  pooka  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1  pooka  *    notice, this list of conditions and the following disclaimer in the
     18  1.1  pooka  *    documentation and/or other materials provided with the distribution.
     19  1.1  pooka  *
     20  1.1  pooka  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  1.1  pooka  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  1.1  pooka  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  1.1  pooka  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  1.1  pooka  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  1.1  pooka  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  1.1  pooka  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  1.1  pooka  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  1.1  pooka  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  1.1  pooka  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  1.1  pooka  * POSSIBILITY OF SUCH DAMAGE.
     31  1.1  pooka  */
     32  1.1  pooka 
     33  1.1  pooka /*
     34  1.1  pooka  * Reference:
     35  1.1  pooka  * TBD MSR techreport by Richard Pittman and Alessandro Forin
     36  1.1  pooka  *
     37  1.1  pooka  * Definitions for the Xilinx ML40x dev boards with MSR's eMIPS.
     38  1.1  pooka  */
     39  1.1  pooka 
     40  1.1  pooka #ifndef _MIPS32_EMIPS_EMIPSREG_H_
     41  1.1  pooka #define _MIPS32_EMIPS_EMIPSREG_H_ 1
     42  1.1  pooka 
     43  1.1  pooka /*
     44  1.1  pooka  * Peripheral Mapping Table (PMT) definitions
     45  1.1  pooka  *
     46  1.1  pooka  * Each entry in this table holds the physical address of a section of peripherals
     47  1.1  pooka  * and the tag for the type of peripherals in that section.
     48  1.1  pooka  * Peripherals of the same type go into the same section, which is subdivided
     49  1.1  pooka  * as appropriate for that peripheral type.
     50  1.1  pooka  * Each section is at least 64KB wide, each subdivision is at least 4KB wide.
     51  1.1  pooka  *
     52  1.1  pooka  * NB: This table grows *down* from the top of the address space
     53  1.1  pooka  * The value 0xffffffff for an entry indicates the section is not populated.
     54  1.1  pooka  * The tag 0xffff is therefore invalid.
     55  1.1  pooka  * The end-of-table is indicated by the first invalid entry.
     56  1.1  pooka  *
     57  1.1  pooka  * Entries in the table are (preferably) in the processor's own byteorder.
     58  1.1  pooka  * The first entry is for the table itself and has a known tag.
     59  1.1  pooka  * From this software can verify the byteorder is correct.
     60  1.1  pooka  *
     61  1.1  pooka  * For each section we also define here its favorite placement in the address space.
     62  1.1  pooka  * Software should verify the table for the ultimate truth, peripherals might
     63  1.1  pooka  * or might not be present in the FPGA bitfile being used.
     64  1.1  pooka  *
     65  1.1  pooka  */
     66  1.1  pooka #ifndef __ASSEMBLER__
     67  1.1  pooka struct _Pmt {
     68  1.1  pooka 
     69  1.1  pooka     volatile uint16_t   TopOfPhysicalAddress;
     70  1.1  pooka     volatile uint16_t   Tag;
     71  1.1  pooka };
     72  1.1  pooka #define ThePmt (((struct _Pmt *)0)-1)
     73  1.1  pooka 
     74  1.1  pooka #endif /* !__ASSEMBLER__ */
     75  1.1  pooka 
     76  1.1  pooka /*
     77  1.1  pooka  * Peripheral tags
     78  1.1  pooka  */
     79  1.1  pooka # define                PMTTAG_END_OF_TABLE             0xffff /* required, last entry */
     80  1.1  pooka # define                PMTTAG_BRAM                     0
     81  1.1  pooka # define                PMTTAG_PMT                      1      /* required, first entry */
     82  1.1  pooka # define                PMTTAG_SRAM                     2
     83  1.1  pooka # define                PMTTAG_DDRAM                    3
     84  1.1  pooka # define                PMTTAG_FLASH                    4
     85  1.1  pooka # define                PMTTAG_INTERRUPT_CONTROLLER     5
     86  1.1  pooka # define                PMTTAG_USART                    6
     87  1.1  pooka # define                PMTTAG_TIMER                    7
     88  1.1  pooka # define                PMTTAG_WATCHDOG                 8
     89  1.1  pooka # define                PMTTAG_GPIO                     9
     90  1.1  pooka # define                PMTTAG_SYSTEM_ACE               10
     91  1.1  pooka # define                PMTTAG_LCD                      11
     92  1.1  pooka # define                PMTTAG_PS2                      12
     93  1.1  pooka # define                PMTTAG_VGA                      13
     94  1.1  pooka # define                PMTTAG_ETHERNET                 14
     95  1.1  pooka # define                PMTTAG_AC97                     15
     96  1.1  pooka # define                PMTTAG_POWER_MGR                16
     97  1.1  pooka # define                PMTTAG_EXTENSION_CONTROLLER     17
     98  1.1  pooka # define                PMTTAG_ICAP                     18
     99  1.1  pooka # define                PMTTAG_LAST_TAG_DEFINED         18
    100  1.1  pooka 
    101  1.1  pooka /*
    102  1.1  pooka  * Preferred addresses (nb: for the control registers of...)
    103  1.1  pooka  */
    104  1.1  pooka # define                BRAM_DEFAULT_ADDRESS                   (0xffff << 16)
    105  1.1  pooka # define                SRAM_0_DEFAULT_ADDRESS                 (0xfffd << 16)
    106  1.1  pooka # define                DDRAM_0_DEFAULT_ADDRESS                (0xfffc << 16)
    107  1.1  pooka # define                FLASH_0_DEFAULT_ADDRESS                (0xfffb << 16)
    108  1.1  pooka # define                INTERRUPT_CONTROLLER_DEFAULT_ADDRESS   (0xfffa << 16)
    109  1.1  pooka # define                USART_DEFAULT_ADDRESS                  (0xfff9 << 16)
    110  1.1  pooka # define                TIMER_DEFAULT_ADDRESS                  (0xfff8 << 16)
    111  1.1  pooka # define                WATCHDOG_DEFAULT_ADDRESS               (0xfff7 << 16)
    112  1.1  pooka # define                GPIO_DEFAULT_ADDRESS                   (0xfff6 << 16)
    113  1.1  pooka # define                IDE_DEFAULT_ADDRESS                    (0xfff5 << 16)
    114  1.1  pooka # define                LCD_DEFAULT_ADDRESS                    (0xfff4 << 16)
    115  1.1  pooka # define                PS2_DEFAULT_ADDRESS                    (0xfff3 << 16)
    116  1.1  pooka # define                VGA_DEFAULT_ADDRESS                    (0xfff2 << 16)
    117  1.1  pooka # define                ETHERNET_DEFAULT_ADDRESS               (0xfff1 << 16)
    118  1.1  pooka # define                POWER_MGR_DEFAULT_ADDRESS              (0xfff0 << 16)
    119  1.1  pooka # define                AC97_DEFAULT_ADDRESS                   (0xffef << 16)
    120  1.1  pooka # define                EXTENSION_CONTROLLER_DEFAULT_ADDRESS   (0xffee << 16)
    121  1.1  pooka # define                ICAP_DEFAULT_ADDRESS                   (0xffed << 16)
    122  1.1  pooka 
    123  1.1  pooka 
    124  1.1  pooka /*
    125  1.1  pooka  * SRAM controller
    126  1.1  pooka  */
    127  1.1  pooka #ifndef __ASSEMBLER__
    128  1.1  pooka struct _Sram {
    129  1.1  pooka     volatile uint32_t   BaseAddressAndTag;    /* rw */
    130  1.1  pooka     volatile uint32_t   Control;              /* rw */
    131  1.1  pooka };
    132  1.1  pooka #else
    133  1.1  pooka # define                SRAMBT                          0
    134  1.1  pooka # define                SRAMST                          4
    135  1.1  pooka #endif /* !__ASSEMBLER__ */
    136  1.1  pooka 
    137  1.1  pooka # define                SRAMBT_TAG                      0x0000ffff  /* ro */
    138  1.1  pooka # define                SRAMBT_BASE                     0xffff0000  /* rw */
    139  1.1  pooka 
    140  1.1  pooka # define                SRAMST_DELAY                    0x0000000f  /* rw */
    141  1.1  pooka # define                SRAMST_BURST_INTERLEAVED        0x00000010  /* ro */
    142  1.1  pooka # define                SRAMST_BURST_LINEAR             0x00000000  /* ro */
    143  1.1  pooka # define                SRAMST_BURST_ENABLE             0x00000020  /* rw */
    144  1.1  pooka # define                SRAMST_BURST_DISABLE            0x00000000  /* rw */
    145  1.1  pooka # define                SRAMST_CLOCK_MASK               0x00000040  /* rw */
    146  1.1  pooka # define                SRAMST_SLEEP                    0x00000080  /* rw */
    147  1.1  pooka # define                SRAMST_PARITY                   0x00000f00  /* rw */
    148  1.1  pooka # define                SRAMST_RESET                    0x00001000  /* rw */
    149  1.1  pooka # define                SRAMST_BUS_8                    0x00002000  /* rw */
    150  1.1  pooka # define                SRAMST_BUS_16                   0x00004000  /* rw */
    151  1.1  pooka # define                SRAMST_BUS_32                   0x00008000  /* rw */
    152  1.1  pooka # define                SRAMST_SIZE                     0xffff0000  /* ro
    153  1.1  pooka                                                                      * in bytes, masked */
    154  1.1  pooka 
    155  1.1  pooka /*
    156  1.1  pooka  * DDRAM controller
    157  1.1  pooka  */
    158  1.1  pooka #ifndef __ASSEMBLER__
    159  1.1  pooka struct _Ddram {
    160  1.1  pooka     volatile uint32_t   BaseAddressAndTag;    /* rw */
    161  1.1  pooka     volatile uint32_t   Control;              /* rw */
    162  1.1  pooka     volatile uint32_t   PreCharge;            /* wo */
    163  1.1  pooka     volatile uint32_t   Refresh;              /* wo */
    164  1.1  pooka };
    165  1.1  pooka #else
    166  1.1  pooka # define                DDRAMBT                         0
    167  1.1  pooka # define                DDRAMST                         4
    168  1.1  pooka # define                DDRAMPC                         8
    169  1.1  pooka # define                DDRAMRF                         12
    170  1.1  pooka # define                DDRAMCTRL_SIZE                  16
    171  1.1  pooka #endif /* !__ASSEMBLER__ */
    172  1.1  pooka 
    173  1.1  pooka # define                DDRAMBT_TAG                     0x0000ffff  /* ro */
    174  1.1  pooka # define                DDRAMBT_BASE                    0xffff0000  /* rw */
    175  1.1  pooka 
    176  1.1  pooka # define                DDRAMST_RST                     0x00000001    /* rw */
    177  1.1  pooka # define                DDRAMST_CLR                     0x00000002    /* rw */
    178  1.1  pooka # define                DDRAMST_TSTEN                   0x00000004    /* rw */
    179  1.1  pooka # define                DDRAMST_BUF                     0x00000008    /* rw */
    180  1.1  pooka # define                DDRAMST_CALDNE                  0x00000010    /* ro */
    181  1.1  pooka # define                DDRAMST_CALFAIL                 0x00000020    /* ro */
    182  1.1  pooka # define                DDRAMST_SERR                    0x00000040    /* ro */
    183  1.1  pooka # define                DDRAMST_DERR                    0x00000080    /* ro */
    184  1.1  pooka # define                DDRAMST_BURST                   0x00000f00    /* ro */
    185  1.1  pooka # define                DDRAMST_OVF                     0x00001000    /* ro */
    186  1.1  pooka # define                DDRAMST_BUS8                    0x00002000    /* ro */
    187  1.1  pooka # define                DDRAMST_BUS16                   0x00004000    /* ro */
    188  1.1  pooka # define                DDRAMST_BUS32                   0x00008000    /* ro */
    189  1.1  pooka # define                DDRAMST_SIZE                    0xffff0000    /* ro */
    190  1.1  pooka 
    191  1.1  pooka /*
    192  1.1  pooka  * FLASH controller
    193  1.1  pooka  */
    194  1.1  pooka #ifndef __ASSEMBLER__
    195  1.1  pooka struct _Flash {
    196  1.1  pooka     volatile uint32_t   BaseAddressAndTag;    /* rw */
    197  1.1  pooka     volatile uint32_t   Control;              /* rw */
    198  1.1  pooka };
    199  1.1  pooka #else
    200  1.1  pooka # define                FLASHBT                         0
    201  1.1  pooka # define                FLASHST                         4
    202  1.1  pooka #endif /* !__ASSEMBLER__ */
    203  1.1  pooka 
    204  1.1  pooka # define                FLASHBT_TAG                     0x0000ffff  /* ro */
    205  1.1  pooka # define                FLASHBT_BASE                    0xffff0000  /* rw */
    206  1.1  pooka 
    207  1.1  pooka # define                FLASHST_DELAY                   0x0000000f  /* rw */
    208  1.1  pooka # define                FLASHST_RESET_PIN               0x00000010  /* rw */
    209  1.1  pooka # define                FLASHST_RESET_CONTROLLER        0x00001000  /* rw */
    210  1.1  pooka # define                FLASHST_BUS_8                   0x00002000  /* rw */
    211  1.1  pooka # define                FLASHST_BUS_16                  0x00004000  /* rw */
    212  1.1  pooka # define                FLASHST_BUS_32                  0x00008000  /* rw */
    213  1.1  pooka # define                FLASHST_SIZE                    0xffff0000  /* ro
    214  1.1  pooka                                                                      * in bytes, masked */
    215  1.1  pooka 
    216  1.1  pooka /*
    217  1.1  pooka  * ARM RPS Interrupt Controller (AIC)
    218  1.1  pooka  */
    219  1.1  pooka #ifndef __ASSEMBLER__
    220  1.1  pooka struct _Aic {
    221  1.1  pooka     volatile uint32_t   Tag;                  /* ro */
    222  1.1  pooka     volatile uint32_t   IrqStatus;            /* rw */
    223  1.1  pooka     volatile uint32_t   IrqRawStatus;         /* ro */
    224  1.1  pooka     volatile uint32_t   IrqEnable;            /* rw */
    225  1.1  pooka     volatile uint32_t   IrqEnableClear;
    226  1.1  pooka     volatile uint32_t   IrqSoft;
    227  1.1  pooka };
    228  1.1  pooka #else
    229  1.1  pooka # define                AICT                            0
    230  1.1  pooka # define                AICS                            4
    231  1.1  pooka # define                AICRS                           8
    232  1.1  pooka # define                AICEN                           12
    233  1.1  pooka # define                AICEC                           16
    234  1.1  pooka #endif /* !__ASSEMBLER__ */
    235  1.1  pooka 
    236  1.1  pooka # define                AIC_TIMER                       0
    237  1.1  pooka # define                AIC_SOFTWARE                    1
    238  1.1  pooka # define                AIC_GPIO                        2
    239  1.1  pooka # define                AIC_WATCHDOG                    3
    240  1.1  pooka # define                AIC_SYSTEM_ACE                  4
    241  1.1  pooka # define                AIC_ETHERNET                    5
    242  1.1  pooka # define                AIC_PS2                         6
    243  1.1  pooka # define                AIC_AC97                        7
    244  1.1  pooka # define                AIC_USART                       9
    245  1.1  pooka # define                AIC_EXTENSION_CONTROLLER        10
    246  1.1  pooka # define                AIC_ICAP                        11
    247  1.1  pooka # define                AIC_SYSTEM_ACE2                 12
    248  1.1  pooka # define                AIC_VGA                         13
    249  1.1  pooka # define                AIC_EXTENSION_2                 29
    250  1.1  pooka # define                AIC_EXTENSION_1                 30
    251  1.1  pooka # define                AIC_EXTENSION_0                 31
    252  1.1  pooka 
    253  1.1  pooka # define                AIC_TIMER_BIT                   (1 << AIC_TIMER)
    254  1.1  pooka # define                AIC_SOFTWARE_BIT                (1 << AIC_SOFTWARE)
    255  1.1  pooka # define                AIC_GPIO_BIT                    (1 << AIC_GPIO)
    256  1.1  pooka # define                AIC_WATCHDOG_BIT                (1 << AIC_WATCHDOG)
    257  1.1  pooka # define                AIC_SYSTEM_ACE_BIT              (1 << AIC_SYSTEM_ACE)
    258  1.1  pooka # define                AIC_ETHERNET_BIT                (1 << AIC_ETHERNET)
    259  1.1  pooka # define                AIC_PS2_BIT                     (1 << AIC_PS2)
    260  1.1  pooka # define                AIC_AC97_BIT                    (1 << AIC_AC97)
    261  1.1  pooka # define                AIC_USART_BIT                   (1 << AIC_USART)
    262  1.1  pooka # define                AIC_EXTENSION_CONTROLLER_BIT    (1 << AIC_EXTENSION_CONTROLLER)
    263  1.1  pooka # define                AIC_ICAP_BIT                    (1 << AIC_ICAP)
    264  1.1  pooka # define                AIC_SYSTEM_ACE2_BIT             (1 << AIC_SYSTEM_ACE2)
    265  1.1  pooka # define                AIC_VGA_BIT                     (1 << AIC_VGA)
    266  1.1  pooka # define                AIC_EXTENSION_2_BIT             (1 << AIC_EXTENSION_2)
    267  1.1  pooka # define                AIC_EXTENSION_1_BIT             (1 << AIC_EXTENSION_1)
    268  1.1  pooka # define                AIC_EXTENSION_0_BIT             (1 << AIC_EXTENSION_0)
    269  1.1  pooka 
    270  1.1  pooka /*
    271  1.1  pooka  * General Purpose I/O pads controller (GPIO)
    272  1.1  pooka  */
    273  1.1  pooka #ifndef __ASSEMBLER__
    274  1.1  pooka struct _Pio {
    275  1.1  pooka     volatile uint32_t  Tag;                  /* ro value=9 NB: All other registers RESET to 0 */
    276  1.1  pooka     volatile uint32_t  Enable;               /* rw READ:  0 => high-z, 1 => In/Out based on DIRECTION
    277  1.1  pooka                                               *    WRITE: 0 => no effect, 1 => pin is enabled for I/O */
    278  1.1  pooka     volatile uint32_t  Disable;              /* wo 0 => no effect, 1 => disabled, set in high-z */
    279  1.1  pooka     volatile uint32_t  Direction;            /* rw READ:  0 => input, 1 => output (if enabled)
    280  1.1  pooka                                               *    WRITE: 0 => no-effect, 1 => output */
    281  1.1  pooka     volatile uint32_t  OutDisable;           /* wo 0 => no effect, 1 => set for input */
    282  1.1  pooka 
    283  1.1  pooka     volatile uint32_t  PinData;              /* rw READ:  0 => LOW, 1 => HIGH
    284  1.1  pooka                                               *    WRITE: 0 => no effect, 1 => set pin HIGH */
    285  1.1  pooka     volatile uint32_t  ClearData;            /* wo 0 => no effect, 1 => set pin LOW */
    286  1.1  pooka     volatile uint32_t  PinStatus;            /* ro 0 => LOW, 1 => HIGH */
    287  1.1  pooka 
    288  1.1  pooka     volatile uint32_t  IntrStatus;           /* rw READ:  0 => none 1 => pending (regardless of INTRMASK)
    289  1.1  pooka                                               *    WRITE: 0 => no-effect, 1 => clear if pending  */
    290  1.1  pooka     volatile uint32_t  IntrEnable;           /* rw READ:  0 => none, 1 => enabled
    291  1.1  pooka                                               *    WRITE: 0 => no-effect, 1 => enable */
    292  1.1  pooka     volatile uint32_t  IntrDisable;          /* wo 0 => no effect, 1 => disable */
    293  1.1  pooka     volatile uint32_t  IntrTrigger;          /* rw 0 => intr on level change, 1 => on transition */
    294  1.1  pooka     volatile uint32_t  IntrNotLevel;         /* rw 0 => HIGH, 1 => LOW  -- Combinations:
    295  1.1  pooka                                               *    Trig Lev InterruptOn..
    296  1.1  pooka                                               *    0    0   level high
    297  1.1  pooka                                               *    0    1   level low
    298  1.1  pooka                                               *    1    0   low to high transition
    299  1.1  pooka                                               *    1    1   high to low transition
    300  1.1  pooka                                               */
    301  1.1  pooka     volatile uint32_t  reserved[3];          /* ro padding to 64 bytes total */
    302  1.1  pooka };
    303  1.1  pooka #else
    304  1.1  pooka # define                PIOT                            0
    305  1.1  pooka # define                PIOEN                           4
    306  1.1  pooka # define                PIOD                            8
    307  1.1  pooka # define                PIODIR                          12
    308  1.1  pooka # define                PIOOD                           16
    309  1.1  pooka # define                PIOPD                           20
    310  1.1  pooka # define                PIOCD                           24
    311  1.1  pooka # define                PIOPS                           28
    312  1.1  pooka # define                PIOIS                           32
    313  1.1  pooka # define                PIOIE                           36
    314  1.1  pooka # define                PIOID                           40
    315  1.1  pooka # define                PIOIT                           44
    316  1.1  pooka # define                PIOINL                          48
    317  1.1  pooka #endif /* !__ASSEMBLER__ */
    318  1.1  pooka 
    319  1.1  pooka /* DIP switches on SW1 and their known uses */
    320  1.1  pooka # define                PIO_SW1_1                       0
    321  1.1  pooka # define                PIO_SW1_1_BIT                   (1 << PIO_SW1_1)
    322  1.1  pooka # define                PIO_SW1_2                       1
    323  1.1  pooka # define                PIO_SW1_2_BIT                   (1 << PIO_SW1_2)
    324  1.1  pooka # define                PIO_SW1_3                       2
    325  1.1  pooka # define                PIO_SW1_3_BIT                   (1 << PIO_SW1_3)
    326  1.1  pooka # define                PIO_SW1_4                       3
    327  1.1  pooka # define                PIO_SW1_4_BIT                   (1 << PIO_SW1_4)
    328  1.1  pooka # define                PIO_SW1_5                       4
    329  1.1  pooka # define                PIO_SW1_5_BIT                   (1 << PIO_SW1_5)
    330  1.1  pooka # define                PIO_SW1_6                       5
    331  1.1  pooka # define                PIO_SW1_6_BIT                   (1 << PIO_SW1_6)
    332  1.1  pooka # define                PIO_SW1_7                       6
    333  1.1  pooka # define                PIO_SW1_7_BIT                   (1 << PIO_SW1_7)
    334  1.1  pooka # define                PIO_SW1_8                       7
    335  1.1  pooka # define                PIO_SW1_8_BIT                   (1 << PIO_SW1_8)
    336  1.1  pooka # define                SW1_BOOT_FROM_FLASH             PIO_SW1_1_BIT  /* else USART */
    337  1.1  pooka # define                SW1_BOOT_FS_IN_FLASH            PIO_SW1_2_BIT  /* else serplexd via USART */
    338  1.1  pooka # define                SW1_BOOT_FROM_SRAM              PIO_SW1_3_BIT  /* else USART */
    339  1.1  pooka /* LEDs */
    340  1.1  pooka # define                PIO_LED_NORTH                   8
    341  1.1  pooka # define                PIO_LED_NORTH_BIT               (1 << PIO_LED_NORTH)
    342  1.1  pooka # define                PIO_LED_EAST                    9
    343  1.1  pooka # define                PIO_LED_EAST_BIT                (1 << PIO_LED_EAST)
    344  1.1  pooka # define                PIO_LED_SOUTH                   10
    345  1.1  pooka # define                PIO_LED_SOUTH_BIT               (1 << PIO_LED_SOUTH)
    346  1.1  pooka # define                PIO_LED_WEST                    11
    347  1.1  pooka # define                PIO_LED_WEST_BIT                (1 << PIO_LED_WEST)
    348  1.1  pooka # define                PIO_LED_CENTER                  12
    349  1.1  pooka # define                PIO_LED_CENTER_BIT              (1 << PIO_LED_CENTER)
    350  1.1  pooka # define                PIO_LED_GP0                     13
    351  1.1  pooka # define                PIO_LED_GP0_BIT                 (1 << PIO_LED_GP0)
    352  1.1  pooka # define                PIO_LED_GP1                     14
    353  1.1  pooka # define                PIO_LED_GP1_BIT                 (1 << PIO_LED_GP1)
    354  1.1  pooka # define                PIO_LED_GP2                     15
    355  1.1  pooka # define                PIO_LED_GP2_BIT                 (1 << PIO_LED_GP2)
    356  1.1  pooka # define                PIO_LED_GP3                     16
    357  1.1  pooka # define                PIO_LED_GP3_BIT                 (1 << PIO_LED_GP3)
    358  1.1  pooka # define                PIO_LED_ERROR1                  17
    359  1.1  pooka # define                PIO_LED_ERROR1_BIT              (1 << PIO_LED_ERROR1)
    360  1.1  pooka # define                PIO_LED_ERROR2                  18
    361  1.1  pooka # define                PIO_LED_ERROR2_BIT              (1 << PIO_LED_ERROR2)
    362  1.1  pooka /* Buttons */
    363  1.1  pooka # define                PIO_BUTTON_NORTH                19
    364  1.1  pooka # define                PIO_BUTTON_NORTH_BIT            (1 << PIO_BUTTON_NORTH)
    365  1.1  pooka # define                PIO_BUTTON_EAST                 20
    366  1.1  pooka # define                PIO_BUTTON_EAST_BIT             (1 << PIO_BUTTON_EAST)
    367  1.1  pooka # define                PIO_BUTTON_SOUTH                21
    368  1.1  pooka # define                PIO_BUTTON_SOUTH_BIT            (1 << PIO_BUTTON_SOUTH)
    369  1.1  pooka # define                PIO_BUTTON_WEST                 22
    370  1.1  pooka # define                PIO_BUTTON_WEST_BIT             (1 << PIO_BUTTON_WEST)
    371  1.1  pooka # define                PIO_BUTTON_CENTER               23
    372  1.1  pooka # define                PIO_BUTTON_CENTER_BIT           (1 << PIO_BUTTON_CENTER)
    373  1.1  pooka 
    374  1.1  pooka /*
    375  1.1  pooka  * Universal Synch/Asynch Receiver/Transmitter (USART)
    376  1.1  pooka  */
    377  1.1  pooka #ifndef __ASSEMBLER__
    378  1.1  pooka struct _Usart {
    379  1.1  pooka     volatile uint32_t  Tag;                  /* ro */
    380  1.1  pooka     volatile uint32_t  Control;              /* rw */
    381  1.1  pooka     volatile uint32_t  IntrEnable;
    382  1.1  pooka     volatile uint32_t  IntrDisable;
    383  1.1  pooka     volatile uint32_t  IntrMask;
    384  1.1  pooka     volatile uint32_t  ChannelStatus; /* all these with.. */
    385  1.1  pooka     volatile uint32_t  RxData;
    386  1.1  pooka     volatile uint32_t  TxData;
    387  1.1  pooka     volatile uint32_t  Baud;
    388  1.1  pooka     volatile uint32_t  Timeout;
    389  1.1  pooka     volatile uint32_t  reserved[6];          /* ro padding to 64 bytes total */
    390  1.1  pooka };
    391  1.1  pooka #else
    392  1.1  pooka # define                USARTT                          0
    393  1.1  pooka # define                USARTC                          4
    394  1.1  pooka # define                USARTIE                         8
    395  1.1  pooka # define                USARTID                         12
    396  1.1  pooka # define                USARTM                          16
    397  1.1  pooka # define                USARTST                         20
    398  1.1  pooka # define                USARTRX                         24
    399  1.1  pooka # define                USARTTX                         28
    400  1.1  pooka # define                USARTBD                         32
    401  1.1  pooka # define                USARTTO                         36
    402  1.1  pooka #endif /* !__ASSEMBLER__ */
    403  1.1  pooka 
    404  1.1  pooka # define                USC_RESET                       0x00000001
    405  1.1  pooka # define                USC_RSTRX                       0x00000004
    406  1.1  pooka # define                USC_RSTTX                       0x00000008
    407  1.1  pooka # define                USC_RXEN                        0x00000010
    408  1.1  pooka # define                USC_RXDIS                       0x00000020
    409  1.1  pooka # define                USC_TXEN                        0x00000040
    410  1.1  pooka # define                USC_TXDIS                       0x00000080
    411  1.1  pooka # define                USC_RSTSTA                      0x00000100
    412  1.1  pooka # define                USC_STTBRK                      0x00000200
    413  1.1  pooka # define                USC_STPBRK                      0x00000400
    414  1.1  pooka # define                USC_STTO                        0x00000800
    415  1.1  pooka # define                USC_CLK_SENDA                   0x00010000
    416  1.1  pooka # define                USC_BPC_9                       0x00020000
    417  1.1  pooka # define                USC_CLKO                        0x00040000
    418  1.1  pooka # define                USC_EVEN                        0x00000000
    419  1.1  pooka # define                USC_ODD                         0x00080000
    420  1.1  pooka # define                USC_SPACE                       0x00100000 /* forced 0 */
    421  1.1  pooka # define                USC_MARK                        0x00180000 /* forced 1 */
    422  1.1  pooka # define                USC_NONE                        0x00200000
    423  1.1  pooka # define                USC_MDROP                       0x00300000
    424  1.1  pooka # define                USC_BPC_5                       0x00000000
    425  1.1  pooka # define                USC_BPC_6                       0x00400000
    426  1.1  pooka # define                USC_BPC_7                       0x00800000
    427  1.1  pooka # define                USC_BPC_8                       0x00c00000
    428  1.1  pooka # define                USC_CLKDIV                      0x0f000000
    429  1.1  pooka # define                USC_CLKDIV_1                    0x00000000
    430  1.1  pooka # define                USC_CLKDIV_2                    0x01000000
    431  1.1  pooka # define                USC_CLKDIV_4                    0x02000000
    432  1.1  pooka # define                USC_CLKDIV_8                    0x03000000
    433  1.1  pooka # define                USC_CLKDIV_16                   0x04000000
    434  1.1  pooka # define                USC_CLKDIV_32                   0x05000000
    435  1.1  pooka # define                USC_CLKDIV_64                   0x06000000
    436  1.1  pooka # define                USC_CLKDIV_128                  0x07000000
    437  1.1  pooka # define                USC_CLKDIV_EXT                  0x08000000
    438  1.1  pooka # define                USC_1STOP                       0x00000000
    439  1.1  pooka # define                USC_1_5STOP                     0x10000000
    440  1.1  pooka # define                USC_2STOP                       0x20000000
    441  1.1  pooka # define                USC_ECHO                        0x40000000 /* rx->tx, tx disabled */
    442  1.1  pooka # define                USC_LOOPBACK                    0x80000000 /* tx->rx, rx/tx disabled */
    443  1.1  pooka # define                USC_ECHO2                       0xc0000000 /* rx->tx, rx disabled */
    444  1.1  pooka 
    445  1.1  pooka # define                USI_RXRDY                       0x00000001
    446  1.1  pooka # define                USI_TXRDY                       0x00000002
    447  1.1  pooka # define                USI_RXBRK                       0x00000004
    448  1.1  pooka # define                USI_ENDRX                       0x00000008
    449  1.1  pooka # define                USI_ENDTX                       0x00000010
    450  1.1  pooka # define                USI_OVRE                        0x00000020
    451  1.1  pooka # define                USI_FRAME                       0x00000040
    452  1.1  pooka # define                USI_PARE                        0x00000080
    453  1.1  pooka # define                USI_TIMEOUT                     0x00000100
    454  1.1  pooka # define                USI_TXEMPTY                     0x00000200
    455  1.1  pooka 
    456  1.1  pooka /*
    457  1.1  pooka  * Timer/Counter (TC)
    458  1.1  pooka  */
    459  1.1  pooka #ifndef __ASSEMBLER__
    460  1.1  pooka struct _Tc {
    461  1.1  pooka     volatile uint32_t   Tag;                  /* ro */
    462  1.1  pooka     volatile uint32_t   Control;              /* rw */
    463  1.1  pooka     volatile uint64_t   FreeRunning;
    464  1.1  pooka     volatile uint32_t   DownCounterHigh;      /* rw */
    465  1.1  pooka     volatile uint32_t   DownCounter;          /* rw */
    466  1.1  pooka     volatile uint32_t   reserved[2];          /* ro padding to 32 bytes total */
    467  1.1  pooka };
    468  1.1  pooka #else
    469  1.1  pooka # define                TCT                             0
    470  1.1  pooka # define                TCC                             4
    471  1.1  pooka # define                TCFH                            8
    472  1.1  pooka # define                TCFL                            12
    473  1.1  pooka # define                TCCH                            16
    474  1.1  pooka # define                TCCL                            20
    475  1.1  pooka #endif /* !__ASSEMBLER__ */
    476  1.1  pooka 
    477  1.1  pooka # define                TCCT_ENABLE                     0x00000001
    478  1.1  pooka # define                TCCT_INT_ENABLE                 0x00000002
    479  1.1  pooka # define                TCCT_CLKO                       0x00000008
    480  1.1  pooka # define                TCCT_RESET                      0x00000010
    481  1.1  pooka # define                TCCT_FINTEN                     0x00000020
    482  1.1  pooka # define                TCCT_CLOCK                      0x000000c0
    483  1.1  pooka # define                TCCT_INTERRUPT                  0x00000100
    484  1.1  pooka # define                TCCT_FINT                       0x00000200
    485  1.1  pooka # define                TCCT_OVERFLOW                   0x00000400
    486  1.1  pooka # define                TCCT_OVERRUN                    0x00000800
    487  1.1  pooka 
    488  1.1  pooka /*
    489  1.1  pooka  * LCD controller
    490  1.1  pooka  */
    491  1.1  pooka #ifndef __ASSEMBLER__
    492  1.1  pooka struct _Lcd {
    493  1.1  pooka     volatile uint32_t   TypeAndTag;           /* ro */
    494  1.1  pooka     volatile uint32_t   Control;              /* rw */
    495  1.1  pooka     volatile uint32_t   Data;                 /* wo */
    496  1.1  pooka     volatile uint32_t   Refresh;              /* wo */
    497  1.1  pooka };
    498  1.1  pooka #else
    499  1.1  pooka # define                LCDBT                            0
    500  1.1  pooka # define                LCDST                            4
    501  1.1  pooka # define                LCDPC                            8
    502  1.1  pooka # define                LCDRF                            12
    503  1.1  pooka #endif /* !__ASSEMBLER__ */
    504  1.1  pooka 
    505  1.1  pooka # define                LCDBT_TAG                       0x0000ffff  /* ro */
    506  1.1  pooka # define                LCDBT_TYPE                      0xffff0000  /* ro */
    507  1.1  pooka 
    508  1.1  pooka # define                LCDST_RST                       0x00000001  /* rw */
    509  1.1  pooka /* other bits are type-specific */
    510  1.1  pooka 
    511  1.1  pooka /*
    512  1.1  pooka  * Watchdog Timer (WD)
    513  1.1  pooka  */
    514  1.1  pooka #ifndef __ASSEMBLER__
    515  1.1  pooka struct _Wd {
    516  1.1  pooka     volatile uint32_t   Tag;                  /* ro */
    517  1.1  pooka     volatile uint32_t   OvflMode;
    518  1.1  pooka     volatile uint32_t   ClockMode;
    519  1.1  pooka     volatile uint32_t   Control;
    520  1.1  pooka     volatile uint32_t   Status;
    521  1.1  pooka     volatile uint32_t   reserved[3];          /* ro padding to 32 bytes total */
    522  1.1  pooka };
    523  1.1  pooka #else
    524  1.1  pooka # define                WDT                             0
    525  1.1  pooka # define                WDO                             4
    526  1.1  pooka # define                WDM                             8
    527  1.1  pooka # define                WDC                             12
    528  1.1  pooka # define                WDS                             16
    529  1.1  pooka #endif /* !__ASSEMBLER__ */
    530  1.1  pooka 
    531  1.1  pooka /*
    532  1.1  pooka  * Power Management Controller (PMC)
    533  1.1  pooka  */
    534  1.1  pooka #ifndef __ASSEMBLER__
    535  1.1  pooka struct _Pmc {
    536  1.1  pooka     volatile uint32_t   Tag;                            /* ro */
    537  1.1  pooka     volatile uint32_t   SystemPowerEnable;              /* rw */
    538  1.1  pooka     volatile uint32_t   SystemPowerDisable;             /* wo */
    539  1.1  pooka     volatile uint32_t   PeripheralPowerEnable;          /* rw */
    540  1.1  pooka     volatile uint32_t   PeripheralPowerDisable;         /* wo */
    541  1.1  pooka     volatile uint32_t   reserved[3];                    /* ro padding to 32 bytes total */
    542  1.1  pooka };
    543  1.1  pooka #else
    544  1.1  pooka # define                PMCT                            0
    545  1.1  pooka # define                PMCSE                           4
    546  1.1  pooka # define                PMCSD                           8
    547  1.1  pooka # define                PMCPE                           12
    548  1.1  pooka # define                PMCPD                           16
    549  1.1  pooka #endif /* !__ASSEMBLER__ */
    550  1.1  pooka 
    551  1.1  pooka # define                PMCSC_CPU       0x00000001
    552  1.1  pooka 
    553  1.1  pooka /* more as we get more.. */
    554  1.1  pooka # define                PMCPC_USART     0x00000001
    555  1.1  pooka 
    556  1.1  pooka 
    557  1.1  pooka /*
    558  1.1  pooka  * System ACE Controller (SAC)
    559  1.1  pooka  */
    560  1.1  pooka 
    561  1.1  pooka #ifndef __ASSEMBLER__
    562  1.1  pooka struct _Sac {
    563  1.1  pooka     volatile uint32_t        Tag;                       /*0x00000000 */
    564  1.1  pooka     volatile uint32_t        Control;                   /*0x00000004 */
    565  1.1  pooka     volatile uint32_t        reserved0[30];
    566  1.1  pooka     volatile uint32_t        BUSMODEREG;                /*0x00000080 */
    567  1.1  pooka     volatile uint32_t        STATUS;                    /*0x00000084 */
    568  1.1  pooka     volatile uint32_t        ERRORREG;                  /*0x00000088 */
    569  1.1  pooka     volatile uint32_t        CFGLBAREG;                 /*0x0000008c */
    570  1.1  pooka     volatile uint32_t        MPULBAREG;                 /*0x00000090 */
    571  1.1  pooka     volatile uint16_t        VERSIONREG;                /*0x00000094 */
    572  1.1  pooka     volatile uint16_t        SECCNTCMDREG;              /*0x00000096 */
    573  1.1  pooka     volatile uint32_t        CONTROLREG;                /*0x00000098 */
    574  1.1  pooka     volatile uint16_t        reserved1[1];
    575  1.1  pooka     volatile uint16_t        FATSTATREG;                /*0x0000009e */
    576  1.1  pooka     volatile uint32_t        reserved2[8];
    577  1.1  pooka     volatile uint32_t        DATABUFREG[16];            /*0x000000c0 */
    578  1.1  pooka };
    579  1.1  pooka #endif /* !__ASSEMBLER__ */
    580  1.1  pooka 
    581  1.1  pooka /*    volatile uint32_t        Tag;                      0x00000000 */
    582  1.1  pooka # define                SAC_TAG                          0x0000ffff
    583  1.1  pooka 
    584  1.1  pooka /*    volatile uint32_t        Control;                  0x00000004 */
    585  1.1  pooka # define                SAC_SIZE                         0x0000ffff
    586  1.1  pooka # define                SAC_RST                          0x00010000
    587  1.1  pooka # define                SAC_BUS8                         0x00020000
    588  1.1  pooka # define                SAC_BUS16                        0x00040000
    589  1.1  pooka # define                SAC_BUS32                        0x00080000
    590  1.1  pooka # define                SAC_IRQ                          0x00100000
    591  1.1  pooka # define                SAC_BRDY                         0x00200000
    592  1.1  pooka # define                SAC_INTMASK                      0x00c00000
    593  1.1  pooka # define                SAC_TDELAY                       0x0f000000
    594  1.1  pooka # define                SAC_BUFW8                        0x10000000
    595  1.1  pooka # define                SAC_BUFW16                       0x20000000
    596  1.1  pooka # define                SAC_BUFW32                       0x40000000
    597  1.1  pooka # define                SAC_DEBUG                        0x80000000
    598  1.1  pooka 
    599  1.1  pooka /*    volatile uint32_t        BUSMODEREG;               0x00000080 */
    600  1.1  pooka # define                SAC_MODE16                       0x00000001
    601  1.1  pooka 
    602  1.1  pooka /*    volatile uint32_t        STATUS;                   0x00000084 */
    603  1.1  pooka # define                SAC_CFGLOCK                      0x00000001
    604  1.1  pooka # define                SAC_MPULOCK                      0x00000002
    605  1.1  pooka # define                SAC_CFGERROR                     0x00000004
    606  1.1  pooka # define                SAC_CFCERROR                     0x00000008
    607  1.1  pooka # define                SAC_CFDETECT                     0x00000010
    608  1.1  pooka # define                SAC_DATABUFRDY                   0x00000020
    609  1.1  pooka # define                SAC_DATABUFMODE                  0x00000040
    610  1.1  pooka # define                SAC_CFGDONE                      0x00000080
    611  1.1  pooka # define                SAC_RDYFORCFCMD                  0x00000100
    612  1.1  pooka # define                SAC_CFGMODEPIN                   0x00000200
    613  1.1  pooka # define                SAC_CFGADDRPINS                  0x0000e000
    614  1.1  pooka # define                SAC_CFBSY                        0x00020000
    615  1.1  pooka # define                SAC_CFRDY                        0x00040000
    616  1.1  pooka # define                SAC_CFDWF                        0x00080000
    617  1.1  pooka # define                SAC_CFDSC                        0x00100000
    618  1.1  pooka # define                SAC_CFDRQ                        0x00200000
    619  1.1  pooka # define                SAC_CFCORR                       0x00400000
    620  1.1  pooka # define                SAC_CFERR                        0x00800000
    621  1.1  pooka 
    622  1.1  pooka /*    volatile uint32_t        ERRORREG;                 0x00000088 */
    623  1.1  pooka # define                SAC_CARDRESETERR                 0x00000001
    624  1.1  pooka # define                SAC_CARDRDYERR                   0x00000002
    625  1.1  pooka # define                SAC_CARDREADERR                  0x00000004
    626  1.1  pooka # define                SAC_CARDWRITEERR                 0x00000008
    627  1.1  pooka # define                SAC_SECTORRDYERR                 0x00000010
    628  1.1  pooka # define                SAC_CFGADDRERR                   0x00000020
    629  1.1  pooka # define                SAC_CFGFAILED                    0x00000040
    630  1.1  pooka # define                SAC_CFGREADERR                   0x00000080
    631  1.1  pooka # define                SAC_CFGINSTRERR                  0x00000100
    632  1.1  pooka # define                SAC_CFGINITERR                   0x00000200
    633  1.1  pooka # define                SAC_CFBBK                        0x00000800
    634  1.1  pooka # define                SAC_CFUNC                        0x00001000
    635  1.1  pooka # define                SAC_CFIDNF                       0x00002000
    636  1.1  pooka # define                SAC_CFABORT                      0x00004000
    637  1.1  pooka # define                SAC_CFAMNF                       0x00008000
    638  1.1  pooka 
    639  1.1  pooka /*    volatile uint16_t        VERSIONREG;               0x00000094 */
    640  1.1  pooka # define                SAC_VERREV                       0x000000ff
    641  1.1  pooka # define                SAC_VERMINOR                     0x00000f00
    642  1.1  pooka # define                SAC_VERMAJOR                     0x0000f000
    643  1.1  pooka 
    644  1.1  pooka /*    volatile uint16_t        SECCNTCMDREG;             0x00000096 */
    645  1.1  pooka # define                SAC_SECCCNT                      0x000000ff
    646  1.1  pooka # define                SAC_CMD                          0x00000700
    647  1.1  pooka # define                SAC_CMD_RESETMEMCARD             0x00000100
    648  1.1  pooka # define                SAC_CMD_IDENTIFYMEMCARD          0x00000200
    649  1.1  pooka # define                SAC_CMD_READMEMCARDDATA          0x00000300
    650  1.1  pooka # define                SAC_CMD_WRITEMEMCARDDATA         0x00000400
    651  1.1  pooka # define                SAC_CMD_ABORT                    0x00000600
    652  1.1  pooka 
    653  1.1  pooka /*    volatile uint32_t        CONTROLREG;               0x00000098 */
    654  1.1  pooka # define                SAC_FORCELOCKREQ                 0x00000001
    655  1.1  pooka # define                SAC_LOCKREQ                      0x00000002
    656  1.1  pooka # define                SAC_FORCECFGADDR                 0x00000004
    657  1.1  pooka # define                SAC_FORCECFGMODE                 0x00000008
    658  1.1  pooka # define                SAC_CFGMODE                      0x00000010
    659  1.1  pooka # define                SAC_CFGSTART                     0x00000020
    660  1.1  pooka # define                SAC_CFGSEL                       0x00000040
    661  1.1  pooka # define                SAC_CFGRESET                     0x00000080
    662  1.1  pooka # define                SAC_DATABUFRDYIRQ                0x00000100
    663  1.1  pooka # define                SAC_ERRORIRQ                     0x00000200
    664  1.1  pooka # define                SAC_CFGDONEIRQ                   0x00000400
    665  1.1  pooka # define                SAC_RESETIRQ                     0x00000800
    666  1.1  pooka # define                SAC_CFGPROG                      0x00001000
    667  1.1  pooka # define                SAC_CFGADDRBIT                   0x0000e000
    668  1.1  pooka # define                SAC_CFGADDR_0                    0x00000000
    669  1.1  pooka # define                SAC_CFGADDR_1                    0x00002000
    670  1.1  pooka # define                SAC_CFGADDR_2                    0x00004000
    671  1.1  pooka # define                SAC_CFGADDR_3                    0x00006000
    672  1.1  pooka # define                SAC_CFGADDR_4                    0x00008000
    673  1.1  pooka # define                SAC_CFGADDR_5                    0x0000a000
    674  1.1  pooka # define                SAC_CFGADDR_6                    0x0000c000
    675  1.1  pooka # define                SAC_CFGADDR_7                    0x0000e000
    676  1.1  pooka # define                SAC_CFGRSVD                      0x00070000
    677  1.1  pooka 
    678  1.1  pooka /*    volatile uint16_t        FATSTATREG;               0x0000009e */
    679  1.1  pooka # define                SAC_MBRVALID                     0x00000001
    680  1.1  pooka # define                SAC_PBRVALID                     0x00000002
    681  1.1  pooka # define                SAC_MBRFAT12                     0x00000004
    682  1.1  pooka # define                SAC_PBRFAT12                     0x00000008
    683  1.1  pooka # define                SAC_MBRFAT16                     0x00000010
    684  1.1  pooka # define                SAC_PBRFAT16                     0x00000020
    685  1.1  pooka # define                SAC_CALCFAT12                    0x00000040
    686  1.1  pooka # define                SAC_CALCFAT16                    0x00000080
    687  1.1  pooka 
    688  1.1  pooka /*
    689  1.1  pooka  * Extension Controller (EC)
    690  1.1  pooka  */
    691  1.1  pooka 
    692  1.1  pooka #define EC_MAX_BATS 5
    693  1.1  pooka #ifndef __ASSEMBLER__
    694  1.1  pooka struct _Ec {
    695  1.1  pooka     volatile uint32_t        Tag;                       /*0x00000000 */
    696  1.1  pooka     volatile uint32_t        Control;                   /*0x00000004 */
    697  1.1  pooka     volatile uint32_t        SlotStatusAndTag;          /*0x00000008 */
    698  1.1  pooka     volatile uint32_t        BatOrSize[EC_MAX_BATS];    /*0x0000000c */
    699  1.1  pooka };
    700  1.1  pooka #endif /* !__ASSEMBLER__ */
    701  1.1  pooka 
    702  1.1  pooka /*    volatile uint32_t        Tag;                      0x00000000 */
    703  1.1  pooka # define                ECT_TAG                          0x0000ffff
    704  1.1  pooka 
    705  1.1  pooka /*    volatile uint32_t        Control;                  0x00000004 */
    706  1.1  pooka # define                ECC_SIZE                         0x0000ffff
    707  1.1  pooka # define                ECC_RST                          0x00010000
    708  1.1  pooka # define                ECC_IRQ                          0x00020000  /* write-one-to-clear */
    709  1.1  pooka # define                ECC_IRQ_ENABLE                   0x00040000
    710  1.1  pooka # define                ECC_INT_LOAD                     0x00100000
    711  1.1  pooka # define                ECC_INT_UNLOAD                   0x00200000
    712  1.1  pooka # define                ECC_SLOTNO                       0xff000000
    713  1.1  pooka # define                ECC_SLOTNO_SHIFT                 24
    714  1.1  pooka # define                ECC_WANTS_INTERRUPT              0x00400000  /* extension needs interrupt */
    715  1.1  pooka # define                ECC_PRIVILEDGED                  0x00800000  /* extension needs priv interface */
    716  1.1  pooka 
    717  1.1  pooka /*    volatile uint32_t        SlotStatusAndTag;         0x00000008 */
    718  1.1  pooka # define                ECS_TAG                          0x0000ffff  /* of the selected slot */
    719  1.1  pooka # define                ECS_STATUS                       0x00ff0000
    720  1.1  pooka # define                ECS_ABSENT                       0x00000000  /* not loaded */
    721  1.1  pooka # define                ECS_CONFIG                       0x00010000  /* needs configuration */
    722  1.1  pooka # define                ECS_RUN                          0x00020000  /* running ok */
    723  1.1  pooka # define                ECS_PM0                          0x00030000  /* power management state 0 */
    724  1.1  pooka # define                ECS_PM1                          0x00040000  /* power management state 1 */
    725  1.1  pooka # define                ECS_PM2                          0x00050000  /* power management state 2 */
    726  1.1  pooka 
    727  1.1  pooka /*    volatile uint32_t        BatOrSize[5];             0x0000000c */
    728  1.1  pooka /* In the CONFIG state reads the size (flipped decode mask) for the corresponding bat */
    729  1.1  pooka # define                ECB_SIZE_NONE                    0x00000000
    730  1.1  pooka # define                ECB_SIZE_4                       0x00000003
    731  1.1  pooka # define                ECB_SIZE_8                       0x00000007 /* and so on, 2^N */
    732  1.1  pooka /* In non-CONFIG states reads the value of the corresponding Base Address Translation */
    733  1.1  pooka /* In all states, writes back to the corresponding BAT */
    734  1.1  pooka # define                ECB_BAT_VALID                    0x00000001
    735  1.1  pooka # define                ECB_BAT                          0xfffffff8
    736  1.1  pooka 
    737  1.1  pooka /*
    738  1.1  pooka  * Common interface for packet-based device interfaces (CPBDI)
    739  1.1  pooka  */
    740  1.1  pooka 
    741  1.1  pooka #ifndef __ASSEMBLER__
    742  1.1  pooka #define CPBDI_STRUCT_DECLARATION {                                                  \
    743  1.1  pooka     volatile uint32_t   Tag;                  /* ro */                              \
    744  1.1  pooka     volatile uint32_t   Control;              /* rw */                              \
    745  1.1  pooka     /* FIFO interface. Write-> input FIFO; Read-> output FIFO */                    \
    746  1.1  pooka     volatile uint32_t  SizeAndFlags;                                                \
    747  1.1  pooka     volatile uint32_t  BufferAddressHi32;                                           \
    748  1.1  pooka     volatile uint32_t  BufferAddressLo32;  /* write/read of this word acts */       \
    749  1.1  pooka     volatile uint32_t  Pad[3];             /* round to 32bytes */                   \
    750  1.1  pooka }
    751  1.1  pooka 
    752  1.1  pooka struct _Cpbdi    CPBDI_STRUCT_DECLARATION;
    753  1.1  pooka #else
    754  1.1  pooka # define                CPBDIT                           0
    755  1.1  pooka # define                CPBDIC                           4
    756  1.1  pooka # define                CPBDIS                           8
    757  1.1  pooka # define                CPBDIH                           12
    758  1.1  pooka # define                CPBDIL                           16
    759  1.1  pooka # define                CPBDI_SIZE                       32
    760  1.1  pooka #endif /* !__ASSEMBLER__ */
    761  1.1  pooka 
    762  1.1  pooka /* Common defines for Control register */
    763  1.1  pooka # define                CPBDI_RESET                     0x00000001   /* autoclear */
    764  1.1  pooka # define                CPBDI_INTEN                     0x00000002   /* interrupt enable */
    765  1.1  pooka # define                CPBDI_DONE                      0x00000004   /* interrupt pending aka done */
    766  1.1  pooka # define                CPBDI_IF_FULL                   0x00000010   /* input fifo full */
    767  1.1  pooka # define                CPBDI_OF_EMPTY                  0x00000020   /* output fifo empty */
    768  1.1  pooka # define                CPBDI_URUN                      0x00000040   /* recvr ran out of buffers */
    769  1.1  pooka # define                CPBDI_ERROR                     0x80000000   /* unrecoverable error */
    770  1.1  pooka 
    771  1.1  pooka /* Common defines for SizeAndFlags register */
    772  1.1  pooka # define                CPBDI_F_MASK                    0xf0000000
    773  1.1  pooka # define                CPBDI_F_DONE                    0x80000000
    774  1.1  pooka # define                CPBDI_F_XMIT                    0x00000000
    775  1.1  pooka # define                CPBDI_F_RECV                    0x10000000
    776  1.1  pooka # define                CPBDI_F_CMD                     0x20000000
    777  1.1  pooka 
    778  1.1  pooka /*
    779  1.1  pooka  * Ethernet interface (ENIC)
    780  1.1  pooka  */
    781  1.1  pooka 
    782  1.1  pooka #ifndef __ASSEMBLER__
    783  1.1  pooka struct _Enic    CPBDI_STRUCT_DECLARATION;
    784  1.1  pooka #else
    785  1.1  pooka # define                ENICT                           CPBDIT
    786  1.1  pooka # define                ENICC                           CPBDIC
    787  1.1  pooka # define                ENICS                           CPBDIS
    788  1.1  pooka # define                ENICH                           CPBDIH
    789  1.1  pooka # define                ENICL                           CPBDIL
    790  1.1  pooka # define                ENIC_SIZE                       CPBDI_SIZE
    791  1.1  pooka #endif /* !__ASSEMBLER__ */
    792  1.1  pooka 
    793  1.1  pooka # define                EC_RESET                        CPBDI_RESET
    794  1.1  pooka # define                EC_INTEN                        CPBDI_INTEN
    795  1.1  pooka # define                EC_DONE                         CPBDI_DONE
    796  1.1  pooka # define                EC_RXDIS                        0x00000008   /* recv disabled */
    797  1.1  pooka # define                EC_IF_FULL                      CPBDI_IF_FULL
    798  1.1  pooka # define                EC_OF_EMPTY                     CPBDI_OF_EMPTY
    799  1.1  pooka # define                EC_URUN                         CPBDI_URUN
    800  1.1  pooka # define                EC_ERROR                        CPBDI_ERROR
    801  1.1  pooka # define                EC_WMASK                        0x0000000b   /* user-writeable bits */
    802  1.1  pooka 
    803  1.1  pooka # define                ES_F_MASK                       CPBDI_F_MASK
    804  1.1  pooka # define                ES_F_DONE                       CPBDI_F_DONE
    805  1.1  pooka # define                ES_F_XMIT                       CPBDI_F_XMIT
    806  1.1  pooka # define                ES_F_RECV                       CPBDI_F_RECV
    807  1.1  pooka # define                ES_F_CMD                        CPBDI_F_CMD
    808  1.1  pooka # define                ES_S_MASK                       0xFFFF
    809  1.1  pooka 
    810  1.1  pooka /* Command codes in a command buffer (first byte)
    811  1.1  pooka  */
    812  1.1  pooka #define ENIC_CMD_NOP           0x00
    813  1.1  pooka #define ENIC_CMD_GET_INFO      0x01
    814  1.1  pooka #ifndef __ASSEMBLER__
    815  1.1  pooka typedef struct {
    816  1.1  pooka     uint8_t  InputFifoSize;
    817  1.1  pooka     uint8_t  OutputFifoSize;
    818  1.1  pooka     uint8_t  CompletionFifoSize;
    819  1.1  pooka     uint8_t  ErrorCount;
    820  1.1  pooka     uint16_t FramesDropped;
    821  1.1  pooka     uint16_t Reserved;
    822  1.1  pooka } ENIC_INFO, *PENIC_INFO;
    823  1.1  pooka #endif /* !__ASSEMBLER__ */
    824  1.1  pooka 
    825  1.1  pooka #define ENIC_CMD_GET_ADDRESS   0x02
    826  1.1  pooka #ifndef __ASSEMBLER__
    827  1.1  pooka typedef struct {
    828  1.1  pooka     uint8_t  Mac[6];
    829  1.1  pooka } ENIC_MAC, *PENIC_MAC;
    830  1.1  pooka #endif /* !__ASSEMBLER__ */
    831  1.1  pooka 
    832  1.1  pooka /*
    833  1.1  pooka  * Internal Configuration Access Point (ICAP) interface
    834  1.1  pooka  */
    835  1.1  pooka 
    836  1.1  pooka #ifndef __ASSEMBLER__
    837  1.1  pooka struct _Icap    CPBDI_STRUCT_DECLARATION;
    838  1.1  pooka #else
    839  1.1  pooka # define                ICAPT                           CPBDIT
    840  1.1  pooka # define                ICAPC                           CPBDIC
    841  1.1  pooka # define                ICAPS                           CPBDIS
    842  1.1  pooka # define                ICAPH                           CPBDIH
    843  1.1  pooka # define                ICAPL                           CPBDIL
    844  1.1  pooka # define                ICAP_SIZE                       CPBDI_SIZE
    845  1.1  pooka #endif /* !__ASSEMBLER__ */
    846  1.1  pooka 
    847  1.1  pooka # define                ICAPC_RESET                     CPBDI_RESET
    848  1.1  pooka # define                ICAPC_INTEN                     CPBDI_INTEN
    849  1.1  pooka # define                ICAPC_DONE                      CPBDI_DONE
    850  1.1  pooka # define                ICAPC_IF_FULL                   CPBDI_IF_FULL
    851  1.1  pooka # define                ICAPC_OF_EMPTY                  CPBDI_OF_EMPTY
    852  1.1  pooka # define                ICAPC_ERROR                     CPBDI_ERROR
    853  1.1  pooka # define                ICAPC_WMASK                     0x00000007   /* user-writeable bits */
    854  1.1  pooka 
    855  1.1  pooka # define                ICAPS_F_MASK                    CPBDI_F_MASK
    856  1.1  pooka # define                ICAPS_F_DONE                    CPBDI_F_DONE
    857  1.1  pooka # define                ICAPS_F_XMIT                    CPBDI_F_XMIT
    858  1.1  pooka # define                ICAPS_F_RECV                    CPBDI_F_RECV
    859  1.1  pooka # define                ICAPS_F_CMD                     CPBDI_F_CMD  /* TBD */
    860  1.1  pooka # define                ICAPS_S_MASK                    0x0FFFFFFF
    861  1.1  pooka 
    862  1.1  pooka /*
    863  1.1  pooka  * Extensible Video Graphic Array (EVGA) interface
    864  1.1  pooka  */
    865  1.1  pooka 
    866  1.1  pooka #ifndef __ASSEMBLER__
    867  1.1  pooka struct _Evga    CPBDI_STRUCT_DECLARATION;
    868  1.1  pooka #else
    869  1.1  pooka # define                EVGAT                           CPBDIT
    870  1.1  pooka # define                EVGAC                           CPBDIC
    871  1.1  pooka # define                EVGAS                           CPBDIS
    872  1.1  pooka # define                EVGAH                           CPBDIH
    873  1.1  pooka # define                EVGAL                           CPBDIL
    874  1.1  pooka # define                EVGA_SIZE                       CPBDI_SIZE
    875  1.1  pooka #endif /* !__ASSEMBLER__ */
    876  1.1  pooka 
    877  1.1  pooka # define                EVGAC_RESET                     CPBDI_RESET
    878  1.1  pooka # define                EVGAC_INTEN                     CPBDI_INTEN
    879  1.1  pooka # define                EVGAC_DONE                      CPBDI_DONE
    880  1.1  pooka # define                EVGAC_IF_FULL                   CPBDI_IF_FULL
    881  1.1  pooka # define                EVGAC_OF_EMPTY                  CPBDI_OF_EMPTY
    882  1.1  pooka # define                EVGAC_ERROR                     CPBDI_ERROR
    883  1.1  pooka # define                EVGAC_WMASK                     0x00000007   /* user-writeable bits */
    884  1.1  pooka 
    885  1.1  pooka # define                EVGAS_F_MASK                    CPBDI_F_MASK
    886  1.1  pooka # define                EVGAS_F_DONE                    CPBDI_F_DONE
    887  1.1  pooka # define                EVGAS_F_XMIT                    CPBDI_F_XMIT
    888  1.1  pooka # define                EVGAS_F_RECV                    CPBDI_F_RECV
    889  1.1  pooka # define                EVGAS_F_CMD                     CPBDI_F_CMD
    890  1.1  pooka # define                EVGAS_S_MASK                    0x0FFFFFFF
    891  1.1  pooka 
    892  1.1  pooka /* Command codes in a command buffer (first byte) */
    893  1.1  pooka #define EVGA_CMD_NOP           0x00
    894  1.1  pooka #define EVGA_CMD_IDENTIFY      0x01
    895  1.1  pooka #ifndef __ASSEMBLER__
    896  1.1  pooka typedef struct {
    897  1.1  pooka     uint8_t  CommandEcho;
    898  1.1  pooka     uint8_t  InterfaceVersion;
    899  1.1  pooka     uint16_t Size;                        /* of this structure, all bytes counted */
    900  1.1  pooka     uint16_t PciVendorId;                 /* See PCI catalog */
    901  1.1  pooka     uint16_t PciProductId;                /* See PCI catalog */
    902  1.1  pooka     uint32_t StandardCaps;                /* TBD */
    903  1.1  pooka     uint8_t  InputFifoSize;
    904  1.1  pooka     uint8_t  OutputFifoSize;
    905  1.1  pooka     uint8_t  CompletionFifoSize;
    906  1.1  pooka     uint8_t  ErrorCount;
    907  1.1  pooka     /* More as needed */
    908  1.1  pooka } EVGA_IDENTIFY, *PEVGA_IDENTIFY;
    909  1.1  pooka #endif /* !__ASSEMBLER__ */
    910  1.1  pooka #define EVGA_IDENTIFY_BIG_ENDIAN                        0x00
    911  1.1  pooka #define EVGA_IDENTIFY_LITTLE_ENDIAN                     0x80
    912  1.1  pooka #define EVGA_IDENTIFY_VERSION_1                         0x01
    913  1.1  pooka 
    914  1.1  pooka 
    915  1.1  pooka #define EVGA_CMD_2D_SET_BASE   0x02
    916  1.1  pooka #define EVGA_CMD_2D_GET_BASE   0x03
    917  1.1  pooka #ifndef __ASSEMBLER__
    918  1.1  pooka typedef struct {
    919  1.1  pooka     uint8_t  CommandEcho;
    920  1.1  pooka     uint8_t  Pad[3];
    921  1.1  pooka     uint32_t AddressLow32;
    922  1.1  pooka     uint32_t AddressHigh32;
    923  1.1  pooka } EVGA_2D_BASE, *PEVGA_2D_BASE;
    924  1.1  pooka 
    925  1.1  pooka #endif /* !__ASSEMBLER__ */
    926  1.1  pooka 
    927  1.1  pooka 
    928  1.1  pooka 
    929  1.1  pooka #endif /* _MIPS32_EMIPS_EMIPSREG_H_ */
    930