versadac  1
versadac - Scalable Recorder Firmware
netif.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 Controller */
14 /* Component : Hardware Interface */
15 /* $Workfile:: netif.h $*/
16 /* $Revision:: 4 $*/
17 /* $Date:: 15/06/10 16:30 $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : */
22 /* Network Abstraction Layer */
23 /* */
24 /*---------------------------------------------------------------------------*/
25 
26 
27 #ifndef _netif_h
28 #define _netif_h
29 
30 
31 
32 
33 
34 /* Basic Type for Ethernet 2*/
35 #define ETHERNET_BASE_TYPE 0x800
36 
37 /* VLAN TAG Type*/
38 #define ETH_802_1_VLAN_TAG 0x8100
39 
40 /* VLAN TAG Priority */
41 #define ETH_802_1_VLAN_TAG_PRIORITY_6 0xC000
42 #define ETH_802_1_VLAN_TAG_PRIORITY_5 0xA000
43 
44 /* PNIO Frame type */
45 #define ETHERNET_PNIO_TYPE 0x8892
46 
47 /* MRP Frame type */
48 #define ETHERNET_MRP_TYPE 0x88E3
49 
50 
51 /* Default UDP RT port */
52 #define PNIO_UDPRT_PORT 0x8892
53 
54 /* PNIO Frame type */
55 #define RPC_SERVER_PNIO_PORT 0x8894
56 
57 /* MAC ADDRESS LENGTH */
58 
59 
60 #include "os_pck.h"
61 
63  APP_BYTE MacDestAddr[MAC_ADDRESS_LEN]; /* Destination MAC address*/
64  APP_BYTE MacSrcAddr [MAC_ADDRESS_LEN]; /* Source MAC address*/
65  APP_WORD Type; /* Ethernet Type. Type < 0x800 are ethernet type 1(max 0x5dc). type for ethernet2 starts at 0x800*/
66 }STRUCT_ALIGNEMENT;
67 typedef struct _ST_ETHERNETI_FRAME_HEADER PACK_ALIGNEMENT(ST_ETHERNETI_FRAME_HEADER), APP_FAR * LPST_ETHERNETI_FRAME_HEADER;
68 #define ST_ETHERNETI_FRAME_HEADER_SIZEOF 14
69 STRUCT_SIZE_CHECK(ST_ETHERNETI_FRAME_HEADER, ST_ETHERNETI_FRAME_HEADER_SIZEOF)
70 
72  APP_BYTE MacDestAddr[MAC_ADDRESS_LEN]; /* Destination MAC address*/
73  APP_BYTE MacSrcAddr [MAC_ADDRESS_LEN]; /* Source MAC address*/
74  APP_WORD VlanTag; /* ETH_802_1_VLAN_TAG*/
75  APP_WORD VlanTagCtrl;
76  APP_WORD Type; /* SRT Frame 0x8892*/
77 }STRUCT_ALIGNEMENT;
78 typedef struct _ST_ETHERNETII_VLAN_FRAME_HEADER PACK_ALIGNEMENT(ST_ETHERNETII_VLAN_FRAME_HEADER), APP_FAR * LPST_ETHERNETII_VLAN_FRAME_HEADER;
79 #define ST_ETHERNETII_VLAN_FRAME_HEADER_SIZEOF 18
80 STRUCT_SIZE_CHECK(ST_ETHERNETII_VLAN_FRAME_HEADER, ST_ETHERNETII_VLAN_FRAME_HEADER_SIZEOF)
81 
82 
83 struct _UDPHDR{
84  APP_WORD SrcPort;
85  APP_WORD DstPort;
86  APP_WORD Length;
87  APP_WORD Checksum;
88 }STRUCT_ALIGNEMENT;
89 typedef struct _UDPHDR PACK_ALIGNEMENT(ST_UDPHDR);
90 #define ST_UDPHDR_SIZEOF 8
91 STRUCT_SIZE_CHECK(ST_UDPHDR, ST_UDPHDR_SIZEOF)
92 
93 
94 struct _IPHDR{
95  APP_BYTE Vsn;
96  APP_BYTE Tos;
97  APP_WORD Length;
98  APP_WORD Identification;
99  APP_WORD Flags;
100  APP_BYTE TTL;
101  APP_BYTE Prot;
102  APP_WORD Chksum;
103  ALIGNED_DWORD_DECL(IPSrc);
104  ALIGNED_DWORD_DECL(IPDst);
105 }STRUCT_ALIGNEMENT;
106 typedef struct _IPHDR PACK_ALIGNEMENT(IPHDR);
107 
108 #define ST_IPHDR_SIZEOF 20
109 STRUCT_SIZE_CHECK(ST_IPHDR, ST_IPHDR_SIZEOF)
110 
111 
112 struct _IpParameter {
113  APP_DWORD dwRemanent;
114  APP_DWORD dwIpAddr;
115  APP_DWORD dwSubNet;
116  APP_DWORD dwGateway;
117  APP_DWORD ipMode; /* Not use in controller. This paramater is only used by device
118  As the device and controller has the same configuration structure it's important
119  to add this parameter, to ensure size of structure has the same size.*/
120 }STRUCT_ALIGNEMENT;
121 typedef struct _IpParameter PACK_ALIGNEMENT(ST_IPPARAMETER), APP_FAR * LPST_IPPARAMETER;
122 
123 #include "os_unpck.h"
124 
125 #define SIZEOF_CYCLE_COUNTER 2
126 #define SIZEOF_FRAMEID 2
127 #define SIZEOF_DATA_STATUS 1
128 #define SIZEOF_TRANSFERT_STATUS 1
129 #define SIZEOF_PADDING 40
130 #define SIZE_FRAME_PRODUCTION_LESS_DATA ST_ETHERNETII_VLAN_FRAME_HEADER_SIZEOF + SIZEOF_FRAMEID + SIZEOF_CYCLE_COUNTER + SIZEOF_DATA_STATUS + SIZEOF_TRANSFERT_STATUS
131 
132 #endif
Definition: netif.h:94
Definition: netif.h:62
Definition: netif.h:112
Definition: netif.h:83
Definition: netif.h:71