RainbowBS Manual · RainbowBS(RBS) is an open-source base library developed for embedded systems...

Post on 21-Mar-2020

5 views 0 download

Transcript of RainbowBS Manual · RainbowBS(RBS) is an open-source base library developed for embedded systems...

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

AcknowledgementandAbout

AcknowledgmentsThanksgoto:

DimitrivanHeesch,authorofDoxygen.AdamDunkels,authorofprotothreadslibraryandContikiOSkernel.NiuYuQingforlogoandsuggestions.Myfamilyforsupportingandencourage.Haroopad,awell-donemarkdowntool.Enyaforgreatvoicetolistentowhilecoding.

AboutWhatisthismanualfor

ThismanualisusedasareferencetoRainbowBS(RBS)whichisanopen-sourcebaselibrarydevelopedforembeddedsystemsespeciallywithlimitresources.

HowtogetsourcepackageRBShasbeencommittedtoGitHub.Soyoucangetthenewestsourcepackagefromhttps://github.com/jacobqwq/RainbowBS/

FutureworkThisv0.1.0isthefirstdistributedRBSversion.

AlthoughRBScanbeusedindependently,itwillalsobecomeabasicpartofRainbowSysaccordingtotheplan.

ThegoalofRainbowSysistobuildanopen-sourceflexibleandconfigurablesystemsoftwarewrittenbyClanguageforembeddedsystems,especiallylikelowcostmicro-controllerswhichhavelimitresources.RainbowSyswillconsistofCMSIS-compatibleRTOS,filesystem,GUI,comunicationstack,etc....

SoRBSisthefirstdistributedcomponentofRainbowSysandwilloffercommonsupportfortheothercomponentsofRainbowSys.

ThenextdistributedcomponentofRainbowSyswillbetheGUIcomponentnamedRainbowGX(RGX),whichisnowbeingimprovedcontinuouslytogetherwithRBS.AndyouwillseeRGXsoon.:)

RGXDeskLevelDemonstration

AuthorDesignedbyQWQcomingfromQingdao,ShandongProv,China.

Email:jacobqwq@icloud.com

Generatedby 1.8.9.1

TableofContents

WhatisRainbowBSRainbowBSFeaturesRequirementsLicenceConventions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter1Introduction

WhatisRainbowBSRainbowBS(RBS)isanopen-sourcebaselibrarydevelopedforembeddedsystemsespeciallywithlimitresources.

RBSiswrittenbyClanguageincompliancewiththeISO/IEC9899:1999standardanditisset-uptobehighlyportable.Thereforeitisindependentofhardwarearchitectureandcanbeincorporatedintolowcostmicro-controllerslike8051,AVR,PIC,ARMandetc...,justwithsmallportingcode.

ThisdocumentshowsyouhowtoconfigureanduseRBS.

FollowingdiagramshowstheRBSpositionintheentiresoftwarearchitecture:

RBSinApplication

FollowingdiagramshowstheRBSarchitecture:

RBSArchitecture

RainbowBSFeaturesHardwareFeatures

Any8/16/32bitsCPUcanuseit.OnetimerandverylittleflashandRAMneeded.

SoftwareFeaturesPortable:RBSiswrittenbyClanguage,soitisportableonanyCcompilercompatiblewiththeC99standard.Configurable:RBShasbasecomponentsandoptionaladvancedcomponentslistedbelow.

BasicType

BasicMacros

System/CPUInfo.

MemoryOperation

Conversionrelated

base base base base base

Debug DynamicMemoryManagement

ProtothreadProcessModel

OSsupport

optional optional optional optional

OSIndependence:RBScanrunwithorwithoutOSsupport.Itoffersthread-safetyfeatureforOS.PCTools:RAutoConfigforgeneratingconfigurablefilebyUI.

Requirements1. OnlyCPU,timer,RAMandflasharenecessaryinthetargetsystem.2. TheCcompilercompatiblewiththeISO/IEC9899:1999

standard(C99).

LicenceRainbowBSisanopen-sourcebaselibraryforembeddedsystems.Thisisafreesoftwareandopenedforeducation,researchandcommercialdevelopmentsunderlicensepolicyoffollowingterms.

Copyright©2015-2016QWQ(jacobqwq@icloud.com).Allrightsreserved.

Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet:

Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistofconditionsandthefollowingdisclaimer.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistofconditionsandthefollowingdisclaimerinthedocumentationand/orothermaterialsprovidedwiththedistribution.Thenameoftheauthormaynotbeusedtoendorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwrittenpermission.

THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLCOPYRIGHTHOLDERSANDCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIF

ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

ConventionsFollowingconventionsareusedinthisdocument

textusedfornormaltextitemusedforitememphasizeboldfontusedtoemphasizeprintf()usedforcodequotes

Generatedby 1.8.9.1

TableofContents

Howtoportbasiccomponents

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter2BasicComponents

Basiccomponentsconsistoftype,macros,system/CPUinformation,memoryoperationanddigitconversion.

Typedefinationreferstobasictypes

Macrosreferstobasicmacros

Systemrelatedreferstosystemreleted

CPUrelatedreferstoCPUinformation

Memoryoperationrelatedreferstomemoryoperation

Digitconversionreferstoconversionreleted

HowtoportbasiccomponentsSystem/CPUinformationneedsomemacrosdefinedinfileRainbowBSConf.h.

RBS_CFG_SYS_INFOindicatesastringwhichRBS_GetSysInfo()returns.

RBS_CFG_TICK_RATEindicatesthetimertickpersecond.

RBS_CFG_CPU_WORD_SIZEindicatessizewhichRBS_GetCPUBits()returns.

RBS_CFG_CPU_BYTE_ORDER_Lisdefinedto0or1whichRBS_IsCPULittleEndian()uses.

RBS_CFG_CPU_STACK_DOWNisdefinedto0or1whichRBS_IsStackGrowDown()uses.

Generatedby 1.8.9.1

TableofContents

ApplicationModelIntroductionApplicationModelSupportedbyRBSProtothreadProcessLocalvariablesSchedulingImplementation

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter3ApplicationModel

ApplicationModelIntroductionFromtheviewofapplicationdevelopersforanembeddedsystem,therearemainlytwowaystoconstructprogramforanapplication.

Event-Drivenapplicationmodel

Thismodelisverysuitableforsimpleapplications.Twomethodsareused,pollingorinterruptdriven.

Forpollingmethod,theprocessorcanwaitfordatareadytoprocessit,andwaitagain.Thepollingmethodworkswellforverysimpleapplications,butithasseveraldisadvantages.Forexample,whentheapplicationgetsmorecomplex,thepollingloopdesignmightgetverydifficulttomaintain.Also,itisdifficulttodefineprioritiesbetweendifferentservicesusingpollingandyoumightendupwithpoorresponsiveness,whereaperipheralrequestingservicemightneedtowaitalongtimewhiletheprocessorishandlinglessimportanttasks.Andlotsofenergyiswastedduringthepollingwhenserviceisnotrequired.

pollingmethod

Forinterruptdrivenmethod,almostallmicro-controllershavesomesortofsleepmodesupporttoreducepower,inwhichtheperipheralcanwakeuptheprocessorwhenitrequiresaservice.Interruptsfromdifferentperipheralscanbeassignedwithdifferentinterruptprioritylevelssothatthisallowsmuchbetterresponsiveness..

interruptdrivenmethod

Insomecases,theprocessingofdatafromperipheralservicescanbepartitionedintotwoparts:thefirstpartneedstobedonequickly,andthesecondpartcanbecarriedoutalittlebitlater.Insuchsituationswecanuseamixtureofinterrupt-drivenandpollingmethodstoconstructtheprogram.Whenaperipheralrequiresservice,ittriggersaninterruptrequestasinaninterrupt-drivenapplication.Oncethefirstpartoftheinterruptserviceiscarriedout,itupdatessomesoftwarevariablessothatthesecondpartoftheservicecanbeexecutedinthepolling-basedapplicationcode.

mixedpollingandinterruptdrivenmethod

Usingthisarrangement,wecanreducethedurationofhigh-priorityinterrupthandlerssothatlowerpriorityinterruptservicescangetservedquicker.Atthesametime,theprocessorcanstillentersleepmodetosavepowerwhennoservicingisneeded.

Multi-Threadedapplicationmodel

Whentheapplicationsgetmorecomplex,apollingandinterrupt-drivenprogramstructuremightnotbeabletohandletheprocessingrequirements.Forexample,sometasksthatcantakealongtimetoexecutemightneedtobeprocessedconcurrently.Thiscanbedonebydividingtheprocessor’stimeintoanumberoftimeslotsandallocatingthetimeslotstothesetasks.Whileitistechnicallypossibletocreatesuchanarrangementbymanuallypartitioningthe

tasksandbuildingasimpleschedulertohandlethis,itisoftenimpracticaltodothisinrealprojectsasitistimeconsumingandcanmaketheprogrammuchhardertomaintainanddebug.

Intheseapplications,aReal-TimeOperatingSystem(RTOS)canbeusedtohandlethetaskscheduling(Figure2.11).AnRTOSallowsmultipleprocessestobeexecutedconcurrently,bydividingtheprocessor’stimeintotimeslotsandallocatingthetimeslotstotheprocessesthatrequireservices.AtimerisneedtohandlethetimekeepingfortheRTOS,andattheendofeachtimeslot,thetimergeneratesatimerinterrupt,whichtriggersthetaskscheduleranddecidesifcontextswitchingshouldbecarriedout.Ifyes,thecurrentexecutingprocessissuspendedandtheprocessorexecutesanotherprocess.

multi-thresdedmethod

ApplicationModelSupportedbyRBSTherearethreeoptionalapplicationmodeltowriteyourapplicationcodebasedonRBS.

NormalModel

Thisisanevent-drivensystemmodelsothatanendlessloopisneededinmain().

OSModel

Thisisamulti-threadedsystemmodelsothatanOSkernelisneeded.

PrptothreadProcessModel

Thisisanevent-drivensystemwithmulti-threadedlikedblockingproperty.

Protothreadsareaextremelylightweight,stacklesstypeofthreadsthatprovidesablockingcontextontopofanevent-drivensystem,withouttheoverheadofper-threadstacks.Thepurposeofprotothreadsistoimplementsequentialflowofcontrolwithoutcomplexstatemachinesorfullmulti-threading.ProtothreadsprovidesconditionalblockinginsideCfunctions.

Theadvantageofprotothreadsoverapurelyevent-drivenapproachisthatprotothreadsprovidesasequentialcodestructurethatallowsforblockingfunctions.Inpurelyevent-drivensystems,blockingmustbeimplementedbymanuallybreakingthefunctionintotwopieces-oneforthepieceofcodebeforetheblockingcallandoneforthecodeaftertheblockingcall.Thismakesithardtousecontrolstructuressuchasif()conditionalsandwhile()loops.

Theadvantageofprotothreadsoverordinarythreadsisthataprotothreaddonotrequireaseparatestack.Inmemoryconstrained

systems,theoverheadofallocatingmultiplestackscanconsumelargeamountsoftheavailablememory.Incontrast,eachprotothreadonlyrequiresbetweentwoandtwelvebytesofstate,dependingonthearchitecture.

ProtothreadProcessTheprotothreadslibrarywaswrittenbyAdamDunkelsadam@sics.sewithsupportfromOliverSchmidtol.sc@web.de.

Protothreadsareaextremelylightweight,stacklessthreadsthatprovidesablockingcontextontopofanevent-drivensystem,withouttheoverheadofper-threadstacks.Thepurposeofprotothreadsistoimplementsequentialflowofcontrolwithoutusingcomplexstatemachinesorfullmulti-threading.ProtothreadsprovidesconditionalblockinginsideaCfunction.

Inmemoryconstrainedsystems,suchasdeeplyembeddedsystems,traditionalmulti-threadingmayhaveatoolargememoryoverhead.Intraditionalmulti-threading,eachthreadrequiresitsownstack,thattypicallyisover-provisioned.Thestacksmayuselargepartsoftheavailablememory.

Themainadvantageofprotothreadsoverordinarythreadsisthatprotothreadsareverylightweight:aprotothreaddoesnotrequireitsownstack.Rather,allprotothreadsrunonthesamestackandcontextswitchingisdonebystackrewinding.Thisisadvantageousinmemoryconstrainedsystems,whereastackforathreadmightusealargepartoftheavailablememory.Aprotothreadonlyrequiresonlytwobytesofmemoryperprotothread.Moreover,protothreadsareimplementedinpureCanddonotrequireanymachine-specificassemblercode.

AprotothreadrunswithinasingleCfunctionandcannotspanoverotherfunctions.AprotothreadmaycallnormalCfunctions,butcannotblockinsideacalledfunction.Blockinginsidenestedfunctioncallsisinsteadmadebyspawningaseparateprotothreadforeachpotentiallyblockingfunction.Theadvantageofthisapproachisthatblockingisexplicit:theprogrammerknowsexactlywhichfunctionsthatblockthatwhichfunctionstheneverblocks.

Protothreadsaresimilartoasymmetricco-routines.Themaindifferenceisthatco-routinesusesaseparatestackforeachco-routine,whereasprotothreadsarestackless.ThemostsimilarmechanismtoprotothreadsarePythongenerators.Thesearealsostacklessconstructs,buthavea

differentpurpose.ProtothreadsprovidesblockingcontextsinsideaCfunction,whereasPythongeneratorsprovidemultipleexitpointsfromageneratorfunction.

Detailreferancestoprotothreadprocessprotothreadprocess

LocalvariablesNote

Becauseprotothreadsdonotsavethestackcontextacrossablockingcall,localvariablesarenotpreservedwhentheprotothreadblocks.Thismeansthatlocalvariablesshouldbeusedwithutmostcare-ifindoubt,donotuselocalvariablesinsideaprotothread!

SchedulingAprotothreadisdrivenbyrepeatedcallstothefunctioninwhichtheprotothreadisrunning.Eachtimethefunctioniscalled,theprotothreadwillrununtilitblocksorexits.Thustheschedulingofprotothreadsisdonebytheapplicationthatusesprotothreads.

ImplementationProtothreadsareimplementedusinglocalcontinuations.Alocalcontinuationrepresentsthecurrentstateofexecutionataparticularplaceintheprogram,butdoesnotprovideanycallhistoryorlocalvariables.Alocalcontinuationcanbesetinaspecificfunctiontocapturethestateofthefunction.Afteralocalcontinuationhasbeensetcanberesumedinordertorestorethestateofthefunctionatthepointwherethelocalcontinuationwasset.

Localcontinuationscanbeimplementedinavarietyofways:

byusingmachinespecificassemblercode.byusingstandardCconstructs.byusingcompilerextensions.

Thefirstwayworksbysavingandrestoringtheprocessorstate,exceptforstackpointers,andrequiresbetween16and32bytesofmemoryperprotothread.Theexactamountofmemoryrequireddependsonthearchitecture.

ThestandardCimplementationrequiresonlytwobytesofstateperprotothreadandutilizestheCswitch()statementinanon-obviouswaythatissimilartoDuff'sdevice.Thisimplementationdoes,however,imposeaslightrestrictiontothecodethatusesprotothreadsinthatthecodecannotuseswitch()statementsitself.

CertaincompilershasCextensionsthatcanbeusedtoimplementprotothreads.GCCsupportslabelpointersthatcanbeusedforthispurpose.Withthisimplementation,protothreadsrequire4bytesofRAMperprotothread.

Generatedby 1.8.9.1

TableofContents

DMMFeaturesMemoryBlockMemoryPoolUsageConfiguration

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter4DynamicMemoryManagment

Dynamicmemorymanagementisanoptionalcomponentformemoryusage.Itoffersbothmemoryblockandmemorypoolmechanism.

DMMFeaturesmemoryblockoffersfixedsizememorymanagement.memorypooloffersvariablesizememorymanagement.bothmechanismssupportregister,byte-alignment,usagecheckandthread-safety.

MemoryBlockregistermemoryblock

DependingontheRBS_CFG_APP_MODELconfigurationwhetherornotusingOS,oneoftworegisterinterfacesshouldbeusedbeforeusingmemoryblock.

IfRBS_CFG_APP_MODELisconfiguratedtoRBS_APP_OS,thread-safetyversionshouldbeused.

hDMMRBS_DMM_RegisterBlock(char*pName,void*pDM,USIZESize,USIZEBlockSize,HMUTEXhMutex)

IfRBS_CFG_APP_MODELisconfiguratedtoothers.

hDMMRBS_DMM_RegisterBlock(char*pName,void*pDM,USIZESize,USIZEBlockSize)

allocateandfreeblock

hBLOCKRBS_DMM_AllocZeroBlock(hDMMhDmm)

hBLOCKRBS_DMM_AllocBlock(hDMMhDmm)

BOOLRBS_DMM_FreeBlock(hBLOCKhBlock)

blockusage

void*RBS_DMM_UseHBlock(hBLOCKhBlock)

BOOLRBS_DMM_UnuseHBlock(hBLOCKhBlock)

MemoryPoolregistermemorypool

DependingontheRBS_CFG_APP_MODELconfigurationwhetherornotusingOS,oneoftworegisterinterfacesshouldbeusedbeforusingmemorypool.

IfRBS_CFG_APP_MODELisconfiguratedtoRBS_APP_OS,thread-safetyversionshouldbeused.

hDMMRBS_DMM_RegisterPool(char*pName,void*pDM,USIZESize,BOOLbAntiFrag,U16HCount,HMUTEXhMutex)

IfRBS_CFG_APP_MODELisconfiguratedtoothers.

hDMMRBS_DMM_RegisterPool(char*pName,void*pDM,USIZESize,BOOLbAntiFrag,U16HCount)

allocateandfreepool

hMEMRBS_DMM_AllocZeroMem(hDMMhDmm,USIZEsize)

hMEMRBS_DMM_AllocMem(hDMMhDmm,USIZEsize)

hMEMRBS_DMM_ReallocMem(hMEMhMem,USIZEsize)

BOOLRBS_DMM_FreeMem(hMEMhMem)

poolusage

void*RBS_DMM_UseHMem(hMEMhMem)

BOOLRBS_DMM_UnuseHMem(hMEMhMem)

USIZERBS_DMM_GetHMemSize(hMEMhMem)

UsageInanembeddedsystem,therearesomememorytypeswithdifferentsizesuchasinternalSRAMintegratedinmicro-controller,externalSDRAM,SRAM,etc...andthosememorycanbebyte-addressedinthesameaddressspace.Someofthemareusedforstacks,whilesomeusedforglobaldataandsomeusedfordynamicmemoryallocation.Sothespecificusageofthosememoryaredecidedbytheapplication.

UnliketraditionalmemorymanagementlikemallocinClibrary,DMMcanmanagemorethanonecontinuousbyte-addressedmemoryfordynamicmemoryallocationandcanbesensitivetomemoryusage.

Asanexample,amicro-controllerhas8K-bytessizeinternalRAMinandexternal2M-bytesSDRAM.Youwanttouse2K-bytesinternalRAMand1M-bytesexternalSDRAMspacefordynamicmemoryallocation.Firstofall,youjustdefinetwobytearray,oneforthe2KinternalRAMandtheotherforthe1M-bytesexternalSDRAM,andtheusetheregisterinterfacetodefinethetwomemoryspace.Afterregister,youcanallocatememoryfromthembytheDMMhandlereturnedfromregister.

Allocatedmemorywillreturnamemoryhandleandthenyoucanusethememoryhandletouse,notuseorfreetheallocatedmemory.

UsingRBS_DMM_UseHBlock()orRBS_DMM_UseHMem()torefertotheallocatedmemoryspace.

UsingRBS_DMM_UnuseHBlock()orBS_DMM_UnuseHMem()tonotifytheDMMtoendthelastmemoryreferance.

UsingRBS_DMM_FreeBlock()orRBS_DMM_FreeMem()tonotifytheDMMtoreleasethememory.

RBS_DMM_UseHBloc()andBRS_DMM_UnuseHBlock()areusedinpair,whileRBS_DMM_UseHMem()andRBS_DMM_UnuseHMem()areinpair.Thereasonisthateachmemoryhandlehasareferancecounterininternal,andthecounterisincreasedby1perusageanddecreaseby1pernousage.Soifthecounterisnotinitialvalue,itwillnotbereleased

successfullybyRBS_DMM_FreeBlock()orRBS_DMM_FreeMem().Thisiscalledusagecheck.DevelopersshouldkeepinmindthataftereachreferencetotheallocatedmemorybyRBS_DMM_UseHBlock()orRBS_DMM_UseHMem(),anRBS_DMM_UnuseHBlock()orRBS_DMM_UnuseHMem()shouldbecalledandifhewantstorefertothememoryagain,thenRBS_DMM_UseHBlock()orBS_DMM_UseHMem()shouldbecalledagain.Withusagecheck,developerswillfindmemoryusageconflictsandbugsearlier.Forexample,therearetworunningtasksAandBthatbothusinganallocatedmemory.IftaskAisusingthememorywithoutcallingRBS_DMM_UnuseHBlock()orRBS_DMM_UnuseHMem()andtaskBcallRBS_DMM_FreeBlock()orRBS_DMM_FreeMem(),thenanerrorinformationwillbeprintedbydebugcomponent,tellingthatitcannotreleasememoryhandlebecauseitisusing.

RememberthatusagecheckisonlyeffectiveifRBSdebugcomponentisenabled,otherwiseusagecheckisdisabled.FollowingistheexamplecodeforDMMusage.

1 /*definearray*/

2 U8aInternalRAM[2048]

__attribute__((at(0x20000000)));//2K-bytes

internalRAMstartingfrom0x20000000

3 U8aExternalRAM[1024*1024]

__attribute__((at(0x08011000)));//1M-bytes

externalSDRAMstartingfrom0x08011000

4 /*register*/

5 hDMMhBlockDMM=RBS_DMM_RegisterBlock("Block

DMM",aInternalRAM,sizeof(aInternalRAM),60);//re

gisteramemoryblockwith60bytesperblock.

6 hDMMhPoolDMM=RBS_DMM_RegisterPool("Pool

DMM",aExternalRAM,sizeof(aExternalRAM),FALSE,20

0);//registeramemorypoolwith200handle

available.

7 /*allocate*/

8 hBLOCKhBlock=

RBS_DMM_AllocBlock(hBlockDMM);//allocatea

blockfromhBlockDMM

9 hMEMhMem=

RBS_DMM_AllocMem(hPoolDMM,200);//allocate200

bytesfromhPoolDMM

10 /*reference*/

11 void*pBlock=

RBS_DMM_UseHBlock(hBlock);//usinghBlock

12 void*pMem=RBS_DMM_UseHMem(hMem);//using

hMem

13 ...//usingmemory

14 RBS_DMM_UnuseHBlock(hBlock);//notusehBlock

15 RBS_DMM_UnuseHMem(hMem);//unusinghMem

16 /*free*/

17 RBS_DMM_FreeBlock(hBlock);//releasehBlock

18 RBS_DMM_FreeMem(hMem);//releasehMem

ConfigurationRBS_CFG_DMM_ALIGNisdefinedfordefinebyte-alignment.3means8bytes,2means4bytes,1means2bytes,0means1bytes.

Allocatedmemorystartedaddressandsizearebothalignment.SoifRBS_CFG_DMM_ALIGNis2andyouallocated25bytes,thenyouget28bytesactually.

Generatedby 1.8.9.1

TableofContents

DebugFeaturesDebugUsageHowtoconfiguredebugcomponentHowtoportdebugcomponent

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter5Debug

DebugisimportantforsoftwaredevelopmentandRBScontainsausefuldebugcomponent.Detailreferencestodebug

DebugFeaturesfouroptionaldebuglevels:none,error,warning,logoutputre-targetingthread-safetysupport

DebugUsageFourtypesdebugmacrosareavailable.

debugstatement

RBS_DEBUG_STA(sta)

RBS_DEBUG_IF(exp,sta)

RBS_DEBUG_ELSIF(sta1,exp,sta2)

RBS_DEBUG_ENDIF(sta)

debugerroroutput

RBS_DEBUG_ERROR(exp,s)

RBS_DEBUG_ERROR_FORMAT(exp,format,...)

debugwarningoutput

RBS_DEBUG_WARN(exp,s)

RBS_DEBUG_WARN_FORMAT(exp,format,...)

debuglogoutput

RBS_DEBUG_LOG(s)

RBS_DEBUG_LOG_FORMAT(format,...)

HowtoconfiguredebugcomponentTherearetwomacroconfigurationfordebugcomponent.

RBS_CFG_DEBUG_LEVEListheconfigurationfordebuglevel.YoucandefineRBS_CFG_DEBUG_LEVELfromoneofthefouroptionaldebuglevelsmacros.

RBS_DEBUG_LEVEL_NOCHECKdisablealldebugstatementandoutputRBS_DEBUG_LEVEL_ERRORSonlyenabledebugstatementanddebugerroroutputRBS_DEBUG_LEVEL_WARNINGSdebugwarningoutputplusBS_DEBUG_LEVEL_ERRORS

RBS_DEBUG_LEVEL_ALLdebuglogoutputplusBS_DEBUG_LEVEL_WARNINGS

RBS_CFG_DEBUG_BUFSIZEcofigurethedebugbuffersizeinbytes.Defaultsizeis300bytes.Oneoutputstringlengthshouldnotexceeddebugbuffersize.

HowtoportdebugcomponentDependingtodebuglevelyouconfigureRBS_CFG_DEBUG_LEVEL,differentportingfunctionsareneeded.Andyoucanre-targetingoutputbytheseportingfunctions.

RBS_DEBUG_LEVEL_ERRORSneeds:

voidPort_Printf_Error(constchar*s)fordebugerroroutput

RBS_DEBUG_LEVEL_WARNINGSneeds:

voidPort_Printf_Error(constchar*s)fordebugerroroutputvoidPort_Printf_Warn(constchar*s)fordebugwarningoutput

BS_DEBUG_LEVEL_ALLneeds:

voidPort_Printf_Error(constchar*s)fordebugerroroutputvoidPort_Printf_Warn(constchar*s)fordebugwarningoutputvoidPort_Printf_Log(constchar*s)fordebuglogoutput

IfapplicationmodelRBS_CFG_APP_MODELisconfiguredtoRBS_APP_OS,thenOSlocksuchasmutexorsemaphoreshouldusedforthread-safedebug.

Debugerroroutput(RBS_DEBUG_LEVEL_ERRORS),debugwarningoutput(RBS_DEBUG_LEVEL_WARNINGS)anddebuglog(RBS_DEBUG_LEVEL_ALL)outputusethesamelock.Andthreefollowingportingfunctionsshouldbepresent.

BOOLPort_Init(void)forcreatingdebuglockBOOLPort_GetMutex(HMUTEXhMutex)forlockdebugoutputBOOLPort_FreeMutex(HMUTEXhMutex)forunlockdebugoutput

Generatedby 1.8.9.1

TableofContents

ConfigurationclassSystemandCPUApplicationmodelDMMDebug

UsingRAutoConfig

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter6Configration

RBSconfigurationisdefinedbyfileRainbowBSConf.h.YoucanwriteormodifythisfileorusePCtoolRAutoConfig.exetogeneratethisfile.

ConfigurationclassSystemandCPU

RBS_CFG_SYS_INFO

defineastringfordescribingtheapplication.

RBS_CFG_TICK_RATE

timertickpersecond.Thevalidvalueshouldbeinrangof1to1000and1000shouldbedividedwithnoremainderbyit.

RBS_CFG_CPU_WORD_SIZE

definitionofCPUwordsize8bits/16bits/32bits.

RBS_CFG_CPU_BYTE_ORDER_L

CPUbyteorder.1meanslittle-endiaand0meansbig-endia.

RBS_CFG_CPU_STACK_DOWN

stackgrowthdirection.1meansgrowingtolowaddressand0meansgrowingtohighaddress.

ApplicationmodelRBS_CFG_APP_MODEL

oneofthreeapplicationmodelsshouldbechosen.

RBS_APP_NONEtraditionalevent-drivenmodel.RBS_APP_PTPprotothreadevent-drivenmodel.RBS_APP_OSmultitaskmodel.OSkernelneeded.

HMUTEX

typeofmutexdefinedbyOSused.ThishaseffectonlywhenRBS_CFG_APP_MODELisconfiguredtoRBS_APP_OS.

Headfilename

headfileofferedbyOSused.ThishaseffectonlywhenRBS_CFG_APP_MODELisconfiguredtoRBS_APP_OS.

RBS_CFG_PTP_NO_PROCESS_NAME

processname.1meansdisabled,0meansenabled.ThishaseffectonlywhenRBS_CFG_APP_MODELisconfiguredtoRBS_APP_PTP.

RBS_CFG_PTP_PROCESS_STATS

usedtostatisticsforeventsused.1meansenabled,0meansdisabled.ThishaseffectonlywhenRBS_CFG_APP_MODELisconfiguredtoRBS_APP_PTP.

RBS_CFG_PTP_NUMEVENTS

eventcount.ThishaseffectonlywhenRBS_CFG_APP_MODELisconfiguredtoRBS_APP_PTP.

DMMRBS_CFG_DMM_ALIGN

definethealignmentbytesformemoryaddressandsize.3means8bytes,2means4bytes,1means2bytes,0means1byte.

DebugRBS_CFG_DEBUG_LEVEL

debugoutputlevel.oneoffourshouldbechosen.

RBS_DEBUG_LEVEL_NOCHECKdisabledebugoutput.norunningtimechecksareperformed.RBS_DEBUG_LEVEL_ERRORSerrorsarerecorded.RBS_DEBUG_LEVEL_WARNINGSerrorsandwarningsarerecorded.RBS_DEBUG_LEVEL_LOGerrors,warningsandlogsarerecorded.

RBS_CFG_DEBUG_BUFSIZE

outputbufferlength.ThishaseffectonlywhenRBS_CFG_DEBUG_LEVELisnotconfiguredtoRBS_DEBUG_LEVEL_NOCHECK.

UsingRAutoConfigRAutoConfigisin"RainbowBS\RBSTools".

RainbowAutoConfig

Generatedby 1.8.9.1

TableofContents

PortedonPCPortedonCortex-M

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Chapter7PortingandExample

Currently,RBShasbeenportedonPCandARMCortex-MMCU.Alsoitcanbeportedonanyotherarchitecturebyreferencetothat.

Recommendprojectfilearchitectureasfollowing:

FileArchitecture

PortedonPCRefertotheexamplein"RainbowBS/RBSDemoProjects/X86_VS2008/RBSDemo_VS2008.sln".TherearethreeconfigurationtargetscorrespondingtothethreeRBSapplicationmodelsrespectively.

PortedonCortex-MRefertotheexamplein"RainbowBS/RBSDemoProjects/STM32F4_MDK/RBSDemo_STM32F4.uvprojx".TherearethreeconfigurationtargetscorrespondingtothethreeRBSapplicationmodelsrespectively.ThestandardoutputisdefinedtouseSWOintheexample.YoucanuseKeil-MDKDebugViewerorJLinkSWOViewer(ifJLinkisusedasadaptor)toview.

OutputinDebugViewer

OutputinJLinkSWOViewer

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Modules

Hereisalistofallmodules:[detaillevel 1 2 ]

RBSconfigration basictypes basicmacros systemreleted CPUinformation memoryoperation conversionreleted dynamicmemorymanagement protothreadprocess Eventtimers debug▼Pt Localcontinuations Protothreadsemaphores

Generatedby 1.8.9.1

Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

RBSconfigration

Macros#define RBS_CFG_SYS_INFO"RainbowSys"#define RBS_CFG_TICK_RATE100#define RBS_CFG_CPU_WORD_SIZE32/*CPUwordsize*/#define RBS_CFG_CPU_BYTE_ORDER_L1/*CPUbyteorder*/

#define RBS_CFG_CPU_STACK_DOWN1/*stackgrowthdirection*/

#define RBS_APP_NONE0#define RBS_APP_PTP1#define RBS_APP_OS2#define RBS_CFG_APP_MODELRBS_APP_PTP#define RBS_CFG_PTP_NO_PROCESS_NAME0#define RBS_CFG_PTP_PROCESS_STATS0#define RBS_CFG_PTP_NUMEVENTS32#define RBS_CFG_DMM_ALIGN2

#define RBS_DEBUG_LEVEL_NOCHECK0/*Norunningtimechecksareperformed*/#define RBS_DEBUG_LEVEL_ERRORS1/*Errorsarerecorded*/

#define RBS_DEBUG_LEVEL_WARNINGS2/*ErrorsandWarningsarerecorded*/

#define RBS_DEBUG_LEVEL_LOG3/*Errors,Warningsandlogsarerecorded*/

#define RBS_CFG_DEBUG_BUFSIZE300#define RBS_CFG_DEBUG_LEVELRBS_DEBUG_LEVEL_LOG

DetailedDescription

Generatedby 1.8.9.1

Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

basictypes

Typedefstypedefuint8_t BOOL

typedefint8_t I8

typedefuint8_t U8

typedefint16_t I16

typedefuint16_t U16typedefint32_t I32

typedefuint32_t U32typedefint64_t I64

typedefuint64_t U64

typedefsize_t USIZEtypedefptrdiff_t IPTRDIFF

typedefU64 TICK

DetailedDescription

basictypesdefination.

Generatedby 1.8.9.1

Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

basicmacros

Macros#define FALSE0u#define TRUE1u#define USE_PARA(para)(para=(para))#define MIN(v0,v1)(((v0)>(v1))?(v1):(v0))#define MAX(v0,v1)(((v0)>(v1))?(v0):(v1))#define ABS(v)(((v)>=0)?(v):(-(v)))#define SWAP(a,b)(a=(a)+(b),b=(a)-(b),a=(a)-(b))#define COUNT_OF(a)(sizeof(a)/sizeof(a[0]))#define _STR(a)#a#define STR(a)_STR(a)#define _CONS(a,b)a##b#define CONS(a,b)_CONS(a,b)

#define ALIGN_F(pointer,power2)(((IPTRDIFF)(pointer)+((IPTRDIFF)((power2)-1)))&(~((IPTRDIFF)((power2)-1))))

#define ALIGN_B(pointer,power2)((IPTRDIFF)(pointer)&(~((IPTRDIFF)((power2)-1))))

DetailedDescription

basicmacrosdefination.

Generatedby 1.8.9.1

DataStructures|Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

systemreleted

DataStructuresstruct tTime Timestructure.More...

FunctionsBOOL RBS_Init(void) InitializeRainbowBS.More...

systeminformationconstchar* RBS_GetVersionString(void) GetRainbowBSversionstring.More...constchar* RBS_GetSysInfo(void) Getsystemdescriptionstring.More...

timereleatedTICK RBS_GetTickCount(void)

Getsystemtick.More...

U64 RBS_GetRunTime(void) Getsystemrunningtime(ms).More...

void RBS_GetLocalTime(tTime*ptTime) Getsystemlocaltime.More...

void RBS_Delay(U32milliseconds) Delaysomemilliseconds.More...#define RBS_TICK_MS(1000u/RBS_CFG_TICK_RATE)

DetailedDescription

Implementationofsystemreleted.

FunctionDocumentation

voidRBS_Delay ( U32 milliseconds )

Parameters[in]millisecondsmillisecondcount.

Hereisthecallgraphforthisfunction:

voidRBS_GetLocalTime ( tTime* ptTime )

Parameters[out] ptTime localtimepointer.

SeealsoRBS_GetRunTime()

Hereisthecallgraphforthisfunction:

U64RBS_GetRunTime ( void )

Returnssystemrunningtimeinmillisecond.

SeealsoRBS_GetLocalTime()

Hereisthecallgraphforthisfunction:

constchar*RBS_GetSysInfo ( void )

Returnssystemdescriptionstring.

SeealsoRBS_GetVersionString()

TICKRBS_GetTickCount ( void )

Returnssystemtick.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

constchar*RBS_GetVersionString ( void )

Returnsversionstring.

SeealsoRBS_GetSysInfo()

BOOLRBS_Init ( void )

ReturnvaluesTRUE successfully.

FALSE failed.

Hereisthecallgraphforthisfunction:

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

tTimeStructReferencesystemreleted

Timestructure.

#include<RainbowBS.h>

CollaborationdiagramfortTime:

DataFieldsU16 yearU8 month

U8 day

U8 day_of_week

U8 hour

U8 minute

U8 second

U16 milliseconds

FieldDocumentation

U8day

dayofmonth[1,31]

U8day_of_week

dayofweek[0,6]

U8hour

hour[0,23]

U16milliseconds

milliseconds[0,999]

U8minute

minute[0,59]

U8month

month[1,12]

U8second

second[0,59]

U16year

year[1601,30827]

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

RainbowBS.h

Generatedby 1.8.9.1

Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

CPUinformation

FunctionsU8 RBS_GetCPUBits(void)

CPUword-width.More...BOOL RBS_IsCPULittleEndian(void) CheckifCPUislittle-endian.More...BOOL RBS_IsStackGrowDown(void) Checkifstackgrowsdown.More...

DetailedDescription

InformationaboutCPU.

FunctionDocumentation

U8RBS_GetCPUBits ( void )

ReturnsCPUword-width(8/16/32/64).

BOOLRBS_IsCPULittleEndian ( void )

ReturnvaluesTRUE little-endian.FALSE big-endian.

BOOLRBS_IsStackGrowDown ( void )

ReturnvaluesTRUE growthdown.FALSE growthup.

Generatedby 1.8.9.1

Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

memoryoperation

Functionsvoid RBS_MemSet8(U8*pDes,U8fill,USIZEnum) Setmemorybybyteunit.More...void RBS_MemSet16(U16*pDes,U16fill,USIZEnum) Setmemorybytwo-bytesunit.More...void RBS_MemSet32(U32*pDes,U32fill,USIZEnum) Setmemorybyfour-bytesunit.More...void RBS_MemCpy8(U8*pDes,constU8*pSrc,USIZEnum) Copymemorybybyteunit.More...U16 RBS_Read16L(constU8**ppData) Reada16-bitsentityinlittle-endian.More...U32 RBS_Read32L(constU8**ppData) Reada32-bitsentityinlittle-endian.More...void RBS_Write16L(U8**ppData,U16data) Writea16-bitsentityinlittle-endian.More...void RBS_Write32L(U8**ppData,U32data) Writea32-bitsentityinlittle-endian.More...U16 RBS_Read16B(constU8**ppData) Reada16-bitsentityinbig-endian.More...U32 RBS_Read32B(constU8**ppData) Reada32-bitsentityinbig-endian.More...void RBS_Write16B(U8**ppData,U16data) Writea16-bitsentityinbig-endian.More...

void RBS_Write32B(U8**ppData,U32data) Writea32-bitsentityinbig-endian.More...

DetailedDescription

Memorysetandcopyoperation.

FunctionDocumentation

voidRBS_MemCpy8 ( U8* pDes,constU8* pSrc,USIZE num)

Parameters[out] pDes destinationpointer.[in] pSrc sourcepointer.[in] num totalunits.

Hereisthecallergraphforthisfunction:

voidRBS_MemSet16 ( U16* pDes,U16 fill,USIZE num)

Parameters[out] pDes destinationpointer(two-bytesalignment).[in] fill two-bytesfilled.[in] num totalunits.

voidRBS_MemSet32 ( U32* pDes,U32 fill,USIZE num)

Parameters[out] pDes destinationpointer(four-bytesalignment).[in] fill four-bytesfilled.[in] num totalunits.

voidRBS_MemSet8 ( U8* pDes,U8 fill,USIZE num)

Parameters[out] pDes destinationpointer.[in] fill bytefilled.[in] num totalunits.

Hereisthecallergraphforthisfunction:

U16RBS_Read16B ( constU8** ppData )

Parameters[in,out] ppData datapointer,added2bytesaftercalling.

Returnsdataentity

U16RBS_Read16L ( constU8** ppData )

Parameters[in,out] ppData datapointer,added2bytesaftercalling.

Returnsdataentity

U32RBS_Read32B ( constU8** ppData )

Parameters[in,out] ppData datapointer,added4bytesaftercalling.

Returnsdataentity

U32RBS_Read32L ( constU8** ppData )

Parameters[in,out] ppData datapointer,added4bytesaftercalling.

Returnsdataentity

voidRBS_Write16B ( U8** ppData,U16 data)

Parameters[in,out] ppData datapointer,added2bytesaftercalling.[in] data datatobewtitten.

voidRBS_Write16L ( U8** ppData,U16 data)

Parameters[in,out] ppData datapointer,added2bytesaftercalling.

[in] data datatobewtitten.

voidRBS_Write32B ( U8** ppData,U32 data)

Parameters[in,out] ppData datapointer,added4bytesaftercalling.[in] data datatobewtitten.

voidRBS_Write32L ( U8** ppData,U32 data)

Parameters[in,out] ppData datapointer,added4bytesaftercalling.[in] data datatobewtitten.

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

conversionreleted

convertdigittostringenum ePOW{SHEX,SBINARY,SDECIMAL} Specifichex,binaryordecimal.More...

U8 RBS_Number2String(U32value,ePOWePow,U8length,char*pText)

ConvertunsigneddigittoASCIIstring.More...

trigonometricreletedint RBS_sin(intangle)

Calculatesine.More...

int RBS_cos(intangle) Calculatecosine.More...

int RBS_tan(intangle) Calculatetangent.More...

int RBS_ctan(intangle) Calculatecotangent.More...#define ANG_45DEG1024#define ANG_90DEG(2*ANG_45DEG)#define ANG_135DEG(3*ANG_45DEG)#define ANG_180DEG(4*ANG_45DEG)#define ANG_225DEG(5*ANG_45DEG)#define ANG_270DEG(6*ANG_45DEG)#define ANG_315DEG(7*ANG_45DEG)#define ANG_360DEG(8*ANG_45DEG)

DetailedDescription

EnumerationTypeDocumentation

enumePOW

Enumerator

SHEX hexSBINARY binarySDECIMAL decimal

FunctionDocumentation

intRBS_cos ( int angle )

Thisfunctioncalculatescosinewithoutusingfloat-pointnumbers.Ituseaconstanttabletolookupfortheappropriatevalue.

Parameters[in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.

Returnscos(degrees)*1024.

intRBS_ctan ( int angle )

Thisfunctioncalculatescotangentwithoutusingfloat-pointnumbers.Ituseaconstanttabletolookupfortheappropriatevalue.

Parameters[in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.

Returnscotan(degrees)*1024.

U8RBS_Number2String ( U32 value,ePOW ePow,U8 length,char* pText)

Parameters[in] value unsigneddigit.

[in] ePow choosehex,binaryordecimal.[in] lengthMax.bitsfromlowestbit.IfLenis0,choosing

Min.charactersautomatically.[out] pText outputstringbuffer.

Returnscharacternumber.

SeealsoePOW

intRBS_sin ( int angle )

Thisfunctioncalculatessinewithoutusingfloat-pointnumbers.Ituseaconstanttabletolookupfortheapproximatevalue.

Parameters[in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.

Returnssin(degrees)*1024.

Example:

1 //calculatesineof30degrees,thereturnvalueis

511which

2 //isapproximatelyequaltosin30*1024whichis512.

3 intvalue=RBS_sin(30*ANG_45DEG/45);

intRBS_tan ( int angle )

Thisfunctioncalculatestangentwithoutusingfloat-pointnumbers.Ituseaconstanttabletolookupfortheappropriatevalue.

Parameters[in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.

Returnstan(degrees)*1024.

Generatedby 1.8.9.1

Macros|Typedefs|Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

dynamicmemorymanagement

Macros#define HDMM_NULLNULL#define HBLOCK_NULLNULL#define HMEM_NULLNULL

Typedefstypedefvoid* hDMMtypedefvoid* hBLOCKtypedefvoid* hMEM

Functions

hDMM RBS_DMM_RegisterBlock(char*pName,void*pDM,USIZEsize,USIZEblock_size,HMUTEXhMutex)

Registerthememoryareaasadynamicblockmemoryarea.More...

hBLOCK RBS_DMM_AllocZeroBlock(hDMMhDmm) Allocateafreeblockwithzeroinitializationfromthedynamic

blockmemoryarea.More...hBLOCK RBS_DMM_AllocBlock(hDMMhDmm) Allocateafreeblockfromthedynamicblockmemoryarea.

More...

BOOL RBS_DMM_FreeBlock(hBLOCKhBlock) Freetheallocatedblock.More...

void* RBS_DMM_UseHBlock(hBLOCKhBlock) Gettheallocatedblockpointer.More...

BOOL RBS_DMM_UnuseHBlock(hBLOCKhBlock) Unusetheallocatedblockarea.More...

hDMM RBS_DMM_RegisterPool(char*pName,void*pDM,USIZEsize,BOOLbAntiFrag,U16handle_count,HMUTEXhMutex)

Registerthememoryareaasadynamicpoolmemoryarea.More...

hMEM RBS_DMM_AllocZeroMem(hDMMhDmm,USIZEsize)

Allocateafreememorywithzeroinitializationfromthedynamicmemoryarea.More...

hMEM RBS_DMM_AllocMem(hDMMhDmm,USIZEsize)

Allocateafreememoryfromthedynamicmemoryarea.More...

hMEM RBS_DMM_ReallocMem(hMEMhMem,USIZEsize)

Reallocateafreememoryfromthesamedynamicmemoryarea.More...

BOOL RBS_DMM_FreeMem(hMEMhMem)

Freetheallocatedmemory.More...

void* RBS_DMM_UseHMem(hMEMhMem) Gettheallocatedmemorypointer.More...

BOOL RBS_DMM_UnuseHMem(hMEMhMem) Unusetheallocatedmemoryarea.More...

USIZE RBS_DMM_GetHMemSize(hMEMhMem) Gettheallocatedmemorysize.More...

DetailedDescription

Dynamicmemorymanagementforbothmemorypollandblock.

FunctionDocumentation

hBLOCKRBS_DMM_AllocBlock ( hDMM hDmm )

Parameters[in] hDmm handleofdynamicblockmemoryarea.

ReturnvaluesHBLOCK_NULL failed.others handleofdynamicmemoryarea.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

hMEMRBS_DMM_AllocMem ( hDMM hDmm,USIZE size)

Parameters[in] hDmm handleofdynamicmemoryarea.[in] size memoryareabytes.

ReturnvaluesHMEM_NULL failed.others handleofdynamicmemoryarea.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

hBLOCKRBS_DMM_AllocZeroBlock ( hDMM hDmm )

Parameters[in] hDmm handleofdynamicblockmemoryarea.

ReturnvaluesHBLOCK_NULL failed.others handleofdynamicmemoryarea.

Hereisthecallgraphforthisfunction:

hMEMRBS_DMM_AllocZeroMem ( hDMM hDmm,USIZE size)

Parameters[in] hDmm handleofdynamicmemoryarea.[in] size memoryareabytes.

ReturnvaluesHMEM_NULL failed.others handleofdynamicmemoryarea.

Hereisthecallgraphforthisfunction:

BOOLRBS_DMM_FreeBlock ( hBLOCK hBlock )

Parameters[in] hBlock handleofaallocatedblock.

ReturnvaluesTRUE successful.FALSE failed.

Hereisthecallgraphforthisfunction:

BOOLRBS_DMM_FreeMem ( hMEM hMem )

Parameters[in] hMem handleofaallocatedmemory.

Returnvalues

TRUE successful.FALSE failed.

Hereisthecallgraphforthisfunction:

USIZERBS_DMM_GetHMemSize ( hMEM hMem )

Parameters[in] hMem handleoftheallocatedmemory.

Returnsmemoryareasize.

Hereisthecallgraphforthisfunction:

hMEMRBS_DMM_ReallocMem ( hMEM hMem,USIZE size)

Parameters[in] hMem handleofanallocatedmemory.[in] size memoryareabytes.

ReturnvaluesHMEM_NULL failed.others handleofdynamicmemoryarea.

Hereisthecallgraphforthisfunction:

hDMMRBS_DMM_RegisterBlock ( char* pName,void* pDM,USIZE size,USIZE block_size,HMUTEX hMutex)

Parameters[in] pName blockmemoryname.[in] pDM pointertotheblockmemoryarea.[in] size blockmemoryareasize(bytes).[in] block_size eachblocksize.[in] hMutex memoryblockmutexforthread-safe.IfNULL,no

thread-safesupport.

ReturnvaluesHDMM_NULL failed.other handleofdynamicblockmemoryarea.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

hDMMRBS_DMM_RegisterPool ( char* pName,void* pDM,USIZE size,BOOL bAntiFrag,U16 handle_count,HMUTEX hMutex)

Parameters[in] pName memorypoolname.[in] pDM pointertothememoryarea.[in] size memoryareasize(bytes).[in] bAntiFrag enabledefragmentation.[in] handle_count countofmemoryhandles.[in] hMutex memorypoolmutexforthread-safety.If

NULL,nothread-safesupport.

ReturnvaluesNot HDMM_NULLsuccessful.HDMM_NULL failed.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

BOOLRBS_DMM_UnuseHBlock ( hBLOCK hBlock )

Parameters[in] hBlock handleofaallocatedblock.

Returnsblockareapointer.

SeealsoRBS_DMM_UseHBlock()

NoteusedinpairwithRBS_DMM_UseHBlock()

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

BOOLRBS_DMM_UnuseHMem ( hMEM hMem )

Parameters[in] hMem handleofaallocatedmemory.

Returnsmemoryareapointer.

SeealsoRBS_DMM_UseHMem()

NoteusedinpairwithRBS_DMM_UseHMem()

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

void*RBS_DMM_UseHBlock ( hBLOCK hBlock )

Parameters[in] hBlock handleofaallocatedblock.

Returnsblockareapointer.

SeealsoRBS_DMM_UnuseHBlock()

NoteusedinpairwithRBS_DMM_UnuseHBlock()

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

void*RBS_DMM_UseHMem ( hMEM hMem )

Parameters[in] hMem handleofaallocatedmemory.

Returnsmemoryareapointer.

SeealsoRBS_DMM_UnuseHMem()

NoteusedinpairwithRBS_DMM_UnuseHMem()

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

Generatedby 1.8.9.1

DataStructures|Macros|Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

protothreadprocess

DataStructuresstruct process_struct Processstructure(oneprocessconsistsoneprotothread).

More...

Macros#define PROCESS_NONENULL#define PROCESS_BROADCASTNULL

TypedefstypedefU8 process_event_t

typedefvoid* process_data_t

typedefstructprocess_struct tPROCESS Processstructure(oneprocessconsists

oneprotothread).More...

predefinedeventtype#define PROCESS_EVENT_NONE0x80#define PROCESS_EVENT_INIT0x81#define PROCESS_EVENT_POLL0x82#define PROCESS_EVENT_EXIT0x83#define PROCESS_EVENT_SERVICE_REMOVED0x84#define PROCESS_EVENT_CONTINUE0x85#define PROCESS_EVENT_MSG0x86#define PROCESS_EVENT_EXITED0x87#define PROCESS_EVENT_TIMER0x88#define PROCESS_EVENT_COM0x89#define PROCESS_EVENT_MAX0x8a

processdeclarationanddefinition#define PROCESS_THREAD(name,ev,data) Definethebodyofaprocess.More...#define PROCESS_NAME(name)externtPROCESSname Declarethenameofaprocess.More...#define PROCESS(name,strname) Defineaprocess.More...

semaphoredeclarationanddefinition#define SEM_NAME(name)externstructpt_semsem_##name Declarethenameofasemaphore.More...#define SEM(name,count) Defineasemaphore.More...

processprotothreadfunctions#define PROCESS_BEGIN() Definethebeginningofaprocess.More...#define PROCESS_END() Definetheendofaprocess.More...#define PROCESS_WAIT_EVENT() Waitforaneventtobepostedtotheprocess.More...#define PROCESS_WAIT_EVENT_UNTIL(c) Waitforaneventtobepostedtotheprocess,withanextra

condition.More...#define PROCESS_YIELD() Yieldthecurrentlyrunningprocess.#define PROCESS_YIELD_UNTIL(c) Yieldthecurrentlyrunningprocessuntilaconditionoccurs.

More...#define PROCESS_WAIT_UNTIL(c) Waitforaconditiontooccur.More...#define PROCESS_WAIT_WHILE(c) Waitforaconditionnotoccur.More...#define PROCESS_EXIT() Exitthecurrentlyrunningprocess.#define PROCESS_PT_SPAWN(pt,thread) Spawnaprotothreadfromtheprocess.More...#define PROCESS_PAUSE()

Yieldtheprocessforashortwhile.More...#define PROCESS_WAIT_SEM(name)#define PROCESS_SIGNAL_SEM(name)

pollandexithandlers

#define PROCESS_POLLHANDLER(handler)if(ev==PROCESS_EVENT_POLL){handler;} Specifyanactionwhenaprocessispolled.More...

#define PROCESS_EXITHANDLER(handler)if(ev==PROCESS_EVENT_EXIT){handler;} Specifyanactionwhenaprocessexits.More...

processfunctionscalledfromapplicationprogramstPROCESS* process_current

BOOL process_start(tPROCESS*ptProcess,process_data_targ) Startaprocess.More...

BOOL process_post(tPROCESS*ptProcess,process_event_tev,void*data)

Postanasynchronouseventtooneorallprocesses.More...

void process_send(tPROCESS*ptProcess,process_event_tev,void*data) Sendasynchronouseventtoaprocess.More...

void process_exit(tPROCESS*ptProcess) Causeaprocesstoexit.More...process_event_t process_alloc_event(void) Allocateaglobaleventnumber.More...

#define PROCESS_CURRENT()process_current Getapointertothecurrentlyrunningprocess.More...

#definePROCESS_CONTEXT_BEGIN(ptProcess){tPROCESS*tmp_current=PROCESS_CURRENT();process_current=ptProcess

Switchcontexttoanotherprocess.More...

#define PROCESS_CONTEXT_END(ptProcess)process_current=tmp_current;} Endacontextswitch.More...

processfunctionscalledfromdevicedrivers.BOOL process_poll(tPROCESS*ptProcess) Requestaprocesstobepolled.More...

functionscalledbythesystemandboot-upcodeU16 process_run(void)

Runthesystemonce-callpollhandlersandprocessoneevent.More...

BOOL process_is_running(tPROCESS*ptProcess) Checkifaprocessisrunning.More...

U16 process_nevents(void) Numberofeventswaitingtobeprocessed.More...

DetailedDescription

Aprocessinconsistsofasingleprotothread.

MacroDefinitionDocumentation

#definePROCESS ( name, strname)

Thismacrodefinesaprocess.Theprocesshastwonames:thevariableoftheprocessstructure,whichisusedbytheCprogram,andahumanreadablestringname,whichisusedwhendebugging.AconfigurationoptionallowsremovalofthereadablenametosaveRAM.

Parameters[in] name Thevariablenameoftheprocessstructure.[in] strname Thestringrepresentationoftheprocess'name.

Notedefinitionmustbeglobal.

#definePROCESS_BEGIN ( )

Thismacrodefinesthebeginningofaprocess,andmustalwaysappearinaPROCESS_THREAD()definition.ThePROCESS_END()macromustcomeattheendoftheprocess.

#definePROCESS_CONTEXT_BEGIN ( ptProcess )

{tPROCESS*tmp_current=PROCESS_CURRENT();process_current=ptProcess

Thisfunctionswitchcontexttothespecifiedprocessandexecutesthecodeasifrunbythatprocess.Typicaluseofthisfunctionistoswitchcontextinservices,calledbyotherprocesses.EachPROCESS_CONTEXT_BEGIN()mustbefollowedbythe

PROCESS_CONTEXT_END()macrotoendthecontextswitch.

Parameters[in] ptProcess Theprocesstouseascontext

SeealsoPROCESS_CONTEXT_END()PROCESS_CURRENT()

Example:

1 PROCESS_CONTEXT_BEGIN(&test_process);

2 etimer_set(&timer,CLOCK_SECOND);

3 PROCESS_CONTEXT_END(&test_process);

#definePROCESS_CONTEXT_END ( ptProcess )

process_current=tmp_current;}

Thisfunctionendsacontextswitchandchangesbacktothepreviousprocess.

Parameters[in] ptProcess Theprocessusedinthecontextswitch

SeealsoPROCESS_CONTEXT_START()

#definePROCESS_CURRENT ( ) process_current

Thismacrogetapointertothecurrentlyrunningprocess.Typically,thismacroisusedtopostaneventtothecurrentprocesswithprocess_post().

#definePROCESS_END ( )

Thismacrodefinestheendofaprocess.Itmustappearina

PROCESS_THREAD()definitionandmustalwaysbeincluded.TheprocessexitswhenthePROCESS_END()macroisreached.

#definePROCESS_EXITHANDLER ( handler )

if(ev==PROCESS_EVENT_EXIT){handler;}

NoteThisdeclarationmustcomeimmediatelybeforethePROCESS_BEGIN()macro.

Parametershandler Theactiontobeperformed.

#definePROCESS_NAME ( name ) externtPROCESSname

ThismacroistypicallyusedinheaderfilestodeclarethenameofaprocessthatisimplementedintheCfile.

#definePROCESS_PAUSE ( )

Thismacroyieldsthecurrentlyrunningprocessforashortwhile,thuslettingotherprocessesrunbeforetheprocesscontinues.

#definePROCESS_POLLHANDLER ( handler )

if(ev==PROCESS_EVENT_POLL){handler;}

NoteThisdeclarationmustcomeimmediatelybeforethePROCESS_BEGIN()macro.

Parametershandler Theactiontobeperformed.

#definePROCESS_PT_SPAWN ( pt, thread)

Parameterspt[inout] Theprotothreadstate(structpt)forthenew

protothreadthread[in] Thecalltotheprotothreadfunction.

SeealsoPT_SPAWN()

#definePROCESS_SIGNAL_SEM ( name )

Signalasemaphore

Thismacrocarriesoutthe"signal"operationonthesemaphore.

Parameters[in] name semaphorename

NoteIt'stheapplication'sresponsibilitytonotifythewaitingprocessifsemaphoreisavilable.

SeealsoPROCESS_WAIT_SEM()

#definePROCESS_THREAD ( name, ev, data)

Thismacroisusedtodefinethebody(protothread)ofaprocess.The

processiscalledwheneveraneventoccursinthesystem,AprocessalwaysstartwiththePROCESS_BEGIN()macroandendwiththePROCESS_END()macro.

#definePROCESS_WAIT_EVENT ( )

Thismacroblocksthecurrentlyrunningprocessuntiltheprocessreceivesanevent.

#definePROCESS_WAIT_EVENT_UNTIL ( c )

ThismacroissimilartoPROCESS_WAIT_EVENT()inthatitblocksthecurrentlyrunningprocessuntiltheprocessreceivesanevent.ButPROCESS_WAIT_EVENT_UNTIL()takesanextraconditionwhichmustbetruefortheprocesstocontinue.

Parameters[in] c Theconditionthatmustbetruefortheprocessto

continue.

SeealsoPT_WAIT_UNTIL()

#definePROCESS_WAIT_SEM ( name )

Waitforasemaphore

Thismacrocarriesoutthe"wait"operationonthesemaphore.

Parameters[in] name semaphorename

NoteIt'stheapplication'sresponsibilitytonotifythewaitingprocessifsemaphoreisavilable.

SeealsoPROCESS_SIGNAL_SEM()

#definePROCESS_WAIT_UNTIL ( c )

Thismacrodoesnotguaranteethattheprocessyields,andshouldthereforebeusedwithcare.Inmostcases,PROCESS_WAIT_EVENT(),PROCESS_WAIT_EVENT_UNTIL(),PROCESS_YIELD()orPROCESS_YIELD_UNTIL()shouldbeusedinstead.

Parameters[in] c Theconditionthatmustbetruefortheprocessto

continue

#definePROCESS_WAIT_WHILE ( c )

Thismacrodoesnotguaranteethattheprocessyields,andshouldthereforebeusedwithcare.Inmostcases,PROCESS_WAIT_EVENT(),PROCESS_WAIT_EVENT_UNTIL(),PROCESS_YIELD()orPROCESS_YIELD_UNTIL()shouldbeusedinstead.

Parameters[in] c Theconditionthatmustbefalsefortheprocessto

continue.

#definePROCESS_YIELD_UNTIL ( c )

ThismacroisdifferentfromPROCESS_WAIT_UNTIL()inthatPROCESS_YIELD_UNTIL()isguaranteedtoalwaysyieldatleastonce.ThisensuresthattheprocessdoesnotendupinaninfiniteloopandmonopolizingtheCPU.

Parameters

[in] c Theconditiontowaitfor.

#defineSEM ( name, count)

Parametersname Thevariablenameofthesemaphorestructure.count Thecountvalueofthesemaphore.

Notedefinitionmustbeglobal.

#defineSEM_NAME ( name ) externstructpt_semsem_##name

ThismacroistypicallyusedinheaderfilestodeclarethenameofasemaphorethatisimplementedintheCfile.

TypedefDocumentation

typedefstructprocess_structtPROCESS

Noteapplicationcodeshouldnotchangeanymemberoftheprocessstructurefortheyaremaintainedbysysteminside.

FunctionDocumentation

process_event_tprocess_alloc_event ( void )

eventnumbersabove128areglobalandmaybepostedfromoneprocesstoanother.Thisfunctionallocatesonesucheventnumber.

NoteTherecurrentlyisnowaytodeallocateanallocatedeventnumber.

ReturnsTheallocatedeventnumber

voidprocess_exit ( tPROCESS* ptProcess )

Thisfunctioncausesaprocesstoexit.Theprocesscaneitherbethecurrentlyexecutingprocess,oranotherprocessthatiscurrentlyrunning.

Parameters[in,out] ptProcess Theprocessthatistobeexited

SeealsoPROCESS_CURRENT()

BOOLprocess_is_running ( tPROCESS* ptProcess )

Thisfunctionchecksifaspecificprocessisrunning.Aprocesscanbeonrunningstateaftercallingprocess_start()normally.

Parameters[in] ptProcess Theprocesspointer.

ReturnvaluesTRUE iftheprocessisrunning.FALSE iftheprocessisnotrunning.

Hereisthecallergraphforthisfunction:

U16process_nevents ( void )

ReturnsNumberofeventsthatarecurrentlywaitingtobeprocessed.

BOOLprocess_poll ( tPROCESS* ptProcess )

Thisfunctiontypicallyiscalledfromaninterrupthandlertocauseaprocesstobepolled.

Parameters[in,out] ptProcess Apointertotheprocess'processstructure.

ReturnvaluesTRUE pollsuccessfully.FALSE iftheprocessisnotrunning.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

BOOLprocess_post ( tPROCESS* ptProcess,process_event_t ev,void* data

)

Thisfunctionpostsanasynchronouseventtooneorallprocesses.Thehandingoftheeventisdeferreduntilthetargetprocessisscheduledbythekernel.Aneventcanbebroadcasttoallprocesses,inwhichcaseallprocessesinthesystemwillbescheduledtohandletheevent.

Parameters[in,out] ptProcess Theprocesstowhichtheeventshouldbe

posted,orPROCESS_BROADCASTiftheeventshouldbepostedtoallprocesses.

[in] ev Theeventtobeposted.[in,out] data Theauxiliarydatatobesentwiththeevent

ReturnvaluesTRUE Theeventcouldbeposted.FALSE Theeventqueuewasfullandtheeventcouldnotbe

posted.

Seealsoprocess_send()

U16process_run ( void )

Thisfunctionshouldbecalledrepeatedlyfromthemain()programtoactuallyrunthesystem.Itcallsthenecessarypollhandlers,andprocessesoneevent.ThefunctionreturnsthenumberofeventsthatarewaitingintheeventqueuesothatthecallermaychoosetoputtheCPUtosleepwhentherearenopendingevents.

Exampleabouthowtouseprotothreadprocessmodelforevent-drivensystem:

1 intmain(void){

2 RBS_Init();//RBSinitialization

3 process_start();//startprocess

4 ...

5 while(1){

6 do{

7 ...//dosomeoptionalusercode

8 }while(process_run()>0);

9 sleep();//gotosleep

10 }

11 }

ReturnsThenumberofeventsthatarecurrentlywaitingtobeprocessed.

voidprocess_send ( tPROCESS* ptProcess,process_event_t ev,void* data)

Thisfunctionsendsasynchronouseventtooneprocesses.Onoppositeofprocess_post(),thehandingoftheeventiscompletedimmediatelyaftercalling.

Parameters[in,out] ptProcess Apointertotheprocess'processstructure.[in] ev Theeventtobeposted.[in,out] data Apointertoadditionaldatathatisposted

togetherwiththeevent.

Seealsoprocess_post()

Hereisthecallergraphforthisfunction:

BOOLprocess_start ( tPROCESS* ptProcess,process_data_t arg

)

Parameters[in,out] ptProcess Apointertoaprocessstructure.[in] arg Anargumentpointerthatcanbepassedto

thenewprocess

ReturnvaluesTRUE successful.FALSE Trytostartaprocessthatisalreadyrunning.

Hereisthecallgraphforthisfunction:

Hereisthecallergraphforthisfunction:

Generatedby 1.8.9.1

PublicMemberFunctions|DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

process_structStructReferenceprotothreadprocess

Processstructure(oneprocessconsistsoneprotothread).More...

#include<RainbowBS.h>

Collaborationdiagramforprocess_struct:

PublicMemberFunctions PT_THREAD((*thread)(structpt*,process_event_t,process_data_t))

DataFieldsstructprocess_struct* next

constchar* name

structpt pt

U8 state

BOOL needspoll

DetailedDescription

Noteapplicationcodeshouldnotchangeanymemberoftheprocessstructurefortheyaremaintainedbysysteminside.

FieldDocumentation

constchar*name

processnamestring

BOOLneedspoll

indicateifaprocesshashighprivilegetobecalled,

Seealsoprocess_poll()

structprocess_struct*next

pointertothenextprocess,allprocessesareinaprocesslist

U8state

indicateprocessstate

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

RainbowBS.h

Generatedby 1.8.9.1

DataStructures|Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Eventtimers

DataStructuresstruct etime_struct Eventtimerstructure.More...

Typedefstypedefstructetime_struct tETIME Eventtimerstructure.More...

etimerfunctionscalledfromapplicationprogramsvoid etimer_set(tETIME*ptEtime,TICKinterval)

Setaneventtimer.More...

void etimer_reset(tETIME*ptEtime) Resetaneventtimerwiththesameintervalaswaspreviously

set.More...

void etimer_restart(tETIME*ptEtime) Restartaneventtimerfromthecurrentpointintime.More...

void etimer_adjust(tETIME*ptEtime,inttimediff) Adjusttheexpirationtimeforaneventtimer.More...TICK etimer_expiration_time(tETIME*ptEtime) Gettheexpirationtimefortheeventtimer.More...TICK etimer_start_time(tETIME*ptEtime) Getthestarttimefortheeventtimer.More...BOOL etimer_expired(tETIME*ptEtime) Checkifaneventtimerhasexpired.More...

void etimer_stop(tETIME*ptEtime) Stopapendingeventtimer.More...

etimerfunctionscalledfromtimerinterrupts,bythesystem

void etimer_request_poll(void) Maketheeventtimerawarethattheclockhaschanged.More...BOOL etimer_pending(void) Checkifthereareanynon-expiredeventtimers.More...

DetailedDescription

Eventtimersprovidesawaytogeneratetimedevents.Aneventtimerwillpostaneventtotheprocessthatsetthetimerwhentheeventtimerexpires.

Aneventtimerisdeclaredasastructetimerandallaccesstotheeventtimerismadebyapointertothedeclaredeventtimer.

TypedefDocumentation

typedefstructetime_structtETIME

Thisstructureisusedfordeclaringatimer.Thetimermustbesetwithetimer_set()beforeitcanbeused.

FunctionDocumentation

voidetimer_adjust ( tETIME* ptEtime,int timediff)

Thisfunctionisusedtoadjustthetimetheeventtimerwillexpire.Itcanbeusedtosynchronizeperiodictimerswithouttheneedtorestartthetimerorchangethetimerinterval.

Parameters[in,out] ptEtime Apointertotheeventtimer.[in] timediff Thetimedifferencetoadjusttheexpiration

timewith.

NoteThisfunctionshouldonlybeusedforsmalladjustments.Forlargeadjustmentsuseetimer_set()instead.Aperiodictimerwilldriftunlesstheetimer_reset()functionisused.

Seealsoetimer_set()etimer_reset()

TICKetimer_expiration_time ( tETIME* ptEtime )

Thisfunctionreturnstheexpirationtimeforaneventtimer.

Parameters[in,out] ptEtime Apointertotheeventtimer.

Returns

Theexpirationtimefortheeventtimer.

BOOLetimer_expired ( tETIME* ptEtime )

Thisfunctiontestsifaneventtimerhasexpiredandreturnstrueorfalsedependingonitsstatus.

Parameters[in] ptEtime Apointertotheeventtimer.

ReturnvaluesTRUE ifthetimerhasexpired.FALSE ifthetimerhasnotexpired.

BOOLetimer_pending ( void )

Thisfunctionchecksifthereareanyactiveeventtimersthathavenotexpired.

ReturnvaluesTRUE ifthereareactiveeventtimers.FALSE iftherearenoactivetimers.

voidetimer_request_poll ( void )

Thisfunctionisusedtoinformtheeventtimermodulethatthesystemclockhasbeenupdated.Typically,thisfunctionwouldbecalledfromthetimerinterrupthandlerwhentheclockhasticked.

Hereisthecallgraphforthisfunction:

voidetimer_reset ( tETIME* ptEtime )

Thisfunctionresetstheeventtimerwiththesameintervalthatwasgiventotheeventtimerwiththeetimer_set()function.Thestartpointoftheintervalistheexacttimethattheeventtimerlastexpired.Therefore,thisfunctionwillcausethetimertobestableovertime,unliketheetimer_restart()function.

Parameters[in,out] ptEtime Apointertotheeventtimer.

Seealsoetimer_restart()

voidetimer_restart ( tETIME* ptEtime )

Thisfunctionrestartstheeventtimerwiththesameintervalthatwasgiventotheetimer_set()function.Theeventtimerwillstartatthecurrenttime.

Parameters[in,out] ptEtime Apointertotheeventtimer.

NoteAperiodictimerwilldriftifthisfunctionisusedtoresetit.Forperiodictimers,usetheetimer_reset()functioninstead.

Seealsoetimer_reset()

Hereisthecallgraphforthisfunction:

voidetimer_set ( tETIME* ptEtime,TICK interval)

Thisfunctionisusedtosetaneventtimerforatimesometimeinthe

future.Whentheeventtimerexpires,theeventPROCESS_EVENT_TIMERwillbepostedtotheprocessthatcalledtheetimer_set()function.

Parameters[in,out] ptEtime Apointertotheeventtimer[in] interval Theintervalbeforethetimerexpires.

Hereisthecallgraphforthisfunction:

TICKetimer_start_time ( tETIME* ptEtime )

Thisfunctionreturnsthestarttime(whenthetimerwaslastset)foraneventtimer.

Parameters[in,out] ptEtime Apointertotheeventtimer

ReturnsThestarttimefortheeventtimer.

voidetimer_stop ( tETIME* ptEtime )

Thisfunctionstopsaneventtimerthathaspreviouslybeensetwithetimer_set()oretimer_reset().Afterthisfunctionhasbeencalled,theeventtimerwillnotemitanyeventwhenitexpires.

Parameters[in,out] ptEtime Apointertothependingeventtimer.

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

etime_structStructReferenceEventtimers

Eventtimerstructure.More...

#include<RainbowBS.h>

Collaborationdiagramforetime_struct:

DataFieldsTICK start

TICK interval

structetime_struct* next

tPROCESS* p

DetailedDescription

Thisstructureisusedfordeclaringatimer.Thetimermustbesetwithetimer_set()beforeitcanbeused.

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

debug

statementmacros

statementmacrosfordebug

#define RBS_DEBUG_STA(sta)sta Cstatementstaiscompiledifenabledebug.More...#define RBS_DEBUG_IF(exp,sta)if(exp){sta Cstatementifiscompiledifenabledebug.More...

#define RBS_DEBUG_ELSIF(sta1,exp,sta2)sta1;}elseif(exp){sta2 Cstatementelseifiscompiledifenabledebug.More...#define RBS_DEBUG_ENDIF(sta)sta;} Cstatement}forifiscompiledifenabledebug.More...

errormacrofunction

errormacrosfordebugoutput

#define RBS_DEBUG_ERROR(exp,s,sta) Outputerrorinformation.More...#define RBS_DEBUG_ERROR_FORMAT(exp,format,sta,...) Outputformaterrorinformationconditionally.More...

warningmacrofunction

warningmacrosfordebugoutput

#define RBS_DEBUG_WARN(exp,s) Outputwarninginformationconditionally.More...#define RBS_DEBUG_WARN_FORMAT(exp,format,...) Outputformatwarninginformationconditionally.More...

logmacrofunction

logmacrosfordebugoutput

#define RBS_DEBUG_LOG(s) Outputformatloginformation.More...#define RBS_DEBUG_LOG_FORMAT(format,...) Outputformatloginformation.More...

DetailedDescription

usedforsystemorapplicationdebug.

MacroDefinitionDocumentation

#defineRBS_DEBUG_ELSIF ( sta1, exp, sta2) sta1;}elseif(exp){sta2

Thismacroequalstosta1;}elseif(exp){sta2

Parameterssta1Cstatement.exp Cexpression.sta2Cstatement.

NotethisshouldusedwithRBS_DEBUG_IF()andRBS_DEBUG_ENDIF().

SeealsoRBS_DEBUG_IF()RBS_DEBUG_ENDIF()

#defineRBS_DEBUG_ENDIF ( sta ) sta;}

Thismacroequalstosta1;}

ParametersstaCstatement.

NotethisshouldusedwithRBS_DEBUG_IF()andRBS_DEBUG_ELSIF().

SeealsoRBS_DEBUG_IF()

RBS_DEBUG_ELSIF()

#defineRBS_DEBUG_ERROR ( exp, s, sta)

Parameters[in] exp Clanguagelogicalexpression.[in] s informationstring.[in] sta Cstatement.

NotelengthofinformationstringshouldnotexceedRBS_CFG_DEBUG_BUFSIZE

#defineRBS_DEBUG_ERROR_FORMAT ( exp, format, sta, ...)

Parameters[in] exp Clanguagelogicalexpression.[in] format formatinformationstring.[in] sta Cstatement.[in] ... parameters.

NotelengthofinformationstringshouldnotexceedRBS_CFG_DEBUG_BUFSIZE

#defineRBS_DEBUG_IF ( exp,

sta) if(exp){sta

Thismacroequalstoif(exp){sta

Parametersexp Cexpression.sta Cstatement.

NotethisshouldusedwithRBS_DEBUG_ELSIF()andRBS_DEBUG_ENDIF().

SeealsoRBS_DEBUG_ELSIF()RBS_DEBUG_ENDIF()

#defineRBS_DEBUG_LOG ( s )

Parameters[in] s informationstring.

NotelengthofinformationstringshouldnotexceedRBS_CFG_DEBUG_BUFSIZE

#defineRBS_DEBUG_LOG_FORMAT ( format, ...)

Parameters[in] format formatinformationstring.[in] ... parameters.

Notelengthofinformationstringshouldnotexceed

RBS_CFG_DEBUG_BUFSIZE

#defineRBS_DEBUG_STA ( sta ) sta

ParametersstaCstatement

#defineRBS_DEBUG_WARN ( exp, s)

Parameters[in] exp Clanguagelogicalexpression.[in] s informationstring.

NotelengthofinformationstringshouldnotexceedRBS_CFG_DEBUG_BUFSIZE

#defineRBS_DEBUG_WARN_FORMAT ( exp, format, ...)

Parameters[in] exp Clanguagelogicalexpression.[in] format formatinformationstring.[in] ... parameters.

NotelengthofinformationstringshouldnotexceedRBS_CFG_DEBUG_BUFSIZE

Generatedby 1.8.9.1

Modules|Files|DataStructures|Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Pt

CollaborationdiagramforPt:

Modules Localcontinuations Protothreadsemaphores

Filesfile pt.h

DataStructuresstruct pt

Macros#define PT_WAITING0#define PT_YIELDED1#define PT_EXITED2#define PT_ENDED3

Initialization#define PT_INIT(pt)

Declarationanddefinition#define PT_THREAD(name_args)#define PT_BEGIN(pt)#define PT_END(pt)

Blockedwait#define PT_WAIT_UNTIL(pt,condition)#define PT_WAIT_WHILE(pt,cond)

Hierarchicalprotothreads#define PT_WAIT_THREAD(pt,thread)#define PT_SPAWN(pt,child,thread)

Exitingandrestarting#define PT_RESTART(pt)#define PT_EXIT(pt)

Callingaprotothread#define PT_SCHEDULE(f)

Yieldingfromaprotothread#define PT_YIELD(pt)#define PT_YIELD_UNTIL(pt,cond) Yieldfromtheprotothreaduntilaconditionoccurs.More...

DetailedDescription

MacroDefinitionDocumentation

#definePT_BEGIN ( pt )

DeclarethestartofaprotothreadinsidetheCfunctionimplementingtheprotothread.

Thismacroisusedtodeclarethestartingpointofaprotothread.Itshouldbeplacedatthestartofthefunctioninwhichtheprotothreadruns.AllCstatementsabovethePT_BEGIN()invokationwillbeexecutedeachtimetheprotothreadisscheduled.

Parameterspt Apointertotheprotothreadcontrolstructure.

#definePT_END ( pt )

Declaretheendofaprotothread.

Thismacroisusedfordeclaringthataprotothreadends.ItmustalwaysbeusedtogetherwithamatchingPT_BEGIN()macro.

Parameterspt Apointertotheprotothreadcontrolstructure.

#definePT_EXIT ( pt )

Exittheprotothread.

Thismacrocausestheprotothreadtoexit.Iftheprotothreadwasspawnedbyanotherprotothread,theparentprotothreadwillbecomeunblockedandcancontinuetorun.

Parameterspt Apointertotheprotothreadcontrolstructure.

#definePT_INIT ( pt )

Initializeaprotothread.

Initializesaprotothread.Initializationmustbedonepriortostartingtoexecutetheprotothread.

Parameterspt Apointertotheprotothreadcontrolstructure.

SeealsoPT_SPAWN()

#definePT_RESTART ( pt )

Restarttheprotothread.

ThismacrowillblockandcausetherunningprotothreadtorestartitsexecutionattheplaceofthePT_BEGIN()call.

Parameterspt Apointertotheprotothreadcontrolstructure.

#definePT_SCHEDULE ( f )

Scheduleaprotothread.

Thisfunctionshedulesaprotothread.Thereturnvalueofthefunctionisnon-zeroiftheprotothreadisrunningorzeroiftheprotothreadhas

exited.

Parametersf ThecalltotheCfunctionimplementingtheprotothreadtobescheduled

#definePT_SPAWN ( pt, child, thread)

Spawnachildprotothreadandwaituntilitexits.

Thismacrospawnsachildprotothreadandwaitsuntilitexits.Themacrocanonlybeusedwithinaprotothread.

Parameterspt Apointertotheprotothreadcontrolstructure.child Apointertothechildprotothread'scontrolstructure.thread Thechildprotothreadwitharguments

#definePT_THREAD ( name_args )

Declarationofaprotothread.

Thismacroisusedtodeclareaprotothread.Allprotothreadsmustbedeclaredwiththismacro.

Parametersname_args ThenameandargumentsoftheCfunction

implementingtheprotothread.

#definePT_WAIT_THREAD ( pt, thread)

Blockandwaituntilachildprotothreadcompletes.

Thismacroschedulesachildprotothread.Thecurrentprotothreadwillblockuntilthechildprotothreadcompletes.

NoteThechildprotothreadmustbemanuallyinitializedwiththePT_INIT()functionbeforethisfunctionisused.

Parameterspt Apointertotheprotothreadcontrolstructure.thread Thechildprotothreadwitharguments

SeealsoPT_SPAWN()

#definePT_WAIT_UNTIL ( pt, condition)

Blockandwaituntilconditionistrue.

Thismacroblockstheprotothreaduntilthespecifiedconditionistrue.

Parameterspt Apointertotheprotothreadcontrolstructure.condition Thecondition.

#definePT_WAIT_WHILE ( pt, cond)

Blockandwaitwhileconditionistrue.

Thisfunctionblocksandwaitswhileconditionistrue.See

PT_WAIT_UNTIL().

Parameterspt Apointertotheprotothreadcontrolstructure.cond Thecondition.

#definePT_YIELD ( pt )

Yieldfromthecurrentprotothread.

Thisfunctionwillyieldtheprotothread,therebyallowingotherprocessingtotakeplaceinthesystem.

Parameterspt Apointertotheprotothreadcontrolstructure.

#definePT_YIELD_UNTIL ( pt, cond)

Parameterspt Apointertotheprotothreadcontrolstructure.cond Thecondition.

Thisfunctionwillyieldtheprotothread,untilthe

specifiedconditionevaluatestotrue.

Generatedby 1.8.9.1

Files|Macros|Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

LocalcontinuationsPt

CollaborationdiagramforLocalcontinuations:

Filesfile lc-addrlabels.hfile lc-switch.hfile lc.h

Macros#define LC_INIT(s)s=NULL#define LC_RESUME(s)#define LC_CONCAT2(s1,s2)s1##s2#define LC_CONCAT(s1,s2)LC_CONCAT2(s1,s2)#define LC_SET(s)#define LC_END(s)#define LC_INIT(s)s=0;#define LC_RESUME(s)switch(s){case0:#define LC_SET(s)s=__LINE__;case__LINE__:#define LC_END(s)}#define __LC_H__

Typedefstypedefvoid* lc_t

typedefunsignedshort lc_t

DetailedDescription

Localcontinuationsformthebasisforimplementingprotothreads.Alocalcontinuationcanbesetinaspecificfunctiontocapturethestateofthefunction.Afteralocalcontinuationhasbeensetcanberesumedinordertorestorethestateofthefunctionatthepointwherethelocalcontinuationwasset.

MacroDefinitionDocumentation

#defineLC_RESUME ( s )

Value:do{\

if(s!=NULL){\

goto*s;\

}\

}while(0)

#defineLC_SET ( s )

Value:do{\

LC_CONCAT(LC_LABEL,__LINE__):\

(s)=&&LC_CONCAT(LC_LABEL,__LINE__);\

}while(0)

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

Macros|Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

lc-addrlabels.hFileReferencePt»Localcontinuations

Macros#define LC_INIT(s)s=NULL#define LC_RESUME(s)#define LC_CONCAT2(s1,s2)s1##s2#define LC_CONCAT(s1,s2)LC_CONCAT2(s1,s2)#define LC_SET(s)#define LC_END(s)

Typedefstypedefvoid* lc_t

DetailedDescription

Implementationoflocalcontinuationsbasedonthe"Labelsasvalues"featureofgcc

AuthorAdamDunkelsadam@sics.se

ThisimplementationoflocalcontinuationsisbasedonaspecialfeatureoftheGCCCcompilercalled"labelsasvalues".ThisfeatureallowsassigningpointerswiththeaddressofthecodecorrespondingtoaparticularClabel.

Formoreinformation,seetheGCCdocumentation:http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

Macros|Typedefs

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

lc-switch.hFileReferencePt»Localcontinuations

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

Macros#define LC_INIT(s)s=0;#define LC_RESUME(s)switch(s){case0:#define LC_SET(s)s=__LINE__;case__LINE__:#define LC_END(s)}

Typedefstypedefunsignedshort lc_t

DetailedDescription

Implementationoflocalcontinuationsbasedonswitch()statment

AuthorAdamDunkelsadam@sics.se

ThisimplementationoflocalcontinuationsusestheCswitch()statementtoresumeexecutionofafunctionsomewhereinsidethefunction'sbody.Theimplementationisbasedonthefactthatswitch()statementsareabletojumpdirectlyintothebodiesofcontrolstructuressuchasif()orwhile()statmenets.

ThisimplementationborrowsheavilyfromSimonTatham'scoroutinesimplementationinC:http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

lc.hFileReferencePt»Localcontinuations

#include"lc-switch.h"

Includedependencygraphforlc.h:

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

DetailedDescription

Localcontinuations

AuthorAdamDunkelsadam@sics.se

Generatedby 1.8.9.1

Files|DataStructures|Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ProtothreadsemaphoresPt

CollaborationdiagramforProtothreadsemaphores:

Filesfile pt-sem.h

DataStructuresstruct pt_sem

Macros#define PT_SEM_INIT(s,c)#define PT_SEM_WAIT(pt,s)#define PT_SEM_SIGNAL(pt,s)

DetailedDescription

Thismoduleimplementscountingsemaphoresontopofprotothreads.Semaphoresareasynchronizationprimitivethatprovidetwooperations:"wait"and"signal".The"wait"operationchecksthesemaphorecounterandblocksthethreadifthecounteriszero.The"signal"operationincreasesthesemaphorecounterbutdoesnotblock.Ifanotherthreadhasblockedwaitingforthesemaphorethatissignalled,theblockedthreadwillbecomerunnableagain.

Semaphorescanbeusedtoimplementother,morestructured,synchronizationprimitivessuchasmonitorsandmessagequeues/boundedbuffers(seebelow).

Thefollowingexampleshowshowtheproducer-consumerproblem,alsoknownastheboundedbufferproblem,canbesolvedusingprotothreadsandsemaphores.Notesontheprogramfollowaftertheexample.

#include"pt-sem.h"

#defineNUM_ITEMS32

#defineBUFSIZE8

staticstructpt_semmutex,full,empty;

PT_THREAD(producer(structpt*pt))

{

staticintproduced;

PT_BEGIN(pt);

for(produced=0;produced<NUM_ITEMS;++produced)

{

PT_SEM_WAIT(pt,&full);

PT_SEM_WAIT(pt,&mutex);

add_to_buffer(produce_item());

PT_SEM_SIGNAL(pt,&mutex);

PT_SEM_SIGNAL(pt,&empty);

}

PT_END(pt);

}

PT_THREAD(consumer(structpt*pt))

{

staticintconsumed;

PT_BEGIN(pt);

for(consumed=0;consumed<NUM_ITEMS;++consumed)

{

PT_SEM_WAIT(pt,&empty);

PT_SEM_WAIT(pt,&mutex);

consume_item(get_from_buffer());

PT_SEM_SIGNAL(pt,&mutex);

PT_SEM_SIGNAL(pt,&full);

}

PT_END(pt);

}

PT_THREAD(driver_thread(structpt*pt))

{

staticstructptpt_producer,pt_consumer;

PT_BEGIN(pt);

PT_SEM_INIT(&empty,0);

PT_SEM_INIT(&full,BUFSIZE);

PT_SEM_INIT(&mutex,1);

PT_INIT(&pt_producer);

PT_INIT(&pt_consumer);

PT_WAIT_THREAD(pt,producer(&pt_producer)&

consumer(&pt_consumer));

PT_END(pt);

}

Theprogramusesthreeprotothreads:oneprotothreadthatimplementstheconsumer,onethreadthatimplementstheproducer,andoneprotothreadthatdrivesthetwootherprotothreads.Theprogramusesthreesemaphores:"full","empty"and"mutex".The"mutex"semaphoreisusedtoprovidemutualexclusionforthebuffer,the"empty"semaphoreisusedtoblocktheconsumeristhebufferisempty,andthe"full"semaphoreisusedtoblocktheproduceristhebufferisfull.

The"driver_thread"holdstwoprotothreadstatevariables,"pt_producer"and"pt_consumer".Itisimportanttonotethatboththesevariablesaredeclaredasstatic.Ifthestatickeywordisnotused,bothvariablesarestoredonthestack.Sinceprotothreadsdonotstorethestack,thesevariablesmaybeoverwrittenduringaprotothreadwaitoperation.Similarly,boththe"consumer"and"producer"protothreadsdeclaretheirlocalvariablesasstatic,toavoidthembeingstoredonthestack.

MacroDefinitionDocumentation

#definePT_SEM_INIT ( s, c)

Initializeasemaphore

Thismacroinitializesasemaphorewithavalueforthecounter.Internally,thesemaphoresusean"unsignedint"torepresentthecounter,andthereforethe"count"argumentshouldbewithinrangeofanunsignedint.

Parameterss (structpt_sem*)Apointertothept_semstructrepresentingthesemaphore

c (unsignedint)Theinitialcountofthesemaphore.

#definePT_SEM_SIGNAL ( pt, s)

Signalasemaphore

Thismacrocarriesoutthe"signal"operationonthesemaphore.Thesignaloperationincrementsthecounterinsidethesemaphore,whicheventuallywillcausewaitingprotothreadstocontinueexecuting.

Parameterspt (structpt*)Apointertotheprotothread(structpt)inwhichtheoperationisexecuted.

s (structpt_sem*)Apointertothept_semstructrepresentingthesemaphore

#definePT_SEM_WAIT ( pt, s)

Waitforasemaphore

Thismacrocarriesoutthe"wait"operationonthesemaphore.Thewaitoperationcausestheprotothreadtoblockwhilethecounteriszero.Whenthecounterreachesavaluelargerthanzero,theprotothreadwillcontinue.

Parameterspt (structpt*)Apointertotheprotothread(structpt)inwhichtheoperationisexecuted.

s (structpt_sem*)Apointertothept_semstructrepresentingthesemaphore

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

DataStructures|Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

pt-sem.hFileReferencePt»Protothreadsemaphores

#include"pt.h"

Includedependencygraphforpt-sem.h:

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

DataStructuresstruct pt_sem

Macros#define PT_SEM_INIT(s,c)#define PT_SEM_WAIT(pt,s)#define PT_SEM_SIGNAL(pt,s)

DetailedDescription

Coutingsemaphoresimplementedonprotothreads

AuthorAdamDunkelsadam@sics.se

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

pt_semStructReferencePt»Protothreadsemaphores

Collaborationdiagramforpt_sem:

DataFieldsunsignedint count

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

pt-sem.h

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

DataStructures|Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

pt.hFileReferencePt

#include"lc.h"

Includedependencygraphforpt.h:

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

DataStructuresstruct pt

Macros#define PT_WAITING0#define PT_YIELDED1#define PT_EXITED2#define PT_ENDED3

Initialization#define PT_INIT(pt)

Declarationanddefinition#define PT_THREAD(name_args)#define PT_BEGIN(pt)#define PT_END(pt)

Blockedwait#define PT_WAIT_UNTIL(pt,condition)#define PT_WAIT_WHILE(pt,cond)

Hierarchicalprotothreads#define PT_WAIT_THREAD(pt,thread)#define PT_SPAWN(pt,child,thread)

Exitingandrestarting#define PT_RESTART(pt)

#define PT_EXIT(pt)

Callingaprotothread#define PT_SCHEDULE(f)

Yieldingfromaprotothread#define PT_YIELD(pt)#define PT_YIELD_UNTIL(pt,cond) Yieldfromtheprotothreaduntilaconditionoccurs.More...

DetailedDescription

Protothreadsimplementation.

AuthorAdamDunkelsadam@sics.se

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ptStructReferencePt

Collaborationdiagramforpt:

DataFieldslc_t lc

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

pt.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

DataStructures

Herearethedatastructureswithbriefdescriptions:

C etime_struct Eventtimerstructure C event_struct C MEM_struct C process_struct Processstructure(oneprocessconsistsone

protothread) C pt C pt_sem C tBLOCK C tDMMHEAD C tTime Timestructure

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

event_structStructReference

Collaborationdiagramforevent_struct:

DataFieldsprocess_event_t evprocess_data_t data

tPROCESS* p

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

process.c

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

MEM_structStructReference

CollaborationdiagramforMEM_struct:

DataFieldshDMM hDmm

U8* pData

USIZE size

structMEM_struct* pNextstructMEM_struct* pPrev

U8 lock_count

FieldDocumentation

hDMMhDmm

DMMhandle

U8lock_count

0:notallocated,1:allocated,[2,255]:beingusedlock_count-1times.

U8*pData

pointerofmemoryarea

structMEM_struct*pNext

nexthandleinlinkedlist

structMEM_struct*pPrev

prevhandleinlinkedlist

USIZEsize

usablesizeofallocatedblock

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

DMM.c

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

tBLOCKStructReference

CollaborationdiagramfortBLOCK:

DataFieldshDMM hDmm

U8* pData

U8 lock_count

FieldDocumentation

hDMMhDmm

DMMhandle

U8lock_count

0:notallocated,1:allocated,[2,255]:beingusedlock_count-1times

U8*pData

pointerofdataarea

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

DMM.c

Generatedby 1.8.9.1

DataFields

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

tDMMHEADStructReference

CollaborationdiagramfortDMMHEAD:

DataFieldseDMTYPE eType

char* pName

void* pObjectArrayStart

void* pObjectArrayLast

void* pFreeObject

USIZE free_object_count

USIZE free_bytes

U8* pDataStart

U8* pDataEnd

USIZE block_sizeHMUTEX hMutex

FieldDocumentation

USIZEblock_size

blocksizeifeTypeisDM_BLOCK

eDMTYPEeType

DMMtype

USIZEfree_bytes

countoffreebytesifeTypeisDM_POOLorDM_POOL_AUTO

USIZEfree_object_count

countoffreearray(tBLOCKortMEM)objects

HMUTEXhMutex

lock

U8*pDataEnd

pointerofdataend

U8*pDataStart

pointerofdatahead

void*pFreeObject

pointerforacceleratingallocation

char*pName

DMMname

void*pObjectArrayLast

pointerofthelastarray(tBLOCKortMEM)object

void*pObjectArrayStart

pointerofthefirstarray(tBLOCKortMEM)object

Thedocumentationforthisstructwasgeneratedfromthefollowingfile:

DMM.c

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

DataStructureIndex

E|M|P|T

M event_struct pt tDMMHEAD

p pt_sem tTimeMEM_struct te process_struct

tBLOCKetime_struct

E|M|P|T

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Hereisalistofalldocumentedstructandunionfieldswithlinkstothestruct/uniondocumentationforeachfield:

-b-

block_size:tDMMHEAD

-d-

day:tTimeday_of_week:tTime

-e-

eType:tDMMHEAD

-f-

free_bytes:tDMMHEADfree_object_count:tDMMHEAD

-h-

hDmm:MEM_struct,tBLOCKhMutex:tDMMHEADhour:tTime

-l-

lock_count:MEM_struct,tBLOCK

-m-

milliseconds:tTime

minute:tTimemonth:tTime

-n-

name:process_structneedspoll:process_structnext:process_struct

-p-

pData:MEM_struct,tBLOCKpDataEnd:tDMMHEADpDataStart:tDMMHEADpFreeObject:tDMMHEADpName:tDMMHEADpNext:MEM_structpObjectArrayLast:tDMMHEADpObjectArrayStart:tDMMHEADpPrev:MEM_struct

-s-

second:tTimesize:MEM_structstate:process_struct

-y-

year:tTime

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

-b-

block_size:tDMMHEAD

-d-

day:tTimeday_of_week:tTime

-e-

eType:tDMMHEAD

-f-

free_bytes:tDMMHEADfree_object_count:tDMMHEAD

-h-

hDmm:MEM_struct,tBLOCKhMutex:tDMMHEADhour:tTime

-l-

lock_count:MEM_struct,tBLOCK

-m-

milliseconds:tTimeminute:tTime

month:tTime

-n-

name:process_structneedspoll:process_structnext:process_struct

-p-

pData:MEM_struct,tBLOCKpDataEnd:tDMMHEADpDataStart:tDMMHEADpFreeObject:tDMMHEADpName:tDMMHEADpNext:MEM_structpObjectArrayLast:tDMMHEADpObjectArrayStart:tDMMHEADpPrev:MEM_struct

-s-

second:tTimesize:MEM_structstate:process_struct

-y-

year:tTime

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

FileList

Hereisalistofalldocumentedfileswithbriefdescriptions:

lc-addrlabels.h lc-switch.h lc.h Port.h pt-sem.h pt.h RainbowBS.h RainbowBSConf.h

Generatedby 1.8.9.1

RainbowBS RBSSource Port

Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Port.hFileReference#include"RainbowBS.h"

IncludedependencygraphforPort.h:

FunctionsBOOL Port_Init(void) Initializehardware.More...TICK Port_GetTickCount(void) Getsystemtick.More...

void Port_GetLocalTime(tTime*pTime) Getsystemlocaltime.More...

void Port_Delay(U32millisec) Delaysomemillisecond.More...

void Port_Printf_Error(constchar*s) Outputerrorinformation.More...

void Port_Printf_Warn(constchar*s) Outputwarninginformation.More...

void Port_Printf_Log(constchar*s) Outputloginformation.More...BOOL Port_GetMutex(HMUTEXhMutex) Waitforamutex.More...BOOL Port_FreeMutex(HMUTEXhMutex) Releaseamutex.More...

DetailedDescription

Implementationofporting.

AuthorQWQjacobqwq@icloud.com

FunctionDocumentation

voidPort_Delay ( U32 millisec )

Parameters[in]millisecmillisecondcount.

Hereisthecallergraphforthisfunction:

BOOLPort_FreeMutex ( HMUTEX hMutex )

Parameters[in] hMutex handleofmutex.

Hereisthecallergraphforthisfunction:

voidPort_GetLocalTime ( tTime* pTime )

Parameters[out] pTime timestructure.

Hereisthecallergraphforthisfunction:

BOOLPort_GetMutex ( HMUTEX hMutex )

Parameters[in] hMutex handleofmutex.

Hereisthecallergraphforthisfunction:

TICKPort_GetTickCount ( void )

Returnssystemtick.

Hereisthecallergraphforthisfunction:

BOOLPort_Init ( void )

ReturnvaluesTRUE successful.FALSE failed.

Hereisthecallergraphforthisfunction:

voidPort_Printf_Error ( constchar* s )

Parameters[in] s string.

voidPort_Printf_Log ( constchar* s )

Parameters[in] s string.

voidPort_Printf_Warn ( constchar* s )

Parameters[in] s string.

Generatedby 1.8.9.1

RainbowBS RBSSource

DataStructures|Macros|Typedefs|Functions

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

RainbowBS.hFileReference

#include<stddef.h>#include<windows.h>#include"RainbowBSConf.h"

#include"pt.h"

#include"pt-sem.h"

#include<stdio.h>

#include<string.h>

IncludedependencygraphforRainbowBS.h:

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

DataStructuresstruct tTime Timestructure.More...struct process_struct Processstructure(oneprocessconsistsoneprotothread).

More...struct etime_struct Eventtimerstructure.More...

Macros#define RBS_VERSION"0.1.0"#define RBS_VERNUM0x0100#define RBS_VER_MAJOR0#define RBS_VER_MINOR1#define RBS_VER_REVISION0#define RBS_VER_SUBREVISION0#define FALSE0u#define TRUE1u#define USE_PARA(para)(para=(para))#define MIN(v0,v1)(((v0)>(v1))?(v1):(v0))#define MAX(v0,v1)(((v0)>(v1))?(v0):(v1))#define ABS(v)(((v)>=0)?(v):(-(v)))#define SWAP(a,b)(a=(a)+(b),b=(a)-(b),a=(a)-(b))#define COUNT_OF(a)(sizeof(a)/sizeof(a[0]))#define _STR(a)#a#define STR(a)_STR(a)#define _CONS(a,b)a##b

#define CONS(a,b)_CONS(a,b)

#define ALIGN_F(pointer,power2)(((IPTRDIFF)(pointer)+((IPTRDIFF)((power2)-1)))&(~((IPTRDIFF)((power2)-1))))

#define ALIGN_B(pointer,power2)((IPTRDIFF)(pointer)&(~((IPTRDIFF)((power2)-1))))#define HDMM_NULLNULL#define HBLOCK_NULLNULL#define HMEM_NULLNULL#define PROCESS_NONENULL#define PROCESS_BROADCASTNULL

#define PROCESS_NAME_STRING(process)((NULL==(process))?"NoName":(process)->name)

predefinedeventtype#define PROCESS_EVENT_NONE0x80#define PROCESS_EVENT_INIT0x81#define PROCESS_EVENT_POLL0x82#define PROCESS_EVENT_EXIT0x83#define PROCESS_EVENT_SERVICE_REMOVED0x84#define PROCESS_EVENT_CONTINUE0x85#define PROCESS_EVENT_MSG0x86#define PROCESS_EVENT_EXITED0x87

#define PROCESS_EVENT_TIMER0x88#define PROCESS_EVENT_COM0x89#define PROCESS_EVENT_MAX0x8a

processdeclarationanddefinition#define PROCESS_THREAD(name,ev,data) Definethebodyofaprocess.More...#define PROCESS_NAME(name)externtPROCESSname Declarethenameofaprocess.More...#define PROCESS(name,strname) Defineaprocess.More...

semaphoredeclarationanddefinition#define SEM_NAME(name)externstructpt_semsem_##name Declarethenameofasemaphore.More...#define SEM(name,count) Defineasemaphore.More...

processprotothreadfunctions#define PROCESS_BEGIN() Definethebeginningofaprocess.More...#define PROCESS_END() Definetheendofaprocess.More...#define PROCESS_WAIT_EVENT() Waitforaneventtobepostedtotheprocess.More...

#define PROCESS_WAIT_EVENT_UNTIL(c) Waitforaneventtobepostedtotheprocess,withanextra

condition.More...#define PROCESS_YIELD() Yieldthecurrentlyrunningprocess.#define PROCESS_YIELD_UNTIL(c) Yieldthecurrentlyrunningprocessuntilaconditionoccurs.

More...#define PROCESS_WAIT_UNTIL(c) Waitforaconditiontooccur.More...#define PROCESS_WAIT_WHILE(c) Waitforaconditionnotoccur.More...#define PROCESS_EXIT() Exitthecurrentlyrunningprocess.#define PROCESS_PT_SPAWN(pt,thread) Spawnaprotothreadfromtheprocess.More...#define PROCESS_PAUSE() Yieldtheprocessforashortwhile.More...#define PROCESS_WAIT_SEM(name)#define PROCESS_SIGNAL_SEM(name)

pollandexithandlers

#define PROCESS_POLLHANDLER(handler)if(ev==PROCESS_EVENT_POLL){handler;} Specifyanactionwhenaprocessispolled.More...

#define PROCESS_EXITHANDLER(handler)if(ev==

PROCESS_EVENT_EXIT){handler;} Specifyanactionwhenaprocessexits.More...

statementmacros

statementmacrosfordebug

#define RBS_DEBUG_STA(sta)sta Cstatementstaiscompiledifenabledebug.More...#define RBS_DEBUG_IF(exp,sta)if(exp){sta Cstatementifiscompiledifenabledebug.More...

#define RBS_DEBUG_ELSIF(sta1,exp,sta2)sta1;}elseif(exp){sta2 Cstatementelseifiscompiledifenabledebug.More...#define RBS_DEBUG_ENDIF(sta)sta;} Cstatement}forifiscompiledifenabledebug.More...

errormacrofunction

errormacrosfordebugoutput

#define RBS_DEBUG_ERROR(exp,s,sta) Outputerrorinformation.More...#define RBS_DEBUG_ERROR_FORMAT(exp,format,sta,...) Outputformaterrorinformationconditionally.More...

warningmacrofunction

warningmacrosfordebugoutput

#define RBS_DEBUG_WARN(exp,s)

Outputwarninginformationconditionally.More...#define RBS_DEBUG_WARN_FORMAT(exp,format,...) Outputformatwarninginformationconditionally.More...

logmacrofunction

logmacrosfordebugoutput

#define RBS_DEBUG_LOG(s) Outputformatloginformation.More...#define RBS_DEBUG_LOG_FORMAT(format,...) Outputformatloginformation.More...

Typedefstypedefuint8_t BOOL

typedefint8_t I8

typedefuint8_t U8

typedefint16_t I16

typedefuint16_t U16

typedefint32_t I32

typedefuint32_t U32

typedefint64_t I64

typedefuint64_t U64

typedefsize_t USIZE

typedefptrdiff_t IPTRDIFF

typedefU64 TICK

typedefvoid* hDMM

typedefvoid* hBLOCK

typedefvoid* hMEM

typedefU8 process_event_t

typedefvoid* process_data_t

typedefstructprocess_struct tPROCESS Processstructure(oneprocessconsists

oneprotothread).More...

typedefstructetime_struct tETIME Eventtimerstructure.More...

FunctionsBOOL RBS_Init(void)

InitializeRainbowBS.More...

U8 RBS_GetCPUBits(void) CPUword-width.More...

BOOL RBS_IsCPULittleEndian(void) CheckifCPUislittle-endian.More...

BOOL RBS_IsStackGrowDown(void) Checkifstackgrowsdown.More...

void RBS_MemSet8(U8*pDes,U8fill,USIZEnum) Setmemorybybyteunit.More...

void RBS_MemSet16(U16*pDes,U16fill,USIZEnum) Setmemorybytwo-bytesunit.More...

void RBS_MemSet32(U32*pDes,U32fill,USIZEnum) Setmemorybyfour-bytesunit.More...

void RBS_MemCpy8(U8*pDes,constU8*pSrc,USIZEnum) Copymemorybybyteunit.More...

U16 RBS_Read16L(constU8**ppData) Reada16-bitsentityinlittle-endian.More...

U32 RBS_Read32L(constU8**ppData) Reada32-bitsentityinlittle-endian.More...

void RBS_Write16L(U8**ppData,U16data) Writea16-bitsentityinlittle-endian.More...

void RBS_Write32L(U8**ppData,U32data) Writea32-bitsentityinlittle-endian.More...

U16 RBS_Read16B(constU8**ppData) Reada16-bitsentityinbig-endian.More...

U32 RBS_Read32B(constU8**ppData) Reada32-bitsentityinbig-endian.More...

void RBS_Write16B(U8**ppData,U16data) Writea16-bitsentityinbig-endian.More...

void RBS_Write32B(U8**ppData,U32data) Writea32-bitsentityinbig-endian.More...

hDMM RBS_DMM_RegisterBlock(char*pName,void*pDM,USIZEsize,USIZEblock_size,HMUTEXhMutex)

Registerthememoryareaasadynamicblockmemoryarea.More...

hBLOCK RBS_DMM_AllocZeroBlock(hDMMhDmm)

Allocateafreeblockwithzeroinitializationfromthedynamicblockmemoryarea.More...

hBLOCK RBS_DMM_AllocBlock(hDMMhDmm)

Allocateafreeblockfromthedynamicblockmemoryarea.More...

BOOL RBS_DMM_FreeBlock(hBLOCKhBlock)

Freetheallocatedblock.More...

void* RBS_DMM_UseHBlock(hBLOCKhBlock) Gettheallocatedblockpointer.More...

BOOL RBS_DMM_UnuseHBlock(hBLOCKhBlock) Unusetheallocatedblockarea.More...

hDMMRBS_DMM_RegisterPool(char*pName,void*pDM,USIZEsize,BOOLbAntiFrag,U16handle_count,HMUTEXhMutex)

Registerthememoryareaasadynamicpoolmemoryarea.More...

hMEM RBS_DMM_AllocZeroMem(hDMMhDmm,USIZEsize)

Allocateafreememorywithzeroinitializationfromthedynamicmemoryarea.More...

hMEM RBS_DMM_AllocMem(hDMMhDmm,USIZEsize)

Allocateafreememoryfromthedynamicmemoryarea.More...

hMEM RBS_DMM_ReallocMem(hMEMhMem,USIZEsize)

Reallocateafreememoryfromthesamedynamicmemoryarea.More...

BOOL RBS_DMM_FreeMem(hMEMhMem)

Freetheallocatedmemory.More...

void* RBS_DMM_UseHMem(hMEMhMem) Gettheallocatedmemorypointer.More...

BOOL RBS_DMM_UnuseHMem(hMEMhMem) Unusetheallocatedmemoryarea.More...

USIZE RBS_DMM_GetHMemSize(hMEMhMem) Gettheallocatedmemorysize.More...

systeminformationconstchar* RBS_GetVersionString(void) GetRainbowBSversionstring.More...constchar* RBS_GetSysInfo(void)

Getsystemdescriptionstring.More...

processfunctionscalledfromdevicedrivers.BOOL process_poll(tPROCESS*ptProcess)

Requestaprocesstobepolled.More...

functionscalledbythesystemandboot-upcodeU16 process_run(void)

Runthesystemonce-callpollhandlersandprocessoneevent.More...

BOOL process_is_running(tPROCESS*ptProcess)

Checkifaprocessisrunning.More...

U16 process_nevents(void) Numberofeventswaitingtobeprocessed.More...

etimerfunctionscalledfromapplicationprogramsvoid etimer_set(tETIME*ptEtime,TICKinterval)

Setaneventtimer.More...

void etimer_reset(tETIME*ptEtime) Resetaneventtimerwiththesameintervalaswas

previouslyset.More...

void etimer_restart(tETIME*ptEtime) Restartaneventtimerfromthecurrentpointintime.

More...

void etimer_adjust(tETIME*ptEtime,inttimediff) Adjusttheexpirationtimeforaneventtimer.More...

TICK etimer_expiration_time(tETIME*ptEtime) Gettheexpirationtimefortheeventtimer.More...

TICK etimer_start_time(tETIME*ptEtime) Getthestarttimefortheeventtimer.More...

BOOL etimer_expired(tETIME*ptEtime)

Checkifaneventtimerhasexpired.More...

void etimer_stop(tETIME*ptEtime) Stopapendingeventtimer.More...

etimerfunctionscalledfromtimerinterrupts,bythesystemvoid etimer_request_poll(void)

Maketheeventtimerawarethattheclockhaschanged.More...

BOOL etimer_pending(void)

Checkifthereareanynon-expiredeventtimers.More...

timereleated#define RBS_TICK_MS(1000u/RBS_CFG_TICK_RATE)

TICK RBS_GetTickCount(void) Getsystemtick.More...

U64 RBS_GetRunTime(void) Getsystemrunningtime(ms).More...

void RBS_GetLocalTime(tTime*ptTime) Getsystemlocaltime.More...

void RBS_Delay(U32milliseconds) Delaysomemilliseconds.More...

convertdigittostringenum ePOW{SHEX,SBINARY,SDECIMAL} Specifichex,binaryordecimal.More...

U8 RBS_Number2String(U32value,ePOWePow,U8length,char*pText)

ConvertunsigneddigittoASCIIstring.More...

trigonometricreleted#define ANG_45DEG1024#define ANG_90DEG(2*ANG_45DEG)#define ANG_135DEG(3*ANG_45DEG)#define ANG_180DEG(4*ANG_45DEG)#define ANG_225DEG(5*ANG_45DEG)#define ANG_270DEG(6*ANG_45DEG)#define ANG_315DEG(7*ANG_45DEG)#define ANG_360DEG(8*ANG_45DEG)

int RBS_sin(intangle) Calculatesine.More...

int RBS_cos(intangle) Calculatecosine.More...

int RBS_tan(intangle) Calculatetangent.More...

int RBS_ctan(intangle) Calculatecotangent.More...

processfunctionscalledfromapplicationprograms#define PROCESS_CURRENT()process_current

Getapointertothecurrentlyrunningprocess.More...

#definePROCESS_CONTEXT_BEGIN(ptProcess){tPROCESS*tmp_current=PROCESS_CURRENT();process_current=ptProcess

Switchcontexttoanotherprocess.More...

#define PROCESS_CONTEXT_END(ptProcess)process_current=tmp_current;} Endacontextswitch.More...

tPROCESS* process_current

BOOL process_start(tPROCESS*ptProcess,process_data_targ) Startaprocess.More...

BOOL process_post(tPROCESS*ptProcess,process_event_tev,void*data)

Postanasynchronouseventtooneorallprocesses.More...

void process_send(tPROCESS*ptProcess,process_event_tev,void*data) Sendasynchronouseventtoaprocess.More...

void process_exit(tPROCESS*ptProcess) Causeaprocesstoexit.More...process_event_t process_alloc_event(void) Allocateaglobaleventnumber.More...

DetailedDescription

RainbowBSInterface.

AuthorQWQjacobqwq@icloud.com

Generatedby 1.8.9.1

RainbowBS RBSSource Config

Macros

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

RainbowBSConf.hFileReference

Thisgraphshowswhichfilesdirectlyorindirectlyincludethisfile:

Macros#define RBS_CFG_SYS_INFO"RainbowSys"#define RBS_CFG_TICK_RATE100#define RBS_CFG_CPU_WORD_SIZE32/*CPUwordsize*/#define RBS_CFG_CPU_BYTE_ORDER_L1/*CPUbyteorder*/

#define RBS_CFG_CPU_STACK_DOWN1/*stackgrowthdirection*/

#define RBS_APP_NONE0#define RBS_APP_PTP1#define RBS_APP_OS2#define RBS_CFG_APP_MODELRBS_APP_PTP#define RBS_CFG_PTP_NO_PROCESS_NAME0#define RBS_CFG_PTP_PROCESS_STATS0#define RBS_CFG_PTP_NUMEVENTS32#define RBS_CFG_DMM_ALIGN2

#define RBS_DEBUG_LEVEL_NOCHECK0/*Norunningtimechecksareperformed*/#define RBS_DEBUG_LEVEL_ERRORS1/*Errorsarerecorded*/

#define RBS_DEBUG_LEVEL_WARNINGS2/*ErrorsandWarningsarerecorded*/

#define RBS_DEBUG_LEVEL_LOG3/*Errors,Warningsandlogsarerecorded*/

#define RBS_CFG_DEBUG_BUFSIZE300#define RBS_CFG_DEBUG_LEVELRBS_DEBUG_LEVEL_LOG

DetailedDescription

RainbowBSConfiguration.

AuthorQWQjacobqwq@icloud.com

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

Hereisalistofalldocumentedfunctions,variables,defines,enums,andtypedefswithlinkstothedocumentation:

-e-

ePOW:RainbowBS.hetimer_adjust():RainbowBS.hetimer_expiration_time():RainbowBS.hetimer_expired():RainbowBS.hetimer_pending():RainbowBS.hetimer_request_poll():RainbowBS.hetimer_reset():RainbowBS.hetimer_restart():RainbowBS.hetimer_set():RainbowBS.hetimer_start_time():RainbowBS.hetimer_stop():RainbowBS.h

-p-

Port_Delay():Port.hPort_FreeMutex():Port.hPort_GetLocalTime():Port.hPort_GetMutex():Port.hPort_GetTickCount():Port.hPort_Init():Port.hPort_Printf_Error():Port.hPort_Printf_Log():Port.hPort_Printf_Warn():Port.hPROCESS:RainbowBS.hprocess_alloc_event():RainbowBS.hPROCESS_BEGIN:RainbowBS.hPROCESS_CONTEXT_BEGIN:RainbowBS.hPROCESS_CONTEXT_END:RainbowBS.hPROCESS_CURRENT:RainbowBS.hPROCESS_END:RainbowBS.hprocess_exit():RainbowBS.h

PROCESS_EXIT:RainbowBS.hPROCESS_EXITHANDLER:RainbowBS.hprocess_is_running():RainbowBS.hPROCESS_NAME:RainbowBS.hprocess_nevents():RainbowBS.hPROCESS_PAUSE:RainbowBS.hprocess_poll():RainbowBS.hPROCESS_POLLHANDLER:RainbowBS.hprocess_post():RainbowBS.hPROCESS_PT_SPAWN:RainbowBS.hprocess_run():RainbowBS.hprocess_send():RainbowBS.hPROCESS_SIGNAL_SEM:RainbowBS.hprocess_start():RainbowBS.hPROCESS_THREAD:RainbowBS.hPROCESS_WAIT_EVENT:RainbowBS.hPROCESS_WAIT_EVENT_UNTIL:RainbowBS.hPROCESS_WAIT_SEM:RainbowBS.hPROCESS_WAIT_UNTIL:RainbowBS.hPROCESS_WAIT_WHILE:RainbowBS.hPROCESS_YIELD:RainbowBS.hPROCESS_YIELD_UNTIL:RainbowBS.hPT_BEGIN:pt.hPT_END:pt.hPT_EXIT:pt.hPT_INIT:pt.hPT_RESTART:pt.hPT_SCHEDULE:pt.hPT_SEM_INIT:pt-sem.hPT_SEM_SIGNAL:pt-sem.hPT_SEM_WAIT:pt-sem.hPT_SPAWN:pt.hPT_THREAD:pt.hPT_WAIT_THREAD:pt.hPT_WAIT_UNTIL:pt.hPT_WAIT_WHILE:pt.hPT_YIELD:pt.hPT_YIELD_UNTIL:pt.h

-r-

RBS_cos():RainbowBS.hRBS_ctan():RainbowBS.hRBS_DEBUG_ELSIF:RainbowBS.hRBS_DEBUG_ENDIF:RainbowBS.hRBS_DEBUG_ERROR:RainbowBS.hRBS_DEBUG_ERROR_FORMAT:RainbowBS.hRBS_DEBUG_IF:RainbowBS.hRBS_DEBUG_LOG:RainbowBS.hRBS_DEBUG_LOG_FORMAT:RainbowBS.hRBS_DEBUG_STA:RainbowBS.hRBS_DEBUG_WARN:RainbowBS.hRBS_DEBUG_WARN_FORMAT:RainbowBS.hRBS_Delay():RainbowBS.hRBS_DMM_AllocBlock():RainbowBS.hRBS_DMM_AllocMem():RainbowBS.hRBS_DMM_AllocZeroBlock():RainbowBS.hRBS_DMM_AllocZeroMem():RainbowBS.hRBS_DMM_FreeBlock():RainbowBS.hRBS_DMM_FreeMem():RainbowBS.hRBS_DMM_GetHMemSize():RainbowBS.hRBS_DMM_ReallocMem():RainbowBS.hRBS_DMM_RegisterBlock():RainbowBS.hRBS_DMM_RegisterPool():RainbowBS.hRBS_DMM_UnuseHBlock():RainbowBS.hRBS_DMM_UnuseHMem():RainbowBS.hRBS_DMM_UseHBlock():RainbowBS.hRBS_DMM_UseHMem():RainbowBS.hRBS_GetCPUBits():RainbowBS.hRBS_GetLocalTime():RainbowBS.hRBS_GetRunTime():RainbowBS.hRBS_GetSysInfo():RainbowBS.hRBS_GetTickCount():RainbowBS.hRBS_GetVersionString():RainbowBS.hRBS_Init():RainbowBS.hRBS_IsCPULittleEndian():RainbowBS.hRBS_IsStackGrowDown():RainbowBS.hRBS_MemCpy8():RainbowBS.hRBS_MemSet16():RainbowBS.hRBS_MemSet32():RainbowBS.hRBS_MemSet8():RainbowBS.h

RBS_Number2String():RainbowBS.hRBS_Read16B():RainbowBS.hRBS_Read16L():RainbowBS.hRBS_Read32B():RainbowBS.hRBS_Read32L():RainbowBS.hRBS_sin():RainbowBS.hRBS_tan():RainbowBS.hRBS_Write16B():RainbowBS.hRBS_Write16L():RainbowBS.hRBS_Write32B():RainbowBS.hRBS_Write32L():RainbowBS.h

-s-

SBINARY:RainbowBS.hSDECIMAL:RainbowBS.hSEM:RainbowBS.hSEM_NAME:RainbowBS.hSHEX:RainbowBS.h

-t-

tETIME:RainbowBS.htPROCESS:RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

-e-

etimer_adjust():RainbowBS.hetimer_expiration_time():RainbowBS.hetimer_expired():RainbowBS.hetimer_pending():RainbowBS.hetimer_request_poll():RainbowBS.hetimer_reset():RainbowBS.hetimer_restart():RainbowBS.hetimer_set():RainbowBS.hetimer_start_time():RainbowBS.hetimer_stop():RainbowBS.h

-p-

Port_Delay():Port.hPort_FreeMutex():Port.hPort_GetLocalTime():Port.hPort_GetMutex():Port.hPort_GetTickCount():Port.hPort_Init():Port.hPort_Printf_Error():Port.hPort_Printf_Log():Port.hPort_Printf_Warn():Port.hprocess_alloc_event():RainbowBS.hprocess_exit():RainbowBS.hprocess_is_running():RainbowBS.hprocess_nevents():RainbowBS.hprocess_poll():RainbowBS.hprocess_post():RainbowBS.hprocess_run():RainbowBS.hprocess_send():RainbowBS.hprocess_start():RainbowBS.h

-r-

RBS_cos():RainbowBS.hRBS_ctan():RainbowBS.hRBS_Delay():RainbowBS.hRBS_DMM_AllocBlock():RainbowBS.hRBS_DMM_AllocMem():RainbowBS.hRBS_DMM_AllocZeroBlock():RainbowBS.hRBS_DMM_AllocZeroMem():RainbowBS.hRBS_DMM_FreeBlock():RainbowBS.hRBS_DMM_FreeMem():RainbowBS.hRBS_DMM_GetHMemSize():RainbowBS.hRBS_DMM_ReallocMem():RainbowBS.hRBS_DMM_RegisterBlock():RainbowBS.hRBS_DMM_RegisterPool():RainbowBS.hRBS_DMM_UnuseHBlock():RainbowBS.hRBS_DMM_UnuseHMem():RainbowBS.hRBS_DMM_UseHBlock():RainbowBS.hRBS_DMM_UseHMem():RainbowBS.hRBS_GetCPUBits():RainbowBS.hRBS_GetLocalTime():RainbowBS.hRBS_GetRunTime():RainbowBS.hRBS_GetSysInfo():RainbowBS.hRBS_GetTickCount():RainbowBS.hRBS_GetVersionString():RainbowBS.hRBS_Init():RainbowBS.hRBS_IsCPULittleEndian():RainbowBS.hRBS_IsStackGrowDown():RainbowBS.hRBS_MemCpy8():RainbowBS.hRBS_MemSet16():RainbowBS.hRBS_MemSet32():RainbowBS.hRBS_MemSet8():RainbowBS.hRBS_Number2String():RainbowBS.hRBS_Read16B():RainbowBS.hRBS_Read16L():RainbowBS.hRBS_Read32B():RainbowBS.hRBS_Read32L():RainbowBS.hRBS_sin():RainbowBS.hRBS_tan():RainbowBS.hRBS_Write16B():RainbowBS.h

RBS_Write16L():RainbowBS.hRBS_Write32B():RainbowBS.hRBS_Write32L():RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

tETIME:RainbowBS.htPROCESS:RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ePOW:RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

SBINARY:RainbowBS.hSDECIMAL:RainbowBS.hSHEX:RainbowBS.h

Generatedby 1.8.9.1

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

-p-

PROCESS:RainbowBS.hPROCESS_BEGIN:RainbowBS.hPROCESS_CONTEXT_BEGIN:RainbowBS.hPROCESS_CONTEXT_END:RainbowBS.hPROCESS_CURRENT:RainbowBS.hPROCESS_END:RainbowBS.hPROCESS_EXIT:RainbowBS.hPROCESS_EXITHANDLER:RainbowBS.hPROCESS_NAME:RainbowBS.hPROCESS_PAUSE:RainbowBS.hPROCESS_POLLHANDLER:RainbowBS.hPROCESS_PT_SPAWN:RainbowBS.hPROCESS_SIGNAL_SEM:RainbowBS.hPROCESS_THREAD:RainbowBS.hPROCESS_WAIT_EVENT:RainbowBS.hPROCESS_WAIT_EVENT_UNTIL:RainbowBS.hPROCESS_WAIT_SEM:RainbowBS.hPROCESS_WAIT_UNTIL:RainbowBS.hPROCESS_WAIT_WHILE:RainbowBS.hPROCESS_YIELD:RainbowBS.hPROCESS_YIELD_UNTIL:RainbowBS.hPT_BEGIN:pt.hPT_END:pt.hPT_EXIT:pt.hPT_INIT:pt.hPT_RESTART:pt.hPT_SCHEDULE:pt.hPT_SEM_INIT:pt-sem.hPT_SEM_SIGNAL:pt-sem.hPT_SEM_WAIT:pt-sem.hPT_SPAWN:pt.hPT_THREAD:pt.h

PT_WAIT_THREAD:pt.hPT_WAIT_UNTIL:pt.hPT_WAIT_WHILE:pt.hPT_YIELD:pt.hPT_YIELD_UNTIL:pt.h

-r-

RBS_DEBUG_ELSIF:RainbowBS.hRBS_DEBUG_ENDIF:RainbowBS.hRBS_DEBUG_ERROR:RainbowBS.hRBS_DEBUG_ERROR_FORMAT:RainbowBS.hRBS_DEBUG_IF:RainbowBS.hRBS_DEBUG_LOG:RainbowBS.hRBS_DEBUG_LOG_FORMAT:RainbowBS.hRBS_DEBUG_STA:RainbowBS.hRBS_DEBUG_WARN:RainbowBS.hRBS_DEBUG_WARN_FORMAT:RainbowBS.h

-s-

SEM:RainbowBS.hSEM_NAME:RainbowBS.h

Generatedby 1.8.9.1

RainbowBS

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

RainbowBSDirectoryReference

DirectorydependencygraphforRainbowBS:

Directoriesdirectory RBSSource

Generatedby 1.8.9.1

RainbowBS RBSSource

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

RBSSourceDirectoryReference

DirectorydependencygraphforRBSSource:

Directoriesdirectory Basedirectory Configdirectory Port

Filesfile RainbowBS.h

Generatedby 1.8.9.1

RainbowBS RBSSource Base

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

BaseDirectoryReference

DirectorydependencygraphforBase:

Directoriesdirectory Processdirectory Protothreads

Filesfile Convert.cfile Debug.cfile DMM.cfile MemOP.cfile System.c

Generatedby 1.8.9.1

RainbowBS RBSSource Base Protothreads

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ProtothreadsDirectoryReference

DirectorydependencygraphforProtothreads:

Filesfile lc-addrlabels.hfile lc-switch.hfile lc.hfile pt-sem.hfile pt.h

Generatedby 1.8.9.1

RainbowBS RBSSource Port

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

PortDirectoryReference

DirectorydependencygraphforPort:

Filesfile Port.cfile Port.h

Generatedby 1.8.9.1

RainbowBS RBSSource Config

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ConfigDirectoryReference

DirectorydependencygraphforConfig:

Filesfile RainbowBSConf.h

Generatedby 1.8.9.1

RainbowBS RBSSource Base Process

RainbowBSManualv0.1.0WrittenbyQWQ(jacobqwq@icloud.com)

ProcessDirectoryReference

DirectorydependencygraphforProcess:

Filesfile etimer.cfile process.c

Generatedby 1.8.9.1