#ifndef XP_CDS_TK_21180_H #define XP_CDS_TK_21180_H #include #include "x_basic_types.h" #include "xp_cds_status_bus.h" #include "xp_id_plate_info.h" ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //// 21180 ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// #define T_CDS_TK_COUNT_ADR_PBUS_21180 0 // count max elements in parallel bus #define T_CDS_TK_SETUP_USE_ADR_PBUS_21180 0x0 // ïî óìîë÷àíèþ - íàñòðîéêà êàêèå ðåãèñòðû èñïîëüçîâàòü äëß PBUS, 0xffff - âñå âîçìîæíûå /*----------------------------------------------------------------------------- Define the types -----------------------------------------------------------------------------*/ ///////////////////////////////////////////////////////////// // write serial bus reg ///////////////////////////////////////////////////////////// typedef struct { //0 union { UInt16 all; struct { UInt16 tk0 :1; UInt16 tk1 :1; UInt16 tk2 :1; UInt16 tk3 :1; UInt16 tk4 :1; UInt16 tk5 :1; UInt16 tk6 :1; UInt16 tk7 :1; UInt16 reserv :8; } bit; } mask_tk_out_40pin; //1 union { UInt16 all; struct { UInt16 value :15; // N=(mintime * fclk) fclk=50000kHz UInt16 enable :1; } bit; } deadtime; //2 union { UInt16 all; struct { UInt16 time0 :8; UInt16 delay :8; } bit; } ack_time; //3 union { UInt16 all; struct { UInt16 tk0_ack :1; UInt16 tk1_ack :1; UInt16 tk2_ack :1; UInt16 tk3_ack :1; UInt16 tk4_ack :1; UInt16 tk5_ack :1; UInt16 tk6_ack :1; UInt16 tk7_ack :1; UInt16 tk0_current :1; UInt16 tk1_current :1; UInt16 tk2_current :1; UInt16 tk3_current :1; UInt16 tk4_current :1; UInt16 tk5_current :1; UInt16 tk6_current :1; UInt16 tk7_current :1; } bit; } mask_protect_tk; //4 union { UInt16 all; struct { UInt16 reserv :12; UInt16 disable_err_hwp :1; UInt16 disable_err0_in :1; UInt16 enable_err_switch :1; UInt16 enable_err_power :1; } bit; } protect_error; //7 UInt16 cmd_reset_error; //9 union { UInt16 all; struct { UInt16 value :15; // N=(mintime * fclk) - 2 fclk=50000kHz UInt16 enable :1; } bit; } mintime; // } T_cds_tk_write_sbus_21180; #define T_CDS_TK_WRITE_SBUS_DEFAULTS_21180 {0x0000,0x5f5f,0x0909,0x0000,0x0000,0x0000, 0x0105}//{0,0,0,0,0,0,0} ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // read reg serial bus ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// typedef struct { //0 union { UInt16 all; struct { UInt16 tk0 :1; UInt16 tk1 :1; UInt16 tk2 :1; UInt16 tk3 :1; UInt16 tk4 :1; UInt16 tk5 :1; UInt16 tk6 :1; UInt16 tk7 :1; UInt16 reserv :8; } bit; } mask_tk_out_40pin; //1 union { UInt16 all; struct { UInt16 value :15; // N=(mintime * fclk) fclk=50000kHz UInt16 reserv :1; } bit; } deadtime; //2 union { UInt16 all; struct { UInt16 time0 :8; UInt16 delay :8; } bit; } ack_time; //3 union { UInt16 all; struct { UInt16 tk0_ack :1; UInt16 tk1_ack :1; UInt16 tk2_ack :1; UInt16 tk3_ack :1; UInt16 tk4_ack :1; UInt16 tk5_ack :1; UInt16 tk6_ack :1; UInt16 tk7_ack :1; UInt16 tk0_current :1; UInt16 tk1_current :1; UInt16 tk2_current :1; UInt16 tk3_current :1; UInt16 tk4_current :1; UInt16 tk5_current :1; UInt16 tk6_current :1; UInt16 tk7_current :1; } bit; } mask_protect_tk; //4 union { UInt16 all; struct { UInt16 reserv :12; UInt16 disable_err_hwp :1; UInt16 disable_err0_in :1; UInt16 enable_err_switch :1; UInt16 enable_err_power :1; } bit; } protect_error; //5 union { UInt16 all; struct { UInt16 tk0_ack :1; UInt16 tk1_ack :1; UInt16 tk2_ack :1; UInt16 tk3_ack :1; UInt16 tk4_ack :1; UInt16 tk5_ack :1; UInt16 tk6_ack :1; UInt16 tk7_ack :1; UInt16 tk0 :1; UInt16 tk1 :1; UInt16 tk2 :1; UInt16 tk3 :1; UInt16 tk4 :1; UInt16 tk5 :1; UInt16 tk6 :1; UInt16 tk7 :1; } bit; } status_tk_40pin; //6 union { UInt16 all; struct { UInt16 tk0_a4 :1; UInt16 tk1_b4 :1; UInt16 tk2_c4 :1; UInt16 tk3_a5 :1; UInt16 tk4_b5 :1; UInt16 tk5_c5 :1; UInt16 tk6_a6 :1; UInt16 tk7_b6 :1; UInt16 tk8_c6 :1; UInt16 tk9_a7 :1; UInt16 tk10_b7 :1; UInt16 tk11_c7 :1; UInt16 tk12_a8 :1; UInt16 tk13_b8 :1; UInt16 tk14_a9 :1; UInt16 tk15_b9 :1; } bit; } status_tk_96pin; //7 union { UInt16 all; struct { UInt16 reserv :11; UInt16 err0_local :1; UInt16 err_hwp :1; UInt16 err0_in :1; UInt16 err_switch :1; UInt16 err_power :1; } bit; } lock_status_error; //8 union { UInt16 all; struct { UInt16 tk0_ack :1; UInt16 tk1_ack :1; UInt16 tk2_ack :1; UInt16 tk3_ack :1; UInt16 tk4_ack :1; UInt16 tk5_ack :1; UInt16 tk6_ack :1; UInt16 tk7_ack :1; UInt16 tk0_current :1; UInt16 tk1_current :1; UInt16 tk2_current :1; UInt16 tk3_current :1; UInt16 tk4_current :1; UInt16 tk5_current :1; UInt16 tk6_current :1; UInt16 tk7_current :1; } bit; } status_protect_current_ack; //9 union { UInt16 all; struct { UInt16 value :15; // N=(mintime * fclk) + 2 fclk=50000kHz UInt16 enable :1; } bit; } mintime; //10 union { UInt16 all; struct { UInt16 tk0_deadtime :1; UInt16 tk1_deadtime :1; UInt16 tk2_deadtime :1; UInt16 tk3_deadtime :1; UInt16 tk4_deadtime :1; UInt16 tk5_deadtime :1; UInt16 tk6_deadtime :1; UInt16 tk7_deadtime :1; UInt16 tk0_mintime :1; UInt16 tk1_mintime :1; UInt16 tk2_mintime :1; UInt16 tk3_mintime :1; UInt16 tk4_mintime :1; UInt16 tk5_mintime :1; UInt16 tk6_mintime :1; UInt16 tk7_mintime :1; } bit; } status_protect_deadtime_mintime; //11 UInt16 time_err_tk0_tk2; //12 UInt16 time_err_tk1_tk3; //13 UInt16 time_err_tk4_tk6; //14 UInt16 time_err_tk5_tk7; //15 union { UInt16 all; struct { UInt16 reserv :11; UInt16 err0_local :1; UInt16 err_hwp :1; UInt16 err0_in :1; UInt16 err_switch :1; UInt16 err_power :1; } bit; } current_status_error; } T_cds_tk_read_sbus_21180; #define T_CDS_TK_READ_SBUS_DEFAULTS_21180 {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0} ////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //setup parallel bus ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// typedef struct { UInt16 count_elements_pbus; // use_or_not? union { UInt16 all; struct{ UInt16 res : 16; }bit; } use_reg_in_pbus; } T_cds_tk_setup_pbus_21180; #define T_CDS_TK_SETUP_PBUS_DEFAULTS_21180 {T_CDS_TK_COUNT_ADR_PBUS_21180,T_CDS_TK_SETUP_USE_ADR_PBUS_21180} ////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// typedef struct{ T_cds_tk_write_sbus_21180 sbus; } T_cds_tk_write_21180; typedef struct{ T_cds_tk_read_sbus_21180 sbus; Int16 type_cds_xilinx; } T_cds_tk_read_21180; ////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// typedef struct { UInt16 plane_address; // 0 to 15 UInt16 useit; Int16 type_cds_xilinx; T_cds_tk_setup_pbus_21180 setup_pbus; T_cds_status_serial_bus status_serial_bus; T_cds_status_parallel_bus status_parallel_bus; T_component_status status; T_local_status local_status; T_cds_tk_write_21180 write; T_cds_tk_read_21180 read; UInt16 store_protect_error; void (*init)(); // Pointer to calculation function int (*read_all)(); // Pointer to calculation function int (*write_all)(); // Pointer to calculation function int (*read_sbus)(); // Pointer to calculation function int (*write_sbus)(); // Pointer to calculation function int (*read_pbus)(); // Pointer to calculation function int (*write_pbus)(); // Pointer to calculation function void (*reset_error)(); // Pointer to calculation function void (*store_disable_error)(); // Pointer to calculation function void (*restore_enable_error)(); // Pointer to calculation function } T_cds_tk_21180; #define T_cds_tk_DEFAULTS_21180 { 0,\ 0,\ TYPE_CDS_XILINX_DEFAULTS,\ T_CDS_TK_SETUP_PBUS_DEFAULTS_21180, \ T_cds_status_serial_bus_DEFAULT,\ T_cds_status_parallel_bus_DEFAULT,\ component_NotReady,\ local_status_NotReady,\ {T_CDS_TK_WRITE_SBUS_DEFAULTS_21180},\ {T_CDS_TK_READ_SBUS_DEFAULTS_21180,TYPE_CDS_XILINX_DEFAULTS},\ 0, \ (void (*)(Uint32))cds_tk_init, \ (int (*)(Uint32))cds_tk_read_all, \ (int (*)(Uint32))cds_tk_write_all, \ (int (*)(Uint32))cds_tk_read_sbus_21180, \ (int (*)(Uint32))cds_tk_write_sbus_21180, \ (int (*)(Uint32))cds_tk_read_pbus, \ (int (*)(Uint32))cds_tk_write_pbus, \ (void (*)(Uint32))cds_tk_reset_error, \ (void (*)(Uint32))cds_tk_store_disable_error, \ (void (*)(Uint32))cds_tk_restore_enable_error \ } typedef T_cds_tk_21180 *T_cds_tk_handle_21180; #endif // XP_CDS_TK_21180_H