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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ser_gen.c

?? 一個C語言寫的讀入位置跟蹤器數(shù)據(jù)的源程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
	else    /* rxcount > 0 */
	{
	    /*
		Get remainder of Block of data from the serial port, recsize characters
		and store them in rxbuf
	    */
	    if ((rxchar = waitforchar(comport)) >= 0)  /* no errors */
	    {
		/*
		   Check Phase bit
		*/
		if (rxchar & 0x80)              /* check to see that phase bit = '0' */
		{
		    if (outputmode == STREAM)
		    {
			phaseerror_count[comport]++;     /* keep track of phase errors */
			resynch = TRUE;         /* loop again flag */
			continue;
		    }
		    else
		    {
			return(RXPHASEERROR);       /* return phase error */
		    }
		}
	    }
	    else
	    {
		if (outputmode == STREAM)
		{
		    phaseerror_count[comport]++;     /* keep track of phase errors */
		    resynch = TRUE;         /* loop again flag */
		    continue;
		}
		else
		{
		    return(RXERRORS);
		}
	    }
	}
	/*
	   Store the received character
	*/
	*rxbufptr++ = rxchar;   /* store and adjust pointer */
	rxcount++;              /* increment */
    }
    while ((resynch) || (rxcount < recsize));

    /*
	Return the number of characters received
    */
    return(rxcount);
}

/*
    send_serial_cmd     -    Send Serial Command to the Bird port

    Prototype in:       serial.h

    Parameters Passed:  short comport
			cmd         -   string to send to the serial point
			cmdsize     -   size of the cmd string (cmd is NOT
					NULL terminated, since the data can
					be NULL)
    Return Value:       number of characters transmitted

    Remarks:            Routine will send a string of characters to the serial
			port.  The string is pointed to by cmd and all
			characters will be sent upto but NOT including
			the NULL
*/
int send_serial_cmd(comport, cmd, cmdsize)
short comport;
unsigned char * cmd;
short cmdsize;
{
    short txcount = 0;

    DISABLE();
    /*
	Disable the Receive Interrupts
    */
    OUTPORTB(com_base[comport] + INTERENABLE, 0);
    OUTPORTB(com_base[comport] + INTERENABLE, 0);

    /*
	Turn the Transmitter to Transmit
    */
    if(port_type[comport] == RS485_PORT)
	 OUTPORTB(com_base[comport] + MODEMCONT, DTRON + OUT2);

    /*
	Transmit the CMD and DATA Characters NOW
    */
    while (txcount < cmdsize)
    {
	/*
	    Store the character in the TX buffer
	*/
	if (txcount == 0)
	{
	    if(port_type[comport] == RS485_PORT)
		while (send_serial_cmdchar(comport,*cmd) == TXBUFFERFULL);
	    else
		while (send_serial_datachar(comport,*cmd) == TXBUFFERFULL);
	}
	else
	{
	    while (send_serial_datachar(comport,*cmd) == TXBUFFERFULL);
	}
	cmd++;
	txcount++;
    }

    /*
	Clear the Receive Buffer in case of a dirty char
    */

    while (INPORTB(com_base[comport] + LINESTATUS) & DATARDY)
	INPORTB(com_base[comport] + RXBUF);

    /*
	Turn the Transceiver to Receive
    */
    if(port_type[comport] == RS485_PORT)
	OUTPORTB(com_base[comport] + MODEMCONT, OUT2);

    /*
	Enable the Receive Interrupts
    */
    OUTPORTB (com_base[comport] + INTERENABLE,
	RXDATAAVAILINTENABLE | RXLINESTATUSINTENABLE);
    OUTPORTB (com_base[comport] + INTERENABLE,
	RXDATAAVAILINTENABLE | RXLINESTATUSINTENABLE);

    ENABLE();
    return(txcount);
}

/*
    send_serial_cmdchar    -   Send one serial CMD char to the serial port
    send_serial_datachar    -   Send one serial DATA char to the serial port

    Prototype in:       serial.h

    Parameters Passed:  short comport
			chr     -   character to send to the serial port

    Return Value:       returns TRUE if successful, or TXBUFFERFULL if the
			TXBUF is full

    Remarks:            The routine is used to send a single character
			out to the UART if there is room in the output buffer.
			The routine checks to see if the Transmit interrupts
			are presently enabled...if not they are turned out
			so the ISR will get the character.
*/
int send_serial_cmdchar(comport,chr)
short comport;
unsigned char chr;
{
    /*
	Check for a full TX Hardware buffer...
    */
    if (!(INPORTB(com_base[comport] + LINESTATUS) & TXSHIFTEMPTY))
	return(TXBUFFERFULL);

    /*
	Set the Parity to a MARK
    */
    if(port_type[comport] == RS485_PORT)
	OUTPORTB(com_base[comport] + LINECONT, STOP_WORDLEN_MARKPARITY);

    /*
	Write the character to the Hardware
    */
    OUTPORTB(com_base[comport] + TXBUF, chr);

    /*
	Wait for the Buffer to EMPTY
    */
    while (!(INPORTB(com_base[comport] + LINESTATUS) & TXSHIFTEMPTY));

    /*
	Set the Parity back to a SPACE
    */
    if(port_type[comport] == RS485_PORT)
	OUTPORTB(com_base[comport] + LINECONT, STOP_WORDLEN_SPACEPARITY);

    return(TRUE);
}

int send_serial_datachar(comport,chr)
short comport;
unsigned char chr;
{
    /*
	Check for a full TX Hardware buffer...
    */
    if (!(INPORTB(com_base[comport] + LINESTATUS) & TXSHIFTEMPTY))
	return(TXBUFFERFULL);

    /*
	Write the character to the Hardware
    */
    OUTPORTB(com_base[comport] + TXBUF, chr);

    /*
	Wait for the Buffer to EMPTY
    */
    while (!(INPORTB(com_base[comport] + LINESTATUS) & TXSHIFTEMPTY));


    return(TRUE);
}

/*
    get_serial_char -   Get 1 Character from the serial port if one is available

    Prototype in:       serial.h

    Parameters Passed:  short comport

    Return Value:       returns the

    Remarks:            returns the receive character if successful,
			RXERRORS if recieve errors
			NODATAAVAIL if no characer available
*/
int get_serial_char(comport)
short comport;
{
	short rxchar;

    if ((!rxerrors[comport]) && (!rxbufoverruns[comport]))
    {
	/*
	    get character if available...else return
	*/
	if (rxbufinptr[comport] == rxbufoutptr[comport])
	    return(NODATAAVAIL);

	/*
	    get the character
	*/
	rxchar = *rxbufoutptr[comport]++;

	/*
	    check for End of Rx buffer..if so, wrap pointer to start
	*/
	if (rxbufoutptr[comport] == &rxbuf[comport][RXBUFSIZE])
	    rxbufoutptr[comport] = rxbuf[comport];

	/*
	    return the character
	*/
	return(rxchar);
    }
    else
    {
	/*
	    Reset Error flags and Announce the Errors
	*/
	if (rxerrors[comport])
	{
	    DISABLE();
	    printf("** ERROR ** rx line errors have occured\n");
	    rxerrors[comport] = FALSE;
	    ENABLE();
	}

	if (rxbufoverruns[comport])
	{
	    DISABLE();
	    printf("** ERROR ** rx buffer overrun errors have occured\n");
	    rxbufoverruns[comport] = FALSE;
	    ENABLE();
	}

	return(RXERRORS);
    }

}

/*
    waitforchar         -   Wait for a Character from the Serial Port

    Prototype in:       serial.h

    Parameters Passed:  short comport

    Return Value:       returns the receive character if successful,
			RXERRORS if recieve errors,
			RXTIMEOUT if a time out occurs before a
			character is ready

    Remarks:            Routine waits for the TIMEOUTINTICKS period
			for a character

*/
int waitforchar(comport)
short comport;
{
	short rxchar;
    long starttime;

    /*
	Get the time now in ticks
    */
    starttime = GETTICKS;

    /*
	Wait until a character is available
	....leave loop if errors or character available
    */
    while ((rxchar = get_serial_char(comport)) == NODATAAVAIL)
    {
	/*
	    Check to see if a timeout occured
	*/
	if ((GETTICKS - starttime) > (long) (RXTIMEOUTINSECS * 1000) / tick_msec)
	{
	    printf("\n** ERROR ** receiver timed out\n");
	    return(RXTIMEOUT);
	}
    }


    /*
	return if RX errors
    */
    if (rxchar < 0)
	return(RXERRORS);

    /*
	Everything is OK...return the character
    */
    return(rxchar);
}

/*
    waitforphase        -   Wait for a Character with phase bit set

    Prototype in:       serial.h

    Parameters Passed:  short comport

    Return Value:       returns the received character if successful,
			or RXERRORS if an error occurs

    Remarks:            waits for a character to be received with the
			most significant bit (bit 7) set to a '1'.  Characters
			received with bit 7 = '0' are thrown away.
			Routine waits for the TIMEOUTINTICKS period.
*/
int waitforphase(comport)
short comport;
{
	short rxchar;

    /*
	Wait until waitforchar returns a character or error
    */
    while (((rxchar = waitforchar(comport)) & 0x80) == 0)
    {
	/*
	    return if errors
	*/
	if (rxchar < 0)
	    return(RXERRORS);
    }

    /*
	Everything is OK...return the character
    */
    return(rxchar);
}

/*
    serialisr           -   Serial Interrupt Service Routine for COM*

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       void

    Remarks:            Routine processes the interrupt request from the
			8250 UART.  There are four possible interrupts from
			the UART...all are processed while in the ISR.
*/
void interrupt far serialisr_com1()
{
    serial_isr(COM1);
    return;         /* go home via IRET */
}
void interrupt far serialisr_com2()
{
    serial_isr(COM2);
    return;         /* go home via IRET */
}
void interrupt far serialisr_com3()
{
    serial_isr(COM3);
    return;         /* go home via IRET */
}
void interrupt far serialisr_com4()
{
    serial_isr(COM4);
    return;         /* go home via IRET */
}

void serial_isr(comport)
short comport;
{
	short intid;      /* holds the interrupt ID from the UART */
	short txchar;     /* Character to transmit */
    short sts;

    ENABLE();       /* enable higher priority interrupts to occur */

    /*
	Verify that the Interrupt is from the UART
	...do all the possible pending interrupts while here...until
	there are NO interrupts pending
    */

    while (!((intid = (0x0F & INPORTB(com_base[comport] + INTERIDENT))) & 1)) /* bit 0 = 0 if interrupts pending */
    {
	/*
	    Do the Serial Interrupt in Priority order
	    ..RXLINESTATUS, RXDATAAVAIL,TXEMPTY, MODEMSTATUS
	*/
	switch (intid)
	{
	    /*
		Line Status
		...just increment error counter
	    */
	    case RXLINESTATUS:  /* line status changed ... check RX errors */
		/*
		    Get the error from Linestatus
		*/
		if ((rxerrorvalue[comport] = (INPORTB(com_base[comport] + LINESTATUS) & RXERRORMSK)) != 0) /* clears interrupt */
		    rxerrors[comport] = TRUE;

		break;

	    /*
		RX Data Available
		...get the byte and store it in the RX circular buffer
		.....check for RX buffer overruns when storing character
	    */
	    case RXDATAAVAIL:
		/*
		    Get the RX data and store in the circular buffer
		*/
		*rxbufinptr[comport]++ = INPORTB(com_base[comport] + RXBUF);

		/*
		    Check for RX circular buffer overrun
		*/
		if (rxbufinptr[comport] == rxbufoutptr[comport])          /* ck overrrun? */
		    rxbufoverruns[comport]=TRUE;                 /* increment overrun count */

		/*
		    Check for top of buffer...adjust if necessary
		*/
		if (rxbufinptr[comport] == &rxbuf[comport][RXBUFSIZE])    /* at top ? */
		    rxbufinptr[comport] = rxbuf[comport];                 /* reset */

		break;

	    /*
		TX Holding Register Empty
		...transmit a character from the TX buffer if one is available
		else, shut down the TX interrupt until more characters are
		available
	    */
	    case TXEMPTY:
		/*
		    Get the Character to transmit
		*/
		txchar = *txbufoutptr[comport]++;

		/*
		    check for top of buffer
		    ...reset if at top
		*/
		if (txbufoutptr[comport] == &txbuf[comport][TXBUFSIZE])
		    txbufoutptr[comport] = txbuf[comport];

		if (txbufoutptr[comport] == txbufinptr[comport])          /* no data to send */
		{
		    /*
			Disable the Tx Interrupt Enable
			....don't bother until more TX chars in buffer
		    */
		    OUTPORTB(com_base[comport] + INTERENABLE,
			RXDATAAVAILINTENABLE | RXLINESTATUSINTENABLE);
		    OUTPORTB(com_base[comport] + INTERENABLE,
			RXDATAAVAILINTENABLE | RXLINESTATUSINTENABLE);

		    /*
			Set flag to indicate buffer empty
		    */
		    txbufempty[comport] = TRUE;
		}
		/*
		    Send the next TX character and increment the pointer
		*/
		OUTPORTB(com_base[comport] + TXBUF, txchar);

		break;

	    /*
		Modem Status Change
		...currently should never get here since it is never enabled,
		but if we do...clear the request by reading the register
	    */
	    case MODEMSTATUSCHG:        /* CTS, DSR, RI, DCD change */
		INPORTB(com_base[comport] + MODEMSTATUS);         /* clear the request */

	    case FIFORECV:
		while ((sts = INPORTB(com_base[comport] + LINESTATUS)) & DATARDY)
		{
		    /*
			Check for Errors
		    */
		    if (sts & FIFORCVERR)
		    {
			rxerrors[comport] = TRUE;
			break;
		    }

		    /*
			Get the RX data and store in the circular buffer
		    */
		    *rxbufinptr[comport]++ = INPORTB(com_base[comport] + RXBUF);

		    /*
			Check for RX circular buffer overrun
		    */
		    if (rxbufinptr[comport] == rxbufoutptr[comport])          /* ck overrrun? */
			rxbufoverruns[comport]=TRUE;                 /* increment overrun count */

		    /*
			Check for top of buffer...adjust if necessary
		    */
		    if (rxbufinptr[comport] == &rxbuf[comport][RXBUFSIZE])    /* at top ? */
			rxbufinptr[comport] = rxbuf[comport];                 /* reset */

		}
		break;
	}
    }

    /*
	Send End of Interrupt Command to the 8259
    */
    PCPIC_OUTEOI;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲短视频| 亚洲天天做日日做天天谢日日欢| 国产高清在线精品| 亚洲图片欧美色图| 亚洲精品一区二区三区精华液 | 国精产品一区一区三区mba视频| 亚洲欧美日韩电影| 国产日韩欧美在线一区| 欧美一区在线视频| 欧美色图一区二区三区| 成人性色生活片| 久久se精品一区精品二区| 亚洲成av人片观看| 亚洲黄色小视频| 国产拍欧美日韩视频二区| 欧美va在线播放| 欧美久久久久中文字幕| 91亚洲精品乱码久久久久久蜜桃 | 99精品桃花视频在线观看| 日本三级亚洲精品| 亚洲成a人v欧美综合天堂| 亚洲日本护士毛茸茸| 国产亚洲欧美日韩日本| 欧美日本在线视频| 欧美专区亚洲专区| 一本色道久久综合狠狠躁的推荐| 国产成人免费视频网站高清观看视频 | 欧美一级国产精品| 欧美日韩亚洲综合在线| 欧美亚洲国产怡红院影院| 色婷婷av一区二区| 色哟哟日韩精品| 欧美最新大片在线看| 色播五月激情综合网| 91在线国产福利| 99re视频精品| 色女孩综合影院| 91女人视频在线观看| 一本到不卡免费一区二区| 色美美综合视频| 欧美影视一区二区三区| 欧美日韩在线综合| 欧美老年两性高潮| 欧美一区二区三区喷汁尤物| 日韩欧美国产一区二区在线播放 | 蜜桃视频在线一区| 久久超碰97中文字幕| 九九视频精品免费| 国产米奇在线777精品观看| 久久99久久99小草精品免视看| 久久成人av少妇免费| 国产福利不卡视频| av一区二区三区在线| 一本一道久久a久久精品| 欧美午夜精品免费| 欧美一区二区在线看| www国产精品av| √…a在线天堂一区| 一区二区三区日韩在线观看| 三级久久三级久久| 精品一区二区三区不卡| 国产成人日日夜夜| 色婷婷香蕉在线一区二区| 欧美亚男人的天堂| 日韩欧美一级精品久久| 中文字幕第一页久久| 亚洲欧洲综合另类| 三级不卡在线观看| 国产成人综合网| 在线影院国内精品| 日韩精品一区在线观看| 国产欧美一二三区| 一区二区三区欧美亚洲| 青娱乐精品视频| 成人av网站免费观看| 欧美探花视频资源| 久久婷婷成人综合色| 亚洲精品免费视频| 男人操女人的视频在线观看欧美 | 欧美一区二区三区免费观看视频 | 韩国欧美一区二区| 色94色欧美sute亚洲线路二| 日韩欧美在线综合网| 国产精品传媒在线| 美国十次综合导航| 色成年激情久久综合| 亚洲精品一区二区三区蜜桃下载| 亚洲精品久久嫩草网站秘色| 久久精品国产精品青草| 色8久久精品久久久久久蜜| 亚洲精品一区二区三区99| 亚洲一区二区三区四区中文字幕 | 欧洲精品一区二区三区在线观看| 欧美va在线播放| 亚洲第一福利一区| 国产白丝网站精品污在线入口| 欧美日韩另类国产亚洲欧美一级| 国产日韩欧美不卡| 日本视频在线一区| 色婷婷精品大在线视频| 久久久噜噜噜久久人人看| 午夜精品免费在线观看| av在线免费不卡| 26uuu国产电影一区二区| 亚洲国产日韩精品| 91同城在线观看| 精品在线免费视频| 欧洲在线/亚洲| 中文字幕第一区| 国产一区二区导航在线播放| 制服视频三区第一页精品| 亚洲女爱视频在线| 成人性生交大片免费看在线播放 | 亚洲综合999| jlzzjlzz欧美大全| 国产亚洲精品7777| 精品无人码麻豆乱码1区2区 | 国产精品一线二线三线精华| 91精品国产入口在线| 亚洲国产wwwccc36天堂| 91视频免费观看| 中文字幕色av一区二区三区| 国产河南妇女毛片精品久久久| 精品久久久久久最新网址| 奇米777欧美一区二区| 欧美精品视频www在线观看 | 成人av网站在线| 国产精品丝袜黑色高跟| 国产一区二区三区免费看| 精品国产麻豆免费人成网站| 日韩制服丝袜av| 欧美精品在线观看播放| 午夜国产精品影院在线观看| 欧美性一级生活| 午夜视频在线观看一区| 欧美三级电影在线看| 亚洲第一搞黄网站| 56国语精品自产拍在线观看| 首页欧美精品中文字幕| 欧美一区二区三区四区视频| 日韩精品一二区| 日韩欧美在线综合网| 激情深爱一区二区| 久久久国产精品午夜一区ai换脸| 国产一区二区三区四区在线观看| 麻豆精品久久久| 久久久精品黄色| 丰满少妇在线播放bd日韩电影| 亚洲国产激情av| 99久久99精品久久久久久| 亚洲日韩欧美一区二区在线| 在线视频你懂得一区| 亚洲成人免费观看| 日韩久久免费av| 粉嫩av一区二区三区粉嫩| 亚洲欧美一区二区久久| 欧美性猛片aaaaaaa做受| 三级不卡在线观看| 久久久蜜桃精品| 91麻豆成人久久精品二区三区| 亚洲一区二区综合| 欧美成人vps| 波多野结衣中文字幕一区二区三区| 亚洲欧洲综合另类| 7777精品伊人久久久大香线蕉经典版下载| 欧美一级欧美三级| 国产福利一区二区三区视频 | 欧美日韩午夜影院| 精东粉嫩av免费一区二区三区| 中文字幕av免费专区久久| 欧美日韩综合色| 国产精品69毛片高清亚洲| 亚洲精品国产品国语在线app| 在线综合亚洲欧美在线视频| 国产精品白丝jk黑袜喷水| 亚洲欧美国产77777| 欧美一级高清大全免费观看| 成人av在线一区二区| 亚洲一二三专区| 2021国产精品久久精品| 91亚洲精品乱码久久久久久蜜桃| 男女视频一区二区| 亚洲视频免费看| 欧美xxxx老人做受| 日本乱人伦aⅴ精品| 国产剧情一区二区| 亚洲国产裸拍裸体视频在线观看乱了 | 久久国产精品色婷婷| 成人欧美一区二区三区白人| 欧美一区二区三区四区五区| 91在线porny国产在线看| 久久精品国产77777蜜臀| 亚洲人成电影网站色mp4| 26uuu亚洲综合色| 欧美人与z0zoxxxx视频| av网站一区二区三区| 国产在线看一区| 香蕉影视欧美成人| 亚洲欧美另类图片小说| 久久嫩草精品久久久精品一|