demo/BARE
if not RTOS is available or demo/BARERTOS
if an RTOS is available.
Modules | |
MODBUS Porting Layer Verification | |
MODBUS Porting Layer (Serial) | |
MODBUS Porting Layer (TCP) | |
MODBUS Porting Layer (UDP) | |
Defines | |
#define | INLINE inline |
#define | STATIC static |
#define | PR_BEGIN_EXTERN_C extern "C" { |
#define | PR_END_EXTERN_C } |
#define | MBM_PORT_ASSERT(x) assert( x ) |
#define | MBM_PORT_ENTER_CRITICAL_SECTION() |
#define | MBM_PORT_EXIT_CRITICAL_SECTION() |
#define | TRUE ( BOOL )1 |
#define | FALSE ( BOOL )0 |
#define | MBM_PORT_EVENTHDL_INVALID NULL |
#define | MBM_PORT_TIMERHDL_INVALID NULL |
#define | MBM_PORT_SERIALHDL_INVALID NULL |
#define | MBM_PORT_TCPHDL_INVALID NULL |
Typedefs | |
typedef UBYTE | xMBPEventType |
typedef BOOL(* | pbMBPTimerExpiredCB )(xMBHandle xHdl) |
typedef void * | xMBMPortEventHandle |
typedef void * | xMBMPortTimerHandle |
typedef void * | xMBMPortSerialHandle |
typedef void * | xMBMPortTCPHandle |
typedef char | BOOL |
typedef unsigned char | UBYTE |
typedef char | BYTE |
typedef unsigned char | UCHAR |
typedef char | CHAR |
typedef unsigned short | USHORT |
typedef short | SHORT |
typedef unsigned long | ULONG |
typedef long | LONG |
Functions | |
eMBErrorCode | eMBPTimerInit (xMBPTimerHandle *xTimerHdl, USHORT usTimeOut1ms, pbMBPTimerExpiredCB pbMBPTimerExpiredFN, xMBHandle xHdl) |
void | vMBPTimerClose (xMBPTimerHandle xTimerHdl) |
eMBErrorCode | eMBPTimerSetTimeout (xMBPTimerHandle xTimerHdl, USHORT usTimeOut1ms) |
eMBErrorCode | eMBPTimerStart (xMBPTimerHandle xTimerHdl) |
eMBErrorCode | eMBPTimerStop (xMBPTimerHandle xTimerHdl) |
eMBErrorCode | eMBPEventCreate (xMBPEventHandle *pxEventHdl) |
eMBErrorCode | eMBPEventPost (const xMBPEventHandle xEventHdl, xMBPEventType xEvent) |
BOOL | bMBPEventGet (const xMBPEventHandle xEventHdl, xMBPEventType *pxEvent) |
void | vMBPEventDelete (xMBPEventHandle xEventHdl) |
void | vMBPLibraryLoad (void) |
void | vMBPLibraryUnload (void) |
void | vMBPPortLog (eMBPortLogLevel eLevel, eMBPortLogFacility eModule, const CHAR *szFmt,...) |
BOOL | bMBPPortLogIsEnabled (eMBPortLogLevel eLevel, eMBPortLogFacility eModule) |
void | vMBPGetTimeStamp (xMBPTimeStamp *pTimeStamp) |
|
A boolean evaluating to false in an boolean C-Expression.
|
|
INLINE macro to match different compiler types.
|
|
An assertion macro. If this function is called the port should enter its debug mode and the system should be restarted. |
|
This macro must disable interrupts on the system. This function disable interrupts and keeps track on the number of times it has been called. Typically it would save the processor status register on entry, disable interrupts and if it was called the first time it will save the processor status register. At every call it would increment the so called nesting counter. |
|
An invalid handle for an event queue.
|
|
This macro should restore the old system status. If this function has been called the same time as the function MBM_PORT_ENTER_CRITICAL_SECTION is should restore the processor context stored when MBM_PORT_ENTER_CRITICAL_SECTION was called the first time. A typical implementation would decrement the counter and if the counter reaches zero it would restore the old value. |
|
An invalid handle for a serial port.
|
|
An invalid handle for a TCP instance.
|
|
An invalid handle for a timer.
|
|
Mark functions as C code for C++ sources. Start tag.
|
|
Mark functions as C code for C++ sources. End tag.
|
|
STATIC macro to match different compiler types.
|
|
A boolean evaluating to true in an boolean C-Expression.
|
|
Boolean data type.
|
|
A byte holding value from -128 to 127.
|
|
A character holding value from -128 to 127.
|
|
An signed long value holding values from -2147483648 to 2147483647.
|
|
A callback function which should be called if the timer has expired.
|
|
An signed short value holding values from -32768 to 32767.
|
|
An unsigned byte holding value from 0 to 255.
|
|
An unsigned character holding value from 0 to 255.
|
|
An unsigned long value holding values from 0 to 4294967296.
|
|
An unsigned short value holding values from 0 to 65535.
|
|
A port dependent type for an event handle.
|
|
A port dependent type for a serial handle.
|
|
A port dependent type for a TCP handle.
|
|
A port dependent type for a timer handle.
|
|
An abstract data type used as an interface to the event queues.
|
|
Get an event from the queue.
|
|
Checks if a given level module is enabled. This is used to improve execution speed because if logging is not required the printf formatter is not called and a function call is avoided.
|
|
Creates a new event handler.
An event handler allows the posting of an event. At most one event is posted at once and this event can be retrieved later by calling bMBPEventGet. The function bMBPEventGet should return
|
|
Post a event to an event queue.
|
|
Creates a new Timer and returns a handle to this timer.
Timers are a generic instruction. If the timer has been started by a call to eMBPTimerStart a callback should be made when the timer has expired using the function pointer pbMBPTimerExpiredFN with the handle xHdl as an argument. The following semantics are important for the implementation of the porting layer:
|
|
Changes the timeout for a timer.
|
|
Starts the timer. When a timer has been started the timer module should perform a callback after the timeout for this timer has been elapsed or the timer has been disabled before it has expired.
|
|
Stops the timer. If the timer has been stopped no callbacks should be performed.
|
|
Releases the event queue.
|
|
Get the current timestamp. This function must store the current implementation dependent timestamp into the variable pointed to by pTimeStamp. It must be safe for an implementation to copy this data structure into a different one, for example by using memcpy. |
|
If the advanced startup/shutdown functionallity has been enabled this function is called when the first TCP or RTU/ASCII instance is created. This functionallity can be enabled by setting the macro MBP_ADVA_STARTUP_SHUTDOWN_ENABLED to 1 in the file mbmconfig.h or mbsconfig.h. |
|
If the advanced startup/shutdown functionallity has been enabled this function is called when the last TCP or RTU/ASCII has been removed. This functionallity can be enabled by setting the macro MBP_ADVA_STARTUP_SHUTDOWN_ENABLED to 1 in the file mbmconfig.h or mbsconfig.h. |
|
Log a message using using the porting layer facility.
|
|
Releases this timer.
|