#ifndef XP_CDS_OUT_H #define XP_CDS_OUT_H #include "x_basic_types.h" #include "xp_cds_status_bus.h" #include "xp_id_plate_info.h" /*----------------------------------------------------------------------------- Define the types -----------------------------------------------------------------------------*/ ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // write serial bus reg ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// typedef struct { //0 union { UInt16 all; struct{ UInt16 dout0 : 1; UInt16 dout1 : 1; UInt16 dout2 : 1; UInt16 dout3 : 1; UInt16 dout4 : 1; UInt16 dout5 : 1; UInt16 dout6 : 1; UInt16 dout7 : 1; UInt16 dout8 : 1; UInt16 dout9 : 1; UInt16 dout10 : 1; UInt16 dout11 : 1; UInt16 dout12 : 1; UInt16 dout13 : 1; UInt16 dout14 : 1; UInt16 dout15 : 1; }bit; } data_out; //1 union { UInt16 all; struct{ UInt16 dout0 : 1; UInt16 dout1 : 1; UInt16 dout2 : 1; UInt16 dout3 : 1; UInt16 dout4 : 1; UInt16 dout5 : 1; UInt16 dout6 : 1; UInt16 dout7 : 1; UInt16 dout8 : 1; UInt16 dout9 : 1; UInt16 dout10 : 1; UInt16 dout11 : 1; UInt16 dout12 : 1; UInt16 dout13 : 1; UInt16 dout14 : 1; UInt16 dout15 : 1; }bit; } enable_protect_out; //6 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; } T_cds_out_write_sbus; #define T_CDS_OUT_WRITE_SBUS_DEFAULTS {0xffff,0xffff,0xf000,0} ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // read reg serial bus ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// typedef struct { //0 union { UInt16 all; struct{ UInt16 dout0 : 1; UInt16 dout1 : 1; UInt16 dout2 : 1; UInt16 dout3 : 1; UInt16 dout4 : 1; UInt16 dout5 : 1; UInt16 dout6 : 1; UInt16 dout7 : 1; UInt16 dout8 : 1; UInt16 dout9 : 1; UInt16 dout10 : 1; UInt16 dout11 : 1; UInt16 dout12 : 1; UInt16 dout13 : 1; UInt16 dout14 : 1; UInt16 dout15 : 1; }bit; } data_out; //1 union { UInt16 all; struct{ UInt16 dout0 : 1; UInt16 dout1 : 1; UInt16 dout2 : 1; UInt16 dout3 : 1; UInt16 dout4 : 1; UInt16 dout5 : 1; UInt16 dout6 : 1; UInt16 dout7 : 1; UInt16 dout8 : 1; UInt16 dout9 : 1; UInt16 dout10 : 1; UInt16 dout11 : 1; UInt16 dout12 : 1; UInt16 dout13 : 1; UInt16 dout14 : 1; UInt16 dout15 : 1; }bit; } enable_protect_out; //6 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 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; //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_out_read_sbus; #define T_CDS_OUT_READ_SBUS_DEFAULTS {0,0,0,0,0} ///////////////////////////////////////////////////////////////// typedef struct{ T_cds_out_write_sbus sbus; } T_cds_out_write; typedef struct{ T_cds_out_read_sbus sbus; Int16 type_cds_xilinx; } T_cds_out_read; ////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // main struct ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// typedef struct TS_cds_out{ UInt16 plane_address; // 0 to 15 UInt16 useit; Int16 type_cds_xilinx; 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_out_write write; T_cds_out_read 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_out; typedef T_cds_out *T_cds_out_handle; /*----------------------------------------------------------------------------- Default initalizer for object. -----------------------------------------------------------------------------*/ #define T_cds_out_DEFAULTS { 0,\ 0,\ TYPE_CDS_XILINX_DEFAULTS,\ T_cds_status_serial_bus_DEFAULT,\ T_cds_status_parallel_bus_DEFAULT,\ component_NotReady,\ local_status_NotReady,\ {T_CDS_OUT_WRITE_SBUS_DEFAULTS},\ {T_CDS_OUT_READ_SBUS_DEFAULTS,TYPE_CDS_XILINX_DEFAULTS},\ 0,\ (void (*)(Uint32))cds_out_init, \ (int (*)(Uint32))cds_out_read_all, \ (int (*)(Uint32))cds_out_write_all, \ (int (*)(Uint32))cds_out_read_sbus, \ (int (*)(Uint32))cds_out_write_sbus, \ (int (*)(Uint32))cds_out_read_pbus, \ (int (*)(Uint32))cds_out_write_pbus, \ (void (*)(Uint32))cds_out_reset_error, \ (void (*)(Uint32))cds_out_store_disable_error, \ (void (*)(Uint32))cds_out_restore_enable_error \ } ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// void cds_out_init(T_cds_out_handle); int cds_out_read_all(T_cds_out_handle); int cds_out_write_all(T_cds_out_handle); int cds_out_read_sbus(T_cds_out_handle); int cds_out_write_sbus(T_cds_out_handle); int cds_out_read_pbus(T_cds_out_handle); int cds_out_write_pbus(T_cds_out_handle); void cds_out_reset_error(T_cds_out_handle); void cds_out_store_disable_error(T_cds_out_handle); void cds_out_restore_enable_error(T_cds_out_handle); #endif