/home/epimerde/documents/tc11/CanFestival-3/include/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 /* The process_var structure
00030  Used to store the PDO before the transmission or the reception.
00031 */
00032 typedef struct struct_s_process_var {
00033   UNS8 count; /* Size of data. Ex : for a PDO of 6 bytes of data, count = 6 */
00034   /* WARNING s_process_var.data is subject to ENDIANISATION 
00035    * (with respect to CANOPEN_BIG_ENDIAN)
00036    */
00037   UNS8 data[PDO_MAX_LEN];
00038 }s_process_var;
00039 
00040 #include "data.h"
00041 
00043 typedef struct struct_s_PDO {
00044   UNS32 cobId;    /* COB-ID */
00045   UNS8           len;     /* Number of data transmitted (in data[]) */
00046   UNS8           data[8]; /* Contain the data */
00047 }s_PDO;
00048 
00055 UNS8 sendPDO (CO_Data* d, s_PDO pdo, UNS8 request);
00056 
00064 UNS8 PDOmGR (CO_Data* d, UNS32 cobId);
00065 
00071 UNS8 buildPDO (CO_Data* d, UNS16 index);
00072 
00078 UNS8 sendPDOrequest (CO_Data* d, UNS32 cobId);
00079 
00084 UNS8 proceedPDO (CO_Data* d, Message *m);
00085 
00086 /* used by the application to send a variable by PDO.
00087  * Check in which PDO the variable is mapped, and send the PDO. 
00088  * of course, the others variables mapped in the PDO are also sent !
00089  * ( ie when a specific event occured)
00090  * bus_id is hardware dependant
00091  * variable is a pointer to the variable which has to be sent. Must be
00092  * defined in the object dictionary
00093  * return 0xFF if error, else return 0
00094  */
00095 UNS8 sendPDOevent (CO_Data* d, void * variable);
00096 
00097 /* copy bit per bit in little endian */
00098 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian);
00099 #endif

Generated on Mon Jun 4 16:29:06 2007 for CanFestival by  doxygen 1.5.1