11bd4fe43Sopenharmony_ci/*
21bd4fe43Sopenharmony_ci * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * This program is free software; you can redistribute it and/or
51bd4fe43Sopenharmony_ci * modify it under the terms of the GNU General Public License
61bd4fe43Sopenharmony_ci * as published by the Free Software Foundation; either version 2
71bd4fe43Sopenharmony_ci * of the License, or (at your option) any later version.
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci * This program is distributed in the hope that it will be useful,
101bd4fe43Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
111bd4fe43Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
121bd4fe43Sopenharmony_ci * GNU General Public License for more details.
131bd4fe43Sopenharmony_ci *
141bd4fe43Sopenharmony_ci * You should have received a copy of the GNU General Public License
151bd4fe43Sopenharmony_ci * along with this program; if not, write to the Free Software
161bd4fe43Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
171bd4fe43Sopenharmony_ci */
181bd4fe43Sopenharmony_ci#ifndef __HI_COMM_IRQ_H__
191bd4fe43Sopenharmony_ci#define __HI_COMM_IRQ_H__
201bd4fe43Sopenharmony_ci#include "hi_defines.h"
211bd4fe43Sopenharmony_ci
221bd4fe43Sopenharmony_ci/* For IRQ */
231bd4fe43Sopenharmony_ci#define HI_MAX_STATE_NUM       1
241bd4fe43Sopenharmony_ci
251bd4fe43Sopenharmony_citypedef enum {
261bd4fe43Sopenharmony_ci    HI_INT_NORMAL = 0,
271bd4fe43Sopenharmony_ci    HI_INT_VICAP  = 1,
281bd4fe43Sopenharmony_ci    HI_INT_SCD    = 2,
291bd4fe43Sopenharmony_ci    HI_INT_VDH    = 3,
301bd4fe43Sopenharmony_ci    HI_INT_NNIE   = 4,
311bd4fe43Sopenharmony_ci    HI_INT_AIO    = 5,
321bd4fe43Sopenharmony_ci    HI_INT_BUTT,
331bd4fe43Sopenharmony_ci} hi_int_type;
341bd4fe43Sopenharmony_ci
351bd4fe43Sopenharmony_citypedef struct {
361bd4fe43Sopenharmony_ci    volatile hi_u32 state_num;                    /* Number of interrupt states */
371bd4fe43Sopenharmony_ci    volatile hi_u32 raw_state[HI_MAX_STATE_NUM];  /* raw interrupt states */
381bd4fe43Sopenharmony_ci    volatile hi_u32 mask_state[HI_MAX_STATE_NUM]; /* interrupt states after mask */
391bd4fe43Sopenharmony_ci} hi_normal_int_state;
401bd4fe43Sopenharmony_ci
411bd4fe43Sopenharmony_citypedef struct {
421bd4fe43Sopenharmony_ci    volatile unsigned int cap_state;
431bd4fe43Sopenharmony_ci    volatile unsigned int pt_state[VI_MAX_DEV_NUM];
441bd4fe43Sopenharmony_ci    volatile unsigned int ch_state[VI_MAX_PHY_PIPE_NUM];
451bd4fe43Sopenharmony_ci    volatile unsigned int isp_fe_state[VI_MAX_ISP_FE_NUM];
461bd4fe43Sopenharmony_ci} hi_vicap_int_state;
471bd4fe43Sopenharmony_ci
481bd4fe43Sopenharmony_citypedef struct {
491bd4fe43Sopenharmony_ci    unsigned int aio_int_status_state;
501bd4fe43Sopenharmony_ci    unsigned int aio_int_raw_state;
511bd4fe43Sopenharmony_ci    unsigned int tx_raw_state[AO_DEV_MAX_NUM];
521bd4fe43Sopenharmony_ci    unsigned int tx_stat_state[AO_DEV_MAX_NUM];
531bd4fe43Sopenharmony_ci    unsigned int rx_raw_state[AI_DEV_MAX_NUM];
541bd4fe43Sopenharmony_ci    unsigned int rx_stat_state[AI_DEV_MAX_NUM];
551bd4fe43Sopenharmony_ci} hi_aio_int_state;
561bd4fe43Sopenharmony_ci
571bd4fe43Sopenharmony_citypedef struct {
581bd4fe43Sopenharmony_ci    hi_int_type type;
591bd4fe43Sopenharmony_ci    union {
601bd4fe43Sopenharmony_ci        hi_normal_int_state normal;
611bd4fe43Sopenharmony_ci        hi_vicap_int_state  vicap;
621bd4fe43Sopenharmony_ci        hi_aio_int_state    aio;
631bd4fe43Sopenharmony_ci    };
641bd4fe43Sopenharmony_ci} hi_int_state_info;
651bd4fe43Sopenharmony_ci
661bd4fe43Sopenharmony_citypedef struct {
671bd4fe43Sopenharmony_ci    hi_void *dev;
681bd4fe43Sopenharmony_ci    hi_int_state_info int_info;
691bd4fe43Sopenharmony_ci} hi_irq_arg;
701bd4fe43Sopenharmony_ci
711bd4fe43Sopenharmony_ci
721bd4fe43Sopenharmony_citypedef struct {
731bd4fe43Sopenharmony_ci    unsigned int cap_reg;
741bd4fe43Sopenharmony_ci    unsigned int pt_reg[VI_MAX_DEV_NUM];
751bd4fe43Sopenharmony_ci    unsigned int ch_reg[VI_MAX_PHY_PIPE_NUM];
761bd4fe43Sopenharmony_ci    unsigned int isp_fe_reg[VI_MAX_ISP_FE_NUM];
771bd4fe43Sopenharmony_ci} hi_vicap_int_reg;
781bd4fe43Sopenharmony_ci
791bd4fe43Sopenharmony_citypedef struct {
801bd4fe43Sopenharmony_ci    unsigned int aio_int_status_reg;
811bd4fe43Sopenharmony_ci    unsigned int aio_int_raw_reg;
821bd4fe43Sopenharmony_ci    unsigned int tx_clr_reg[AO_DEV_MAX_NUM];
831bd4fe43Sopenharmony_ci    unsigned int tx_raw_reg[AO_DEV_MAX_NUM];
841bd4fe43Sopenharmony_ci    unsigned int tx_stat_reg[AO_DEV_MAX_NUM];
851bd4fe43Sopenharmony_ci    unsigned int rx_clr_reg[AI_DEV_MAX_NUM];
861bd4fe43Sopenharmony_ci    unsigned int rx_raw_reg[AI_DEV_MAX_NUM];
871bd4fe43Sopenharmony_ci    unsigned int rx_stat_reg[AI_DEV_MAX_NUM];
881bd4fe43Sopenharmony_ci} hi_aio_int_reg;
891bd4fe43Sopenharmony_ci
901bd4fe43Sopenharmony_ci
911bd4fe43Sopenharmony_citypedef struct {
921bd4fe43Sopenharmony_ci    unsigned int reg_num;
931bd4fe43Sopenharmony_ci    unsigned int raw_int_reg[HI_MAX_STATE_NUM];   /* raw int state */
941bd4fe43Sopenharmony_ci    unsigned int mask_int_reg[HI_MAX_STATE_NUM];  /* int state after mask */
951bd4fe43Sopenharmony_ci    unsigned int clr_int_reg[HI_MAX_STATE_NUM];
961bd4fe43Sopenharmony_ci} hi_normal_int_reg;
971bd4fe43Sopenharmony_ci
981bd4fe43Sopenharmony_citypedef struct {
991bd4fe43Sopenharmony_ci    hi_int_type type;
1001bd4fe43Sopenharmony_ci    union {
1011bd4fe43Sopenharmony_ci        hi_normal_int_reg normal;
1021bd4fe43Sopenharmony_ci        hi_vicap_int_reg  vicap;
1031bd4fe43Sopenharmony_ci        hi_aio_int_reg    aio;
1041bd4fe43Sopenharmony_ci    };
1051bd4fe43Sopenharmony_ci} hi_int_reg_info;
1061bd4fe43Sopenharmony_ci
1071bd4fe43Sopenharmony_ci#endif /* end of #ifndef __HI_COMM_IRQ_H__ */
1081bd4fe43Sopenharmony_ci
109