Trident IoT SDK
Loading...
Searching...
No Matches
T32CZ20_sysctrl.h
Go to the documentation of this file.
1
10
11#ifndef T32CZ20_SYSCTRL_H_
12#define T32CZ20_SYSCTRL_H_
13
14#include "tr_hal_platform.h"
15
16
22
23
28#define TR_HAL_NUM_PULL_REGISTERS 4
29#define TR_HAL_PINS_PER_PULL_REG 8
30
31#define TR_HAL_NUM_DRIVE_REGISTERS 2
32#define TR_HAL_PINS_PER_DRIVE_REG 16
33
34
41typedef struct
42{
43 // bit 4 to bit 7 (0x000000F0) is the chip revision
44 // bit 8 to bit 15 (0x0000FF00) is the chip ID
45 __IO uint32_t chip_info; // 0x00
46
47 // select which real clock to use for virtual clocks: hclk, per_clk, slow_clk
48 // and configure baseband frequency
49 __IO uint32_t system_clock_control_0; // 0x04
50
51 // select clk for UARTs, external slow clk, PWM, timers 0,1,2
52 __IO uint32_t system_clock_control_1; // 0x08
53
54 __IO uint32_t system_power_state; // 0x0C
55
56 // default is 0 = GPIO
57 __IO uint32_t reserved_old_map[4]; // 0x10, 0x14, 0x18, 0x1C
58 //__IO uint32_t gpio_pin_map[4]; // 0x10, 0x14, 0x18, 0x1C
59
60 // default is 0b110 = 6 = 100K pull up
61 __IO uint32_t gpio_pull_ctrl[TR_HAL_NUM_PULL_REGISTERS]; // 0x20, 0x24, 0x28, 0x2C
62
63 // default is 0b11 = 3 = 20 mA (max)
64 __IO uint32_t gpio_drv_ctrl[TR_HAL_NUM_DRIVE_REGISTERS]; // 0x30, 0x34
65
66 // default is 0 = disabled
67 __IO uint32_t open_drain_enable; // 0x38
68
69 __IO uint32_t enable_schmitt; // 0x3C
70 __IO uint32_t enable_filter; // 0x40
71 __IO uint32_t aio_control; // 0x44
72 __IO uint32_t cache_control; // 0x48
73 __IO uint32_t pwm_select; // 0x4C
74
75 // these are for telling the system how to power the RAM when in a power down
76 // mode. The RAM can be retained or not retained
77 __IO uint32_t sram_lowpower_0; // 0x50
78 __IO uint32_t sram_lowpower_1; // 0x54
79 __IO uint32_t sram_lowpower_2; // 0x58
80 __IO uint32_t sram_lowpower_3; // 0x5C
81
82 __IO uint32_t system_clock_control_2; // 0x60
83 __IO uint32_t system_test; // 0x64
84 __IO uint32_t reserved[6]; // 0x68 - 0x7C
85
86 // for setting GPIO pins as output functions
87 __IO uint32_t gpio_output_mux[8]; // 0x80 - 0x9C
88
89 // for setting GPIO pins as input functions
90 // note that the reg at 0xAC == IMUX3 == 4th register == gpio_input_mux[3] is NOT CURRENTLY USED
91 __IO uint32_t gpio_input_mux[8]; // 0xA0 - 0xBC
92
94
95// *****************************************************************
96// this is for the SYSTEM CLOCK CONTROL 0 register (0x04)
97
98// bits 0,1 = HCLK select
99// hclk: host clock (host, AHB, memory, DMA, flash, I2S, crypto)
100#define SYS_CTRL_HCLK_SELECT_XTAL_CLK 0x00
101#define SYS_CTRL_HCLK_SELECT_PLL_CLK 0x01
102#define SYS_CTRL_HCLK_SELECT_XTAL_CLK_DIV2 0x02
103#define SYS_CTRL_HCLK_SELECT_RCO_1M 0x03
104#define SYS_CTRL_HCLK_SELECT_MASK 0x03
105
106// bits 2,3 = PER CLK select
107// per clk: wdog, I2C, SPI
108#define SYS_CTRL_PER_CLK_SELECT_XTAL_CLK 0x00
109#define SYS_CTRL_PER_CLK_SELECT_XTAL_CLK_DIV2 0x04
110#define SYS_CTRL_PER_CLK_SELECT_RCO_1M 0x08
111#define SYS_CTRL_PER_CLK_SELECT_MASK 0x0C
112
113// bits 4,5 reserved
114
115// bits 6,7 = SLOW CLK select
116// slow_clk: RTC, timers 3,4
117#define SYS_CTRL_SLOW_CLK_SELECT_RCO_32K 0x00
118#define SYS_CTRL_SLOW_CLK_SELECT_XO_32K 0x40
119#define SYS_CTRL_SLOW_CLK_SELECT_EXTERNAL 0xC0
120#define SYS_CTRL_SLOW_CLK_SELECT_MASK 0xC0
121
122// bits 8,9,10 = baseband frequency
123#define SYS_CTRL_BASEBAND_FREQ_48_MHZ 0x00
124#define SYS_CTRL_BASEBAND_FREQ_64_MHZ 0x100
125#define SYS_CTRL_BASEBAND_FREQ_36_MHZ 0x600
126#define SYS_CTRL_BASEBAND_FREQ_40_MHZ 0x700
127
128// bits 11-14 reserved
129
130// bit 15 - baseband PLL enable
131#define SYS_CTRL_BASEBAND_PLL_ENABLE 0x8000
132#define SYS_CTRL_BASEBAND_PLL_DISABLE 0x0000
133
134
135// *****************************************************************
136// this is for the SYSTEM CLOCK CONTROL 1 register (0x08)
137
138// bits 0,1 UART0 clock select
139// bits 2,3 UART1 clock select
140// bits 4,5 UART2 clock select
141
142// these are the values, and will need to be shifted based on the UART
143// this is for bits 0 thru 5
144#define SYS_CTRL_UART_CLOCK_SELECT_PER_CLOCK 0x00
145#define SYS_CTRL_UART_CLOCK_SELECT_RCO_1M 0x02
146#define SYS_CTRL_UART_CLOCK_SELECT_RCO_32K 0x03
147
148#define SYS_CTRL_UART0_CLOCK_SELECT_BIT_SHIFT 0
149#define SYS_CTRL_UART1_CLOCK_SELECT_BIT_SHIFT 2
150#define SYS_CTRL_UART2_CLOCK_SELECT_BIT_SHIFT 4
151
152// bits 6,7 reserved
153
154// bits 8 to 13 are for setting the slow clock to an external clock
155
156// bit 13 set = enable slow clock to use external source
157#define SYS_CTRL_SLOW_CLK_ENABLE_EXTERNAL 0x2000
158
159// the external clock source is a GPIO number, in bits 8 to 12
160// so shift the GPIO number by this amount of bits
161#define SYS_CTRL_SLOW_CLK_EXTERNAL_SRC_SHIFT 8
162
163// bits 16,17 = PWM0 clock select
164// bits 18,19 = PWM1 clock select
165// bits 20,21 = PWM2 clock select
166// bits 22,23 = PWM3 clock select
167// bits 24,25 = PWM4 clock select
168
169#define SYS_CTRL_PWM_CLOCK_SELECT_HCLK 0x00
170#define SYS_CTRL_PWM_CLOCK_SELECT_PER_CLK 0x01
171#define SYS_CTRL_PWM_CLOCK_SELECT_RCO_1M 0x02
172#define SYS_CTRL_PWM_CLOCK_SELECT_SLOW_CLK 0x03
173
174#define SYS_CTRL_PWM0_CLOCK_SELECT_BIT_SHIFT 16
175#define SYS_CTRL_PWM1_CLOCK_SELECT_BIT_SHIFT 18
176#define SYS_CTRL_PWM2_CLOCK_SELECT_BIT_SHIFT 20
177#define SYS_CTRL_PWM3_CLOCK_SELECT_BIT_SHIFT 22
178#define SYS_CTRL_PWM4_CLOCK_SELECT_BIT_SHIFT 24
179
180// bits 26,27 = Timer0 clock select
181// bits 28,29 = Timer1 clock select
182// bits 30,31 = Timer2 clock select
183
184#define SYS_CTRL_TIMER_CLOCK_SELECT_PER_CLK 0x00
185#define SYS_CTRL_TIMER_CLOCK_SELECT_RCO_1M 0x02
186#define SYS_CTRL_TIMER_CLOCK_SELECT_SLOW_CLK 0x03
187
188#define SYS_CTRL_TIMER0_CLOCK_SELECT_BIT_SHIFT 26
189#define SYS_CTRL_TIMER1_CLOCK_SELECT_BIT_SHIFT 28
190#define SYS_CTRL_TIMER2_CLOCK_SELECT_BIT_SHIFT 30
191
192
193// *****************************************************************
194// this is for the SYSTEM POWER STATE register (0x0C)
195#define TR_HAL_POWER_NORMAL 0x00
196#define TR_HAL_POWER_LITE_SLEEP 0x01
197#define TR_HAL_POWER_DEEP_SLEEP 0x02
198#define TR_HAL_POWER_POWERDOWN 0x04
199
200
201// *****************************************************************
202// this orients the SYSCTRL_REGISTERS struct with the correct addresses
203// so referencing a field will now read/write the correct SYSCTRL register
204// chip address
205#define SYS_CTRL_CHIP_REGISTERS ((SYS_CTRL_REGISTERS_T *) CHIP_MEMORY_MAP_SYS_CTRL_BASE)
206
207// these are for setting the system_clock_control register
208#define SCC_UART0_CLOCK_BIT 16
209#define SCC_UART1_CLOCK_BIT 17
210#define SCC_UART2_CLOCK_BIT 18
211
215
216#endif // T32CZ20_SYSCTRL_H_
This file contains the CHIP SPECIFIC types and defines for the T32CZ20.
#define TR_HAL_NUM_DRIVE_REGISTERS
Definition T32CZ20_sysctrl.h:31
#define TR_HAL_NUM_PULL_REGISTERS
defines for dealing with the SYS_CTRL pull registers and drive registers
Definition T32CZ20_sysctrl.h:28
offsets for where to find chip registers needed for System Control register which is used to configur...
Definition T32CM11_sysctrl.h:43
__IO uint32_t gpio_drv_ctrl[TR_HAL_NUM_DRIVE_REGISTERS]
Definition T32CM11_sysctrl.h:55
__IO uint32_t aio_control
Definition T32CZ20_sysctrl.h:71
__IO uint32_t cache_control
Definition T32CZ20_sysctrl.h:72
__IO uint32_t sram_lowpower_2
Definition T32CZ20_sysctrl.h:79
__IO uint32_t sram_lowpower_3
Definition T32CZ20_sysctrl.h:80
__IO uint32_t reserved[2]
Definition T32CM11_sysctrl.h:46
__IO uint32_t gpio_input_mux[8]
Definition T32CZ20_sysctrl.h:91
__IO uint32_t system_power_state
Definition T32CZ20_sysctrl.h:54
__IO uint32_t gpio_pull_ctrl[TR_HAL_NUM_PULL_REGISTERS]
Definition T32CM11_sysctrl.h:52
__IO uint32_t system_clock_control_0
Definition T32CZ20_sysctrl.h:49
__IO uint32_t enable_schmitt
Definition T32CZ20_sysctrl.h:69
__IO uint32_t reserved_old_map[4]
Definition T32CZ20_sysctrl.h:57
__IO uint32_t enable_filter
Definition T32CZ20_sysctrl.h:70
__IO uint32_t pwm_select
Definition T32CZ20_sysctrl.h:73
__IO uint32_t gpio_output_mux[8]
Definition T32CZ20_sysctrl.h:87
__IO uint32_t open_drain_enable
Definition T32CM11_sysctrl.h:58
__IO uint32_t sram_lowpower_1
Definition T32CZ20_sysctrl.h:78
__IO uint32_t sram_lowpower_0
Definition T32CZ20_sysctrl.h:77
__IO uint32_t system_clock_control_2
Definition T32CZ20_sysctrl.h:82
__IO uint32_t system_clock_control_1
Definition T32CZ20_sysctrl.h:52
__IO uint32_t system_test
Definition T32CZ20_sysctrl.h:83