⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simple_serial.h

📁 此程序为查询方式下的tl16c750程序.开发环境为uClinux2.4.x+s3c440b.不需要向uClinux内核中加入驱动
💻 H
字号:


/*=====================================================
*
*  	File Name: 
*	---------
*	tl16c750.h  
*
*  	Copyright: 
*	--------
*	Beijing Founder Electronics CO.LTD
*
*	Modification History:
*	-----------------
*	2006-7-17, zhang dahai, created(9-4-10-37).
*
*	Description:
*	----------
*	the header file of tl16c750, which is one of the drivers for digital 
*	jet printing machine.
*
=====================================================*/

#ifndef	 _SIMPLE_SERIAL_H_
#define	 _SIMPLE_SERIAL_H_

/*===================================================*/
/*                                         gereneral                                                           */
/*===================================================*/

/*=================device number=========================*/

#define 	TL16C750_NAME 		"tl16c750"	/*device name of tl16c750*/
#define 	TL16C750_MAJOR 	125			/*the major device number of tl16c750*/



/* =================for LoopQueue=========================*/

#define   MAX_ITEM_NUM		20			/*number of  items in LoopQueue*/
#define   MAX_MSG_LEN		56			/*byte number of each item in LoopQueue*/

/*=================buad rate related=======================*/

#define 	XTALL						12288000	/*Hz*/
#define 	DESIRED_BAUD_RATE		9600//768000		/*bps*/

/*===================================================*/
/*                                         TL16C750                                                           */
/*===================================================*/

/*================tl16c750 Registers========================*/

#define	TL16C750_BASE_ADDR			0x06000000	/*nGCS3 of ARM*/
#define	TL16C750_FIFO				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x00)
#define   TL16C750_IER				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x01)
#define   TL16C750_IIR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x02)
#define   TL16C750_FCR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x02)
#define   TL16C750_LCR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x03)
#define   TL16C750_MCR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x04)
#define   TL16C750_LSR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x05)
#define   TL16C750_MSR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x06)
#define   TL16C750_SR				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x07)
#define   TL16C750_DLSB				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x00)
#define   TL16C750_DMSB				*(volatile unsigned char *)(TL16C750_BASE_ADDR+0x01)

/*================FIFO control register======================*/

#define  	FCR_FIFO_ENALBE			0x01
#define   FCR_CLR_RX_FIFO			0x02
#define   FCR_CLR_TX_FIRO			0x03
#define   FCR_64_BYTE_MODE 			0x20
#define   FCR_1_TRIGGER_LEVEL_16 	0x00
#define   FCR_4_TRIGGER_LEVEL_16 	0x40
#define   FCR_8_TRIGGER_LEVEL_16 	0x80
#define   FCR_14_TRIGGER_LEVEL_16 	0xC0
#define   FCR_1_TRIGGER_LEVEL_64 	0x00
#define   FCR_16_TRIGGER_LEVEL_64 	0x40
#define   FCR_32_TRIGGER_LEVEL_64 	0x80
#define   FCR_56_TRIGGER_LEVEL_64 	0xC0

/*================interrupt enalbe register===================*/

#define 	IER_EN_RDA_INT			0x01
#define   IER_EN_THRE_INT			0x02
#define   IER_EN_RLS_INT				0x04
#define   IER_EN_MS_INT				0x08
#define 	IER_EN_SLEEP_MODE			0x10
#define 	IER_EN_LPWR_MODE			0x20
#define 	IER_DISEN_ALL				0x00

/*================interrupt identify register==================*/

#define 	IIR_RLS_INT					0x06	/*receiver line status*/
#define   IIR_RDA_INT				0x04	/*receiver data available*/
#define 	IIR_CTOI_INT				0x0C	/*char time out indicater*/
#define 	IIR_THRE_INT				0x02	/*transmitter holding register empty*/
#define	IIR_MS_INT					0x00	/*modem status*/

/*==================line control register===================*/

#define 	LCR_5_CHR_BIT				0x00
#define 	LCR_6_CHR_BIT				0x01
#define 	LCR_7_CHR_BIT				0x02
#define 	LCR_8_CHR_BIT				0x03
#define   LCR_1_STOP_BIT				0x00
#define   LCR_2_STOP_BIT				0x04
#define   LCR_EN_PARITY				0x08
#define 	LCR_EN_EVEN_PARITY		0x10
#define   LCR_EN_STICK_PARITY		0x20
#define   LCR_EN_BREAK_CONTRL		0x40
#define   LCR_DLAB					0x80

/*==================line status register===================*/

#define  	LSR_DATA_READY 			0x01	/*the data ready (DR) indicator for the receiver.*/
#define   LSR_OVER_RUN_ERROR		0x02	/*the overrun error (OE) indicator.*/
#define   LSR_PARITY_ERROR			0x04	/*the parity error (PE) indicator.*/
#define   LSR_FRAME_ERROR			0x08	/*the framing error (FE) indicator.*/
#define   LSR_BREAK_INT				0x10	/*the break interrupt (BI) indicator.*/
#define   LSR_THRE					0x20	/*the transmitter holding register empty indicator.*/
#define   LSR_TEMT					0x40	/*the transmitter empty (TEMT) indicator.*/
#define   LSR_FIFO_ERR				0x80	/*In the FIFO mode, LSR7 isset when there is at least */
											/*one parity, framing, or break error in the FIFO.*/

/*=================modem control register================*/

#define  	MCR_DTR_OUT				0x01
#define   MCR_RTS_OUT				0x02
#define   MCR_OUT1					0x04
#define   MCR_OUT2					0x08
#define   MCR_LOOP_BACK				0x10
#define   MCR_EN_AUTO_FLOW			0x22
#define   MCR_EN_AUTO_CTS			0x20
#define   MCR_EN_AUTO_RTS			0x00

/*===================================================*/
/*                               protocol bewteen host and arm                                       */
/*===================================================*/

/*=================TrCode======================*/

#define   TC_RESPONSE				0x10		/*response*/
#define   TC_CMD_REQUEST			0x00		/*command request*/
#define   TC_CMD_REPORT			0x02		/*command report*/
#define   TC_STS_REPORT				0x03		/*status report*/

#define   RESPONSE_LEN				4			/*the length of struct--response*/

/*==============operation code====================*/

#define  OP_CODE_INITIALIZE			0x00
#define  OP_CODE_RESET				0x01
#define  OP_CODE_STATUS_REQUEST	0x02

#define  OP_CODE_START_JOB			0x10
#define  OP_CODE_END_JOB			0x11
#define  OP_CODE_START_PAGE		0x12
#define  OP_CODE_END_PAGE			0x13
#define  OP_CODE_ABORT_JOB		0x14

/*==========error code in the struct of response ==========*/

#define 	ERR_CODE_NO				0x00		/*NO error(ACK)*/
#define 	ERR_CODE_OVERRUN		0x01		/*Overrun Error (NACK)*/
#define 	ERR_CODE_PARITY			0x02		/*Parity Error (NACK)*/
#define 	ERR_CODE_FRAME			0x03		/*Framing Error (NACK)*/
#define 	ERR_CODE_CHR_TIMEOUT	0x04		/*Character Timeout Error (NACK)*/
#define 	ERR_CODE_CHKSUM			0x05		/*CheckSum Error (NACK)*/
#define 	ERR_CODE_SN				0x06		/*Sequence Number Error (NACK)*/

/*=================report code===================*/

#define 	REPORT_CODE_COMPLETE			0x00
#define	REPORT_CODE_CMD_REJECTED		0x01
#define	REPORT_CODE_UNDEF_CMD			0x02
#define	REPORT_CODE_PARA_ERR			0x03
#define	REPORT_CODE_CMD_TIMEOUT		0x04
#define	REPORT_CODE_HADRDWARE_ERR		0x05
#define	REPORT_CODE_MEM_NOT_ENOUGH	0x06

/*=================header forma==================t*/

#define	HEADER_FORMAT_JOB_HEADER		0x00
#define	HEADER_FORMAT_JOB_FOOTER		0x01
#define	HEADER_FORMAT_PAGE_HEADER		0x02
#define	HEADER_FORMAT_PAGE_FOOTER		0x03

/*==================jet freq=====================*/

#define	JET_FREQ_5K			0x00
#define	JET_FREQ_10K			0x01
#define	JET_FREQ_15K			0x02
#define	JET_FREQ_20K			0x03

/*==================job type=====================*/

#define	JOB_TYPE_NORMAL		0x00
#define	JOB_TYPE_MAINTENANCE		0x01

/*=================gradation=====================*/

#define	GRADATION_1B			0x01
#define	GRADATION_2B			0x02
#define	GRADATION_4B			0x04
#define	GRADATION_8B			0x08

/*=================resolution=====================*/

#define	RESOLUTION_H_300		0x00
#define	RESOLUTION_H_360		0x01
#define	RESOLUTION_H_480		0x02
#define	RESOLUTION_H_600		0x03
#define	RESOLUTION_H_720		0x04
#define	RESOLUTION_H_1200		0x05
#define	RESOLUTION_H_1440		0x06
#define	RESOLUTION_H_2400		0x07

#define	RESOLUTION_L_300		0x00
#define	RESOLUTION_L_360		0x10
#define	RESOLUTION_L_480		0x20
#define	RESOLUTION_L_600		0x30
#define	RESOLUTION_L_720		0x40
#define	RESOLUTION_L_1200		0x50
#define	RESOLUTION_L_1440		0x60
#define	RESOLUTION_L_2400		0x70

/*===============image setting=====================*/

#define	COLOR_MODE_K			0x01
#define	COLOR_MODE_C			0x02
#define	COLOR_MODE_M			0x04
#define	COLOR_MODE_Y			0x08

#define   DUPLEX_MODE_SIMPLE		x00
#define	DUPLEX_MODE_DUPLEX		x10

/*=================color========================*/

#define	COLOR_K			0x01
#define	COLOR_C			0x02
#define	COLOR_M			0x04
#define	COLOR_Y			0x08

/*===============basic status=====================*/

#define	BASIC_STATUS_ERR				0x01
#define	BASIC_STATUS_WAIT				0x02
#define	BASIC_STATUS_OPERATOR_CALL	0x04
#define	BASIC_STATUS_MAINTENANCE	0x08
#define	BASIC_STATUS_PRINTER_BUSY	0x10
#define	BASIC_STATUS_JET_FREQ			0x20

/*============operator call status====================*/

#define	OPERATOR_CALL_NO_PAPER		0x01
#define	OPERATOR_CALL_PAPER_JAM		0x02
#define	OPERATOR_CALL_C_INK_EMPTY	0x04
#define	OPERATOR_CALL_M_INK_EMPTY	0x08
#define	OPERATOR_CALL_Y_INK_EMPTY	0x10
#define	OPERATOR_CALL_K_INK_EMPTY	0x20

/*==============wait status=======================*/

#define  	WAIT_STATUS_SLEEPING				0x01
#define  	WAIT_STATUS_WARMING				0x02
#define  	WAIT_STATUS_MEM_NOT_ENOUGH	0x04

/*==for the number of array--response, used in interrupt handler===*/

#define 	RSP_CHK_SUM				0			/*check sum*/
#define	RSP_TR_CODE				1			/*Trcode*/
#define   RSP_SN						2			/*Sequence Number*/
#define   RSP_ERR_CODE				3			/*error code*/



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -