]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/arm/lpc24xx/var/v2_0/include/lpc24xx_misc.h
Initial revision
[karo-tx-redboot.git] / packages / hal / arm / lpc24xx / var / v2_0 / include / lpc24xx_misc.h
1 #ifndef CYGONCE_HAL_ARM_LPC24XX_VAR_LPC24XX_MISC_H
2 #define CYGONCE_HAL_ARM_LPC24XX_VAR_LPC24XX_MISC_H
3 //=============================================================================
4 //
5 //      lpc24xx_misc.h
6 //
7 //      HAL misc variant support code for NCP LPC24xx header file
8 //
9 //=============================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 2006 eCosCentric Limited 
14 //
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
18 //
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22 // for more details.
23 //
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 //
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
34 //
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 // -------------------------------------------
38 //####ECOSGPLCOPYRIGHTEND####
39 //=============================================================================
40 //#####DESCRIPTIONBEGIN####
41 //
42 // Author(s):    andyj 
43 // Contributors: jani
44 // Date:         2006-02-04
45 // Purpose:      LPC2XXX specific miscellaneous support header file
46 // Description: 
47 // Usage:        #include <cyg/hal/lpc24xx_misc.h>
48 //
49 //####DESCRIPTIONEND####
50 //
51 //=============================================================================
52
53 //-----------------------------------------------------------------------------
54 // Functions to obtain the current processor clock settings
55 //-----------------------------------------------------------------------------
56 externC cyg_uint32 hal_lpc_get_pclk(cyg_uint32 peripheral_id);
57
58 //
59 // Identifiers for peripheral clock. Use these identifiers with the function
60 // hal_get_pclk()
61 //
62 #define CYNUM_HAL_LPC24XX_PCLK_WDT    0
63 #define CYNUM_HAL_LPC24XX_PCLK_TIMER0 1
64 #define CYNUM_HAL_LPC24XX_PCLK_TIMER1 2
65 #define CYNUM_HAL_LPC24XX_PCLK_UART0  3
66 #define CYNUM_HAL_LPC24XX_PCLK_UART1  4
67 #define CYNUM_HAL_LPC24XX_PCLK_PWM0   5
68 #define CYNUM_HAL_LPC24XX_PCLK_PWM1   6
69 #define CYNUM_HAL_LPC24XX_PCLK_I2C0   7
70 #define CYNUM_HAL_LPC24XX_PCLK_SPI    8
71 #define CYNUM_HAL_LPC24XX_PCLK_RTC    9
72 #define CYNUM_HAL_LPC24XX_PCLK_SSP1   10
73 #define CYNUM_HAL_LPC24XX_PCLK_DAC    11
74 #define CYNUM_HAL_LPC24XX_PCLK_ADC    12
75 #define CYNUM_HAL_LPC24XX_PCLK_CAN1   13
76 #define CYNUM_HAL_LPC24XX_PCLK_CAN2   14
77 #define CYNUM_HAL_LPC24XX_PCLK_ACF    15
78 #define CYNUM_HAL_LPC24XX_PCLK_BATRAM 16
79 #define CYNUM_HAL_LPC24XX_PCLK_GPIO   17
80 #define CYNUM_HAL_LPC24XX_PCLK_PCB    18
81 #define CYNUM_HAL_LPC24XX_PCLK_I2C1   19
82 #define CYNUM_HAL_LPC24XX_PCLK_SSP0   21
83 #define CYNUM_HAL_LPC24XX_PCLK_TIMER2 22
84 #define CYNUM_HAL_LPC24XX_PCLK_TIMER3 23
85 #define CYNUM_HAL_LPC24XX_PCLK_UART2  24
86 #define CYNUM_HAL_LPC24XX_PCLK_UART3  25
87 #define CYNUM_HAL_LPC24XX_PCLK_I2C2   26
88 #define CYNUM_HAL_LPC24XX_PCLK_I2S    27
89 #define CYNUM_HAL_LPC24XX_PCLK_MCI    28
90 #define CYNUM_HAL_LPC24XX_PCLK_SYSCON 30
91
92
93 //-----------------------------------------------------------------------------
94 // Macros to derive the baudrate divider values for the internal UARTs
95 // The LPC24xx family supports differents baudrate clocks for each single
96 // UART. So we need a way to calculate the baudrate for each single UART
97 // Now we rely on the fact that we use the same baurate clock for all
98 // UARTs and we query only UART0
99 //-----------------------------------------------------------------------------
100 #define CYG_HAL_ARM_LPC24XX_PCLK(_pclkid_) hal_lpc_get_pclk(_pclkid_) 
101 #define CYG_HAL_ARM_LPC2XXX_BAUD_GENERATOR(baud) \
102             (CYG_HAL_ARM_LPC24XX_PCLK(CYNUM_HAL_LPC24XX_PCLK_UART0)/((baud)*16))
103 #define CYG_HAL_ARM_LPC24XX_BAUD_GENERATOR(_pclkid_, baud) \
104             (CYG_HAL_ARM_LPC24XX_PCLK(_pclkid_)/((baud)*16))
105             
106
107 //-----------------------------------------------------------------------------
108 // LPX24xx platform reset (watchdog resets the board)
109 //-----------------------------------------------------------------------------
110 externC void hal_lpc_watchdog_reset(void);
111
112 #define HAL_PLATFORM_RESET() hal_lpc_watchdog_reset()
113 #define HAL_PLATFORM_RESET_ENTRY 0
114
115 //-----------------------------------------------------------------------------
116 // end of lpc24xx_misc.h
117 #endif // CYGONCE_HAL_ARM_LPC24XX_VAR_LPC24XX_MISC_H