CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bsp_board_generic.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_generic_LPC17xx LPC17xx generic board
37  * \ingroup xg_bsp_LPC17xx
38  * @{
39  *
40  *\~russian
41  * Общий файл для описания платы
42  *
43  * Файл используется для описания общего случая использования контроллера.
44  * Активизирован только UART0.
45  *\~english
46  * LPC17xx generic board definition
47  *
48  * File is used to describe generic using of MCU
49  * UART0 is only activated.
50 */
51 #ifndef bsp_board_generic /*bsp_board_brd_name must be in every board_def file*/
52  #define bsp_board_generic 1
53 #endif
54 /*-----------i_ is the i_DENTIFICATION DEFENITIONS --------------------------*/
55 #define i_ARCH CM3
56 
57 #define i_MCU_FAMILY LPC17xx
58 
59 #define i_MCU_MODEL 1768
60 
61 #define i_BOARD GENERIC_BOARD
62 
63 #define i_VENDOR GENERIC_VERNDOR
64 
65 #define i_VERSION 0x010100 /* version 1.1.0*/
66 /*---------DEFINES THAT PERIPHERIAL DEVICES BOARD HAS ------------------------*/
67 #define BSP_BOARD_HAS_SDRAM 0 /**< board has SDRAM*/
68 
69 #define BSP_BOARD_HAS_ETHERNET 0 /**< board has ETHERNET*/
70 #define BSP_BOARD_HAS_UART0 1 /**< board has UART0*/
71 #define BSP_BOARD_HAS_UART1 0 /**< board has UART1*/
72 #define BSP_BOARD_HAS_UART2 0 /**< board has UART3 as IRDA */
73 #define BSP_BOARD_HAS_CAN 0 /**< board has CAN as IRDA */
74 #define BSP_BOARD_HAS_USB 0 /**< board has USB */
75 #define BSP_BOARD_HAS_USB_HOST 0 /**< board has USB HOST on USB1*/
76 #define BSP_BOARD_HAS_USB_OTG 0 /**< board has OTG USB on USB2*/
77 #define BSP_BOARD_HAS_USB_DEVICE 0 /**< board has USB DEVICE on USB2*/
78 
79 #define BSP_BOARD_HAS_SD 0
80 #define BSP_BOARD_HAS_MMC 0
81 
82 #define BSP_BOARD_HAS_I2C 0
83 #define BSP_BOARD_HAS_I2C_PCA9532 0
84 
85 #define BSP_BOARD_HAS_SPI 0
86 #define BSP_BOARD_HAS_SPI_TSC2046 0
87 
88 /*--------VALUES FOR system_LPC2xxx ----------------------------------------*/
89 #define LPC2xxx_VIC_SETUP 1
90 #define LPC2xxx_CLOCK_SETUP 1
91 #define LPC2xxx_PLL_SETUP 1
92 
93 #define XTAL_HZ 12000000UL
94  /* there is three clock soursec in lpc2xxx
95  and table here describe sourses and frequency constants.
96  CLKSRCSEL_IRC 0 IRC_OSC_HZ
97  CLKSRCSEL_XTAL 1 XTAL_HZ
98  CLKSRCSEL_RTC 2 RTC_CLK_HZ
99  */
100  /* select extermal oscillator, as the PLL clock source */
101 #define CLKSRCSEL_Val CLKSRCSEL_XTAL
102 
103 /* Fcck = 72Mhz, Fosc = 288Mhz, and USB 48Mhz */
104 /*Fcck = 2 * (PLL_MValue + 1) * F_OSC_HZ)/(PLL_NValue + 1) /(CCLKCFG_Val + 1))
105  Fcck = 2 * 12 * 12 = 288Mhz
106  Fosc = Fcck / (CCLKCFG_Val + 1) = 57.6Mhz --> useful for UART 57600 baud and etc.
107  FUSB = Fcck / (USBCLKDivValue + 1) = 48Mhz
108 */
109 #define PLL_MValue 11
110 #define PLL_NValue 0
111 #define CCLKCFG_Val 3
112 #define USBCLKCFG_Val 5
113 /* example 2 the best by perfomance and CCLK clock is max
114  Fcck = 2 * 12 * 12 = 288Mhz
115  Fosc = Fcck / (3 + 1) = 72.0Mhz
116  FUSB = Fcck / (9 + 1) = 48.0Mhz
117 
118 #define PLL_MValue 11
119 #define PLL_NValue 0
120 #define CCLKCFG_Val 3
121 #define USBCLKDivValue 5
122 */
123 /* example 3
124  Fcck = 2 * 20 * 12 = 480Mhz
125  Fosc = Fcck / (7 + 1) = 60.0Mhz
126  FUSB = Fcck / (9 + 1) = 48.0Mhz
127 
128 #define PLL_MValue 19
129 #define PLL_NValue 0
130 #define CCLKCFG_Val 7
131 #define USBCLKDivValue 9
132 */
133 
134 /*-----------Peripheral clock selsection -------------------------------------*/
135 /* let watchdog be at normal freq at CCLK/4 but let timer be at CCLK/1 */
136 //#ifndef PCLKSEL0_Val
137 // #define PCLKSEL0_Val (LPC2XXX_PCLK_V(WDT,4) | LPC2XXX_PCLK_V(TIMER0,1))
138 //#endif
139 // /* let BAT_RAM and SYSCON be at normal freq at CCLK/4 */
140 //#ifndef PCLKSEL1_Val
141 // #define PCLKSEL1_Val (LPC2XXX_PCLK_V(BAT_RAM,4) | LPC2XXX_PCLK_V(SYSCON,4))
142 //#endif
143 
144 
145 #define LPC2xxx_FLASH_SETUP 1 /**< Enabling MAM*/
146  /* Enabling MAM and setting number of clocks
147  used for Flash memory fetch (4 cclks in this case) */
148 #define MAMCR_Val LPC_SC_MAM_MODE_FULL
149 
150 
151 #define LPC2xxx_SDRAM_SETUP BSP_BOARD_HAS_SDRAM
152 /*--------END OF VALUES FOR system_LPC2xxx ---------------------------------*/
153 /*--------PIN DESCRIPTION ----------------------------------------------------*/
154 /*--------END OF PIN DESCRIPTION ---------------------------------------------*/
155 /*-------SPI CHIP SELECT CHIP NUMBRES ---------------------------------------*/
156 #define port_spi_chip_select_init()
157 
158 
159 //void port_spi_chip_select
160 #define port_spi_chip_select(chip_num)
161 
162 
163 #define port_spi_chip_disselect(chip_num)
164 
165 
166 /*----------------------------------------------------------------------------*/
167 
168 
169 /** @} end of group xg_bsp_board_def_genreic */
170 #endif /*BSP_BOARD_DEF_H*/