mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-16 10:24:26 +00:00
gptimer: clean up hal and ll for driver-ng
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#ifndef __TIMG_REG_H__
|
||||
#define __TIMG_REG_H__
|
||||
#include "soc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The value that needs to be written to TIMG_WDT_WKEY to write-enable the wdt registers */
|
||||
#define TIMG_WDT_WKEY_VALUE 0x50D83AA1
|
||||
|
||||
@@ -669,7 +666,6 @@
|
||||
#define TIMG_CLK_EN_V 0x1
|
||||
#define TIMG_CLK_EN_S 31
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*__TIMG_REG_H__ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,207 +1,743 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#ifndef _SOC_TIMG_STRUCT_H_
|
||||
#define _SOC_TIMG_STRUCT_H_
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef volatile struct timg_dev_s {
|
||||
/** Group: Configuration and Control Register */
|
||||
/** Type of txconfig register
|
||||
* Timer x configuration register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 10;
|
||||
uint32_t alarm_en: 1; /*When set alarm is enabled*/
|
||||
uint32_t level_int_en: 1; /*When set level type interrupt will be generated during alarm*/
|
||||
uint32_t edge_int_en: 1; /*When set edge type interrupt will be generated during alarm*/
|
||||
uint32_t divider: 16; /*Timer clock (T0/1_clk) pre-scale value.*/
|
||||
uint32_t autoreload: 1; /*When set timer 0/1 auto-reload at alarming is enabled*/
|
||||
uint32_t increase: 1; /*When set timer 0/1 time-base counter increment. When cleared timer 0 time-base counter decrement.*/
|
||||
uint32_t enable: 1; /*When set timer 0/1 time-base counter is enabled*/
|
||||
};
|
||||
uint32_t val;
|
||||
} config;
|
||||
uint32_t cnt_low; /*Register to store timer 0/1 time-base counter current value lower 32 bits.*/
|
||||
uint32_t cnt_high; /*Register to store timer 0 time-base counter current value higher 32 bits.*/
|
||||
uint32_t update; /*Write any value will trigger a timer 0 time-base counter value update (timer 0 current value will be stored in registers above)*/
|
||||
uint32_t alarm_low; /*Timer 0 time-base counter value lower 32 bits that will trigger the alarm*/
|
||||
uint32_t alarm_high; /*Timer 0 time-base counter value higher 32 bits that will trigger the alarm*/
|
||||
uint32_t load_low; /*Lower 32 bits of the value that will load into timer 0 time-base counter*/
|
||||
uint32_t load_high; /*higher 32 bits of the value that will load into timer 0 time-base counter*/
|
||||
uint32_t reload; /*Write any value will trigger timer 0 time-base counter reload*/
|
||||
} hw_timer[2];
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 14;
|
||||
uint32_t flashboot_mod_en: 1; /*When set flash boot protection is enabled*/
|
||||
uint32_t sys_reset_length: 3; /*length of system reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/
|
||||
uint32_t cpu_reset_length: 3; /*length of CPU reset selection. 0: 100ns 1: 200ns 2: 300ns 3: 400ns 4: 500ns 5: 800ns 6: 1.6us 7: 3.2us*/
|
||||
uint32_t level_int_en: 1; /*When set level type interrupt generation is enabled*/
|
||||
uint32_t edge_int_en: 1; /*When set edge type interrupt generation is enabled*/
|
||||
uint32_t stg3: 2; /*Stage 3 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/
|
||||
uint32_t stg2: 2; /*Stage 2 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/
|
||||
uint32_t stg1: 2; /*Stage 1 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/
|
||||
uint32_t stg0: 2; /*Stage 0 configuration. 0: off 1: interrupt 2: reset CPU 3: reset system*/
|
||||
uint32_t en: 1; /*When set SWDT is enabled*/
|
||||
};
|
||||
uint32_t val;
|
||||
} wdt_config0;
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 16;
|
||||
uint32_t clk_prescale:16; /*SWDT clock prescale value. Period = 12.5ns * value stored in this register*/
|
||||
};
|
||||
uint32_t val;
|
||||
} wdt_config1;
|
||||
uint32_t wdt_config2; /*Stage 0 timeout value in SWDT clock cycles*/
|
||||
uint32_t wdt_config3; /*Stage 1 timeout value in SWDT clock cycles*/
|
||||
uint32_t wdt_config4; /*Stage 2 timeout value in SWDT clock cycles*/
|
||||
uint32_t wdt_config5; /*Stage 3 timeout value in SWDT clock cycles*/
|
||||
uint32_t wdt_feed; /*Write any value will feed SWDT*/
|
||||
uint32_t wdt_wprotect; /*If change its value from default then write protection is on.*/
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 12;
|
||||
uint32_t start_cycling: 1;
|
||||
uint32_t clk_sel: 2;
|
||||
uint32_t rdy: 1;
|
||||
uint32_t max: 15;
|
||||
uint32_t start: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} rtc_cali_cfg;
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 7;
|
||||
uint32_t value:25;
|
||||
};
|
||||
uint32_t val;
|
||||
} rtc_cali_cfg1;
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 7;
|
||||
uint32_t rtc_only: 1;
|
||||
uint32_t cpst_en: 1;
|
||||
uint32_t lac_en: 1;
|
||||
uint32_t alarm_en: 1;
|
||||
uint32_t level_int_en: 1;
|
||||
uint32_t edge_int_en: 1;
|
||||
uint32_t divider: 16;
|
||||
uint32_t autoreload: 1;
|
||||
uint32_t increase: 1;
|
||||
uint32_t en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lactconfig;
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 6;
|
||||
uint32_t step_len:26;
|
||||
};
|
||||
uint32_t val;
|
||||
} lactrtc;
|
||||
uint32_t lactlo; /**/
|
||||
uint32_t lacthi; /**/
|
||||
uint32_t lactupdate; /**/
|
||||
uint32_t lactalarmlo; /**/
|
||||
uint32_t lactalarmhi; /**/
|
||||
uint32_t lactloadlo; /**/
|
||||
uint32_t lactloadhi; /**/
|
||||
uint32_t lactload; /**/
|
||||
union {
|
||||
struct {
|
||||
uint32_t t0: 1; /*interrupt when timer0 alarm*/
|
||||
uint32_t t1: 1; /*interrupt when timer1 alarm*/
|
||||
uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/
|
||||
uint32_t lact: 1;
|
||||
uint32_t reserved4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} int_ena;
|
||||
union {
|
||||
struct {
|
||||
uint32_t t0: 1; /*interrupt when timer0 alarm*/
|
||||
uint32_t t1: 1; /*interrupt when timer1 alarm*/
|
||||
uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/
|
||||
uint32_t lact: 1;
|
||||
uint32_t reserved4:28;
|
||||
};
|
||||
uint32_t val;
|
||||
} int_raw;
|
||||
union {
|
||||
struct {
|
||||
uint32_t t0: 1; /*interrupt when timer0 alarm*/
|
||||
uint32_t t1: 1; /*interrupt when timer1 alarm*/
|
||||
uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/
|
||||
uint32_t lact: 1;
|
||||
uint32_t reserved4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} int_st_timers;
|
||||
union {
|
||||
struct {
|
||||
uint32_t t0: 1; /*interrupt when timer0 alarm*/
|
||||
uint32_t t1: 1; /*interrupt when timer1 alarm*/
|
||||
uint32_t wdt: 1; /*Interrupt when an interrupt stage timeout*/
|
||||
uint32_t lact: 1;
|
||||
uint32_t reserved4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} int_clr_timers;
|
||||
uint32_t reserved_a8;
|
||||
uint32_t reserved_ac;
|
||||
uint32_t reserved_b0;
|
||||
uint32_t reserved_b4;
|
||||
uint32_t reserved_b8;
|
||||
uint32_t reserved_bc;
|
||||
uint32_t reserved_c0;
|
||||
uint32_t reserved_c4;
|
||||
uint32_t reserved_c8;
|
||||
uint32_t reserved_cc;
|
||||
uint32_t reserved_d0;
|
||||
uint32_t reserved_d4;
|
||||
uint32_t reserved_d8;
|
||||
uint32_t reserved_dc;
|
||||
uint32_t reserved_e0;
|
||||
uint32_t reserved_e4;
|
||||
uint32_t reserved_e8;
|
||||
uint32_t reserved_ec;
|
||||
uint32_t reserved_f0;
|
||||
uint32_t reserved_f4;
|
||||
union {
|
||||
struct {
|
||||
uint32_t date:28; /*Version of this regfile*/
|
||||
uint32_t reserved28: 4;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_date;
|
||||
union {
|
||||
struct {
|
||||
uint32_t reserved0: 31;
|
||||
uint32_t en: 1; /*Force clock enable for this regfile*/
|
||||
};
|
||||
uint32_t val;
|
||||
} clk;
|
||||
uint32_t reserved_0: 10;
|
||||
/** tx_alarm_en : R/W; bitpos: [10]; default: 0;
|
||||
* When set, the alarm is enabled. This bit is automatically cleared once an
|
||||
*
|
||||
* alarm occurs.
|
||||
*/
|
||||
uint32_t tx_alarm_en: 1;
|
||||
/** tx_level_int_en : R/W; bitpos: [11]; default: 0;
|
||||
* When set, an alarm will generate a level type interrupt.
|
||||
*/
|
||||
uint32_t tx_level_int_en: 1;
|
||||
/** tx_edge_int_en : R/W; bitpos: [12]; default: 0;
|
||||
* When set, an alarm will generate an edge type interrupt.
|
||||
*/
|
||||
uint32_t tx_edge_int_en: 1;
|
||||
/** tx_divider : R/W; bitpos: [28:13]; default: 1;
|
||||
* Timer x clock (Tx_clk) prescaler value.
|
||||
*/
|
||||
uint32_t tx_divider: 16;
|
||||
/** tx_autoreload : R/W; bitpos: [29]; default: 1;
|
||||
* When set, timer x auto-reload at alarm is enabled.
|
||||
*/
|
||||
uint32_t tx_autoreload: 1;
|
||||
/** tx_increase : R/W; bitpos: [30]; default: 1;
|
||||
* When set, the timer x time-base counter will increment every clock tick. When
|
||||
*
|
||||
* cleared, the timer x time-base counter will decrement.
|
||||
*/
|
||||
uint32_t tx_increase: 1;
|
||||
/** tx_en : R/W; bitpos: [31]; default: 0;
|
||||
* When set, the timer x time-base counter is enabled.
|
||||
*/
|
||||
uint32_t tx_en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txconfig_reg_t;
|
||||
|
||||
/** Type of txlo register
|
||||
* Timer x current value, low 32 bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_lo : RO; bitpos: [31:0]; default: 0;
|
||||
* After writing to TIMG_TxUPDATE_REG, the low 32 bits of the time-base counter
|
||||
*
|
||||
* of timer x can be read here.
|
||||
*/
|
||||
uint32_t tx_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txlo_reg_t;
|
||||
|
||||
/** Type of txhi register
|
||||
* Timer x current value, high 32 bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_hi : RO; bitpos: [31:0]; default: 0;
|
||||
* After writing to TIMG_TxUPDATE_REG, the high 32 bits of the time-base counter
|
||||
*
|
||||
* of timer x can be read here.
|
||||
*/
|
||||
uint32_t tx_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txhi_reg_t;
|
||||
|
||||
/** Type of txupdate register
|
||||
* Write to copy current timer value to TIMGn_Tx_(LO/HI)_REG
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 31;
|
||||
/** tx_update : R/W; bitpos: [31]; default: 0;
|
||||
* After writing 0 or 1 to TIMG_TxUPDATE_REG, the counter value is latched.
|
||||
*/
|
||||
uint32_t tx_update: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txupdate_reg_t;
|
||||
|
||||
/** Type of txalarmlo register
|
||||
* Timer x alarm value, low 32 bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_alarm_lo : R/W; bitpos: [31:0]; default: 0;
|
||||
* Timer x alarm trigger time-base counter value, low 32 bits.
|
||||
*/
|
||||
uint32_t tx_alarm_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txalarmlo_reg_t;
|
||||
|
||||
/** Type of txalarmhi register
|
||||
* Timer x alarm value, high bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_alarm_hi : R/W; bitpos: [31:0]; default: 0;
|
||||
*
|
||||
*
|
||||
* Timer x alarm trigger time-base counter value, high 32 bits.
|
||||
*/
|
||||
uint32_t tx_alarm_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txalarmhi_reg_t;
|
||||
|
||||
/** Type of txloadlo register
|
||||
* Timer x reload value, low 32 bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_load_lo : R/W; bitpos: [31:0]; default: 0;
|
||||
*
|
||||
*
|
||||
* Low 32 bits of the value that a reload will load onto timer x time-base
|
||||
*
|
||||
* Counter.
|
||||
*/
|
||||
uint32_t tx_load_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txloadlo_reg_t;
|
||||
|
||||
/** Type of txloadhi register
|
||||
* Timer x reload value, high 32 bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_load_hi : R/W; bitpos: [31:0]; default: 0;
|
||||
*
|
||||
*
|
||||
* High 32 bits of the value that a reload will load onto timer x time-base
|
||||
*
|
||||
* counter.
|
||||
*/
|
||||
uint32_t tx_load_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txloadhi_reg_t;
|
||||
|
||||
/** Type of txload register
|
||||
* Write to reload timer from TIMG_T0_(LOADLOLOADHI)_REG
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_load : WO; bitpos: [31:0]; default: 0;
|
||||
*
|
||||
*
|
||||
* Write any value to trigger a timer x time-base counter reload.
|
||||
*/
|
||||
uint32_t tx_load: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_txload_reg_t;
|
||||
|
||||
|
||||
/** Group: Configuration and Control Register for WDT */
|
||||
/** Type of wdtconfig0 register
|
||||
* Watchdog timer configuration register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 14;
|
||||
/** wdt_flashboot_mod_en : R/W; bitpos: [14]; default: 1;
|
||||
* When set, Flash boot protection is enabled.
|
||||
*/
|
||||
uint32_t wdt_flashboot_mod_en: 1;
|
||||
/** wdt_sys_reset_length : R/W; bitpos: [17:15]; default: 1;
|
||||
* System reset signal length selection. 0: 100 ns, 1: 200 ns,
|
||||
*
|
||||
* 2: 300 ns, 3: 400 ns, 4: 500 ns, 5: 800 ns, 6: 1.6 us, 7: 3.2 us.
|
||||
*/
|
||||
uint32_t wdt_sys_reset_length: 3;
|
||||
/** wdt_cpu_reset_length : R/W; bitpos: [20:18]; default: 1;
|
||||
* CPU reset signal length selection. 0: 100 ns, 1: 200 ns,
|
||||
*
|
||||
* 2: 300 ns, 3: 400 ns, 4: 500 ns, 5: 800 ns, 6: 1.6 us, 7: 3.2 us.
|
||||
*/
|
||||
uint32_t wdt_cpu_reset_length: 3;
|
||||
/** wdt_level_int_en : R/W; bitpos: [21]; default: 0;
|
||||
* When set, a level type interrupt will occur at the timeout of a stage
|
||||
*
|
||||
* configured to generate an interrupt.
|
||||
*/
|
||||
uint32_t wdt_level_int_en: 1;
|
||||
/** wdt_edge_int_en : R/W; bitpos: [22]; default: 0;
|
||||
* When set, an edge type interrupt will occur at the timeout of a stage
|
||||
*
|
||||
* configured to generate an interrupt.
|
||||
*/
|
||||
uint32_t wdt_edge_int_en: 1;
|
||||
/** wdt_stg3 : R/W; bitpos: [24:23]; default: 0;
|
||||
* Stage 3 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system.
|
||||
*
|
||||
*/
|
||||
uint32_t wdt_stg3: 2;
|
||||
/** wdt_stg2 : R/W; bitpos: [26:25]; default: 0;
|
||||
* Stage 2 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system.
|
||||
*
|
||||
*/
|
||||
uint32_t wdt_stg2: 2;
|
||||
/** wdt_stg1 : R/W; bitpos: [28:27]; default: 0;
|
||||
* Stage 1 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system.
|
||||
*
|
||||
*/
|
||||
uint32_t wdt_stg1: 2;
|
||||
/** wdt_stg0 : R/W; bitpos: [30:29]; default: 0;
|
||||
* Stage 0 configuration. 0: off, 1: interrupt, 2: reset CPU, 3: reset system.
|
||||
*
|
||||
*/
|
||||
uint32_t wdt_stg0: 2;
|
||||
/** wdt_en : R/W; bitpos: [31]; default: 0;
|
||||
* When set, MWDT is enabled.
|
||||
*/
|
||||
uint32_t wdt_en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig0_reg_t;
|
||||
|
||||
/** Type of wdtconfig1 register
|
||||
* Watchdog timer prescaler register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 16;
|
||||
/** wdt_clk_prescaler : R/W; bitpos: [31:16]; default: 1;
|
||||
* MWDT clock prescaler value. MWDT clock period = 12.5 ns *
|
||||
*
|
||||
* TIMG_WDT_CLK_PRESCALE.
|
||||
*/
|
||||
uint32_t wdt_clk_prescaler: 16;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig1_reg_t;
|
||||
|
||||
/** Type of wdtconfig2 register
|
||||
* Watchdog timer stage 0 timeout value
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_stg0_hold : R/W; bitpos: [31:0]; default: 26000000;
|
||||
* Stage 0 timeout value, in MWDT clock cycles.
|
||||
*/
|
||||
uint32_t wdt_stg0_hold: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig2_reg_t;
|
||||
|
||||
/** Type of wdtconfig3 register
|
||||
* Watchdog timer stage 1 timeout value
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_stg1_hold : R/W; bitpos: [31:0]; default: 134217727;
|
||||
* Stage 1 timeout value, in MWDT clock cycles.
|
||||
*/
|
||||
uint32_t wdt_stg1_hold: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig3_reg_t;
|
||||
|
||||
/** Type of wdtconfig4 register
|
||||
* Watchdog timer stage 2 timeout value
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_stg2_hold : R/W; bitpos: [31:0]; default: 1048575;
|
||||
* Stage 2 timeout value, in MWDT clock cycles.
|
||||
*/
|
||||
uint32_t wdt_stg2_hold: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig4_reg_t;
|
||||
|
||||
/** Type of wdtconfig5 register
|
||||
* Watchdog timer stage 3 timeout value
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_stg3_hold : R/W; bitpos: [31:0]; default: 1048575;
|
||||
* Stage 3 timeout value, in MWDT clock cycles.
|
||||
*/
|
||||
uint32_t wdt_stg3_hold: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtconfig5_reg_t;
|
||||
|
||||
/** Type of wdtfeed register
|
||||
* Write to feed the watchdog timer
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_feed : WO; bitpos: [31:0]; default: 0;
|
||||
* Write any value to feed the MWDT. (WO)
|
||||
*/
|
||||
uint32_t wdt_feed: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtfeed_reg_t;
|
||||
|
||||
/** Type of wdtwprotect register
|
||||
* Watchdog write protect register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** wdt_wkey : R/W; bitpos: [31:0]; default: 1356348065;
|
||||
* If the register contains a different value than its reset value, write
|
||||
*
|
||||
* protection is enabled.
|
||||
*/
|
||||
uint32_t wdt_wkey: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_wdtwprotect_reg_t;
|
||||
|
||||
|
||||
/** Group: Configuration and Control Register for RTC CALI */
|
||||
/** Type of rtccalicfg register
|
||||
* RTC calibration configuration register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 12;
|
||||
/** rtc_cali_start_cycling : R/W; bitpos: [12]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t rtc_cali_start_cycling: 1;
|
||||
/** rtc_cali_clk_sel : R/W; bitpos: [14:13]; default: 1;
|
||||
* 0:rtcslowclock. 1:clk_80m. 2:xtal_32k.
|
||||
*/
|
||||
uint32_t rtc_cali_clk_sel: 2;
|
||||
/** rtc_cali_rdy : RO; bitpos: [15]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t rtc_cali_rdy: 1;
|
||||
/** rtc_cali_max : R/W; bitpos: [30:16]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t rtc_cali_max: 15;
|
||||
/** rtc_cali_start : R/W; bitpos: [31]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t rtc_cali_start: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_rtccalicfg_reg_t;
|
||||
|
||||
/** Type of rtccalicfg1 register
|
||||
* RTC calibration configuration1 register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 7;
|
||||
/** rtc_cali_value : RO; bitpos: [31:7]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t rtc_cali_value: 25;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_rtccalicfg1_reg_t;
|
||||
|
||||
/** Group: Configuration and Control Register for LACT */
|
||||
/** Type of lactconfig register
|
||||
* LACT configuration register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 7;
|
||||
/** lact_rtc_only : R/W; bitpos: [7]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_rtc_only: 1;
|
||||
/** lact_cpst_en : R/W; bitpos: [8]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_cpst_en: 1;
|
||||
/** lact_lac_en : R/W; bitpos: [9]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_lac_en: 1;
|
||||
/** lact_alarm_en : R/W; bitpos: [10]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_alarm_en: 1;
|
||||
/** lact_level_int_en : R/W; bitpos: [11]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_level_int_en: 1;
|
||||
/** lact_edge_int_en : R/W; bitpos: [12]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_edge_int_en: 1;
|
||||
/** lact_divider : R/W; bitpos: [28:13]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_divider: 16;
|
||||
/** lact_autoreload : R/W; bitpos: [29]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_autoreload: 1;
|
||||
/** lact_increase : R/W; bitpos: [30]; default: 1;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_increase: 1;
|
||||
/** lact_en : R/W; bitpos: [31]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactconfig_reg_t;
|
||||
|
||||
/** Type of lactrtc register
|
||||
* LACT RTC register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 6;
|
||||
/** lact_rtc_step_len : R/W; bitpos: [31:6]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_rtc_step_len: 26;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactrtc_reg_t;
|
||||
|
||||
/** Type of lactlo register
|
||||
* LACT low register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_lo : RO; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactlo_reg_t;
|
||||
|
||||
/** Type of lacthi register
|
||||
* LACT high register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_hi : RO; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lacthi_reg_t;
|
||||
|
||||
/** Type of lactupdate register
|
||||
* LACT update register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_update : WO; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_update: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactupdate_reg_t;
|
||||
|
||||
/** Type of lactalarmlo register
|
||||
* LACT alarm low register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_alarm_lo : R/W; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_alarm_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactalarmlo_reg_t;
|
||||
|
||||
/** Type of lactalarmhi register
|
||||
* LACT alarm high register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_alarm_hi : R/W; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_alarm_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactalarmhi_reg_t;
|
||||
|
||||
/** Type of lactloadlo register
|
||||
* LACT load low register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_load_lo : R/W; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_load_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactloadlo_reg_t;
|
||||
|
||||
/** Type of lactloadhi register
|
||||
* Timer LACT load high register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_load_hi : R/W; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_load_hi: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactloadhi_reg_t;
|
||||
|
||||
/** Type of lactload register
|
||||
* Timer LACT load register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lact_load : WO; bitpos: [31:0]; default: 0;
|
||||
* Reserved
|
||||
*/
|
||||
uint32_t lact_load: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_lactload_reg_t;
|
||||
|
||||
|
||||
/** Group: Interrupt Register */
|
||||
/** Type of int_ena_timers register
|
||||
* Interrupt enable bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** tx_int_ena : R/W; bitpos: [0]; default: 0;
|
||||
* The interrupt enable bit for the TIMG_T0_INT interrupt.
|
||||
*/
|
||||
uint32_t t0_int_ena: 1;
|
||||
/** t1_int_ena : R/W; bitpos: [1]; default: 0;
|
||||
* The interrupt enable bit for the TIMG_T1_INT interrupt.
|
||||
*/
|
||||
uint32_t t1_int_ena: 1;
|
||||
/** wdt_int_ena : R/W; bitpos: [2]; default: 0;
|
||||
* The interrupt enable bit for the TIMG_WDT_INT interrupt.
|
||||
*/
|
||||
uint32_t wdt_int_ena: 1;
|
||||
/** lact_int_ena : R/W; bitpos: [3]; default: 0;
|
||||
* The interrupt enable bit for the TIMG_LACT_INT interrupt.
|
||||
*/
|
||||
uint32_t lact_int_ena: 1;
|
||||
uint32_t reserved_4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_int_ena_timers_reg_t;
|
||||
|
||||
/** Type of int_raw_timers register
|
||||
* Raw interrupt status
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** t0_int_raw : RO; bitpos: [0]; default: 0;
|
||||
* The raw interrupt status bit for the TIMG_T0_INT interrupt.
|
||||
*/
|
||||
uint32_t t0_int_raw: 1;
|
||||
/** t1_int_raw : RO; bitpos: [1]; default: 0;
|
||||
* The raw interrupt status bit for the TIMG_T1_INT interrupt.
|
||||
*/
|
||||
uint32_t t1_int_raw: 1;
|
||||
/** wdt_int_raw : RO; bitpos: [2]; default: 0;
|
||||
* The raw interrupt status bit for the TIMG_WDT_INT interrupt.
|
||||
*/
|
||||
uint32_t wdt_int_raw: 1;
|
||||
/** lact_int_raw : RO; bitpos: [3]; default: 0;
|
||||
* The raw interrupt status bit for the TIMG_LACT_INT interrupt.
|
||||
*/
|
||||
uint32_t lact_int_raw: 1;
|
||||
uint32_t reserved_4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_int_raw_timers_reg_t;
|
||||
|
||||
/** Type of int_st_timers register
|
||||
* Masked interrupt status
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** t0_int_st : RO; bitpos: [0]; default: 0;
|
||||
* The masked interrupt status bit for the TIMG_T0_INT interrupt.
|
||||
*/
|
||||
uint32_t t0_int_st: 1;
|
||||
/** t1_int_st : RO; bitpos: [1]; default: 0;
|
||||
* The masked interrupt status bit for the TIMG_T1_INT interrupt.
|
||||
*/
|
||||
uint32_t t1_int_st: 1;
|
||||
/** wdt_int_st : RO; bitpos: [2]; default: 0;
|
||||
* The masked interrupt status bit for the TIMG_WDT_INT interrupt.
|
||||
*/
|
||||
uint32_t wdt_int_st: 1;
|
||||
/** lact_int_st : RO; bitpos: [3]; default: 0;
|
||||
* The masked interrupt status bit for the TIMG_LACT_INT interrupt.
|
||||
*/
|
||||
uint32_t lact_int_st: 1;
|
||||
uint32_t reserved_4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_int_st_timers_reg_t;
|
||||
|
||||
/** Type of int_clr_timers register
|
||||
* Interrupt clear bits
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** t0_int_clr : WO; bitpos: [0]; default: 0;
|
||||
* Set this bit to clear the TIMG_T0_INT interrupt.
|
||||
*/
|
||||
uint32_t t0_int_clr: 1;
|
||||
/** t1_int_clr : WO; bitpos: [1]; default: 0;
|
||||
* Set this bit to clear the TIMG_T1_INT interrupt.
|
||||
*/
|
||||
uint32_t t1_int_clr: 1;
|
||||
/** wdt_int_clr : WO; bitpos: [2]; default: 0;
|
||||
* Set this bit to clear the TIMG_WDT_INT interrupt.
|
||||
*/
|
||||
uint32_t wdt_int_clr: 1;
|
||||
/** lact_int_clr : WO; bitpos: [3]; default: 0;
|
||||
* Set this bit to clear the TIMG_LACT_INT interrupt.
|
||||
*/
|
||||
uint32_t lact_int_clr: 1;
|
||||
uint32_t reserved_4: 28;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_int_clr_timers_reg_t;
|
||||
|
||||
|
||||
/** Group: Version Register */
|
||||
/** Type of timers_date register
|
||||
* Version control register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** timers_date : R/W; bitpos: [27:0]; default: 26243681;
|
||||
* Version control register.
|
||||
*/
|
||||
uint32_t timers_date: 28;
|
||||
uint32_t reserved_28: 4;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_timers_date_reg_t;
|
||||
|
||||
|
||||
/** Group: Configuration Register */
|
||||
/** Type of regclk register
|
||||
* Timer group clock gate register
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0: 31;
|
||||
/** clk_en : R/W; bitpos: [31]; default: 0;
|
||||
* Register clock gate signal. 1: Registers can be read and written to by software. 0:
|
||||
* Registers can not be read or written to by software.
|
||||
*/
|
||||
uint32_t clk_en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} timg_regclk_reg_t;
|
||||
|
||||
typedef struct {
|
||||
volatile timg_txconfig_reg_t config;
|
||||
volatile timg_txlo_reg_t lo;
|
||||
volatile timg_txhi_reg_t hi;
|
||||
volatile timg_txupdate_reg_t update;
|
||||
volatile timg_txalarmlo_reg_t alarmlo;
|
||||
volatile timg_txalarmhi_reg_t alarmhi;
|
||||
volatile timg_txloadlo_reg_t loadlo;
|
||||
volatile timg_txloadhi_reg_t loadhi;
|
||||
volatile timg_txload_reg_t load;
|
||||
} timg_hwtimer_reg_t;
|
||||
|
||||
typedef struct timg_dev_t {
|
||||
volatile timg_hwtimer_reg_t hw_timer[2];
|
||||
volatile timg_wdtconfig0_reg_t wdtconfig0;
|
||||
volatile timg_wdtconfig1_reg_t wdtconfig1;
|
||||
volatile timg_wdtconfig2_reg_t wdtconfig2;
|
||||
volatile timg_wdtconfig3_reg_t wdtconfig3;
|
||||
volatile timg_wdtconfig4_reg_t wdtconfig4;
|
||||
volatile timg_wdtconfig5_reg_t wdtconfig5;
|
||||
volatile timg_wdtfeed_reg_t wdtfeed;
|
||||
volatile timg_wdtwprotect_reg_t wdtwprotect;
|
||||
volatile timg_rtccalicfg_reg_t rtccalicfg;
|
||||
volatile timg_rtccalicfg1_reg_t rtccalicfg1;
|
||||
volatile timg_lactconfig_reg_t lactconfig;
|
||||
volatile timg_lactrtc_reg_t lactrtc;
|
||||
volatile timg_lactlo_reg_t lactlo;
|
||||
volatile timg_lacthi_reg_t lacthi;
|
||||
volatile timg_lactupdate_reg_t lactupdate;
|
||||
volatile timg_lactalarmlo_reg_t lactalarmlo;
|
||||
volatile timg_lactalarmhi_reg_t lactalarmhi;
|
||||
volatile timg_lactloadlo_reg_t lactloadlo;
|
||||
volatile timg_lactloadhi_reg_t lactloadhi;
|
||||
volatile timg_lactload_reg_t lactload;
|
||||
volatile timg_int_ena_timers_reg_t int_ena_timers;
|
||||
volatile timg_int_raw_timers_reg_t int_raw_timers;
|
||||
volatile timg_int_st_timers_reg_t int_st_timers;
|
||||
volatile timg_int_clr_timers_reg_t int_clr_timers;
|
||||
uint32_t reserved_0ac[20];
|
||||
volatile timg_timers_date_reg_t timers_date;
|
||||
volatile timg_regclk_reg_t regclk;
|
||||
} timg_dev_t;
|
||||
|
||||
extern timg_dev_t TIMERG0;
|
||||
extern timg_dev_t TIMERG1;
|
||||
|
||||
#ifndef __cplusplus
|
||||
_Static_assert(sizeof(timg_dev_t) == 0x100, "Invalid size of timg_dev_t structure");
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SOC_TIMG_STRUCT_H_ */
|
||||
|
Reference in New Issue
Block a user