123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #ifndef _MB_PORT_H
- #define _MB_PORT_H
- #ifdef __cplusplus
- PR_BEGIN_EXTERN_C
- #endif
- typedef enum
- {
- EV_READY,
- EV_FRAME_RECEIVED,
- EV_EXECUTE,
- EV_FRAME_SENT
- } eMBEventType;
- typedef enum
- {
- MB_PAR_NONE = 0,
- MB_PAR_ODD,
- MB_PAR_EVEN
- } eMBParity;
- #define MB_RX_SET gpio_bits_reset(GPIOD, GPIO_PINS_10)
- #define MB_TX_SET gpio_bits_set(GPIOD, GPIO_PINS_10)
- BOOL xMBPortEventInit( void );
- BOOL xMBPortEventPost( eMBEventType eEvent );
- BOOL xMBPortEventGet( eMBEventType * eEvent );
- BOOL xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate,
- UCHAR ucDataBits, eMBParity eParity, unsigned int stop_bit );
- void vMBPortClose( void );
- void xMBPortSerialClose( void );
- void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable );
- BOOL xMBPortSerialGetByte( CHAR * pucByte );
- BOOL xMBPortSerialPutByte( CHAR ucByte );
- BOOL xMBPortTimersInit( USHORT usTimeOut50us );
- void xMBPortTimersClose( void );
- void vMBPortTimersEnable( void );
- void vMBPortTimersDisable( void );
- void vMBPortTimersDelay( USHORT usTimeOutMS );
- extern BOOL( *pxMBFrameCBByteReceived ) ( void );
- extern BOOL( *pxMBFrameCBTransmitterEmpty ) ( void );
- extern BOOL( *pxMBPortCBTimerExpired ) ( void );
- BOOL xMBTCPPortInit( USHORT usTCPPort );
- void vMBTCPPortClose( void );
- void vMBTCPPortDisable( void );
- BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength );
- BOOL xMBTCPPortSendResponse( const UCHAR *pucMBTCPFrame, USHORT usTCPLength );
- #ifdef __cplusplus
- PR_END_EXTERN_C
- #endif
- #endif
|