dp_user.h
资源名称:Profibus.rar [点击查看]
上传用户:hualang
上传日期:2022-04-11
资源大小:104k
文件大小:7k
源码类别:
能源行业(电力石油煤炭)
开发平台:
C/C++
- ///////////////////////////////////////////////////////////////
- // 文 件 名 : dp_user.h
- // 文件功能 : vpc3用户接口部分
- // 作 者 : 530
- // 创建时间 :
- // 项目名称 : Blackfin
- // 操作系统 :
- // 备 注 :
- // 历史记录 :
- ///////////////////////////////////////////////////////////////
- #ifndef DP_USER_H
- #define DP_USER_H
- //动作状态
- #define SPI_ON 0x01
- #define SPI_OFF 0x00
- //报警类型
- #define ALARM_ACTION 0x01
- #define ALARM_DI 0x02
- #define ALARM_WAVE 0x03
- #define ALARM_ABNORMAL 0x04
- #define ALARM_SOFTSTRAP 0x05
- #define ALARM_HARDSTRAP 0x06
- #define ALARM_V0_DIAG 0x07 //V0诊断方式
- //录波文件类型
- #define WAVE_FORAMT_FILE 0x01
- #define WAVE_FORAMT_SAMPLE 0x02
- //非周期读服务slot定义
- #define SlotNum_Read_BhPara 0x02
- #define SlotNum_Read_Energy 0x03
- #define SlotNum_Read_WaveConfig 0x04
- #define SlotNum_Read_WaveData_File_Zone0 0x05
- #define SlotNum_Read_WaveData_File_Zone1 0x06
- #define SlotNum_Read_WaveData_File_Zone2 0x07
- #define SlotNum_Read_WaveData_File_Zone3 0x08
- #define SlotNum_Read_WaveData_Sample_Zone0 0x09
- #define SlotNum_Read_WaveData_Sample_Zone1 0x0a
- #define SlotNum_Read_WaveData_Sample_Zone2 0x0b
- #define SlotNum_Read_WaveData_Sample_Zone3 0x0c
- #define SlotNum_Read_WaveData_Sample_Zone4 0x0d
- #define SlotNum_Read_WaveData_Sample_Zone5 0x0e
- #define SlotNum_Read_BhPara_Zone0 0x0f
- #define SlotNum_Read_BhPara_Zone1 0x10
- #define SlotNum_Read_BhPara_Zone2 0x11
- #define SlotNum_Read_BhPara_Zone3 0x12
- #define SlotNum_Read_BhPara_Zone4 0x13
- #define SlotNum_Read_BhPara_Zone5 0x14
- #define SlotNum_Read_DeviceInfo 0x15
- #define SlotNum_Read_WaveData_Comtrade_Zone0 22
- #define SlotNum_Read_WaveData_Comtrade_Zone1 23
- #define SlotNum_Read_WaveData_Comtrade_Zone2 24
- #define SlotNum_Read_WaveData_Comtrade_Zone3 25
- #define SlotNum_Read_WaveData_Comtrade_Zone4 26
- #define SlotNum_Read_WaveData_Comtrade_Zone5 27
- #define SlotNum_Read_WaveData_Comtrade_Zone6 28
- #define SlotNum_Read_WaveData_Comtrade_Zone7 29
- #define SlotNum_Read_WaveData_Comtrade_Zone8 30
- //EDD 扩展
- #define SlotNum_50 50
- #define SlotNum_51 51
- #define SlotNum_52 52
- #define SlotNum_53 53
- #define SlotNum_54 54
- #define SlotNum_55 55 //读写虚拟液晶
- #define SlotNum_50_SYSINFO 0
- #define SlotNum_50_DEVMODEL 1
- #define SlotNum_50_SYSCFG 2
- #define SlotNum_50_PROTSETTING 3
- #define SlotNum_50_DICFG 4
- #define SlotNum_50_DOCFG 5
- #define SlotNum_50_PW 6
- #define SlotNum_50_CTRLOBJ 7
- #define SlotNum_50_SOFTSTRAP 8
- #define SlotNum_50_SIGNALRESET 9
- #define SlotNum_50_STARTWAVE 10
- #define SlotNum_50_LANGUAGE 11
- //增加用户开入常开常闭
- #define SlotNum_50_DI_NONC 20
- #define SlotNum_51_MEASFOLDER0 0
- #define SlotNum_51_MEASFOLDER1 1
- #define SlotNum_51_MEASFOLDER2 2
- #define SlotNum_51_MEAS_COMMUSEND_BARVAL 10 //通讯上送的测量值, 棒图显示实际值
- #define SlotNum_51_MEAS_COMMUSEND_TRENDVIEW 11 //通讯上送的测量值, 趋势图显示实际值
- #define SlotNum_52_DBGDATA_FOLDER0 0
- #define SlotNum_52_DBGDATA_FOLDER1 1
- #define SlotNum_52_DBGDATA_FOLDER2 2
- #define SlotNum_53_DI 0
- #define SlotNum_53_DO 1
- #define SlotNum_53_PT 2
- #define SlotNum_53_SOFTSTRAP 3
- #define SlotNum_53_ABNLSIG 4
- #define SlotNum_53_ACTSIG 5
- #define SlotNum_53_ENERGY 6
- #define SlotNum_53_STAT 7
- #define SlotNum_53_PBSTAT 8
- //非周期写服务slot定义
- #define SlotNum_Write_BhPara 0x02
- #define SlotNum_Write_StartWave 0x03
- #define SlotNum_Write_ModifyTime 0x04
- #define SlotNum_Write_CtrlSelect 0x05
- #define SlotNum_Write_CtrlExecute 0x06
- #define SlotNum_Write_ResetSignal 0x07
- #define SlotNum_Write_BhPara_Zone0 0x08
- #define SlotNum_Write_BhPara_Zone1 0x09
- #define SlotNum_Write_BhPara_Zone2 0x0A
- #define SlotNum_Write_BhPara_Zone3 0x0B
- #define SlotNum_Write_BhPara_Zone4 0x0C
- #define SlotNum_Write_BhPara_Zone5 0x0D
- #define SlotNum_Write_CtrlCancel 0x0E
- //error-code2定义
- #define ErrCode2_Read_BhPara 0x01
- #define ErrCode2_Read_Energy 0x02
- #define ErrCode2_Read_WaveConfig 0x03
- #define ErrCode2_Read_WaveData 0x04
- #define ErrCode2_Write_BhPara 0x05
- #define ErrCode2_Write_StartWave 0x06
- #define ErrCode2_Write_SETTIME 0x07
- #define ErrCode2_Write_SIGNALRESET 0x08
- //遥控控制结果
- #define ErrCode2_Write_Control 0x10
- #define ErrCode2_Write_DICFG 0x11
- #define ErrCode2_Write_DOCFG 0x12
- #define ErrCode2_Write_DINONCCFG 0x13
- #define MAX_DPV1_DU_COUNT 240
- /************************************************************************/
- /* 导出给其他文件用相关函数 */
- /************************************************************************/
- void ResetVPC3(uint8 dev_num);
- bool16 InitVPC3(int dev_num, uint8 nAddr);
- void user_main(int dev_num);
- int GetProfibusBaudRate(int dev_num);
- bool16 IsInDPV1Status(uint8 nDevID);
- int GetProfibusMasterAddr(int dev_num);
- int GetProfibusDPState(int dev_num);
- int GetProfibusPrmCount(int dev_num);
- int GetProfibusCheckCfgCount(int dev_num);
- void application_ready(uint8 dev_num);
- //void ClockSyncProcInADInt(uint8 dev_num);
- /************************************************************************/
- /* 导出给VPC3用户状态机使用的相关函数 */
- /************************************************************************/
- uint8* GetInputBuffer(uint8 nDevID, uint8* pUserLen);
- void SetOutputBuffer(uint8 nDevID, uint8* pDxOutputData, uint8 nOutputLen);
- uint8* GetRealCfgBuffer(uint8 nDevID, uint8* pCfgLen);
- bool16 SetPrmBuffer(uint8 nDevID, uint8* pUserPrmData, uint8 nPrmLen);
- int DPV1_ReadReq(uint8 nDevID, uint8 nSlot, uint8 nIndex, uint8 nReadLen, uint8** pDataRet, uint8* pLenAssemb, uint8* nErrCode1, uint8* nErrCode2);
- int DPV1_WriteReq(uint8 nDevID, uint8 nSlot, uint8 nIndex, uint8 nWriteLen, uint8* pDataWrite, uint8* nErrCode1, uint8* nErrCode2);
- void ReceiveProcess(uint8 nDevID, int nLength);
- void SendProcess(uint8 nDevID, int nLength);
- void AlarmProcess(uint8 nDevID);
- void AlarmACK(uint8 nDevID);
- void DoEventInDxState(uint8 nDevID);
- void SetDataExchangeLED(uint8 bOn);
- int xmemcmp(void* pSrc, void* pDest, int nLen);
- // uint8 AssembActionSOE(uint8 nDevID, const TSOE_ACTION_STRUCT * pActSOE,uint8* pDataRet);
- // uint8 AssembDISOE(uint8 nDevID, const TSOE_DIEVENT_STRUCT * pActSOE,uint8* pDataRet);
- // uint8 AssembAbnormalSOE(uint8 nDevID, const TSOE_ABNORMAL_STRUCT * pActSOE,uint8* pDataRet);
- // uint8 AssembWaveExSOE(uint8 nDevID, const TSOE_EX_WAVE_FILE_STRUCT * pWaveSOE,uint8* pDataRet);
- uint8 SendUserDiagnostic(uint8 dev_num, uint8 nDiagType, const void * pDiagData, uint8 bAlarm);
- void QuitAlarm(uint8 dev_num);
- void EDD_C2_InitiateReq(uint8 nDevID);
- void EDD_C2_AbortInd(uint8 nDevID);
- //请求设置子站地址
- void SetSlaveAddressReq(int nAddress);
- #endif