source: rtems/c/src/lib/libbsp/arm/rtl22xx/include/bsp.h @ 85fe6d04

5
Last change on this file since 85fe6d04 was 85fe6d04, checked in by Joel Sherrill <joel@…>, on 03/30/16 at 19:04:21

arm/rtl22xx/include/bsp.h: Do not include <rtems/iosupp.h>

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @file
3 * @ingroup arm_rtl22xx
4 * @brief Global BSP definitions.
5 */
6
7/*
8 * Philips LPC22XX/LPC21xx BSP header file
9 *
10 * by Ray,Xu <Rayx.cn@gmail.com>
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15*/
16#ifndef LIBBSP_ARM_RTL22XX_BSP_H
17#define LIBBSP_ARM_RTL22XX_BSP_H
18
19#include <bspopts.h>
20#include <bsp/default-initial-extension.h>
21
22/**
23 * @defgroup arm_rtl22xx RTL22XX Support
24 * @ingroup bsp_arm
25 * @brief RTL22XX Support Package
26 * @{
27 */
28
29#include <rtems.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#define BSP_FEATURE_IRQ_EXTENSION
36
37#define CONFIG_ARM_CLK 60000000L
38/* cclk=cco/(2*P) */
39/* cco = cclk*2*P       */
40
41/** @brief system clk frequecy,<=60Mhz, defined in system configuration */
42#define LPC22xx_Fcclk   CONFIG_ARM_CLK
43
44/* Fcco 156M~320Mhz*/
45/** @brief system clk frequecy,<=60Mhz, defined in system configuration */
46#define LPC22xx_Fcclk   CONFIG_ARM_CLK
47#define LPC22xx_Fcco    LPC22xx_Fcclk * 4
48/** @brief VPB clk frequency,1,1/2,1/4 times of Fcclk */
49#define LPC22xx_Fpclk   (LPC22xx_Fcclk /4) *1
50
51
52
53/**
54 * @name Fcclk range: 10MHz ~ MCU allowed frequency
55 * @{
56 */
57
58#define Fcclk_MIN           10000000L
59#define Fcclk_MAX           60000000L
60
61/** @} */
62
63/**
64 * @name Fcco range: 156MHz ~ 320MHz
65 * @{
66 */
67
68#define Fcco_MIN            156000000L
69#define Fcco_MAX            320000000L
70
71/** @} */
72
73#define PLLFEED_DATA1       0xAA
74#define PLLFEED_DATA2       0x55
75
76/**
77 * @name PLL PLLCON register bit descriptions
78 * @{
79 */
80
81#define PLLCON_ENABLE_BIT   0
82#define PLLCON_CONNECT_BIT  1
83
84/** @} */
85
86/**
87 * @name PLL PLLSTAT register bit descriptions
88 * @{
89 */
90
91#define PLLSTAT_ENABLE_BIT  8
92#define PLLSTAT_CONNECT_BIT 9
93#define PLLSTAT_LOCK_BIT    10
94
95/** @} */
96
97/**
98 * @name PM Peripheral Type
99 * @{
100 */
101
102#define PC_TIMER0           0x2
103#define PC_TIMER1           0x4
104#define PC_UART0            0x8
105#define PC_UART1            0x10
106#define PC_PWM0             0x20
107#define PC_I2C              0x80
108#define PC_SPI0             0x100
109#define PC_RTC              0x200
110
111/** @} */
112
113/** @brief OSC [Hz] */
114#define FOSC              11059200
115/** @brief Core clk [Hz] */
116#define FCCLK             FOSC<<2
117
118/**
119 * @name System Configure
120 * @{
121 */
122
123/** @brief osc freq,10MHz~25MHz, change to a real one if needed */
124#define Fosc    11059200
125/** @brief system freq 2^n time of  Fosc(1~32) <=60MHZ */
126#define Fcclk   (Fosc << 2)
127/** @brief CCO freq 2,4,8,16 time of Fcclk 156MHz~320MHz */
128#define Fcco    (Fcclk <<2)
129/** @brief VPB freq only(Fcclk / 4) 1~4 */
130#define Fpclk   (Fcclk >>2) * 1
131/* This was M.  That is a BAD BAD public constant.  I renamed it to
132 * JOEL_M so it wouldn't conflict with user code.  If you can find
133 * a better name, fix this.  But nothing I found uses it.
134 */
135
136/** @} */
137
138#define JOEL_M       Fcclk / Fosc
139#define P_min   Fcco_MIN / (2*Fcclk) + 1;
140#define P_max   Fcco_MAX / (2*Fcclk);
141
142#define  UART_BPS       115200
143
144/** @brief Time Precision time [us] */
145#define TIMER_PRECISION   10
146
147/** @brief I2C Speed [bit/s] */
148#define I2CSPEED          20000         // 20 Kbit/s
149
150/**
151 * @name Uarts buffers size
152 * @{
153 */
154
155#define RXBUFSIZE         32
156#define TXBUFSIZE         32
157
158/** @} */
159
160/** @brief SPI Speed [bit/s] */
161#define SPISPEED          1500000       // 1.5 Mbit/s
162/** @brief SPI EEPROM CS pin
163 *
164 *  (SSEL is not suitable for CS, because is used by SPI module for multi master SPI interface)
165 */
166#define SPI_CS_PIN        P0_13
167#define SPI_CS_PIN_FUNC   PINSEL0_bit.SPI_CS_PIN
168
169/**
170 * @name Flash definition
171 * @{
172 */
173
174//#define RTL22XX_FLASH_SIZE      (0x200000-RTL22XX_FLASH_BOOT)   // Total area of Flash region in words 8 bit
175/** @brief Total area of Flash region in words 8 bit */
176#define RTL22XX_FLASH_SIZE        (0x80000-RTL22XX_FLASH_BOOT)
177//#define RTL22XX_FLASH_SIZE      (0x80000-RTL22XX_FLASH_BOOT)      // Total area of Flash region in words 8 bit
178#define RTL22XX_FLASH_BEGIN       0x80000000
179/** @brief First 0x8000 bytes reserved for boot loader etc. */
180#define RTL22XX_FLASH_BASE        (RTL22XX_FLASH_BEGIN+RTL22XX_FLASH_BOOT)
181
182/** @} */
183
184/**
185 * @name SRAM definition
186 * @{
187 */
188
189/** @brief Total area of Flash region in words 8 bit */
190#define SRAM_SIZE         0x100000
191/** @brief First 0x8000 bytes reserved for boot loader etc. */
192#define SRAM_BASE         0x81000000
193
194/** @} */
195
196/** @brief CS8900A definition */
197#define CS8900A_BASE      0x82000000
198/** @brief RTL8019AS definition */
199#define RTL8019AS_BASE    0x82000000
200
201struct rtems_bsdnet_ifconfig;
202int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config,
203                          int                          attaching);
204
205/**
206 * @name Network driver configuration
207 * @{
208 */
209
210#define RTEMS_BSP_NETWORK_DRIVER_NAME   "eth0"
211#define RTEMS_BSP_NETWORK_DRIVER_ATTACH cs8900_driver_attach
212
213/** @} */
214
215/*
216 * Prototypes for methods used across file boundaries in the BSP.
217 */
218extern void  UART0_Ini(void);
219
220/** @} */
221
222#ifdef __cplusplus
223}
224#endif
225
226#endif /* _BSP_H */
Note: See TracBrowser for help on using the repository browser.