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

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

?? heap_2.c

?? freescale k40/k60 freertos-lwip例程
?? 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. */
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女一区二区三区| 在线播放中文字幕一区| 久久久精品国产免费观看同学| 亚洲国产精品久久久久婷婷884 | 日韩欧美aaaaaa| 一区二区三区四区中文字幕| 在线亚洲人成电影网站色www| 亚洲欧洲一区二区在线播放| 99精品国产视频| 亚洲gay无套男同| 欧美性色综合网| 免费观看一级欧美片| 久久久三级国产网站| 95精品视频在线| 久久爱www久久做| 1024精品合集| 欧美一级久久久| 久久成人18免费观看| 国产精品青草久久| 91麻豆精品国产综合久久久久久| 免费人成黄页网站在线一区二区| 精品99久久久久久| 96av麻豆蜜桃一区二区| 久久电影网电视剧免费观看| 亚洲欧美一区二区三区久本道91| 精品久久国产97色综合| 色女孩综合影院| 成人精品国产免费网站| 蜜臀久久99精品久久久久宅男| 亚洲女性喷水在线观看一区| 国产日韩欧美亚洲| 欧美在线免费观看视频| 不卡欧美aaaaa| fc2成人免费人成在线观看播放| 日本成人在线不卡视频| 亚洲宅男天堂在线观看无病毒| 日韩一区二区在线播放| 51精品视频一区二区三区| 91国产精品成人| 欧美日韩色一区| 欧美日韩亚州综合| 欧美一区二区三区日韩视频| 欧美丝袜自拍制服另类| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲乱码国产乱码精品精可以看| 国产欧美1区2区3区| 久久亚洲捆绑美女| 国产精品久久久久永久免费观看| 综合av第一页| 国产日产亚洲精品系列| 久久久一区二区三区捆绑**| 91麻豆福利精品推荐| 精品亚洲国产成人av制服丝袜| 亚洲国产aⅴ天堂久久| 亚洲欧美另类小说视频| 日本aⅴ亚洲精品中文乱码| 久久99久久精品欧美| 91小视频在线| 精品国产成人在线影院| 一二三四社区欧美黄| 亚洲情趣在线观看| 久久国产精品一区二区| 9人人澡人人爽人人精品| 777a∨成人精品桃花网| 国产午夜久久久久| 精品在线观看视频| 欧美性感一区二区三区| 国产精品免费视频观看| 国产一区二区影院| 日韩无一区二区| 婷婷综合另类小说色区| 国产精品羞羞答答xxdd| 欧美一区二区视频网站| 亚洲第一久久影院| 欧美日韩国产综合视频在线观看 | 一区二区三区国产精品| heyzo一本久久综合| 国产精品久久777777| 99久久99久久免费精品蜜臀| 久久久久久久久久电影| 精品一区在线看| 国产精品乱子久久久久| 欧美性猛交一区二区三区精品| 国产精品情趣视频| 成人av网址在线| 亚洲靠逼com| 粉嫩嫩av羞羞动漫久久久| 国产精品久久久久一区二区三区| 老司机精品视频在线| 亚洲精品在线观| 91蜜桃免费观看视频| 丝瓜av网站精品一区二区| 色综合天天性综合| 夜色激情一区二区| 成人精品一区二区三区四区| 国产精品久久久久久久第一福利| 91麻豆高清视频| 国产九色精品成人porny| 国产精品美女久久久久av爽李琼| 欧美四级电影网| 国产不卡一区视频| 麻豆极品一区二区三区| 一区二区三区久久| 欧美一区二区三区在线看| 久久97超碰色| 一区二区三区电影在线播| 久久久精品欧美丰满| 色欧美日韩亚洲| 成人禁用看黄a在线| 极品瑜伽女神91| 亚洲一区免费在线观看| 亚洲一区二区在线免费看| 亚洲午夜精品网| 免费人成黄页网站在线一区二区| 亚洲成人av在线电影| 国产欧美日韩在线观看| 国产精品视频麻豆| 综合在线观看色| 一区二区三区波多野结衣在线观看 | 国产欧美精品一区aⅴ影院 | 国产精品美日韩| 一区二区三区视频在线观看| 五月天丁香久久| 福利一区二区在线| 欧美日韩一区二区三区在线| 欧美一区二视频| 中文字幕日本乱码精品影院| 丝袜美腿亚洲色图| 成人性生交大片免费看中文 | 欧美一二区视频| 国产精品色呦呦| 美国十次综合导航| 日本道免费精品一区二区三区| 日韩色视频在线观看| 亚洲一区二区高清| 懂色av一区二区三区蜜臀| 成人一区二区在线观看| 6080亚洲精品一区二区| 国产亲近乱来精品视频| 视频一区在线播放| 丁香婷婷综合激情五月色| 日韩欧美一二三| 亚洲一区在线看| 成a人片国产精品| 久久综合九色综合欧美98| 五月婷婷综合在线| 91福利社在线观看| 一区二区三区久久久| 色乱码一区二区三区88| 一区二区国产视频| 欧美综合欧美视频| 亚洲午夜免费福利视频| 91在线一区二区三区| 亚洲精品一区二区三区福利| 精品中文字幕一区二区小辣椒| 欧美一区日本一区韩国一区| 婷婷中文字幕综合| 欧美一级日韩免费不卡| 美腿丝袜亚洲三区| www久久精品| 色哟哟一区二区三区| 亚洲国产精品久久不卡毛片| 日韩欧美高清在线| 国产精品一区二区无线| 亚洲图片另类小说| 欧美日韩国产综合草草| 亚洲一卡二卡三卡四卡五卡| 青草av.久久免费一区| 日韩欧美亚洲一区二区| 成人高清免费观看| 亚洲国产综合色| 久久人人97超碰com| 色视频一区二区| 麻豆成人久久精品二区三区红| 久久久久久99精品| 欧美精品xxxxbbbb| 97se亚洲国产综合在线| 狠狠色狠狠色合久久伊人| 玉足女爽爽91| 日本一区二区三区四区在线视频| 欧美日本韩国一区| 91免费视频网| 成人美女在线观看| 国产在线精品一区二区不卡了 | 欧美成人精品二区三区99精品| 色综合天天综合网国产成人综合天| 久久国产精品第一页| 另类小说视频一区二区| 日本不卡高清视频| 日日夜夜精品免费视频| 香蕉加勒比综合久久| 亚洲激情综合网| 亚洲电影在线播放| 亚洲自拍偷拍av| 日韩精品一二三| 国产精品一区二区在线观看网站| 国精产品一区一区三区mba桃花| 亚洲成人免费在线| 麻豆精品视频在线观看免费| 精品写真视频在线观看|