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

4.11
Last change on this file since a052181 was a052181, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 14, 2012 at 8:59:10 AM

score: Add RTEMS_FATAL_SOURCE_EXIT

Include <bsp/default-initial-extension.h> in all BSPs. Call
rtems_fatal() with RTEMS_FATAL_SOURCE_EXIT as source and the exit()
status code as fatal code in every bsp_cleanup(). Move previous
bsp_cleanup() code into bsp_fatal_extension().

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*
2 * Philips LPC22XX/LPC21xx BSP header file
3 *
4 * by Ray,Xu <Rayx.cn@gmail.com>
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9*/
10#ifndef _BSP_H
11#define _BSP_H
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#include <bspopts.h>
18#include <bsp/default-initial-extension.h>
19
20#define BSP_SMALL_MEMORY 1
21
22#include <rtems.h>
23#include <rtems/iosupp.h>
24#include <rtems/console.h>
25#include <rtems/clockdrv.h>
26
27#define BSP_FEATURE_IRQ_EXTENSION
28
29#define CONFIG_ARM_CLK 60000000L
30/* cclk=cco/(2*P) */
31/* cco = cclk*2*P       */
32
33/* system clk frequecy,<=60Mhz, defined in system configuration */
34#define LPC22xx_Fcclk   CONFIG_ARM_CLK
35
36/* Fcco 156M~320Mhz*/
37/* system clk frequecy,<=60Mhz, defined in system configuration */
38#define LPC22xx_Fcclk   CONFIG_ARM_CLK
39#define LPC22xx_Fcco    LPC22xx_Fcclk * 4
40/*VPB clk frequency,1,1/2,1/4 times of Fcclk */
41#define LPC22xx_Fpclk   (LPC22xx_Fcclk /4) *1
42
43
44
45/* Fcclk range: 10MHz ~ MCU allowed frequency */
46#define Fcclk_MIN           10000000L
47#define Fcclk_MAX           60000000L
48
49/* Fcco range: 156MHz ~ 320MHz */
50#define Fcco_MIN            156000000L
51#define Fcco_MAX            320000000L
52
53#define PLLFEED_DATA1       0xAA
54#define PLLFEED_DATA2       0x55
55
56/* PLL PLLCON register bit descriptions */
57#define PLLCON_ENABLE_BIT   0
58#define PLLCON_CONNECT_BIT  1
59
60/* PLL PLLSTAT register bit descriptions */
61#define PLLSTAT_ENABLE_BIT  8
62#define PLLSTAT_CONNECT_BIT 9
63#define PLLSTAT_LOCK_BIT    10
64
65/* PM Peripheral Type */
66#define PC_TIMER0           0x2
67#define PC_TIMER1           0x4
68#define PC_UART0            0x8
69#define PC_UART1            0x10
70#define PC_PWM0             0x20
71#define PC_I2C              0x80
72#define PC_SPI0             0x100
73#define PC_RTC              0x200
74
75// OSC [Hz]
76#define FOSC              11059200
77// Core clk [Hz]
78#define FCCLK             FOSC<<2
79/**
80* help file
81*/
82/* System configure, Fosc Fcclk Fcco Fpclk must be defined*/
83#define Fosc    11059200          // osc freq,10MHz~25MHz,
84                                  //    change to real one if needed
85#define Fcclk   (Fosc << 2)       //system freq 2^n time of  Fosc(1~32) <=60MHZ
86#define Fcco    (Fcclk <<2)       //CCO freq 2,4,8,16 time of Fcclk 156MHz~320MHz
87#define Fpclk   (Fcclk >>2) * 1   //VPB freq only(Fcclk / 4) 1~4
88/* This was M.  That is a BAD BAD public constant.  I renamed it to
89 * JOEL_M so it wouldn't conflict with user code.  If you can find
90 * a better name, fix this.  But nothing I found uses it.
91 */
92#define JOEL_M       Fcclk / Fosc
93#define P_min   Fcco_MIN / (2*Fcclk) + 1;
94#define P_max   Fcco_MAX / (2*Fcclk);
95
96
97
98#define  UART_BPS       115200
99
100// Time Precision time [us]
101#define TIMER_PRECISION   10
102
103// I2C Speed [bit/s]
104#define I2CSPEED          20000         // 20 Kbit/s
105
106// Uarts buffers size
107#define RXBUFSIZE         32
108#define TXBUFSIZE         32
109
110// SPI Speed [bit/s]
111#define SPISPEED          1500000       // 1.5 Mbit/s
112// SPI EEPROM CS pin (SSEL is not suitable for CS, because is used by SPI module for multi master SPI interface)
113#define SPI_CS_PIN        P0_13
114#define SPI_CS_PIN_FUNC   PINSEL0_bit.SPI_CS_PIN
115
116// Flash definition
117//#define FLASH_SIZE      (0x200000-FLASH_BOOT)   // Total area of Flash region in words 8 bit
118#define FLASH_SIZE        (0x80000-FLASH_BOOT)   // Total area of Flash region in words 8 bit
119//#define FLASH_SIZE      (0x80000-FLASH_BOOT)      // Total area of Flash region in words 8 bit
120#define FLASH_BEGIN       0x80000000
121#define FLASH_BASE        (FLASH_BEGIN+FLASH_BOOT)   //First 0x8000 bytes reserved for boot loader etc.
122
123// SRAM definition
124#define SRAM_SIZE         0x100000                  // Total area of Flash region in words 8 bit
125#define SRAM_BASE         0x81000000                //First 0x8000 bytes reserved for boot loader etc.
126
127// CS8900A definition
128#define CS8900A_BASE      0x82000000
129// RTL8019AS definition
130#define RTL8019AS_BASE    0x82000000
131
132struct rtems_bsdnet_ifconfig;
133int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config,
134                          int                          attaching);
135
136/*
137 * Network driver configuration
138 */
139#define RTEMS_BSP_NETWORK_DRIVER_NAME   "eth0"
140#define RTEMS_BSP_NETWORK_DRIVER_ATTACH cs8900_driver_attach
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* _BSP_H */
Note: See TracBrowser for help on using the repository browser.