Razvalyaev
7e0063eee0
Все основные файлы подтянуты без изменений Изменены (только папка main_matlab): - заглушки для ненужных функций (main_matlab.c) - iq библиотека (IQmathLib_matlab.c) - библиотеки DSP281x
111 lines
2.9 KiB
C
111 lines
2.9 KiB
C
#ifndef _X_OPTLINK_TMS2TMS_H
|
|
#define _X_OPTLINK_TMS2TMS_H
|
|
|
|
#define MAX_WAIT_ERROR_X_OPTLINK_TMS2TMS 1 // ìàêñ. êîë-âî îæèäàíèß ÷òåíèß ñ øèíû
|
|
|
|
|
|
typedef union {
|
|
unsigned int all;
|
|
struct {
|
|
unsigned int id:8;
|
|
unsigned int count_receiver_error:4;
|
|
unsigned int trans_busy:1; // ïðèåìíèê íà âíåøíåé ïëàòå ÒÊ
|
|
unsigned int trans_error:1; // ïðèåìíèê íà âíåøíåé ïëàòå ÒÊ
|
|
unsigned int receiver_busy :1; // ïðèåìíèê íà òåêóùåé ïëàòå ÒÊ
|
|
unsigned int receiver_error:1; // ïðèåìíèê íà òåêóùåé ïëàòå ÒÊ
|
|
} bit;
|
|
} X_OPTLINK_TMS2TMS_status;
|
|
|
|
|
|
|
|
|
|
typedef union {
|
|
unsigned int all;
|
|
struct {
|
|
unsigned int started:1;
|
|
unsigned int error:1;
|
|
unsigned int cmd_start:1;
|
|
unsigned int count_error:4;
|
|
unsigned int slave_addr_error:4;
|
|
unsigned int init:1;
|
|
unsigned int was_started:1;
|
|
unsigned int rezerv:3;
|
|
|
|
} bit;
|
|
} X_OPTLINK_TMS2TMS_flags;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
unsigned int setup_error_count_read; // íàñòðîéêà ìàêñ êîë-âà ïîïûòîê ÷òåíèé ñ øèíû äî âîçíèêíîâåíèß îøèáêè
|
|
} X_OPTLINK_TMS2TMS_Setup;
|
|
|
|
|
|
|
|
typedef struct { X_OPTLINK_TMS2TMS_flags flags; // ôëàãè
|
|
X_OPTLINK_TMS2TMS_Setup setup; // íàñòðîéêà
|
|
|
|
X_OPTLINK_TMS2TMS_status status1; // ñòàòóñ1
|
|
X_OPTLINK_TMS2TMS_status status2; // ñòàòóñ2
|
|
|
|
unsigned int data_receiver[4]; // äàííûå ïðèíßòûå - 0..3
|
|
unsigned int data_send[4]; // äàííûå äëß ïåðåäà÷è - 0..3
|
|
|
|
unsigned int error_count_send; // îáùåå êîëè÷-âî îøèáîê ïåðåäà÷è
|
|
unsigned int error_count_receiver; // îáùåå êîëè÷-âî îøèáîê ïåðåäà÷è
|
|
unsigned int count_receiver; // îáùåå êîëè÷-âî ÷òåíèß
|
|
unsigned int count_send; // îáùåå êîëè÷-âî ïåðåäà÷è
|
|
|
|
// unsigned int error_count_write; // îáùåå êîëè÷-âî îøèáîê çàïèñè
|
|
// unsigned int error_count_hold; // îáùåå êîëè÷-âî îøèáîê çàõâàòà øèíû
|
|
|
|
void (*init)(); // Pointer to init function
|
|
void (*read_data)(); // Pointer to init function
|
|
void (*write_data)(); // Pointer to init function
|
|
}X_OPTLINK_TMS2TMS;
|
|
|
|
|
|
|
|
/*
|
|
// òàéìàóò îæèäàíèß âûïîëåíèß êîìàíäû
|
|
#define TIME_OUT_SERIAL_BUS 10000 // max 65535
|
|
|
|
|
|
#define CMD_SERIAL_BUS_READ 0x0000
|
|
#define CMD_SERIAL_BUS_WRITE 0x8000
|
|
|
|
*/
|
|
|
|
|
|
typedef X_OPTLINK_TMS2TMS *X_OPTLINK_TMS2TMS_handle;
|
|
|
|
#define X_OPTLINK_TMS2TMS_DEFAULTS { 0, \
|
|
0,0,\
|
|
MAX_WAIT_ERROR_X_OPTLINK_TMS2TMS, \
|
|
{0,0,0,0},\
|
|
{0,0,0,0},\
|
|
0, \
|
|
0, \
|
|
0, \
|
|
0, \
|
|
(void (*)(Uint32))x_optlink_tms2tms_init,\
|
|
(void (*)(Uint32))x_optlink_tms2tms_read_data,\
|
|
(void (*)(Uint32))x_optlink_tms2tms_write_data\
|
|
}
|
|
|
|
|
|
void x_optlink_tms2tms_init(X_OPTLINK_TMS2TMS_handle);
|
|
|
|
void x_optlink_tms2tms_read_data(X_OPTLINK_TMS2TMS_handle);
|
|
|
|
void x_optlink_tms2tms_write_data(X_OPTLINK_TMS2TMS_handle);
|
|
|
|
|
|
extern X_OPTLINK_TMS2TMS x_optlink_tms2tms_project;
|
|
|
|
|
|
|
|
#endif // end _X_OPTLINK_TMS2TMS_H
|
|
|