Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time System Design Considerations.

Slides:



Advertisements
Similar presentations
Dynamic memory allocation
Advertisements

Part IV: Memory Management
Dynamic Memory Allocation in C.  What is Memory What is Memory  Memory Allocation in C Memory Allocation in C  Difference b\w static memory allocation.
R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
Dynamic Memory Allocation I Topics Basic representation and alignment (mainly for static memory allocation, main concepts carry over to dynamic memory.
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 9 MEMORY MANAGEMENT.
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Memory Management Chapter 7.
Managing Memory Static and Dynamic Memory Type Casts Allocating Arrays of Dynamic Size Resizing Block of Memory Returning Memory from a Function Avoiding.
Typical Memory Layout sysPhysMemTop() sysMemTop() FREE_RAM_ADRS
User-Level Memory Management in Linux Programming
Pointer applications. Arrays and pointers Name of an array is a pointer constant to the first element whose value cannot be changed Address and name refer.
The Environment of a UNIX Process. Introduction How is main() called? How are arguments passed? Memory layout? Memory allocation? Environment variables.
1 Pointers A pointer variable holds an address We may add or subtract an integer to get a different address. Adding an integer k to a pointer p with base.
Processes CSCI 444/544 Operating Systems Fall 2008.
1 1 Lecture 4 Structure – Array, Records and Alignment Memory- How to allocate memory to speed up operation Structure – Array, Records and Alignment Memory-
. Memory Management. Memory Organization u During run time, variables can be stored in one of three “pools”  Stack  Static heap  Dynamic heap.
C++ fundamentals.
Copyright © 2008 Texas Instruments. All rights reserved. 1.Introduction 2.Real-Time System Design Considerations 3.Hardware Interrupts (HWI) 4.Software.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. D SP TEXAS INSTRUMENTS TECHNOLOGY 1.
Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao ISBN: CMPBooks.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
Data Structures Week 5 Further Data Structures The story so far  We understand the notion of an abstract data type.  Saw some fundamental operations.
 2007 Pearson Education, Inc. All rights reserved C Data Structures.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1.Introduction 2.Real-Time System Design Considerations 3.Hardware.
Copyright © 2004 Texas Instruments. All rights reserved. 1.Introduction 2.Real-Time System Design Considerations 3.Hardware Interrupts (HWI) 4.Software.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
Stack and Heap Memory Stack resident variables include:
Chapter 0.2 – Pointers and Memory. Type Specifiers  const  may be initialised but not used in any subsequent assignment  common and useful  volatile.
Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility,
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
TMS320C6000 DSP Optimization Workshop Chapter 10 Advanced Memory Management Copyright © 2005 Texas Instruments. All rights reserved. Technical Training.
ECE 103 Engineering Programming Chapter 47 Dynamic Memory Alocation Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 9.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1.Introduction 2.Real-Time.
CPS4200 Unix Systems Programming Chapter 2. Programs, Processes and Threads A program is a prepared sequence of instructions to accomplish a defined task.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Stacks.
Review of Stacks and Queues Dr. Yingwu Zhu. How does a Stack Work? Last-in-First-out (LIFO) data structure Adding an item Push operation Removing an item.
32-Bit-Digital Signal Controller Texas Instruments Incorporated
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization Introduction.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
12/22/ Thread Model for Realizing Concurrency B. Ramamurthy.
12/23/2015Engineering Problem Solving with C++, second edition, J. Ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 9 An Introduction.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
C LANGUAGE Characteristics of C · Small size
Basic Memory Management Chapter 3 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T.
MORE POINTERS Plus: Memory Allocation Heap versus Stack.
DSP/BIOS Real Time Operating system using DSP /ARM processor.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1.Introduction 2.Real-Time.
Chapter 7 Process Environment Chien-Chung Shen CIS/UD
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Stack and Heap Memory Stack resident variables include:
Processes and threads.
12 C Data Structures.
Chapter 9: Virtual Memory
Dynamic Systems (MEM, BUF)
Chapter 9: Virtual-Memory Management
Further Data Structures
Dynamic Memory Allocation
Operating Systems: A Modern Perspective, Chapter 6
Chapter 10-1: Dynamic Memory Allocation
Chapter 9: Pointers and String
Dynamic Memory – A Review
Dynamic Data Structures
Presentation transcript:

Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time System Design Considerations 3.Hardware Interrupts (HWI) 4.Software Interrupts (SWI) 5.Task Authoring (TSK) 6.Data Streaming (SIO) 7.Multi-Threading (CLK, PRD) 8.BIOS Instrumentation (LOG, STS, SYS, TRC) 9.Static Systems (GCONF, TCONF) 10.Cache (BCACHE) 11.Dynamic Systems (MEM, BUF) 12.Flash Programming (HexAIS, Flashburn) 13.Inter-Thread Communication (MSGQ,...) 14.DSP Algorithm Standard (XDAIS) 15.Input Output Mini-Drivers (IOM) 16.Direct Memory Access (DMA) 17.Review DSP/BIOS System Integration Workshop

Objectives  Contrast static and dynamic system coding benefits  Implement dynamic BIOS object creation and deletion  Contrast the BIOS MEM API to malloc and free  Contrast MEM API with BUF API  Modify static systems to employ dynamic methods T TO Technical Training Organization 2

 Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab Dynamic Systems What are the advantages to adding dynamic coding constructs to my DSP system? T TO Technical Training Organization 3

Static vs Dynamic Systems DYNAMIC Environment  Create  Create streams  Allocate buffers  Initialize variables  Execute  Read data  Process data  Write data  Delete  Delete streams  Free buffers STATIC Environment Link-time Declare streams Declare buffers  Initialize variables  Execute  Read data  Process data  Write data  Static Objects – created at link time via TCONF and/or GCONF  Dynamic Objects – created at runtime via MOD_create() API  Once created, both can be used identically  Only dynamic objects may be deleted via MOD_delete() API  Static benefits: easy, smaller code size, faster startup  Dynamic benefits: smaller RAM budget, reuse of on-chip RAM  Dynamic objects allow needs of the running system to determine the style and quantity of objects in place T TO Technical Training Organization 4

Dynamic Systems Can arrays of RAM be allocated as needed and given back when done ? Can malloc be enhanced to allow requests from a specific memory type? Can arrays of RAM be allocated as needed and given back when done ? Can malloc be enhanced to allow requests from a specific memory type?  Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab T TO Technical Training Organization 5

Dynamic Memory Allocation Ptr addr = MEM_alloc(Int segid, Uns size, Uns align);  Superset of malloc() function – invokes the DSP/BIOS memory manager  Allows selection of heap to draw from plus address alignment  Creation of multiple heaps is via GCONF or TCONF  Size is in NMADUs and allocation is always an even numbers of words  Aligns on even boundaries  Returns MEM_ILLEGAL if failure  malloc(size) API is translated to MEM_alloc(0,size,0) in BIOS Ptr addr = MEM_calloc(Int segid, Uns size, Uns align);  Is MEM_alloc() + clears (zeros) the array Ptr addr = MEM_valloc(Int segid, Uns size, Uns align, Char value);  Is MEM_alloc() + fills array with specified value Bool status = MEM_free(Int segid, Ptr address, Uns size);  Replacement for free() C function  Complement to MEM_alloc / valloc / calloc APIs  Must specify segment and size in addition to ptr to array  Removal of auto-store of size arg allows better aligned array packing T TO Technical Training Organization 6

Memory Heap Configuration in *.c file, obtain access to heap label via : extern Int IRAM; 7

Memory Status Interrogation struct MEM_Stat { Uns size; // original size of heap Uns used // number of MADUs used in heap Uns length; // largest contiguous block available } status = MEM_stat(segid, statbuf);  Used to query the status of specified heap  Helpful for diagnostics  Could be used to actively manage heap usage in sophisticated system  Cannot be called from a SWI or HWI; TSK scheduler must be enabled  Same information available in CCS Kernel/Object View window T TO Technical Training Organization 8

Dynamic Memory Considerations...  Non-Reentrant  Cannot be called from within HWI or SWI  Non-Deterministic:  Memory manager traverses linked list of free blocks for each allocate and delete  Recommended: Allocate and free memory during a background process or startup (pre-realtime)  Fragmentation:  After repeated allocation and freeing of memory large contiguous blocks of memory may not be available to allocate  To minimize memory fragmentation:  Allocate smaller, equal-sized blocks of memory from one memory segment and larger equal-sized blocks of memory from a second segment, etc.  For all the above concerns: Consider using BUF API T TO Technical Training Organization 9

MEM API Review MEM_allocAllocate memory from specified heap MEM_callocMEM_alloc + clear (zero) the array MEM_vallocMEM_alloc + fill array with specified value MEM_freeReturn MEM_alloc’d array to specified heap MEM APIDescription MEM_statReturn the status of a memory segment segid = MEM_define(base, length, attrs); MEM_redefine(segid, base, length); MEM_defineDefine a new memory segment MEM_redefineRedefine an existing memory segment T TO Technical Training Organization 10

Dynamic Systems Can BIOS objects occupy RAM only when needed ?  Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab T TO Technical Training Organization 11

#define COUNT 0 #include SEM_Handle hMySem; hMySem = SEM_create(COUNT,NULL); SEM_post(hMySem); SEM_delete(hMySem); #define COUNT 0 #include SEM_Handle hMySem; hMySem = SEM_create(COUNT,NULL); SEM_post(hMySem); SEM_delete(hMySem); Dynamically Creating DSP/BIOS Objects  XXX_create  Allocates memory for object out of segment defined in config tool  Returns a XXX_Handle to the created object  XXX_delete  Frees the object’s memory  Argument: object handle; return type: void Modules supporting dynamic create and delete SWI TSK SIO SEM BUF MSGQ QUE MBX LCK GIO C X D T TO Technical Training Organization 12

Dynamic Object Creation and Deletion hSwi = SWI_create(attrs); // attrs shown below hTask = TSK_create(fxn, attrs, [arg,]...); hStrm = SIO_create(name, mode, bufsize, attrs); hSem = SEM_create(count, attrs); hBuf = BUF_create(numbuff, size, align, attrs); hQueue = QUE_create(attrs); hMbx = MBX_create(msgsize, mbxlength, attrs); // see below hLock = LCK_create(attrs); hGio = GIO_create(name,mode,*status,chanParams,*attrs) hSwi = SWI_create(attrs); // attrs shown below hTask = TSK_create(fxn, attrs, [arg,]...); hStrm = SIO_create(name, mode, bufsize, attrs); hSem = SEM_create(count, attrs); hBuf = BUF_create(numbuff, size, align, attrs); hQueue = QUE_create(attrs); hMbx = MBX_create(msgsize, mbxlength, attrs); // see below hLock = LCK_create(attrs); hGio = GIO_create(name,mode,*status,chanParams,*attrs) Uns msgsize; // size of message Uns mbxlength;// length of mailbox MBX_Attrs *attrs; // pointer to mailbox attributes struct MBX_Attrs { Int segid;// heap to malloc from }; struct SWI_Attrs { SWI_Fxn fxn; Arg arg0; Arg arg1; Int priority; Uns mailbox; };  MOD_create API all return the handle to the new object  Arguments mirror those from static configuration  Many ‘attrs’ arguments are ‘placeholders’ for possible future definition  SEM, BUF, SIO, TSK examples appear elsewhere in this chapter T TO Technical Training Organization 13

Dynamic Stream API hStrm = SIO_create(name, mode, uBufSize, pAttrs); #include #define BUFSIZE 100 SIO_HandlehStrmIn, hStrmOut; SIO_Attrsattrs = SIO_ATTRS; attrs.nbufs = 3; hStrmIn = SIO_create("/a2d", SIO_INPUT, BUFSIZE, &attrs); hStrmOut = SIO_create("/d2a", SIO_OUTPUT, BUFSIZE, &attrs); / / use In and Out streams as desired... SIO_idle(hStrmIn); SIO_idle(hStrmOut); SIO_delete(hStrmIn); SIO_delete(hStrmOut); C X D SIO_HandlehStrm; // stream object handle Stringname; // name of device Intmode; // SIO_INPUT or SIO_OUTPUT UnsuBufSize; // stream buffer size SIO_Attrs*pAttrs; // pointer to stream attributes struct SIO_Attrs { Intnbufs; Intsegid; Intalign; Boolflush; Unsmodel; Unstimeout; DEV_Callback callback } T TO Technical Training Organization 14

Stream Attributes Structure struct SIO_Attrs { SIO_ATTRS Int nbufs; 2 max number of buffers to queue Int segid;0 memory segment for buffers Int align; 0 alignment of buffers Bool flush;FALSE or TRUE; Block in DEV_idle? Uns model;SIO_STANDARD or SIO_ISSUERECLAIM; stream model Uns timeout;SYS_FOREVER max # system ticks to wait when blocking DEV_Callback *callback; NULL callback fxn – most useful for SIO to SWI } SIO_Attrs; T TO Technical Training Organization 15

Dynamic Task API hTsk = TSK_create(fxn, attrs, [arg,]...); #include TSK_HandlehMyTsk; TSK_Attrsattrs = TSK_ATTRS; attrs.priority = 3; hMyTsk = TSK_create((Fxn)myCode, attrs); // “MyTsk” is now active in system with priority = 3... TSK_delete(hMyTsk); C X D struct TSK_Attrs { Int priority;// task priority Ptr stack;// pre-allocated stack Uns stacksize;// size of stack in MAU Int stackseg;// segment to allocate Ptr environ;// global data structure String name;// printable name Boolexitflag;// needs to exit to terminate? };  Task cannot call TSK_delete() on itself  TSK_delete is never intrinsically called by BIOS T TO Technical Training Organization 16

Dynamic Systems How can threads share arrays without issues of speed, determinism, or fragmentation?  Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab T TO Technical Training Organization 17

BUF Concepts  Buffer pools contain a specified number of equal size buffers  Any number of pools can be created  Creation can be static (via TCONF) or dynamic (BUF_create / BUF_delete)  Buffers are allocated from a pool and freed back when no longer needed  Buffers can be shared between threads  Buffer pool API are faster and smaller than malloc-type operations  In addition, BUF_alloc and BUF_free are deterministic (unlike malloc)  BUF API have no reentrancy or fragmentation issues  Tip – larger buffers can be semi-filled by threads with smaller data blocks  Cache and EDMA can cause coherency issues when using BUF or MEM API Buffer Pool buf SWI BUF_alloc buf TSK BUF_free buf BUF_createBUF_delete T TO Technical Training Organization 18

BUF_alloc() and BUF_free()  pMyBuf = BUF_alloc(hPool)  get a buffer from buffer pool hPool' and initializes ‘pMyBuf' with the base address of the borrowed buffer  bStatus = BUF_free(hPool, pMyBuf)  returns the buffer pointed to by ‘pMyBuf' to pool ‘hPool'  Complement to BUF_alloc  example of use: extern BUF_Obj bufferPool; BUF_Handle hPool = &bufferPool; Ptr pMyBuf; pMyBuf = BUF_alloc(hPool); if (pMyBuf == NULL ) { SYS_abort("BUF_alloc failed");} // thread can use buffer freely now... bStatus = BUF_free(hPool, pMyBuf); if(bStatus==0) { LOG_printf(&trace,"BUF_delete failed!"); } extern BUF_Obj bufferPool; BUF_Handle hPool = &bufferPool; Ptr pMyBuf; pMyBuf = BUF_alloc(hPool); if (pMyBuf == NULL ) { SYS_abort("BUF_alloc failed");} // thread can use buffer freely now... bStatus = BUF_free(hPool, pMyBuf); if(bStatus==0) { LOG_printf(&trace,"BUF_delete failed!"); } T TO Technical Training Organization 19

BUF_maxbuff() and BUF_stat()  uCount = BUF_maxbuff(hPool);  Returns maximum number of free buffers available currently  Useful for fundamental system tuning and diagnostics  BUF_stat(hPool, pBufInfo);  Information from the pool object is copied to the BufInfo structure  Useful for additional system tuning and diagnostics  example of use: typedef struct BUF_Stat { MEM_sizep postalignsize; // Size after align MEM_sizep size; // Original size of buffer Uns totalbuffers; // Total # of buffers in pool Uns freebuffers; // # of free buffers in pool } BUF_Stat; BUF_Stat bufInfo; extern BUF_Obj bufferPool; BUF_Handle hPool = &bufferPool; BUF_stat(hPool, &bufInfo); LOG_printf(&trace, "Free buffers Available: %d",bufInfo.freebuffers); T TO Technical Training Organization 20

GCONF Creation of Buffer Pool Creating a BUF 1. right click on BUF mgr 2. select “insert BUF” 3. type BUF name 4. right click on new BUF 5. select “properties” 6. indicate desired Memory segment Number of buffers Size of buffers Alignment of buffers Gray boxes indicate effective pool and buffer sizes T TO Technical Training Organization 21

TCONF Creation of Buffer Pool TCONF programming essentially mirrors the BUF_create arguments: BUF.OBJMEMSEG = prog.get(“IRAM"); // mem segment for all pool objects var myPool = BUF.create("myBuf"); myPool.bufCount = 8; // number of buffers in 'myPool' pool myPool.size = 512*sizeof(short); // size of each 'myPool' buffer in MADUs myPool.align = 2; // alignment applied to each buffer in myPool myPool.bufSeg = prog.get(“IRAM"); // mem segment for 'myPool' buffers typedef struct BUF_Attrs { Int segid; } BUF_Attrs; T TO Technical Training Organization myPool = BUF_create(numbuf, size, align, attrs) 22

BUF_create() and BUF_delete() BUF_Handle hPool; BUF_Attrs *myAttrs; myAttrs = &BUF_ATTRS; hPool=BUF_create(8, 1024, 2, &myAttrs); if( hPool == NULL ){LOG_printf(&trace,"BUF_create failed!");} // buffer pool can now be used as long as desired... bStatus = BUF_delete(hPool); if( bStatus == 0 ){LOG_printf(&trace,"BUF_delete failed!");}  hPool = BUF_create(numbuf, size, align, attrs)  Dynamically create a buffer pool  Arguments: number of buffers in pool, their size and alignment, heap to draw from  Returns handle to pool object  Calls MEM_alloc() to obtain memory from heap  bStatus = BUF_delete(hPool)  Frees a dynamically created buffer pool back to heap  Complement to BUF_create  Status: 1=success, 0=fail  Calls MEM_free to implement  example of use: typedef struct BUF_Attrs { Int segid; } BUF_Attrs; T TO Technical Training Organization 23

BUF API Review BUF_allocAllocate a buffer from the pool BUF_freeReturn a buffer to the pool BUF APIDescription BUF_maxbuffInterrogate maximum # buffers taken from pool BUF_statGet pool info (buf size, # free bufs, total # bufs in pool) BUF_createDynamically create a pool of buffers BUF_deleteDelete a dynamically created buffer pool T TO Technical Training Organization 24

BUF Structures typedef struct BUF_Obj { Ptr startaddr; // Start addr of buffer pool MEM_sizep size; // Size before alignment MEM_sizep postalignsize; // Size after align Ptr nextfree; // Ptr to next free buffer Uns totalbuffers; // # of buffers in pool Uns freebuffers; // # of free buffers in pool Int segid; // Mem seg for buffer pool } BUF_Obj, *BUF_Handle; typedef struct BUF_Attrs { Int segid; // segment for element allocation } BUF_Attrs; BUF_Attrs BUF_ATTRS = {// default attributes 0, }; typedef struct BUF_Stat { MEM_sizep postalignsize; // Size after align MEM_sizep size; // Original size of buffer Uns totalbuffers; // Total buffers in pool Uns freebuffers; // # of free buffers in pool } BUF_Stat; T TO Technical Training Organization 31

Dynamic Systems  Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab T TO Technical Training Organization 25

Dynamic Systems - Review  MOD_create() and MOD_delete()  Objects created as/when desired  Identical to static objects when executed  May be deleted when no longer required  Reduced RAM requirement  Larger code space, slower startup  System can adapt ‘on the fly’  MOD_create() returns a handle to the new object  MOD_delete() API are void return with handle arg  MEM API  Allow dynamic array create and delete  Superset of malloc() and free()  Able to select from multiple heaps + alignment  Offers the most flexibility and memory savings ability  Issues: determinism, reentrancy, fragmentation  BUF API  Allows sharing of buffers amongst threads  Buffers within a given pool are equal sized  Deterministic, reentrant, nonfragmenting T TO Technical Training Organization 26

Dynamic Systems  Apply any one or group of dynamic constructs to the prior lab  Measure speed and memory to see what changes there were  Apply any one or group of dynamic constructs to the prior lab  Measure speed and memory to see what changes there were  Concepts  Memory Allocation - MEM  Dynamic Objects  Buffer Pools - BUF  Review  Lab T TO Technical Training Organization 27

Lab10 - Dynamic Systems Use the KOV to observe memory objects in the following lab exercises: A.Stream Buffer Creation: BUF_alloc() B.Stream Buffer Deletion : BUF_free() C.Memory Allocation : MEM_alloc(), MEM_free() D.Dynamic Task : TSK_create(), _delete() T TO Technical Training Organization 28

Double Buffered SIO Create/Delete //create phase… hSioIn = SIO_create(“/dioIn”, SIO_INPUT, SIZE, attrs); hSioOut = SIO_create(“/dioOut”, SIO_OUTPUT, SIZE, attrs); pBufIn = MEM_alloc(ISRAM, BFSZ, 2); pBufIn2 = MEM_alloc(ISRAM, BFSZ, 2); pBufOut = MEM_alloc(ISRAM, BKSZ, 2); pBufOut2 = MEM_alloc(ISRAM, BKSZ, 2); //delete phase… status = MEM_free(ISRAM, pBufOut2, BKFZ); status = MEM_free(ISRAM, pBufOut, BKSZ); status = MEM_free(ISRAM, pBufIn2, BFSZ); status = MEM_free(ISRAM, pBufIn, BFSZ); status = SIO_delete(hSioIn); status = SIO_delete(hSioOut); T TO Technical Training Organization 29

ti Technical Training Organization 32