Prepare demo for release.
parent
b56d2c8d6b
commit
fbf1f69a10
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
#Sun Nov 16 19:17:14 GMT 2008
|
||||
#Sun Nov 16 20:38:31 GMT 2008
|
||||
eclipse.preferences.version=1
|
||||
properties/RTOSDemo.null.38326818/0.1348192838=\#\r\n\#Sun Nov 16 19\:17\:14 GMT 2008\r\norg.eclipse.cdt.build.core.settings.holder.1053974197\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.804763436\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.libs.1997217404\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.99587291\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.prefbase.toolchain.1423010524\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\n0.1348192838\=\\\#\\r\\n\\\#Sun Nov 16 19\\\:17\\\:14 GMT 2008\\r\\nrcState\\\=0\\r\\nrebuildState\\\=false\\r\\n\r\n
|
||||
properties/RTOSDemo.null.38326818/0.1348192838=\#\r\n\#Sun Nov 16 20\:38\:31 GMT 2008\r\norg.eclipse.cdt.build.core.settings.holder.1053974197\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.804763436\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.libs.1997217404\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.settings.holder.99587291\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\norg.eclipse.cdt.build.core.prefbase.toolchain.1423010524\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrebuildState\\\=false\\r\\n\r\n0.1348192838\=\\\#\\r\\n\\\#Sun Nov 16 20\\\:38\\\:31 GMT 2008\\r\\nrcState\\\=0\\r\\nrebuildState\\\=false\\r\\n\r\n
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,69 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workingSetManager>
|
||||
<workingSet editPageId="org.eclipse.cdt.ui.CElementWorkingSetPage" factoryID="org.eclipse.ui.internal.WorkingSetFactory" label="RTOSDemo" name="RTOSDemo">
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOSConfig.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/croutine.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/include" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/list.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/portable/GCC/ColdFire_V2" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltPollQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/PollQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/integer.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/GenQTest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/queue.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/tasks.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Tick_Setup.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/ParTest" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/main.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/serial" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/webserver" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltBlckQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltBlock.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/list.c" type="1"/>
|
||||
<item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/RTOSDemo/m52233-rom.ld" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltBlock.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/comtest2.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/portable/GCC/ColdFire_V2" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/BlockQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/croutine.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/crflash.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltPollQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltQTest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/BlockQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/GenQTest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/IntQueue.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/PollQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/tasks.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/dynamic.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/QPeek.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/blocktim.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/dynamic.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/fileIO.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltQTest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/QPeek.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/death.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/main.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/comtest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/countsem.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/crflash.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/crhook.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/death.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/dynamic.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/flash.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/flop.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Tick_Setup.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/recmutex.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/integer.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/recmutex.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/semtest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/countsem.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltBlckQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/flop.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltBlckQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltBlock.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltPollQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/AltQTest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/BlockQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/GenQTest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/IntQueue.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/PollQ.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/QPeek.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/blocktim.h" type="1"/>
|
||||
<item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/RTOSDemo/Makefile" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/print.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/comtest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/comtest2.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/countsem.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/crflash.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/crhook.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/death.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/dynamic.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/fileIO.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/IntQueue.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_uIP" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOSConfig.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/flash.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/flop.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/integer.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/serial.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/blocktim.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/flash.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/blocktim.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/mevents.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/partest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/print.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/recmutex.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/semtest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/serial.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_uIP" type="2"/>
|
||||
<item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/RTOSDemo/Makefile" type="1"/>
|
||||
<item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/RTOSDemo/m52233-rom.ld" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/ParTest" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/countsem.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/PollQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/partest.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/recmutex.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/webserver" type="2"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/crflash.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/flop.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/GenQTest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/include/crhook.h" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/BlockQ.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/death.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/AltQTest.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/Demo_Source/Minimal/crhook.c" type="1"/>
|
||||
<item factoryID="org.eclipse.cdt.ui.PersistableCElementFactory" path="/RTOSDemo/FreeRTOS_Source/include" type="2"/>
|
||||
</workingSet>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" label="Window Working Set" name="Aggregate for window 1217933244875"/>
|
||||
<mruList name="RTOSDemo"/>
|
||||
|
@ -1,277 +0,0 @@
|
||||
/*
|
||||
FreeRTOS.org V5.1.0 - 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
|
||||
|
||||
/* Definitions from linker file. */
|
||||
extern far unsigned portCHAR __SP_INIT[];
|
||||
extern far unsigned portCHAR __RAM_ADDRESS[];
|
||||
extern far unsigned portCHAR __RAM_SIZE[];
|
||||
extern far unsigned portCHAR __stack_size[];
|
||||
|
||||
#define heapTOP_OF_RAM ( ( (unsigned portLONG) __RAM_ADDRESS + (unsigned portLONG ) __RAM_SIZE ) - 4 )
|
||||
#define heapTOTAL_SIZE ( (heapTOP_OF_RAM - (unsigned portLONG)__SP_INIT ) + 4 )
|
||||
|
||||
/* Allocate the memory for the heap. The struct is used to force byte
|
||||
alignment without using any non-portable code. */
|
||||
typedef struct xRTOS_HEAP_t
|
||||
{
|
||||
unsigned portLONG ulDummy;
|
||||
unsigned portCHAR *ucHeap;
|
||||
} xHeapStruct;
|
||||
|
||||
/* 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 xHeapStruct *xHeap = NULL;
|
||||
|
||||
/* 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; \
|
||||
\
|
||||
/* Point to the start of the heap. */ \
|
||||
xHeap = ( void * ) ( ( unsigned portLONG ) __SP_INIT + 4UL ); \
|
||||
xHeap->ucHeap = ( void * ) xHeap; \
|
||||
\
|
||||
/* 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 = heapTOTAL_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 = heapTOTAL_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 < heapTOTAL_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();
|
||||
|
||||
if( pvReturn == NULL )
|
||||
{
|
||||
asm volatile ("NOP");
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -1,227 +0,0 @@
|
||||
/* Linker script for m52235evb
|
||||
*
|
||||
* Version:Sourcery G++ Lite 4.2-125
|
||||
* BugURL:https://support.codesourcery.com/GNUToolchain/
|
||||
*
|
||||
* Copyright 2007, 2008 CodeSourcery.
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply. */
|
||||
|
||||
OUTPUT_ARCH(m68k)
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lcs3 -lcs3unhosted -lcs3coldfire)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ram (rw) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||
vectorrom (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
|
||||
cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000020
|
||||
rom (rx) : ORIGIN = 0x00000420, LENGTH = 256K - 0x400 - 0x20
|
||||
ipsbar (rw) : ORIGIN = 0x40000000, LENGTH = 2M
|
||||
}
|
||||
|
||||
/* These force the linker to search for particular symbols from
|
||||
* the start of the link process and thus ensure the user's
|
||||
* overrides are picked up
|
||||
*/
|
||||
EXTERN(__cs3_reset_m52235evb)
|
||||
INCLUDE coldfire-names.inc
|
||||
EXTERN(__cs3_interrupt_vector_coldfire)
|
||||
EXTERN(__cs3_start_c main __cs3_stack __cs3_heap_end)
|
||||
EXTERN(_start)
|
||||
|
||||
PROVIDE(__cs3_heap_start = _end);
|
||||
PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
|
||||
PROVIDE(__cs3_region_num = (__cs3_regions_end - __cs3_regions) / 20);
|
||||
PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.vectors_table :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
__cs3_region_start_rom = .;
|
||||
*(.cs3.region-head.rom)
|
||||
ASSERT (. == __cs3_region_start_rom, ".cs3.region-head.rom not permitted");
|
||||
__cs3_interrupt_vector = __cs3_interrupt_vector_coldfire;
|
||||
*(.cs3.interrupt_vector)
|
||||
/* Make sure we pulled in an interrupt vector. */
|
||||
ASSERT (. != __cs3_interrupt_vector_coldfire, "No interrupt vector");
|
||||
} > vectorrom
|
||||
|
||||
.cfmprotect :
|
||||
{
|
||||
*(.cfmconfig)
|
||||
. = ALIGN (0x4);
|
||||
} > cfmprotrom
|
||||
|
||||
|
||||
.text :
|
||||
{
|
||||
|
||||
PROVIDE(__cs3_reset_m52235evb = _start);
|
||||
__cs3_reset = __cs3_reset_m52235evb;
|
||||
*(.cs3.reset)
|
||||
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.jcr))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .jcr))
|
||||
KEEP (*crtend.o(.jcr))
|
||||
|
||||
. = ALIGN(0x4);
|
||||
*(.gcc_except_table .gcc_except_table.*)
|
||||
} >rom
|
||||
.eh_frame_hdr : ALIGN (4)
|
||||
{
|
||||
KEEP (*(.eh_frame_hdr))
|
||||
} >rom
|
||||
.eh_frame : ALIGN (4)
|
||||
{
|
||||
KEEP (*(.eh_frame))
|
||||
} >rom
|
||||
.rodata : ALIGN (4)
|
||||
{
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
|
||||
. = ALIGN(4);
|
||||
_init = .;
|
||||
LONG (0x4e560000) /* linkw %fp,#0 */
|
||||
KEEP(*(.init))
|
||||
SHORT (0x4e5e) /* unlk %fp */
|
||||
SHORT (0x4e75) /* rts */
|
||||
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
_fini = .;
|
||||
LONG (0x4e560000) /* linkw %fp,#0 */
|
||||
KEEP(*(.fini))
|
||||
SHORT (0x4e5e) /* unlk %fp */
|
||||
SHORT (0x4e75) /* rts */
|
||||
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
|
||||
*(.lit)
|
||||
|
||||
. = ALIGN(4);
|
||||
__cs3_regions = .;
|
||||
LONG (0)
|
||||
LONG (__cs3_region_init_ram)
|
||||
LONG (__cs3_region_start_ram)
|
||||
LONG (__cs3_region_init_size_ram)
|
||||
LONG (__cs3_region_zero_size_ram)
|
||||
__cs3_regions_end = .;
|
||||
|
||||
. = ALIGN (8);
|
||||
. = ALIGN (8);
|
||||
*(.rom)
|
||||
*(.rom.b)
|
||||
_etext = .;
|
||||
} >rom
|
||||
/* __cs3_region_end_rom is deprecated */
|
||||
__cs3_region_end_rom = __cs3_region_start_rom + LENGTH(rom);
|
||||
__cs3_region_size_rom = LENGTH(rom);
|
||||
|
||||
.cs3.ipsbar :
|
||||
{
|
||||
__cs3_region_start_ipsbar = .;
|
||||
*(.cs3.region-head.ipsbar)
|
||||
. = ALIGN (8);
|
||||
} >ipsbar
|
||||
/* __cs3_region_end_ipsbar is deprecated */
|
||||
__cs3_region_end_ipsbar = __cs3_region_start_ipsbar + LENGTH(ipsbar);
|
||||
__cs3_region_size_ipsbar = LENGTH(ipsbar);
|
||||
|
||||
.data : ALIGN (8)
|
||||
{
|
||||
__cs3_region_start_ram = .;
|
||||
*(.cs3.region-head.ram)
|
||||
*(.got.plt) *(.got)
|
||||
*(.shdata)
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
. = ALIGN (8);
|
||||
*(.ram)
|
||||
_edata = .;
|
||||
} >ram AT>rom
|
||||
.bss :
|
||||
{
|
||||
*(.shbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
*(.ram.b)
|
||||
_end = .;
|
||||
__end = .;
|
||||
} >ram AT>rom
|
||||
/* __cs3_region_end_ram is deprecated */
|
||||
__cs3_region_end_ram = __cs3_region_start_ram + LENGTH(ram);
|
||||
__cs3_region_size_ram = LENGTH(ram);
|
||||
__cs3_region_init_ram = LOADADDR (.data);
|
||||
__cs3_region_init_size_ram = _edata - ADDR (.data);
|
||||
__cs3_region_zero_size_ram = _end - _edata;
|
||||
|
||||
.stab 0 (NOLOAD) : { *(.stab) }
|
||||
.stabstr 0 (NOLOAD) : { *(.stabstr) }
|
||||
/* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to the beginning
|
||||
* of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
@ -0,0 +1,293 @@
|
||||
/*
|
||||
Copyright 2001, 2002 Georges Menie (www.menie.org)
|
||||
stdarg version contributed by Christian Ettinger
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
putchar is the only external dependency for this file,
|
||||
if you have a working putchar, leave it commented out.
|
||||
If not, uncomment the define below and
|
||||
replace outbyte(c) by your own function call.
|
||||
|
||||
*/
|
||||
|
||||
#define putchar(c) c
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
static void printchar(char **str, int c)
|
||||
{
|
||||
//extern int putchar(int c);
|
||||
|
||||
if (str) {
|
||||
**str = (char)c;
|
||||
++(*str);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)putchar(c);
|
||||
}
|
||||
}
|
||||
|
||||
#define PAD_RIGHT 1
|
||||
#define PAD_ZERO 2
|
||||
|
||||
static int prints(char **out, const char *string, int width, int pad)
|
||||
{
|
||||
register int pc = 0, padchar = ' ';
|
||||
|
||||
if (width > 0) {
|
||||
register int len = 0;
|
||||
register const char *ptr;
|
||||
for (ptr = string; *ptr; ++ptr) ++len;
|
||||
if (len >= width) width = 0;
|
||||
else width -= len;
|
||||
if (pad & PAD_ZERO) padchar = '0';
|
||||
}
|
||||
if (!(pad & PAD_RIGHT)) {
|
||||
for ( ; width > 0; --width) {
|
||||
printchar (out, padchar);
|
||||
++pc;
|
||||
}
|
||||
}
|
||||
for ( ; *string ; ++string) {
|
||||
printchar (out, *string);
|
||||
++pc;
|
||||
}
|
||||
for ( ; width > 0; --width) {
|
||||
printchar (out, padchar);
|
||||
++pc;
|
||||
}
|
||||
|
||||
return pc;
|
||||
}
|
||||
|
||||
/* the following should be enough for 32 bit int */
|
||||
#define PRINT_BUF_LEN 12
|
||||
|
||||
static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase)
|
||||
{
|
||||
char print_buf[PRINT_BUF_LEN];
|
||||
register char *s;
|
||||
register int t, neg = 0, pc = 0;
|
||||
register unsigned int u = (unsigned int)i;
|
||||
|
||||
if (i == 0) {
|
||||
print_buf[0] = '0';
|
||||
print_buf[1] = '\0';
|
||||
return prints (out, print_buf, width, pad);
|
||||
}
|
||||
|
||||
if (sg && b == 10 && i < 0) {
|
||||
neg = 1;
|
||||
u = (unsigned int)-i;
|
||||
}
|
||||
|
||||
s = print_buf + PRINT_BUF_LEN-1;
|
||||
*s = '\0';
|
||||
|
||||
while (u) {
|
||||
t = (int)u % b;
|
||||
if( t >= 10 )
|
||||
t += letbase - '0' - 10;
|
||||
*--s = (char)(t + '0');
|
||||
u /= b;
|
||||
}
|
||||
|
||||
if (neg) {
|
||||
if( width && (pad & PAD_ZERO) ) {
|
||||
printchar (out, '-');
|
||||
++pc;
|
||||
--width;
|
||||
}
|
||||
else {
|
||||
*--s = '-';
|
||||
}
|
||||
}
|
||||
|
||||
return pc + prints (out, s, width, pad);
|
||||
}
|
||||
|
||||
static int print( char **out, const char *format, va_list args )
|
||||
{
|
||||
register int width, pad;
|
||||
register int pc = 0;
|
||||
char scr[2];
|
||||
|
||||
for (; *format != 0; ++format) {
|
||||
if (*format == '%') {
|
||||
++format;
|
||||
width = pad = 0;
|
||||
if (*format == '\0') break;
|
||||
if (*format == '%') goto out;
|
||||
if (*format == '-') {
|
||||
++format;
|
||||
pad = PAD_RIGHT;
|
||||
}
|
||||
while (*format == '0') {
|
||||
++format;
|
||||
pad |= PAD_ZERO;
|
||||
}
|
||||
for ( ; *format >= '0' && *format <= '9'; ++format) {
|
||||
width *= 10;
|
||||
width += *format - '0';
|
||||
}
|
||||
if( *format == 's' ) {
|
||||
register char *s = (char *)va_arg( args, int );
|
||||
pc += prints (out, s?s:"(null)", width, pad);
|
||||
continue;
|
||||
}
|
||||
if( *format == 'd' ) {
|
||||
pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if( *format == 'x' ) {
|
||||
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if( *format == 'X' ) {
|
||||
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
|
||||
continue;
|
||||
}
|
||||
if( *format == 'u' ) {
|
||||
pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
|
||||
continue;
|
||||
}
|
||||
if( *format == 'c' ) {
|
||||
/* char are converted to int then pushed on the stack */
|
||||
scr[0] = (char)va_arg( args, int );
|
||||
scr[1] = '\0';
|
||||
pc += prints (out, scr, width, pad);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
out:
|
||||
printchar (out, *format);
|
||||
++pc;
|
||||
}
|
||||
}
|
||||
if (out) **out = '\0';
|
||||
va_end( args );
|
||||
return pc;
|
||||
}
|
||||
|
||||
int printf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start( args, format );
|
||||
return print( 0, format, args );
|
||||
}
|
||||
|
||||
int sprintf(char *out, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start( args, format );
|
||||
return print( &out, format, args );
|
||||
}
|
||||
|
||||
|
||||
int snprintf( char *buf, unsigned int count, const char *format, ... )
|
||||
{
|
||||
va_list args;
|
||||
|
||||
( void ) count;
|
||||
|
||||
va_start( args, format );
|
||||
return print( &buf, format, args );
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST_PRINTF
|
||||
int main(void)
|
||||
{
|
||||
char *ptr = "Hello world!";
|
||||
char *np = 0;
|
||||
int i = 5;
|
||||
unsigned int bs = sizeof(int)*8;
|
||||
int mi;
|
||||
char buf[80];
|
||||
|
||||
mi = (1 << (bs-1)) + 1;
|
||||
printf("%s\n", ptr);
|
||||
printf("printf test\n");
|
||||
printf("%s is null pointer\n", np);
|
||||
printf("%d = 5\n", i);
|
||||
printf("%d = - max int\n", mi);
|
||||
printf("char %c = 'a'\n", 'a');
|
||||
printf("hex %x = ff\n", 0xff);
|
||||
printf("hex %02x = 00\n", 0);
|
||||
printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3);
|
||||
printf("%d %s(s)%", 0, "message");
|
||||
printf("\n");
|
||||
printf("%d %s(s) with %%\n", 0, "message");
|
||||
sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf);
|
||||
sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf);
|
||||
sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf);
|
||||
sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf);
|
||||
sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf);
|
||||
sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf);
|
||||
sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf);
|
||||
sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* if you compile this file with
|
||||
* gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c
|
||||
* you will get a normal warning:
|
||||
* printf.c:214: warning: spurious trailing `%' in format
|
||||
* this line is testing an invalid % at the end of the format string.
|
||||
*
|
||||
* this should display (on 32bit int machine) :
|
||||
*
|
||||
* Hello world!
|
||||
* printf test
|
||||
* (null) is null pointer
|
||||
* 5 = 5
|
||||
* -2147483647 = - max int
|
||||
* char a = 'a'
|
||||
* hex ff = ff
|
||||
* hex 00 = 00
|
||||
* signed -3 = unsigned 4294967293 = hex fffffffd
|
||||
* 0 message(s)
|
||||
* 0 message(s) with %
|
||||
* justif: "left "
|
||||
* justif: " right"
|
||||
* 3: 0003 zero padded
|
||||
* 3: 3 left justif.
|
||||
* 3: 3 right justif.
|
||||
* -3: -003 zero padded
|
||||
* -3: -3 left justif.
|
||||
* -3: -3 right justif.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* To keep linker happy. */
|
||||
int write( int i, char* c, int n)
|
||||
{
|
||||
(void)i;
|
||||
(void)n;
|
||||
(void)c;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue