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#include "libethercat/pool.h"
49
58typedef struct ec_foe {
60} ec_foe_t;
61
62#define MAX_FILE_NAME_SIZE 512u
63#define MAX_ERROR_TEXT_SIZE 512u
64
66typedef struct ec_fw_update {
67 osal_uint16_t cmd;
68 osal_uint16_t size;
69 osal_uint16_t address_low;
70 osal_uint16_t address_high;
71 osal_uint16_t data[(LEC_MAX_DATA-8u)>>1u];
73
74#define EC_FOE_OP_CODE_READ_REQUEST 0x01u
75#define EC_FOE_OP_CODE_WRITE_REQUEST 0x02u
76#define EC_FOE_OP_CODE_DATA_REQUEST 0x03u
77#define EC_FOE_OP_CODE_ACK_REQUEST 0x04u
78#define EC_FOE_OP_CODE_ERROR_REQUEST 0x05u
79#define EC_FOE_OP_CODE_BUSY_REQUEST 0x06u
80
81#define EC_FOE_ERROR_NOT_DEFINED 0x8000u
82#define EC_FOE_ERROR_NOT_FOUND 0x8001u
83#define EC_FOE_ERROR_ACCESS_DENIED 0x8002u
84#define EC_FOE_ERROR_DISK_FULL 0x8003u
85#define EC_FOE_ERROR_ILLEGAL 0x8004u
86#define EC_FOE_ERROR_PACKET_NUMBER_WRONG 0x8005u
87#define EC_FOE_ERROR_ALREADY_EXISTS 0x8006u
88#define EC_FOE_ERROR_NO_USER 0x8007u
89#define EC_FOE_ERROR_BOOTSTRAP_ONLY 0x8008u
90#define EC_FOE_ERROR_NOT_BOOTSTRAP 0x8009u
91#define EC_FOE_ERROR_NO_RIGHTS 0x800Au
92#define EC_FOE_ERROR_PROGRAM_ERROR 0x800Bu
93
94#define EFW_CMD_IGNORE 0u
95#define EFW_CMD_MEMORY_TRANSFER 1u
96#define EFW_CMD_WRCODE 2u
97#define EFW_CMD_CHK_DEVID 3u
98#define EFW_CMD_CHK_DEVICEID 3u
99#define EFW_CMD_CHKSUM 4u
100#define EFW_CMD_WRCODECHKSUM 5u
101#define EFW_CMD_SET_DEVID 6u
102#define EFW_CMD_CHKSUMCHKSUM 6u
103#define EFW_CMD_BOOTCHKSUM 7u
104#define EFW_CMD_SET_EEPROM 10u
105
106// forward declarations
107struct ec;
108typedef struct ec ec_t;
109
110#ifdef __cplusplus
111extern "C" {
112#endif
113
115
122void ec_foe_init(ec_t *pec, osal_uint16_t slave);
123
125
132void ec_foe_deinit(ec_t *pec, osal_uint16_t slave);
133
135
144void ec_foe_enqueue(ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry);
145
147
171int ec_foe_read(ec_t *pec, osal_uint16_t slave, osal_uint32_t password,
172 osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t **file_data,
173 osal_size_t *file_data_len, const osal_char_t **error_message);
174
176
199int ec_foe_write(ec_t *pec, osal_uint16_t slave, osal_uint32_t password,
200 osal_char_t file_name[MAX_FILE_NAME_SIZE], osal_uint8_t *file_data,
201 osal_size_t file_data_len, const osal_char_t **error_message);
202
203#ifdef __cplusplus
204}
205#endif
206
209#endif // LIBETHERCAT_COE_H
210
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:62
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.
Data pool implementation.
Definition foe.h:58
pool_t recv_pool
Pool for received FoE messages.
Definition foe.h:59
firmware update
Definition foe.h:66
osal_uint16_t address_low
destination/source address low WORD
Definition foe.h:69
osal_uint16_t size
size of data
Definition foe.h:68
osal_uint16_t cmd
firmware update command
Definition foe.h:67
osal_uint16_t data[(LEC_MAX_DATA-8u)> >1u]
firmware data bytes
Definition foe.h:71
osal_uint16_t address_high
destination/source address high WORD
Definition foe.h:70
ethercat master structure
Definition ec.h:192
Pool queue entry.
Definition pool.h:67
the datagram pool itself
Definition pool.h:84