CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bsp_board_EA_v1_1.h
Go to the documentation of this file.
1 /*
2  * CMSIS2000
3  * CMSIS-like sources for LPC2xxx series MCUs
4  *
5  * (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6  *
7  * Version: 0.0.7
8  * Date of the Last Update: 2013-03-04
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  *
28  * Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29  *
30  *
31 #*/
32 
33 #ifndef BSP_BOARD_DEF_H /*BSP_BOARD_DEF_H must be in every board_def file*/
34 #define BSP_BOARD_DEF_H 1
35 /**
36  * \defgroup xg_bsp_board_def_EA_v1_1 Embedded Artist LPC2478 board
37  * \ingroup xg_bsp_LPC2xxx
38  * @{
39  *
40  *\~russian
41  * Описание платы EA_v1_1
42  *
43  * Плата EA_v1_1 -- отладочная плата от Embedded artist
44  *\~english
45  * EA_v1_1 board definition
46  *
47  * EA_v1_1 board is the Embedded artist board with NXP LPC2478 MCU,
48  * with Touchscreen, USB and etc.
49 */
50 #ifndef bsp_board_EA_v1_1 /*bsp_board_brd_name must be in every board_def file*/
51  #define bsp_board_EA_v1_1 1
52 #endif
53 /*-----------i_ is the i_DENTIFICATION DEFENITIONS --------------------------*/
54 #define i_ARCH ARM7
55 
56 #define i_MCU_FAMILY LPC2xxx
57 
58 #define i_MCU_MODEL 2478
59 
60 #define i_BOARD EA_v1_1
61 
62 #define i_VENDOR EA
63 
64 #define i_VERSION 0x010100
65 /*---------DEFINES THAT PERIPHERIAL DEVICES BOARD HAS ------------------------*/
66 #define BSP_BOARD_HAS_ETHERNET 1 /**< board has ETHERNET*/
67 #define BSP_BOARD_HAS_UART0 1 /**< board has UART0*/
68 #define BSP_BOARD_HAS_UART1 1 /**< board has UART1*/
69 #define BSP_BOARD_HAS_UART2 1 /**< board has UART3 as IRDA */
70 #define BSP_BOARD_HAS_CAN 1 /**< board has CAN as IRDA */
71 #define BSP_BOARD_HAS_USB 1 /**< board has USB */
72 #define BSP_BOARD_HAS_USB_HOST 2 /**< board has USB HOST on USB2*/
73 #define BSP_BOARD_HAS_USB_OTG 1 /**< board has OTG USB on USB1*/
74 #define BSP_BOARD_HAS_USB_DEVICE 0 /**< board has USB DEVICE on USB1*/
75 #ifndef BSP_USB_MODE_DEFINED
76 /*--------------- some examples -----------------*/
77 // #define BSP_USB_MODE_DEFINED \
78 // (TYPE_DEVICE_PORT2_SOFT_CONNECT|TYPE_USB_PORT2_LED| \
79 // TYPE_HOST_PORT1|TYPE_HOST_PORT1_POWER_EN)
80 
81 // TYPE_HOST_PORT1|TYPE_USB_PORT1_LED|TYPE_HOST_PORT1_POWER_EN|
82 // TYPE_USB_PORT2_LED|TYPE_DEVICE_PORT2_SOFT_CONNECT)
83 
84 #define BSP_USB_MODE_DEFINED (\
85  TYPE_OTG_PORT1|TYPE_USB_PORT1_LED| \
86  TYPE_HOST_PORT2|TYPE_USB_PORT2_LED|TYPE_HOST_PORT2_POWER_EN)
87 #endif
88 
89 #define BSP_BOARD_HAS_SD 1
90 #define BSP_BOARD_HAS_MMC 1
91 
92 #define BSP_BOARD_HAS_I2C 1
93 #define BSP_BOARD_HAS_I2C_PCA9532 1
94 
95 #define BSP_BOARD_HAS_SPI 1
96 #define BSP_BOARD_HAS_SPI_TSC2046 1
97 
98 /*--------VALUES FOR system_LPC2xxx ----------------------------------------*/
99 #define LPC2xxx_VIC_SETUP 1
100 #define LPC2xxx_CLOCK_SETUP 1
101 #define LPC2xxx_PLL_SETUP 1
102 
103 #define XTAL_HZ 12000000UL
104  /* there is three clock soursec in lpc2xxx
105  and table here describe sourses and frequency constants.
106  CLKSRCSEL_IRC 0 IRC_OSC_HZ
107  CLKSRCSEL_XTAL 1 XTAL_HZ
108  CLKSRCSEL_RTC 2 RTC_CLK_HZ
109  */
110  /* select extermal oscillator, as the PLL clock source */
111 #define CLKSRCSEL_Val CLKSRCSEL_XTAL
112 
113 /* Fcck = 72Mhz, Fosc = 288Mhz, and USB 48Mhz */
114 /*Fcck = 2 * (PLL_MValue + 1) * F_OSC_HZ)/(PLL_NValue + 1) /(CCLKCFG_Val + 1))
115  Fcck = 2 * 12 * 12 = 288Mhz
116  Fosc = Fcck / (CCLKCFG_Val + 1) = 57.6Mhz --> useful for UART 57600 baud and etc.
117  FUSB = Fcck / (USBCLKDivValue + 1) = 48Mhz
118 */
119 #define PLL_MValue 11
120 #define PLL_NValue 0
121 #define CCLKCFG_Val 3
122 #define USBCLKCFG_Val 5
123 /* example 2 the best by perfomance and CCLK clock is max
124  Fcck = 2 * 12 * 12 = 288Mhz
125  Fosc = Fcck / (3 + 1) = 72.0Mhz
126  FUSB = Fcck / (9 + 1) = 48.0Mhz
127 
128 #define PLL_MValue 11
129 #define PLL_NValue 0
130 #define CCLKCFG_Val 3
131 #define USBCLKDivValue 5
132 */
133 /* example 3
134  Fcck = 2 * 20 * 12 = 480Mhz
135  Fosc = Fcck / (7 + 1) = 60.0Mhz
136  FUSB = Fcck / (9 + 1) = 48.0Mhz
137 
138 #define PLL_MValue 19
139 #define PLL_NValue 0
140 #define CCLKCFG_Val 7
141 #define USBCLKDivValue 9
142 */
143 
144 /*-----------Peripheral clock selsection -------------------------------------*/
145 /* let watchdog be at normal freq at CCLK/4 but let timer be at CCLK/1 */
146 #ifndef PCLKSEL0_Val
147  #define PCLKSEL0_Val (LPC2XXX_PCLK_V(WDT,4) | LPC2XXX_PCLK_V(TIMER0,1))
148 #endif
149 /* let BAT_RAM and SYSCON be at normal freq at CCLK/4 */
150 #ifndef PCLKSEL1_Val
151  #define PCLKSEL1_Val (LPC2XXX_PCLK_V(BAT_RAM,4) | LPC2XXX_PCLK_V(SYSCON,4))
152 #endif
153 
154 #ifndef PCONP_Val
155  #define PCONP_Val (PCTIMER0 | PCTIMER1 | PCUART0 | PCUART1 | \
156  PCPWM1 | PCI2C0 | PCSPI | PCRTC | PCSSP1 | PCGPIO | PCI2C1 |\
157  PCTIMER3 | PCI2C1 | PCUART3 | PCENET)
158 #endif
159 
160 #define LPC2xxx_FLASH_SETUP 1 /**< Enabling MAM*/
161  /* Enabling MAM and setting number of clocks
162  used for Flash memory fetch (4 cclks in this case) */
163 #define MAMCR_Val LPC_SC_MAM_MODE_FULL
164 
165 
166 #define LPC2xxx_SDRAM_SETUP BSP_BOARD_HAS_SDRAM
167 /*--------END OF VALUES FOR system_LPC2xxx ---------------------------------*/
168 /*--------PIN DESCRIPTION ----------------------------------------------------*/
169 /*--------END OF PIN DESCRIPTION ---------------------------------------------*/
170 /*-------SPI CHIP SELECT CHIP NUMBRES ---------------------------------------*/
171 #define CS_TSC2046 1
172 
173 #define P0_20_TP_CS PORT_PIN_NUMBER(LPC2XXX_PORT0,20)
174 
175 #define port_spi_chip_select_init() \
176  PORT_SELECT_PIN (P0_20_TP_CS,PORT_PIN_MODE_GPIO); \
177  PORT_DIRECTION_PIN(P0_20_TP_CS,PIN_OUTPUT); \
178  PORT_SET_PIN (P0_20_TP_CS)
179 
180 
181 //void port_spi_chip_select
182 #define port_spi_chip_select(chip_num) \
183  PORT_CLEAR_PIN (P0_20_TP_CS)
184 
185 
186 #define port_spi_chip_disselect(chip_num) \
187  PORT_SET_PIN (P0_20_TP_CS)
188 
189 /*----------------------------------------------------------------------------*/
190 #define PCA_LED1 8
191 #define PCA_LED2 9
192 #define PCA_LED3 10
193 #define PCA_LED4 11
194 #define PCA_LED5 12
195 #define PCA_LED6 14
196 #define PCA_LED7 15
197 
198 #define PCA_LEDnWP 4
199 #define PCA_LEDCD 5
200 
201 /** @} end of group xg_bsp_board_def_EA_v1_1 */
202 #endif /*BSP_BOARD_DEF_H*/