 /*****************************************************************
 *
 * UART.h
 * UART Packet Handler
 *
 *
 *****************************************************************/
#ifndef UART_H
#define UART_H



/*** Macro Definitions **/


#define AST_UART_CHANNEL_NUM		4

#define AST_UART4_IRQ				34

#define BMC_UART4_DEV               "/dev/ttyS3"
#define BMC_UART1_DEV               "/dev/ttyS0"
#define BMC_UART2_DEV               "/dev/ttyS1"

#define AST_UART1_BASE                  0x1E783000
#define AST_UART2_BASE                  0x1E78D000
#define AST_UART3_BASE                  0x1E78E000
#define AST_UART4_BASE                  0x1E78F000
#define AST_UART5_BASE                  0x1E784000

/*--------------- Virtual address of the IO Registers Region  ------------*/

#define AST_UART1_VA_BASE               IO_ADDRESS(AST_UART1_BASE)
#define AST_UART2_VA_BASE               IO_ADDRESS(AST_UART2_BASE)
#define AST_UART3_VA_BASE               IO_ADDRESS(AST_UART3_BASE)
#define AST_UART4_VA_BASE               IO_ADDRESS(AST_UART4_BASE)
#define AST_UART5_VA_BASE               IO_ADDRESS(AST_UART5_BASE)



typedef struct
{
	unsigned char (*num_uart_ch) (void);
	void (*enable_uart_interrupt) (unsigned char  ch_num);
	void (*disable_uart_interrupt) (unsigned char  ch_num);
	void (*read_uart_status) (unsigned char  ch_num, unsigned char *status_value);
	void (*write_uart_status) (unsigned char  ch_num, unsigned char  status_value);
	void (*read_uart_data_in) (unsigned char ch_num, unsigned char *data_value);
	void (*write_uart_data_out) (unsigned char  ch_num, unsigned char  data_value);
	void (*uart_interrupt_enable_user) (unsigned char  ch_num);
	void (*uart_interrupt_disable_user) (unsigned char  ch_num);
} uart_hal_operations_t;

typedef struct
{
	int (*process_uart_intr) (int dev_id, unsigned char ch_num);
	int (*is_hw_test_mode) (void);
} uart_core_funcs_t;


extern int UART_Open_Port(char *port) ;
extern int UART_Set_Port(int fd, int speed, int flow_ctrl, int databits, int stopbits, int parity);
extern int UART_Recv_data(int fd,  char *rx_buff, int data_len);
extern int URT_Send_data(int fd, unsigned char *tx_buff, int data_len);

extern void* OEMSERIAL_TASK(void *pArg);

#endif /* UART_H */
