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 etisserant@240: 00029 #include "can.h" etisserant@240: 00030 etisserant@240: 00031 typedef struct struct_s_PDO_status s_PDO_status; etisserant@240: 00032 etisserant@240: 00033 #include "data.h" etisserant@240: 00034 etisserant@240: 00035 /* Status of the TPDO : */ etisserant@240: 00036 #define PDO_INHIBITED 0x01 etisserant@240: 00037 #define PDO_RTR_SYNC_READY 0x01 etisserant@240: 00038 etisserant@240: 00040 struct struct_s_PDO_status { etisserant@240: 00041 UNS8 transmit_type_parameter; etisserant@240: 00042 TIMER_HANDLE event_timer; etisserant@240: 00043 TIMER_HANDLE inhibit_timer; etisserant@240: 00044 Message last_message; etisserant@240: 00045 }; etisserant@240: 00046 etisserant@240: 00047 #define s_PDO_staus_Initializer {0, TIMER_NONE, TIMER_NONE, Message_Initializer} etisserant@240: 00048 etisserant@240: 00053 #define TRANS_EVERY_N_SYNC(n) (n) /*n = 1 to 240 */ etisserant@240: 00054 #define TRANS_SYNC_MIN 1 /* Trans after reception of n SYNC. n = 1 to 240 */ etisserant@240: 00055 #define TRANS_SYNC_MAX 240 /* Trans after reception of n SYNC. n = 1 to 240 */ etisserant@240: 00056 #define TRANS_RTR_SYNC 252 /* Transmission on request */ etisserant@240: 00057 #define TRANS_RTR 253 /* Transmission on request */ etisserant@240: 00058 #define TRANS_EVENT_SPECIFIC 254 /* Transmission on event */ etisserant@240: 00059 #define TRANS_EVENT_PROFILE 255 /* Transmission on event */ etisserant@240: 00060 etisserant@240: 00069 UNS8 buildPDO(CO_Data* d, UNS8 numPdo, Message *pdo); etisserant@240: 00070 etisserant@240: 00076 UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex ); etisserant@240: 00077 etisserant@240: 00082 UNS8 proceedPDO (CO_Data* d, Message *m); etisserant@240: 00083 etisserant@240: 00090 UNS8 sendPDOevent (CO_Data* d); etisserant@240: 00091 etisserant@240: 00095 UNS8 _sendPDOevent(CO_Data* d, UNS8 isSyncEvent); nico@215: 00096 etisserant@240: 00097 etisserant@240: 00098 void PDOInit(CO_Data* d); etisserant@240: 00099 void PDOStop(CO_Data* d); etisserant@240: 00100 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum); etisserant@240: 00101 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum); etisserant@240: 00102 etisserant@240: 00103 /* copy bit per bit in little endian */ etisserant@240: 00104 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian); etisserant@240: 00105 #endif etisserant@240: