Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | |
| 3 | (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29 |
| 4 | www.systec-electronic.com |
| 5 | |
| 6 | Project: openPOWERLINK |
| 7 | |
| 8 | Description: defines objdict dictionary |
| 9 | |
| 10 | License: |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions |
| 14 | are met: |
| 15 | |
| 16 | 1. Redistributions of source code must retain the above copyright |
| 17 | notice, this list of conditions and the following disclaimer. |
| 18 | |
| 19 | 2. Redistributions in binary form must reproduce the above copyright |
| 20 | notice, this list of conditions and the following disclaimer in the |
| 21 | documentation and/or other materials provided with the distribution. |
| 22 | |
| 23 | 3. Neither the name of SYSTEC electronic GmbH nor the names of its |
| 24 | contributors may be used to endorse or promote products derived |
| 25 | from this software without prior written permission. For written |
| 26 | permission, please contact info@systec-electronic.com. |
| 27 | |
| 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 31 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 32 | COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 33 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 34 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 35 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 36 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 37 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 38 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 39 | POSSIBILITY OF SUCH DAMAGE. |
| 40 | |
| 41 | Severability Clause: |
| 42 | |
| 43 | If a provision of this License is or becomes illegal, invalid or |
| 44 | unenforceable in any jurisdiction, that shall not affect: |
| 45 | 1. the validity or enforceability in that jurisdiction of any other |
| 46 | provision of this License; or |
| 47 | 2. the validity or enforceability in other jurisdictions of that or |
| 48 | any other provision of this License. |
| 49 | |
| 50 | ------------------------------------------------------------------------- |
| 51 | |
| 52 | $RCSfile: EplObjDef.h,v $ |
| 53 | |
| 54 | $Author: D.Krueger $ |
| 55 | |
| 56 | $Revision: 1.4 $ $Date: 2008/04/17 21:36:32 $ |
| 57 | |
| 58 | $State: Exp $ |
| 59 | |
| 60 | Build Environment: |
| 61 | GCC V3.4 |
| 62 | |
| 63 | ------------------------------------------------------------------------- |
| 64 | |
| 65 | Revision History: |
| 66 | |
| 67 | 2006/06/06 k.t.: take ObjDef.h from CANopen and modify for EPL |
| 68 | |
| 69 | ****************************************************************************/ |
| 70 | |
| 71 | #ifndef _EPLOBJDEF_H_ |
| 72 | #define _EPLOBJDEF_H_ |
| 73 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 74 | //--------------------------------------------------------------------------- |
| 75 | // security checks |
| 76 | //--------------------------------------------------------------------------- |
| 77 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 78 | //--------------------------------------------------------------------------- |
| 79 | // macros to help building OD |
| 80 | //--------------------------------------------------------------------------- |
| 81 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 82 | //--------------------------------------------------------------------------- |
| 83 | #if (defined (EPL_OBD_USE_VARIABLE_SUBINDEX_TAB) && (EPL_OBD_USE_VARIABLE_SUBINDEX_TAB != FALSE)) |
| 84 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 85 | #define CCM_SUBINDEX_RAM_ONLY(a) a; |
| 86 | #define CCM_SUBINDEX_RAM_ONEOF(a,b) a |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 87 | |
| 88 | #else |
| 89 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 90 | #define CCM_SUBINDEX_RAM_ONLY(a) |
| 91 | #define CCM_SUBINDEX_RAM_ONEOF(a,b) b |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 92 | |
| 93 | #endif |
| 94 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 95 | //--------------------------------------------------------------------------- |
| 96 | // To prevent unused memory in subindex tables we need this macro. |
| 97 | // But not all compilers support to preset the last struct value followed by a comma. |
| 98 | // Compilers which does not support a comma after last struct value has to place in a dummy subindex. |
| 99 | #if ((DEV_SYSTEM & _DEV_COMMA_EXT_) != 0) |
| 100 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 101 | #define EPL_OBD_END_SUBINDEX() |
| 102 | #define EPL_OBD_MAX_ARRAY_SUBENTRIES 2 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 103 | |
| 104 | #else |
| 105 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 106 | #define EPL_OBD_END_SUBINDEX() {0,0,0,NULL,NULL} |
| 107 | #define EPL_OBD_MAX_ARRAY_SUBENTRIES 3 |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 108 | |
| 109 | #endif |
| 110 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 111 | //--------------------------------------------------------------------------- |
| 112 | //--------------------------------------------------------------------------- |
| 113 | // globale vars |
| 114 | //--------------------------------------------------------------------------- |
| 115 | //--------------------------------------------------------------------------- |
| 116 | |
| 117 | // ------------------------------------------------------------------------- |
| 118 | // creation of data in ROM memory |
| 119 | // ------------------------------------------------------------------------- |
| 120 | #define EPL_OBD_CREATE_ROM_DATA |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 121 | #include "objdict.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 122 | #undef EPL_OBD_CREATE_ROM_DATA |
| 123 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 124 | // ------------------------------------------------------------------------- |
| 125 | // creation of data in RAM memory |
| 126 | // ------------------------------------------------------------------------- |
| 127 | |
| 128 | #define EPL_OBD_CREATE_RAM_DATA |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 129 | #include "objdict.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 130 | #undef EPL_OBD_CREATE_RAM_DATA |
| 131 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 132 | // ------------------------------------------------------------------------- |
| 133 | // creation of subindex tables in ROM and RAM |
| 134 | // ------------------------------------------------------------------------- |
| 135 | |
| 136 | #define EPL_OBD_CREATE_SUBINDEX_TAB |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 137 | #include "objdict.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 138 | #undef EPL_OBD_CREATE_SUBINDEX_TAB |
| 139 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 140 | // ------------------------------------------------------------------------- |
| 141 | // creation of index tables for generic, manufacturer and device part |
| 142 | // ------------------------------------------------------------------------- |
| 143 | |
| 144 | #define EPL_OBD_CREATE_INDEX_TAB |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 145 | #include "objdict.h" |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 146 | #undef EPL_OBD_CREATE_INDEX_TAB |
| 147 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 148 | //=========================================================================// |
| 149 | // // |
| 150 | // P U B L I C F U N C T I O N S // |
| 151 | // // |
| 152 | //=========================================================================// |
| 153 | |
| 154 | // ---------------------------------------------------------------------------- |
| 155 | // |
| 156 | // Function: EPL_OBD_INIT_RAM_NAME() |
| 157 | // |
| 158 | // Description: function to initialize object dictionary |
| 159 | // |
| 160 | // Parameters: pInitParam_p = pointer to init param struct of Epl |
| 161 | // |
| 162 | // Returns: tEplKernel = error code |
| 163 | // |
| 164 | // State: |
| 165 | // |
| 166 | // ---------------------------------------------------------------------------- |
| 167 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 168 | EPLDLLEXPORT tEplKernel PUBLIC EPL_OBD_INIT_RAM_NAME(tEplObdInitParam MEM * |
| 169 | pInitParam_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 170 | { |
| 171 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 172 | tEplObdInitParam MEM *pInitParam = pInitParam_p; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 173 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 174 | // check if pointer to parameter structure is valid |
| 175 | // if not then only copy subindex tables below |
| 176 | if (pInitParam != NULL) { |
| 177 | // at first delete all parameters (all pointers will be set zu NULL) |
| 178 | EPL_MEMSET(pInitParam, 0, sizeof(tEplObdInitParam)); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 179 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 180 | #define EPL_OBD_CREATE_INIT_FUNCTION |
| 181 | { |
| 182 | // inserts code to init pointer to index tables |
| 183 | #include "objdict.h" |
| 184 | } |
| 185 | #undef EPL_OBD_CREATE_INIT_FUNCTION |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 186 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 187 | #if (defined (EPL_OBD_USER_OD) && (EPL_OBD_USER_OD != FALSE)) |
| 188 | { |
| 189 | // to begin no user OD is defined |
| 190 | pInitParam_p->m_pUserPart = NULL; |
| 191 | } |
| 192 | #endif |
| 193 | } |
| 194 | #define EPL_OBD_CREATE_INIT_SUBINDEX |
| 195 | { |
| 196 | // inserts code to copy subindex tables |
| 197 | #include "objdict.h" |
| 198 | } |
| 199 | #undef EPL_OBD_CREATE_INIT_SUBINDEX |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 200 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 201 | return kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 202 | |
| 203 | } |
| 204 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 205 | #endif // _EPLOBJDEF_H_ |
| 206 | |
| 207 | // Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler |
| 208 | // damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder). |