亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? port.c

?? z85c30 DRIVER RUN ON PC104 PC AND VXWORKS SYSTERM.
?? C
?? 第 1 頁 / 共 5 頁
字號:
#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <math.h>
#include <bios.h>
#include "config.h"
#include "mem.h"
#include "drv\port.h"

#ifdef __cplusplus
	#define __CPPARGS ...
#else
	#define __CPPARGS
#endif

//net

unsigned char	 old_intmas_reg1=0;
unsigned char	 old_intmas_reg2=0;

int rr0,rr1,rr2,rr3,rr4,rr5,rr6,rr7,rr8,rr9,rr10,rr11,rr12,rr13,rr14,rr15;

void interrupt_initial(void);

void interrupt far timer_interrupt(void);
void interrupt (* old_int0)(void);

void interrupt far com1_interrupt(void);
void interrupt (* old_com1int)(void);

void interrupt far com2_interrupt(void);
void interrupt (* old_com2int)(void);

void interrupt far com34_interrupt(void);
void interrupt (* old_int5)(void);

void interrupt far com56_interrupt(void);
void interrupt (* old_int6)(void);

void interrupt far com78_interrupt(void);
void interrupt (* old_int7)(void);

void interrupt far com90_interrupt(void);
void interrupt (* old_int11)(void);
void interrupt (* old_int14)(void);

void interrupt far com1112_interrupt(void);
void interrupt (* old_int15)(void);
void interrupt far com1314_interrupt(void);
void interrupt (* old_int9)(void);
//void interrupt far keyboard_interrupt(void);
//void interrupt (* old_keyint)(void);
void interrupt nic_interrupt(__CPPARGS);
void interrupt (* old_int10)(__CPPARGS);
void interrupt_zi_programe_async(int Tcom_number);//2003-06-10
void interrupt_zi_programe_async_a(int Tcom_number);//2003-06-10
void open_RTS(int Tport);
void clear_RTS(int Tport);

extern int rev_state;
extern unsigned char  GpsMsg[160];


nic_ini(void)
{
	unsigned char val;
	unsigned int port,value;
	int i;
	//int int_num;
	char string[36];

/*	port=CR;
	val=0xC1;
	outportb(port,val);  //program command register for page 3

	port=CONFIG1;
	outportb(port,0x10);
	val=inportb(port);
	int_num=(val&0x70)>>4;
	printf("nic int is:%d",int_num);*/

	disable();

	port=CR;
	val=0x01;            /*00100001*/
	outportb(port,val);  /*program command register for page 0*/


	port=DCR;
	val=0x19;       		/*01001001*/
	outportb(port,val);      /*initialize data configuration register*/
	val=0;
	port=RBCR0;
	outportb(port,val);
	port=RBCR1;
	outportb(port,val);        /*clear remote byte count register*/
	port=RCR;
	val=0x06;     		  //   address match;
	outportb(port,val);        /*initialize receive configuration register*/
	port=TCR;
	val=0x00;       /*00000010*/
	outportb(port,val);        /*place the NIC in LOOPBACK mode 1*/
	port=PSTART;
	val=0x4c;                 //? why 4c
	outportb(port,val);        /*PSTART=4ch*/
	port=PSTOP;
	val=0x7f;
	outportb(port,val);        /*PSTOP=7fh*/
	port=BNRY;
	val=0x4c;       /*BNDRY=PSTART*/
	outportb(port,val);        /*initialize Receive Buffer Ring*/
	port=ISR;
	val=0xff;      /*11111111*/
	outportb(port,val);        /*clear interrupt status register*/
	port=IMR;
	val=0xff;      /*11111111*/
	outportb(port,val);
	port=DCR;
	val=0x59;       /*01001000   0x49 as a word*/
	outportb(port,val);
	val=0;
	port=RSAR0;
	outportb(port,val);
	port=RSAR1;
	outportb(port,val);        /*set remote start address to 0000h*/
	port=RBCR1;
	outportb(port,val);
	port=RBCR0;
	val=20;
	outportb(port,val);        /*DMA byte counter=20*/
	port=CR;
	val=0x0a;       /*00001010*/
	outportb(port,val);

	port=CR;
	val=0x41;
	outportb(port,val);

	port=PAR0;                                   //set mac address;
	for (i=0;i<6;i++){
		mac_addr[i]=inportb(port);
		port++;
	}
	port=MAR0;                    /*initialize mult_add*/
	for (i=0;i<8;i++){
		outportb(port,0xff);
		port++;
	}

	port=CURR;
	val=0x4d;       /* CURR=PSTART+1*/
	next_pkt=val;
	outportb(port,val);        /* initialize CURR & next_pkt*/

	port=CR;
	val=0x22;       /*00100010*/
	outport(port,val);       /*put NIC in START mode*/

	port=TCR;
	val=0;           /*00000000*/
	outportb(port,val);        /*set NIC to normal operation*/

	enable();
	return 1;
}
/******************************************************************/
//--------------------------------------------com port Async seting;
void com_initial(void)
{
	int ifor1;

	com1_initial();
	//InitCom(1,9600);
	com2_initial();

	outp(com3_commandport,0x09);
	outp(com3_commandport,0xc0);        //hardeware reset;
	if(Port_Set[2][5]==1)
		sync_com_initial(3,Port_Set[2][4]);
	else
		async_com_initial(3);

	if(Port_Set[3][5]==1)
		sync_com_initial(4,Port_Set[3][4]);
	else
		async_com_initial(4);
	outp(com5_commandport,0x09);
	outp(com5_commandport,0xc0);        //hardeware reset;
	if(Port_Set[4][5]==1)
		sync_com_initial(5,Port_Set[4][4]);
	else
		async_com_initial(5);
	if(Port_Set[5][5]==1)
		sync_com_initial(6,Port_Set[5][4]);
	else
		async_com_initial(6);

	outp(com7_commandport,0x09);
	outp(com7_commandport,0xc0);        //hardeware reset;
	if(Port_Set[6][5]==1)
		sync_com_initial(7,Port_Set[6][4]);
	else
		async_com_initial(7);

	if(Port_Set[7][5]==1)
		sync_com_initial(8,Port_Set[7][4]);
	else
		async_com_initial(8);

	outp(com9_commandport,0x09);
	outp(com9_commandport,0xc0);       //hardeware reset;
	if(Port_Set[8][5]==1)
		sync_com_initial(9,Port_Set[8][4]);
	else
		async_com_initial(9);

	if(Port_Set[9][5]==1)
		sync_com_initial(10,Port_Set[9][4]);
	else
		async_com_initial(10);

	outp(com11_commandport,0x09);
	outp(com11_commandport,0xc0);       //hardeware reset;
	if(Port_Set[10][5]==1)
		sync_com_initial(11,Port_Set[10][4]);
	else
		async_com_initial(11);

	if(Port_Set[11][5]==1)
		sync_com_initial(12,Port_Set[11][4]);
	else
		async_com_initial(12);

	outp(com13_commandport,0x09);
	outp(com13_commandport,0xc0);       //hardeware reset;
	if(Port_Set[12][5]==1)
		sync_com_initial(13,Port_Set[12][4]);
	else
		async_com_initial(13);

	if(Port_Set[13][5]==1)
		sync_com_initial(14,Port_Set[13][4]);
	else
		async_com_initial(14);
}

void com1_initial(void)
{
	int baut_rate;
	baut_rate=115200L/(pow(2,Port_Set[0][1])*300);

	outp(com1_lineclt,0x03); //set data format and rate of bit;
	outp(com1_lineclt,0x80|inp(com1_lineclt));                           //8位數據,1位停止位,無奇偶校驗
	outp(com1_brlsb,baut_rate & 0x00ff);//0x30);     //波特率為2400
	outp(com1_brmsb,(baut_rate>>8) & 0x00ff);//0x00);
	outp(com1_lineclt,0x7f&inp(com1_lineclt));    //DLAB=0;
	inp(com1_dataport);
}

void com2_initial(void)
{
	int baut_rate;
	baut_rate=115200L/(pow(2,Port_Set[1][1])*300);

	outp(com2_lineclt,0x03); //set data format and rate of bit;
	outp(com2_lineclt,0x80|inp(com2_lineclt));                           //8位數據,1位停止位,無奇偶校驗
	outp(com2_brlsb,baut_rate & 0x00ff);//0x30);     //波特率為2400
	outp(com2_brmsb,(baut_rate>>8) & 0x00ff);//0x00);
	outp(com2_lineclt,0x7f&inp(com2_lineclt));    //DLAB=0;
	inp(com2_dataport);
}

void async_com_initial(int Tcom_number)
{

    int baut_hi;
    int baut_lo;
    int commandport;
    int dataport;
    unsigned long int tc=0,tc1=0,tc2=0;
    unsigned long int br=0;
    int baut_rate;
    baut_rate=pow(2,Port_Set[Tcom_number-1][1])*300;

    if(Tcom_number%2)
    {
	commandport=0x2d2+(Tcom_number-3)*2;
	dataport=0x2d3+(Tcom_number-3)*2;


	outp(commandport,0x09);
	outp(commandport,0x80);        //channel a reset;

	outp(commandport,0x04);
	outp(commandport,0xc4);        //select asyn mode: no parity: 1 stop bit; *64 clock mode;

	outp(commandport,0x03);
	outp(commandport,0xc0);        // 8 bit received per character; no auto mode;

	outp(commandport,0x0e);
	outp(commandport,0x00);        //disable BRG;

	outp(commandport,0x0e);
	outp(commandport,0x02);        //BRG clock soure: PCLK pin;

	br=baut_rate;//2400;           //NRZI
//	printf("asny: %d",baut_rate);
	tc=(clock_f/(2*br*64))-2;
	tc1=tc2=tc;
	baut_hi=(tc1&0xff00)>>8;
	baut_lo=(tc2&0x00ff);
//	printf("h=%2X l=%2X\n",baut_hi,baut_lo);

	outp(commandport,0x0c);
	outp(commandport,baut_lo);        //set baut rate lower byte,2400;

	outp(commandport,0x0d);
	outp(commandport,baut_hi);        //set baut rate higher byte;

	outp(commandport,0x0b);
	outp(commandport,0x56);        //set /TRXC PIN;

	outp(commandport,0x01);
	//outp(commandport,0x12);        //receive,transmit interupt enable;
	outp(commandport,0x10);        //receive,transmit interupt enable;

	outp(commandport,0x09);
	outp(commandport,0x08);        //master interupt enable;

	outp(commandport,0x0e);
	outp(commandport,0x03);        //enable BRG;

	outp(commandport,0x03);
	outp(commandport,0xc1);        //ENABLE RECEIVE;

	outp(commandport,0x05);
	outp(commandport,0x68);        //ENABLE TRANSMIT;

	inp(dataport);
    }
    else
    {
	commandport=0x2d0+(Tcom_number-4)*2;
	dataport=0x2d1+(Tcom_number-4)*2;


	outp(commandport,0x09);
	outp(commandport,0x40);        //channel b reset;

	outp(commandport,0x04);
	outp(commandport,0xc4);        //select asyn mode: no parity: 1 stop bit; *64 clock mode;

	outp(commandport,0x03);
	outp(commandport,0xc0);        // 8 bit received per character; no auto mode;

	outp(commandport,0x0e);
	outp(commandport,0x00);        //disable BRG;

	outp(commandport,0x0e);
	outp(commandport,0x02);        //BRG clock soure: PCLK pin;

	br=baut_rate;//2400;        //NRZI IN DPLL
//	printf("asny: %d",baut_rate);
	tc=(clock_f/(2*br*64))-2;
	tc1=tc2=tc;
	baut_hi=(tc1&0xff00)>>8;
	baut_lo=(tc2&0x00ff);
//	printf("h=%2X l=%2X\n",baut_hi,baut_lo);

	outp(commandport,0x0c);
	outp(commandport,baut_lo);        //set baut rate lower byte,2400;

	outp(commandport,0x0d);
	outp(commandport,baut_hi);        //set baut rate higher byte;

	outp(commandport,0x0b);
	outp(commandport,0x56);        //set /TRXC PIN;

	outp(commandport,0x01);
	outp(commandport,0x10);        //receive interupt enable;
	//outp(commandport,0x12);        //receive,transmit interupt enable;

	outp(commandport,0x09);
	outp(commandport,0x08);        //master interupt enable;

	outp(commandport,0x0e);
	outp(commandport,0x03);        //enable BRG;

	outp(commandport,0x03);
	outp(commandport,0xc1);        //ENABLE RECEIVE;

	outp(commandport,0x05);
	outp(commandport,0x68);        //ENABLE TRANSMIT;

	inp(dataport);
    }
}
void sync_com_initial(int Tcom_number,int Tclock_type)
{
    int baut_hi;
    int baut_lo;
    int commandport;
    int dataport;
    unsigned long int tc=0,tc1=0,tc2=0;
    unsigned long int br=0;
    int baut_rate;
    baut_rate=pow(2,Port_Set[Tcom_number-1][1])*300;

    if(Tcom_number%2)
    {
	commandport=0x2d2+(Tcom_number-3)*2;
	dataport=0x2d3+(Tcom_number-3)*2;

	outp(commandport,0x09);
	outp(commandport,0x80);        //channel a reset;
    }
    else
    {
	commandport=0x2d0+(Tcom_number-4)*2;
	dataport=0x2d1+(Tcom_number-4)*2;

	outp(commandport,0x09);
	outp(commandport,0x40);        //channel a reset;
    }

	outp(commandport,0x03);        //WR3
	outp(commandport,0xd8);        //8 bit received per character;
				       //no auto mode;
				       //CRC check;
				       //no address search;
				       //sync character load inhibit;
				       //rx disable;

	outp(commandport,0x05);        //WR5
	//outp(commandport,0x65);        //Tx 8 bits/character;
	outp(commandport,0x61);        //Tx 8 bits/character;
				       //tx CRC enable;
					    //tx disable;

	outp(commandport,0x04);        //WR4
	if(Tclock_type==0)
		outp(commandport,0xa0);        //X32 clock mode; select SDLC mode(0111 1110 flag);select sync mode;no parity;
	else
		outp(commandport,0x20);        //X1 clock mode; select SDLC mode(0111 1110 flag);select sync mode;no parity;

	outp(commandport,0x0f);        //WR15
	outp(commandport,0x0);        //the flag '7eH' is written;

	outp(commandport,0x07);        //WR7
	outp(commandport,0x7e);        //the flag '7eH' is written;

	outp(commandport,0x0f);        //WR15
	outp(commandport,0x01);        //
	outp(commandport,0x07);        //WR7'
	outp(commandport,0x43);        //Extended read enable;
				       //automatic Tx Underrun/EOM latch reset;
				       //auto SDLC transmission open;

	outp(commandport,0x06);        //WR6
	outp(commandport,0xff);        //init address;

	outp(commandport,0x0a);        //WR10
	//outp(commandport,0x80);        //+++
	outp(commandport,0x88);        //CRC preset I//O;
				       //abort/flag on underrun;
				       //8-bit Sync;ENCODE  :NRZ;

	outp(commandport,0x0e);
	outp(commandport,0x60);        //disable BRG;disable DPLL;


	if(Tclock_type==0)
	{
		br=baut_rate;           //NRZI IN DPLL
//		printf("sny DPLL: %d",baut_rate);
		tc=(clock_f/(2*br*32))-2;
		tc1=tc2=tc;
		baut_hi=(tc1&0xff00)>>8;
		baut_lo=(tc2&0x00ff);
//		printf("h=%2X l=%2X\n",baut_hi,baut_lo);
	}
	else
	{
		br=baut_rate;           //NRZI
//		printf("sny I: %d",baut_rate);
		tc=(clock_f/(2*br))-2;
		tc1=tc2=tc;
		baut_hi=(tc1&0xff00)>>8;
		baut_lo=(tc2&0x00ff);
//		printf("h=%2X l=%2X\n",baut_hi,baut_lo);
	}

	outp(commandport,0x0c);
	outp(commandport,baut_lo);        //set baut rate lower byte,2400;

	outp(commandport,0x0d);
	outp(commandport,baut_hi);        //set baut rate higher byte;

	outp(commandport,0x0e);
	outp(commandport,0x02);           //BRG clock soure: PCLK pin;

	if(Tclock_type==0)                //DPLL;
	{
		outp(commandport,0x0b);
		outp(commandport,0x7f);      	//dpll

		outp(commandport,0x0e);
		outp(commandport,0x83);         //BRG clock soure: PCLK pin;
						//DPLL CLOCK SOURCE=BRG;

		outp(commandport,0x0e);
		outp(commandport,0xe3);	        //op mode;DPLL IN NRZI;


		outp(commandport,0x0e);
		outp(commandport,0x23);         //enable BRG; enable DPLL;
	}
	else  if(Tclock_type==1)          //ICLK;
	{
		outp(commandport,0x0b);
		outp(commandport,0x56);      	//56: R T CLOCK ICLK
						//0X11: T:ICLK; R:OCLK;

		outp(commandport,0x0e);
		outp(commandport,0x63);         //BRG clock soure: PCLK pin;
						//DPLL CLOCK SOURCE=BRG;
	}
	else                              //OCLK;
	{
		outp(commandport,0x0b);
		outp(commandport,0x05);      	//R T CLOCK OCLK;

		outp(commandport,0x0e);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天堂va蜜桃一区二区三区 | 久久久久久免费网| 91蝌蚪国产九色| 成人免费的视频| 久久99最新地址| 精品一区二区三区视频| 奇米777欧美一区二区| 日韩国产欧美在线观看| 亚洲韩国一区二区三区| 亚洲午夜久久久久久久久电影网| 一区二区三区四区在线播放 | 精品视频1区2区3区| 91蜜桃免费观看视频| 99久久免费国产| 在线亚洲一区二区| 在线成人免费观看| 欧美一级片在线| 精品国产免费一区二区三区香蕉| 日韩午夜激情电影| 久久久久国产精品麻豆| 国产精品少妇自拍| 亚洲最新在线观看| 免费成人在线观看视频| 国产精品一区二区三区99| 成av人片一区二区| 欧美影院精品一区| 精品久久久久久久久久久院品网| 欧美成人三级在线| 国产精品久久久久三级| 亚洲国产wwwccc36天堂| 久久不见久久见中文字幕免费| 国产主播一区二区| 色噜噜狠狠一区二区三区果冻| 欧美久久久久久久久久| 久久亚洲影视婷婷| 一区二区三区免费看视频| 婷婷成人激情在线网| 国产麻豆精品在线观看| 91成人在线精品| 亚洲人成7777| 日韩av一级电影| 99国产精品久久久| 日韩久久免费av| 亚洲欧美日韩国产综合| 精品亚洲国内自在自线福利| 91丨porny丨首页| 精品国产免费一区二区三区香蕉 | 亚洲激情图片一区| 韩日av一区二区| 精品视频一区 二区 三区| 国产日韩欧美亚洲| 日韩国产在线一| 91理论电影在线观看| 久久精品网站免费观看| 麻豆精品久久精品色综合| 在线一区二区三区| 国产精品伦理在线| 久久av资源网| 91视频免费播放| 欧美日本在线看| 99热精品一区二区| 久久成人免费日本黄色| 性做久久久久久免费观看欧美| 国产精品白丝jk黑袜喷水| 欧美日产国产精品| 一区二区三区不卡视频在线观看| 成人激情免费视频| 中文字幕精品三区| 国模一区二区三区白浆| 欧美一区二区在线免费观看| 亚洲国产欧美在线人成| 色综合久久久久综合| 国产精品欧美综合在线| 国产精品自在在线| 国产午夜精品一区二区三区四区| 日韩av电影天堂| 欧美精品第1页| 五月综合激情网| 欧美日韩国产天堂| 免费看欧美女人艹b| 6080国产精品一区二区| 日精品一区二区| 91精品免费观看| 麻豆国产一区二区| 精品国产乱码久久久久久夜甘婷婷 | 久久免费视频色| 国产一区二区免费看| 日韩久久精品一区| 国产一区二区三区av电影| 精品国产一二三区| 国产91精品久久久久久久网曝门 | aaa欧美大片| 中文字幕精品一区二区精品绿巨人 | 欧美sm美女调教| 国产精品一品二品| 中文字幕国产精品一区二区| 一本色道久久综合亚洲精品按摩| 亚洲美女免费在线| 欧美日韩午夜影院| 久久99久久99小草精品免视看| 精品国产乱码久久久久久老虎| 国产精品系列在线观看| 亚洲黄网站在线观看| 欧美蜜桃一区二区三区| 久久国产乱子精品免费女| 中文字幕第一区第二区| 91国产福利在线| 久久精品国产免费| 国产精品久久久久久久久晋中| 欧美日韩中字一区| 国产一区二区精品久久91| 1024成人网色www| 欧美一区二区三区思思人| 国产91色综合久久免费分享| 亚洲香肠在线观看| 久久久综合精品| 欧美日韩dvd在线观看| 成人av在线资源网| 麻豆91免费观看| 亚洲男人电影天堂| 久久久久久久久久电影| 欧美性欧美巨大黑白大战| 国产一区二区看久久| 人禽交欧美网站| 亚洲欧美一区二区久久| 久久久精品人体av艺术| 欧美图区在线视频| 99热国产精品| 国产精品18久久久久久久久| 亚洲成人在线观看视频| 国产欧美一区二区精品婷婷| 欧美日韩一级视频| 不卡视频在线观看| 久久99国产乱子伦精品免费| 五月婷婷综合激情| 亚洲免费大片在线观看| 国产清纯白嫩初高生在线观看91 | 国产一区二区三区电影在线观看| 亚洲国产精品久久久久秋霞影院| 国产精品久久久久aaaa| 91麻豆精品国产91久久久使用方法| 国产suv精品一区二区三区| 五月天激情小说综合| 亚洲男同1069视频| 国产精品国产三级国产aⅴ原创| 久久先锋影音av| 日韩午夜激情视频| 日韩欧美自拍偷拍| 91精品视频网| 欧美三级电影在线观看| 色先锋aa成人| 色综合久久久久久久| 色综合久久久久| 在线观看日韩电影| 色婷婷综合视频在线观看| 99久久免费精品| 一本色道久久综合亚洲精品按摩| 99国产精品视频免费观看| 成人精品视频网站| 成人免费看片app下载| 豆国产96在线|亚洲| 成人av网在线| 91麻豆免费视频| 欧美视频中文一区二区三区在线观看| 色婷婷综合五月| 欧美日韩视频在线观看一区二区三区| 欧美午夜视频网站| 欧美一级黄色大片| 久久婷婷综合激情| 欧美国产成人精品| 亚洲色图欧美在线| 亚洲国产日韩av| 久久国产乱子精品免费女| 国产v综合v亚洲欧| 色哟哟国产精品| 制服丝袜亚洲网站| 久久久久久毛片| 中文字幕在线观看一区二区| 综合激情成人伊人| 五月激情综合色| 国产高清不卡一区| 日本韩国视频一区二区| 欧美剧情片在线观看| 国产日韩欧美激情| 亚洲成人动漫一区| 国产69精品久久777的优势| 99re成人精品视频| 538在线一区二区精品国产| 国产日韩在线不卡| 午夜伊人狠狠久久| 国产91精品在线观看| 在线不卡a资源高清| 国产欧美精品一区| 日韩精品亚洲专区| 丰满白嫩尤物一区二区| 欧美日韩中文字幕精品| 久久久精品欧美丰满| 亚洲国产毛片aaaaa无费看| 国产高清成人在线| 欧美一区二区在线播放|