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