Introduced ecrt_voe_handler_received_header(); renamed

ecrt_voe_handler_header() to ecrt_voe_handler_send_header().
This commit is contained in:
Florian Pose 2008-09-30 07:50:34 +00:00
parent 64e1d6f678
commit 09f06703c2
2 changed files with 40 additions and 9 deletions

View File

@ -923,21 +923,35 @@ void ecrt_sdo_request_read(
* VoE handler methods.
****************************************************************************/
/** Sets the VoE header containing vendor ID and vendor type.
/** Sets the VoE header for future send operations.
*
* A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor
* type at as header. These numbers can be set with this function.
*/
void ecrt_voe_handler_header(
void ecrt_voe_handler_send_header(
ec_voe_handler_t *voe, /**< VoE handler. */
uint32_t vendor_id, /**< Vendor ID. */
uint16_t vendor_type /**< Vendor-specific type. */
);
/** Reads the header data of a received VoE message.
*
* This method can be used after a read operation has succeded, to get the
* received header information.
*
* The header information is stored at the memory given by the pointer
* parameters.
*/
void ecrt_voe_handler_received_header(
const ec_voe_handler_t *voe, /**< VoE handler. */
uint32_t *vendor_id, /**< Vendor ID. */
uint16_t *vendor_type /**< Vendor-specific type. */
);
/** Access to the VoE handler's data.
*
* This function returns a pointer to the VoE handler's internal memory, after
* the VoE header (see ecrt_voe_handler_header()).
* the VoE header (see ecrt_voe_handler_send_header()).
*
* - After a read operation was successful, the memory contains the received
* data. The size of the received data can be determined via
@ -955,7 +969,7 @@ uint8_t *ecrt_voe_handler_data(
/** Returns the current data size.
*
* The data size is the size of the VoE data without the header (see
* ecrt_voe_handler_header()).
* ecrt_voe_handler_send_header()).
*
* When the VoE handler is created, the data size is set to the size of the
* reserved memory. At a write operation, the data size is set to the number
@ -971,7 +985,8 @@ size_t ecrt_voe_handler_data_size(
/** Start a VoE write operation.
*
* After this function has been called, the ecrt_voe_handler_execute() method
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY.
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY. No
* other operation may be started while the handler is busy.
*/
void ecrt_voe_handler_write(
ec_voe_handler_t *voe, /**< VoE handler. */
@ -981,10 +996,12 @@ void ecrt_voe_handler_write(
/** Start a VoE read operation.
*
* After this function has been called, the ecrt_voe_handler_execute() method
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY.
* must be called in every bus cycle as long as it returns EC_REQUEST_BUSY. No
* other operation may be started while the handler is busy.
*
* On success, the size of the read data can be determined via
* ecrt_voe_handler_data_size().
* ecrt_voe_handler_data_size(), while the VoE header of the received data
* can be retrieved with ecrt_voe_handler_received_header().
*/
void ecrt_voe_handler_read(
ec_voe_handler_t *voe /**< VoE handler. */

View File

@ -111,7 +111,7 @@ void ec_voe_handler_clear(
* Application interface.
****************************************************************************/
void ecrt_voe_handler_header(ec_voe_handler_t *voe, uint32_t vendor_id,
void ecrt_voe_handler_send_header(ec_voe_handler_t *voe, uint32_t vendor_id,
uint16_t vendor_type)
{
voe->vendor_id = vendor_id;
@ -120,6 +120,19 @@ void ecrt_voe_handler_header(ec_voe_handler_t *voe, uint32_t vendor_id,
/*****************************************************************************/
void ecrt_voe_handler_received_header(const ec_voe_handler_t *voe,
uint32_t *vendor_id, uint16_t *vendor_type)
{
uint8_t *header = voe->datagram.data + EC_MBOX_HEADER_SIZE;
if (vendor_id)
*vendor_id = EC_READ_U32(header);
if (vendor_type)
*vendor_type = EC_READ_U16(header + 4);
}
/*****************************************************************************/
uint8_t *ecrt_voe_handler_data(ec_voe_handler_t *voe)
{
return voe->datagram.data + EC_MBOX_HEADER_SIZE + EC_VOE_HEADER_SIZE;
@ -405,7 +418,8 @@ void ec_voe_handler_state_error(ec_voe_handler_t *voe)
/** \cond */
EXPORT_SYMBOL(ecrt_voe_handler_header);
EXPORT_SYMBOL(ecrt_voe_handler_send_header);
EXPORT_SYMBOL(ecrt_voe_handler_received_header);
EXPORT_SYMBOL(ecrt_voe_handler_data);
EXPORT_SYMBOL(ecrt_voe_handler_data_size);
EXPORT_SYMBOL(ecrt_voe_handler_read);