SOEM  v1.4.0
Macros | Functions | Variables
eepromtool.c File Reference

EEprom tool for Simple Open EtherCAT master. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ethercat.h"

Macros

#define MAXBUF   524288
 
#define STDBUF   2048
 
#define MINBUF   128
 
#define CRCBUF   14
 
#define MODE_NONE   0
 
#define MODE_READBIN   1
 
#define MODE_READINTEL   2
 
#define MODE_WRITEBIN   3
 
#define MODE_WRITEINTEL   4
 
#define MODE_WRITEALIAS   5
 
#define MODE_INFO   6
 
#define MAXSLENGTH   256
 
#define IHEXLENGTH   0x20
 

Functions

void calc_crc (uint8 *crc, uint8 b)
 
uint16 SIIcrc (uint8 *buf)
 
int input_bin (char *fname, int *length)
 
int input_intelhex (char *fname, int *start, int *length)
 
int output_bin (char *fname, int length)
 
int output_intelhex (char *fname, int length)
 
int eeprom_read (int slave, int start, int length)
 
int eeprom_write (int slave, int start, int length)
 
int eeprom_writealias (int slave, int alias, uint16 crc)
 
void eepromtool (char *ifname, int slave, int mode, char *fname)
 
int main (int argc, char *argv[])
 

Variables

uint8 ebuf [MAXBUF]
 
uint8 ob
 
uint16 ow
 
int os
 
int slave
 
int alias
 
ec_timet tstart
 
ec_timet tend
 
ec_timet tdif
 
int wkc
 
int mode
 
char sline [MAXSLENGTH]
 

Detailed Description

EEprom tool for Simple Open EtherCAT master.

Usage : eepromtool ifname slave OPTION fname|alias ifname is NIC interface, f.e. eth0 slave = slave number in EtherCAT order 1..n -r read EEPROM, output binary format -ri read EEPROM, output Intel Hex format -w write EEPROM, input binary format -wi write EEPROM, input Intel Hex format -i display EEPROM information -walias write slave alias in EEPROM

(c)Arthur Ketels 2010-2012

Macro Definition Documentation

◆ CRCBUF

#define CRCBUF   14

◆ IHEXLENGTH

#define IHEXLENGTH   0x20

◆ MAXBUF

#define MAXBUF   524288

◆ MAXSLENGTH

#define MAXSLENGTH   256

◆ MINBUF

#define MINBUF   128

◆ MODE_INFO

#define MODE_INFO   6

◆ MODE_NONE

#define MODE_NONE   0

◆ MODE_READBIN

#define MODE_READBIN   1

◆ MODE_READINTEL

#define MODE_READINTEL   2

◆ MODE_WRITEALIAS

#define MODE_WRITEALIAS   5

◆ MODE_WRITEBIN

#define MODE_WRITEBIN   3

◆ MODE_WRITEINTEL

#define MODE_WRITEINTEL   4

◆ STDBUF

#define STDBUF   2048

Function Documentation

◆ calc_crc()

void calc_crc ( uint8 *  crc,
uint8  b 
)

◆ eeprom_read()

int eeprom_read ( int  slave,
int  start,
int  length 
)

◆ eeprom_write()

int eeprom_write ( int  slave,
int  start,
int  length 
)

◆ eeprom_writealias()

int eeprom_writealias ( int  slave,
int  alias,
uint16  crc 
)

◆ eepromtool()

void eepromtool ( char *  ifname,
int  slave,
int  mode,
char *  fname 
)

◆ input_bin()

int input_bin ( char *  fname,
int *  length 
)

◆ input_intelhex()

int input_intelhex ( char *  fname,
int *  start,
int *  length 
)

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ output_bin()

int output_bin ( char *  fname,
int  length 
)

◆ output_intelhex()

int output_intelhex ( char *  fname,
int  length 
)

◆ SIIcrc()

uint16 SIIcrc ( uint8 *  buf)

Variable Documentation

◆ alias

int alias

◆ ebuf

uint8 ebuf[MAXBUF]

◆ mode

int mode

◆ ob

uint8 ob

◆ os

int os

◆ ow

uint16 ow

◆ slave

int slave

◆ sline

char sline[MAXSLENGTH]

◆ tdif

ec_timet tdif

◆ tend

ec_timet tend

◆ tstart

ec_timet tstart

◆ wkc

int wkc