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

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

?? heap_2.c

?? IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR IAR
?? C
字號:
/*
	FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.

	This file is part of the FreeRTOS.org distribution.

	FreeRTOS.org is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	FreeRTOS.org is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with FreeRTOS.org; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	A special exception to the GPL can be applied should you wish to distribute
	a combined work that includes FreeRTOS.org, without being obliged to provide
	the source code for any proprietary components.  See the licensing section
	of http://www.FreeRTOS.org for full details of how and when the exception
	can be applied.

    ***************************************************************************
    ***************************************************************************
    *                                                                         *
    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *
    * and even write all or part of your application on your behalf.          *
    * See http://www.OpenRTOS.com for details of the services we provide to   *
    * expedite your project.                                                  *
    *                                                                         *
    ***************************************************************************
    ***************************************************************************

	Please ensure to read the configuration and relevant port sections of the
	online documentation.

	http://www.FreeRTOS.org - Documentation, latest information, license and 
	contact details.

	http://www.SafeRTOS.com - A version that is certified for use in safety 
	critical systems.

	http://www.OpenRTOS.com - Commercial support, development, porting, 
	licensing and training services.
*/

/*
 * A sample implementation of pvPortMalloc() and vPortFree() that permits
 * allocated blocks to be freed, but does not combine adjacent free blocks
 * into a single larger block.
 *
 * See heap_1.c and heap_3.c for alternative implementations, and the memory
 * management pages of http://www.FreeRTOS.org for more information.
 */
#include <stdlib.h>

#include "FreeRTOS.h"
#include "task.h"

/* Setup the correct byte alignment mask for the defined byte alignment. */

#if portBYTE_ALIGNMENT == 8
	#define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0007 )
#endif

#if portBYTE_ALIGNMENT == 4
	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0003 )
#endif

#if portBYTE_ALIGNMENT == 2
	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0001 )
#endif

#if portBYTE_ALIGNMENT == 1
	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0000 )
#endif

#ifndef heapBYTE_ALIGNMENT_MASK
	#error "Invalid portBYTE_ALIGNMENT definition"
#endif

/* Allocate the memory for the heap.  The struct is used to force byte
alignment without using any non-portable code. */
static struct xRTOS_HEAP
{
	unsigned portLONG ulDummy;
	unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];
} xHeap;

/* Define the linked list structure.  This is used to link free blocks in order
of their size. */
typedef struct A_BLOCK_LINK
{
	struct A_BLOCK_LINK *pxNextFreeBlock;	/*<< The next free block in the list. */
	size_t xBlockSize;						/*<< The size of the free block. */
} xBlockLink;


static const unsigned portSHORT  heapSTRUCT_SIZE	= ( sizeof( xBlockLink ) + ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );
#define heapMINIMUM_BLOCK_SIZE	( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )

/* Create a couple of list links to mark the start and end of the list. */
static xBlockLink xStart, xEnd;

/* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */

/*
 * Insert a block into the list of free blocks - which is ordered by size of
 * the block.  Small blocks at the start of the list and large blocks at the end
 * of the list.
 */
#define prvInsertBlockIntoFreeList( pxBlockToInsert )								\
{																					\
xBlockLink *pxIterator;																\
size_t xBlockSize;																	\
																					\
	xBlockSize = pxBlockToInsert->xBlockSize;										\
																					\
	/* Iterate through the list until a block is found that has a larger size */	\
	/* than the block we are inserting. */											\
	for( pxIterator = &xStart; pxIterator->pxNextFreeBlock->xBlockSize < xBlockSize; pxIterator = pxIterator->pxNextFreeBlock )	\
	{																				\
		/* There is nothing to do here - just iterate to the correct position. */	\
	}																				\
																					\
	/* Update the list to include the block being inserted in the correct */		\
	/* position. */																	\
	pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;					\
	pxIterator->pxNextFreeBlock = pxBlockToInsert;									\
}
/*-----------------------------------------------------------*/

#define prvHeapInit()																\
{																					\
xBlockLink *pxFirstFreeBlock;														\
																					\
	/* xStart is used to hold a pointer to the first item in the list of free */	\
	/* blocks.  The void cast is used to prevent compiler warnings. */				\
	xStart.pxNextFreeBlock = ( void * ) xHeap.ucHeap;								\
	xStart.xBlockSize = ( size_t ) 0;												\
																					\
	/* xEnd is used to mark the end of the list of free blocks. */					\
	xEnd.xBlockSize = configTOTAL_HEAP_SIZE;										\
	xEnd.pxNextFreeBlock = NULL;													\
																					\
	/* To start with there is a single free block that is sized to take up the		\
	entire heap space. */															\
	pxFirstFreeBlock = ( void * ) xHeap.ucHeap;										\
	pxFirstFreeBlock->xBlockSize = configTOTAL_HEAP_SIZE;							\
	pxFirstFreeBlock->pxNextFreeBlock = &xEnd;										\
}
/*-----------------------------------------------------------*/

void *pvPortMalloc( size_t xWantedSize )
{
xBlockLink *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
static portBASE_TYPE xHeapHasBeenInitialised = pdFALSE;
void *pvReturn = NULL;

	vTaskSuspendAll();
	{
		/* If this is the first call to malloc then the heap will require
		initialisation to setup the list of free blocks. */
		if( xHeapHasBeenInitialised == pdFALSE )
		{
			prvHeapInit();
			xHeapHasBeenInitialised = pdTRUE;
		}

		/* The wanted size is increased so it can contain a xBlockLink
		structure in addition to the requested amount of bytes. */
		if( xWantedSize > 0 )
		{
			xWantedSize += heapSTRUCT_SIZE;

			/* Ensure that blocks are always aligned to the required number of bytes. */
			if( xWantedSize & heapBYTE_ALIGNMENT_MASK )
			{
				/* Byte alignment required. */
				xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) );
			}
		}

		if( ( xWantedSize > 0 ) && ( xWantedSize < configTOTAL_HEAP_SIZE ) )
		{
			/* Blocks are stored in byte order - traverse the list from the start
			(smallest) block until one of adequate size is found. */
			pxPreviousBlock = &xStart;
			pxBlock = xStart.pxNextFreeBlock;
			while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock ) )
			{
				pxPreviousBlock = pxBlock;
				pxBlock = pxBlock->pxNextFreeBlock;
			}

			/* If we found the end marker then a block of adequate size was not found. */
			if( pxBlock != &xEnd )
			{
				/* Return the memory space - jumping over the xBlockLink structure
				at its start. */
				pvReturn = ( void * ) ( ( ( unsigned portCHAR * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE );

				/* This block is being returned for use so must be taken our of the
				list of free blocks. */
				pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock;

				/* If the block is larger than required it can be split into two. */
				if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE )
				{
					/* This block is to be split into two.  Create a new block
					following the number of bytes requested. The void cast is
					used to prevent byte alignment warnings from the compiler. */
					pxNewBlockLink = ( void * ) ( ( ( unsigned portCHAR * ) pxBlock ) + xWantedSize );
					
					/* Calculate the sizes of two blocks split from the single
					block. */
					pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;	
					pxBlock->xBlockSize = xWantedSize;			
					
					/* Insert the new block into the list of free blocks. */
					prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
				}
			}
		}
	}
	xTaskResumeAll();

	return pvReturn;
}
/*-----------------------------------------------------------*/

void vPortFree( void *pv )
{
unsigned portCHAR *puc = ( unsigned portCHAR * ) pv;
xBlockLink *pxLink;

	if( pv )
	{
		/* The memory being freed will have an xBlockLink structure immediately
		before it. */
		puc -= heapSTRUCT_SIZE;

		/* This casting is to keep the compiler from issuing warnings. */
		pxLink = ( void * ) puc;

		vTaskSuspendAll();
		{				
			/* Add this block to the list of free blocks. */
			prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) );
		}
		xTaskResumeAll();
	}
}
/*-----------------------------------------------------------*/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品一区二区三区四区| 亚洲麻豆国产自偷在线| 国产精品毛片久久久久久| 亚洲手机成人高清视频| 精品在线免费观看| 欧美色图免费看| 中文字幕乱码久久午夜不卡| 午夜精品福利一区二区三区蜜桃| 国产精品白丝av| 欧美日韩日日摸| 亚洲三级久久久| 国产精品一卡二卡在线观看| 91麻豆精品国产自产在线| 成人欧美一区二区三区视频网页 | 蓝色福利精品导航| 91亚洲永久精品| 中文字幕乱码久久午夜不卡| 美女高潮久久久| 在线精品视频小说1| 国产精品网友自拍| 极品瑜伽女神91| 欧美性视频一区二区三区| 国产精品丝袜一区| 国产一区二区三区不卡在线观看| 在线成人av网站| 亚洲成人一区在线| 91精品91久久久中77777| 中文字幕一区免费在线观看| 国产福利精品一区| 久久精品视频一区二区三区| 国产综合色精品一区二区三区| 欧美一区二区三区四区五区| 亚洲国产精品久久人人爱| 日本道免费精品一区二区三区| 国产日韩欧美制服另类| 青娱乐精品视频在线| 91精品国产综合久久久久久| 六月丁香综合在线视频| 日韩三级精品电影久久久| 亚洲成人激情自拍| 制服.丝袜.亚洲.另类.中文 | 欧美体内she精视频| 一区二区欧美在线观看| 在线观看一区日韩| 亚洲电影中文字幕在线观看| 欧美特级限制片免费在线观看| 亚洲一区二区美女| 欧美乱妇15p| 青青青伊人色综合久久| 精品国产免费久久 | 午夜影视日本亚洲欧洲精品| 69堂精品视频| 精品一二三四区| 国产目拍亚洲精品99久久精品| 成人性生交大片免费看在线播放| 国产精品电影一区二区三区| 欧美系列在线观看| 麻豆91在线观看| 国产三级欧美三级| 色琪琪一区二区三区亚洲区| 亚洲图片欧美视频| 欧美xxxxx裸体时装秀| 大桥未久av一区二区三区中文| 综合久久久久久久| 日韩视频在线观看一区二区| 国产成人av一区二区三区在线 | 91久久精品国产91性色tv| 丝袜美腿一区二区三区| 精品精品欲导航| 国产精品456露脸| 亚洲小说春色综合另类电影| 亚洲精品一区二区三区香蕉| 91免费国产视频网站| 日韩精品一级中文字幕精品视频免费观看 | 欧美一区二区三区四区视频| 国内欧美视频一区二区| 亚洲欧洲成人自拍| 日韩三级高清在线| 91论坛在线播放| 麻豆成人综合网| 亚洲婷婷综合久久一本伊一区| 欧美日韩一区二区三区不卡| 国产成人精品免费| 日本不卡不码高清免费观看| 国产精品国产三级国产三级人妇 | av不卡免费电影| 久久精品国产一区二区三| 亚洲女同一区二区| 久久久久99精品国产片| 欧美日韩久久久久久| 波多野结衣视频一区| 麻豆91精品91久久久的内涵| 亚洲一区二区中文在线| 国产蜜臀97一区二区三区| 这里是久久伊人| 欧美日韩精品久久久| 99国产精品久久| 成人中文字幕合集| 老司机精品视频在线| 日韩成人伦理电影在线观看| 一区二区三区高清| 中文字幕日本不卡| 中文字幕第一区| 久久先锋资源网| 日韩欧美国产麻豆| 91精品国产综合久久婷婷香蕉| 在线看国产日韩| 欧洲国产伦久久久久久久| 99在线视频精品| 成人性生交大片免费看中文| 国产成人精品亚洲777人妖| 狠狠色狠狠色合久久伊人| 欧美aaa在线| 日本三级韩国三级欧美三级| 亚洲国产综合91精品麻豆| 亚洲欧美福利一区二区| 亚洲天堂成人网| 亚洲视频电影在线| 亚洲狠狠丁香婷婷综合久久久| 国产精品乱子久久久久| 中文成人综合网| 国产嫩草影院久久久久| 国产精品美女久久久久av爽李琼| 久久久精品tv| 国产精品久久久久久久久久久免费看| 精品久久久久久久久久久久久久久久久 | 久久黄色级2电影| 久久国产精品99精品国产| 久久精品久久99精品久久| 国产资源在线一区| 国产成人av电影在线| 国产成a人亚洲| 成人小视频在线| av成人老司机| 欧美亚洲一区二区三区四区| 欧美电影影音先锋| 精品国精品自拍自在线| 国产精品少妇自拍| 亚洲精品国产a| 日韩电影在线免费| 成人综合婷婷国产精品久久蜜臀 | 天天影视色香欲综合网老头| 美国欧美日韩国产在线播放| 国产一区二区三区日韩| 91色乱码一区二区三区| 欧美日韩一区国产| 久久久久久久久久久99999| 国产精品视频在线看| 久久精品视频在线免费观看| 欧美日韩一区三区四区| 日韩亚洲欧美中文三级| 久久女同精品一区二区| 日本一区二区免费在线| 欧美国产欧美综合| 夜夜亚洲天天久久| 视频一区二区国产| 成人黄页毛片网站| 一本久久a久久精品亚洲| 高清不卡一区二区| 99精品欧美一区二区三区小说| 91网站最新地址| 欧美日韩在线综合| 久久精品人人做人人综合| 综合久久国产九一剧情麻豆| 午夜精品久久久久久久99水蜜桃| 毛片av一区二区| 99国产精品视频免费观看| 欧美日韩国产另类不卡| 国产精品色噜噜| 亚洲成人自拍网| 丝袜诱惑制服诱惑色一区在线观看 | 在线免费不卡电影| 欧美哺乳videos| 亚洲成av人片www| 黄色资源网久久资源365| 色婷婷亚洲综合| 欧美日韩一级黄| **网站欧美大片在线观看| 日韩一区精品字幕| 91在线视频观看| 欧美年轻男男videosbes| 日韩码欧中文字| 韩日av一区二区| 成人精品一区二区三区四区| 欧美精品v日韩精品v韩国精品v| 久久精品亚洲一区二区三区浴池| 亚洲午夜羞羞片| 欧美在线制服丝袜| 欧美国产激情一区二区三区蜜月| 午夜一区二区三区视频| www.av精品| 国产精品视频一二三| 美女国产一区二区| 欧美一区二区三区影视| 日韩精品五月天| 欧美一三区三区四区免费在线看| 亚洲综合在线五月| av亚洲精华国产精华| 国产精品三级av在线播放| 国产一区二区三区电影在线观看|