#ifndef _PORT_H
#define _PORT_H


//#include "main.h"
#include "at32f403a_407.h"
#include "FreeRTOS.h"
#include "task.h"


/* ----------------------- Defines ------------------------------------------*/
#define	INLINE                      inline
#define PR_BEGIN_EXTERN_C           extern "C" {
#define	PR_END_EXTERN_C             }

#define ENTER_CRITICAL_SECTION( )   vMBPortEnterCritical()
#define EXIT_CRITICAL_SECTION( )    vMBPortExitCritical()

#define assert( x )

typedef char    BOOL;

typedef unsigned char UCHAR;
typedef char    CHAR;

typedef unsigned short USHORT;
typedef short   SHORT;

typedef unsigned long ULONG;
typedef long    LONG;



#define MB_PORT_HAS_CLOSE	                    1
#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS    2

/* ----------------------- Prototypes ---------------------------------------*/
void            vMBPortSetWithinException( BOOL bInException );
BOOL            bMBPortIsWithinException( void );

void            vMBPortEnterCritical( void );
void            vMBPortExitCritical( void );

void vMB_USART_IRQHandler(void);

#endif
