#ifndef __INTER_MSG_REG_H__
#define __INTER_MSG_REG_H__


#define FUN_IRQ_MAX_NUM    512
#define IRQ_MAX_NUM        32
#define IRQ_SYS_MASK_NUM   16

typedef unsigned int uint32_t;
typedef unsigned int UINT32;
typedef void (*irq_handler)();


extern int cur_apeid;
extern int apcid_buf[12];

typedef struct{
    int reg_vec_count;
    int reg_vec_buf[32];
    int irq_count[32];
    irq_handler pfun[32];

}vec_desc;

typedef struct {

    uint32_t reg_irq_cnt;              //0x00
    uint32_t reg_irq_val[IRQ_MAX_NUM]; //0x04-0x80

    uint32_t reg_irq_cpu_id; //0x84

    uint32_t irq_cnt; //0x88

    uint32_t fun_start_cnt_all; //0x8c
    uint32_t fun_end_cnt_all; //0x90
    uint32_t cur_irq_num;   //0x94
    uint32_t fun_run_cnt[FUN_IRQ_MAX_NUM]; //0x94-0x890

    //uint32_t last_irq_num; //0x8a4

    uint32_t irq_sys_mask[IRQ_SYS_MASK_NUM]; //0x8a8 -0x8e4
    uint32_t irq_sys_status[IRQ_SYS_MASK_NUM]; //0x8e8 -0x924
    uint32_t apc_csu_allpendevent0; //0x928
    uint32_t apc_csu_intmaskl; //0x92c
    uint32_t event_mask_l;

}irq_debug_t;


extern int smart_irq_request(uint32_t vector,irq_handler func);
extern int get_apcid();
extern void enable_interrupt();

void __ucps2_interrupt5();
extern int get_cur_cpuid();


#define do_write(a,v)	__ucps2_store_ext_mem((void *)(a), (uint32_t)v, f_W)
#define do_read(ptr)    __ucps2_load_ext_mem_v((char*)(ptr), f_W)





#endif
