См. документацию.
33 #ifndef _PORT_LPC2XXX_PCLK_H_
34 #define _PORT_LPC2XXX_PCLK_H_ 1
46 #include "bsp_board_def.h"
52 #define WDT_lpc_periph 0
53 #define TIMER0_lpc_periph 1
54 #define TIMER1_lpc_periph 2
55 #define UART0_lpc_periph 3
56 #define UART1_lpc_periph 4
57 #define PWM0_lpc_periph 5
58 #define PWM1_lpc_periph 6
59 #define I2C0_lpc_periph 7
60 #define SPI_lpc_periph 8
61 #define RTC_lpc_periph 9
62 #define SSP1_lpc_periph 10
63 #define DAC_lpc_periph 11
64 #define ADC_lpc_periph 12
65 #define ADC0_lpc_periph ADC_lpc_periph
66 #define CAN1_lpc_periph 13
67 #define CAN2_lpc_periph 14
68 #define ACF_lpc_periph 15
70 #define BAT_RAM_lpc_periph 16
71 #define GPIO_lpc_periph 17
72 #define PCB_lpc_periph 18
73 #define I2C1_lpc_periph 19
74 #define LCD_lpc_periph 20
75 #define ADC1_lpc_periph 20
76 #define SSP0_lpc_periph 21
77 #define TIMER2_lpc_periph 22
78 #define TIMER3_lpc_periph 23
79 #define UART2_lpc_periph 24
80 #define UART3_lpc_periph 25
81 #define I2C2_lpc_periph 26
82 #define I2S_lpc_periph 27
83 #define MCI_lpc_periph 28
84 #define GPDMA_lpc_periph 29
85 #define ENET_lpc_periph 30
86 #define SYSCON_lpc_periph 30
87 #define USB_lpc_periph 31
98 #define PLCK_divider_4 0
99 #define PLCK_divider_1 1
100 #define PLCK_divider_2 2
101 #define PLCK_divider_8 3
102 #define PLCK_divider_6 3
112 #define LPC2XXX_PLCK_DIVIDER_VALUE(devider_koeff) PLCK_divider_##devider_koeff
114 #if ((i_MCU_MODEL > 2300) || ((i_MCU_MODEL > 1700) && (i_MCU_MODEL < 1900)))
123 #define LPC2XXX_PCLK_V(module,koeff) (1<<((module##_lpc_periph&0x0F) + 1))*LPC2XXX_PLCK_DIVIDER_VALUE(koeff)
127 #define GET_PCLKSEL(module) ((module##_lpc_periph*0x10)/16)
129 #define SET_PCLKSEL(module,koeff) PCLKSEL##GET_PCLKSEL(module) = \
130 PCLKSEL##GET_PCLKSEL(module) | LPC2XXX_PCLK_V(module,koeff)
133 #define PCLK_DIVIDER 4
137 #define APBDIV_Val LPC2XXX_PLCK_DIVIDER_VALUE(PCLK_DIVIDER)
138 #define F_PCLK_HZ (F_CCLK_HZ/PCLK_DIVIDER)