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

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

?? heap_2.c

?? freescale k40/k60 freertos-uip 例程
?? C
字號:
/*
    FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd.

    ***************************************************************************
    *                                                                         *
    * If you are:                                                             *
    *                                                                         *
    *    + New to FreeRTOS,                                                   *
    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
    *    + Looking for basic training,                                        *
    *    + Wanting to improve your FreeRTOS skills and productivity           *
    *                                                                         *
    * then take a look at the FreeRTOS eBook                                  *
    *                                                                         *
    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
    *                  http://www.FreeRTOS.org/Documentation                  *
    *                                                                         *
    * A pdf reference manual is also available.  Both are usually delivered   *
    * to your inbox within 20 minutes to two hours when purchased between 8am *
    * and 8pm GMT (although please allow up to 24 hours in case of            *
    * exceptional circumstances).  Thank you for your support!                *
    *                                                                         *
    ***************************************************************************

    This file is part of the FreeRTOS distribution.

    FreeRTOS is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License (version 2) as published by the
    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
    ***NOTE*** The exception to the GPL is included to allow you to distribute
    a combined work that includes FreeRTOS without being obliged to provide the
    source code for proprietary components outside of the FreeRTOS kernel.
    FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it 
    can be viewed here: http://www.freertos.org/a00114.html and also obtained 
    by writing to Richard Barry, contact details for whom are available on the
    FreeRTOS WEB site.

    1 tab == 4 spaces!

    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>

/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers.  That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE

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

#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE

/* Allocate the memory for the heap.  The struct is used to force byte
alignment without using any non-portable code. */
static union xRTOS_HEAP
{
	#if portBYTE_ALIGNMENT == 8
		volatile portDOUBLE dDummy;
	#else
		volatile unsigned long ulDummy;
	#endif
	unsigned char 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 short  heapSTRUCT_SIZE	= ( sizeof( xBlockLink ) + portBYTE_ALIGNMENT - ( 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;

/* Keeps track of the number of free bytes remaining, but says nothing about
fragmentation. */
static size_t xFreeBytesRemaining;

/* 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;										\
																					\
	xFreeBytesRemaining = configTOTAL_HEAP_SIZE;									\
}
/*-----------------------------------------------------------*/

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 & portBYTE_ALIGNMENT_MASK )
			{
				/* Byte alignment required. */
				xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_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 char * ) 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 char * ) 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 ) );
				}
				
				xFreeBytesRemaining -= xWantedSize;
			}
		}
	}
	xTaskResumeAll();

	#if( configUSE_MALLOC_FAILED_HOOK == 1 )
	{
		if( pvReturn == NULL )
		{
			extern void vApplicationMallocFailedHook( void );
			vApplicationMallocFailedHook();
		}
	}
	#endif

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

void vPortFree( void *pv )
{
unsigned char *puc = ( unsigned char * ) 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 ) );
			xFreeBytesRemaining += pxLink->xBlockSize;
		}
		xTaskResumeAll();
	}
}
/*-----------------------------------------------------------*/

size_t xPortGetFreeHeapSize( void )
{
	return xFreeBytesRemaining;
}
/*-----------------------------------------------------------*/

void vPortInitialiseBlocks( void )
{
	/* This just exists to keep the linker quiet. */
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品精品国产自在97香蕉| 亚洲自拍偷拍av| 97se亚洲国产综合在线| 日本不卡免费在线视频| 亚洲一级片在线观看| 麻豆久久久久久| 欧美性色黄大片| 成人福利视频在线| 国产成人丝袜美腿| 国产成人福利片| 欧美二区三区的天堂| 5858s免费视频成人| 欧美片网站yy| 久久久久99精品一区| 国产婷婷色一区二区三区| 久久久久久日产精品| 五月激情综合婷婷| 捆绑紧缚一区二区三区视频| 久久疯狂做爰流白浆xx| 欧美日韩dvd在线观看| 亚洲色图清纯唯美| 午夜精品视频在线观看| 色综合婷婷久久| 欧美色视频在线| 欧美电影免费观看完整版| 精品福利av导航| 国产精品久久久久久久久久免费看| 欧美国产欧美亚州国产日韩mv天天看完整 | 一本色道综合亚洲| 色噜噜狠狠色综合欧洲selulu| 欧美日韩精品一区二区| 亚洲一区在线电影| 欧美性欧美巨大黑白大战| 亚洲视频免费观看| 色综合久久中文综合久久牛| √…a在线天堂一区| 麻豆精品视频在线观看免费| 欧美剧情片在线观看| 一区二区三区在线免费视频| 免费xxxx性欧美18vr| 欧美一二三四在线| 中文字幕在线一区免费| 99麻豆久久久国产精品免费优播| 欧美久久久久久久久久| 丝袜亚洲另类丝袜在线| 99久久国产综合精品女不卡| 亚洲乱码国产乱码精品精98午夜 | 伊人开心综合网| 欧美综合天天夜夜久久| 欧美激情综合网| 成人性生交大片| 欧美videos大乳护士334| 亚洲美女在线一区| 国产乱人伦偷精品视频不卡| 欧美美女一区二区在线观看| 日韩制服丝袜先锋影音| 久久久久久久综合色一本| 丁香六月综合激情| 亚洲精品视频一区| 日韩一区二区三区在线观看| 激情综合色综合久久| 欧美日韩精品一区二区三区四区| 青青草97国产精品免费观看无弹窗版| 精品福利一二区| 91在线国产观看| 午夜视频一区二区| 久久综合久久综合久久| 美女国产一区二区三区| 国产亚洲欧美中文| 欧美亚洲国产一区在线观看网站| 美国av一区二区| 成人欧美一区二区三区1314| 麻豆精品一区二区av白丝在线| 欧美日韩一级黄| 在线综合亚洲欧美在线视频| 国产91精品精华液一区二区三区| 成人午夜视频在线观看| 亚洲免费在线观看视频| 精品国产不卡一区二区三区| 91免费观看视频在线| 中文字幕一区视频| 欧美一区二区福利视频| 日日夜夜精品免费视频| 亚洲国产精品精华液2区45| 欧美日韩一级视频| 91在线码无精品| 国产精品一区三区| 日日摸夜夜添夜夜添精品视频| 国产拍欧美日韩视频二区| 国产高清久久久| 婷婷综合另类小说色区| 国产精品国产三级国产aⅴ原创 | 91麻豆精品国产91久久久| 成人av网址在线| 国产尤物一区二区| 国产欧美一区二区精品忘忧草| 欧美日韩一区二区不卡| 99re成人在线| 成人高清视频在线观看| 精品一区二区三区免费视频| 亚洲1区2区3区4区| 欧美岛国在线观看| 欧美综合欧美视频| 91黄色免费网站| 一道本成人在线| 91亚洲国产成人精品一区二三| 国产成人在线看| 国产精品一级二级三级| 久久99国产精品免费| 蜜桃精品在线观看| 免费视频最近日韩| 久久成人av少妇免费| 日韩av电影天堂| 国产精品污网站| 欧美日本精品一区二区三区| 色乱码一区二区三区88| 91女人视频在线观看| www.日本不卡| 91视频免费观看| 欧美自拍丝袜亚洲| 欧美日韩午夜在线| 精品视频免费看| 欧美精品日韩精品| 日韩你懂的在线播放| 精品久久久三级丝袜| 久久男人中文字幕资源站| 国产亚洲欧美日韩在线一区| 亚洲成人av在线电影| 天堂va蜜桃一区二区三区| 日本vs亚洲vs韩国一区三区二区 | 99re这里只有精品6| av网站免费线看精品| 91片黄在线观看| 欧美日韩精品一二三区| 欧美精品一区二区久久久 | 欧美一级黄色录像| 久久综合九色综合97婷婷| 国产欧美一区二区在线观看| 成人免费一区二区三区视频| 一区二区三区日韩欧美| 日本不卡一区二区| 国产一区二区三区在线看麻豆| heyzo一本久久综合| 欧美在线播放高清精品| 日韩欧美国产wwwww| 久久色.com| 一区二区三区精品在线| 免费在线观看一区二区三区| 国产夫妻精品视频| 欧美中文字幕亚洲一区二区va在线| 欧美一区二区三区思思人| 中文字幕第一页久久| 亚洲国产精品一区二区www在线 | 日韩精品在线一区| 国产精品萝li| 天使萌一区二区三区免费观看| 国产很黄免费观看久久| 欧美日韩一级二级| 久久九九久久九九| 亚洲一二三四区不卡| 激情文学综合插| 欧美日韩在线一区二区| 欧美大胆人体bbbb| 亚洲欧美自拍偷拍色图| 免费高清不卡av| 在线看日韩精品电影| 欧美国产欧美亚州国产日韩mv天天看完整 | av不卡在线观看| 日韩美女在线视频| 亚洲裸体在线观看| 国产精品一区二区不卡| 欧美剧在线免费观看网站| 亚洲欧洲日韩在线| 国产精品1024| 欧美刺激午夜性久久久久久久 | 91色视频在线| 久久人人爽人人爽| 欧美aaaaaa午夜精品| 欧美日韩中文精品| 自拍偷拍国产精品| 成人18视频日本| 久久九九全国免费| 国产一区二区精品久久99 | 在线看国产日韩| 中文字幕色av一区二区三区| 国产一区二区三区最好精华液| 制服视频三区第一页精品| 一区二区三区不卡视频在线观看| 国产不卡视频在线观看| 精品va天堂亚洲国产| 久久精品国产久精国产爱| 欧洲在线/亚洲| 亚洲欧美另类在线| 91最新地址在线播放| 国产精品电影院| av电影在线观看不卡| 国产精品污网站| 91在线观看下载| 日韩理论片在线| 在线免费视频一区二区|