versadac  1
versadac - Scalable Recorder Firmware
ppm.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 : Production */
15 /* $Workfile:: ppm.h $*/
16 /* $Revision:: 2 $*/
17 /* $Date:: 9/22/09 6:01p $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : */
22 /* - Main user production thread */
23 /*---------------------------------------------------------------------------*/
24 
25 
26 #ifndef _PPM_H
27 #define _PPM_H
28 
29 /* #### STATE MACHINE #### */
30 #define STATE_PPM_W_START 0
31 #define STATE_PPM_RUN 1
32 #define STATE_PPM_C_RUN 2
33 #define STATE_PPM_WCON 3
34 
35 
36 
37 
38 #define PPM_SET_STATE(a, b) a->wStateMachine = b
39 
40 
41 APP_WORD provider_task(APP_LPVOID pStart);
42 APP_WORD ppm_take_protect ( LPST_CREP lpstCrep );
43 APP_WORD ppm_give_protect ( LPST_CREP lpstCrep );
44 APP_WORD ppm_create_protect ( LPST_CREP lpstCrep );
45 APP_WORD ppm_clear_protect ( LPST_CREP lpstCrep );
46 #define PPM_CREATE_MUTEX(x) ppm_create_protect(x)
47 #define PPM_CLEAR_MUTEX(x) ppm_clear_protect(x)
48 #define PPM_TAKE_MUTEX(x) ppm_take_protect(x)
49 #define PPM_GIVE_MUTEX(x) ppm_give_protect(x)
50 
51 APP_DWORD APP_FAR ppm_start (LPST_MSG* ppMsg);
52 APP_DWORD APP_FAR ppm_active_req (LPST_MSG* ppMsg);
53 APP_DWORD APP_FAR ppm_close_req (LPST_MSG* ppMsg);
54 APP_DWORD APP_FAR ppm_set_prov_data_req (LPST_MSG* ppMsg);
55 APP_DWORD APP_FAR ppm_set_prov_status_req (LPST_MSG* ppMsg);
56 APP_DWORD APP_FAR ppm_Time_event_ind (LPST_MSG* ppMsg);
57 APP_DWORD APP_FAR ppm_c_data_cnf (LPST_MSG* ppMsg);
58 APP_DWORD APP_FAR ppm_Stop (LPST_MSG* ppMsg);
59 APP_DWORD APP_FAR ppm_Ready (LPST_MSG* ppMsg);
60 APP_DWORD APP_FAR ppm_end (LPST_MSG* ppMsg);
61 
62 #define RETURN_PPM_READY (*ppMsg)->dwQueue = ID_QUEUE_PPM; (*ppMsg)->wCodeFnct = ID_PPM_READY; return SEND_MESSAGE
63 #define RETURN_PPM_END (*ppMsg)->dwQueue = ID_QUEUE_PPM; (*ppMsg)->wCodeFnct = ID_PPM_END; return SEND_MESSAGE
64 
65 #define ACTIVATE_PPM_REQ OS_SEND_MESSAGE_PPM (ID_PPM_ACTIVE_REQ)
66 
67 #define RETURN_CMDEV_ID_PPM_ACTIVE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_PPM_ACTIVE_CNF_POS; return SEND_MESSAGE
68 #define RETURN_CMDEV_ID_PPM_ACTIVE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_PPM_ACTIVE_CNF_NEG; return SEND_MESSAGE
69 
70 #define RETURN_CMDEV_ID_PPM_ACTIVE_CNF (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_PPM_ACTIVATE_CNF; return SEND_MESSAGE
71 
72 #define CLOSE_PPM_REQ OS_SEND_MESSAGE_PPM (ID_PPM_CLOSE_REQ)
73 
74 #define RETURN_CMDEV_ID_PPM_CLOSE_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_PPM_CLOSE_CNF_POS; return SEND_MESSAGE
75 #define RETURN_CMDEV_ID_PPM_CLOSE_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_CMDEV; (*ppMsg)->wCodeFnct = ID_PPM_CLOSE_CNF_NEG; return SEND_MESSAGE
76 
77 #define RETURN_PPM_SET_PROV_STATUS_REQ (*ppMsg)->dwQueue = ID_QUEUE_PPM; (*ppMsg)->wCodeFnct = ID_PPM_SET_PROV_STATUS_REQ; return SEND_MESSAGE
78 #define PPM_ERROR_IND OS_SEND_MESSAGE_CMDEV (ID_PPM_ERROR_IND)
79 
80 #define RETURN_STTUP_SET_PROV_DATA_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_INPUT_CNF_NEG; return SEND_MESSAGE
81 #define RETURN_STTUP_SET_PROV_DATA_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_PPM_SET_INPUT_CNF_POS; return SEND_MESSAGE
82 
83 #define RETURN_STTUP_GET_CONS_DATA_CNF_NEG (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_CNF_NEG; return SEND_MESSAGE
84 #define RETURN_STTUP_GET_CONS_DATA_CNF_POS (*ppMsg)->dwQueue = ID_QUEUE_ASESM; (*ppMsg)->wCodeFnct = ID_CPM_GET_OUTPUT_CNF_POS; return SEND_MESSAGE
85 
86 #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
87 #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
88 
89 #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
90 #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
91 
92 
93 #endif
Definition: message.h:1163