ECAT_Slave_in_ПЧ2П_c402  0.8
Реализация EtherCAT Slave для CM TMS320F28388D
Файл mailbox.h
#include "ecat_def.h"
Граф включаемых заголовочных файлов для mailbox.h:
Граф файлов, в которые включается этот файл:

См. исходные тексты.

Структуры данных

struct  MBX_STRUCT_PACKED_START
 CoE Mailbox header. Подробнее...
 
struct  TMBXQUEUE
 Mailbox queue. Подробнее...
 

Макросы

#define MBX_TYPE_AOE   1
 Mailbox type AoE. Подробнее...
 
#define MBX_TYPE_EOE   2
 Mailbox type EoE. Подробнее...
 
#define MBX_TYPE_COE   3
 Mailbox type CoE. Подробнее...
 
#define MBX_TYPE_FOE   4
 Mailbox type FoE. Подробнее...
 
#define MBX_TYPE_SOE   5
 Mailbox type SoE. Подробнее...
 
#define MBX_TYPE_VOE   15
 Mailbox type VoE. Подробнее...
 
#define EMCY_SERVICE   ((UINT8) 0x0001)
 Emergency service. Подробнее...
 
#define COE_SERVICE   ((UINT8) 0x0002)
 CoE service. Подробнее...
 
#define SOE_SERVICE   ((UINT8) 0x0004)
 SoE service. Подробнее...
 
#define EOE_SERVICE   ((UINT8) 0x0008)
 EoE service. Подробнее...
 
#define AOE_SERVICE   ((UINT8) 0x0010)
 AoE service. Подробнее...
 
#define VOE_SERVICE   ((UINT8) 0x0020)
 VoE service. Подробнее...
 
#define FOE_SERVICE   ((UINT8) 0x0040)
 FoE service. Подробнее...
 
#define FRAGMENTS_FOLLOW   ((UINT8) 0x0080)
 Fragments follow service. Подробнее...
 
#define MAX_MBX_QUEUE_SIZE   10
 Mailbox queue size. Подробнее...
 
#define MBXSERVICE_MBXERRORCMD   0x01
 Mailbox error command. Подробнее...
 
#define MBXERR_SYNTAX   0x01
 Mailbox error "syntax". Подробнее...
 
#define MBXERR_UNSUPPORTEDPROTOCOL   0x02
 Mailbox error "unsupported protocol". Подробнее...
 
#define MBXERR_INVALIDCHANNEL   0x03
 Mailbox error "invalid channel". Подробнее...
 
#define MBXERR_SERVICENOTSUPPORTED   0x04
 Mailbox error "service not supported". Подробнее...
 
#define MBXERR_INVALIDHEADER   0x05
 Mailbox error "invalid header". Подробнее...
 
#define MBXERR_SIZETOOSHORT   0x06
 Mailbox error "Size too short". Подробнее...
 
#define MBXERR_NOMOREMEMORY   0x07
 Mailbox error "No memory". Подробнее...
 
#define MBXERR_INVALIDSIZE   0x08
 Mailbox error "Invalid size". Подробнее...
 
#define MBXERR_SERVICEINWORK   0x09
 Mailbox error "Service in work". Подробнее...
 
#define MBX_OFFS_TYPE   1
 Protocol type offset. Подробнее...
 
#define MBX_OFFS_COUNTER   1
 Protocol counter offset. Подробнее...
 
#define MBX_MASK_TYPE   0x0F
 Protocol type mask. Подробнее...
 
#define MBX_MASK_COUNTER   0xF0
 Protocol counter mask. Подробнее...
 
#define MBX_SHIFT_TYPE   0
 Protocol type shift. Подробнее...
 
#define MBX_SHIFT_COUNTER   4
 Protocol counter shift. Подробнее...
 
#define MBX_HEADER_SIZE   6
 Mailbox header size. Подробнее...
 
#define MAX_MBX_DATA_SIZE   (MAX_MBX_SIZE - MBX_HEADER_SIZE)
 Mailbox data size. Подробнее...
 
#define PROTO   extern
 

Определения типов

typedef struct MBX_STRUCT_PACKED_START TMBXHEADER
 Mailbox header. Подробнее...
 
typedef struct MBX_STRUCT_PACKED_START TMBX
 Mailbox datagram. Подробнее...
 

Функции

void MBX_Init (void)
 This function intialize the Mailbox Interface. Подробнее...
 
UINT16 MBX_StartMailboxHandler (void)
 This function includes the state transition from INIT to. Подробнее...
 
void MBX_StopMailboxHandler (void)
 This function includes the state transition from. Подробнее...
 
void MBX_MailboxWriteInd (TMBX MBXMEM *pMbx)
 This function is called when the Master has written the Receive-Mailbox. Подробнее...
 
void MBX_MailboxReadInd (void)
 This function is called when the Master has read the Send-Mailbox. Подробнее...
 
void MBX_MailboxRepeatReq (void)
 This function is called if the Master has requested a resending of the last. Подробнее...
 
UINT8 MBX_MailboxSendReq (TMBX MBXMEM *pMbx, UINT8 flags)
 This function puts a new Mailbox service in the Send Mailbox. Подробнее...
 
void MBX_CheckAndCopyMailbox (void)
 This function is used to check if the received mailbox command can be processed. Подробнее...
 
UINT8 MBX_CopyToSendMailbox (TMBX MBXMEM *pMbx)
 This function copies data to the Send Mailbox. Подробнее...
 
void MBX_Main (void)
 This function is called cyclically to check if a received Mailbox service was stored. Подробнее...
 

Переменные

PROTO BOOL bReceiveMbxIsLocked
 Receive mailbox is locked (MBoxOut, default SM0) Подробнее...
 
PROTO BOOL bSendMbxIsFull
 Send mailbox is full (MBoxIn, default SM1) Подробнее...
 
PROTO BOOL bMbxRunning
 Mailbox running (At least PreOP state) Подробнее...
 
PROTO BOOL bMbxRepeatToggle
 Mailbox repeat toggle. Подробнее...
 
PROTO UINT16 u16SendMbxSize
 Send mailbox size (default SM1) Подробнее...
 
PROTO UINT16 u16ReceiveMbxSize
 Receive mailbox size (default SM0) Подробнее...
 
PROTO UINT16 u16EscAddrReceiveMbx
 Receive mailbox address (default SM0) Подробнее...
 
PROTO UINT16 u16EscAddrSendMbx
 Send mailbox address (default SM1) Подробнее...
 
PROTO UINT8 u8MbxWriteCounter
 Write mailbox counter. Подробнее...
 
PROTO UINT8 u8MbxReadCounter
 Read mailbox counter. Подробнее...
 
PROTO UINT8 u8MailboxSendReqStored
 Mailbox send request stored. Подробнее...
 
PROTO TMBX MBXMEMpsWriteMbx
 Pointer to write mailbox buffer. Подробнее...
 
PROTO TMBX MBXMEMpsReadMbx
 Pointer to read mailbox buffer. Подробнее...
 
PROTO TMBX MBXMEMpsRepeatMbx
 Pointer to repeat mailbox buffer. Подробнее...
 
PROTO TMBX MBXMEMpsStoreMbx
 Pointer to store mailbox buffer. Подробнее...
 
PROTO TMBXQUEUE MBXMEM sMbxSendQueue
 Send mailbox queue. Подробнее...
 
PROTO TMBXQUEUE MBXMEM sMbxReceiveQueue
 Receive mailbox queue. Подробнее...
 

Подробное описание

Автор
Ether.nosp@m.catS.nosp@m.SC@be.nosp@m.ckho.nosp@m.ff.co.nosp@m.m
Версия
5.12


Changes to version V5.11:
V5.12 ECAT2: big endian changes
V5.12 MBX3: handle incomplete mailbox communication

Changes to version V5.01:
V5.11 ECAT10: change PROTO handling to prevent compiler errors
V5.11 MBX1: "return value of ""MBX_StartMailboxHandler()"" changed to UINT16"
V5.11 MBX3: set application triggered emergency and EoE data to pending if no mailbox queue is supported and another mailbox request is currently handled, Handle only one mailbox request at a time (in case that MAILBPX_QUEUE is disabled)

Changes to version - :
V5.01 : Start file change log

См. определение в файле mailbox.h

Макросы

◆ MBX_MASK_COUNTER

#define MBX_MASK_COUNTER   0xF0

Protocol counter mask.

См. определение в файле mailbox.h строка 108

◆ MBX_MASK_TYPE

#define MBX_MASK_TYPE   0x0F

Protocol type mask.

См. определение в файле mailbox.h строка 107

◆ MBX_OFFS_COUNTER

#define MBX_OFFS_COUNTER   1

Protocol counter offset.

См. определение в файле mailbox.h строка 106

◆ MBX_OFFS_TYPE

#define MBX_OFFS_TYPE   1

Protocol type offset.

См. определение в файле mailbox.h строка 105

◆ MBX_SHIFT_COUNTER

#define MBX_SHIFT_COUNTER   4

Protocol counter shift.

См. определение в файле mailbox.h строка 110

◆ MBX_SHIFT_TYPE

#define MBX_SHIFT_TYPE   0

Protocol type shift.

См. определение в файле mailbox.h строка 109