36 #ifndef __MHAL_GPIOIF_H__
37 #define __MHAL_GPIOIF_H__
38 #include "mhal_osai.h"
133 #define GPIOIF_EINVAL 1
135 #define GPIOIF_EPTR 2
138 #define MAX_FIFO_ENTRY_CNT 16
141 #define MAX_CTRL_SETTING 6
144 #define MAX_MIN_PURSE_WIDTH 0x3fff
147 #define IRQ_GPIOIF_EVENT_C_R_LOW (0)
149 #define IRQ_GPIOIF_EVENT_C_R_HIGH (1)
151 #define IRQ_GPIOIF_RESET_DONE (2)
153 #define IRQ_GPIOIF_EVENT_C_OVERFLOW (8)
155 #define IRQ_GPIOIF_EVENT_C_UNDERFLOW (9)
159 #define IRQ_GPIOIF_W_CFIFO0_WHEN_FULL (12)
163 #define IRQ_GPIOIF_W_CFIFO1_WHEN_FULL (13)
167 #define IRQ_GPIOIF_W_GPIO_2_RESET_CFIFO0_WHEN_FULL (14)
171 #define IRQ_GPIOIF_W_GPIO_2_RESET_CFIFO1_WHEN_FULL (15)
173 #define IRQ_GPIOIF_CFIFO0_NOT_EMPTY (16)
175 #define IRQ_GPIOIF_CFIFO1_NOT_EMPTY (17)
177 #define IRQ_GPIOIF_R_CFIFO0_WHENEMPTY (24)
179 #define IRQ_GPIOIF_R_CFIFO1_WHENEMPTY (25)
181 #define IRQ_GPIOIF_ALL_ENABLE (1 << IRQ_GPIOIF_EVENT_C_R_LOW) |\
182 (1 << IRQ_GPIOIF_EVENT_C_R_HIGH) |\
183 (1 << IRQ_GPIOIF_RESET_DONE) |\
184 (1 << IRQ_GPIOIF_EVENT_C_OVERFLOW) |\
185 (1 << IRQ_GPIOIF_EVENT_C_UNDERFLOW) |\
186 (1 << IRQ_GPIOIF_W_CFIFO0_WHEN_FULL) |\
187 (1 << IRQ_GPIOIF_W_CFIFO1_WHEN_FULL) |\
188 (1 << IRQ_GPIOIF_W_GPIO_2_RESET_CFIFO0_WHEN_FULL) |\
189 (1 << IRQ_GPIOIF_W_GPIO_2_RESET_CFIFO1_WHEN_FULL) |\
190 (1 << IRQ_GPIOIF_CFIFO0_NOT_EMPTY) |\
191 (1 << IRQ_GPIOIF_CFIFO1_NOT_EMPTY) |\
192 (1 << IRQ_GPIOIF_R_CFIFO0_WHENEMPTY) |\
193 (1 << IRQ_GPIOIF_R_CFIFO1_WHENEMPTY)
729 unsigned int min_p,
unsigned int init_v);
Capture on bith rising or falling edge.
Definition: mhal_gpioif.h:333
GPIOIF maximum clock source <invalid>
Definition: mhal_gpioif.h:218
Back to reset value when the counter reaches low limit value.
Definition: mhal_gpioif.h:281
Capture on falling edge.
Definition: mhal_gpioif.h:331
u32 int_event_uf_count
GPIOIF interrupt event underflow count value.
Definition: mhal_gpioif.h:409
mhal_gpioif_source_clock clk
GPIOIF clock source.
Definition: mhal_gpioif.h:373
u32 edge_type_gpio_1
Define edge type of GPIO_1 capture(0~3)
Definition: mhal_gpioif.h:367
int mtk_mhal_gpioif_read_reset_val(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read reset value of GPIOIF Event Counter.
u32 high_limit
High limit value for GPIOIF Event Counter.
Definition: mhal_gpioif.h:363
Capture on rising edge.
Definition: mhal_gpioif.h:313
u32 cap_fifo1[MAX_FIFO_ENTRY_CNT]
GPIOIF store capture fifo1 value.
Definition: mhal_gpioif.h:429
GPIOIF Embedded XTAL KHz(26MHz) clock source.
Definition: mhal_gpioif.h:210
GPIOIF group2(gpio8~11)
Definition: mhal_gpioif.h:230
GPIOIF Both Event Counter Mode and Capture Counter Mode.
Definition: mhal_gpioif.h:264
Interrupt issued when the counter reaches low limit value.
Definition: mhal_gpioif.h:297
int mtk_mhal_gpioif_read_high_limit_val(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read high limit value of GPIOIF Event Counter.
GPIOIF Embedded 32KHz clock source.
Definition: mhal_gpioif.h:212
int irq[MHAL_GPIOIF_GROUP_MAX]
GPIOIF controller group0~group5 irq number.
Definition: mhal_gpioif.h:444
int mtk_mhal_gpioif_disable_capture_counter(struct mtk_gpioif_controller *ctlr)
This function is used to disable capture counter mode.
GPIOIF maximum saturare mode limit selection <invalid>
Definition: mhal_gpioif.h:285
Capture on bith rising or falling edge.
Definition: mhal_gpioif.h:317
GPIOIF maximum edge type <invalid>
Definition: mhal_gpioif.h:321
int mtk_mhal_gpioif_read_gpio_cap_fifo0_value(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read the GPIO capture fifo0 counter.
mhal_gpioif_group group
GPIOIF group.
Definition: mhal_gpioif.h:375
#define MAX_FIFO_ENTRY_CNT
This defines GPIOIF Capture Mode maximum available FIFO entry counter.
Definition: mhal_gpioif.h:138
Not interrupt.
Definition: mhal_gpioif.h:295
mhal_gpioif_gpio_0_edge_type gpio_0_edge_type
GPIOIF edge type of GPIO_0.
Definition: mhal_gpioif.h:387
int mtk_mhal_gpioif_counter_clock_setting(struct mtk_gpioif_controller *ctlr, int enable)
This function is used to enable/disable GPIOIF source clock.
u32 int_cap_f1_full_count
GPIOIF interrupt capture fifo1 count value.
Definition: mhal_gpioif.h:413
int mtk_mhal_gpioif_hardware_reset_by_gpio_2(struct mtk_gpioif_controller *ctlr, int active_reset)
This function uses GPIO_2 pin to reset GPIOIF event counter.
GPIOIF Direction mode.
Definition: mhal_gpioif.h:246
u32 low_limit
Low limit value for GPIOIF Event Counter.
Definition: mhal_gpioif.h:361
GPIOIF maximum edge type <invalid>
Definition: mhal_gpioif.h:337
struct mtk_gpioif_config * mconfig
GPIOIF configure property.
Definition: mhal_gpioif.h:446
int mtk_mhal_gpioif_select_clock_source(struct mtk_gpioif_controller *ctlr)
This function is used to select the GPIOIF clock source.
u32 int_bit
GPIOIF interrupt bit value.
Definition: mhal_gpioif.h:399
This structure defines the GPIOIF related parameters.
Definition: mhal_gpioif.h:351
u32 cap_fifo1_count
GPIOIF read capture fifo1 count value.
Definition: mhal_gpioif.h:433
u32 int_cap_f0_full_count
GPIOIF interrupt capture fifo0 count value.
Definition: mhal_gpioif.h:411
void __iomem * reg_clk_base
GPIOIF controller clk base address.
Definition: mhal_gpioif.h:442
GPIOIF maximum group <invalid>
Definition: mhal_gpioif.h:238
mhal_gpioif_group
This enum defines GPIOIF group selection.
Definition: mhal_gpioif.h:224
GPIOIF Capture Counter Mode.
Definition: mhal_gpioif.h:262
u32 int_reset_cap_f0_full_count
GPIOIF interrupt reset capture fifo0 count value.
Definition: mhal_gpioif.h:415
int mtk_mhal_gpioif_enable_capture_counter(struct mtk_gpioif_controller *ctlr)
This function is used to enable capture counter mode.
u32 int_cap_f1_np_count
GPIOIF interrupt capture fifo1 not empty count value.
Definition: mhal_gpioif.h:421
Saturare on high limit value.
Definition: mhal_gpioif.h:279
int mtk_mhal_gpioif_enable_event_counter(struct mtk_gpioif_controller *ctlr)
This function is used to enable event counter mode.
The common configuration can be set for the GPIOIF HW.
Definition: mhal_gpioif.h:371
GPIOIF Quadrature mode.
Definition: mhal_gpioif.h:250
u32 int_event_high_count
GPIOIF interrupt event high count value.
Definition: mhal_gpioif.h:403
u32 cap_fifo0[MAX_FIFO_ENTRY_CNT]
GPIOIF store capture fifo0 value.
Definition: mhal_gpioif.h:427
int mtk_mhal_gpioif_software_reset(struct mtk_gpioif_controller *ctlr)
This function is used to perform software reset of the GPIO event counter.
u32 int_reset_cap_f1_full_count
GPIOIF interrupt reset capture fifo1 count value.
Definition: mhal_gpioif.h:417
GPIOIF maximum supported Mode <invalid>
Definition: mhal_gpioif.h:266
u8 control_setting
Control edge type of GPIOIF Event Counter(1~6)
Definition: mhal_gpioif.h:353
Not saturare on limit value.
Definition: mhal_gpioif.h:275
GPIOIF group1(gpio4~7)
Definition: mhal_gpioif.h:228
mhal_gpioif_sa_mode_limit_select
This enum defines GPIOIF saturation mode selection of GPIO event counter when reaching limit value ...
Definition: mhal_gpioif.h:273
Capture on rising edge(reserved)
Definition: mhal_gpioif.h:335
int mtk_mhal_gpioif_capture_counter_setting(struct mtk_gpioif_controller *ctlr)
This function is used to set capture mode counter setting.
int mtk_mhal_gpioif_disable_event_counter(struct mtk_gpioif_controller *ctlr)
This function is used to disable event counter mode.
Capture on rising edge.
Definition: mhal_gpioif.h:329
mhal_gpioif_interrupt_limit_select
This enum defines GPIOIF interrupt mode selection of GPIO event counter.
Definition: mhal_gpioif.h:293
Interrupt issued when the counter reaches both low and high limit value.
Definition: mhal_gpioif.h:303
mhal_gpioif_event_counter_mode
This enum defines GPIOIF Event Counter Mode.
Definition: mhal_gpioif.h:244
GPIOIF maximum interrupt mode limit selection <invalid>
Definition: mhal_gpioif.h:305
mhal_gpioif_source_clock
This enum defines GPIOIF clock source selection.
Definition: mhal_gpioif.h:208
int mtk_mhal_gpioif_interrupt_bit_wise(struct mtk_gpioif_controller *ctlr, u32 bit, u8 enable)
This function is used to enable/disable bit-wise interrupt.
mhal_gpioif_gpio_0_edge_type
This enum defines the GPIOIF edge type of GPIO_0 capture.
Definition: mhal_gpioif.h:311
u32 int_cap_f0_p_count
GPIOIF interrupt capture fifo0 empty count value.
Definition: mhal_gpioif.h:423
This structure defines the GPIOIF related property.
Definition: mhal_gpioif.h:438
Back to reset value when the counter reaches high limit value.
Definition: mhal_gpioif.h:283
GPIOIF Event Counter Mode.
Definition: mhal_gpioif.h:260
mhal_gpioif_mode
This enum defines GPIOIF counter mode which can support.
Definition: mhal_gpioif.h:258
int mtk_mhal_gpioif_read_gpio_event_count(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read the GPIO event counter value.
This structure defines the GPIOIF interrupt count related parameters.
Definition: mhal_gpioif.h:397
int mtk_mhal_gpioif_limit_comparator(struct mtk_gpioif_controller *ctlr)
This function is used to set interrupt mode or saturation mode of the GPIO event counter.
u32 reset_value
Reset value for GPIOIF Event Counter.
Definition: mhal_gpioif.h:359
mhal_gpioif_interrupt_limit_select inter_lim
GPIOIF interrupt mode selection of GPIO event counter.
Definition: mhal_gpioif.h:385
int mtk_mhal_gpioif_read_gpio_cap_fifo1_value(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read the GPIO capture fifo1 counter.
GPIOIF group0(gpio0~3)
Definition: mhal_gpioif.h:226
Saturare on low limit value.
Definition: mhal_gpioif.h:277
mhal_gpioif_sa_mode_limit_select sa_mode_lim
GPIOIF saturation mode selection of GPIO event counter when reaching limit value. ...
Definition: mhal_gpioif.h:383
GPIOIF maximum Event Counter Mode <invalid>
Definition: mhal_gpioif.h:252
u32 int_event_low_count
GPIOIF interrupt event low count value.
Definition: mhal_gpioif.h:401
u32 edge_type_gpio_0
Define edge type of GPIO_0 capture(0~3)
Definition: mhal_gpioif.h:365
u8 updown
Definition of increment/decremnet GPIO pin for GPIOIF Event Counter in quadrature mode...
Definition: mhal_gpioif.h:357
int mtk_mhal_gpioif_de_glitch(struct mtk_gpioif_controller *ctlr, int gpio, int enable, unsigned int min_p, unsigned int init_v)
This function is used to set GPIOIF de-glitch setting.
mhal_gpioif_event_capture_setting * setting
GPIOIF event and capture setting.
Definition: mhal_gpioif.h:391
int mtk_mhal_gpioif_event_counter_setting(struct mtk_gpioif_controller *ctlr)
This function is used to set event counter mode setting.
GPIOIF group5(gpio20~23)
Definition: mhal_gpioif.h:236
mhal_gpioif_event_counter_mode event_cnt_mode
GPIOIF Event Counter Mode.
Definition: mhal_gpioif.h:377
mhal_gpioif_gpio_1_edge_type
This enum defines the GPIOIF edge type of GPIO_1 capture.
Definition: mhal_gpioif.h:327
GPIOIF group4(gpio16~19)
Definition: mhal_gpioif.h:234
GPIOIF 200MHz clock source.
Definition: mhal_gpioif.h:216
mhal_gpioif_gpio_1_edge_type gpio_1_edge_type
GPIOIF edge type of GPIO_1.
Definition: mhal_gpioif.h:389
u32 int_cap_f1_p_count
GPIOIF interrupt capture fifo1 empty count value.
Definition: mhal_gpioif.h:425
u32 int_gpio2_rst_done_count
GPIOIF gpio2 interrupt reset done count value.
Definition: mhal_gpioif.h:405
GPIOIF Up Down mode.
Definition: mhal_gpioif.h:248
u32 int_event_over_count
GPIOIF interrupt event overflow count value.
Definition: mhal_gpioif.h:407
int mtk_mhal_gpioif_isr_handle(struct mtk_gpioif_controller *ctlr)
This function is used to handle GPIOIF group0~5 interrupt.
Interrupt issued when the counter reaches high limit value.
Definition: mhal_gpioif.h:299
u32 cap_fifo0_count
GPIOIF read capture fifo0 count value.
Definition: mhal_gpioif.h:431
GPIOIF group3(gpio12~15)
Definition: mhal_gpioif.h:232
GPIOIF AXI1 MHz(125MHz) clock source.
Definition: mhal_gpioif.h:214
int mtk_mhal_gpioif_read_low_limit_val(struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
This function is used to read low limit value of GPIOIF Event Counter.
int mtk_mhal_gpioif_global_reset(struct mtk_gpioif_controller *ctlr)
This function is used to reset all GPIOIF group globally and make the register of the GPIOIF group to...
void __iomem * base[MHAL_GPIOIF_GROUP_MAX]
GPIOIF controller base address.
Definition: mhal_gpioif.h:440
Capture on rising edge(reserved)
Definition: mhal_gpioif.h:319
u32 int_cap_f0_np_count
GPIOIF interrupt capture fifo0 not empty count value.
Definition: mhal_gpioif.h:419
Capture on falling edge.
Definition: mhal_gpioif.h:315
mhal_gpioif_mode mode
GPIOIF mode.
Definition: mhal_gpioif.h:379