DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1. 1.Introduction.

Slides:



Advertisements
Similar presentations
Process management Information maintained by OS for process management  process context  process control block OS virtualization of CPU for each process.
Advertisements

The OS kernel: Implementing processes and Threads Kernel Definitions and Objects Queue Structures Threads Implementing Processes and Threads Implementing.
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.
Project: Processes and Resource Management Textbook: pages Lubomir Bic.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Real-Time Library: RTX
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.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
OS Spring’03 Introduction Operating Systems Spring 2003.
1 When to Switch Processes 3 triggers –System call, Interrupt and Trap System call –when a user program invokes a system call. e.g., a system call that.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
MicroC/OS-II Embedded Systems Design and Implementation.
Performance Evaluation of Real-Time Operating Systems
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. D SP TEXAS INSTRUMENTS TECHNOLOGY 1.
Real-Time DSP System Design Course and DSP/BIOS II David J. Waldo Associate Professor Oklahoma Christian University 2501 E. Memorial Rd. Oklahoma City,
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time System Design Considerations.
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.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
DSP/BIOS Scheduling Chapter 9 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1.Introduction 2.Real-Time.
Code Composer Studio & DSP/BIOS
32-Bit-Digital Signal Controller Texas Instruments Incorporated
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
Copyright © 2004 Texas Instruments. All rights reserved. 1.Introduction 2.Real-Time System Design Considerations 3.Hardware Interrupts (HWI) 4.Software.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
CS140 Project 1: Threads Slides by Kiyoshi Shikuma.
Java Thread and Memory Model
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
DSP/BIOS for C6000/C5000. What is DSP/BIOS Real-time Environment –Thread execution model Threads, Mailboxes, Semaphores –Device independent I/O Logging,
Streams – SIO & Drivers – PSP Chapter 6 C64x+ DSP/BIOS Integration Workshop Copyright © 2010 Texas Instruments. All rights reserved. 1.
DSP/BIOS System Integration Workshop Copyright © 2004 Texas Instruments. All rights reserved. T TO Technical Training Organization 1 1.Introduction 2.Real-Time.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
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 3 RTOS Concepts And Definitions Department of Computer Science Hsu Hao Chen Professor Hsung-Pin Chang.
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 7: Semaphore Management Seulki Lee 1. Semaphore?  A protocol mechanism offered by most multitasking kernels  Control access to a shared resource.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Chapter 4 DSP/BIOS. DSP/BIOS Part 1 - Introduction.
Processes and threads.
Topics Covered What is Real Time Operating System (RTOS)
Getting Started with the µC/OS-III Real Time Kernel
Process management Information maintained by OS for process management
TI BIOS TSK – Task Authoring 15 November 2018 Dr. Veton Këpuska.
Multi-Threaded Systems
Swi Scheduling Hwi Swi Tsk Idle
CS 143A Quiz 1 Solution.
Chapter 3: Processes.
CSE 153 Design of Operating Systems Winter 19
Chapter 3: Process Management
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University
Presentation transcript:

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

Objectives   Describe the fundamental concepts of tasks   Demonstrate the use of semaphores in tasks   Author TSK code using simple data block pointers   Create a TSK with the CCS GUI   Describe the TSK object   Modify SWI based code to employ TSK T TO Technical Training Organization 2

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 3

SWI TSK 12 Scheduler States : TSK vs SWI Ready Blocked Terminated 12 Running pend post preempted Created when highest priority 12 Ready Inactive 12 Running when highest priority preempted Posted Created   ready to run when created   by BIOS startup if specified in GCONF   by TSK_create() in dynamic systems (mod 11)   preemptive   blocked when pending on an unavailable resource   returned to ready state when resource is posted   may be terminated when no longer needed Tasks are: completed T TO Technical Training Organization 4

SWI vs. TSK SWIFeatureTSK Preemptable Block, Suspend Delete prior to completion by other threads User Name, Error Number, Environment Pointer Can interface with SIO context switch speed Context preserved across accesses to thread Can call SEM_pend() Stack API callable by faster slower - NO * system Individual ASM, C C T TO Technical Training Organization * SEM_pend with timeout of 0 is allowed 5

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 6

Priority Background DSP/BIOS Scheduler HWI Hardware Interrupts SWI Software Interrupts TSK Tasks IDL Background   HWI priorities set by hardware   Fixed number, preemption optional   All TSKs are preempted by all SWIs and HWIs   All SWIs are preempted by all HWIs   Preemption amongst HWI is determined by user   In absence of HWI, SWI, and TSK, IDL functions run in loop   14 SWI priority levels   Any number possible, all preemptive   15 TSK priority levels   Any number possible, all preemptive   Continuous loop   Non-realtime in nature Foreground Hard R/T Soft R/T T TO Technical Training Organization 7

Thread Preemption Example HWI SWI 2 SWI 1 IDL TSK 2 TSK 1 interrupt pend sem2 interrupt pend sem2 pend sem1 interrupt return post swi1 return post swi2 return post sem2 return post swi2 return post sem1 post sem2 return pend sem2 pend sem1 Events over time T TO Technical Training Organization 8

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 9

Task Code Topology - SEM Posting Void taskFunction(…) { /* Prolog */ while (‘condition’){ SEM_pend() /* Process */ } /* Epilog */ } Void taskFunction(…) { /* Prolog */ while (‘condition’){ SEM_pend() /* Process */ } /* Epilog */ }   Initialization (runs once only)   Processing loop - option: termination condition   Wait for resources to be available   Perform desired DSP work...   Shutdown (runs once - at most)   TSK can encompass three phases of activity   SEM can be used to signal resource availability to TSK   SEM_pend() blocks TSK until next buffer is available T TO Technical Training Organization 10

Count > 0 Decrement count Pend Return TRUE true Semaphore Pend Semaphore Structure:   Non-negative 16-bit counter   Pending queue (FIFO) Semaphore Structure:   Non-negative 16-bit counter   Pending queue (FIFO) Return FALSE timeout expires SEM posted false Block task yes no timeout = 0 SEM_pend(&sem, timeout) #define SYS_FOREVER (Uns)// wait forever #define SYS_POLL (Uns)0// don’t wait T TO Technical Training Organization 11

Task pending on sem? Ready first waiting task Return True Task switch will occur if higher priority task is made ready Semaphore Post Increment count False Semaphore Structure:   Non-negative count   Pending queue (FIFO) Semaphore Structure:   Non-negative count   Pending queue (FIFO) Post SEM_post(&sem) T TO Technical Training Organization 12

Static Creation of SEM var mySem = SEM.create("mySem"); mySem.comment = "my SEM"; mySem.count = 0; T TO Technical Training Organization Creating a new SEM Obj 1. right click on SEM mgr 2. select “Insert SEM” 3. type object name 4. right click on new SEM 5. select “Properties” 6. indicate desired User Comment (FYI) Initial SEM count 13

SEM API Summary SEM_pendWait for the semaphore SEM_postSignal the semaphore SEM_countGet the current semaphore count SEM_resetReset SEM count to the argument-specified value SEM_newPuts specified count value in specified SEM SEM_ipost SEM_post in ISR – obsolete – use SEM_post SEM APIDescription SEM_createCreate a semaphore SEM_deleteDelete a semaphore Mod 11 T TO Technical Training Organization SEM_pendBinaryWait for binary semaphore to = 1 SEM_postBinaryWrite a 1 to the specified semaphore 14

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 15

Static Creation of TSK Creating a new TSK 1. right click on TSK mgr 2. select “Insert TSK” 3. type TSK name 4. right click on new TSK 5. select “Properties” 8. indicate desired priority stack properties function arguments etc T TO Technical Training Organization 16

fxn * environ * priority6 stack * namelpf1 C fxn, eg: bk FIR inst2 myTsk Task Object Concepts... Task object:  Pointer to task function  Priority: changable  Pointer to task’s stack  Stores local variables  Nested function calls  makes blocking possible  Interrupts run on the system stack  Pointer to text name of TSK  Environment: pointer to user defined structure: fxn * environ * priority6 stack * namelpf2 struct myEnv T TO Technical Training Organization TSK_setenv(TSK_self(),&myEnv); hMyEnv = TSK_getenv(&myTsk); TSK stack struct myEnv TSK stack 17

TSK Object T TO Technical Training Organization struct KNL_Obj { // from KNL.h QUE_Elemready; // ready/sem queue QUE_Elemalarm; // alarm queue elem QUE_Elemsetpri; // set priority queue QUE_Handlequeue; // task's ready queue Intpriority; // task priority Unsmask; // 1 << priority Ptrsp; // current stack ptr Unstimeout; // timeout value Intmode; // blocked, ready,... STS_Obj*sts; // for TSK_deltatime() Boolsignalled; // woken by sem or t-out }; typedef struct TSK_Obj { // from TSK.h KNL_Objkobj; // kernel object Ptrstack; // used w TSK_delete() size_tstacksize; // ditto Intstackseg; // stack alloc’n RAM Stringname; // printable name Ptrenviron; // environment pointer Interrno; // TSK_seterr()/_geterr() Boolexitflag; // FALSE for server tasks } TSK_Obj, *TSK_Handle; typedef struct TSK_Config { IntSTACKSEG; IntPRIORITY; size_tSTACKSIZE; FxnCREATEFXN; FxnDELETEFXN; FxnEXITFXN; FxnSWITCHFXN; FxnREADYFXN; } TSK_Config; typedef struct TSK_Stat { TSK_Attrsattrs; // task attributes TSK_Modemode; // running, blocked... Ptrsp; // stack ptr size_tused; // stack max } TSK_Stat; typedef struct TSK_Attrs { Int priority ;// task priority Ptr stack ;// stack supplied size_t stacksize ;// size of stack Int stackseg ;// stack alloc’n seg Ptr environ ;// environment pointer String name ;// printable name Bool exitflag; // server tasks = false Bool initstackflag; // FALSE: no stack init } TSK_Attrs; 18

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 19

TSK API Summary TSK_exitTerminate execution of the current task TSK_getenvGet task environment TSK_setenvSet task environment TSK_getnameGet task name TSK_createCreate a task ready for execution TSK_deleteDelete a task TSK APIDescription Mod 11   Most TSK API are used outside the TSK so other parts of the system can interact with or control the TSK   Most TSK API are to allow:   TSK scheduler management (Mod 7)   TSK monitor & debug (Mod 8)   Dynamic creation & deletion of TSK (Mod 11)   TSK author usually has no need for any TSK API within the TSK code itself T TO Technical Training Organization 20

TSK API Summary TSK_settimeSet task statistics initial time TSK_deltatimeRecord time elapsed since TSK made ready TSK_getstsGet task STS object TSK_seterrSet task error number TSK_geterrGet task error number TSK_statRetrieve the status of a task TSK_checkstacksCheck for stack overflow TSK_disableDisable DSP/BIOS task scheduler TSK_enableEnable DSP/BIOS task scheduler TSK_getpriGet task priority TSK_setpriSet a tasks execution priority TSK_tickAdvance system alarm clock TSK_itickAdvance system alarm clock (ISR) TSK_sleepDelay execution of the current task TSK_timeReturn current value of system clock TSK_yieldYield processor to equal priority task TSK APIDescription Mod 8 Mod 7 T TO Technical Training Organization 21

Tasks   TSK vs SWI   TSK Scheduling   Semaphores (SEM)   Task Object   Review   Lab 12 Ready Blocked Terminated 12 Running pend post preempted Created when highest priority T TO Technical Training Organization 22

Audio Out (48 KHz) Lab 5: Task Thread - TSK ADC AIC33 Audio In (48 KHz) McBSP DRR FIR.c FIR Code DAC AIC33 McBSP DXR mcbsp.c coeffs.c Coefficients BIOS\Labs\HWBIOS\Labs\Work BIOS\Labs\Algos   Begin with the SWI-based buffered system   Modify SWI to run as TSK; add SEM_pend and while loop   TCF: remove SWI obj, add TSK and SEM objs   Modify HWI to post SEM instead of SWI   Build, load, test, verify performance isrAudio pInBuf[bkCnt]=MCBSP_read MCBSP_write(pOutBuf[bkCnt]) if(bkCnt=2*BUF) QUE_put(&from DevQbufs) SEM_post(&mySem) bkCnt=0; HWI12 tskProcBuf procBuf while() SEM_pend(&mySem) for (i =0, i<HIST; i ++) pIn ][i]= pPriorIn ][ 2*BUF-HIST ]; if( sw0 == 1 ) FIR(in[ pIn-HIST ],out[ pOut ]) else {pOut[i]=pIn[i]} T TO Technical Training Organization 23

Lab 5 : Procedure Overview   In the TCF file:   replace the processing SWI with a TSK   create a SEM   In audio.c:   In the isrAudio (HWI) function:   Post a SEM instead of the SWI   In the procBuf (TSK) function   Add a while loop and SEM_pend to the remaining code in procBuf()   Build, download, run, and verify the correct operation of the new solution   Optionally, copy the solution files to C:\BIOS\mySols\05 24

ti Technical Training Organization 32

Lab Details FilterDebugRelease Off18%4.7% On61%6.5% HWI – based lab 3 FilterDebugRelease Off3.8%2.3% On45%3.7% SWI – based lab 4 Observations: Moving from SWI to TSK showed results within 0.1% of being the same So… the ‘extra overhead’ of TSK vs SWI doesn’t really amount to much at all, and could easily be countered by a small increase in buffer size, which will have much greater effect than thread type FilterDebugRelease Off 3.8% 2.5% On 45% 3.8% TSK – based lab 5