matlab_23550/Inu/Src/N12_Xilinx/xp_cds_tk_21300.h

461 lines
10 KiB
C
Raw Normal View History

#ifndef XP_CDS_TK_21300_H
#define XP_CDS_TK_21300_H
#include <project_setup.h>
#include "x_basic_types.h"
#include "xp_cds_status_bus.h"
#include "xp_id_plate_info.h"
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
//// 21300
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
#define T_CDS_TK_COUNT_ADR_PBUS_21300 0 // count max elements in parallel bus
#define T_CDS_TK_SETUP_USE_ADR_PBUS_21300 0x0 // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> PBUS, 0xffff - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*-----------------------------------------------------------------------------
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_21300;
#define T_CDS_TK_WRITE_SBUS_DEFAULTS_21300 {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_tk1;
//12
UInt16 time_err_tk2_tk3;
//13
UInt16 time_err_tk4_tk5;
//14
UInt16 time_err_tk6_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_21300;
#define T_CDS_TK_READ_SBUS_DEFAULTS_21300 {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_21300;
#define T_CDS_TK_SETUP_PBUS_DEFAULTS_21300 {T_CDS_TK_COUNT_ADR_PBUS_21300,T_CDS_TK_SETUP_USE_ADR_PBUS_21300}
//////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
typedef struct{
T_cds_tk_write_sbus_21300 sbus;
} T_cds_tk_write_21300;
typedef struct{
T_cds_tk_read_sbus_21300 sbus;
Int16 type_cds_xilinx;
} T_cds_tk_read_21300;
//////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
typedef struct {
UInt16 plane_address; // 0 to 15
UInt16 useit;
Int16 type_cds_xilinx;
T_cds_tk_setup_pbus_21300 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_21300 write;
T_cds_tk_read_21300 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_21300;
#define T_cds_tk_DEFAULTS_21300 { 0,\
0,\
TYPE_CDS_XILINX_DEFAULTS,\
T_CDS_TK_SETUP_PBUS_DEFAULTS_21300, \
T_cds_status_serial_bus_DEFAULT,\
T_cds_status_parallel_bus_DEFAULT,\
component_NotReady,\
local_status_NotReady,\
{T_CDS_TK_WRITE_SBUS_DEFAULTS_21300},\
{T_CDS_TK_READ_SBUS_DEFAULTS_21300,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_21300, \
(int (*)(Uint32))cds_tk_write_sbus_21300, \
(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_21300 *T_cds_tk_handle_21300;
#endif // XP_CDS_TK_21300_H