SOES v1.0.0
Defines | Functions | Variables
esc_foe.c File Reference

File over EtherCAT (FoE) module. More...

#include "osal.h"
#include "utypes.h"
#include "esc.h"
#include "esc_foe.h"
#include <string.h>

Defines

#define DPRINT(...)
#define DEBUG_ASSERT(expression)

Functions

int FOE_fopen (char *name, uint8 num_chars, uint32 pass, uint8 op)
uint16 FOE_fwrite (uint8 *data, uint16 length)
uint32_t FOE_fclose (void)
void FOE_init ()
void FOE_abort (uint32 code)
int FOE_send_ack ()
void FOE_read ()
void FOE_write ()
void FOE_data ()
void FOE_error ()
void FOE_config (foe_cfg_t *cfg, foe_writefile_cfg_t *cfg_files)
void ESC_foeprocess (void)

Variables

char foe_file_name [FOE_FN_MAX+1]
static foe_cfg_tfoe_cfg
static foe_writefile_cfg_t * foe_files
static foe_writefile_cfg_t * foe_file
static _FOEvar FOEvar

Detailed Description

File over EtherCAT (FoE) module.

FOE read / write and FOE service functions


Define Documentation

#define DEBUG_ASSERT (   expression)
#define DPRINT (   ...)

Function Documentation

void ESC_foeprocess ( void  )

Main FoE function checking the status on current mailbox buffers carrying data, distributing the mailboxes to appropriate FOE functions depending on requested opcode. On Error an FoE Error or FoE Abort will be sent.

void FOE_abort ( uint32  code)

Function for sending an FOE abort frame.

Parameters:
[in]code= abort code
void FOE_config ( foe_cfg_t cfg,
foe_writefile_cfg_t *  cfg_files 
)

Function copying the application configuration variable to the FoE module local pointer variable.

Parameters:
[in]cfg= Pointer to by the Application static declared configuration variable holding application specific details.
[in]cfg_files= Pointer to by the Application static declared configuration variable holding file specific details for files to be handled by FoE
void FOE_data ( )

FoE data request handler. Validates and reads data until we're finsihed. Every read frame follwed by an Ack frame. On error we will send FOE Abort.

void FOE_error ( )

FoE error requesthandler. Send an FOE Abort.

uint32_t FOE_fclose ( void  )

Function handling the final FOE_fwrite when we close up regardless if we have filled the buffers or not.

Returns:
Number of copied bytes on success, 0= if failed.
int FOE_fopen ( char *  name,
uint8  num_chars,
uint32  pass,
uint8  op 
)

Validate a write or read request by checking filename and password.

Parameters:
[in]name= Filename
[in]num_chars= Length of filename
[in]pass= Numeric variable of password
[in]op= Request op-code
Returns:
0= if we succeed, FOE_ERR_NOTFOUND something wrong with filename or password
uint16 FOE_fwrite ( uint8 *  data,
uint16  length 
)

Function reading mailbox buffer to local buffer to be handled by application write hook. Ex. flash routine used by software update. It will consume the buffer and call the write hook every time the configured flush buffer limit is reached.

Parameters:
[in]data= Pointer to buffer
[in]length= Length of data to read
Returns:
Number of copied bytes.
void FOE_init ( void  )

Initialize by clearing all current status variables.

void FOE_read ( )
int FOE_send_ack ( )

Sends an FoE ack data frame.

Returns:
0= or error number.
void FOE_write ( )

FoE write request handler. Starts with Initialize, Open and Ack that we can/will receive data. On error we will send FOE Abort.


Variable Documentation

foe_cfg_t* foe_cfg [static]

Main FoE configuration pointer data array. Structure i allocated and filled by the application defining what preferences it require.

foe_writefile_cfg_t* foe_file [static]

Pointer to current file configuration item used by FoE.

char foe_file_name[FOE_FN_MAX+1]

Variable holding current filename read at FOE Open.

foe_writefile_cfg_t* foe_files [static]

Collection of files possible to receive by FoE. Structure i allocated and filled by the application defining what preferences it require.

_FOEvar FOEvar [static]

Main FoE status data array. Structure gets filled with current status variables during FoE usage.