General C Functions for the etpu Covers the MCF523x, MPC5500, MPC5600, MPC5700, MPX40 and all etpu-equipped Devices

Similar documents
Working around ERR7026 according to application needs

Adding a run control interface into an existing CodeWarrior for MCU v10.x project

DDR Validation Tool Getting Started Guide

i.mx 6Solo/6DualLite Product Lifetime Usage Estimates

FRDM-K64F Board Errata

Getting Started with Freescale MQX RTOS for Kinetis SDK and MDK-ARM Keil

Processor Expert Software for i.mx Processors Version 1.0

CodeWarrior Development Studio Processor Expert RTOS Adapter User Guide

Using DMA for Pulse Counting on S32K

How to setup pre-build steps in CodeWarrior for Microcontrollers v10.x

Getting Started with Freescale MQX RTOS for Kinetis SDK and Kinetis Design Studio IDE

Component Development Environment Getting Started Guide

Generating a Quick and Controlled Waveform With the DAC

MQX RTOS Release Notes for Kinetis SDK v1.2.0 for KL33Z64 for FRDM-KL43Z Freescale Freedom Development Platform

MQX RTOS Release Notes for Kinetis SDK FRDM- KV10Z Freescale Freedom Development Platform

Single Chip Module (SCM) Package-on- Package (PoP) Assembly Guide

CodeWarrior Development Studio for StarCore 3900FP DSP v SP3 Release Notes

PMSM Field-Oriented Control Using MC56F84789 DSC With Encoders Demo Guide

TWR-KV10Z32 Sample Code Guide for CodeWarrior Board configuration, software, and development tools

Building U-Boot in CodeWarrior ARMv8

Freedom FRDM-MC-LVBLDC Development Platform User s Guide

MMPF0100 Errata for Mask 1N47F and 1N18J

i.mx 6 Android JB 4.3_1.1.1 Patch Release Notes

Collecting Linux Trace without using CodeWarrior

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

P1010RDB-PB Quick Start Guide

HVP-KV10Z32 User s Guide

Getting Started with Freescale MQX RTOS for Kinetis SDK and ARM GCC

Kinetis Updater User's Guide

Intelligent Sensing Framework 2.1 for Kinetis Errata Sheet

Emulating Dual SPI Using FlexIO

Quick Start Guide for FRDM-FXS-MULTI-B

Watt Saver Software Component (WSC)

Using an External GCC Toolchain with CodeWarrior for Power Architecture

i.mx 6UltraLite Product Usage Lifetime Estimates

i.mx 6ULL Product Usage Lifetime Estimates

Load Position-Independent Code (PIC) on a Kinetis Platform Using the IAR EWARM Compiler

Kinetis USB-KW41Z Wireless Protocol Sniffer Quick Start Guide

Freescale MKW40Z IEEE Software Quick Start Guide

AIOP Task Aware Debug

etpu Automotive Function Set (Set 2)

Integrate TWR-EPD Software with MQX RTOS Based on the TWR-K21F120M Platform

Configuring DDR in U-Boot using QCVS

Emulating I2C Bus Master by using FlexIO

i.mx 7 Dual/Solo Product Lifetime Usage

HVP-MC56F82748 User s Guide

Understanding S08P Internal Clock Source

New VLE Instructions for Improving Interrupt Handler Efficiency Robert Moran Applications Engineer Microcontroller Solutions Group

Kinetis SDK Release Notes for the TWR-K24F120M Tower System Module

TWR-LS1021A Getting Started

i.mxrt1050 Product Lifetime Usage Estimates

Getting Started with MQX RTOS for Kinetis SDK

S12VR Hardware Design. Guidelines. 1 Introduction. 2 Hardware Design. Guidelines. 2.1 Voltage regulator. Freescale Semiconductor

Using the MPC5777M MCAN Module to Exchange CAN FD Messages

MM912_634, Silicon Analog Mask (M91W) / Digital Mask (N53A) Errata

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

HVP-KV31F120M User s Guide

KIT33972AEWEVBE Evaluation Board

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

PCIe Certification Guide for i.mx 6Dual/6Quad and i.mx 6Solo/6DualLite

Getting Started with the MCU Flashloader

Freescale MQX USB Stack for TWR-K24F120M GA User s Guide

Kinetis Bootloader to Update Multiple Devices in a Field Bus Network

Mask Set Errata for Mask 2N27B

Using FCCU on MPC5744P

Controller Continuum. for Microcontrollers V6.3. Quick Start

Getting Started with MCUXpresso SDK CMSIS Packs

Getting Started with Pins Tool User's Guide

Three-Phase Power Meter Hardware Design Reference Manual

Kinetis Bootloader v1.2.0 Release Notes

for ColdFire Architectures V7.2 Quick Start

Freescale Semiconductor Data Sheet: Technical Data

OpenSDA on TWR-KW2x. User s Guide Rev 1.1

Mask Set Errata for Mask 0N22G

MPXHZ6130A, 15 to 130 kpa, Absolute, Integrated Pressure Sensor

Using the Xtrinsic FXLS8471CQ Transient-Acceleration Function

How to use FlexMemory as D-Flash and EEPROM in KE1xF

Engine Control etpu Library Covers all MPC5500, MPC5600, and MPC5700 Devices Featured with the Enhanced Time Processing Unit (etpu)

MPC7410 RISC Microprocessor Hardware Specifications Addendum for the MPC7410TxxnnnLE Series

Table of Contents 1 Typical Applications General Description Block Diagram Pinout System Connections Typical A

Kinetis SDK v Release Notes for KV5x Derivatives

Using the Knock Window etpu Function

KIT34901EFEVB Evaluation Board

etpu General Function Set (Set 1) David Paterson MCD Applications Engineer

TWR-LS1021A Getting Started

Flash Core Voltage Supply Requirements and Considerations

High Volume Pressure Sensor for Disposable Applications

MP3V5050V, -50 to 0 kpa, Gauge Pressure Sensor

Freescale Kinetis Software Development Kit Release Notes

Model Based Development Toolbox MagniV for S12ZVC Family of Processors

Quick Start Guide for FRDM-KL05Z

Freescale MQX USB Device API Reference Manual

Using an FFT on the Sigma-Delta ADCs

for Freescale MPC55xx/MPC56xx Microcontrollers V2.10 Quick Start

for StarCore DSP Architectures Quick Start for the Windows Edition

QCVS Frame Distributor Wizard User Guide

Mask Set Errata for Mask 3N86B

SPI topics: watchdog, serial output and parity check

Quick Start Guide for the Freescale Freedom Development Platform FRDM-KL43Z

Smart Plug Software Design Reference Manual

Transcription:

Freescale Semiconductor Document Number: AN2864 Application Note Rev. 2, 09/2015 General C Functions for the etpu Covers the MCF523x, MPC5500, MPC5600, MPC5700, MPX40 and all etpu-equipped Devices by: Milan Brejl and Jeff Loeliger 1 Introduction The Enhanced Time Processing Unit (etpu) is a programmable I/O controller with its own core and memory system, allowing it to perform complex timing and I/O management independently of the CPU. The etpu module is a peripheral for 32-bit devices on the automotive and industrial markets (currently Power Architecture MPC5700, MPC5600 and MPC5500 families, PXR40 and the ColdFire MCF523x). This application note provides simple C interface routines to the etpu module. Contents 1 Introduction...1 2 Functional Overview... 1 3 Functional Description......3 4 etpu Initialization Template...3 5 etpu Project Structure...3 6 Summary...... 4 2 Functional Overview The etpu Utilities etpu_util.c/.h includes low-level functions for using the etpu or etpu2 module. Using these functions prevents the upper software level from direct access to etpu registers. The included routines can be divided into several groups by application usage: etpu Module Initialization fs_etpu_init fs_etpu2_init (etpu2-only) etpu Channel Initialization 2015 Freescale Semiconductor, Inc.

Functional Overview fs_etpu_chan_init fs_etpu_malloc fs_etpu_malloc2 Run-Time etpu Module Control fs_timer_start fs_etpu_get_global_exceptions, fs_etpu_clear_global_exceptions fs_etpu_get_global_error Run-Time etpu Channel Control fs_etpu_get_hsr, fs_etpu_set_hsr fs_etpu_enable, fs_etpu_disable fs_etpu_interrupt_enable, fs_etpu_interrupt_disable fs_etpu_get_chan_interrupt_flag, fs_etpu_clear_chan_interrupt_flag fs_etpu_get_chan_interrupt_oveflow_flag, fs_etpu_clear_chan_interrupt_oveflow_flag fs_etpu_dma_enable, fs_etpu_dma_disable fs_etpu_get_chan_dma_flag, fs_etpu_clear_chan_dma_flag fs_etpu_get_chan_dma_oveflow_flag, fs_etpu_clear_chan_dma_oveflow_flag etpu DATA RAM Access fs_etpu_data_ram fs_etpu_get_chan_local_32, fs_etpu_get_chan_local_24, fs_etpu_get_chan_local_24s, fs_etpu_get_chan_local_16, fs_etpu_get_chan_local_8 fs_etpu_set_chan_local_32, fs_etpu_set_chan_local_24, fs_etpu_set_chan_local_16, fs_etpu_set_chan_local_8 fs_etpu_get_global_32, fs_etpu_get_global_24, fs_etpu_get_global_24s, fs_etpu_get_global_16, fs_etpu_get_global_8 fs_etpu_set_global_32, fs_etpu_set_global_24, fs_etpu_set_global_16, fs_etpu_set_global_8 fs_etpu_coherent_read_32, fs_etpu_coherent_read_24 fs_etpu_coherent_write_32, fs_etpu_coherent_write_24 etpu Load Evaluation fs_etpu_get_idle_cnt_a, fs_etpu_clear_idle_cnt_a (etpu2-only) fs_etpu_get_idle_cnt_b, fs_etpu_clear_idle_cnt_b (etpu2-only) Others fs_memcpy32, fs_memset32 When the etpu is used in an application, the first etpu task is the etpu module initialization. The fs_etpu_init() function initializes the etpu global settings, including uploading the etpu code into CODE RAM, initialization of time-bases, and more. On etpu2, the fs_etpu_init2() function can be consequently used to initialize etpu2-only settings. Individual etpu channels can be initialized after the etpu module initialization. The etpu channel initialization includes configuration of channel registers (fs_etpu_chan_init()) and allocation of DATA RAM (fs_etpu_malloc(), fs_etpu_malloc2()). This task requires detailed information about the etpu function design. That is why each Freescale etpu function comes with API routines for the CPU, which handles the channel initialization and run-time interfaces. The channel initialization API routine must use the fs_etpu_malloc() or fs_etpu_malloc2() for proper allocation of the etpu DATA RAM. After the etpu module and etpu channels are initialized, all etpu channels can be started synchronously by fs_timer_start(), which starts global time-bases common for etpu and emios. The run-time etpu module control functions include also routines to handle the global module exceptions (fs_etpu_get_global_exceptions(), fs_etpu_clear_global_exceptions()) and global error (fs_etpu_get_global_error()). The run-time etpu channel control functions include enabling, disabling, checking and clearing channel interrupts and channel DMA requests, enabling and disabling a channel operation and passing a host service request to a channel. 2 Freescale Semiconductor, Inc.

Functional Description The etpu function API routines uses the etpu DATA RAM access functions to read or write channel-local or global etpu variables. The etpu features hardware for coherent read or write of 2 variables in DATA RAM. Its usage is supported by fs_etpu_coherent_read/write_32/24(). The etpu2 features a support for etpu load evaluation. There are Idle Counter registers on each engine which can be accessed using fs_etpu_get/clear_idle_cnt_a/b(). 3 Functional Description A detailed description of each etpu utility function is included in the source code. For easier reading, documentation in a format of Microsoft Compiled HTML Help (CHM) is generated by DoxyGen and included with the source code in AN2864SW package as doxygen.chm. Additionally, the same documentation in a form of a set of HTML files packed into a single ZIP package is included. 4 etpu Initialization Template A template of etpu initialization code is included in AN2864SW package, in folder init_template. The file etpu_gct.c_ creates two functions to be used by the application in order to initialize the etpu. The function my_system_etpu_init() should be called within initialization of device modules. The function my_system_etpu_start() should be called after all device modules, including the interrupt and DMA controller, are configured. This function effectively starts the etpu. The file etpu_gct.c_ also defines an etpu configuration structure (my_etpu_config) which includes all global etpu settings. The file etpu_gct.h_ includes an assignment of etpu functions to channels and definition of masks enabling channel interrupts, DMA requests and output disable feature for individual channels. Initialization of individual channel functions is assumed to be handled by function API calls, which is indicated in my_system_etpu_init(). 5 etpu Project Structure Figure 1. etpu project Structure An application using the etpu module should include the following files: etpu_struct.h, which defines the etpu registers etpu_util.c/.h, which includes low-level etpu utilities etpu_<func>.c/.h, which are the etpu function APIs, handling the initialization and run-time interface of the individual etpu functions, using the etpu low-level utilities Freescale Semiconductor, Inc. 3

Summary etpu_gct.c/.h, which includes etpu initialization code specific for the user application, implemented using etpu utilities and API calls main.c, which stands for the actual application code, implemented using etpu_gct function calls for initialization and API calls for run-time etpu interface. 6 Summary This application note provides overview of general C functions for the etpu (etpu utilities) and their usage. The source code of these functions is available for download from the Freescale web package AN2864SW. A detailed description of individual utility functions is included with the source code (doxydoc.chm). The etpu utilities can be used on any device featuring the etpu module. Both module versions, etpu and etpu2, are supported. 4 Freescale Semiconductor, Inc.

How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale 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 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 does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: freescale.com/salestermsandconditions. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. MagniV is trademark of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2015 Freescale Semiconductor, Inc. Document Number AN2864 Revision 2, 09/2015