author | groke6 |
Tue, 22 Jan 2008 10:27:13 +0100 | |
changeset 364 | 17edd8a028fa |
parent 296 | 03f2b8b8cb0b |
child 378 | d2abf6c8c27b |
permissions | -rw-r--r-- |
284 | 1 |
/* |
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
||
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
||
6 |
See COPYING file for copyrights details. |
|
7 |
||
8 |
This library is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU Lesser General Public |
|
10 |
License as published by the Free Software Foundation; either |
|
11 |
version 2.1 of the License, or (at your option) any later version. |
|
12 |
||
13 |
This library is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
Lesser General Public License for more details. |
|
17 |
||
18 |
You should have received a copy of the GNU Lesser General Public |
|
19 |
License along with this library; if not, write to the Free Software |
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
*/ |
|
22 |
||
23 |
/*! |
|
24 |
** @file emcy.h |
|
25 |
** @author Luis Jimenez |
|
26 |
** @date Wed Sep 26 2007 |
|
27 |
** |
|
28 |
** @brief Declarations of the functions that manage EMCY (emergency) messages |
|
29 |
** |
|
30 |
** |
|
31 |
*/ |
|
32 |
||
33 |
#ifndef __emcy_h__ |
|
34 |
#define __emcy_h__ |
|
35 |
||
36 |
||
37 |
#include <applicfg.h> |
|
38 |
||
39 |
/* The error states |
|
40 |
* ----------------- */ |
|
41 |
typedef enum enum_errorState { |
|
42 |
Error_free = 0x00, |
|
43 |
Error_occurred = 0x01 |
|
44 |
} e_errorState; |
|
45 |
||
46 |
typedef struct { |
|
47 |
UNS16 errCode; |
|
48 |
UNS8 errRegMask; |
|
49 |
UNS8 active; |
|
50 |
} s_errors; |
|
51 |
||
52 |
#include "data.h" |
|
53 |
||
54 |
||
55 |
typedef void (*post_emcy_t)(UNS8 nodeID, UNS16 errCode, UNS8 errReg); |
|
56 |
void _post_emcy(UNS8 nodeID, UNS16 errCode, UNS8 errReg); |
|
57 |
||
58 |
/************************************************************************* |
|
59 |
* Functions |
|
60 |
*************************************************************************/ |
|
61 |
||
62 |
/** Sets a new error with code errCode. Also sets corresponding bits in Error register (1001h) |
|
63 |
*/ |
|
296
03f2b8b8cb0b
Solved a small bug in emcy.c (errRegMask was always '1' in EMCY_setError.
luis
parents:
284
diff
changeset
|
64 |
UNS8 EMCY_setError(CO_Data* d, UNS16 errCode, UNS8 errRegMask, UNS16 addInfo); |
284 | 65 |
|
66 |
/** Indicates it has recovered from error errCode. Also clears corresponding bits in Error register (1001h) |
|
67 |
*/ |
|
68 |
void EMCY_errorRecovered(CO_Data* d, UNS16 errCode); |
|
69 |
||
70 |
/** Start EMCY consumer and producer |
|
71 |
*/ |
|
72 |
void emergencyInit(CO_Data* d); |
|
73 |
||
74 |
/** Stop EMCY producer and consumer |
|
75 |
*/ |
|
76 |
void emergencyStop(CO_Data* d); |
|
77 |
||
78 |
/** This function is responsible to process an EMCY canopen-message |
|
79 |
* \param Message The CAN-message which has to be analysed. |
|
80 |
*/ |
|
81 |
void proceedEMCY(CO_Data* d, Message* m); |
|
82 |
||
83 |
#endif /*__emcy_h__ */ |