📄 config.h
字号:
/******************************************************************************
*
* $RCSfile: $
* $Revision: $
*
* This module provides information about the project configuration
* Copyright 2004, R O SoftWare
* No guarantees, warrantees, or promises, implied or otherwise.
* May be used for hobby or commercial purposes provided copyright
* notice remains intact.
*
*****************************************************************************/
#ifndef INC_CONFIG_H
#define INC_CONFIG_H
#include "types.h"
#include "LPC21xx.h"
// WARNING! do not set this higher than address of last byte of RAM!
// do not use 0x7fff, use the address of 0x40007fff as may vary on
// LPC2000 chip models.
#define END_OF_THE_RAM_FIELD 0x40007fff
// what hardware is available
#define HAS_CLOCK
#define HAS_MMC
// declare functions and values from crt0.S & the linker control file
extern void _reset_(void);
// extern void exit(void);
extern void _abort_(void);
#define WDOG()
// PLL setup values are computed within the LPC include file
// It relies upon the following defines
#define FOSC (14745000) // Master Oscillator Freq.
#define PLL_MUL (4) // PLL Multiplier
#define CCLK (FOSC * PLL_MUL) // CPU Clock Freq.
// Pheripheral Bus Speed Divider
#define PBSD 2 // MUST BE 1, 2, or 4
#define PCLK (CCLK / PBSD) // Pheripheal Bus Clock Freq.
// Do some value range testing
#if ((FOSC < 10000000) || (FOSC > 25000000))
#error Fosc out of range (10MHz-25MHz)
#error correct and recompile
#endif
#if ((CCLK < 10000000) || (CCLK > 60000000))
#error cclk out of range (10MHz-60MHz)
#error correct PLL_MUL and recompile
#endif
#if ((FCCO < 150000000) || (FCCO > 320000000))
#error Fcco out of range (156MHz-320MHz)
#error internal algorithm error
#endif
#if ((PBSD != 1) && (PBSD != 2) && (PBSD != 4))
#error Pheripheal Bus Speed Divider (PBSD) illegal value (1, 2, or 4)
#endif
// The following are for the Port 0 pins
#ifndef BIT
#define BIT(n) (1 << (n))
#endif
#define TXD0_BIT BIT(0) // used by UART0
#define RXD0_BIT BIT(1) // used by UART0
#define P1_SCL0_BIT BIT(2) // P0.02 P1 conn.
#define P1_SDA0_BIT BIT(3) // P0.03 P1 conn.
#define P1_SCK0_BIT BIT(4) // P0.04 P1 conn.
#define P1_MISO0_BIT BIT(5) // P0.05 P1 conn.
#define P1_MOSI0_BIT BIT(6) // P0.06 P1 conn.
#define P1_SSEL0_BIT BIT(7) // P0.07 P1 conn.
#define ISO_TXD_BIT BIT(8) // used by UART1
#define ISO_RXD_BIT BIT(9) // used by UART1
#define UART1_RTS_BIT BIT(10) // P0.10 output - RTS Uart 1.
#define UART1_CTS_BIT BIT(11) // P0.11 input - CTS Uart 1.
#define SHUTDOWN_BIT BIT(12) // P0.12 output - low disable ISO232.
#define FAULT_BIT BIT(13) // P0.13 input - low is ISO232 Fault.
#define P014_UNUSED_BIT BIT(14) // P0.14 unused - low output
#define MMC_DETECT_BIT BIT(15) // P0.15 input - MMC Card Detect if low.
#define P1_EINT0 BIT(16) // P0.16 P1 conn.
#define SCK1_BIT BIT(17) // P0.17 SSP to MMC card.
#define MISO1_BIT BIT(18) // P0.18 MISO from MMC card.
#define MOSI1_BIT BIT(19) // P0.19 MOSI to MMC card.
#define P020_UNUSED_BIT BIT(20) // P0.20 unused - low output
#define P1_ESEL0_BIT BIT(21) // P0.21 P1 conn.
#define MMC_CS_BIT BIT(22) // P0.22 output - MMC chip select.
#define P023_UNUSED_BIT BIT(23) // P0.23 unused - low output
#define P024_UNUSED_BIT BIT(24) // P0.24 not available as a pinout
#define P1_AOUT_BIT BIT(25) // P0.25 P1 conn.
#define P1_ANA5_BIT BIT(26) // P0.26 P1 conn.
#define ZONE1_BIT BIT(27) // P0.27 input - Analog Zone 1
#define ZONE2_BIT BIT(28) // P0.28 input - Analog Zone 2
#define ZONE3_BIT BIT(29) // P0.29 input - Analog Zone 3
#define ZONE4_BIT BIT(30) // P0.30 input - Analog Zone 4
#define P031_UNUSED_BIT BIT(31) // P0.31 unused - low output
// The following are for the Port 1 pins
#define P100_UNUSED_BIT BIT(0) // P1.00 unused - low output
#define P101_UNUSED_BIT BIT(1) // P1.01 unused - low output
#define P102_UNUSED_BIT BIT(2) // P1.02 unused - low output
#define P103_UNUSED_BIT BIT(3) // P1.03 unused - low output
#define P104_UNUSED_BIT BIT(4) // P1.04 unused - low output
#define P105_UNUSED_BIT BIT(5) // P1.05 unused - low output
#define P106_UNUSED_BIT BIT(6) // P1.06 unused - low output
#define P107_UNUSED_BIT BIT(7) // P1.07 unused - low output
#define P108_UNUSED_BIT BIT(8) // P1.08 unused - low output
#define P109_UNUSED_BIT BIT(9) // P1.09 unused - low output
#define P110_UNUSED_BIT BIT(10) // P1.10 unused - low output
#define P111_UNUSED_BIT BIT(11) // P1.11 unused - low output
#define P112_UNUSED_BIT BIT(12) // P1.12 unused - low output
#define P113_UNUSED_BIT BIT(13) // P1.13 unused - low output
#define P114_UNUSED_BIT BIT(14) // P1.14 unused - low output
#define P115_UNUSED_BIT BIT(15) // P1.15 unused - low output
#define P116_UNUSED_BIT BIT(16) // P1.16 unused - low output
#define WAKEUP_COMM_BIT BIT(17) // P1.17 output - wakeup Comm CPU.
#define MMC_WENABLE_BIT BIT(18) // P1.18 input - High is Write Protected.
#define P119_UNUSED_BIT BIT(19) // P1.19 unused - low output
#define LED_EVENT_BIT BIT(20) // P1.20 output - low for EVENT LED.
#define LED_MMC_BIT BIT(21) // P1.21 output - low for MMC LED.
#define LED_TX5_BIT BIT(22) // P1.22 output - low for TX5 LED.
#define LED_RX5_BIT BIT(23) // P1.23 output - low for RX5 LED.
#define DDATA_BIT BIT(24) // P1.24 Dallas secure memory I/O.
#define RESET_COMM_BIT BIT(25) // P1.25 output - RESET Comm CPU.
#define P126_UNUSED_BIT BIT(26) // used by JTAG
#define P127_UNUSED_BIT BIT(27) // used by JTAG
#define P128_UNUSED_BIT BIT(28) // used by JTAG
#define P129_UNUSED_BIT BIT(29) // used by JTAG
#define P130_UNUSED_BIT BIT(30) // used by JTAG
#define P131_UNUSED_BIT BIT(31) // used by JTAG
#define P0IO_INPUT_BITS (uint32_t) ( \
FAULT_BIT | \
MMC_DETECT_BIT | \
UART1_CTS_BIT | \
ZONE1_BIT | \
ZONE2_BIT | \
ZONE3_BIT | \
ZONE4_BIT | \
0 )
#define P0IO_ZERO_BITS (uint32_t) ( \
0 )
#define P0IO_ONE_BITS (uint32_t) ( \
SHUTDOWN_BIT | \
MMC_CS_BIT | \
UART1_RTS_BIT | \
0 )
#define P0IO_OUTPUT_BITS (uint32_t) ( \
P0IO_ZERO_BITS | \
P0IO_ONE_BITS )
#define P1IO_INPUT_BITS (uint32_t) ( \
MMC_WENABLE_BIT | \
DDATA_BIT | \
0 )
#define P1IO_ZERO_BITS (uint32_t) ( \
0 )
#define P1IO_ONE_BITS (uint32_t) ( \
WAKEUP_COMM_BIT | \
LED_EVENT_BIT | \
LED_MMC_BIT | \
LED_TX5_BIT | \
LED_RX5_BIT | \
0 )
#define P1IO_OUTPUT_BITS (uint32_t) ( \
P1IO_ZERO_BITS | \
P1IO_ONE_BITS )
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -