File indexing completed on 2025-05-11 08:22:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef __AT91RM9200_PMC_H__
0020 #define __AT91RM9200_PMC_H__
0021
0022 #include <bits.h>
0023
0024
0025
0026
0027 int at91rm9200_get_mainclk(void);
0028 int at91rm9200_get_slck(void);
0029 int at91rm9200_get_mck(void);
0030
0031
0032 #define PMC_SCER 0x00
0033 #define PMC_SCDR 0x04
0034 #define PMC_SCSR 0x08
0035 #define PMC_PCER 0x10
0036 #define PMC_PCDR 0x14
0037 #define PMC_PCSR 0x18
0038 #define PMC_MOR 0x20
0039 #define PMC_MCFR 0x24
0040 #define PMC_PLLAR 0x28
0041 #define PMC_PLLBR 0x2C
0042 #define PMC_MCKR 0x30
0043 #define PMC_PCKR0 0x40
0044 #define PMC_PCKR1 0x44
0045 #define PMC_PCKR2 0x48
0046 #define PMC_PCKR3 0x4C
0047 #define PMC_PCKR4 0x50
0048 #define PMC_PCKR5 0x54
0049 #define PMC_PCKR6 0x58
0050 #define PMC_PCKR7 0x5C
0051 #define PMC_IER 0x60
0052 #define PMC_IDR 0x64
0053 #define PMC_SR 0x68
0054 #define PMC_IMR 0x6C
0055
0056
0057
0058
0059
0060
0061 #define PMC_SCR_PCK7 BIT15
0062 #define PMC_SCR_PCK6 BIT14
0063 #define PMC_SCR_PCK5 BIT13
0064 #define PMC_SCR_PCK4 BIT12
0065 #define PMC_SCR_PCK3 BIT11
0066 #define PMC_SCR_PCK2 BIT10
0067 #define PMC_SCR_PCK1 BIT9
0068 #define PMC_SCR_PCK0 BIT8
0069 #define PMC_SCR_UHP BIT4
0070 #define PMC_SCR_MCKUDP BIT2
0071 #define PMC_SCR_UDP BIT1
0072 #define PMC_SCR_PCK BIT0
0073
0074
0075
0076
0077 #define PMC_PCR_PID_EMAC BIT24
0078 #define PMC_PCR_PID_UHP BIT23
0079 #define PMC_PCR_PID_TC5 BIT22
0080 #define PMC_PCR_PID_TC4 BIT21
0081 #define PMC_PCR_PID_TC3 BIT20
0082 #define PMC_PCR_PID_TC2 BIT19
0083 #define PMC_PCR_PID_TC1 BIT18
0084 #define PMC_PCR_PID_TC0 BIT17
0085 #define PMC_PCR_PID_SSC2 BIT16
0086 #define PMC_PCR_PID_SSC1 BIT15
0087 #define PMC_PCR_PID_SSC0 BIT14
0088 #define PMC_PCR_PID_SPI BIT13
0089 #define PMC_PCR_PID_TWI BIT12
0090 #define PMC_PCR_PID_UDP BIT11
0091 #define PMC_PCR_PID_MCI BIT10
0092 #define PMC_PCR_PID_US3 BIT9
0093 #define PMC_PCR_PID_US2 BIT8
0094 #define PMC_PCR_PID_US1 BIT7
0095 #define PMC_PCR_PID_US0 BIT6
0096 #define PMC_PCR_PID_PIOD BIT5
0097 #define PMC_PCR_PID_PIOC BIT4
0098 #define PMC_PCR_PID_PIOB BIT3
0099 #define PMC_PCR_PID_PIOA BIT2
0100
0101
0102 #define PMC_MOR_MOSCEN BIT0
0103
0104
0105 #define PMC_MCFR_MAINRDY BIT16
0106
0107
0108 #define PMC_PLLAR_MUST_SET BIT29
0109 #define PMC_PLLAR_MUL(_x_) ((_x_ & 0x7ff) << 16)
0110 #define PMC_PLLAR_MUL_MASK (0x7ff << 16)
0111
0112 #define PMC_PLLAR_OUT_80_160 (0 << 14)
0113 #define PMC_PLLAR_OUT_150_240 (2 << 14)
0114 #define PMC_PLLAR_DIV(_x_) ((_x_ & 0xff) << 0)
0115 #define PMC_PLLAR_DIV_MASK (0xff)
0116
0117
0118 #define PMC_PLLBR_USB_96M BIT28
0119 #define PMC_PLLBR_MUL(_x_) ((_x_ & 0x7ff) << 16)
0120 #define PMC_PLLBR_MUL_MASK (0x7ff << 16)
0121 #define PMC_PLLBR_OUT_80_160 (0 << 14)
0122 #define PMC_PLLBR_OUT_150_240 (2 << 14)
0123 #define PMC_PLLBR_DIV(_x_) ((_x_ & 0xff) << 0)
0124 #define PMC_PLLBR_DIV_MASK (0xff)
0125
0126
0127 #define PMC_MCKR_MDIV_MASK (3 << 8)
0128 #define PMC_MCKR_MDIV_1 (0 << 8)
0129 #define PMC_MCKR_MDIV_2 (1 << 8)
0130 #define PMC_MCKR_MDIV_3 (2 << 8)
0131 #define PMC_MCKR_MDIV_4 (3 << 8)
0132 #define PMC_MCKR_PRES_MASK (7 << 2)
0133 #define PMC_MCKR_PRES_1 (0 << 2)
0134 #define PMC_MCKR_PRES_2 (1 << 2)
0135 #define PMC_MCKR_PRES_4 (2 << 2)
0136 #define PMC_MCKR_PRES_8 (3 << 2)
0137 #define PMC_MCKR_PRES_16 (4 << 2)
0138 #define PMC_MCKR_PRES_32 (5 << 2)
0139 #define PMC_MCKR_PRES_64 (6 << 2)
0140 #define PMC_MCKR_CSS_MASK (3 << 0)
0141 #define PMC_MCKR_CSS_SLOW (0 << 0)
0142 #define PMC_MCKR_CSS_MAIN (1 << 0)
0143 #define PMC_MCKR_CSS_PLLA (2 << 0)
0144 #define PMC_MCKR_CSS_PLLB (3 << 0)
0145
0146
0147 #define PMC_PCKR_PRES_1 (0 << 2)
0148 #define PMC_PCKR_PRES_2 (1 << 2)
0149 #define PMC_PCKR_PRES_4 (2 << 2)
0150 #define PMC_PCKR_PRES_8 (3 << 2)
0151 #define PMC_PCKR_PRES_16 (4 << 2)
0152 #define PMC_PCKR_PRES_32 (5 << 2)
0153 #define PMC_PCKR_PRES_64 (6 << 2)
0154 #define PMC_PCKR_CSS_SLOW (0 << 0)
0155 #define PMC_PCKR_CSS_MAIN (1 << 0)
0156 #define PMC_PCKR_CSS_PLLA (2 << 0)
0157 #define PMC_PCKR_CSS_PLLB (3 << 0)
0158
0159
0160
0161
0162
0163 #define PMC_INT_PCK7_RDY BIT15
0164 #define PMC_INT_PCK6_RDY BIT14
0165 #define PMC_INT_PCK5_RDY BIT13
0166 #define PMC_INT_PCK4_RDY BIT12
0167 #define PMC_INT_PCK3_RDY BIT11
0168 #define PMC_INT_PCK2_RDY BIT10
0169 #define PMC_INT_PCK1_RDY BIT9
0170 #define PMC_INT_PCK0_RDY BIT8
0171 #define PMC_INT_MCK_RDY BIT3
0172 #define PMC_INT_LOCKB BIT2
0173 #define PMC_INT_LCKA BIT1
0174 #define PMC_INT_MOSCS BIT0
0175
0176
0177 #endif