一、DSP/BIOS的组件 1、DPS/BIOS实时库和API

Slides:



Advertisements
Similar presentations
高考英语阅读分析 —— 七选五. 题型解读: 试题模式: 给出一篇缺少 5 个句子的文章, 对应有七个选项,要求同学们根据文章结构、 内容,选出正确的句子,填入相应的空白处。 考查重点: 主要考查考生对文章的整体内容 和结构以及上下文逻辑意义的理解和掌握。 (考试说明) 选项特点: 主旨概括句(文章整体内容)
Advertisements

1 I/O 设备访问方式和类型. 2 Overview n The two main jobs of a computer: l I/O (Input/Output) l processing n The control of devices connneted to the computer is.
创新实验 课程说明 计算机学院 孙彤 计算机学院 张明.
自衛消防編組任務職責 講 義 This template can be used as a starter file for presenting training materials in a group setting. Sections Right-click on a slide to add.
操作系统结构.
CHAP 2 Computer-System Structures 计算机系统结构
Chapter 2: Computer-System Structures计算机系统结构
第4章 VHDL设计初步.
OSEK/VDX标准的产生 1993年5月,几家德国汽车制造商同意在适用于汽车且通用的实时分布式操作系统的规范化方面进行合作,产物就是OSEK(OSEK:Offense systeme und deren Schnit-stellen fur ide Elek im Kraftfahrzeug)。
Chapter 6 同步 (Synchronization)
天文望远镜集成建模研究 杨德华 南京天文光学技术研究所 30 NOV, 年中国虚拟天文台年会 广西师范大学 桂林
云实践引导产业升级 沈寓实 博士 教授 MBA 中国云体系产业创新战略联盟秘书长 微软云计算中国区总监 WinHEC 2015
Writing 促销英文信 促销的目的就是要卖出产品,那么怎样才能把促销信写得吸引人、让人一看就对产品感兴趣呢?下面就教你促销信的四步写法。
Operating System Process Management - 4 Monday, August 11, 2008.
Operating System CPU Scheduing - 2 Monday, August 11, 2008.
Operating System CPU Scheduing - 3 Monday, August 11, 2008.
深層學習 暑期訓練 (2017).
System Administration Practice Homework 2: Shell Programming
Thinking of Instrumentation Survivability Under Severe Accident
Operating System Concepts 作業系統原理 Chapter 3 行程觀念 (Process Concept)
第六章 应用程序结构.
Applied Operating System Concepts
簡易 Visual Studio 2010 C++ 使用手冊
Operating System Concepts 作業系統原理 CHAPTER 2 系統結構 (System Structures)
中国散裂中子源小角谱仪 的实验数据格式与处理算法 报告人:张晟恺 中国科学院高能物理研究所 SCE 年8月18日
Special English for Industrial Robot
HLA - Time Management 陳昱豪.
Chapter 3 行程觀念 (Process Concept)
创建型设计模式.
ICT RTOS Research Group 胡伟平,王剑
常见问题解答 II. App上重置并清空数据库之后,手机app找不到圣诞灯怎么办? I. 打开APP,发现并连接不了圣诞灯怎么办?
第三章 项目设定.
Programmable Logic Architecture Verilog HDL FPGA Design
重點 資料結構之選定會影響演算法 選擇對的資料結構讓您上天堂 程式.
塑膠材料的種類 塑膠在模具內的流動模式 流動性質的影響 溫度性質的影響
Understanding the Supply Chain
邹佳恒 第十八届全国科学计算与信息化会议 • 威海,
第9章 DSP集成开发环境CCS 内容提要 CCS是TI公司推出的用于开发DSP芯片的集成开发环境,它采用Windows风格界面,集编辑、编译、链接、软件仿真、硬件调试以及实时跟踪等功能于一体,极大地方便了DSP芯片的开发与设计,是目前使用最为广泛的DSP开发软件之一。 本章对CCS开发软件的使用作了详细地介绍。首先,对CCS开发软件作了简要地说明,并介绍了该软件的安装及配置;其次,介绍了CCS的基本操作,包括:CCS的窗口和工具条、文件的编辑、反汇编窗口、存储器窗口、寄存器窗口、观察窗口
簡易 Visual Studio 2005 C++ 使用手冊
單元11: 事件結構 主題: a. 事件結構概述 b. 如何使用事件結構 c. 使用事件結構須注意的事項.
Operating System Principles 作業系統原理
第3章 認識處理元.
PubMed整合显示图书馆电子资源 医科院图书馆电子资源培训讲座.
第十五课:在医院看病.
21st Century Teaching & Learning
Microsoft SQL Server 2008 報表服務_設計
IBM SWG Overall Introduction
TinyOS 石万兵 2019/4/6 mice.
資料結構 Data Structures Fall 2006, 95學年第一學期 Instructor : 陳宗正.
資料庫 靜宜大學資管系 楊子青.
Version Control System Based DSNs
Guide to a successful PowerPoint design – simple is best
高正宗 System Consultant Manager
中国科学技术大学计算机系 陈香兰 2013Fall 第七讲 存储器管理 中国科学技术大学计算机系 陈香兰 2013Fall.
虚 拟 仪 器 virtual instrument
中国科学技术大学计算机系 陈香兰 Fall 2013 第三讲 线程 中国科学技术大学计算机系 陈香兰 Fall 2013.
Common Qs Regarding Earnings
第7章 進階的同步 觀念與實務.
績效考核 一.績效考核: 1.意義 2.目的 3.影響績效的因素 二.要考核什麼? 三.誰來負責考核? 四.運用什麼工具與方法?
第10章 存储器接口 罗文坚 中国科大 计算机学院
Chapter 10 Mobile IP TCP/IP Protocol Suite
CHAPTER 6 Concurrency:deadlock And Starvation
李宏毅專題 Track A, B, C 的時間、地點開學前通知
Create and Use the Authorization Objects in ABAP
动词不定式(6).
Prepare for Cozy & Lazy HOME Life
怎樣把同一評估 給與在不同班級的學生 How to administer the Same assessment to students from Different classes and groups.
Operating System Software School of SCU
Race Conditions and Semaphore
MGT 213 System Management Server的昨天,今天和明天
Presentation transcript:

一、DSP/BIOS的组件 1、DPS/BIOS实时库和API 运用DSP/BIOS的一个基本概念是我们的运行程序是一个多线程的情况,我们通过API(运用程序接口)函数来管理这些线程。 我们可以把DSP/BIOS API分为许多模块,不同的线程属于不同的模块。这些模块包括:TMS320C54x DSP/BIOS User’s Guide Page 1-5

DPS/BIOS实时库和API API管理进程的具体方法是通过API函数,这些函数功能非常多,如:建立和删除对象,变换线程优先级等; 函数的详细说明: TMS320C54x DSP/BIOS Application Programming Interface (API) Reference Guide Page 1-3

2、DSP/BIOS配置工具

DSP/BIOS配置工具 API函数不是直接对线程进行管理,而是通过对不同模块中建立的对象管理来实现对线程的管理,这些对象相当于线程的文件头或函数名。 不同模块中对象的建立有两种方法,一是通过在源文件中使用API函数调用,可以动态产生,动态删除;一是通过DSP/BIOS配置工具产生,是静态产生,不可删除。

DSP/BIOS配置工具 DSP/BIOS配置工具产生对象的优点: 他是图形化的编辑工具,使用更加方便; 他可以对对象进行各种参数设置; 他可以建立各种对象,而API函数只能建立部分对象。

DSP/BIOS配置工具 DSP/BIOS配置工具产生对象的缺点: 一旦建立,不论程序中是否使用,都有占有一定资源; 一旦建立,在程序运行中,不可以删除。

3、DSP/BIOS插件 完成对运行程序的实时分析,时刻监视CPU的负荷,各个线程的执行情况,各段代码的花费时间等等; DSP通过JTAG口返回到PC数据,这些数据反映我们需要的情况。这些数据的产生是在CPU的空闲状态时产生的,所以,不会对DSP本身的运行产生影响。

DSP/BIOS插件 Program tracing: Displaying events written to target logs, reflecting dynamic control flow during program execution。 Performance monitoring: Tracking summary statistics that reflect use of target resources, such as processor load and timing File streaming: Binding target-resident I/O objects to host files。

4、各部分关系 TMS320C54x DSP/BIOS User’s Guide Page 1-4

二、DSP/BIOS的特点 1、DSP/BIOS的目的 DSP/BIOS and its plug-ins for Code Composer Studio are designed to minimize memory and CPU requirements on the target.

2、实现方法 All DSP/BIOS objects can be created in the Configuration Tool and bound into an executable program image. This reduces code size and optimizes internal data structures. Instrumentation data (such as logs and traces) is formatted on the host.

实现方法 The API is modularized so that only the parts of the API that are used by the program need to be bound into the executable program. The library is optimized to require the smallest possible number of instruction cycles, with a significant portion imple-mented in assembly language.

实现方法 Communication between the target and the DSP/BIOS plug-ins is performed within the background idle loop. This ensures that the DSP/BIOS plug-ins do not interfere with the program’s tasks. If the target CPU is too busy to perform background tasks, the DSP/BIOS plug-ins stop receiving infor-mation from the target until the CPU is available.

3、API特点 A program can dynamically create and delete objects that are used in special situations. The same program can use both objects created dynamically and objects created with the Configuration Tool. Low-level system primitives are provided to make it easier to handle errors, create common data structures, and manage memory usage.

API特点 The threading model provides thread types for a variety of situations. Hard-ware interrupts, software interrupts, tasks, idle functions, and periodic functions are all supported. You can control the priorities and blocking characteristics of threads through your choice of thread types.

API特点 Structures to support communication and synchronization between threads are provided. These include semaphores, mailboxes, and resource locks. Two I/O models are supported for maximum flexibility and power. Pipes are used for target/host communication and to support simple cases in which one thread writes to the pipe and another reads from the pipe.Streams are used for more complex I/O and to support device drivers.

三、程序生成 1、DSP/BIOS开发流程 1) Write a framework for your program. You can use C or assembly code. 2) Use the Configuration Tool to create objects for your program to use. 3) Save the configuration file, which generates files to be included when you compile and link your program.

DSP/BIOS开发流程 4) Compile and link the program using a makefile or a Code Composer project. 5) Test program behavior using a simulator or initial hardware and the DSP/BIOS plug-ins. You can monitor logs and traces, statistics objects,timing, software interrupts, and more.

DSP/BIOS开发流程 6) Repeat steps 2-5 until the program runs correctly. You can add functionality and make changes to the basic program structure. 7) When production hardware is ready, modify the configuration file to support the production board and test your program on the board.

2、配置工具使用 Creating a New Configuration Setting Global Properties for a Module Creating an Object Using the Config-uration Tool Files Generated by the Configuration Tool: program.cdb programcfg.h54 programcfg.s54 programcfg.cmd

3、编译和链接 手工添加文件program.cdb (the configuration file)和programcfg.cmd (the linker command file); programcfg.s54自动添加; 库文件rst.lib不需要; C源文件中要加上各种API头文件; 其他源文件同一般的CCS使用一样;

四、线程的基本概念 1、什么是线程 实时的DSP应用,往往需要把许多看似不相干的功能同时实现。不同的功能通过不同的指令流实现,而我们把这些指令流叫线程。 同一个处理器实现多线程的方法是给线程加上优先级。优先级高的线程首先执行。

2、线程的种类 Hardware interrupts (HWI): includes CLK functions Software interrupts (SWI): includes PRD functions Tasks (TSK) Background thread (IDL)

硬件中断 Triggered in response to external asynchronous events that occur in the DSP environment. An HWI function (also called an interrupt service routine or ISR) is executed after a hardware interrupt is triggered in order to perform a critical task that is subject to a hard deadline.

硬件中断 HWI functions are the threads with the highest priority in a DSP/BIOS application. HWIs should be used for application tasks that may need to run at frequencies approaching 200 kHz, and that need to be completed within deadlines of 2 to 100 microseconds.

软件中断 Software interrupts are triggered by calling SWI functions from the program. Software interrupts provide additional priority levels between hardware interrupts and the background thread. SWIs handle tasks subject to time constraints that preclude them from being run from the idle loop, but whose deadlines are not as severe as those of hardware ISRs.

软件中断 Like HWI’s, SWI’s threads always run to completion. Software interrupts should be used to schedule events with deadlines of 100 microseconds or more. SWIs allow HWIs to defer less critical processing to a lower-priority thread, minimizing the time the CPU spends inside an ISR, where other HWIs may be disabled.

TASK Tasks have higher priority than the back-ground thread and lower priority than software interrupts. Tasks differ from software interrupts in that they can be suspended during execution until necessary resources are available. DSP/BIOS provides a number of structures that can be use for inter-task communication and synchronization. These structures include queues, semaphores, and mailboxes.

背景线程 Executes the idle loop (IDL) at the lowest priority in a DSP/BIOS application. After main returns, a DSP/BIOS application calls the startup routine for each DSP/BIOS module and then falls into the idle loop. The idle loop is a continuous loop that calls all functions for the IDL objects.

背景线程 Each function must wait for all others to finish executing before it is called again. The idle loop runs continuously except when it is preempted by higher-priority threads. Only functions that do not have hard deadlines should be executed in the idle loop.

时钟函数 Triggered at the rate of the on-chip timer interrupt. By default, these functions are triggered by the HWI_TINT hardware interrupt and are performed as HWI functions.

周期函数 Performed based on a multiple of either the on-chip timer interrupt or some other occurrence. Periodic functions are a special type of software interrupt.

Data notification functions Performed when you use pipes (PIP) or host channels (HST) to transfer data. The functions are triggered when a frame of data is read or written to notify the writer or reader. These functions are performed as part of the context of the function that called PIP_alloc, PIP_get, PIP_free, or PIP_put.

3、性能比较 SWI or TSK vs. HWI : Perform only critical processing within hardware interrupt service routines. HWIs can run at frequencies approaching 200kHz. Use software interrupts or tasks for events with deadlines around 100 microseconds or more. Your HWI functions should post software interrupts or tasks to perform lower-priority processing.

SWI vs. TSK Use software interrupts if functions have relatively simple interdependencies and data sharing requirements. Use tasks if the requirements are more complex. While higher-priority threads can preempt lower priority threads, only tasks can be suspended to wait for another event, such as resource availability. Tasks also have more options than SWIs when using shared data.

SWI vs. TSK All input needed by a software interrupt’s function should be ready when the program posts the SWI. The SWI object’s mailbox structure provides a way to determine when resources are available. SWIs are more memory efficient because they all run from a single stack.

IDL Create background functions to perform noncritical housekeeping tasks when no other processing is necessary. IDL functions do not typically have hard deadlines; instead they run whenever the system has unused processor time.

CLK Use CLK functions when you want a function to be triggered directly by a timer interrupt. These functions run as HWI functions and should take minimal processing time. The default CLK object, PRD_clock, causes a tick for the periodic functions. You can add additional CLK objects to run at the same rate. However, you should minimize the time required to perform all CLK functions because they run as HWI functions.

PRD Use PRD functions when you want a function to run at a rate based on a multiple of the on-chip timer’s low-resolution rate or another event (such as an external interrupt). These functions run as SWI functions.

PRD vs. SWI All PRD functions run at the same SWI priority, so one PRD function cannot preempt another. However, PRD functions can post lower-priority software interrupts for lengthy proce-ssing routines. This ensures that the PRD_swi software interrupt can preempt those routines when the next system tick occurs and PRD_swi is posted again

4、性能比较图 TMS320C54x DSP/BIOS User’s Guide Page 4-6

5、优先级 硬件中断最高,一个线程可以被挤占(preempt,中途被中断),但是不能被阻塞(block,暂停等待); 软件中断较高,又有14个等级,可以被挤占,但是不能阻塞; TASK较低,有15个等级,可以挤占和阻塞; IDL最低,循环执行一定线程。

6、线程的保护和挤占

线程的保护和挤占

五、硬件中断使用方法 1、中断矢量表 我们在DSP/BIOS的运用中,可以不必去建立中断矢量表。我们只需要在模块MEM中,对VECT的对象进行设置,这个设置是向DSP提供中断矢量表的地址。 我们再通过HWI模块,对需要使用的硬件中断进行中断服务程序的设置就可以了。

2、硬件中断的屏蔽 我们没有办法在DSP/BIOS的配置工具中对那个中断进行屏蔽; 我们可以在程序中通过对寄存器的值的控制来完成对中断的屏蔽; 我们也可以在程序中,调用API函数完成对硬件中断的控制,如函数:HWI_enable HWI_restore HWI_enable

六、软件中断使用方法 1、软件中断的建立 软件中断实际就是把一个已经建立的函数作为一个中断程序,这个中断程序的执行由软件触发; 软件中的建立可以通过配置工具,进行静态的建立; 软件中断的建立,也可以利用API函数动态的建立。 swi = SWI_create(attrs)

2、软件中断的优先级 优先级在建立软中断的时候就确定了; 如果是使用配置工具,在软件中断的对象属性中设置; 如果是使用动态API函数建立,则在建立的时候,可以使用参数来确定他的属性。

3、软件中断的邮箱 邮箱是一个32bit的寄存器,我们可以在配置工具中,建立软件中断对象的时候设置他的初始值; 在程序中,我们使用下面的API函数来控制一个软件中断的邮箱,从而控制软件中断的执行: SWI_andn SWI_dec SWI_inc SWI_or SWI_post

4、邮箱函数 邮箱的API函数在程序中使用,用来控制邮箱值的变换,从而控制软件中断的执行; SWI_post直接调用软件中断,不改变邮箱值; SWI_inc邮箱值加1,同时调用软件中断; SWI_or其所带参数同邮箱值相比特或,同时调用软件中断; SWI_dec邮箱值减1,如果减1后为0,调用软件中断; SWI_andn其所带参数同邮箱值相比特与,相与后邮箱值为0,调用软件中断;

邮箱函数

七、TASK使用方法 1、建立方法 他的建立方法,含义同软件中断是相同的; 同软件中断相比,优先级低; 同软件中断相比,可以被悬挂;

2、任务的特点 同软件中断相比,每个TASK使用自己的堆栈,大小分别设置,而所以软件中断使用自己的堆栈。

3、TASK工作状态 running, which means the task is the one actually executing on the system’s processor; ready, which means the task is scheduled for execution subject to processor availa-bility; blocked, which means the task cannot exe-cute until a particular event occurs within the system; When a task is blocked, it is often because the task is pending on a semaphore which is unavailable. terminated, which means the task is “termi-nated” and does not execute again.

4、状态间的转换和函数

5、TASK同旗语、邮箱 TASK间的通信通过旗语和邮箱; 旗语和邮箱在配置工具中都可以建立; 旗语的意思; 邮箱的意思;

八、CLK使用方法 1、定时器中断周期配置 我们可以利用DSP/BIOS提供的CLK模块,方便地建立定时器中断。中断产生的周期在CLK的通用属性中配置。 配置有两种,一是high resolution time,一种实directly configure timer register

2、 high resolution time 我们在配置工具的CLK模块的通用属性中,选中high resolution time,同时,microseconds/int属性中地数值就是中断产生地周期,单位是微妙。

3、directly configure timer register 我们不选择high resolution time,则定时器地计数频率为CLKOUT/(TDDR+1),计数个数为PRD Register

4、中断服务程序 中断产生的是硬件中断,我们可以添加一个CLK对象来定义入口地址,而不是在中断矢量表中定义入口地址。 中断矢量表的入口地址为CLK_F_isr,这个函数是系统自带的,他会跳转到各个CLK的对象定义的中断服务程序。用户无需定义中断矢量表。

九、周期函数使用方法 周期函数是一个软件中断,优先级没有定时器中断高; 只要选择了PRD模块通用属性中的Use CLK Manager Drive PRD,他的执行就通过对产生多少个定时器中断来计数。 CLK模块中的对象PRD_clock定义的函数就是统计CLK中断的次数,从而传递给PRD模块。 通过建立PRD模块的对象我们建立PRD函数。

十、插件使用 插件在实验中讲解