include/pdo.h
changeset 528 0a30e161d63c
parent 426 8011552b1319
child 529 c171e11707c5
equal deleted inserted replaced
527:7d5c74cc8f91 528:0a30e161d63c
    18 You should have received a copy of the GNU Lesser General Public
    18 You should have received a copy of the GNU Lesser General Public
    19 License along with this library; if not, write to the Free Software
    19 License along with this library; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 */
    21 */
    22 
    22 
       
    23 /** @defgroup pdo Process Data Object (PDO)
       
    24  *  PDO is a communication object defined by the DPO communication parameter and PDA mapping parameter objects.
       
    25  *  It is an uncomfirmed communication service without protocol overhead.
       
    26  *  @ingroup comobj
       
    27  */
       
    28  
    23 #ifndef __pdo_h__
    29 #ifndef __pdo_h__
    24 #define __pdo_h__
    30 #define __pdo_h__
    25 
    31 
    26 #include <applicfg.h>
    32 #include <applicfg.h>
    27 #include <def.h>
    33 #include <def.h>
    57 #define TRANS_RTR_SYNC        252  /* Transmission on request */
    63 #define TRANS_RTR_SYNC        252  /* Transmission on request */
    58 #define TRANS_RTR             253  /* Transmission on request */
    64 #define TRANS_RTR             253  /* Transmission on request */
    59 #define TRANS_EVENT_SPECIFIC  254  /* Transmission on event */
    65 #define TRANS_EVENT_SPECIFIC  254  /* Transmission on event */
    60 #define TRANS_EVENT_PROFILE   255  /* Transmission on event */
    66 #define TRANS_EVENT_PROFILE   255  /* Transmission on event */
    61 
    67 
    62 /** Prepare the PDO defined at index to be sent 
    68 /**
    63  * 
    69  * @ingroup pdo 
    64  * 
    70  * @brief Copy all the data to transmit in process_var
    65  * 
    71  * Prepare the PDO defined at index to be sent
    66  * Copy all the data to transmit in process_var
       
    67  * *pwCobId : returns the value of the cobid. (subindex 1)
    72  * *pwCobId : returns the value of the cobid. (subindex 1)
    68  * Return 0 or 0xFF if error.
    73  * @param *d Pointer on a CAN object data structure
       
    74  * @param numPdo The PDO number
       
    75  * @param *pdo Pointer on a CAN message structure
       
    76  * @return 0 or 0xFF if error.
    69  */
    77  */
    70 UNS8 buildPDO(CO_Data* d, UNS8 numPdo, Message *pdo);
    78 UNS8 buildPDO(CO_Data* d, UNS8 numPdo, Message *pdo);
    71 
    79 
    72 /** Transmit a PDO request frame on the bus bus_id
    80 /** 
       
    81  * @ingroup pdo
       
    82  * @brief Transmit a PDO request frame on the bus bus_id
    73  * to the slave.
    83  * to the slave.
    74  * bus_id is hardware dependant
    84  * bus_id is hardware dependant
    75  * Returns 0xFF if error, other in success.
    85  * @param *d Pointer on a CAN object data structure
       
    86  * @param RPDOIndex Index of the receive PDO
       
    87  * @return 0xFF if error, other in success.
    76  */
    88  */
    77 UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex );
    89 UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex );
    78 
    90 
    79 /** Compute a PDO frame reception
    91 /**
       
    92  * @brief Compute a PDO frame reception
    80  * bus_id is hardware dependant
    93  * bus_id is hardware dependant
    81  * return 0xFF if error, else return 0
    94  * @param *d Pointer on a CAN object data structure
       
    95  * @param *m Pointer on a CAN message structure
       
    96  * @return 0xFF if error, else return 0
    82  */
    97  */
    83 UNS8 proceedPDO (CO_Data* d, Message *m);
    98 UNS8 proceedPDO (CO_Data* d, Message *m);
    84 
    99 
    85 /** Used by the application to signal changes in process data
   100 /**
       
   101  * @ingroup pdo 
       
   102  * @brief Used by the application to signal changes in process data
    86  * that could be mapped to some TPDO.
   103  * that could be mapped to some TPDO.
    87  * This do not necessarily imply PDO emission.
   104  * This do not necessarily imply PDO emission.
    88  * Function iterates on all TPDO and look TPDO transmit 
   105  * Function iterates on all TPDO and look TPDO transmit 
    89  * type and content change before sending it.    
   106  * type and content change before sending it.    
       
   107  * @param *d Pointer on a CAN object data structure
    90  */
   108  */
    91 UNS8 sendPDOevent (CO_Data* d);
   109 UNS8 sendPDOevent (CO_Data* d);
    92 
   110 
    93 /** Function iterates on all TPDO and look TPDO transmit 
   111 /** 
       
   112  * @ingroup pdo
       
   113  * @brief Function iterates on all TPDO and look TPDO transmit 
    94  * type and content change before sending it.
   114  * type and content change before sending it.
       
   115  * @param *d Pointer on a CAN object data structure
       
   116  * @param isSyncEvent
    95  */
   117  */
    96 UNS8 _sendPDOevent(CO_Data* d, UNS8 isSyncEvent);
   118 UNS8 _sendPDOevent(CO_Data* d, UNS8 isSyncEvent);
    97 
   119 
       
   120 /** 
       
   121  * @ingroup pdo
       
   122  * @brief Initialize PDO feature 
       
   123  * @param *d Pointer on a CAN object data structure
       
   124  */
       
   125 void PDOInit(CO_Data* d);
    98 
   126 
    99 void PDOInit(CO_Data* d);
   127 /** 
       
   128  * @ingroup pdo
       
   129  * @brief Stop PDO feature 
       
   130  * @param *d Pointer on a CAN object data structure
       
   131  */
   100 void PDOStop(CO_Data* d);
   132 void PDOStop(CO_Data* d);
       
   133 
       
   134 /** 
       
   135  * @ingroup pdo
       
   136  * @brief Set timer for PDO event
       
   137  * @param *d Pointer on a CAN object data structure
       
   138  * @param pdoNum The PDO number
       
   139  */
   101 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum);
   140 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum);
       
   141 
       
   142 /** 
       
   143  * @ingroup pdo
       
   144  * @brief Inhibit timer for PDO event
       
   145  * @param *d Pointer on a CAN object data structure
       
   146  * @param pdoNum The PDO number
       
   147  */
   102 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum);
   148 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum);
   103 
   149 
   104 /* copy bit per bit in little endian */
   150 /* copy bit per bit in little endian */
   105 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian);
   151 void CopyBits(UNS8 NbBits, UNS8* SrcByteIndex, UNS8 SrcBitIndex, UNS8 SrcBigEndian, UNS8* DestByteIndex, UNS8 DestBitIndex, UNS8 DestBigEndian);
   106 #endif
   152 #endif