decouple stack from application

pull/4/head
Hans-Erik Floryd 2015-05-07 17:43:02 +02:00
parent a5ce11ea9a
commit 6b9aa5a343
5 changed files with 99 additions and 24 deletions

View File

@ -38,6 +38,12 @@ typedef int32_t int32;
#define etohl(x) (x)
#endif
#ifdef ESC_DEBUG
#define DPRINT(...) rprintp ("esc_foe: "__VA_ARGS__) /* TODO */
#else
#define DPRINT(...)
#endif /* DEBUG */
#ifdef __cplusplus
}
#endif

View File

@ -29,12 +29,12 @@
* The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
* property of, and protected by Beckhoff Automation GmbH.
*/
/** \file
/** \file
* \brief
* Headerfile for esc.h
*/
#ifndef __esc__
#define __esc__
@ -529,4 +529,15 @@ extern _MBXcontrol MBXcontrol[MBXBUFFERS];
extern uint8 MBXrun;
extern uint16 SM2_sml, SM3_sml;
typedef struct
{
uint8 state;
} _App;
#define APPSTATE_IDLE 0x00
#define APPSTATE_INPUT 0x01
#define APPSTATE_OUTPUT 0x02
extern _App App;
#endif

View File

@ -29,18 +29,17 @@
* property of, and protected by Beckhoff Automation GmbH.
*/
/** \file
/** \file
* \brief
* CAN over EtherCAT (CoE) module.
*
* SDO read / write and SDO service functions
*/
#include <string.h>
#include <cc.h>
#include "esc.h"
#include "esc_coe.h"
#include "objectlist.h"
#define BITS2BYTES(b) ((b + 7) >> 3)

View File

@ -28,19 +28,90 @@
* The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
* property of, and protected by Beckhoff Automation GmbH.
*/
/** \file
/** \file
* \brief
* Headerfile for esc_coe.c
* Headerfile for esc_coe.c
*/
#ifndef __esc_coe__
#define __esc_coe__
typedef struct PACKED
{
uint16 subindex;
uint16 datatype;
uint16 bitlength;
uint16 access;
const char *name;
uint32 value;
void *data;
} _objd;
typedef struct PACKED
{
uint16 index;
uint16 objtype;
uint8 maxsub;
uint8 pad1;
const char *name;
const _objd *objdesc;
} _objectlist;
#define OBJH_READ 0
#define OBJH_WRITE 1
/* #define _ac const char */
#define nil 0
#define OTYPE_DOMAIN 0x0002
#define OTYPE_DEFTYPE 0x0005
#define OTYPE_DEFSTRUCT 0x0006
#define OTYPE_VAR 0x0007
#define OTYPE_ARRAY 0x0008
#define OTYPE_RECORD 0x0009
#define DTYPE_BOOLEAN 0x0001
#define DTYPE_INTEGER8 0x0002
#define DTYPE_INTEGER16 0x0003
#define DTYPE_INTEGER32 0x0004
#define DTYPE_UNSIGNED8 0x0005
#define DTYPE_UNSIGNED16 0x0006
#define DTYPE_UNSIGNED32 0x0007
#define DTYPE_REAL32 0x0008
#define DTYPE_VISIBLE_STRING 0x0009
#define DTYPE_OCTET_STRING 0x000A
#define DTYPE_UNICODE_STRING 0x000B
#define DTYPE_INTEGER24 0x0010
#define DTYPE_UNSIGNED24 0x0016
#define DTYPE_INTEGER64 0x0015
#define DTYPE_UNSIGNED64 0x001B
#define DTYPE_REAL64 0x0011
#define DTYPE_PDO_MAPPING 0x0021
#define DTYPE_IDENTITY 0x0023
#define DTYPE_BIT1 0x0030
#define DTYPE_BIT2 0x0031
#define DTYPE_BIT3 0x0032
#define DTYPE_BIT4 0x0033
#define DTYPE_BIT5 0x0034
#define DTYPE_BIT6 0x0035
#define DTYPE_BIT7 0x0036
#define DTYPE_BIT8 0x0037
#define ATYPE_R 0x07
#define ATYPE_RW 0x3F
#define ATYPE_RWpre 0x0F
#define ATYPE_RXPDO 0x40
#define ATYPE_TXPDO 0x80
void ESC_coeprocess (void);
uint16 sizeTXPDO (void);
uint16 sizeRXPDO (void);
extern void ESC_objecthandler (uint16 index, uint8 subindex);
extern const _objectlist SDOobjects[];
extern const _objd SDO1C12[];
extern const _objd SDO1C13[];
#endif

View File

@ -31,29 +31,17 @@
* property of, and protected by Beckhoff Automation GmbH.
*/
/** \file
/** \file
* \brief
* File over EtherCAT (FoE) module.
*/
#include "osal.h"
#include <cc.h>
#include "esc.h"
#include "esc_foe.h"
#include <string.h>
#undef ESC_DEBUG
#ifdef ESC_DEBUG
#define DPRINT(...) OSAL_PRINT ("esc_foe: "__VA_ARGS__)
#define DEBUG_ASSERT(expression) ASSERT(expression)
#else
#define DPRINT(...)
#define DEBUG_ASSERT(expression)
#endif /* DEBUG */
/** \file
* \brief
* File over EtherCAT (FoE) module.
@ -369,7 +357,7 @@ void FOE_read ()
{
FOEvar.foepacket = 1;
/*
* Attempt to send the packet
* Attempt to send the packet
*/
res = FOE_send_data_packet ();
if (res <= (int)FOE_DATA_SIZE)