pdo.h

Go to the documentation of this file.
00001 /*
00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
00003 
00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
00005 
00006 See COPYING file for copyrights details.
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 #ifndef __pdo_h__
00024 #define __pdo_h__
00025 
00026 #include <applicfg.h>
00027 #include <def.h>
00028 
00029 #include "can.h"
00030 
00031 typedef struct struct_s_PDO_status s_PDO_status;
00032 
00033 #include "data.h"
00034 
00035 /* Status of the TPDO : */
00036 #define PDO_INHIBITED 0x01
00037 #define PDO_RTR_SYNC_READY 0x01
00038 
00040 struct struct_s_PDO_status {
00041   UNS8 transmit_type_parameter;
00042   TIMER_HANDLE event_timer;
00043   TIMER_HANDLE inhibit_timer;
00044   Message last_message;
00045 };
00046 
00047 #define s_PDO_staus_Initializer {0, TIMER_NONE, TIMER_NONE, Message_Initializer}
00048 
00053 #define TRANS_EVERY_N_SYNC(n) (n) /*n = 1 to 240 */
00054 #define TRANS_SYNC_MIN        1    /* Trans after reception of n SYNC. n = 1 to 240 */
00055 #define TRANS_SYNC_MAX        240  /* Trans after reception of n SYNC. n = 1 to 240 */
00056 #define TRANS_RTR_SYNC        252  /* Transmission on request */
00057 #define TRANS_RTR             253  /* Transmission on request */
00058 #define TRANS_EVENT_SPECIFIC  254  /* Transmission on event */
00059 #define TRANS_EVENT_PROFILE   255  /* Transmission on event */
00060 
00069 UNS8 buildPDO(CO_Data* d, UNS8 numPdo, Message *pdo);
00070 
00076 UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex );
00077 
00082 UNS8 proceedPDO (CO_Data* d, Message *m);
00083 
00090 UNS8 sendPDOevent (CO_Data* d);
00091 
00095 UNS8 _sendPDOevent(CO_Data* d, UNS8 isSyncEvent);
00096 
00097 
00098 void PDOInit(CO_Data* d);
00099 void PDOStop(CO_Data* d);
00100 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum);
00101 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum);
00102 
00103 /* copy bit per bit in little endian */
00104 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian);
00105 #endif

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  doxygen 1.5.1