versadac  1
versadac - Scalable Recorder Firmware
c_dcppdu.h
1 /*---------------------------------------------------------------------------*/
2 /* Copyright (C) 2006 Woodhead Software & Electonics. All rights reserved. */
3 /*---------------------------------------------------------------------------*/
4 /* This program is protected by international copyright. */
5 /* */
6 /* The use of this software including but not limited to its Source Code */
7 /* is subject to restrictions as agreed in the license agreement between */
8 /* you and Woodhead. */
9 /* Copying or distribution is not allowed unless expressly permitted */
10 /* according to your license agreement with Woodhead. */
11 /*---------------------------------------------------------------------------*/
12 /* */
13 /* Project : STACK PROFINET Device */
14 /* Component : DCP managment */
15 /* $Workfile:: c_dcppdu.h $*/
16 /* $Revision:: 4 $*/
17 /* $Date:: 13/07/11 13:55 $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : */
22 /* Device DCP frame generation module */
23 /* */
24 /*---------------------------------------------------------------------------*/
25 
26 
27 #ifndef _C_DCPPDU_H
28 #define _C_DCPPDU_H
29 
30 
31 #define SET_OPTION_SUBOPTION(a,o,so)\
32  if( APP_FALSE == DREP_DCP_BUFFER_SET_PTR(a, sizeof(APP_BYTE))){\
33  return APP_FALSE; \
34  } \
35  BYTE_CPY((DREP_DCP_BUFFER_GET_PTR(a)),0,so); \
36  if( APP_FALSE == DREP_DCP_BUFFER_SET_PTR(a, sizeof(APP_BYTE))){\
37  return APP_FALSE; \
38  } \
39  BYTE_CPY((DREP_DCP_BUFFER_GET_PTR(a)),0,o); \
40 
41 
42 APP_WORD prepareDCP_ID (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wDeviceID, APP_WORD wVendorID);
43 APP_WORD prepareDCPMacAddrBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wBlockInfo, APP_LPBYTE dwDeviceMacAddr);
44 APP_WORD prepareDCPIpBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wBlockInfo, APP_DWORD dwDeviceIpAddr, APP_DWORD dwSubnetMask, APP_DWORD dwRouterIpAddr);
45 APP_WORD prepareDCPRole (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byRole);
46 APP_WORD prepareDCPIDs (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wDeviceId, APP_WORD wVendorId);
47 APP_BOOL prepareDCPNameOfStation (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_LPBYTE pStationName, APP_BYTE bySetOperation, APP_BYTE byReqRes);
48 APP_WORD prepareDCPTypeOfStation (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_LPBYTE pStationType);
49 APP_WORD prepareDCPIdentifyOptionListBlock(LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BOOL bAddInitiative);
50 APP_WORD prepareDCPIdentHeader (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byReqRes, APP_DWORD dwXID, APP_WORD wReponseDelay, APP_WORD wDataLen);
51 APP_BOOL prepareVlanEthFrame (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_LPBYTE pDestMac, APP_WORD wFrameId,APP_LPBYTE pbyMacAddress);
52 APP_WORD prepareDCPHeader (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byReqRes, APP_DWORD dwXID, APP_WORD wDataLen, APP_BYTE wServiceId);
53 APP_WORD prepareDCPHelloHeader (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byReqRes, APP_DWORD dwXID, APP_WORD wReponseDelay, APP_WORD wDataLen);
54 APP_WORD PrepareSetResponseBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byOption, APP_BYTE bySubOption, APP_BYTE byStatus);
55 APP_WORD PrepareGetResponseBlockNeg (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_BYTE byOption, APP_BYTE bySubOption, APP_BYTE byStatus);
56 APP_WORD prepareDhcpBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wBlockInfo, APP_WORD wDataLength ,APP_LPBYTE lpbyData);
57 APP_WORD prepareDeviceInitiativeBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wBlockInfo, APP_BYTE byDeviceInitiatve);
58 APP_WORD prepareInstanceBlock (LPST_DREP_DCP_FRAME lpstDcpBuffer, APP_WORD wBlockInfo, APP_WORD wInstance);
59 APP_WORD prepare_IdentHello_DcpBuffer (LPST_DREP_DCP_FRAME lpstDcpBuffer, LPST_DREP lpstDrep, APP_BOOL bIsPersnalIdent);
60 
61 #endif