#ifndef		__Multiplex_Port_H_
#define		__Multiplex_Port_H_
/*H******************************************************************************
* NAME:         Multiplex_Port.h
*********************************************************************************/

//******************************************************************************
//硬件定义

typedef enum
{
	Multiplex_Normal,
	Multiplex_GPS=1,
  Multiplex_Print=4,
	Multiplex_Price=5,
	Multiplex_YWY=6,
  
}MultiplexItem;

#define Multiplex_Port_RS485_RxEN1       GPIO_ResetBits(GPIOC,GPIO_Pin_9);
#define Multiplex_Port_RS485_TxEN1       GPIO_SetBits(GPIOC,GPIO_Pin_9);
#define Multiplex_Port_RS485_RxEN2       GPIO_ResetBits(GPIOC,GPIO_Pin_14);
#define Multiplex_Port_RS485_TxEN2       GPIO_SetBits(GPIOC,GPIO_Pin_14);

#define Multiplex_Port_TX_DMAAddrSet(x) (DMA2_Stream6->M0AR = x)      //设置流量计发送缓存地址
#define Multiplex_Port_TX_DMALenSet(x)  (DMA2_Stream6->NDTR = x)     //设置流量计DMA发送长度
#define Multiplex_Port_TX_DMAStart()    DMA_Cmd(DMA2_Stream6,ENABLE) ;Multiplex_Port_TX_Flag = 0; //开启流量计DMA发送
#define Multiplex_Port_TX_DMAStop()     DMA_Cmd(DMA2_Stream6,DISABLE) //关闭流量计DMA发送

#define Multiplex_Port_RX_DMAAddrSet(x) (DMA2_Stream1->M0AR = x)      //设置流量计接收缓存地址
#define Multiplex_Port_RX_DMALenSet(x)  (DMA2_Stream1->NDTR = x)     //设置流量计DMA接收
#define Multiplex_Port_RX_DMAStart()    DMA_Cmd(DMA2_Stream1,ENABLE)  //开启流量计DMA接收
#define Multiplex_Port_RX_DMAStop()     DMA_Cmd(DMA2_Stream1,DISABLE) //关闭流量计DMA接收
extern volatile u8 Multiplex_Port_TX_Flag;//
extern volatile u8 Multiplex_Port_RX_Flag;//
extern void Multiplex_Port_DMATX_IRQHandler(void);
extern void Multiplex_Port_DMARX_IRQHandler(void);
extern u16 mystrstr(u8 *s1,u8 *s2);
extern void StringToHex(u8 *Str,u8 *H,u8 Len);
extern u16 CRC_Check(u8 *puchMsg, u16 usDataLen) ;
extern u16 BigToLittle( u16 BigData);
extern void Multiplex_Port_Init(void);	
extern void Multiplex_Port_USART_Configuration(u32 Baud,u8 Check);
extern void Multiplex_PortTXTask(u8 PosTypeTemp,u8 MD_TX_CMD);
extern void Multiplex_PortRXTask(void);
extern u8 Price_DataCheck(volatile u8* pData, u16 len);
#endif	//#ifndef		
