2025-04-30 16:24:29 +08:00

148 lines
4.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef SHMBUFF_123_INCLUDED
#define SHMBUFF_123_INCLUDED
///#include "code.h"
#include "basetype.h"
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************/
//CAN缓冲区的大小改为32满足256长度要求)
#define CAN_BUFF_NUM 16
#define CANADI_BUFF_NUM 63
//
#define PRINT_BUFF_NUM 31
#define IO_BOARD_NUM_MAX (CLZType_IO_NUM)//4 //cbt modified 2021.3.23 硬件4.0IO板数量由4块->5块统一采用basetype.h中的宏定义
#define IO_INPUT_NUM_MAX 32
#ifndef WIN32
struct can_frame {
unsigned int can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
unsigned char can_dlc; /* data length code: 0 .. 8 */
unsigned char data[8] __attribute__((aligned(8)));
};
#else
struct can_frame {
unsigned int can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
unsigned char can_dlc; /* data length code: 0 .. 8 */
unsigned char data[8];
};
#endif
typedef struct{
unsigned char WriteIP; //写Buffer指针
unsigned char ReadIP; //读Buffer指针
struct can_frame Buffer[CAN_BUFF_NUM]; //事件报告缓冲区
DateType timeW[CAN_BUFF_NUM]; //写入数据时间
} CanBufferType;
typedef struct{
unsigned char WriteIP; //写Buffer指针
unsigned char ReadIP; //读Buffer指针
struct can_frame Buffer[CANADI_BUFF_NUM];
} CanADIBufferType;
typedef struct{
unsigned char WriteIP; //写Buffer指针
unsigned char ReadIP; //读Buffer指针
char Buffer[PRINT_BUFF_NUM][256]; //事件报告缓冲区
} PrintfBufferType;
//IO消抖时间的值
typedef struct{
unsigned short updateFlag; //保护只读, 0x5555:初始化值0xAAAA:读取的IO值其它值无效不使用
unsigned char updateIndex; //更新计数器
unsigned char unUse; //预留字节
unsigned int trembleT[IO_INPUT_NUM_MAX]; //IO板配置的消抖时间按照CAN报文排序
} IOTrembleTimeType;
/*** 保护定义的函数,这里仅仅引用 ****/
void inf_get_equTime(DateType *equtime);
/** 定值的值缓冲 **/
int inf_shm_get_addr_dz_prot_recv(DZ_VAL_TYPE **ppucDz);
int inf_shm_get_addr_dz_prot_send(DZ_VAL_TYPE **ppucDz);
int inf_shm_get_addr_sjbg(SoeBufferType **ppstSoe );
int inf_shm_get_addr_zjbg(CheckReportType **ppstCRT);
int inf_shm_get_addr_yxbur(YaoXinStrucType **ppstYx);
int inf_shm_get_addr_operbg(OperReportType **ppstCzsj );
int inf_shm_get_addr_fhlb( WaveType **ppstWT );
int inf_shm_get_addr_gzbg(FaultReportType **ppstFRT);
int inf_shm_get_addr_groupSoe(GroupSoeReportType **ppstGSoe);
int inf_shm_get_addr_clz(CLZBuffType **ppucClz);
int inf_shm_get_addr_gsmv(char **ppucGsmv);
int inf_shm_buffer_check( void );
int inf_shm_buffer_init( void );
//根据上面的结构体can_frame发送或者接收can网的数据
/* 保护从队列中读CAN上收到的数据 */
int inf_shm_can_prot_read( void *data, void *timeW );
/* 保护向队列中写数据,由接口发送 */
int inf_shm_can_prot_write( const void *data );
int inf_shm_can_driver_read( void *data );
int inf_shm_can_driver_write( const void *data );
/*** 调用重定义的print函数向共享缓冲中写数据 ****/
int inf_shm_printf_write( const char *forms, ... );
/** 从缓冲中读数据 ****/
int inf_shm_printf_read( void *data );
//cbt modified 2019.5.22 将自投文件缓冲区分成3个分别对应闭锁配置文件、自投配置文件、馈线自投配置文件
/**自投闭锁文件缓存 **/
//int inf_shm_get_addr_ztblock( char **ppucZtblock );
int inf_shm_get_addr_block( char **ppucBlock );
int inf_shm_get_addr_zt( char **ppucZt );
int inf_shm_get_addr_kxzt( char **ppucKxZt );
/** 驱动调用发送CORE0的CAN数据 **/
int inf_shm_canadi_driver_read( void *data );
/** 驱动调用,保存收到的数据 **/
int inf_shm_canadi_driver_write( const void *data );
int inf_shm_canadi_inf_read( void *data );
int inf_shm_canadi_inf_write( const void *data );
/** 获取谐波的缓冲区 **/
int inf_shm_get_addr_harmon(HarmonBuffType **ppucHarmon);
/** 保护更新跳闸灯的状态 **/
int inf_shm_get_addr_tzled(TZLedBuffType **ppucTzled);
/** 获取供电臂联络信号保存的地址 **/
int inf_shm_get_addr_gdb_ll(GdbLLBuffType **ppucGdbLL);
/** 获取IO板的消抖时间ioIndex从0开始),保护调用,失败返回非0 **/
int inf_shm_io_tremble_time_get( int ioIndex, IOTrembleTimeType *trembleT );
/** 接口调用更新IO消抖时间 **/
int inf_shm_io_tremble_time_set( int ioIndex, const IOTrembleTimeType *trembleT );
/************************************************************************/
#ifdef __cplusplus
}
#endif
#endif