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

📄 sed_drv.c

📁 Linux kernel driver for Epson s1d13700 LCD controller.
💻 C
📖 第 1 页 / 共 3 页
字号:
	wmb();	}}//********************************// Clean LCD...)void CleanLCD(void){  memset_io(GRAPH_MEM_REGION+SAD1,0x20,SAD2-1);  memset_io(GRAPH_MEM_REGION+SAD2,0,SAD3-1);}//********************************void ShowLogo(void){  memcpy_toio(GRAPH_MEM_REGION+SAD2,(BYTE*)logo_array,(long)WIDTH*HEIGHT/8);}//********************************//void pixel(int x, int y, BYTE c){  long int addr;  BYTE bt;  BYTE mask;  if ((x < 0) || (x >= WIDTH) || (y < 0) || (y >= HEIGHT)) return;  //printk(KERN_DEBUG "x = %03d; y = %03d; ", x,y);  addr = SAD2 + (WIDTH/8)*y + (x/8);  if ((addr>=0)&&(addr<0x7000))  {	//printk(KERN_DEBUG "addr = %04lX; ", addr);	//bt = ioread8(GRAPH_MEM_REGION+addr);	bt = readb(GRAPH_MEM_REGION+addr);  	mb();  	//udelay(1);  	//udelay(5);  	//printk(KERN_DEBUG "bt = %02X; ", bt);  	c = c & 1;  	c = c << (7 - (x % 8));  	mask = 1 << (7 - (x % 8));  	bt = (bt & (~mask)) | c;  	//printk(KERN_DEBUG "bt2 = %02X \n", bt);  	//GRAPH_MEM_REGION[addr]=bt;  	//iowrite8(bt,GRAPH_MEM_REGION+addr);  	writeb(bt,GRAPH_MEM_REGION+addr);  	mb();  	//udelay(1);  }  else  {	  printk("errrrrrrrrrrrrrrrrrrooooooooooooooorrrrrrrrrrrr!!\n");  }}//********************************//void line(int x, int y, int x2, int y2, BYTE c){if ((x>319)||(x<0)) return;if ((y>239)||(y<0)) return;if ((x2>319)||(x2<0)) return;if ((y2>239)||(y2<0)) return;int i, steep = 0, sx, sy, dx, dy, e;  dx = abs(x2 - x);  sx = ((x2 - x) > 0) ? 1 : -1;  dy = abs(y2 - y);  sy = ((y2 - y) > 0) ? 1 : -1;  if (dy > dx)  {    steep = 1;    x = x^y;    y = y^x;    x = x^y;    dx = dx^dy;    dy = dy^dx;    dx = dx^dy;    sx = sx^sy;    sy = sy^sx;    sx = sx^sy;  }  e = 2*dy - dx;	for (i=0; i<dx; i++)	{    if (steep) pixel(y, x, c);    else pixel(x, y, c);    while( e >= 0)    {      y = y + sy;      e = e - 2*dx;    }    x = x + sx;    e = e + 2*dy;  }  pixel(x2, y2, c);}//********************************************************//void dotline(int x, int y, int x2, int y2, BYTE c){  int i, steep = 0, sx, sy, dx, dy, e;  dx = abs(x2 - x);  sx = ((x2 - x) > 0) ? 1 : -1;  dy = abs(y2 - y);  sy = ((y2 - y) > 0) ? 1 : -1;  if (dy > dx)  {    steep = 1;    x = x^y;    y = y^x;    x = x^y;    dx = dx^dy;    dy = dy^dx;    dx = dx^dy;    sx = sx^sy;    sy = sy^sx;    sx = sx^sy;  }  e = 2*dy - dx;	for (i=0; i<dx; i++)	{//        mx = x - (x div y) * y;  //      my = y mod 2;        if (((x%2)^(y%2))>0)        {            if (steep) pixel(y, x, c);            else pixel(x, y, c);        }        while( e >= 0)        {          y = y + sy;          e = e - 2*dx;        }        x = x + sx;        e = e + 2*dy;    }    if (((x2%2)^(y2%2))>0)        pixel(x2, y2, c);}//********************************//void circle(int xc, int yc, int r, BYTE c){  int x = 0, y = r, d = 2*(1 - r);  while (y > 0)  {    pixel(xc+x, yc+y, c);    pixel(xc+x, yc-y, c);    pixel(xc-x, yc+y, c);    pixel(xc-x, yc-y, c);    if ((d + y) > 0)    {      y = y - 1;      d = d - (int)(2*y*1) - 1;    }    if (x > d)    {      x = x + 1;      d = d + 2*x + 1;    }  }  pixel(xc+x, yc+y, c);  pixel(xc+x, yc-y, c);  pixel(xc-x, yc+y, c);  pixel(xc-x, yc-y, c);}//-----------------------------------------------------------//****************************//void hor_line(int x1,int x2, int y,BYTE c)// ПХЯСЕЛ ЦНПХГНМРЮКЭМСЧ КХМХЧ ЯКЕБЮ МЮОПЮБН => x2>x1{BYTE ct,bt;//	for(i=x1;i<=x2;i++)pixel(i,y,c);int addr;  addr = SAD2 + (WIDTH/8)*y + (x1/8);  bt = GRAPH_MEM_REGION[addr];  rmb();  if ((c&1)==1)  {  	ct=0xff>>(x1%8); 	bt|=ct;	GRAPH_MEM_REGION[addr]=bt;	wmb();	memset_io(GRAPH_MEM_REGION+addr+1,0xFF,(x2/8)-(x1/8)-1);	wmb();	bt = GRAPH_MEM_REGION[addr+(x2/8)-(x1/8)];	rmb();	ct=0xff<<(7-(x2%8));	bt|=ct;	GRAPH_MEM_REGION[addr+((x2/8)-(x1/8))]=bt;	wmb();  }  else  {  	ct=0xff<<(7-(x1%8)+1);  	bt&=ct;	GRAPH_MEM_REGION[addr]=bt;	wmb();	memset_io(GRAPH_MEM_REGION+addr+1,0,(x2/8)-(x1/8)-1);	wmb();	bt = GRAPH_MEM_REGION[addr+(x2/8)-(x1/8)];	rmb();	ct=0xff>>(x2%8);	bt&=ct;	GRAPH_MEM_REGION[addr+((x2/8)-(x1/8))]=bt;	wmb();  }}//****************************//void vert_line(int x,int y1,int y2,BYTE c)//ПХЯСЕР БЕПРХЙХКЭМСЧ КХМХЧ ЯБЕПУС БМХГ => y2>y1{int i,addr;BYTE ct,bt;	for(i=0;i<y2-y1;i++)	{		addr=SAD2+(WIDTH/8)*(y1+i)+x/8;		bt = GRAPH_MEM_REGION[addr];		rmb();		ct=c&1;		ct=ct<<(7-(x % 8));  		bt = (bt & (~ct)) | ct;		GRAPH_MEM_REGION[addr] = bt;		wmb();	 }}//****************************//void vert_line_xor(int x,int y1,int y2)//ПХЯСЕР БЕПРХЙХКЭМСЧ КХМХЧ ЯБЕПУС БМХГ => y2>y1{int i,addr;BYTE ct,bt;	for(i=0;i<y2-y1;i++)	{//		printk("BUGAGAGAGAGA!!! \n");		addr=SAD2+(WIDTH/8)*(y1+i)+x/8;		if ((addr<0)||(addr>0x7000))		{			printk("!!!!!!!!!!!!!!!!!!ERRRRRRRRRRRROOOOOOOOOOOOOORRRRRRRRRRRr!!!!!!!!!!\n");		}		bt = GRAPH_MEM_REGION[addr];		rmb();		ct=i&1;		ct=ct<<(7-(x % 8));  		bt = bt ^ ct;		GRAPH_MEM_REGION[addr] = bt;		wmb();	 }}//********************************//void rect(int x1, int y1, int x2, int y2, BYTE c){  hor_line(x1, x2, y1, c);  hor_line(x1, x2, y2, c);  vert_line(x1, y1, y2, c);  vert_line(x2, y1, y2, c);}//********************************//void fill_rect(int x1, int y1, int x2, int y2, BYTE c){int i;BYTE ct;	if ((c&1)==1)ct=171;	else ct=0x20;	for(i=0;i<(y2-y1);i++)	{		memset_io(GRAPH_MEM_REGION+SAD1+(y1*COL+x1)+i*COL,ct,x2-x1);		mb();	}}//********************************//void fill_rect_gr(int x1, int y1, int x2, int y2, BYTE c){	int i,xx1,xx2;	//BYTE ct,bt;	if ((c&1)==1)		{		//	ct=0xff;			xx1=x1;			xx2=x2;		}	else		{			//ct=0x0;			xx1 = x1-1;			if (xx1<0) xx1 = 0;			xx2 = x2+1;		}	for (i=y1;i<y2;i++)	{		hor_line(xx1,xx2,i,c);	}	/*for(i=0;i<(y2-y1);i++)	{	memset_io(GRAPH_MEM_REGION+SAD2+(WIDTH/8)*(y1+i)+x1/8+1,ct,(x2-x1+1)/8);		mb();	}	ct=c&1;	ct=ct<<(7-(x % 8));	bt = (bt & (~ct)) | ct;	for(i=0;i<(y2-y1);i++)	{	}*/}//********************************//void SetCursorP(int x, int y){  WriteCursorAddress(y*COL+x);}void GetCursorP(int *x, int *y){  long int addr;  addr = ReadCursorAddress();  rmb();  *x = addr % COL;  *y = addr / COL;}//****************************//void OutCharXY(char ch, int x, int y){	GRAPH_MEM_REGION[SAD1+y*COL+x] = ch;	wmb();}//********************************//void OutChar(char ch){	  DWORD addr;	  addr = ReadCursorAddress();	  GRAPH_MEM_REGION[addr] = ch;	  wmb();}//********************************//void OutString(char* text){	int i=0;	while(text[i]!=0)	{		OutChar(text[i]);		i++;	}}//********************************//void OutStringXY(char* text,int x,int y){	SetCursorP(x,y);	OutString(text);}void InitLCD(void){#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s init_lcd invoked \n",DEVICE_NAME);#endif		Display(0,CUR_OFF);#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s Display off() \n",DEVICE_NAME);#endif		SystemSet();#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s SystemSet() \n",DEVICE_NAME);#endif		Scroll(SAD1, SAD2, SAD3, SAD4);#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s Scroll() \n",DEVICE_NAME);#endif		CursorForm(6,7,0);#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s CursorForm \n",DEVICE_NAME);#endif		CursorDir(CUR_RIGHT);#ifdef DEBUG_MSG		printk(KERN_DEBUG "%s CursorDir \n",DEVICE_NAME);#endif		HScroll();#ifdef DEBUG_MSG

⌨️ 快捷键说明

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