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

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

?? queue.c

?? Modbus協議的源代碼 Modbus協議的源代碼、 Modbus協議的源代碼 Modbus協議的源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
				available on the queue.

				

				As detailed above we do not require mutual exclusion on the event

				list as nothing else can modify it or the ready lists while we

				have the scheduler suspended and queue locked.

				

				It is possible that an ISR has removed data from the queue since we

				checked if any was available.  If this is the case then the data

				will have been copied from the queue, and the queue variables

				updated, but the event list will not yet have been checked to see if

				anything is waiting as the queue is locked. */

				vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );

	

				/* Force a context switch now as we are blocked.  We can do

				this from within a critical section as the task we are

				switching to has its own context.  When we return here (i.e. we

				unblock) we will leave the critical section as normal.

				

				It is possible that an ISR has caused an event on an unrelated and

				unlocked queue.  If this was the case then the event list for that

				queue will have been updated but the ready lists left unchanged -

				instead the readied task will have been added to the pending ready

				list. */

				taskENTER_CRITICAL();

				{

					/* We can safely unlock the queue and scheduler here as

					interrupts are disabled.  We must not yield with anything

					locked, but we can yield from within a critical section.

					

					Tasks that have been placed on the pending ready list cannot

					be tasks that are waiting for events on this queue.  See

					in comment xTaskRemoveFromEventList(). */

					prvUnlockQueue( pxQueue );

	

					/* Resuming the scheduler may cause a yield.  If so then there

					is no point yielding again here. */

					if( !xTaskResumeAll() )

					{

						taskYIELD();

					}

	

					/* Before leaving the critical section we have to ensure

					exclusive access again. */

					vTaskSuspendAll();

					prvLockQueue( pxQueue );				

				}

				taskEXIT_CRITICAL();

			}

		}

			

		/* When we are here it is possible that we unblocked as space became

		available on the queue.  It is also possible that an ISR posted to the

		queue since we left the critical section, so it may be that again there

		is no space.  This would only happen if a task and ISR post onto the

		same queue. */

		taskENTER_CRITICAL();

		{

			if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )

			{

				/* There is room in the queue, copy the data into the queue. */			

				prvCopyQueueData( pxQueue, pvItemToQueue );		

				xReturn = pdPASS;

	

				/* Update the TxLock count so prvUnlockQueue knows to check for

				tasks waiting for data to become available in the queue. */

				++( pxQueue->xTxLock );

			}

			else

			{

				xReturn = errQUEUE_FULL;

			}

		}

		taskEXIT_CRITICAL();



		if( xReturn == errQUEUE_FULL )

		{

			if( xTicksToWait > 0 )

			{

				if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )

				{

					xReturn = queueERRONEOUS_UNBLOCK;

				}

			}

		}

	}

	while( xReturn == queueERRONEOUS_UNBLOCK );



	prvUnlockQueue( pxQueue );

	xTaskResumeAll();



	return xReturn;

}

/*-----------------------------------------------------------*/



signed portBASE_TYPE xQueueSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken )

{

	/* Similar to xQueueSend, except we don't block if there is no room in the

	queue.  Also we don't directly wake a task that was blocked on a queue

	read, instead we return a flag to say whether a context switch is required

	or not (i.e. has a task with a higher priority than us been woken by this

	post). */

	if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )

	{

		prvCopyQueueData( pxQueue, pvItemToQueue );



		/* If the queue is locked we do not alter the event list.  This will

		be done when the queue is unlocked later. */

		if( pxQueue->xTxLock == queueUNLOCKED )

		{

			/* We only want to wake one task per ISR, so check that a task has

			not already been woken. */

			if( !xTaskPreviouslyWoken )		

			{

				if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )

				{

					if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )

					{

						/* The task waiting has a higher priority so record that a

						context	switch is required. */

						return pdTRUE;

					}

				}

			}

		}

		else

		{

			/* Increment the lock count so the task that unlocks the queue

			knows that data was posted while it was locked. */

			++( pxQueue->xTxLock );

		}

	}



	return xTaskPreviouslyWoken;

}

/*-----------------------------------------------------------*/



signed portBASE_TYPE xQueueReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait )

{

signed portBASE_TYPE xReturn;

xTimeOutType xTimeOut;



	/* This function is very similar to xQueueSend().  See comments within

	xQueueSend() for a more detailed explanation.



	Make sure other tasks do not access the queue. */

	vTaskSuspendAll();



	/* Capture the current time status for future reference. */

	vTaskSetTimeOutState( &xTimeOut );



	/* Make sure interrupts do not access the queue. */

	prvLockQueue( pxQueue );



	do

	{

		/* If there are no messages in the queue we may have to block. */

		if( prvIsQueueEmpty( pxQueue ) )

		{

			/* There are no messages in the queue, do we want to block or just

			leave with nothing? */			

			if( xTicksToWait > ( portTickType ) 0 )

			{

				vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );

				taskENTER_CRITICAL();

				{

					prvUnlockQueue( pxQueue );

					if( !xTaskResumeAll() )

					{

						taskYIELD();

					}

	

					vTaskSuspendAll();

					prvLockQueue( pxQueue );

				}

				taskEXIT_CRITICAL();

			}

		}

	

		taskENTER_CRITICAL();

		{

			if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )

			{

				pxQueue->pcReadFrom += pxQueue->uxItemSize;

				if( pxQueue->pcReadFrom >= pxQueue->pcTail )

				{

					pxQueue->pcReadFrom = pxQueue->pcHead;

				}

				--( pxQueue->uxMessagesWaiting );

				memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize );

	

				/* Increment the lock count so prvUnlockQueue knows to check for

				tasks waiting for space to become available on the queue. */

				++( pxQueue->xRxLock );

				xReturn = pdPASS;

			}

			else

			{

				xReturn = errQUEUE_EMPTY;

			}

		}

		taskEXIT_CRITICAL();



		if( xReturn == errQUEUE_EMPTY )

		{

			if( xTicksToWait > 0 )

			{

				if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )

				{

					xReturn = queueERRONEOUS_UNBLOCK;

				}

			}

		}

	} while( xReturn == queueERRONEOUS_UNBLOCK );



	/* We no longer require exclusive access to the queue. */

	prvUnlockQueue( pxQueue );

	xTaskResumeAll();



	return xReturn;

}

/*-----------------------------------------------------------*/



signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken )

{

signed portBASE_TYPE xReturn;



	/* We cannot block from an ISR, so check there is data available. */

	if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )

	{

		/* Copy the data from the queue. */

		pxQueue->pcReadFrom += pxQueue->uxItemSize;

		if( pxQueue->pcReadFrom >= pxQueue->pcTail )

		{

			pxQueue->pcReadFrom = pxQueue->pcHead;

		}

		--( pxQueue->uxMessagesWaiting );

		memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize );



		/* If the queue is locked we will not modify the event list.  Instead

		we update the lock count so the task that unlocks the queue will know

		that an ISR has removed data while the queue was locked. */

		if( pxQueue->xRxLock == queueUNLOCKED )

		{

			/* We only want to wake one task per ISR, so check that a task has

			not already been woken. */

			if( !( *pxTaskWoken ) )

			{

				if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )

				{

					if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )

					{

						/* The task waiting has a higher priority than us so

						force a context switch. */

						*pxTaskWoken = pdTRUE;

					}

				}

			}

		}

		else

		{

			/* Increment the lock count so the task that unlocks the queue

			knows that data was removed while it was locked. */

			++( pxQueue->xRxLock );

		}



		xReturn = pdPASS;

	}

	else

	{

		xReturn = pdFAIL;

	}



	return xReturn;

}

/*-----------------------------------------------------------*/



unsigned portBASE_TYPE uxQueueMessagesWaiting( xQueueHandle pxQueue )

{

unsigned portBASE_TYPE uxReturn;



	taskENTER_CRITICAL();

		uxReturn = pxQueue->uxMessagesWaiting;

	taskEXIT_CRITICAL();



	return uxReturn;

}

/*-----------------------------------------------------------*/



void vQueueDelete( xQueueHandle pxQueue )

{

	vPortFree( pxQueue->pcHead );

	vPortFree( pxQueue );

}

/*-----------------------------------------------------------*/



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人在线视频一区二区| 另类小说色综合网站| 久久久三级国产网站| 欧美一级高清片在线观看| 欧美日韩黄色一区二区| 欧美另类高清zo欧美| 欧美精选一区二区| 555www色欧美视频| 精品国产髙清在线看国产毛片| 日韩三级av在线播放| 久久久精品一品道一区| 国产精品美女一区二区三区| 亚洲午夜精品网| 亚洲一区精品在线| 日韩av中文字幕一区二区| 美女一区二区在线观看| 国模一区二区三区白浆| 成人av手机在线观看| 色88888久久久久久影院按摩 | 久久久精品国产免费观看同学| 日韩欧美一级在线播放| 国产亚洲欧美日韩俺去了| 国产精品丝袜黑色高跟| 亚洲精选在线视频| 日本不卡视频一二三区| 国产一区二三区好的| 不卡的av网站| 欧美一区二区三区免费在线看 | 久久99久久99小草精品免视看| 国产一区在线不卡| 色欧美片视频在线观看| 欧美一区中文字幕| 欧美极品少妇xxxxⅹ高跟鞋 | 亚洲一区二区五区| 老司机一区二区| 91亚洲永久精品| 日韩午夜av电影| 亚洲欧美成人一区二区三区| 免费成人在线播放| 91麻豆国产香蕉久久精品| 日韩一区二区三| 一区二区三区国产精华| 国产精品91一区二区| 4438x成人网最大色成网站| 国产精品久久久久aaaa樱花| 久久精品噜噜噜成人av农村| 91看片淫黄大片一级在线观看| 日韩免费观看高清完整版| 一区二区三区美女| 高清国产午夜精品久久久久久| 91精品欧美久久久久久动漫| 亚洲欧洲综合另类| 国产成人精品一区二| 欧美电影免费提供在线观看| 亚洲动漫第一页| 色综合久久中文综合久久牛| 久久精品亚洲乱码伦伦中文| 免费人成在线不卡| 3atv一区二区三区| 亚洲图片自拍偷拍| 菠萝蜜视频在线观看一区| 2023国产精品| 黄色小说综合网站| 欧美电影免费提供在线观看| 日韩精品一二区| 91精品国模一区二区三区| 亚洲制服丝袜av| 色综合久久中文字幕| 亚洲色图20p| 91美女在线观看| 亚洲精品国产成人久久av盗摄| 成人国产视频在线观看| 国产丝袜在线精品| 国产69精品久久久久毛片| 国产无遮挡一区二区三区毛片日本| 久久99久久久久久久久久久| 欧美成人艳星乳罩| 国产一区二区三区黄视频 | 亚洲人成网站影音先锋播放| 99久久夜色精品国产网站| 亚洲视频一二三| 色爱区综合激月婷婷| 天堂精品中文字幕在线| 日韩精品一区二区三区视频播放 | av不卡免费电影| 亚洲另类中文字| 欧美日韩不卡一区二区| 蜜桃久久久久久久| 久久久不卡网国产精品二区| 国产v综合v亚洲欧| 自拍偷拍国产精品| 91超碰这里只有精品国产| 日本成人中文字幕| 亚洲国产精品高清| 91久久国产综合久久| 日韩vs国产vs欧美| 国产亲近乱来精品视频| 91网站在线观看视频| 偷拍自拍另类欧美| 9i在线看片成人免费| 亚洲va欧美va国产va天堂影院| 91精品蜜臀在线一区尤物| 国产成人免费视频网站高清观看视频| 国产精品美女久久久久aⅴ国产馆| 色哟哟欧美精品| 琪琪久久久久日韩精品| 中文字幕av一区二区三区免费看| 91女厕偷拍女厕偷拍高清| 日韩精品高清不卡| 中文字幕日韩一区| 欧美乱妇23p| 99久精品国产| 麻豆91精品视频| 亚洲美女区一区| 91麻豆精品国产自产在线| 粉嫩高潮美女一区二区三区 | 97国产精品videossex| 日本午夜一区二区| 亚洲精品国久久99热| 久久久久青草大香线综合精品| 在线影院国内精品| 国产成人在线网站| 亚洲午夜久久久| 中文字幕亚洲不卡| 欧美一级日韩一级| 国产91精品精华液一区二区三区| 日韩成人一区二区三区在线观看| 国产视频亚洲色图| 欧美一二三区在线观看| 在线免费观看视频一区| 成人永久免费视频| 国产资源在线一区| 五月综合激情网| 一区二区三区影院| 国产精品拍天天在线| 欧美精品一区二区三区高清aⅴ | 一本色道**综合亚洲精品蜜桃冫| 国产自产2019最新不卡| 天天综合色天天综合| 亚洲色图欧美在线| 国产精品久久久久久久久动漫| 日本伦理一区二区| 日韩 欧美一区二区三区| 亚洲视频网在线直播| 国产精品福利电影一区二区三区四区| 欧美成人video| 欧美v国产在线一区二区三区| 在线不卡中文字幕播放| 欧美影视一区在线| 欧美亚洲图片小说| 欧美色综合久久| 欧美三级韩国三级日本一级| 欧美日韩午夜在线视频| 欧美手机在线视频| 欧美丰满一区二区免费视频 | 国产精品日韩成人| 国产精品免费av| 亚洲色图视频网| 亚洲一本大道在线| 天天操天天干天天综合网| 午夜av一区二区| 久久99精品久久久久久动态图 | 欧美日韩一区在线| 91精品国产综合久久香蕉麻豆 | 中文字幕在线观看不卡| 欧美一级免费大片| 日韩欧美在线123| 久久天天做天天爱综合色| 国产欧美1区2区3区| 亚洲日本丝袜连裤袜办公室| 亚洲第一久久影院| 精品国产a毛片| 国产三级精品三级| 亚洲视频每日更新| 午夜成人在线视频| 国产成人免费视频一区| 91美女片黄在线观看91美女| 884aa四虎影成人精品一区| 精品剧情在线观看| 最新国产精品久久精品| 日本视频一区二区| 成人午夜激情影院| 91精品视频网| 国产精品成人免费| 日本美女一区二区三区视频| 国产美女一区二区三区| 91黄色在线观看| 精品成人私密视频| 亚洲一区在线观看免费观看电影高清| 日韩中文字幕麻豆| 播五月开心婷婷综合| 91精品国产品国语在线不卡| 国产欧美一区二区精品性色| 亚洲一本大道在线| 成人午夜免费电影| 日韩一区二区三区电影| 亚洲蜜桃精久久久久久久| 久久99蜜桃精品| 7878成人国产在线观看| 最近日韩中文字幕|