nico@207: nico@207:
nico@207:00001 /* nico@207: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. nico@207: 00003 nico@207: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN nico@207: 00005 nico@207: 00006 See COPYING file for copyrights details. nico@207: 00007 nico@207: 00008 This library is free software; you can redistribute it and/or nico@207: 00009 modify it under the terms of the GNU Lesser General Public nico@207: 00010 License as published by the Free Software Foundation; either nico@207: 00011 version 2.1 of the License, or (at your option) any later version. nico@207: 00012 nico@207: 00013 This library is distributed in the hope that it will be useful, nico@207: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of nico@207: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@207: 00016 Lesser General Public License for more details. nico@207: 00017 nico@207: 00018 You should have received a copy of the GNU Lesser General Public nico@207: 00019 License along with this library; if not, write to the Free Software nico@207: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA nico@207: 00021 */ nico@207: 00022 nico@207: 00023 #ifndef __pdo_h__ nico@207: 00024 #define __pdo_h__ nico@207: 00025 nico@207: 00026 #include <applicfg.h> nico@207: 00027 #include <def.h> nico@207: 00028 nico@207: 00029 /* The process_var structure nico@207: 00030 Used to store the PDO before the transmission or the reception. nico@207: 00031 */ nico@207: 00032 typedef struct struct_s_process_var { nico@207: 00033 UNS8 count; /* Size of data. Ex : for a PDO of 6 bytes of data, count = 6 */ nico@207: 00034 /* WARNING s_process_var.data is subject to ENDIANISATION nico@207: 00035 * (with respect to CANOPEN_BIG_ENDIAN) nico@207: 00036 */ nico@207: 00037 UNS8 data[PDO_MAX_LEN]; nico@207: 00038 }s_process_var; nico@207: 00039 nico@207: 00040 #include "data.h" nico@207: 00041 nico@207: 00043 typedef struct struct_s_PDO { nico@207: 00044 UNS32 cobId; /* COB-ID */ nico@207: 00045 UNS8 len; /* Number of data transmitted (in data[]) */ nico@207: 00046 UNS8 data[8]; /* Contain the data */ nico@207: 00047 }s_PDO; nico@207: 00048 nico@207: 00055 UNS8 sendPDO (CO_Data* d, s_PDO pdo, UNS8 request); nico@207: 00056 nico@207: 00064 UNS8 PDOmGR (CO_Data* d, UNS32 cobId); nico@207: 00065 nico@207: 00071 UNS8 buildPDO (CO_Data* d, UNS16 index); nico@207: 00072 nico@207: 00078 UNS8 sendPDOrequest (CO_Data* d, UNS32 cobId); nico@207: 00079 nico@207: 00084 UNS8 proceedPDO (CO_Data* d, Message *m); nico@207: 00085 nico@207: 00086 /* used by the application to send a variable by PDO. nico@207: 00087 * Check in which PDO the variable is mapped, and send the PDO. nico@207: 00088 * of course, the others variables mapped in the PDO are also sent ! nico@207: 00089 * ( ie when a specific event occured) nico@207: 00090 * bus_id is hardware dependant nico@207: 00091 * variable is a pointer to the variable which has to be sent. Must be nico@207: 00092 * defined in the object dictionary nico@207: 00093 * return 0xFF if error, else return 0 nico@207: 00094 */ nico@207: 00095 UNS8 sendPDOevent (CO_Data* d, void * variable); nico@207: 00096 nico@207: 00097 /* copy bit per bit in little endian */ nico@207: 00098 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian); nico@207: 00099 #endif nico@207: