ECAT_Slave_in_ПЧ2П_c402  0.8
Реализация EtherCAT Slave для CM TMS320F28388D
Mailbox Functions
Граф связей класса Mailbox Functions:

Файлы

файл  mailbox.c
 Implementation.
 
файл  mailbox.h
 

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

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

Макросы

#define _MAILBOX_   1
 
#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_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. Подробнее...
 

Функции

UINT8 PutInMbxQueue (TMBX MBXMEM *pMbx, TMBXQUEUE MBXMEM *pQueue)
 
TMBX MBXMEMGetOutOfMbxQueue (TMBXQUEUE MBXMEM *pQueue)
 
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. Подробнее...
 
UINT8 MailboxServiceInd (TMBX MBXMEM *pMbx)
 The function checks the mailbox header for the requested service and calls the. Подробнее...
 
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. Подробнее...
 

Переменные

VARVOLATILE UINT8 u8dummy
 
BOOL bNoMbxMemoryAvailable
 Indicates if enough dynamic memory is available to handle at least one mailbox datagram. Подробнее...
 
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. Подробнее...
 

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

Макросы

◆ _MAILBOX_

#define _MAILBOX_   1

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

◆ AOE_SERVICE

#define AOE_SERVICE   ((UINT8) 0x0010)

AoE service.

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

◆ COE_SERVICE

#define COE_SERVICE   ((UINT8) 0x0002)

CoE service.

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

◆ EMCY_SERVICE

#define EMCY_SERVICE   ((UINT8) 0x0001)

Emergency service.

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

◆ EOE_SERVICE

#define EOE_SERVICE   ((UINT8) 0x0008)

EoE service.

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

◆ FOE_SERVICE

#define FOE_SERVICE   ((UINT8) 0x0040)

FoE service.

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

◆ FRAGMENTS_FOLLOW

#define FRAGMENTS_FOLLOW   ((UINT8) 0x0080)

Fragments follow service.

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

◆ MAX_MBX_DATA_SIZE

#define MAX_MBX_DATA_SIZE   (MAX_MBX_SIZE - MBX_HEADER_SIZE)

Mailbox data size.

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

◆ MAX_MBX_QUEUE_SIZE

#define MAX_MBX_QUEUE_SIZE   10

Mailbox queue size.

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

◆ MBX_HEADER_SIZE

#define MBX_HEADER_SIZE   6

Mailbox header size.

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

◆ MBX_TYPE_AOE

#define MBX_TYPE_AOE   1

Mailbox type AoE.

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

◆ MBX_TYPE_COE

#define MBX_TYPE_COE   3

Mailbox type CoE.

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

◆ MBX_TYPE_EOE

#define MBX_TYPE_EOE   2

Mailbox type EoE.

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

◆ MBX_TYPE_FOE

#define MBX_TYPE_FOE   4

Mailbox type FoE.

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

◆ MBX_TYPE_SOE

#define MBX_TYPE_SOE   5

Mailbox type SoE.

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

◆ MBX_TYPE_VOE

#define MBX_TYPE_VOE   15

Mailbox type VoE.

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

◆ MBXERR_INVALIDCHANNEL

#define MBXERR_INVALIDCHANNEL   0x03

Mailbox error "invalid channel".

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

◆ MBXERR_INVALIDHEADER

#define MBXERR_INVALIDHEADER   0x05

Mailbox error "invalid header".

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

◆ MBXERR_INVALIDSIZE

#define MBXERR_INVALIDSIZE   0x08

Mailbox error "Invalid size".

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

◆ MBXERR_NOMOREMEMORY

#define MBXERR_NOMOREMEMORY   0x07

Mailbox error "No memory".

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

◆ MBXERR_SERVICEINWORK

#define MBXERR_SERVICEINWORK   0x09

Mailbox error "Service in work".

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

◆ MBXERR_SERVICENOTSUPPORTED

#define MBXERR_SERVICENOTSUPPORTED   0x04

Mailbox error "service not supported".

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

◆ MBXERR_SIZETOOSHORT

#define MBXERR_SIZETOOSHORT   0x06

Mailbox error "Size too short".

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

◆ MBXERR_SYNTAX

#define MBXERR_SYNTAX   0x01

Mailbox error "syntax".

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

◆ MBXERR_UNSUPPORTEDPROTOCOL

#define MBXERR_UNSUPPORTEDPROTOCOL   0x02

Mailbox error "unsupported protocol".

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

◆ MBXSERVICE_MBXERRORCMD

#define MBXSERVICE_MBXERRORCMD   0x01

Mailbox error command.

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

◆ PROTO

#define PROTO   extern

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

◆ SOE_SERVICE

#define SOE_SERVICE   ((UINT8) 0x0004)

SoE service.

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

◆ VOE_SERVICE

#define VOE_SERVICE   ((UINT8) 0x0020)

VoE service.

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

Типы

◆ TMBX

typedef struct MBX_STRUCT_PACKED_START TMBX

Mailbox datagram.

◆ TMBXHEADER

Mailbox header.

Функции

◆ GetOutOfMbxQueue()

TMBX MBXMEM* GetOutOfMbxQueue ( TMBXQUEUE MBXMEM pQueue)

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

Граф вызова функции:

◆ MailboxServiceInd()

UINT8 MailboxServiceInd ( TMBX MBXMEM pMbx)

The function checks the mailbox header for the requested service and calls the.

Аргументы
pMbxPointer to the received Mailbox command from Master.

corresponding XXXX_ServiceInd-function

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

Граф вызовов:
Граф вызова функции:

◆ MBX_CheckAndCopyMailbox()

PROTO void MBX_CheckAndCopyMailbox ( void  )

This function is used to check if the received mailbox command can be processed.

   Also the contents of the Receive Mailbox will be copied in the variable sMbx.

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

Граф вызовов:
Граф вызова функции:

◆ MBX_CopyToSendMailbox()

PROTO UINT8 MBX_CopyToSendMailbox ( TMBX MBXMEM pMbx)

This function copies data to the Send Mailbox.

Аргументы
pMbxPointer to the Mailbox command to be send to the master.

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

Граф вызова функции:

◆ MBX_Init()

PROTO void MBX_Init ( void  )

This function intialize the Mailbox Interface.

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

Граф вызова функции:

◆ MBX_MailboxReadInd()

PROTO void MBX_MailboxReadInd ( void  )

This function is called when the Master has read the Send-Mailbox.

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

Граф вызовов:
Граф вызова функции:

◆ MBX_MailboxRepeatReq()

PROTO void MBX_MailboxRepeatReq ( void  )

This function is called if the Master has requested a resending of the last.

sent mailbox

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

Граф вызовов:
Граф вызова функции:

◆ MBX_MailboxSendReq()

PROTO UINT8 MBX_MailboxSendReq ( TMBX MBXMEM pMbx,
UINT8  flags 
)

This function puts a new Mailbox service in the Send Mailbox.

Аргументы
pMbxPointer to a Mailbox command to be sent (read by the Master)
flagsBit 0-6: mailbox protocol type: 0x01 - emergency service 0x02 - CoE service 0x04 - SoE service 0x80 - EoE service 0x10 - AoE service 0x20 - VoE service Bit 7: 0 - no more fragments to be sent for the requested mailbox service 1 - additional fragments to be sent for the mailbox service, the corresponding XXXX_ContinueInd-function will be called to get the next fragment
Возвращает
0: Success - mailbox command could be stored in the send mailbox 1: Failed - mailbox command could not be stored in the send mailbox, the XXXX_ContinueInd service will be called when the mailbox was read from the master to

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

Граф вызовов:
Граф вызова функции:

◆ MBX_MailboxWriteInd()

PROTO void MBX_MailboxWriteInd ( TMBX MBXMEM pMbx)

This function is called when the Master has written the Receive-Mailbox.

Аргументы
pMbxPointer to the received Mailbox command from Master.

It will only be called if the send mailbox is empty, that a response for the

mailbox service could be stored.

The function checks the mailbox header for the requested service and calls the

corresponding XXXX_ServiceInd-function

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

Граф вызовов:
Граф вызова функции:

◆ MBX_Main()

PROTO void MBX_Main ( void  )

This function is called cyclically to check if a received Mailbox service was stored.

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

Граф вызовов:
Граф вызова функции:

◆ MBX_StartMailboxHandler()

PROTO UINT16 MBX_StartMailboxHandler ( void  )

This function includes the state transition from INIT to.

PRE-OPERATIONAL in the EtherCAT Slave corresponding to

local management service Start Mailbox Handler

it is checked if the mailbox areas overlaps each other

and the Sync Manager channels 0 and 1 are enabled.

This function shall only be called if mailbox is supported.

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

Граф вызовов:
Граф вызова функции:

◆ MBX_StopMailboxHandler()

PROTO void MBX_StopMailboxHandler ( void  )

This function includes the state transition from.

PRE-OPERATIONAL to INIT in the EtherCAT Slave corresponding to

local management service Stop Mailbox Handler

the Sync Manager channels 0 and 1 are disabled

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

Граф вызовов:
Граф вызова функции:

◆ PutInMbxQueue()

UINT8 PutInMbxQueue ( TMBX MBXMEM pMbx,
TMBXQUEUE MBXMEM pQueue 
)

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

Граф вызова функции:

Переменные

◆ bMbxRepeatToggle

PROTO BOOL bMbxRepeatToggle

Mailbox repeat toggle.

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

◆ bMbxRunning

PROTO BOOL bMbxRunning

Mailbox running (At least PreOP state)

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

◆ bNoMbxMemoryAvailable

BOOL bNoMbxMemoryAvailable

Indicates if enough dynamic memory is available to handle at least one mailbox datagram.

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

◆ bReceiveMbxIsLocked

PROTO BOOL bReceiveMbxIsLocked

Receive mailbox is locked (MBoxOut, default SM0)

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

◆ bSendMbxIsFull

PROTO BOOL bSendMbxIsFull

Send mailbox is full (MBoxIn, default SM1)

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

◆ psReadMbx

PROTO TMBX MBXMEM* psReadMbx

Pointer to read mailbox buffer.

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

◆ psRepeatMbx

PROTO TMBX MBXMEM* psRepeatMbx

Pointer to repeat mailbox buffer.

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

◆ psStoreMbx

PROTO TMBX MBXMEM* psStoreMbx

Pointer to store mailbox buffer.

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

◆ psWriteMbx

PROTO TMBX MBXMEM* psWriteMbx

Pointer to write mailbox buffer.

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

◆ sMbxReceiveQueue

PROTO TMBXQUEUE MBXMEM sMbxReceiveQueue

Receive mailbox queue.

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

◆ sMbxSendQueue

PROTO TMBXQUEUE MBXMEM sMbxSendQueue

Send mailbox queue.

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

◆ u16EscAddrReceiveMbx

PROTO UINT16 u16EscAddrReceiveMbx

Receive mailbox address (default SM0)

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

◆ u16EscAddrSendMbx

PROTO UINT16 u16EscAddrSendMbx

Send mailbox address (default SM1)

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

◆ u16ReceiveMbxSize

PROTO UINT16 u16ReceiveMbxSize

Receive mailbox size (default SM0)

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

◆ u16SendMbxSize

PROTO UINT16 u16SendMbxSize

Send mailbox size (default SM1)

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

◆ u8dummy

VARVOLATILE UINT8 u8dummy
extern

См. определение в файле ecatslv.c строка 246

◆ u8MailboxSendReqStored

PROTO UINT8 u8MailboxSendReqStored

Mailbox send request stored.

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

◆ u8MbxReadCounter

PROTO UINT8 u8MbxReadCounter

Read mailbox counter.

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

◆ u8MbxWriteCounter

PROTO UINT8 u8MbxWriteCounter

Write mailbox counter.

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