1 #ifndef CYGONCE_KARO_TX27_H
2 #define CYGONCE_KARO_TX27_H
4 //=============================================================================
6 // Platform specific support (register layout, etc)
8 //=============================================================================
9 //####ECOSGPLCOPYRIGHTBEGIN####
10 // -------------------------------------------
11 // This file is part of eCos, the Embedded Configurable Operating System.
12 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //===========================================================================
43 #include <cyg/hal/hal_soc.h> // Hardware definitions
45 #include CYGHWR_MEMORY_LAYOUT_H
47 #define SZ_1K 0x00000400
48 #define SZ_2K 0x00000800
49 #define SZ_4K 0x00001000
50 #define SZ_8K 0x00002000
51 #define SZ_16K 0x00004000
52 #define SZ_32K 0x00008000
53 #define SZ_64K 0x00010000
54 #define SZ_128K 0x00020000
55 #define SZ_256K 0x00040000
56 #define SZ_512K 0x00080000
57 #define SZ_1M 0x00100000
58 #define SZ_2M 0x00200000
59 #define SZ_4M 0x00400000
60 #define SZ_8M 0x00800000
61 #define SZ_16M 0x01000000
62 #define SZ_32M 0x02000000
63 #define SZ_64M 0x04000000
64 #define SZ_128M 0x08000000
65 #define SZ_256M 0x10000000
66 #define SZ_512M 0x20000000
67 #define SZ_1G 0x40000000
69 #define RAM_BANK0_BASE SOC_CSD0_BASE
71 #define SDRAM_BASE_ADDR SOC_CSD0_BASE
72 #define SDRAM_SIZE TX27_SDRAM_SIZE
74 #define TX27_LED_MASK (1 << 13)
75 #define TX27_LED_REG_ADDR (SOC_GPIOF_BASE + GPIO_DR)
79 #define LED_IS_ON(n) ({ \
81 HAL_READ_UINT32(SOC_GPIOF_BASE + GPIO_DR, __val); \
82 __val & TX27_LED_MASK; \
85 #define TURN_LED_ON(n) \
88 HAL_READ_UINT32(TX27_LED_REG_ADDR, __val); \
89 __val |= TX27_LED_MASK; \
90 HAL_WRITE_UINT32(TX27_LED_REG_ADDR, __val); \
93 #define TURN_LED_OFF(n) \
96 HAL_READ_UINT32(TX27_LED_REG_ADDR, __val); \
97 __val &= ~TX27_LED_MASK; \
98 HAL_WRITE_UINT32(TX27_LED_REG_ADDR, __val); \
101 #define BOARD_DEBUG_LED(n) \
103 if (n >= 0 && n < LED_MAX_NUM) { \
111 #if !defined(__ASSEMBLER__)
116 #define gpio_tst_bit(grp, gpio) _gpio_tst_bit(grp, gpio, __FUNCTION__, __LINE__)
117 static inline int _gpio_tst_bit(int grp, int gpio, const char *func, int line)
119 if (grp < 0 || grp > 5) {
122 if (gpio < 0 || gpio > 31) {
125 unsigned long val = readl(SOC_GPIOA_BASE + (grp << 8) + GPIO_DR);
126 return !!(val & (1 << gpio));
129 static inline void gpio_set_bit(int grp, int gpio)
131 if (grp < 0 || grp > 5) {
134 if (gpio < 0 || gpio > 31) {
137 unsigned long val = readl(SOC_GPIOA_BASE + (grp << 8) + GPIO_DR);
138 writel(val | (1 << gpio), SOC_GPIOA_BASE + (grp << 8) + GPIO_DR);
141 static inline void gpio_clr_bit(int grp, int gpio)
143 if (grp < 0 || grp > 5) {
146 if (gpio < 0 || gpio > 31) {
149 unsigned long val = readl(SOC_GPIOA_BASE + (grp << 8) + GPIO_DR);
150 writel(val & ~(1 << gpio), SOC_GPIOA_BASE + (grp << 8) + GPIO_DR);
153 unsigned int setCoreVoltage(unsigned int coreVol);
157 #endif /* CYGONCE_KARO_TX27_H */