versadac  1
versadac - Scalable Recorder Firmware
duauser.h
1 /*---------------------------------------------------------------------------*/
2 /* Copyright (C) 2007 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 : */
15 /* $Workfile:: dua.h $*/
16 /* $Revision:: 5 $*/
17 /* $Date:: 11/08/10 9:33 $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : DUA Management */
22 /* */
23 /* 10/04/2012 (KW) - Created to provide support for the SDR Device */
24 /* */
25 /*---------------------------------------------------------------------------*/
26 #ifndef _DUAUSER_H
27 #define _DUAUSER_H
28 
29 // debug enable/disable
30 //#define PND_DEBUG
31 //#define PND_TIMINGS
32 
33 // Module information
34 #define PND_MODULE_DATA_SIZE 4 // All modules in the SDR are 32bit floats
35 #define PND_IOCS_STATUS_SIZE 1 // Al sub slots have a 1 byte status
36 #define PND_MAX_NUMBER_OF_PHYSICAL_SLOTS 16 // The maximum number of physical hardware slots
37 #define PND_MAX_NUMBER_OF_VC_SLOTS 4 // The maximum number of virtual channel slots (virtual slots)
38 #define PND_MAX_NUMBER_OF_SLOTS (PND_MAX_NUMBER_OF_PHYSICAL_SLOTS + PND_MAX_NUMBER_OF_VC_SLOTS + 1) // The maximum number of slots (including virtual VC modules) and DAP
39 #define PND_MAX_NO_OF_SUBLOSTS 16 // The maximum number of sub slots per slot
40 #define PND_VC_SLOT_NUMBER 17 // Virtual channel modules start at this slot number
41 #define PND_DAP_SLOT_NUMBER 0 // The DAP module is always in slot 0
42 #define PND_MAX_NO_OF_ALARMS 2 // The maximum number of alarms per sub slot
43 
44 // Sub slot data direction
45 #define PND_INPUT_MODULE 1 // This module is input data to the SDR (output to the controller)
46 #define PND_OUTPUT_MODULE 2 // This module is output data from the SDR (input from the controller)
47 
48 // DUA state machine states
49 #define PND_DUA_STATUS_WFC 0 // Waiting for connection from controller
50 #define PND_DUA_STATUS_WF_APP_RDY 1 // DUA has to send Application ready
51 #define PND_DUA_STATUS_FIRST_DATA 2 // Stack send the first true set of data
52 #define PND_DUA_STATUS_CONNECTED 3 // Stack is connected and communicating
53 #define PND_DUA_STATUS_UNKNOWN 4 // Unknown connection index
54 
55 // DUA event requests used by DUA and application code
56 #define DUA_WAIT_EVT 0
57 #define DUA_EXIT_EVT 1
58 #define DUA_DIAGNOSTICS_ALARM_EVT 2
59 #define DUA_SET_OUTPUT_PROV_STATUS_RUN_EVT 3
60 #define DUA_SET_OUTPUT_PROV_STATUS_STOP_EVT 4
61 #define DUA_SET_OUTPUT_ERR_STATUS_OK_EVT 5
62 #define DUA_SET_OUTPUT_ERR_STATUS_BAD_EVT 6
63 #define DUA_SET_OUTPUT_DATA_VALID_EVT 7
64 #define DUA_SET_OUTPUT_DATA_INVALID_EVT 8
65 #define DUA_ABORT_REQ_EVT 9
66 #define DUA_LOAD_CONFIGURATION_EVT 10
67 #define DUA_START_DEVICE_EVT 11
68 #define DUA_STOP_DEVICE_EVT 12
69 #define DUA_MODULE_CHANGE_EVT 13
70 #define DUA_UNSUPPORTED_EVT 254
71 #define DUA_NO_EVENT 255
72 
73 // Module changed requests
74 #define DUA_NO_ACTION 0
75 #define DUA_PLUG_ONLY 1
76 #define DUA_PULL_ONLY 2
77 #define DUA_PULL_AND_PLUG 3
78 
79 // DUA status
80 #define DUA_DEVICE_STOPPED 0
81 #define DUA_DEVICE_STOPPING 1
82 #define DUA_DEVICE_SHUTDOWN 2
83 #define DUA_DEVICE_STARTING 3
84 #define DUA_DEVICE_STARTED 4
85 
86 // Data update rate in ms
87 #define DUA_DATA_UPDATE_RATE_IN_MS 6 // This must be in quantities of 10ms so 5 * 10ms = 60ms interval
88 
89 // dua alarm status
90 #define PND_NOT_TRIGGERED 0
91 #define PND_INACTIVE 0
92 #define PND_TRIGGERED 1
93 #define PND_ACTIVE 1
94 
95 #endif