libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
foe.h
Go to the documentation of this file.
1
14/*
15 * This file is part of libethercat.
16 *
17 * libethercat is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 3 of the License, or (at your option) any later version.
21 *
22 * libethercat is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with libethercat (LICENSE.LGPL-V3); if not, write
29 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
30 * Floor, Boston, MA 02110-1301, USA.
31 *
32 * Please note that the use of the EtherCAT technology, the EtherCAT
33 * brand name and the EtherCAT logo is only permitted if the property
34 * rights of Beckhoff Automation GmbH are observed. For further
35 * information please contact Beckhoff Automation GmbH & Co. KG,
36 * Hülshorstweg 20, D-33415 Verl, Germany (www.beckhoff.com) or the
37 * EtherCAT Technology Group, Ostendstraße 196, D-90482 Nuremberg,
38 * Germany (ETG, www.ethercat.org).
39 *
40 */
41
42#ifndef LIBETHERCAT_FOE_H
43#define LIBETHERCAT_FOE_H
44
45#include <libosal/types.h>
46
47#include "libethercat/common.h"
48
57typedef struct ec_foe {
59} ec_foe_t;
60
61#define MAX_FILE_NAME_SIZE 512u
62#define MAX_ERROR_TEXT_SIZE 512u
63
65typedef struct ec_fw_update {
66 osal_uint16_t cmd;
67 osal_uint16_t size;
68 osal_uint16_t address_low;
69 osal_uint16_t address_high;
70 osal_uint16_t data[(LEC_MAX_DATA-8u)>>1u];
72
73#define EC_FOE_OP_CODE_READ_REQUEST 0x01u
74#define EC_FOE_OP_CODE_WRITE_REQUEST 0x02u
75#define EC_FOE_OP_CODE_DATA_REQUEST 0x03u
76#define EC_FOE_OP_CODE_ACK_REQUEST 0x04u
77#define EC_FOE_OP_CODE_ERROR_REQUEST 0x05u
78#define EC_FOE_OP_CODE_BUSY_REQUEST 0x06u
79
80#define EC_FOE_ERROR_NOT_DEFINED 0x8000u
81#define EC_FOE_ERROR_NOT_FOUND 0x8001u
82#define EC_FOE_ERROR_ACCESS_DENIED 0x8002u
83#define EC_FOE_ERROR_DISK_FULL 0x8003u
84#define EC_FOE_ERROR_ILLEGAL 0x8004u
85#define EC_FOE_ERROR_PACKET_NUMBER_WRONG 0x8005u
86#define EC_FOE_ERROR_ALREADY_EXISTS 0x8006u
87#define EC_FOE_ERROR_NO_USER 0x8007u
88#define EC_FOE_ERROR_BOOTSTRAP_ONLY 0x8008u
89#define EC_FOE_ERROR_NOT_BOOTSTRAP 0x8009u
90#define EC_FOE_ERROR_NO_RIGHTS 0x800Au
91#define EC_FOE_ERROR_PROGRAM_ERROR 0x800Bu
92
93#define EFW_CMD_IGNORE 0u
94#define EFW_CMD_MEMORY_TRANSFER 1u
95#define EFW_CMD_WRCODE 2u
96#define EFW_CMD_CHK_DEVID 3u
97#define EFW_CMD_CHK_DEVICEID 3u
98#define EFW_CMD_CHKSUM 4u
99#define EFW_CMD_WRCODECHKSUM 5u
100#define EFW_CMD_SET_DEVID 6u
101#define EFW_CMD_CHKSUMCHKSUM 6u
102#define EFW_CMD_BOOTCHKSUM 7u
103#define EFW_CMD_SET_EEPROM 10u
104
105#ifdef __cplusplus
106extern "C" {
107#endif
108
110
117void ec_foe_init(ec_t *pec, osal_uint16_t slave);
118
120
127void ec_foe_deinit(ec_t *pec, osal_uint16_t slave);
128
130
139void ec_foe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry);
140
142
166int ec_foe_read(ec_t *pec, osal_uint16_t slave, osal_uint32_t password,
167 osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t **file_data,
168 osal_size_t *file_data_len, const osal_char_t **error_message);
169
171
194int ec_foe_write(ec_t *pec, osal_uint16_t slave, osal_uint32_t password,
195 osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t *file_data,
196 osal_size_t file_data_len, const osal_char_t **error_message);
197
198#ifdef __cplusplus
199}
200#endif
201
204#endif // LIBETHERCAT_COE_H
205
ethercat master common stuff
#define LEC_MAX_DATA
Maximum data length.
Definition common.h:175
#define MAX_FILE_NAME_SIZE
file name max size
Definition foe.h:61
int ec_foe_write(ec_t *pec, osal_uint16_t slave, osal_uint32_t password, osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t *file_data, osal_size_t file_data_len, const osal_char_t **error_message)
Write file over FoE.
void ec_foe_deinit(ec_t *pec, osal_uint16_t slave)
deinitialize FoE structure
void ec_foe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
Enqueue FoE message received from slave.
struct ec_fw_update ec_fw_update_t
firmware update
void ec_foe_init(ec_t *pec, osal_uint16_t slave)
initialize FoE structure
int ec_foe_read(ec_t *pec, osal_uint16_t slave, osal_uint32_t password, osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t **file_data, osal_size_t *file_data_len, const osal_char_t **error_message)
Read file over FoE.
Definition foe.h:57
pool_t recv_pool
Pool for received FoE messages.
Definition foe.h:58
firmware update
Definition foe.h:65
osal_uint16_t address_low
destination/source address low WORD
Definition foe.h:68
osal_uint16_t size
size of data
Definition foe.h:67
osal_uint16_t cmd
firmware update command
Definition foe.h:66
osal_uint16_t data[(LEC_MAX_DATA-8u)> >1u]
firmware data bytes
Definition foe.h:70
osal_uint16_t address_high
destination/source address high WORD
Definition foe.h:69
ethercat master structure
Definition ec.h:188
Pool queue entry.
Definition pool.h:67
the datagram pool itself
Definition pool.h:81