Lely core libraries
2.3.4
|
This file is part of the CANopen library; it contains the implementation of the Service Data Object (SDO) functions. More...
#include "co.h"
#include <lely/util/diag.h>
#include <lely/util/frbuf.h>
#include <lely/util/fwbuf.h>
#include <lely/co/sdo.h>
#include <lely/co/val.h>
#include <assert.h>
Go to the source code of this file.
Functions | |
static int | co_sdo_req_dn_buf (struct co_sdo_req *req, const void **pptr, size_t *pnbyte) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer. More... | |
static void | co_sdo_req_up_buf (struct co_sdo_req *req) |
Constructs a CANopen SDO upload request from its internal buffer. | |
const char * | co_sdo_ac2str (co_unsigned32_t ac) |
Returns a string describing an SDO abort code. | |
void | co_sdo_req_init (struct co_sdo_req *req) |
Initializes a CANopen SDO upload/download request. More... | |
void | co_sdo_req_fini (struct co_sdo_req *req) |
Finalizes a CANopen SDO upload/download request. More... | |
void | co_sdo_req_clear (struct co_sdo_req *req) |
Clears a CANopen SDO upload/download request, including its buffer. | |
int | co_sdo_req_dn (struct co_sdo_req *req, const void **pptr, size_t *pnbyte, co_unsigned32_t *pac) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, returns the buffer. More... | |
int | co_sdo_req_dn_val (struct co_sdo_req *req, co_unsigned16_t type, void *val, co_unsigned32_t *pac) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, reads the value. More... | |
int | co_sdo_req_dn_file (struct co_sdo_req *req, const char *filename, co_unsigned32_t *pac) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, writes the value to the specified file. More... | |
int | co_sdo_req_up (struct co_sdo_req *req, const void *ptr, size_t n, co_unsigned32_t *pac) |
Writes the specified bytes to a buffer and constructs a CANopen SDO upload request. More... | |
int | co_sdo_req_up_val (struct co_sdo_req *req, co_unsigned16_t type, const void *val, co_unsigned32_t *pac) |
Writes the specified value to a buffer and constructs a CANopen SDO upload request. More... | |
int | co_sdo_req_up_file (struct co_sdo_req *req, const char *filename, co_unsigned32_t *pac) |
Loads the specified file into a buffer and constructs a CANopen SDO upload request. More... | |
This file is part of the CANopen library; it contains the implementation of the Service Data Object (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 sdo.c.
|
static |
Copies the next segment of the specified CANopen SDO download request to the internal buffer.
req | a pointer to a CANopen SDO download request. |
pptr | the address of a pointer which, on success, points to the first byte in the buffer (can be NULL). |
pnbyte | the address of a value which, on success, contains the total number of bytes in the buffer (can be NULL). |
void co_sdo_req_init | ( | struct co_sdo_req * | req | ) |
Initializes a CANopen SDO upload/download request.
void co_sdo_req_fini | ( | struct co_sdo_req * | req | ) |
Finalizes a CANopen SDO upload/download request.
int co_sdo_req_dn | ( | struct co_sdo_req * | req, |
const void ** | pptr, | ||
size_t * | pnbyte, | ||
co_unsigned32_t * | pac | ||
) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, returns the buffer.
req | a pointer to a CANopen SDO download request. |
pptr | the address of a pointer which, on success, points to the first byte in the buffer (can be NULL). |
pnbyte | the address of a value which, on success, contains the total number of bytes in the buffer (can be NULL). |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |
int co_sdo_req_dn_val | ( | struct co_sdo_req * | req, |
co_unsigned16_t | type, | ||
void * | val, | ||
co_unsigned32_t * | pac | ||
) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, reads the value.
req | a pointer to a CANopen SDO download request. |
type | the data type of the value. |
val | the address of the value to be downloaded (can be NULL). |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |
int co_sdo_req_dn_file | ( | struct co_sdo_req * | req, |
const char * | filename, | ||
co_unsigned32_t * | pac | ||
) |
Copies the next segment of the specified CANopen SDO download request to the internal buffer and, on the last segment, writes the value to the specified file.
req | a pointer to a CANopen SDO download request. |
filename | a pointer to the name of the file. |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |
int co_sdo_req_up | ( | struct co_sdo_req * | req, |
const void * | ptr, | ||
size_t | n, | ||
co_unsigned32_t * | pac | ||
) |
Writes the specified bytes to a buffer and constructs a CANopen SDO upload request.
req | a pointer to a CANopen SDO upload request. |
ptr | a pointer to the bytes to be uploaded. |
n | the number of bytes at ptr. |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |
int co_sdo_req_up_val | ( | struct co_sdo_req * | req, |
co_unsigned16_t | type, | ||
const void * | val, | ||
co_unsigned32_t * | pac | ||
) |
Writes the specified value to a buffer and constructs a CANopen SDO upload request.
req | a pointer to a CANopen SDO upload request. |
type | the data type of the value. |
val | the address of the value to be uploaded. In case of string or domains, this MUST be the address of pointer. |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |
int co_sdo_req_up_file | ( | struct co_sdo_req * | req, |
const char * | filename, | ||
co_unsigned32_t * | pac | ||
) |
Loads the specified file into a buffer and constructs a CANopen SDO upload request.
req | a pointer to a CANopen SDO upload request. |
filename | a pointer to the name of the file. |
pac | the address of a value which, on error, contains the SDO abort code (can be NULL). |