RTEMS 7.0-rc1
Loading...
Searching...
No Matches
bsp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2007 Ray Xu <rayx.cn@gmail.com>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_ARM_RTL22XX_BSP_H
37#define LIBBSP_ARM_RTL22XX_BSP_H
38
49#include <bspopts.h>
51
52#include <rtems.h>
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58#define BSP_FEATURE_IRQ_EXTENSION
59
60#define CONFIG_ARM_CLK 60000000L
61/* cclk=cco/(2*P) */
62/* cco = cclk*2*P */
63
65#define LPC22xx_Fcclk CONFIG_ARM_CLK
66
67/* Fcco 156M~320Mhz*/
69#define LPC22xx_Fcclk CONFIG_ARM_CLK
70#define LPC22xx_Fcco LPC22xx_Fcclk * 4
72#define LPC22xx_Fpclk (LPC22xx_Fcclk /4) *1
73
74
75
81#define Fcclk_MIN 10000000L
82#define Fcclk_MAX 60000000L
83
91#define Fcco_MIN 156000000L
92#define Fcco_MAX 320000000L
93
96#define PLLFEED_DATA1 0xAA
97#define PLLFEED_DATA2 0x55
98
104#define PLLCON_ENABLE_BIT 0
105#define PLLCON_CONNECT_BIT 1
106
114#define PLLSTAT_ENABLE_BIT 8
115#define PLLSTAT_CONNECT_BIT 9
116#define PLLSTAT_LOCK_BIT 10
117
125#define PC_TIMER0 0x2
126#define PC_TIMER1 0x4
127#define PC_UART0 0x8
128#define PC_UART1 0x10
129#define PC_PWM0 0x20
130#define PC_I2C 0x80
131#define PC_SPI0 0x100
132#define PC_RTC 0x200
133
137#define FOSC 11059200
139#define FCCLK FOSC<<2
140
147#define Fosc 11059200
149#define Fcclk (Fosc << 2)
151#define Fcco (Fcclk <<2)
153#define Fpclk (Fcclk >>2) * 1
154/* This was M. That is a BAD BAD public constant. I renamed it to
155 * JOEL_M so it wouldn't conflict with user code. If you can find
156 * a better name, fix this. But nothing I found uses it.
157 */
158
161#define JOEL_M Fcclk / Fosc
162#define P_min Fcco_MIN / (2*Fcclk) + 1;
163#define P_max Fcco_MAX / (2*Fcclk);
164
165#define UART_BPS 115200
166
168#define TIMER_PRECISION 10
169
171#define I2CSPEED 20000 // 20 Kbit/s
172
178#define RXBUFSIZE 32
179#define TXBUFSIZE 32
180
184#define SPISPEED 1500000 // 1.5 Mbit/s
189#define SPI_CS_PIN P0_13
190#define SPI_CS_PIN_FUNC PINSEL0_bit.SPI_CS_PIN
191
197//#define RTL22XX_FLASH_SIZE (0x200000-RTL22XX_FLASH_BOOT) // Total area of Flash region in words 8 bit
199#define RTL22XX_FLASH_SIZE (0x80000-RTL22XX_FLASH_BOOT)
200//#define RTL22XX_FLASH_SIZE (0x80000-RTL22XX_FLASH_BOOT) // Total area of Flash region in words 8 bit
201#define RTL22XX_FLASH_BEGIN 0x80000000
203#define RTL22XX_FLASH_BASE (RTL22XX_FLASH_BEGIN+RTL22XX_FLASH_BOOT)
204
213#define SRAM_SIZE 0x100000
215#define SRAM_BASE 0x81000000
216
220#define CS8900A_BASE 0x82000000
222#define RTL8019AS_BASE 0x82000000
223
224struct rtems_bsdnet_ifconfig;
225int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config,
226 int attaching);
227
233#define RTEMS_BSP_NETWORK_DRIVER_NAME "eth0"
234#define RTEMS_BSP_NETWORK_DRIVER_ATTACH cs8900_driver_attach
235
238/*
239 * Prototypes for methods used across file boundaries in the BSP.
240 */
241extern void UART0_Ini(void);
242
243#ifdef __cplusplus
244}
245#endif
246
249#endif /* _BSP_H */
This header file provides the default definition of BSP_INITIAL_EXTENSION.
This header file defines the RTEMS Classic API.