include/sdo.h
author Christian Taedcke
Wed, 10 Nov 2010 13:08:26 +0100
changeset 655 ea1ddcc77acf
parent 636 033fe6f1ec3c
child 656 f923456f01e5
permissions -rwxr-xr-x
CHANGED: - canSend message parameter is now a const pointer
ADDED : - IXXAT specific can bus watchdog to restart the VCI2 driver if a bus off, data ovverrun or remote queue overrun is detected. The can adapter cannot recover on its own.
* * *
CHANGED: - IXXAT::m_watchdogTimerId from DWORD to UINT_PTR to fix compiler warning
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    23
/** @defgroup comobj Communication Objects
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    24
 *  @ingroup userapi
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    25
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    26
 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    27
/** @defgroup sdo Service Data Object (SDO)
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    28
 *  SDOs provide the access to entries in the CANopen Object Dictionary.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    29
 * 	An SDO is made up of at least two CAN messages with different identifiers.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    30
 * 	SDO s are always confirmed point-to-point communications services. 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    31
 *  @ingroup comobj
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    32
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    33
 
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    34
#ifndef __sdo_h__
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
#define __sdo_h__
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    37
struct struct_s_transfer;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
#include "timer.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    40
32
8afa33692372 SDO callbacks.
etisserant
parents: 0
diff changeset
    41
typedef void (*SDOCallback_t)(CO_Data* d, UNS8 nodeId);
8afa33692372 SDO callbacks.
etisserant
parents: 0
diff changeset
    42
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    43
/* The Transfer structure
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    44
Used to store the different segments of
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    45
 - a SDO received before writing in the dictionary
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    46
 - the reading of the dictionary to put on a SDO to transmit
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    47
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    49
struct struct_s_transfer {
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    50
  UNS8           nodeId;     /**<own ID if server, or node ID of the server if client */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    51
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    52
  UNS8           whoami;     /**< Takes the values SDO_CLIENT or SDO_SERVER */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    53
  UNS8           state;      /**< state of the transmission : Takes the values SDO_... */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    54
  UNS8           toggle;	
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    55
  UNS32          abortCode;  /**< Sent or received */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    56
  /**< index and subindex of the dictionary where to store */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    57
  /**< (for a received SDO) or to read (for a transmit SDO) */
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    58
  UNS16          index;
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    59
  UNS8           subIndex;
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    60
  UNS32          count;      /**< Number of data received or to be sent. */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    61
  UNS32          offset;     /**< stack pointer of data[]
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    62
                              * Used only to tranfer part of a line to or from a SDO.
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    63
                              * offset is always pointing on the next free cell of data[].
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    64
                              * WARNING s_transfer.data is subject to ENDIANISATION
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    65
                              * (with respect to CANOPEN_BIG_ENDIAN)
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    66
                              */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    67
  UNS8           data [SDO_MAX_LENGTH_TRANSFERT];
636
033fe6f1ec3c ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents: 561
diff changeset
    68
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
033fe6f1ec3c ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents: 561
diff changeset
    69
  UNS8           *dynamicData;
033fe6f1ec3c ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents: 561
diff changeset
    70
  UNS32          dynamicDataSize;
033fe6f1ec3c ADDED: - dynamic memory allocation for sdo transfer using malloc and free
Christian Taedcke
parents: 561
diff changeset
    71
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    72
  UNS8           dataType;   /**< Defined in objdictdef.h Value is visible_string
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    73
                              * if it is a string, any other value if it is not a string,
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    74
                              * like 0. In fact, it is used only if client.
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    75
                              */
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    76
  TIMER_HANDLE   timer;      /**< Time counter to implement a timeout in milliseconds.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    77
                              * It is automatically incremented whenever
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    78
                              * the line state is in SDO_DOWNLOAD_IN_PROGRESS or
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    79
                              * SDO_UPLOAD_IN_PROGRESS, and reseted to 0
74
c0b4b2ef7579 compiler compatibility : comments
frdupin
parents: 71
diff changeset
    80
                              * when the response SDO have been received.
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    81
                              */
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    82
  SDOCallback_t Callback;   /**< The user callback func to be called at SDO transaction end */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
typedef struct struct_s_transfer s_transfer;
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
    85
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    86
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    87
#include "data.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    88
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    89
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    90
struct BODY{
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    91
    UNS8 data[8]; /**< The 8 bytes data of the SDO */
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    92
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    93
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 53
diff changeset
    94
/* The SDO structure ...*/
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    95
struct struct_s_SDO {
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
    96
  UNS8 nodeId;		/**< In any case, Node ID of the server (case sender or receiver).*/
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    97
  struct BODY body;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    98
};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    99
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   100
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   101
typedef struct struct_s_SDO s_SDO;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   102
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   103
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   104
 * @brief Reset of a SDO exchange on timeout.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   105
 * Send a SDO abort.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   106
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   107
 * @param id
53
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   108
 */
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   109
void SDOTimeoutAlarm(CO_Data* d, UNS32 id);
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   110
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   111
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   112
 * @brief Reset all SDO buffers.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   113
 * @param *d Pointer on a CAN object data structure
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   114
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   115
void resetSDO (CO_Data* d);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   116
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   117
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   118
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   119
 * @brief Copy the data received from the SDO line transfert to the object dictionary.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   120
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   121
 * @param line SDO line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   122
 * @return SDO error code if error. Else, returns 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   123
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   124
UNS32 SDOlineToObjdict (CO_Data* d, UNS8 line);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   125
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   126
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   127
 * @brief Copy the data from the object dictionary to the SDO line for a network transfert.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   128
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   129
 * @param line SDO line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   130
 * @return SDO error code if error. Else, returns 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   131
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   132
UNS32 objdictToSDOline (CO_Data* d, UNS8 line);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   133
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   134
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   135
 * @brief Copy data from an existant line in the argument "* data"
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   136
 * @param d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   137
 * @param line SDO line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   138
 * @param nbBytes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   139
 * @param *data Pointer on the data
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   140
 * @return 0xFF if error. Else, returns 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   141
 */
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   142
UNS8 lineToSDO (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   144
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   145
 * @brief Add data to an existant line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   146
 * @param d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   147
 * @param line SDO line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   148
 * @param nbBytes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   149
 * @param *data Pointer on the data
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   150
 * @return 0xFF if error. Else, returns 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   151
 */
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   152
UNS8 SDOtoLine (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   153
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   154
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   155
 * @brief Called when an internal SDO abort occurs.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   156
 * Release the line * Only if server *
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   157
 * If client, the line must be released manually in the core application.
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   158
 * The reason of that is to permit the program to read the transfers structure before its reset,
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   159
 * because many informations are stored on it : index, subindex, data received or trasmited, ...
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   160
 * In all cases, sends a SDO abort.
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   161
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   162
 * @param nodeId
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   163
 * @param whoami
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   164
 * @param index
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   165
 * @param subIndex
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   166
 * @param abortCode
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   167
 * @return 0
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   168
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   169
UNS8 failedSDO (CO_Data* d, UNS8 nodeId, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode);
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   170
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   171
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   172
 * @brief Reset an unused line.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   173
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   174
 * @param line SDO line
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   175
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   176
void resetSDOline (CO_Data* d, UNS8 line);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   177
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   178
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   179
 * @brief Initialize some fields of the structure.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   180
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   181
 * @param line
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   182
 * @param nodeId
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   183
 * @param index
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   184
 * @param subIndex
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   185
 * @param state
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   186
 * @return 0
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   187
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
UNS8 initSDOline (CO_Data* d, UNS8 line, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 state);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   190
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   191
 * @brief Search for an unused line in the transfers array
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
 * to store a new SDO.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
 * ie a line which value of the field "state" is "SDO_RESET"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
 * An unused line have the field "state" at the value SDO_RESET
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   195
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   196
 * @param whoami Create the line for a SDO_SERVER or SDO_CLIENT.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   197
 * @param *line Pointer on a SDO line 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   198
 * @return 0xFF if all the lines are on use. Else, return 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   200
UNS8 getSDOfreeLine (CO_Data* d, UNS8 whoami, UNS8 *line);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   201
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   202
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   203
 * @brief Search for the line, in the transfers array, which contains the
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   204
 * beginning of the reception of a fragmented SDO
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   205
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   206
 * @param nodeId correspond to the message node-id
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   207
 * @param whoami takes 2 values : look for a line opened as SDO_CLIENT or SDO_SERVER
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   208
 * @param *line Pointer on a SDO line 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   209
 * @return 0xFF if error.  Else, return 0
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   210
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   211
UNS8 getSDOlineOnUse (CO_Data* d, UNS8 nodeId, UNS8 whoami, UNS8 *line);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   212
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   213
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   214
 * @brief Close a transmission.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   215
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   216
 * @param nodeId Node id of the server if both server or client
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   217
 * @param whoami Line opened as SDO_CLIENT or SDO_SERVER
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   218
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   219
UNS8 closeSDOtransfer (CO_Data* d, UNS8 nodeId, UNS8 whoami);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   220
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   221
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   222
 * @brief Bytes in the line structure which must be transmited (or received)
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   223
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   224
 * @param line SDO line 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   225
 * @param *nbBytes Pointer on nbBytes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   226
 * @return 0.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   227
 */
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   228
UNS8 getSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 * nbBytes);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   229
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   230
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   231
 * @brief Store in the line structure the nb of bytes which must be transmited (or received)
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   232
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   233
 * @param line SDO line 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   234
 * @param nbBytes
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   235
 * @return 0 if success, 0xFF if error.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   236
 */
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   237
UNS8 setSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 nbBytes);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   238
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   239
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   240
 * @brief Transmit a SDO frame on the bus bus_id
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   241
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   242
 * @param whoami Takes 2 values : SDO_CLIENT or SDO_SERVER
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   243
 * @param sdo SDO Structure which contains the sdo to transmit
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   244
 * @return canSend(bus_id,&m) or 0xFF if error.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   245
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   246
UNS8 sendSDO (CO_Data* d, UNS8 whoami, s_SDO sdo);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   247
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   248
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   249
 * @brief Transmit a SDO error to the client. The reasons may be :
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   250
 * Read/Write to a undefined object
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   251
 * Read/Write to a undefined subindex
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   252
 * Read/write a not valid length object
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   253
 * Write a read only object
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   254
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   255
 * @param whoami takes 2 values : SDO_CLIENT or SDO_SERVER
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   256
 * @param nodeId
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   257
 * @param index
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   258
 * @param subIndex
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   259
 * @param abortCode
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   260
 * @return 0
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   261
 */
499
061f12bd838b getReadResultNetworkDict now returns abortcode. Now, abort message should be sent correctly from client.
etisserant
parents: 172
diff changeset
   262
UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 abortCode);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   263
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   264
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   265
 * @brief Treat a SDO frame reception
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   266
 * call the function sendSDO
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   267
 * @param *d Pointer on a CAN object data structure
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   268
 * @param *m Pointer on a CAN message structure 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   269
 * @return code : 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   270
 * 		   - 0xFF if error
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   271
 *         - 0x80 if transfert aborted by the server
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   272
 *         - 0x0  ok
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   273
 */
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   274
UNS8 proceedSDO (CO_Data* d, Message *m);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   275
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   276
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   277
 * @ingroup sdo
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   278
 * @brief Used to send a SDO request frame to write the data at the index and subIndex indicated
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   279
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   280
 * @param nodeId Node Id of the slave
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   281
 * @param index At index indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   282
 * @param subIndex At subIndex indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   283
 * @param count number of bytes to write in the dictionnary.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   284
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   285
 * @param *data Pointer to data
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   286
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   287
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   288
 * - 0xFE is returned when no sdo client to communicate with node.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   289
 * - 0xFF is returned when error occurs.
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   290
 */
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   291
UNS8 writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index,
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   292
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   293
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   294
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   295
 * @ingroup sdo
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   296
 * @brief Used to send a SDO request frame to write in a distant node dictionnary.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   297
 * @details The function Callback which must be defined in the user code is called at the
53
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   298
 * end of the exchange. (on succes or abort).
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   299
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   300
 * @param nodeId Node Id of the slave
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   301
 * @param index At index indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   302
 * @param subIndex At subIndex indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   303
 * @param count number of bytes to write in the dictionnary.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   304
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   305
 * @param *data Pointer to data
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   306
 * @param Callback Callback function
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   307
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   308
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   309
 * - 0xFE is returned when no sdo client to communicate with node.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   310
 * - 0xFF is returned when error occurs.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   311
 */
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   312
UNS8 writeNetworkDictCallBack (CO_Data* d, UNS8 nodeId, UNS16 index,
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   313
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   314
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   315
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   316
 * @ingroup sdo 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   317
 * @brief Used to send a SDO request frame to write in a distant node dictionnary.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   318
 * @details The function Callback which must be defined in the user code is called at the
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   319
 * end of the exchange. (on succes or abort). First free SDO client parameter is
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   320
 * automatically initialized for specific node if not already defined.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   321
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   322
 * @param nodeId Node Id of the slave
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   323
 * @param index At index indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   324
 * @param subIndex At subIndex indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   325
 * @param count number of bytes to write in the dictionnary.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   326
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   327
 * @param *data Pointer to data
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   328
 * @param Callback Callback function
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   329
 * @param endianize When not 0, data is endianized into network byte order
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   330
 *                  when 0, data is not endianized and copied in machine native
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   331
 *                  endianness
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   332
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   333
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   334
 * - 0xFF is returned when error occurs.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   335
 */
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   336
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index,
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   337
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize);
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   338
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   339
/**
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   340
 * @ingroup sdo 
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   341
 * @brief Used to send a SDO request frame to read.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   342
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   343
 * @param nodeId Node Id of the slave
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   344
 * @param index At index indicated
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   345
 * @param subIndex At subIndex indicated
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   346
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   347
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   348
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   349
 * - 0xFE is returned when no sdo client to communicate with node.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   350
 * - 0xFF is returned when error occurs.
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   351
 */
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   352
UNS8 readNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType);
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   353
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   354
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   355
 * @ingroup sdo
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   356
 * @brief Used to send a SDO request frame to read in a distant node dictionnary.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   357
 * @details The function Callback which must be defined in the user code is called at the
53
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   358
 * end of the exchange. (on succes or abort).
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   359
 * @param *d Pointer on a CAN object data structure
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   360
 * @param nodeId Node Id of the slave
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   361
 * @param index At index indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   362
 * @param subIndex At subIndex indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   363
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   364
 * @param Callback Callback function
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   365
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   366
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   367
 * - 0xFE is returned when no sdo client to communicate with node.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   368
 * - 0xFF is returned when error occurs.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   369
 */
53
73bc47a0db55 Add prototypes
frdupin
parents: 32
diff changeset
   370
UNS8 readNetworkDictCallback (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   371
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   372
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   373
 * @ingroup sdo
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   374
 * @brief Used to send a SDO request frame to read in a distant node dictionnary.
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   375
 * @details The function Callback which must be defined in the user code is called at the
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   376
 * end of the exchange. (on succes or abort). First free SDO client parameter is
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   377
 * automatically initialized for specific node if not already defined.
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   378
 * @param *d Pointer on a CAN object data structure
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   379
 * @param nodeId Node Id of the slave
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   380
 * @param index At index indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   381
 * @param subIndex At subIndex indicated
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   382
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   383
 * @param Callback Callback function
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   384
 * @return 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   385
 * - 0 is returned upon success.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   386
 * - 0xFF is returned when error occurs.
506
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   387
 */
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   388
UNS8 readNetworkDictCallbackAI (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback);
c17e2e17aca8 Patch from Jari K. implementing automatic SDO clien allocation, and add a new interface for (read/write)networkdict.
etisserant
parents: 499
diff changeset
   389
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   390
/** 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   391
 * @ingroup sdo
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   392
 * @brief Use this function after calling readNetworkDict to get the result.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   393
 * 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   394
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   395
 * @param nodeId Node Id of the slave
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   396
 * @param *data Pointer to the datas
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   397
 * @param *size Pointer to the size
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   398
 * @param *abortCode Pointer to the abortcode. (0 = not available. Else : SDO abort code. (received if return SDO_ABORTED_RCV)
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   399
 * 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   400
 * 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   401
 * @return
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   402
 *           - SDO_FINISHED             // datas are available
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   403
 *           - SDO_ABORTED_RCV          // Transfert failed (abort SDO received)
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   404
 *           - SDO_ABORTED_INTERNAL     // Transfert failed (internal abort)
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   405
 *           - SDO_UPLOAD_IN_PROGRESS   // Datas are not yet available
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   406
 *           - SDO_DOWNLOAD_IN_PROGRESS // Download is in progress
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   407
 * \n\n
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   408
 * example :
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   409
 * @code
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   410
 * UNS32 data;
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   411
 * UNS8 size;
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   412
 * readNetworkDict(0, 0x05, 0x1016, 1, 0) // get the data index 1016 subindex 1 of node 5
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   413
 * while (getReadResultNetworkDict (0, 0x05, &data, &size) == SDO_UPLOAD_IN_PROGRESS);
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   414
 * @endcode
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   415
*/
539
187058b4a4b8 Changed OD size from UNS8 to UNS32, and repercuted change to PDO and SDO. Thanks to Jari Kuusisto for patch.
etisserant
parents: 529
diff changeset
   416
UNS8 getReadResultNetworkDict (CO_Data* d, UNS8 nodeId, void* data, UNS32 *size, UNS32 * abortCode);
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   417
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   418
/**
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   419
 * @ingroup sdo
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   420
 * @brief Use this function after calling writeNetworkDict function to get the result of the write.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   421
 * @details It is mandatory to call this function because it is releasing the line used for the transfer.
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   422
 * @param *d Pointer to a CAN object data structure
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   423
 * @param nodeId Node Id of the slave
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   424
 * @param *abortCode Pointer to the abortcode
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   425
 * - 0 = not available. 
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   426
 * - SDO abort code (received if return SDO_ABORTED_RCV)
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   427
 * 
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   428
 * @return : 
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   429
 *           - SDO_FINISHED             // datas are available
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   430
 *           - SDO_ABORTED_RCV          // Transfert failed (abort SDO received)
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   431
 *           - SDO_ABORTED_INTERNAL     // Transfert failed (Internal abort)
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   432
 *           - SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   433
 *           - SDO_UPLOAD_IN_PROGRESS   // Upload in progress
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   434
 * \n\n
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   435
 * example :
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   436
 * @code
528
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   437
 * UNS32 data = 0x50;
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   438
 * UNS8 size;
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   439
 * UNS32 abortCode;
0a30e161d63c Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 506
diff changeset
   440
 * writeNetworkDict(0, 0x05, 0x1016, 1, size, &data) // write the data index 1016 subindex 1 of node 5
561
f9be4262c68d Add doxygen comments in headers file
greg
parents: 539
diff changeset
   441
 * while (getWriteResultNetworkDict (0, 0x05, &abortCode) == SDO_DOWNLOAD_IN_PROGRESS);
529
c171e11707c5 Second time, Re-write doxygen tags in headers files to generate User API documentation
greg
parents: 528
diff changeset
   442
 * @endcode
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   443
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   444
UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   445
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   446
#endif