Lely core libraries 2.3.4
|
This file is part of the CANopen library; it contains the implementation of the Client-SDO functions. More...
#include "co.h"
#include "sdo.h"
#include <lely/co/crc.h>
#include <lely/co/csdo.h>
#include <lely/co/dev.h>
#include <lely/co/obj.h>
#include <lely/co/val.h>
#include <lely/util/endian.h>
#include <lely/util/errnum.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | co_csdo_dn_dcf |
The state of a concise DCF download request. More... | |
struct | __co_csdo |
A CANopen Client-SDO. More... | |
struct | __co_csdo_state |
A CANopen Client-SDO state. More... | |
Typedefs | |
typedef const struct __co_csdo_state | co_csdo_state_t |
An opaque CANopen Client-SDO state type. | |
Functions | |
static int | co_csdo_update (co_csdo_t *sdo) |
Updates and (de)activates a Client-SDO service. | |
static co_unsigned32_t | co_1280_dn_ind (co_sub_t *sub, struct co_sdo_req *req, void *data) |
The download indication function for (all sub-objects of) CANopen objects 1280..12FF (SDO client parameter). | |
static int | co_csdo_recv (const struct can_msg *msg, void *data) |
The CAN receive callback function for a Client-SDO service. | |
static int | co_csdo_timer (const struct timespec *tp, void *data) |
The CAN timer callback function for a Client-SDO service. | |
static void | co_csdo_enter (co_csdo_t *sdo, co_csdo_state_t *next) |
Enters the specified state of a Client-SDO service and invokes the exit and entry functions. | |
static void | co_csdo_emit_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
Invokes the 'abort' transition function of the current state of a Client-SDO service. | |
static void | co_csdo_emit_time (co_csdo_t *sdo, const struct timespec *tp) |
Invokes the 'timeout' transition function of the current state of a Client-SDO service. | |
static void | co_csdo_emit_recv (co_csdo_t *sdo, const struct can_msg *msg) |
Invokes the 'CAN frame received' transition function of the current state of a Client-SDO service. | |
static co_csdo_state_t * | co_csdo_stopped_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'stopped' state. | |
static co_csdo_state_t * | co_csdo_wait_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'waiting' state. | |
static co_csdo_state_t * | co_csdo_wait_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'waiting' state. | |
static co_csdo_state_t * | co_csdo_abort_on_enter (co_csdo_t *sdo) |
The entry function of the 'abort transfer' state. | |
static void | co_csdo_abort_on_leave (co_csdo_t *sdo) |
The exit function of the 'abort transfer' state. | |
static co_csdo_state_t * | co_csdo_dn_ini_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'download initiate' state. | |
static co_csdo_state_t * | co_csdo_dn_ini_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'download initiate' state. | |
static co_csdo_state_t * | co_csdo_dn_ini_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'download initiate' state. | |
static co_csdo_state_t * | co_csdo_dn_seg_on_enter (co_csdo_t *sdo) |
The entry function of the 'download segment' state. | |
static co_csdo_state_t * | co_csdo_dn_seg_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'download segment' state. | |
static co_csdo_state_t * | co_csdo_dn_seg_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'download segment' state. | |
static co_csdo_state_t * | co_csdo_dn_seg_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'download segment' state. | |
static co_csdo_state_t * | co_csdo_up_ini_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'upload initiate' state. | |
static co_csdo_state_t * | co_csdo_up_ini_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'upload initiate' state. | |
static co_csdo_state_t * | co_csdo_up_ini_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'upload initiate' state. | |
static co_csdo_state_t * | co_csdo_up_seg_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'upload segment' state. | |
static co_csdo_state_t * | co_csdo_up_seg_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'upload segment' state. | |
static co_csdo_state_t * | co_csdo_up_seg_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'upload segment' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_ini_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block download initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_ini_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block download initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_ini_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block download initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_sub_on_enter (co_csdo_t *sdo) |
The entry function of the 'block download sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_sub_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block download sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_sub_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block download sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_sub_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block download sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_end_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block download end' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_end_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block download end' state. | |
static co_csdo_state_t * | co_csdo_blk_dn_end_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block download end' state. | |
static co_csdo_state_t * | co_csdo_blk_up_ini_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block upload initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_up_ini_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block upload initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_up_ini_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block upload initiate' state. | |
static co_csdo_state_t * | co_csdo_blk_up_sub_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block upload sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_up_sub_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block upload sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_up_sub_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block upload sub-block' state. | |
static co_csdo_state_t * | co_csdo_blk_up_end_on_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
The 'abort' transition function of the 'block upload end' state. | |
static co_csdo_state_t * | co_csdo_blk_up_end_on_time (co_csdo_t *sdo, const struct timespec *tp) |
The 'timeout' transition function of the 'block upload end' state. | |
static co_csdo_state_t * | co_csdo_blk_up_end_on_recv (co_csdo_t *sdo, const struct can_msg *msg) |
The 'CAN frame received' transition function of the 'block upload end' state. | |
static co_csdo_state_t * | co_csdo_abort_ind (co_csdo_t *sdo, co_unsigned32_t ac) |
Processes an abort transfer indication by aborting any ongoing transfer of a Client-SDO and returning it to the waiting state after notifying the user. | |
static co_csdo_state_t * | co_csdo_abort_res (co_csdo_t *sdo, co_unsigned32_t ac) |
Sends an abort transfer request and aborts any ongoing transfer by invoking co_csdo_abort_ind(). | |
static int | co_csdo_dn_ind (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Processes a download request from a Client-SDO by checking and updating the state and copying the value to the internal buffer. | |
static int | co_csdo_up_ind (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, struct membuf *buf, co_csdo_up_con_t *con, void *data) |
Processes an upload request from a Client-SDO by checking and updating the state. | |
static void | co_csdo_send_abort (co_csdo_t *sdo, co_unsigned32_t ac) |
Sends an abort transfer request. | |
static void | co_csdo_send_dn_exp_req (co_csdo_t *sdo) |
Sends a Client-SDO 'download initiate' (expedited) request. | |
static void | co_csdo_send_dn_ini_req (co_csdo_t *sdo) |
Sends a Client-SDO 'download initiate' request. | |
static void | co_csdo_send_dn_seg_req (co_csdo_t *sdo, co_unsigned32_t n, int last) |
Sends a Client-SDO 'download segment' request. | |
static void | co_csdo_send_up_ini_req (co_csdo_t *sdo) |
Sends a Client-SDO 'upload initiate' request. | |
static void | co_csdo_send_up_seg_req (co_csdo_t *sdo) |
Sends a Client-SDO 'upload segment' request. | |
static void | co_csdo_send_blk_dn_ini_req (co_csdo_t *sdo) |
Sends a Client-SDO 'block download initiate' request. | |
static void | co_csdo_send_blk_dn_sub_req (co_csdo_t *sdo, co_unsigned8_t seqno) |
Sends a Client-SDO 'block download sub-block' request. | |
static void | co_csdo_send_blk_dn_end_req (co_csdo_t *sdo) |
Sends a Client-SDO 'block download end' request. | |
static void | co_csdo_send_blk_up_ini_req (co_csdo_t *sdo, co_unsigned8_t pst) |
Sends a Client-SDO 'block upload initiate' request. | |
static void | co_csdo_send_start_up_req (co_csdo_t *sdo) |
Sends a Client-SDO 'start upload' request. | |
static void | co_csdo_send_blk_up_sub_res (co_csdo_t *sdo) |
Sends a Client-SDO 'block upload sub-block' response. | |
static void | co_csdo_send_blk_up_end_res (co_csdo_t *sdo) |
Sends a Client-SDO 'block upload end' response. | |
static void | co_csdo_init_ini_req (co_csdo_t *sdo, struct can_msg *msg, co_unsigned8_t cs) |
Initializes a Client-SDO download/upload initiate request CAN frame. | |
static void | co_csdo_init_seg_req (co_csdo_t *sdo, struct can_msg *msg, co_unsigned8_t cs) |
Initializes a Client-SDO download/upload segment request CAN frame. | |
static void | co_csdo_dn_dcf_dn_con (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, void *data) |
The confirmation function of a single SDO download request during a concise DCF download. | |
int | co_dev_dn_req (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a local device. | |
int | co_dev_dn_val_req (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a local device. | |
int | co_dev_dn_dcf_req (co_dev_t *dev, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data) |
Submits a series of download requests to a local device. | |
int | co_dev_up_req (const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data) |
Submits an upload request to a local device. | |
co_csdo_t * | co_csdo_create (can_net_t *net, co_dev_t *dev, co_unsigned8_t num) |
Creates a new CANopen Client-SDO service. | |
void | co_csdo_destroy (co_csdo_t *csdo) |
Destroys a CANopen Client-SDO service. | |
int | co_csdo_start (co_csdo_t *sdo) |
Starts a Client-SDO service. | |
void | co_csdo_stop (co_csdo_t *sdo) |
Stops a Client-SDO service. | |
int | co_csdo_is_stopped (const co_csdo_t *sdo) |
Retuns 1 if the specified Client-SDO service is stopped, and 0 if not. | |
can_net_t * | co_csdo_get_net (const co_csdo_t *sdo) |
Returns a pointer to the CAN network of a Client-SDO. | |
co_dev_t * | co_csdo_get_dev (const co_csdo_t *sdo) |
Returns a pointer to the CANopen device of a Client-SDO. | |
co_unsigned8_t | co_csdo_get_num (const co_csdo_t *sdo) |
Returns the SDO number of a Client-SDO. | |
const struct co_sdo_par * | co_csdo_get_par (const co_csdo_t *sdo) |
Returns a pointer to the SDO parameter record of a Client-SDO. | |
int | co_csdo_get_timeout (const co_csdo_t *sdo) |
Returns the timeout (in milliseconds) of a Client-SDO. | |
void | co_csdo_set_timeout (co_csdo_t *sdo, int timeout) |
Sets the timeout of a Client-SDO. | |
void | co_csdo_get_dn_ind (const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata) |
Retrieves the indication function used to notify the user of the progress of the current SDO download request. | |
void | co_csdo_set_dn_ind (co_csdo_t *sdo, co_csdo_ind_t *ind, void *data) |
Sets the indication function used to notify the user of the progress of the current SDO download request. | |
void | co_csdo_get_up_ind (const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata) |
Retrieves the indication function used to notify the user of the progress of the current SDO upload request. | |
void | co_csdo_set_up_ind (co_csdo_t *sdo, co_csdo_ind_t *ind, void *data) |
Sets the indication function used to notify the user of the progress of the current SDO upload request. | |
int | co_csdo_is_valid (const co_csdo_t *sdo) |
Returns 1 of the COB-IDs of the specified Client-SDO service are valid, and 0 if not. | |
int | co_csdo_is_idle (const co_csdo_t *sdo) |
Returns 1 if the specified Client-SDO service is idle, and 0 if a transfer is ongoing. | |
void | co_csdo_abort_req (co_csdo_t *sdo, co_unsigned32_t ac) |
Submits an abort transfer request to a remote Server-SDO. | |
int | co_csdo_dn_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a remote Server-SDO. | |
int | co_csdo_dn_val_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a remote Server-SDO. | |
int | co_csdo_dn_dcf_req (co_csdo_t *sdo, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data) |
Submits a series of download requests to a remote Server-SDO. | |
int | co_csdo_up_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data) |
Submits an upload request to a remote Server-SDO. | |
int | co_csdo_blk_dn_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a block download request to a remote Server-SDO. | |
int | co_csdo_blk_dn_val_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a block download request to a remote Server-SDO. | |
int | co_csdo_blk_up_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned8_t pst, co_csdo_up_con_t *con, void *data) |
Submits a block upload request to a remote Server-SDO. | |
Variables | |
static co_csdo_state_t *const | co_csdo_stopped_state = &(co_csdo_state_t){ .on_abort = &co_csdo_stopped_on_abort } |
The 'stopped' state. | |
static co_csdo_state_t *const | co_csdo_wait_state = &(co_csdo_state_t){ .on_abort = &co_csdo_wait_on_abort, .on_recv = &co_csdo_wait_on_recv } |
The 'waiting' state. | |
static co_csdo_state_t *const | co_csdo_abort_state = &(co_csdo_state_t){ .on_enter = &co_csdo_abort_on_enter, .on_leave = &co_csdo_abort_on_leave } |
The 'abort transfer' state. | |
static co_csdo_state_t *const | co_csdo_dn_ini_state = &(co_csdo_state_t){ .on_abort = &co_csdo_dn_ini_on_abort, .on_time = &co_csdo_dn_ini_on_time, .on_recv = &co_csdo_dn_ini_on_recv } |
The 'download initiate' state. | |
static co_csdo_state_t *const | co_csdo_dn_seg_state = &(co_csdo_state_t){ .on_enter = &co_csdo_dn_seg_on_enter, .on_abort = &co_csdo_dn_seg_on_abort, .on_time = &co_csdo_dn_seg_on_time, .on_recv = &co_csdo_dn_seg_on_recv } |
The 'download segment' state. | |
static co_csdo_state_t *const | co_csdo_up_ini_state = &(co_csdo_state_t){ .on_abort = &co_csdo_up_ini_on_abort, .on_time = &co_csdo_up_ini_on_time, .on_recv = &co_csdo_up_ini_on_recv } |
The 'upload initiate' state. | |
static co_csdo_state_t *const | co_csdo_up_seg_state = &(co_csdo_state_t){ .on_abort = &co_csdo_up_seg_on_abort, .on_time = &co_csdo_up_seg_on_time, .on_recv = &co_csdo_up_seg_on_recv } |
The 'upload segment' state. | |
static co_csdo_state_t *const | co_csdo_blk_dn_ini_state = &(co_csdo_state_t){ .on_abort = &co_csdo_blk_dn_ini_on_abort, .on_time = &co_csdo_blk_dn_ini_on_time, .on_recv = &co_csdo_blk_dn_ini_on_recv } |
The 'block download initiate' state. | |
static co_csdo_state_t *const | co_csdo_blk_dn_sub_state = &(co_csdo_state_t){ .on_enter = &co_csdo_blk_dn_sub_on_enter, .on_abort = &co_csdo_blk_dn_sub_on_abort, .on_time = &co_csdo_blk_dn_sub_on_time, .on_recv = &co_csdo_blk_dn_sub_on_recv } |
The 'block download sub-block' state. | |
static co_csdo_state_t *const | co_csdo_blk_dn_end_state = &(co_csdo_state_t){ .on_abort = &co_csdo_blk_dn_end_on_abort, .on_time = &co_csdo_blk_dn_end_on_time, .on_recv = &co_csdo_blk_dn_end_on_recv } |
The 'block download end' state. | |
static co_csdo_state_t *const | co_csdo_blk_up_ini_state = &(co_csdo_state_t){ .on_abort = &co_csdo_blk_up_ini_on_abort, .on_time = &co_csdo_blk_up_ini_on_time, .on_recv = &co_csdo_blk_up_ini_on_recv } |
The 'block upload initiate' state. | |
static co_csdo_state_t *const | co_csdo_blk_up_sub_state = &(co_csdo_state_t){ .on_abort = &co_csdo_blk_up_sub_on_abort, .on_time = &co_csdo_blk_up_sub_on_time, .on_recv = &co_csdo_blk_up_sub_on_recv } |
The 'block upload sub-block' state. | |
static co_csdo_state_t *const | co_csdo_blk_up_end_state = &(co_csdo_state_t){ .on_abort = &co_csdo_blk_up_end_on_abort, .on_time = &co_csdo_blk_up_end_on_time, .on_recv = &co_csdo_blk_up_end_on_recv } |
The 'block upload end' state. | |
This file is part of the CANopen library; it contains the implementation of the Client-SDO functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file csdo.c.
|
static |
|
static |
The download indication function for (all sub-objects of) CANopen objects 1280..12FF (SDO client parameter).
|
static |
The CAN receive callback function for a Client-SDO service.
|
static |
The CAN timer callback function for a Client-SDO service.
|
inlinestatic |
|
static |
Processes an abort transfer indication by aborting any ongoing transfer of a Client-SDO and returning it to the waiting state after notifying the user.
|
static |
Sends an abort transfer request and aborts any ongoing transfer by invoking co_csdo_abort_ind().
sdo | a pointer to a Client-SDO service. |
ac | the SDO abort code. |
|
static |
Processes a download request from a Client-SDO by checking and updating the state and copying the value to the internal buffer.
|
static |
Processes an upload request from a Client-SDO by checking and updating the state.
|
static |
|
static |
|
static |
|
static |
|
static |
The confirmation function of a single SDO download request during a concise DCF download.
int co_dev_dn_req | ( | co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a local device.
This is equivalent to a write operation into an dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_dn_val_req | ( | co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a local device.
This is equivalent to a write operation into an object dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_dn_dcf_req | ( | co_dev_t * | dev, |
const uint_least8_t * | begin, | ||
const uint_least8_t * | end, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a series of download requests to a local device.
This function calls co_dev_dn_req() for each entry in the specified concise DCF.
dev | a pointer to CANopen device. |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_up_req | ( | const co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits an upload request to a local device.
This is equivalent to a read operation from an object dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
Creates a new CANopen Client-SDO service.
The service is started as if by co_csdo_start().
net | a pointer to a CAN network. |
dev | a pointer to a CANopen device describing the client (can be NULL). |
num | the SDO number (in the range [1..128]). The SDO parameter record MUST exist in the object dictionary of dev. However, if dev is NULL, num is interpreted as a node-ID (in the range [1..127]) and the default SDO parameters are used. |
void co_csdo_destroy | ( | co_csdo_t * | sdo | ) |
Destroys a CANopen Client-SDO service.
int co_csdo_start | ( | co_csdo_t * | sdo | ) |
Starts a Client-SDO service.
void co_csdo_stop | ( | co_csdo_t * | sdo | ) |
Stops a Client-SDO service.
Any ongoing request is aborted.
int co_csdo_is_stopped | ( | const co_csdo_t * | sdo | ) |
Retuns 1 if the specified Client-SDO service is stopped, and 0 if not.
int co_csdo_get_timeout | ( | const co_csdo_t * | sdo | ) |
Returns the timeout (in milliseconds) of a Client-SDO.
A return value of 0 (the default) means no timeout is being used.
void co_csdo_set_timeout | ( | co_csdo_t * | sdo, |
int | timeout | ||
) |
Sets the timeout of a Client-SDO.
If the timeout expires before receiving a response from a server, the client aborts the transfer.
sdo | a pointer to a Client-SDO service. |
timeout | the timeout (in milliseconds). A value of 0 (the default) disables the timeout. |
void co_csdo_get_dn_ind | ( | const co_csdo_t * | sdo, |
co_csdo_ind_t ** | pind, | ||
void ** | pdata | ||
) |
Retrieves the indication function used to notify the user of the progress of the current SDO download request.
sdo | a pointer to a Client-SDO service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_csdo_set_dn_ind | ( | co_csdo_t * | sdo, |
co_csdo_ind_t * | ind, | ||
void * | data | ||
) |
Sets the indication function used to notify the user of the progress of the current SDO download request.
sdo | a pointer to a Client-SDO service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
void co_csdo_get_up_ind | ( | const co_csdo_t * | sdo, |
co_csdo_ind_t ** | pind, | ||
void ** | pdata | ||
) |
Retrieves the indication function used to notify the user of the progress of the current SDO upload request.
sdo | a pointer to a Client-SDO service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_csdo_set_up_ind | ( | co_csdo_t * | sdo, |
co_csdo_ind_t * | ind, | ||
void * | data | ||
) |
Sets the indication function used to notify the user of the progress of the current SDO upload request.
sdo | a pointer to a Client-SDO service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
void co_csdo_abort_req | ( | co_csdo_t * | sdo, |
co_unsigned32_t | ac | ||
) |
Submits an abort transfer request to a remote Server-SDO.
This function has no effect if the Client-SDO service is idle (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
ac | the abort code. |
int co_csdo_dn_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. It is the responsibility of the user to ensure that the buffer remains valid until the operation completes. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_dn_val_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_dn_dcf_req | ( | co_csdo_t * | sdo, |
const uint_least8_t * | begin, | ||
const uint_least8_t * | end, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a series of download requests to a remote Server-SDO.
This function calls co_csdo_dn_req() for each entry in the specified concise DCF.
sdo | a pointer to a Client-SDO service. |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_up_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits an upload request to a remote Server-SDO.
This requests the server to upload the value and is equivalent to a read operation from a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_dn_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a block download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_dn_val_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a block download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_up_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned8_t | pst, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits a block upload request to a remote Server-SDO.
This requests the server to upload the value and is equivalent to a read operation from a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
pst | the protocol switch threshold. If pst is non-zero, and the number of bytes to be uploaded is less than or equal to pst, the server may switch to the SDO upload protocol. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |