versadac  1
versadac - Scalable Recorder Firmware
cpm.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 : Consuption */
15 /* $Workfile:: cpm.h $*/
16 /* $Revision:: 4 $*/
17 /* $Date:: 30/08/10 11:52 $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : */
22 /* - Main user consumer thread */
23 /*---------------------------------------------------------------------------*/
24 
25 #ifndef _CPM_H
26 #define _CPM_H
27 
28 APP_WORD consumer_task(APP_LPVOID pStart);
29 
30 #define STATE_CPM_W_START 0
31 #define STATE_CPM_RUN 1
32 #define STATE_CPM_FRUN 2
33 
34 #define CPM_NEW_DATA 0x01
35 #define CPM_NEW_STATUS 0x02
36 
37 #define CPM_SET_STATE(a, b) a->wStateMachine = b
38 
39 
40 /*Active*/
41 APP_DWORD APP_FAR cpm_active_req (LPST_MSG* ppMsg);
42 /*CLOSE*/
43 APP_DWORD APP_FAR cpm_close_req (LPST_MSG* ppMsg);
44 
45 /* Schedule said: ok function is insert */
46 APP_DWORD APP_FAR cpm_ready (LPST_MSG* ppMsg);
47 APP_DWORD APP_FAR cpm_end (LPST_MSG* ppMsg);
48 /*Data, status, role*/
49 APP_DWORD APP_FAR cpm_get_cons_status_req (LPST_MSG* ppMsg);
50 APP_DWORD APP_FAR cpm_set_red_role_req (LPST_MSG* ppMsg);
51 APP_DWORD APP_FAR cpm_get_cons_data_req (LPST_MSG* ppMsg);
52 
53 /*Ind*/
54 APP_DWORD APP_FAR cpm_stop_ind (LPST_MSG* ppMsg);
55 APP_DWORD APP_FAR cpm_new_cons_data_ind (LPST_MSG* ppMsg);
56 APP_DWORD APP_FAR cpm_c_data_ind (LPST_MSG* ppMsg);
57 
58 APP_DWORD APP_FAR cpm_stop (LPST_MSG* ppMsg);
59 APP_DWORD APP_FAR cpm_start (LPST_MSG* ppMsg);
60 
61 
62 #define CPM_C_DATA_IND OS_SEND_MESSAGE_CPM (ID_CPM_C_DATA_IND)
63 
64 /*#define RETURN_CMDEV_CPM_ACTIVE_CNF (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_ACTIVATE_CNF; return SEND_MESSAGE*/
65 #define RETURN_CMDEV_ID_CPM_ACTIVE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_ACTIVE_CNF_POS; return SEND_MESSAGE
66 #define RETURN_CMDEV_ID_CPM_ACTIVE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_ACTIVE_CNF_NEG; return SEND_MESSAGE
67 
68 
69 #define RETURN_CMDEV_ID_CPM_CLOSE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_CLOSE_CNF_POS; return SEND_MESSAGE
70 #define RETURN_CMDEV_ID_CPM_CLOSE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_CLOSE_CNF_NEG; return SEND_MESSAGE
71 
72 #define RETURN_CPM_READY (*ppMsg)->dwQueue = ID_QUEUE_CPM; (*ppMsg)->wCodeFnct = ID_CPM_READY; return SEND_MESSAGE
73 #define RETURN_CPM_END (*ppMsg)->dwQueue = ID_QUEUE_CPM; (*ppMsg)->wCodeFnct = ID_CPM_END; return SEND_MESSAGE
74 
75 #define ACTIVATE_CPM_REQ OS_SEND_MESSAGE_CPM (ID_CPM_ACTIVE_REQ)
76 #define RETURN_CMCTL_ID_CPM_ACTIVE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMCTL; (*ppMsg)->wCodeFnct = ID_CPM_ACTIVE_CNF_POS; return SEND_MESSAGE
77 #define RETURN_CMCTL_ID_CPM_ACTIVE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMCTL; (*ppMsg)->wCodeFnct = ID_CPM_ACTIVE_CNF_NEG; return SEND_MESSAGE
78 
79 #define CLOSE_CPM_REQ OS_SEND_MESSAGE_CPM (ID_CPM_CLOSE_REQ)
80 #define RETURN_CMCTL_ID_CPM_CLOSE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMCTL; (*ppMsg)->wCodeFnct = ID_CPM_CLOSE_CNF_POS; return SEND_MESSAGE
81 #define RETURN_CMCTL_ID_CPM_CLOSE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMCTL; (*ppMsg)->wCodeFnct = ID_CPM_CLOSE_CNF_NEG; return SEND_MESSAGE
82 
83 #define CPM_GET_CONS_DATA_REQ OS_SEND_MESSAGE_CPM (ID_CPM_GET_CONS_DATA_REQ)
84 
85 #define CPM_SET_RED_ROLE_REQ OS_SEND_MESSAGE_CPM (ID_CPM_SET_RED_ROLE_REQ)
86 #define RETURN_CPM_SET_RED_ROLE_REQ (*ppMsg)->dwQueue = ID_QUEUE_CPM; (*ppMsg)->wCodeFnct = ID_CPM_SET_RED_ROLE_REQ; return SEND_MESSAGE
87 
88 #define CMDEV_STOP_IND OS_SEND_MESSAGE_CMDEV (ID_CPM_STOP_IND)
89 #define CMDEV_NEW_CONS_DATA_IND OS_SEND_MESSAGE_CMDEV (ID_CPM_NEW_CONS_DATA_IND)
90 
91 #define RETURN_CMDEV_NEW_CONS_DATA_IND (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_CPM_NEW_CONS_DATA_IND; return SEND_MESSAGE
92 
93 
94 #define RETURN_STTUP_SET_PROV_DATA_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_INPUT_CNF_NEG; return SEND_MESSAGE
95 #define RETURN_STTUP_SET_PROV_DATA_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_INPUT_CNF_POS; return SEND_MESSAGE
96 
97 #define RETURN_STTUP_GET_CONS_DATA_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_CNF_NEG; return SEND_MESSAGE
98 #define RETURN_STTUP_GET_CONS_DATA_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_CNF_POS; return SEND_MESSAGE
99 
100 #define RETURN_STTUP_GET_CONS_DATA_STATUS_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_IOCS_CNF_POS; return SEND_MESSAGE
101 #define RETURN_STTUP_GET_CONS_DATA_STATUS_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_IOCS_CNF_NEG; return SEND_MESSAGE
102 
103 #define RETURN_STTUP_SET_PROV_STATUS_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_OUTPUT_APDU_CNF_POS; return SEND_MESSAGE
104 #define RETURN_STTUP_SET_PROV_STATUS_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_OUTPUT_APDU_CNF_NEG; return SEND_MESSAGE
105 
106 
107 
108 #endif
Definition: message.h:1163