?? template.h
字號:
/* template.h - template board header *//* Copyright 2002 Wind River Systems, Inc. *//*TODO - Remove the template modification history and begin a new history starting with version 01a and growing the history upward with each revision.modification history--------------------01a,21may02,scm written*//* TODO - Fill in this file with I/O addresses and related constants for the template BSP. Anything with "template" as a prefix needs to examined and re-named to id the BSP (i.e. iq80321, iq80310, etc.), and this file should be re-named from "template.h" to iq80321.h, iq80310.h, etc.*//*DESCRIPTIONThis file contains I/O address and related constants for thetemplate BSP.*/#ifndef INCtemplateh#define INCtemplateh#ifdef __cplusplusextern "C" {#endif/*------------------------------------------------------------- * template Macro Defintions... * ------------------------------------------------------------*/#define BIT(bitNumber) (1 << (bitNumber))#define template_REG_READ8 (reg,result)\ ((result) = *(volatile UINT8 *)(reg))#define template_REG_WRITE8 (reg,data)\ (*((volatile UINT8 *)(reg)) = (data))#define template_REG_READ16 (reg,result)\ ((result) = *(volatile UINT16 *)(reg))#define template_REG_WRITE16 (reg,data)\ (*((volatile UINT16 *)(reg)) = (data))#define template_REG_READ32 (reg,result)\ ((result) = *(volatile UINT32 *)(reg))#define template_REG_WRITE32 (reg,data)\ (*((volatile UINT32 *)(reg)) = (data))#define SWAP16(x) ((((x) << 8) | ((x) >> 8)) & 0xFFFF)#define SWAP32(x) (((x) << 24) | \ (((x) & 0x0000FF00) << 8) | \ (((x) & 0x00FF0000) >> 8) | \ (((unsigned int)(x)) >> 24))#if (_BYTE_ORDER == _BIG_ENDIAN)#define SWAP32PCIFUNC(x) (swap32(x))#define SWAP16PCIFUNC(x) (swap16(x))#define SWAP16PCI(x) (SWAP16(x))#define SWAP32PCI(x) (SWAP32(x))#else#define SWAP32PCIFUNC(x) (x)#define SWAP16PCIFUNC(x) (x)#define SWAP16PCI(x) (x)#define SWAP32PCI(x) (x)#endif#define PCI_IN_BYTE(x) *(volatile UINT8 *) (x)#define PCI_IN_WORD(x) *(volatile UINT16 *) (x)#define PCI_IN_LONG(x) *(volatile UINT32 *) (x)#define PCI_OUT_BYTE(x,y) *(volatile UINT8 *) (x) = (UINT8) (y)#define PCI_OUT_WORD(x,y) *(volatile UINT16 *) (x) = (UINT16) (y)#define PCI_OUT_LONG(x,y) *(volatile UINT32 *) (x) = (UINT32) (y)#define PCI_SET_OUT_BYTE(x,y) PCI_OUT_BYTE((int)x, (PCI_IN_BYTE(x) | y))#define PCI_SET_OUT_WORD(x,y) PCI_OUT_WORD((int)x, (PCI_IN_WORD(x) | y))#define PCI_SET_OUT_LONG(x,y) PCI_OUT_LONG((int)x, (PCI_IN_LONG(x) | y))#define PCI_CLEAR_OUT_BYTE(x,y) PCI_OUT_BYTE((int)x, (PCI_IN_BYTE(x) & ~y))#define PCI_CLEAR_OUT_WORD(x,y) PCI_OUT_WORD((int)x, (PCI_IN_WORD(x) & ~y))#define PCI_CLEAR_OUT_LONG(x,y) PCI_OUT_LONG((int)x, (PCI_IN_LONG(x) & ~y))/*------------------------------------------------------------- * template Generic Constants... * ------------------------------------------------------------*/#define SZ_0 0x00000000#define SZ_1 0x00000001#define SZ_2 0x00000002#define SZ_4 0x00000004#define SZ_8 0x00000008#define SZ_16 0x00000010#define SZ_32 0x00000020#define SZ_48 0x00000030#define SZ_64 0x00000040#define SZ_128 0x00000080#define SZ_256 0x00000100#define SZ_512 0x00000200#define SZ_1K 0x00000400#define SZ_2K 0x00000800#define SZ_4K 0x00001000#define SZ_8K 0x00002000#define SZ_16K 0x00004000#define SZ_32K 0x00008000#define SZ_64K 0x00010000#define SZ_128K 0x00020000#define SZ_256K 0x00040000#define SZ_512K 0x00080000#define SZ_1M 0x00100000#define SZ_2M 0x00200000#define SZ_3M 0x00300000#define SZ_4M 0x00400000#define SZ_8M 0x00800000#define SZ_16M 0x01000000#define SZ_32M 0x02000000#define SZ_48M 0x03000000#define SZ_64M 0x04000000#define SZ_128M 0x08000000#define SZ_256M 0x10000000#define SZ_512M 0x20000000#define SZ_1G 0x40000000#define SZ_2G 0x80000000/*TODO: Fill in this file with I/O addresses and related constants for the template BSP. Anything with "template" as a prefix needs to examined and re-named to id the BSP (i.e. iq80321, iq80310, etc.) *//*============================================================= * Processor Specific Register Constants... * ============================================================*//*------------------------------------------------------------- * template Peripheral Registers... * ------------------------------------------------------------*//*------------------------------------------------------------- * template ATU Address Translation... * ------------------------------------------------------------*//*------------------------------------------------------------- * template Memory Controller Unit... * ------------------------------------------------------------*//* Refresh frequqnecy - depending on Memory Controller may not be needed *//* refresh set for 200 Mhz */#define template_MCU_RFR_DEFAULT_VAL 0xFFF/*------------------------------------------------------------- * template Peripheral Bus Interface... * ------------------------------------------------------------*//*------------------------------------------------------------- * template I2C Bus Interface... * ------------------------------------------------------------*//*------------------------------------------------------------- * template Processor Arbitration Unit... * ------------------------------------------------------------*//*------------------------------------------------------------- * template Timers... * ------------------------------------------------------------*//* Timer Mode Registers Internal Bus Address */#define template_TMR0_REG 0xdeadbeef#define template_TMR1_REG 0xdeadbeef/* Timer Input Clock Selects -depending on Timers may not be supported */#define template_TMR_CSEL_CORE 0x00#define template_TMR_CSEL_CORE4 0x00#define template_TMR_CSEL_CORE8 0x00#define template_TMR_CSEL_CORE16 0x00/* Needed by BSP *//* Minimum rate at which the system clock can run */#define SYS_CLK_RATE_MIN 0x0/* 1000 ticks, Maximum rate at which the system clock can run */#define SYS_CLK_RATE_MAX 0xFFF#ifdef INCLUDE_AUX_CLK/* Minimum rate at which the auxiliary clock can run */#define AUX_CLK_RATE_MIN 0x0/* 1000 ticks, Maximum rate at which the auxiliary clock can run */#define AUX_CLK_RATE_MAX 0xFFF#endif/*------------------------------------------------------------- * template Interrupt Controller and General Purpose I/O Unit... * ------------------------------------------------------------*//* PCI Interrupt Routing Select Register */#define template_PIRSR_REG 0xdeadbeef#define template_RESERVED_INT_MSK (0xFFFFFFFF)#define template_INT_NUM_LEVELS (32)#define template_INT_MAX_LEVELS (32)#define template_INT_MODE INT_NON_PREEMPT_MODEL/* Interrupt Bit Positions *//* Timer Interrupts */#define template_INT_TMR0 (00)#define template_INT_TMR1 (00)/* External Interrupts *//* typically assigned to PCI, UART, secondary slot, etc. */#define template_INT_XINT0 (00)#define template_INT_XINT1 (00)#define template_INT_XINT2 (00)#define template_INT_XINT3 (00)#define template_MASK_ALL_INT (0x00000000)/*------------------------------------------------------------- * template Core and Core Performance Monitoring... * ------------------------------------------------------------*//*============================================================= * template Development Board Specific Defines... * ============================================================*//*------------------------------------------------------------- * template Memory Controller... * ------------------------------------------------------------*//* * TODO - Change sizes accordingly... *//* DRAM Starting Address */#define template_SDRAM_BASE_ADDR LOCAL_MEM_LOCAL_ADRS /* SDRAM Address */#define template_SDRAM_BASE_SIZE SZ_128M /* SDRAM 128 MB Default */#define template_SDRAM_BANK_SIZE SZ_8M /* SDRAM 8 MB *//* Boot Flash */#define template_BOOT_FLASH_ADDR 0x00000000#define template_BOOT_FLASH_SIZE SZ_8M/* defaults for LOCAL_MEM_AUTOSIZE */#define template_SDRAM_FIXED_SIZE template_SDRAM_BASE_SIZE /* Size is in MB, 128M */#define template_SDRAM_BANK0_SIZE SZ_128M /* bank size in megabytes */#define template_SDRAM_BANK1_SIZE 0 /* bank size in megabytes */#define template_SDRAM_FIXED_WIDTH 0x8 /* 8 bit memory */#define template_SDRAM_DIMM_COUNT 0x1 /* DIMM count (1 or 2) *//*------------------------------------------------------------- * template UARTs... * ------------------------------------------------------------*//* UART 1 base address */#define template_UART1_REG 0xdeadbeef #ifdef SECOND_UART/* UART 2 base address */#define template_UART2_REG 0xdeadbeef#endif/* UART Clock frequency (for both) */#define template_UART_XTAL 1843200 /* Byte space between registers */#define template_UART_REG_DELTA 1/* Two UARTs in this board */#ifdef SECOND_UART#define template_UART_N_UARTS 2#else#define template_UART_N_UARTS 1#endif#ifdef INCLUDE_HEX_LED/*------------------------------------------------------------- * template 7 Segment LED... * ------------------------------------------------------------*//** 0-On, 1-Off **//* A1/2 Bit 7 --------- | | F1/2 | | B1/2 Bit 2 | | Bit 6 | G1/2 | | Bit 1 | --------- | | E1/2 | | C1/2 Bit 3 | | Bit 5 | D1/2 | | Bit 4 | DP1/2 --------- * Bit 0 (dot)*//* * TODO - Depending on Hex LED, these values will need modifications *//** Numerals **/#define L7SEG_0 0x03 /* 0 */#define L7SEG_1 0x9f /* 1 */#define L7SEG_2 0x25 /* 2 */#define L7SEG_3 0x0d /* 3 */#define L7SEG_4 0x99 /* 4 */#define L7SEG_5 0x49 /* 5 */#define L7SEG_6 0x41 /* 6 */#define L7SEG_7 0x1f /* 7 */#define L7SEG_8 0x01 /* 8 */#define L7SEG_9 0x19 /* 9 *//** Alphas **/#define L7SEG_A 0x11 /* A */#define L7SEG_B 0xc1 /* b */#define L7SEG_C 0x63 /* C */#define L7SEG_D 0x85 /* D */#define L7SEG_E 0x61 /* E */#define L7SEG_F 0x71 /* F */#define L7SEG_g 0x09 /* g */#define L7SEG_H 0x91 /* H */#define L7SEG_h 0xd1 /* h */#define L7SEG_i 0xdf /* i */#define L7SEG_J 0x8f /* J */#define L7SEG_L 0xe3 /* L */#define L7SEG_n 0xd5 /* n */#define L7SEG_o 0xc5 /* o */#define L7SEG_P 0x31 /* P */#define L7SEG_r 0xf5 /* r */#define L7SEG_S 0x92 /* S */#define L7SEG_U 0x83 /* U */#define L7SEG_u 0xc7 /* u *//** Segment On **/#define L7SEG_Tp 0x7f /* top */#define L7SEG_Tr 0xbf /* top right */#define L7SEG_Br 0xdf /* bottom right */#define L7SEG_Rs 0x9f /* right side */#define L7SEG_Bm 0x3f /* bottom */#define L7SEG_Bl 0xf7 /* bootom left */#define L7SEG_Tl 0xfb /* top left */#define L7SEG_Ls 0xf3 /* left side */#define L7SEG_Md 0xfd /* middle */#define L7SEG_Dot 0xfe /* dot */#define L7SEG_ALL_ON 0x00 /* 8.*/#define L7SEG_ALL_OFF 0xFF /* */#ifdef INCLUDE_HEX_LED/* 7 Segment Numeric LED base address */#define template_7SEG_LED_LSB_REG 0xdeadbeef#ifdef SECOND_HEX_LED#define template_7SEG_LED_MSB_REG 0xdeadbeef#endif#endif#endif/*------------------------------------------------------------- * template Rotary Switch... * ------------------------------------------------------------*//* Rotary Switch base address */#define template_ROTSW_REG 0xdeadbeef /*------------------------------------------------------------- * template Battery Status... * ------------------------------------------------------------*//* Battery Status base address */#define template_BATSTAT_REG 0xdeadbeef #ifdef __cplusplus}#endif#endif /* INCtemplateh */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -