etpu Host Interface by:



Similar documents
Connecting Low-Cost External Electrodes to MED-EKG

Blood Pressure Monitor Using Flexis QE128 Gabriel Sanchez RTAC Americas

Initializing the TSEC Controller

Local Interconnect Network (LIN) Physical Interface

Software Real Time Clock Implementation on MC9S08LG32

Understanding LCD Memory and Bus Bandwidth Requirements ColdFire, LCD, and Crossbar Switch

IRTC Compensation and 1 Hz Clock Generation

Programming Audio Applications in the i.mx21 MC9328MX21

Windows 7: Using USB TAP on a Classic CodeWarrior Installation (MGT V9.2 DSC V8.3)

Performance Monitor on PowerQUICC II Pro Processors

PowerQUICC II Pro (MPC83xx) PCI Agent Initialization

Using WinUSB in a Visual Studio Project with Freescale USB device controller

Connecting to an SMTP Server Using the Freescale NanoSSL Client

How To Control A Motor Control On An Hvac Platform

Handling Freescale Pressure Sensors

Cyclic Redundant Checker Calculation on Power Architecture Technology and Comparison of Big-Endian Versus Little-Endian

Point-of-Sale (POS) Users Guide Lech José Olmedo Guerrero Jaime Herrerro Gallardo RTAC Americas

Freescale Embedded GUI Converter Utility 2.0 Quick User Guide

How To Build A Project On An Eclipse Powerbook For Anarc (Powerbook) On An Ipa (Powerpoint) On A Microcontroller (Powerboard) On Microcontrollers (Powerstation) On Your Microcontroller 2 (Powerclock

Improving Embedded Software Test Effectiveness in Automotive Applications

Flexible Active Shutter Control Interface using the MC1323x

Using the Performance Monitor Unit on the e200z760n3 Power Architecture Core

Data Movement Between Big-Endian and Little-Endian Devices

How to Convert 3-Axis Directions and Swap X-Y Axis of Accelerometer Data within Android Driver by: Gang Chen Field Applications Engineer

User Interface Design using CGI Programming and Boa Web Server on M5249C3 Board

Installation of the MMA955xL CodeWarrior Service Pack Author: Fengyi Li Application Engineer

Hardware Configurations for the i.mx Family USB Modules

MCF54418 NAND Flash Controller

Detecting a CPM Overload on the PowerQUICC II

Freescale Variable Key Security Protocol Transmitter User s Guide by: Ioseph Martínez and Christian Michel Applications Engineering - RTAC Americas

MC13783 Buck and Boost Inductor Sizing

MPC8245/MPC8241 Memory Clock Design Guidelines: Part 1

Techniques and Tools for Software Analysis

Using eflexpwm Module for ADC Synchronization in MC56F82xx and MC56F84xx Family of Digital Signal Controllers

Freescale Semiconductor. Integrated Silicon Pressure Sensor. On-Chip Signal Conditioned, Temperature Compensated and Calibrated MPX4080D.

ColdFire Security SEC and Hardware Encryption Acceleration Overview

PQ-MDS-T1 Module. HW Getting Started Guide. Contents. About This Document. Required Reading. Definitions, Acronyms, and Abbreviations

USB HID bootloader for the MC9S08JM60

VGA Output using TV-Out Extension Solution i.mx21

Using XGATE to Implement LIN Communication on HCS12X Daniel Malik 8/16-Bit Products Division East Kilbride, Scotland

3-Phase BLDC Motor Control with Hall Sensors Using 56800/E Digital Signal Controllers

White Paper. Freescale s Embedded Hypervisor for QorIQ P4 Series Communications Platform

Generate Makefiles from Command Line Support in Eclipse-Based CodeWarrior Software

Enhanced Serial Interface Mapping

Using the Kinetis Security and Flash Protection Features

Freescale Semiconductor. Integrated Silicon Pressure Sensor. On-Chip Signal Conditioned, Temperature Compensated and Calibrated MPX5500.

Using Program Memory As Data Memory. 1. Introduction Program Memory and Data. Contents. Memory. Freescale Semiconductor Application Note

Emulated EEPROM Implementation in Dual Flash Architecture on MC9S08LG32 With Demo Description

How To Measure Power Of A Permanent Magnet Synchronous Motor

Implementing Positioning Algorithms Using Accelerometers

Real Time Development of MC Applications using the PC Master Software Visualization Tool. 1. Introduction. 2. Development of Motor Control.

Understanding Pressure and Pressure Measurement

Efficient Low-Level Software Development for the i.mx Platform

NOT RECOMMENDED FOR NEW DESIGN

MLPPP in the Evolving Radio Access Network

VLE 16-bit and 32-bit Instruction Length Decode Algorithm

How To Improve Performance On A P4080 Processor

Comparison of MC9S08QE128 and MCF51QE128 Microcontrollers Scott Pape and Eduardo Montanez Systems Engineering, Freescale Microcontroller Division

3-Phase BLDC Motor Control with Hall Sensors Using the MC56F8013

Robust Over-the-Air Firmware Updates Using Program Flash Memory Swap on Kinetis Microcontrollers

Configuring the FlexTimer for Position and Speed Measurement with an Encoder

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

MSC8156 and MSC8157 PCI Express Performance

How to Do EEPROM Emulation Using Double Flash Array on MC9S08LC60 Ronald Gonzalez and Tatiana Orofino RTAC Americas

Processor Expert Software Microcontrollers Driver Suite Getting Started Guide

How To Fit A 2Mm Exposed Pad To A Dfn Package

Avoiding Read While Write Errors When Developing In-Software Flash Programming Applications for Kinetis and ColdFire+ MCUs

NOT RECOMMENDED FOR NEW DESIGN

User Guide. Introduction. HCS12PLLCALUG/D Rev. 0, 12/2002. HCS12 PLL Component Calculator

Using the High Input Voltage Charger for Single Cell Li-Ion Batteries (KIT34671EPEVBE)

Genesi Pegasos II Setup

Using the HC08 SCI Module

ITU-T V.42bis Data Dictionary Search on the StarCore SC140/SC1400 Cores

i.mx28 Ethernet Performance on Linux

Ref Parameters Symbol Conditions Min Typ Max Units. Standby μa. 3 Range kpa. 4 Resolution 0.15 kpa. 5 Accuracy -20ºC to 85ºC ±1 kpa

i.mx Applications Processors with Hantro's Multimedia Framework

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

MPXAZ6115A MPXHZ6115A SERIES. Freescale Semiconductor Technical Data. MPXAZ6115A Rev 4, 01/2007

A Utility for Programming Single FLASH Array HCS12 MCUs, with Minimum RAM Overhead

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

NOT RECOMMENDED FOR NEW DESIGN

ULN2803A ULN2804A OCTAL PERIPHERAL DRIVER ARRAYS

1 Introduction. Freescale Semiconductor Application Note. Document Number: AN3031 Rev. 1, 04/2010

SEMICONDUCTOR TECHNICAL DATA

AND8365/D. 125 kbps with AMIS-4168x APPLICATION NOTE

AND9190/D. Vertical Timing Optimization for Interline CCD Image Sensors APPLICATION NOTE

Quickly Turning Ideas into Microcontroller-Based Applications with CodeWarrior Development Tools and UNIS Processor Expert

Developing an Application for the i.mx Devices on the Linux Platform

Multicore Processing: Virtualization and Data Center

Freescale Semiconductor, I

P D Operating Junction Temperature T J 200 C Storage Temperature Range T stg 65 to +150 C

RF Power Field Effect Transistors N- Channel Enhancement- Mode Lateral MOSFETs

Adding SDIO Wi-Fi Solution to i.mx Windows CE 5.0/Windows CE 6.0

LOW POWER SCHOTTKY. GUARANTEED OPERATING RANGES ORDERING INFORMATION

DRM for Driver Information System on S12G128. Reference Design

Solder Joint Temperature and Package Peak Temperature Determining Thermal Limits during Soldering

Transcription:

Freescale Semiconductor Application Note AN2821 Rev. 2, 08/2007 etpu Host Interface by: David Paterson Ming Li MCD Applications 1 Introduction This application note discusses the enhanced Time Processing Unit (etpu), hardware and software of the host interface, and describes the software integration. See http://www.freescale.com/etpu for etpu software and examples. The etpu is the new generation of a Time Processing Unit (TPU) by Freescale. Besides the hardware enhancement, significant improvements over TPU have been made to the accompanying software development tools; these tools make the etpu easy to use. A high level (C) language compiler has been developed so the etpu can be programmed using C language instead of microcode. To program the etpu effectively, you must have a clear understanding of how the etpu hardware works. Coding in C, the programmer can leave the mechanics of the etpu programming to the compiler (parameter packing, micro-instruction packing, etc.) and focus more on the Contents 1 Introduction................................... 1 2 Overview..................................... 2 3 etpu and Host Interface Hardware................ 3 4 Host Interface Software......................... 4 4.1 Initialization Overview....................... 4 4.2 etpu Module Initialization.................... 5 4.3 etpu Channel Initialization................... 6 4.4 etpu Function Initialization................... 6 4.5 etpu and Host Interactive Control............. 7 5 Software Integration............................ 7 6 Conclusion.................................... 7 Freescale Semiconductor, Inc., 2007. All rights reserved.

application logic. With the help of the etpu simulator and debugger, etpu software can be developed much like the software for the host CPU. Productivity of software development can be significantly improved. The introduction of the etpu C compiler also changes the way the host interfaces to the etpu functions. With the help of the compiler, the same symbol can be referenced by the etpu and host software. The host software can interface with etpu functions via application programming interface (API) functions, instead of accessing physical memory locations and registers. The host application can call these API functions to interface with the etpu. The references to these API functions and symbols for parameters are resolved at compile time. The implementation details of the etpu functions are hidden from the host application. This design improves the flexibility of the etpu functions implementation and the portability of the host application code. This application note discusses how to build the host interface for etpu functions. 2 Overview Host interface software adds another layer of abstraction between the host CPU and etpu. The host interface API functions hide the complexity of the interaction between the host CPU and etpu, providing a simple interface for host applications. Ideally, every etpu function shall have one or more host interface API functions. The interface software between host and etpu facilitates three major tasks: etpu hardware initialization configure etpu peripheral hardware etpu function initialization pass initial parameters and initiate function execution etpu function run time interactive control update function parameters and manages handshaking After the etpu peripheral and etpu functions are initialized, each etpu function can start to execute with initial function parameters. The host interface API functions need to be provided for interactive control such as parameters updating, control mode changing, etc. To update the parameter or change control mode, the host is responsible for passing updated parameters to the etpu functions and then informing the etpu that the function parameters have changed. If a coherent change of function parameters is required, the logic has to be built in the etpu functions to ensure the coherency. For some etpu functions, the interaction between host and etpu is an essential part of the operation. In host and etpu software, the logic is needed to manage the handshaking between host and etpu. The interaction between the etpu and host can be encapsulated in the host interface API functions. The host code and etpu code are compiled by different compilers. The host compiler is normally used to build a single code image for host and etpu. To build etpu code and host code together, the etpu software building information (i.e. etpu code image) has to be exported to the host compiler. The symbol information has to be exported from the etpu compiler to the host compiler as well. For the Byte Craft etpu compiler, the mechanism is implemented as a set of host interface macros. In the etpu code, these macros are inserted to generate proper executable and symbol information for the host compiler. 2 Freescale Semiconductor

3 etpu and Host Interface Hardware Figure 1 shows the host interface hardware for the etpu. The host and etpu can communicate to each other via event or by data. The host has access to all etpu host interface registers. When the host wants the etpu s services, it can issue the host service request (HSR) by writing the etpu channel control registers. After the host service request is acknowledged, a thread of etpu code associated with this HSR is activated for execution. The etpu code in the thread implements the functions requested by the host. When etpu needs the host service, it can issue the interrupt request or DMA data transfer request, or generate a global exception. The events handling logic is needed in the host software to provide services to the etpu corresponding to these requests. The etpu code memory (RAM) and data memory (RAM) are accessible by host and etpu. The etpu code memory stores the etpu executable binary image. At the power up initialization, following the defined sequences, the host transfers the etpu code stored in the flash memory to the etpu code memory. During the execution, the etpu micro-engine fetches the micro-instructions from the code memory. Figure 1. etpu Host Interface Hardware The etpu data memory provides for data sharing between the host and etpu engines. The etpu can read and write the etpu data memory in any data size (8, 16, 24, and 32 bit). However, the host can only read and write in 8, 16, and 32 bits. A virtual mirror memory space of the normal etpu data memory, parameter sign extension (PSE) memory space, has been created to allow for converting the 24-bit data. This allows the host to read signed 24-bit data and write signed and unsigned 24 bit data. Freescale Semiconductor 3

4 Host Interface Software The function partition between the application software and low-level driver is defined during the software architecture design. To make the software portable, the application software is normally designed to interface with the low-level driver via abstracted interface APIs. The host interface of the etpu functions should be designed so the implementation of the low-level driver is hidden from the application software. After the application software interface to the low-level driver is defined, the functionality of the low-level driver can be partitioned between host CPU and etpu. The etpu interface software running on the host CPU is an integral part of the low-level driver. It manages the details of the interaction between host and etpu. The etpu code and host interface code are compiled by two different compilers. To resolve the etpu code symbol reference in the host code, it is necessary to export the symbolic information from the etpu compiler to the host compiler. Similarly, to build a single executable image, it is necessary to export etpu code image to the host compiler. Several types of information are exported from etpu_c through host interface files, generated from #pragma write statements during compilation. For detailed information on #pragma write, see the etpu_c documentation. 4.1 Initialization Overview The etpu initialization is an important part of the host interface. At the power up, the host has to configure the etpu peripheral properly before the etpu function can be executed. The etpu initialization process is accomplished by host CPU and etpu. During the initialization, the functional partition between host CPU and etpu is as follows: Host responsibility: etpu module initialization etpu channel configuration Providing initial etpu function parameters Initiating the etpu function execution etpu Responsibility: Responding to the HSR Transitioning into the initialization state The etpu initialization can be broken down into three steps: etpu module initialization, etpu channel initialization and etpu function initialization. The following sections discuss the interface design and the data exchange between host CPU and etpu for each step of initialization. 4 Freescale Semiconductor

4.2 etpu Module Initialization At the power up initialization, the etpu peripheral hardware is configured by the host. The etpu module initialization includes the following steps: 1. Initialize etpu global registers etpu MISC compare register (ETPU_MISCCMPR) etpu module configuration register (ETPU_MCR) etpu time base configuration register (ETPU_TBCR) etpu STAC bus configuration register (ETPU_STACR) etpu engine configuration register (ETPU_ECR) 2. Load etpu code to etpu code RAM 3. Copy initial values of etpu code global variables to etpu data memory Most of the information required to configure the etpu global registers are not dependent on the etpu software implementation (time base, clock frequency, entry table address, etc.). The configuration information is determined during the host peripheral configuration and resource allocation. Only the MISC value depends on the actual etpu software implementation; it has to be exported to the host program after the etpu code is compiled. The etpu_c compiler provides a macro (::ETPUmisc) to calculate the MISC value of the etpu code image. The etpu code image is generated when the etpu C program is compiled. To use this code in the host program, the etpu code image can be exported as an array of constant values. The etpu_c compiler provides a macro (::ETPUcode) to generate and export the etpu code image. The etpu code image constant array is suitable to be included in the host source code. The host compiler locates the etpu code image array at host source code compile time. Because the etpu micro-engine can only fetch micro-instructions out of etpu code memory (RAM), at the power up initialization, the etpu code image has to be loaded to etpu code memory. As it is in the standard C syntax, when the etpu code is compiled, the global variables are allocated to the etpu data memory and the initial values are assigned to the corresponding memory locations. The standard C syntax requires that all global variables are declared outside of any function. For etpu, this means that all global variables have to be declared outside of any execution thread. Because only the code in a thread can be executed on etpu, the global variable initial value assignment statements are not executed. The global variables cannot be initialized in the etpu code; they must be initialized by the host. The software statements have to be added to the host code to initialize the etpu global variables. The initialization values have to be exported from the etpu compiler to host compiler. The etpu_c compiler provides a macro (::ETPUglobalimage) to capture initial values for all global variables and exports them as a constant array. At power up initialization, the global variable initial values are loaded to the etpu data memory for global variables. The host interface macros have to be added to the etpu code in #pragma write statements to export the etpu software information to the host compiler. These statements generate header files that contain the MISC value, etpu code image and global variable memory image. Freescale Semiconductor 5

4.3 etpu Channel Initialization After the etpu module is configured, each channel on the etpu module can be configured. The etpu channel initialization includes the following tasks: etpu channel configuration registers initialization Assign etpu function to a channel Configure interrupt/dma/output enable Select etpu function entry table encoding Assign the function frame to a channel Set-up channel priority etpu channel status control register initialization Set-up etpu function mode The etpu channel assignment and the channel priority determination are a part of the host software architecture design. They are independent of the etpu functions implementation. The information for the configuration is provided by the host software design. During the channel initialization, a section of etpu data memory is assigned to each channel. This memory section is the function frame. The function frame contains all the function parameters and static local variables used by the etpu function. The starting address of the function frame is assigned to the channel at initialization. The function frame assignment can be static or dynamic. Dynamic allocation assigns the function frame to the channel based on the next available memory space. The availability of the etpu data memory depends on the number of functions that have been assigned and the number of parameters the function is using. Dynamic allocation can reduce the etpu data memory consumption by minimizing unused memory holes. To allocate the function frame dynamically, the host must know the function frame consumption by a particular etpu function. The etpu_c compiler provides a macro (::ETPUram) to report the number of parameters and static local variables used by a function at compile time. After the host interface macros are added to the etpu code, the #pragma write statements generate a header file that contains all the etpu function configuration and software symbol information at compile time. The header file can be included in the host interface code to resolve symbol references. 4.4 etpu Function Initialization The etpu function initialization is the last step of the etpu initialization process. During the etpu function initialization, the host is responsible for passing the parameters to the etpu functions and initiating the etpu function execution by issuing a host service request. After the host service request for initialization is recognized, the etpu transitions to the initialization state. Unlike in the host CPU, the etpu function parameters passed from host are not placed on the stack. Instead, memory in the function frame is allocated to accommodate every function parameter. The host passes the etpu function parameters by writing directly to the etpu function frame. The host needs to know the function frame address for each channel, as well as the data type and address offset for every parameter. The function frame address can be derived by reading the etpu channel base address register. 6 Freescale Semiconductor

The etpu_c compiler provides the host interface macros to export the offset of each function parameter; use them in #pragma write directives to export this information. The function parameters can be 8-bit, 16-bit, or 32-bit. The etpu compiler can allocate function parameters at 8-, 16-, 24-, or 32-bit boundaries. To pass 8-bit or 16-bit parameters, the host can directly write to etpu data memory. Most etpu data registers and timers are 24-bit. To pass 24-bit etpu function parameters, the host needs to pass a 32-bit parameter to the etpu. Because the host cannot access etpu data memory on the 24-bit boundary, the host code needs to realign the parameter to the 32-bit address boundary before writing it to the function frame. It is the responsibility of the host to ensure the function parameters are within proper range. It is also the responsibility of the host when writing the 24-bit parameter to ensure that the upper byte on the function frame is not corrupted. Similarly, when reading a 24-bit return value from the function frame, the host code must mask the upper byte before returning the correct 24-bit value. To simplify the interface code, it is recommended to access the 24-bit function parameter by using PSE memory space. 4.5 etpu and Host Interactive Control After the etpu function is initialized, it starts execution based on the initial parameters and input/output conditions. The API for the host application code updates the function parameter or changes the control mode. Similarly, host software must provide proper logic to manage the etpu interrupt or DMA requests. Some etpu functions require host or DMA service. The etpu software can write the CIRC bits in the channel interrupt and data transfer request register to send the request to the host or DMA. The interrupt service routine must be added and the DMA channel must be configured in the host code to respond to the etpu request. The host interface software has to provide functions to update etpu function parameters or change the control mode during the normal operation. Similar to the function initialization API, the interface API function needs to check the validity of the parameters, write them to the etpu data memory, and then issue the host service request to inform etpu that the parameters are newly updated. 5 Software Integration The etpu code and host CPU code are compiled and linked separately. The etpu code needs to be built first to generate and export the etpu code image and parameter symbol information. The host code needs to include these files properly to resolve all the symbol reference between etpu and host code. This software build dependency can be added easily to the makefile to ensure the proper sequence. 6 Conclusion The benefit of the host interface design is to isolate any hardware dependency from the application software by means of the host interface API functions. In the etpu host interface design, all the interactions between host and etpu are encapsulated in the interface API functions. With this interface design, the implementation of the low-level driver can be hidden from the host application. Numerous examples are available in the general set and APIs available from Freescale.com. Freescale Semiconductor 7

How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor, Inc. Technical Information Center, EL516 2100 East Elliot Road Tempe, Arizona 85284 +1-800-521-6274 or +1-480-768-2130 www.freescale.com/support Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) www.freescale.com/support Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 support.japan@freescale.com Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong +800 2666 8080 support.asia@freescale.com For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado 80217 1-800-441-2447 or 303-675-2140 Fax: 303-675-2150 LDCForFreescaleSemiconductor@hibbertgroup.com Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals, must be validated for each customer application by customer s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and electrical characteristics as their non-rohs-compliant and/or non-pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. For information on Freescale s Environmental Products program, go to http://www.freescale.com/epp. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2007. All rights reserved. Document Number: AN2821 Rev. 2 08/2007