84 lines
2.8 KiB
C
84 lines
2.8 KiB
C
/******************************************************************************
|
|
|
|
版权所有 (C), 2013-2023, 科大智能电气有限公司
|
|
|
|
******************************************************************************
|
|
文 件 名 : gb104.h
|
|
版 本 号 : V1.0
|
|
生成日期 : 2022年03月23日
|
|
最近修改 :
|
|
功能描述 : gb104.c的头文件
|
|
函数列表 :
|
|
修改历史 :
|
|
1.日 期 : 2022年03月23日
|
|
修改内容 : 创建文件
|
|
|
|
******************************************************************************/
|
|
#ifndef __GB104_H
|
|
#define __GB104_H
|
|
/**************************************文件包含*******************************/
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "lib60870_common.h"
|
|
#include "lib60870_public.h"
|
|
#include "lib60870_process.h"
|
|
#include "Asdu.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**************************************宏定义*********************************/
|
|
#define START_CODE 0x68
|
|
#define FRM_I 0
|
|
#define FRM_S 1
|
|
#define FRM_U 3
|
|
|
|
#define MAX_FRAME_COUNTER 0x7fff
|
|
#define COUNTER_LIMIT 0x8000
|
|
|
|
#define STARTDT_ACT 0x07
|
|
#define STARTDT_CON 0x0B
|
|
#define STOPDT_ACT 0x13
|
|
#define STOPDT_CON 0x23
|
|
#define TESTFR_ACT 0x43
|
|
#define TESTFR_CON 0x83
|
|
|
|
#define T0_TimeHandle 0
|
|
#define T1_TimeHandle 1
|
|
#define T2_TimeHandle 2
|
|
#define T3_TimeHandle 3
|
|
/************************************数据结构定义*****************************/
|
|
/**
|
|
* @brief
|
|
*/
|
|
/**************************************数据声明******************************/
|
|
|
|
/**************************************内部函数声明***************************/
|
|
char GB104_DecodeProcess(CS10xHandle_t pstSelf, unsigned char *pucBuf, unsigned short usLen);
|
|
void GB104_Preprocessor(CS10xHandle_t pstSelf);
|
|
void DoSFrame(CS10xHandle_t pstSelf);
|
|
void DoUFrame(CS10xHandle_t pstSelf);
|
|
|
|
char GB104_EncodeFrame(CS10xHandle_t pstSelf);
|
|
char GB104_EncodeOther(CS10xHandle_t pstSelf);
|
|
|
|
unsigned short GB104_EncodeApci(CS10xHandle_t pstSelf, unsigned char ucFrameType, VIec104Frame * pstFrame);
|
|
void GB104_EncodeApduLen(CS10xHandle_t pstSelf, VIec104Frame * pstApdu);
|
|
void GB104_FrameTimerHdl(CS10xHandle_t pstSelf, VIec104Frame * pstApdu);
|
|
|
|
void GB104_SendAck(CS10xHandle_t pstSelf);
|
|
void SendUFrame(CS10xHandle_t pstSelf, unsigned char ucType);
|
|
|
|
void StopTimer(CS10xHandle_t pstSelf, unsigned short usTimerId);
|
|
void StartTimer(CS10xHandle_t pstSelf, unsigned short usTimerId);
|
|
void GB104_TimerOut(CS10xHandle_t pstSelf, unsigned short usGap);
|
|
bool Check_IEC_104(unsigned char* pstBuf, unsigned short uslen);
|
|
/************************************外部接口函数声明*************************/
|
|
extern void CS10x_104Init(CS10xHandle_t pstSelf, CS10x_SendCb cb, void *arg, CS10x_Type enType);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |