Spru 433 J
Spru 433 J
Spru 433 J
IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TIs terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TIs standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions:
Products Amplifiers Data Converters DSP Interface Logic Power Mgmt Microcontrollers amplifier.ti.com dataconverter.ti.com dsp.ti.com interface.ti.com logic.ti.com power.ti.com microcontroller.ti.com Applications Audio Automotive Broadband Digital Control Military Optical Networking Security Telephony Video & Imaging Wireless Mailing Address: Texas Instruments Post Office Box 655303 Dallas, Texas 75265 www.ti.com/audio www.ti.com/automotive www.ti.com/broadband www.ti.com/digitalcontrol www.ti.com/military www.ti.com/opticalnetwork www.ti.com/security www.ti.com/telephony www.ti.com/video www.ti.com/wireless
Preface
API module support for various C5000 devices, and lists the API modules.
- Chapter 2 provides basic examples of how to use CSL functions, and
shows how to define Build options in the Code Composer Studio environment.
- Chapters 3-21 provide basic examples, functions, and macros, for the in-
iii
Notational Conventions
Notational Conventions
This document uses the following conventions:
- Program listings, program examples, and interactive displays are shown
in a special typeface.
- In syntax descriptions, the function or macro appears in a bold typeface
and the parameters appear in plainface within parentheses. Portions of a syntax that are in bold should be entered as shown; portions of a syntax that are within parentheses describe the type of information that should be entered.
- Macro names are written in uppercase text; function names are written in
lowercase.
- TMS320C55x DSP devices are referred to throughout this reference
iv
Trademarks
Trademarks
The Texas Instruments logo and Texas Instruments are registered trademarks of Texas Instruments. Trademarks of Texas Instruments include: TI, Code Composer Studio, DSP/BIOS, and the TMS320C5000 family and devices. All other brand or product names are trademarks or registered trademarks of their respective companies or organizations.
vi
Contents
Contents
1 CSL Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 1.1 Introduction to CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1.1.1 How the CSL Benefits You . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1.1.2 CSL Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1.2 Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 1.3 CSL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 1.4 CSL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 1.4.1 Peripheral Initialization via Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 1.4.2 Peripheral Initialization via Functional Parameters . . . . . . . . . . . . . . . . . . . . . . 1-10 1.5 CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 1.6 CSL Symbolic Constant Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 1.7 Resource Management and the Use of CSL Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 1.7.1 Using CSL Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14 How to Use CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Using the CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Using the DMA_config() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Compiling and Linking with the CSL Using Code Composer Studio . . . . . . . . . . . . . . . . 2.3.1 Specifying Your Target Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ADC Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CHIP Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 CHIP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 2-2 2-2 2-2 2-7 2-7 3-1 3-2 3-4 3-5 3-8 3-9 4-1 4-2 4-2 4-3 4-4
Contents
DMA Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 6.1.1 DMA Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 6.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 6.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 6.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 EMIF Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7.1.1 EMIF Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.2 Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 GPIO Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 8.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 8.2 Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 8.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 8.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 HPI Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 9-2 9-4 9-5 9-6
10 I2C Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.1.1 I2C Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 10.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 10.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7 10.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17 10.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18 11 ICACHE Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 IRQ Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1.1 The Event ID Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 Using Interrupts with CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
viii
11-1 11-2 11-3 11-5 11-8 12-1 12-2 12-3 12-7 12-8
Contents
12.4
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
13 McBSP Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1 13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 13.1.1 MCBSP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3 13.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6 13.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7 13.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8 13.5 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23 13.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26 14 MMC Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1 14.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 14.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5 14.3 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6 14.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13 15 PLL Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 PWR Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.1.1 PWR Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.3 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1 15-2 15-4 15-5 15-7 16-1 16-2 16-2 16-3 16-4
17 RTC Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1 17.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2 17.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6 17.3 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9 17.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16 18 Timer Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 UART Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19.3.1 CSL Primary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
18-1 18-2 18-3 18-4 18-9 19-1 19-2 19-5 19-8 19-8
ix
Contents
19.4
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-14 19.4.1 General Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-14 19.4.2 UART Control Signal Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-15
20 WDTIM Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-1 20.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2 20.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-3 20.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-4 20.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-14 21 GPT Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-1 21-2 21-3 21-4
Figures
Figures
11 21 22 23 CSL Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Defining the Target Device in the Build Options Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Defining Large Memory Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Defining Library Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Contents
xi
Tables
Tables
11 12 13 14 15 16 17 18 21 31 32 33 34 41 42 43 51 61 62 63 64 71 72 73 74 81 82 83 91 92 93 94 101 102 103 104
xii
CSL Modules and Include Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 CSL Device Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 CSL Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 CSL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Generic CSL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Generic CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 Generic CSL Macros (Handle-based) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12 Generic CSL Symbolic Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 CSL Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 ADC Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 ADC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 ADC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 ADC Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 CHIP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 CHIP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 CHIP Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 DAT Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 DMA Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 DMA Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 DMA Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 DMA Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 EMIF Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 EMIF Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 EMIF CSL Macros Using EMIF Port Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 GPIO Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 GPIO Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 GPIO CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 HPI Module Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 HPI Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 HPI Registers and Bit Field Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 HPI Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 I2C Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 I2C Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 I2C Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 I2C Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17
Tables
111 112 113 121 122 123 131 132 133 134 135 141 142 143 144 151 152 153 154 161 162 163 171 172 173 174 175 181 182 183 184 185 191 192 201 202 211 212
ICACHE Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 ICACHE Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 ICACHE CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8 IRQ Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2 IRQ Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3 IRQ_EVT_NNNN Events List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4 McBSP Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 McBSP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 MCBSP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3 McBSP Macros Using McBSP Port Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23 McBSP CSL Macros Using Handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-24 MMC Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 MMC Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 MMC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 OCR Register Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-24 PLL Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 PLL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 PLL Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3 PLL CSL Macros Using PLL Port Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7 PWR Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2 PWR Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2 PWR CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4 RTC Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3 RTC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3 RTC ANSI C-Style Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4 RTC Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5 TIMER Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 TIMER Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 TIMER CSL Macros Using Timer Port Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9 TIMER CSL Macros Using Handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10 UART APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 UART CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-14 WDTIM Structure and APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2 WDTIM CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-14 GPT Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2 GPT Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2
Contents
xiii
Examples
Examples
11 12 21 121 131 Using PER_config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Using PER_setup() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10 Using a Linker Command File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Manual Interrupt Setting Outside DSP/BIOS HWIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7 McBSP Port Initialization Using MCBSP_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26
xiv
Chapter 1
CSL Overview
This chapter introduces the Chip Support Library, briefly describes its architecture, and provides a generic overview of the collection of functions, macros, and constants that help you program DSP peripherals.
Topic
1.1 1.2 1.3 1.4 1.5 1.6 1.7
Page
Introduction to CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 CSL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 CSL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8 CSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 CSL Symbolic Constant Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13 Resource Management and the Use of CSL Handles . . . . . . . . . . . . 1-14
1-1
Introduction to CSL
1.1.1
The CSL provides you with a standard protocol to program on-chip peripherals. This protocol includes data types and macros to define a peripherals configuration, and functions to implement the various operations of each peripheral.
- Basic Resource Management
Basic resource management is provided through the use of open and close functions for many of the peripherals. This is especially helpful for peripherals that support multiple channels.
- Symbol Peripheral Descriptions
As a side benefit to the creation of the CSL, a complete symbolic description of all peripheral registers and register fields has been created. It is suggested you should use the higher level protocols described in the first two benefits, as these are less device-specific, thus making it easier to migrate code to newer versions of DSPs.
1.1.2
CSL Architecture
The CSL consists of modules that are built and archived into a library file. Each peripheral is covered by a single module while additional modules provide general programming support. Figure 11 illustrates the individual CSL modules. This architecture allows for future expansion because new modules can be added as new peripherals emerge.
CSL
DAT
CHIP
DMA
...
McBSP TIMER
...
1-2
Introduction to CSL
Although each CSL module provides a unique set of functions, some interdependency exists between the modules. For example, the DMA module depends on the IRQ module because of DMA interrupts; as a result, when you link code that uses the DMA module, a portion of the IRQ module is linked automatically. Each module has a compile-time support symbol that denotes whether or not the module is supported for a given device. For example, the symbol _DMA_SUPPORT has a value of 1 if the current device supports it and a value of 0 otherwise. The available symbols are located in Table 11. You can use these support symbols in your application code to make decisions.
CSL Overview
1-3
Introduction to CSL
Description Analog-to-digital converter General device module A data copy/fill module based on the DMA C55x DMA peripheral External memory bus interface Non-multiplexed general purpose I/O I2C peripheral Instruction cache Interrupt controller Multichannel buffered serial port Multimedia controller PLL Power savings control Real-time clock Timer peripheral Watchdog timer USB peripheral Universal asynchronous receiver/ transmitter Host port interface 64-bit General purpose timer
Include File csl_adc.h csl_chip.h csl_dat.h csl_dma.h csl_emif.h csl_gpio.h csl_i2c.h csl_icache.h csl_irq.h csl_mcbsp.h csl_mmc.h csl_pll.h csl_pwr.h csl_rtc.h csl_timer.h csl_wdtim.h csl_usb.h csl_uart.h csl_hpi.h csl_gpt.h
Module Support Symbol _ADC_SUPPORT _CHIP_SUPPORT _DAT_SUPPORT _DMA_SUPPORT _EMIF_SUPPORT _GPIO_SUPPORT _I2C_SUPPORT _ICACHE_SUPPORT _IRQ_SUPPORT _MCBSP_SUPPORT _MMC_SUPPORT _PLL_SUPPORT _PWR_SUPPORT _RTC_SUPPORT _TIMER_SUPPORT _WDT_SUPPORT _USB_SUPPORT _UART_SUPPORT _HPI_SUPPORT _GPT_SUPPORT
Information and instructions for the configuration of the USB module are found in the TMS320C55x CSL USB Programmers Reference Guide (SPRU511).
1-4
Introduction to CSL
Table 12 lists the C5000 devices that the CSL supports and the large and small-model libraries included in the CSL. The device support symbol must be used with the compiler (d option), for the correct peripheral configuration to be used in your code.
CSL Overview
1-5
Naming Conventions
- All functions, macros, and data types start with PER_ (where PER is the
if the function name consists of two separate words. For example, PER_getConfig().
- Macro
all
uppercase
letters;
for
example,
1-6
CSL Overview
1-7
CSL Functions
[handle] is required only for the handle-based peripherals: DAT, DMA, McBSP, and TIMER. See section 1.7.1. [priority] is required only for the DAT peripheral module.
tion 1.4.1).
- Using functional parameters using the PER_setup() function and vari-
ous module specific functions (see section 1.4.2). This method provides a higher level of abstraction compared with the direct register initialization method, but typically at the expense of a larger code size and higher cycle count. Note: These functions are not available for all CSL peripheral modules.
1-8
CSL Functions
PER_setup( [handle,] *setupStructure ) PER_start( [handle,]) [txrx,] [delay] ) PER_reset( [handle] ) PER_close( handle )
Closes a peripheral channel previously opened with PER_open(). The registers for the channel are set to their power-on defaults, and any pending interrupt is cleared.
1.4.1
appropriate register values and pass the address of that structure to the function, which then writes the values to the writable register. Example 11 shows an example of this method. The CSL also provides the PER_REG_RMK (make) macros, which form merged values from a list of field arguments. Macros are covered in section 1.5, CSL Macros.
CSL Overview 1-9
CSL Functions
1.4.2
1-10
CSL Macros
constant (PER_REG_DEFAULT), or a merged field value created with the PER_REG_RMK() macro.
- fieldval indicates an integer constant, integer variable, macro, or symbolic
constant (PER_REG_FIELD_SYMVAL) as explained in section 1.6; all field values are right justified. CSL also offers equivalent macros to those listed in Table 16, but instead of using REG# to identify which channel the register belongs to, it uses the Handle value. The Handle value is returned by the PER_open() function. These macros are shown Table 17. Please note that REG is the register name without the channel/port number.
CSL Overview
1-11
CSL Macros
If applicable, gets the memory address (or sub-address) of the peripheral register REG#.
Writes the value to the peripheral register REG associated with Handle.
If applicable, gets the memory address (or sub-address) of the peripheral register REG associated with Handle. Returns the value of the specified FIELD in the peripheral register REG associated with Handle.
Sets the value of the specified FIELD in the peripheral register REG to fieldval.
1-12
tion of the DAT module, which does not have its own registers).
- REG indicates a peripheral register. - FIELD indicates a field in the register. - SYMVAL indicates the symbolic value of a register field.
(b) Constant Values for Fields Constant PER_REG_FIELD_SYMVAL PER_REG_FIELD_DEFAULT Description Symbolic constant to specify values for individual fields in the specified peripheral register. Default value for a field; corresponds to the field value after a reset or to 0 if a reset has no effect.
CSL Overview
1-13
1.7.1
The call to DMA_open initializes the handle, myDma. This handle can then be used in calls to other API functions:
DMA_start(myDma); . . . DMA_close(myDma); 1-14 /* Begin transfer */
Chapter 2 1
Topic
2.1 2.2 2.3
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Using the CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Compiling and Linking with the CSL Using Code Composer Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2-1
Overview
2.1 Overview
Peripherals are configured using the CSL by declaring/initializing objects and invoking the CSL functions inside your C source code.
by setting the full values of memory-map registers. Compared to functional parameter-based configurations, register-based configurations require less cycles and code size, but are not abstracted.
- Functional parameter-based configuration (PER_setup()): Config-
ures peripherals via a set of parameters. Compared to register-based configurations, functional parameter-based configurations require more cycles and code size, but are more abstracted. The following example illustrates the use of the CSL to initialize DMA channel 0 and to copy a table from address 0x3000 to address 0x2000 using the register based configuration (DMA_config()) Source address: Destination address: Transfer size: 2000h in data space 3000h in data space Sixteen 16-bit single words
2.2.1
2-2
*/
/* Destination packing : DMA_DMACSDP_DSTPACK_ON DMA_DMACSDP_DSTPACK_OFF */ /* Destination selection : DMA_DMACSDP_DST_SARAM DMA_DMACSDP_DST_DARAM DMA_DMACSDP_DST_EMIF DMA_DMACSDP_DST_PERIPH */
DMA_DMACSDP_DST_SARAM ,
DMA_DMACSDP_SRCBEN_NOBURST , /* Source burst : DMA_DMACSDP_SRCBEN_NOBURST DMA_DMACSDP_SRCBEN_BURST4 */ DMA_DMACSDP_SRCPACK_OFF, /* Source packing : DMA_DMACSDP_SRCPACK_ON DMA_DMACSDP_SRCPACK_OFF /* Source selection : DMA_DMACSDP_SRC_SARAM DMA_DMACSDP_SRC_DARAM DMA_DMACSDP_SRC_EMIF DMA_DMACSDP_SRC_PERIPH
*/
DMA_DMACSDP_SRC_SARAM ,
*/
DMA_DMACSDP_DATATYPE_16BIT
) /* DMACSDP */
2-3
DMA_DMACCR_RMK( DMA_DMACCR_DSTAMODE_POSTINC, /* Destination address mode : DMA_DMACCR_DSTAMODE_CONST DMA_DMACCR_DSTAMODE_POSTINC DMA_DMACCR_DSTAMODE_SGLINDX DMA_DMACCR_DSTAMODE_DBLINDX */ DMA_DMACCR_SRCAMODE_POSTINC, /* Source address mode : DMA_DMACCR_SRCAMODE_CONST DMA_DMACCR_SRCAMODE_POSTINC DMA_DMACCR_SRCAMODE_SGLINDX DMA_DMACCR_SRCAMODE_DBLINDX */ DMA_DMACCR_ENDPROG_OFF, /* End of programmation bit : DMA_DMACCR_ENDPROG_ON DMA_DMACCR_ENDPROG_OFF */ DMA_DMACCR_REPEAT_OFF,/* Repeat condition : DMA_DMACCR_REPEAT_ON DMA_DMACCR_REPEAT_ALWAYS DMA_DMACCR_REPEAT_ENDPROG1 DMA_DMACCR_REPEAT_OFF
*/
DMA_DMACCR_AUTOINIT_OFF,/* Auto initialization bit : DMA_DMACCR_AUTOINIT_ON DMA_DMACCR_AUTOINIT_OFF */ DMA_DMACCR_EN_STOP,/* Channel enable : DMA_DMACCR_EN_START DMA_DMACCR_EN_STOP DMA_DMACCR_PRIO_LOW, /* Channel priority : DMA_DMACCR_PRIO_HI DMA_DMACCR_PRIO_LOW
*/
*/
DMA_DMACCR_FS_ELEMENT, /* Frame\Element Sync : DMA_DMACCR_FS_ENABLE DMA_DMACCR_FS_DISABLE DMA_DMACCR_FS_ELEMENT DMA_DMACCR_FS_FRAME */ DMA_DMACCR_SYNC_NONE /* Synchronization control : DMA_DMACCR_SYNC_NONE DMA_DMACCR_SYNC_REVT0 DMA_DMACCR_SYNC_XEVT0 DMA_DMACCR_SYNC_REVTA0 DMA_DMACCR_SYNC_XEVTA0 DMA_DMACCR_SYNC_REVT1 DMA_DMACCR_SYNC_XEVT1 DMA_DMACCR_SYNC_REVTA1 DMA_DMACCR_SYNC_XEVTA1 DMA_DMACCR_SYNC_REVT2
2-4
DMA_DMACCR_SYNC_XEVT2 DMA_DMACCR_SYNC_REVTA2 DMA_DMACCR_SYNC_XEVTA2 DMA_DMACCR_SYNC_TIM1INT DMA_DMACCR_SYNC_TIM2INT DMA_DMACCR_SYNC_EXTINT0 DMA_DMACCR_SYNC_EXTINT1 DMA_DMACCR_SYNC_EXTINT2 DMA_DMACCR_SYNC_EXTINT3 DMA_DMACCR_SYNC_EXTINT4 DMA_DMACCR_SYNC_EXTINT5 ) /* DMACCR */ DMA_DMACICR_RMK(
*/
DMA_DMACICR_BLOCKIE_ON , /* Whole block interrupt enable : DMA_DMACICR_BLOCKIE_ON DMA_DMACICR_BLOCKIE_OFF */ DMA_DMACICR_LASTIE_ON, /* Last frame Interrupt enable : DMA_DMACICR_LASTIE_ON DMA_DMACICR_LASTIE_OFF */ DMA_DMACICR_FRAMEIE_ON, /* Whole frame interrupt enable : DMA_DMACICR_FRAMEIE_ON DMA_DMACICR_FRAMEIE_OFF */ DMA_DMACICR_FIRSTHALFIE_ON, /* HAlf frame interrupt enable : DMA_DMACICR_FIRSTHALFIE_ON DMA_DMACICR_FIRSTHALFIE_OFF */
DMA_DMACICR_DROPIE_ON, /* Sync. event drop interrupt enable : DMA_DMACICR_DROPIE_ON DMA_DMACICR_DROPIE_OFF */ DMA_DMACICR_TIMEOUTIE_ON /* Time out inetrrupt enable DMA_DMACICR_TIMEOUTIE_ON DMA_DMACICR_TIMEOUTIE_OFF ), /* DMACICR */ (DMA_AdrPtr) &src, /* DMACSSAL */ 0, /* DMACSSAU */ (DMA_AdrPtr)&dst, /* DMACDSAL */ 0, /* DMACDSAU */ N, /* DMACEN */ 1, /* DMACFN */ 0, /* DMACFI */ 0 /* DMACEI */ };
How to Use CSL 2-5
*/
Step 3: Define a DMA_Handle pointer. DMA_open will initialize this handle when a DMA channel is opened.
DMA_Handle myhDma; void main(void) { // .....
Step 4: Initialize the CSL Library. A one-time only initialization of the CSL library must be done before calling any CSL module API:
CSL_init(); /* Init CSL */
Step 5: For multi-resource peripherals such as McBSP and DMA, call PER_open to reserve resources (McBSP_open(), DMA_open()...):
myhDma = DMA_open(DMA_CHA0, 0);/* Open DMA Channel 0 */
By default, the TMS320C55xx compiler assigns all data symbols word addresses. The DMA however, expects all addresses to be byte addresses. Therefore, you must shift the address by 2 in order to change the word address to a byte address for the DMA transfer. Step 6: Configure the DMA channel by calling DMA_config() function:
myconfig.dmacssal = (DMA_AdrPtr)(((Uint16)(myconfig.dmacssal)<<1)&0xFFFF); myconfig.dmacdsal = (DMA_AdrPtr)(((Uint16)(myconfig.dmacdsal)<<1)&0xFFFF); myconfig.dmacssau = (((Uint32) &src) >> 15) & 0xFFFF; myconfig.dmacdsau = (((Uint32) &dst) >> 15) & 0xFFFF; DMA_config(myhDma, &myConfig); /* Configure Channel */
Step 8: Wait for FRAME status bit in DMA status register to signal transfer is complete
while (!DMA_FGETH(myhDma, DMACSR, FRAME)) { ; }
2-6
Compiling and Linking with the CSL Using Code Composer Studio
2.3 Compiling and Linking with the CSL Using Code Composer Studio
To compile and link with the CSL, you must configure the Code Composer Studio IDE project environment. To complete this process, follow these steps: Step 1: Specify the target device. (Refer to section 2.3.1) Step 2: Determine whether or not you are using a small or large memory model and specify the CSL and RTS libraries you require. (Refer to section 2.3.1.1) Step 3: Create the linker command file (with a special .csldata section) and add the file to the project. (Refer to section 2.3.1.2) Step 4: Determine if you must enable inlining. (Refer to section 2.3.1.3) The remaining sections in this chapter will provide more details and explanations for the steps above. Note: Code Composer Studio will automatically define the search paths for include files and libraries as defined in Table 21. You are not required to set the i option.
2.3.1
Compiling and Linking with the CSL Using Code Composer Studio
Step 4: In the Define Symbols field, enter one of the device support symbols in Table 12, on page 1-5. For example, if you are using the 5510PG1.2 device, enter CHIP_5510PG1_2. Step 5: Click OK.
Figure 21. Defining the Target Device in the Build Options Dialog
2.3.1.1
Large/Small Memory Model Selection Use of CSL requires that all data resides in the base 64k (Page 0) of memory because of the way in which the small data memory model is implemented. Page independence for the small data memory model is achieved in the compiler by setting all XAR registers to initially point to the area in memory where the .bss section is located. This is done when the C environment boot routine _c_int00 is executed. The compiler then uses ARx addressing for all data accesses, leaving the upper part of XARx untouched.
2-8
Compiling and Linking with the CSL Using Code Composer Studio
Because, CSL is written in C, it relies on the compiler to perform the data/peripheral memory access to read/write peripheral and CPU registers. So in the small data memory model, all peripheral/CPU registers are accessed via ARx addressing. Because the peripheral control registers and CPU status registers reside in the base 64K of I/O and data space respectively, this forces all data to be on page 0 of memory when compiling in small model and using the CSL. Note that this is a problem only when using the small data memory model. This limitation does not exist when compiling with a large data memory model. If you use any large memory model libraries, define the -ml option for the compiler and link with the large memory model runtime library (rts55x.lib) using the following steps: Step 1: In Code Composer Studio, select Project Options. Step 2: In the Build Options dialog box, select the Compiler Tab (Figure 22). Step 3: In the Category list box, highlight advanced. Step 4: Select Use Large memory model (-ml). Step 5: Click OK.
2-9
Compiling and Linking with the CSL Using Code Composer Studio
Then, you must specify which CSL and RTS libraries will be linked in your project.
- In Code Composer Studio, select Project Options. - In the Build Options dialog box, Select the Linker Tab (see Figure 23). - In the Category list, highlight Basic. - The Library search Path field (-l), should show:
on page 1-5.
2-10
Compiling and Linking with the CSL Using Code Composer Studio
- For example, if you are using the 5510 device, enter csl5510.lib for near
mode or csl5510x.lib for far mode. In addition, you must include the corresponding rts55.lib or rts55x.lib compiler runtime support libraries.
- Click OK.
2-11
Compiling and Linking with the CSL Using Code Composer Studio
2.3.1.2
Creating a Linker Command File The CSL has two requirements for the linker command file:
- You must allocate the .csldata section.
The CSL creates a .csl data section to maintain global data that is used to implement functions with configurable data. You must allocate this section within the base 64K address space of the data space.
- You must reserve address 0x7b in scratch pad memory
The CSL uses address 0x7b in the data space as a pointer to the .csldata section, which is initialized during the execution of CSL_init(). For this reason, you must call CSL_init() before calling any other CSL functions. Overwriting memory location 0x7b can cause the CSL functions to fail. Example 21 illustrates these requirements which must be included in the linker command file.
origin = 8000h, length = 0D000h origin = 18000h, length = 08000h origin = 1000h, length = 04000h
SECTIONS { .text .cinit .switch .data .bss .const .sysmem .stack .csldata
PROG0 PROG0 PROG0 DATA DATA DATA DATA DATA DATA 6000h 4000h
2.3.1.3
Using Function Inlining Because some CSL functions are short (they may set only a single bit field), incurring the overhead of a C function call is not always necessary. If you enable inline, the CSL declares these functions as static inline. Using this technique helps you improve code performance.
2-12
Chapter 3
ADC Module
This chapter describes the ADC module, lists the API structure, functions, and macros within the module, and provides an ADC API reference section. The ADC module is not handle-based.
Topic
3.1 3.2 3.3 3.4 3.5
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
3-1
Overview
3.1 Overview
The configuration of the ADC can be performed by using one of the following methods:
- Register-based configuration
A register-based configuration is performed by calling ADC_config() or any of the SET register/field macros.
- Parameter-based configuration
A parameter-based configuration can be performed by calling ADC_setFreq(). Using ADC_setFreq() to initialize the ADC registers for the desired sampling frequency is the recommended approach. The sampled value can also be read using the ADC_read() function. Compared to the register-based approach, this method provides a higher level of abstraction. The downside is larger code size and higher cycle counts. Table 31 lists the configuration structure used to set up the ADC. Table 32 lists the functions available for use with the ADC module. Table 33 lists ADC registers and fields.
3-2
Overview
Field CHSELECT, ADCSTART ADCDATA(R), CHSELECT, ADCBUSY(R) CONVRATEDIV, SAMPTIMEDIV CPUCLKDIV, IDLEEN
ADC Module
3-3
ADC_Config
ADC_Config
Structure Members
Description
ADC configuration structure used to set up the ADC. You create and initialize this structure and then pass its address to the ADC_config() function. You can either use literal values or use ADC_RMK macros to create the structure member values.
ADC_Config 0xFFFF, 0xFFFF, 0xFFFF } Config = { /* ADCCTL */ /* ADCCLKDIV */ /* ADCCLKCTL */
Example
3-4
ADC_getConfig
3.3 Functions
The following are functions available for use with the ADC module.
ADC_config
Function Arguments Return Value Description Example
ADC_getConfig
Function Arguments Return Value Description Example
ADC Module
3-5
ADC_read ADC_read
Function
Arguments
Performs conversions by setting the ADC start bit (ADCCTL) and polling ADC busy (ADCDATA) until done. The sampled values are then read into the array.
int i=7,j=15,k=1; int channel=0,samplenumber=3; Uint16 samplestorage[3]={0,0,0}; ADC_setFreq(i,j,k); ADC_read(channel,samplestorage,samplenumber); /* performs 3 conversions from analog input 0 */ /* and reads the digital data into the */ /* samplestorage array. */
ADC_setFreq
Function
Arguments
convratediv
sampletimediv Sample and hold time divider value (inside ADCCLKDIV) Value from 0255 Return Value
3-6
None
ADC_setFreq
Description Initializes the ADC peripheral by setting the system clock divider, conversion clock rate divider, and sample and hold time divider values into the appropriate registers. Refer to the TMS320C55x Peripherals Reference Guide (SPRU317A) for explanations on how to produce a desired ADC sampling frequency using these three parameters. Example
int i=7,j=15,k=1; ADC_setFreq(i,j,k); /* This example sets the ADC sampling frequency */ /* to 21.5 KHZ, given a 144 MHZ clockout frequency */
ADC Module
3-7
Macros
3.4 Macros
This section contains descriptions of the macros available in the ADC module. See the general macros description in section 1.5 on page 1-11. To use these macros, you must include csl_adc.h. The ADC module defines macros that have been designed for the following purposes:
- The RMK macros create individual control-register masks for the following
purposes:
J J
To initialize a ADC_Config structure that can be passed to functions such as ADC_Config(). To use as arguments for the appropriate RSET macro.
(b) Macros to read/write ADC register field values (Applicable to register with more than one field) Macro ADC_FGET() ADC_FSET()
Notes:
1) REG indicates the registers, ADCCTL, ADCCLKDIV, ADCCLKCTL 2) FIELD indicates the register field name - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
3-8
Examples
1) REG indicates the registers, ADCCTL, ADCCLKDIV, ADCCLKCTL 2) FIELD indicates the register field name - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
3.5 Examples
ADC programming examples using CSL are provided in the: \examples\<target>\CSL directory of Code Composer Studio and in Programming the C5509 ADC Peripheral Application Report (SPRA785).
ADC Module
3-9
3-10
Chapter 4
CHIP Module
This chapter describes the CHIP module, lists the API functions and macros within the module, and provides a CHIP API reference section. The CSL CHIP module is not handle-based; it offers general CPU functions and macros for C55x register accesses.
Topic
4.1 4.2 4.3
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
4-1
Overview
4.1 Overview
The following sections contain all the information required to run the CHIP module. Table 41 lists the functions available, section 4.3 contains the macros, and Table 42 lists CHIP registers.
4.1.1
CHIP Registers
Field ACOV0, ACOV1, ACOV2, ACOV3, TC1, TC2, CARRY, DP BRAF, CPL, XF, HM, INTM, M40, SATD, SXMD, C16, FRCT, C54CM, ASM ARMS, DBGM, EALLOW, RDM, CDPLC, AR7LC, AR6LC, AR5LC, AR4LC, AR3LC, AR2LC, AR1LC, AR0LC CAFRZ, CAEN, CACLR, HINT, CBERR, MPNMC, SATA, AVIS, CLKOFF, SMUL, SST DMAC5, DMAC4, XINT2, RINT2, INT3, DSPINT, DMAC1, XINT1, RINT1, RINT0, TINT0, INT2, INT0 INT5, TINT1, DMAC3, DMAC2, INT4, DMAC0, XINT0, INT1 DMAC5, DMAC4, XINT2, RINT2, INT3, DSPINT, DMAC1, XINT1, RINT1, RINT0, TINT0, INT2, INT0 INT5, TINT1, DMAC3, DMAC2, INT4, DMAC0, XINT0, INT1 IVPD IVPH PDP HPE, BH, HBH, BOOTM3(R), CLKDIV CLKOUT, OSCDIS, EMIFX2, SP2, SP1, PP
4-2
CHIP_getRevId
4.2 Functions
The following are functions available for use with theCHIP module.
CHIP_getDieId_High32
Function Arguments Return Value Description Example
Uint32 CHIP_getDieId_High32(); None high 32 bits of Die ID Returns high 32 bits of the Die ID register
Uint32 DieId_32_High; DieId_32_High = CHIP_getDieId_High32();
CHIP_getDieId_Low32
Function Arguments Return Value Description Example
Uint32 CHIP_getDieId_Low32(); None low 32 bits of Die ID Returns low 32 bits of the Die ID register
Uint32 DieId_32_Low; DieId_32_Low = CHIP_getDieId_Low32();
CHIP_getRevId
Function Arguments Return Value Description Example
Macros
4.3 Macros
CSL offers a collection of macros to gain individual access to the CHIP peripheral registers and fields. Table 43 contains a list of macros available for the CHIP module. To use them, include csl_chip.h.
(b) Macros to read/write CHIP register field values (Applicable only to registers with more than one field) Macro CHIP_FGET() CHIP_FSET() Syntax Uint16 CHIP_FGET(REG, FIELD) void CHIP_FSET(REG,FIELD, Uint16 fieldval)
(c) Macros to read/write CHIP register field values (Applicable only to registers with more than one field) Macro CHIP_REG_RMK() Syntax Uint16 CHIP_REG_RMK(fieldval_n,...fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field * only writeable fields allowed CHIP_FMK() (d) Macros to read a register address Macro CHIP_ADDR()
Notes:
1) REG indicates the register XBSR 2) FIELD indicates the register field name - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
4-4
Chapter 5
DAT Module
This chapter describes the DAT (data) module, lists the API functions within the module, and provides a DAT API reference section. The handle-based DAT module allows you to use DMA hardware to move data.
Topic
5.1 5.2
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5-1
Overview
5.1 Overview
The handle-based DAT(data) module allows you to use DMA hardware to move data. This module works the same for all devices that support the DMA regardless of the type of the DMA controller. Therefore, any application code using the DAT module is compatible across all devices as long as the DMA supports the specific address reach and memory space. The DAT copy operations occur on dedicated DMA hardware independent of the CPU. Because of this asynchronous nature, you can submit an operation to be performed in the background while the CPU performs other tasks in the foreground. Then you can use the DAT_wait() function to block completion of the operation before moving to the next task. Since the DAT module uses the DMA peripheral, it cannot use a DMA channel that is already allocated by the application. To ensure this does not happen, you must call the DAT_open() function to allocate a DMA channel for exclusive use. When the module is no longer needed, you can free the DMA resource by calling DAT_close(). It should be noted that for 5509/5510/5509A targets, the source as well as destination data is in SARAM (since DMA internally is configured for this port) and for 5502, the data is in DARAM (since DMA internally is configured for DARAM PORT0). Table 51 lists the functions for use with the DAT modules. The functions are listed in alphabetical order. Your application must call DAT_open() and DAT_close(); the other functions are used at your discretion.
5-2
DAT_copy
5.2 Functions
The following are functions available for use with the DAT module.
DAT_close
Function
DAT_copy
Function
Arguments
Return Value
DMA status
Description Example
Copies the memory values from the Src to the Dst memory locations.
DAT_copy(hDat, /* (DMA_AdrPtr)0xF000, /* (DMA_AdrPtr)0xFF00, /* 0x0010 /* ); Device Handler src dst ByteCnt */ */ */ */
DAT Module
5-3
DAT_copy2D DAT_copy2D
Function Copies 2dimensional data from source memory to destination memory Uint16 DAT_copy2D(DAT_Handle hDat, Uint16 Type, (DMA_AdrPtr)Src, (DMA_AdrPtr)Dst, Uint16 LineLen, Uint16 LineCnt, Uint16 LinePitch ); hDat Type Device Handler (see DAT_open) Type of 2D DMA transfer, must be one of the following: - DAT_1D2D : 1D to 2D transfer - DAT_2D1D : 2D to 1D transfer - DAT_2D2D : 2D to 2D transfer Pointer to source memory assumes byte addresses Pointer to destination memory assumes byte addresses Number of 16-bit words in one line Number of lines to copy Number of bytes between start of one line to start of next line (always an even number since underlying DMA transfer assumes 16-bit elements) Returns status of data transfer at the moment of exiting the routine: - 0: transfer complete - 1: on-going transfer
Arguments
Return Value
DMA status
Description
Copies the memory values from the Src to the Dst memory locations.
5-4
DAT_fill
Example
DAT_copy2D(hDat, /* DAT_2D2D, /* (DMA_AdrPtr)0xFF00, /* (DMA_AdrPtr)0xF000, /* 0x0010, /* 0x0004, /* 0x0110, /* ); Device Handler Type src dst linelen Line Cnt LinePitch */ */ */ */ */ */ */
DAT_fill
Function
Arguments
Return Value
DMA status
Description
Fills the destination memory with a value for a specified byte count using DMA hardware. You must open the DAT channel with DAT_open() before calling this function. You can use the DAT_wait() function to poll for the completed transfer of data.
Uint16 value; DAT_fill(hDat, /* (DMA_AdrPtr)0x00FF, /* 0x0010, /* &value /* );
Example
*/ */ */ */
DAT Module
5-5
DAT_open DAT_open
Function
Arguments
Priority
DAT_Handle hdat
Description
Before a DAT channel can be used, it must first be opened by this function with an assigned priority. Once opened, it cannot be opened again until closed (see DAT_close).
DAT_open(DAT_CHA0,DAT_PRI_LOW,0);
Example
5-6
DAT_wait DAT_wait
Function
Example
DAT Module
5-7
DAT_wait
5-8
Chapter 6
DMA Module
This chapter describes the DMA module, lists the API structure, functions, and macros within the module, and provides a DMA API reference section.
Topic
6.1 6.2 6.3 6.4
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11
6-1
Overview
6.1 Overview
Table 62 summarizes the primary API functions and macros.
- Your application must call DMA_open() and DMA_close(). - Your application can also call DMA_reset(hDma). - You can perform configuration by calling DMA_config() or any of the SET
register macros. Because DMA_config() initializes 11 control registers, macros are provided to enable efficient access to individual registers when you need to set only one or two. The recommended approach is to use DMA_config() to initialize the DMA registers. The CSL DMA module defines macros (see section 6.4) designed for these primary purposes:
- The RMK macros create individual control-register masks for the following
purposes:
J J
To initialize an DMA_Config structure that you then pass to functions such as DMA_config(). To use as arguments for the appropriate SET macro.
6-2
Overview
DMA Module
6-3
Overview
6.1.1
DMA Registers
Field FREE, EHPIEXCL, EHPIPRIO DSTBEN, DSTPACK, DST, SRCBEN, SRCPACK, SRC, DATATYPE DSTAMODE, SRCAMODE, ENDPROG, FIFOFLUSH, REPEAT, AUTOINIT, EN, PRIO, FS, SYNC BLOCKIE, LASTIE, FRAMEIE, FIRSTHALFIE, DROPIE, TIMEOUTIE (R)SYNC, (R)BLOCK, (R)LAST, (R)FRAME, (R)HALF, (R)DROP, (R)TIMEOUT SSAL SSAU DSAL DSAU ELEMENTNUM FRAMENDX ELEMENTNDX FRAMENDX ELEMENTNDX FRAMENDX ELEMENTNDX DMACSAC DMACDAC PTE, ETE, ITE1, ITE0 DTCE, STCE COMPMODE
6-4
DMA_Config
DMA_Config
Structure Members
For CHIP_5509, CHIP_5510PG1_x (x=0, 2) Int16 dmacfi DMA Channel Frame Index Register Int16 dmacei DMA Channel Element Index Register For CHIP_5510PG2_x (x=0, 1, 2), 5509A, 5502, 5501 Int16 dmacsfi DMA Channel Source Frame Index Register Int16 dmacsei DMA Channel Source Element Index Register Int16 dmacdfi DMA Channel Destination Frame Index Register Int16 dmacdei DMA Channel Destination Element Index Description DMA configuration structure used to set up a DMA channel. You create and initialize this structure and then pass its address to the DMA_config() function. You can use literal values or the DMA_RMK macros to create the structure member values. Refer to section 2.2.1, step 2 and step 6.
DMA Module 6-5
Example
DMA_close
6.3 Functions
The following are functions available for use with the DMA module.
DMA_close
Function
Closes DMA
void DMA_close( DMA_Handle hDma ); hDma None Closes a previously opened DMA device. The DMA event is disabled and cleared. The DMA registers are set to their default values. Refer to section 2.2.1, step 6. Device Handle, see DMA_open();
DMA_config
Function
Arguments
None Writes a value to the DMA using the configuration structure. The values of the structure are written to the port registers. See also DMA_Config. Refer to section 2.2.1, step 2 and step 6.
6-6
DMA_getEventId DMA_getConfig
Function
Arguments
None Reads the DMA configuration into the Config structure (see DMA_Config).
DMA_Config myConfig; DMA_getConfig (hDma, &myConfig);
DMA_getEventId
Function
Returns the IRQ Event ID for the DMA completion interrupt. Use this ID to manage the event using the IRQ module.
EventId = DMA_getEventId(hDma); IRQ_enable(EventId);
DMA Module
6-7
DMA_open DMA_open
Function
Arguments
Before a DMA device can be used, it must first be opened by this function. Once opened, it cannot be opened again until closed (see DMA_close). The return value is a unique device handle that is used in subsequent DMA API calls. If the function fails, INV is returned. If the DMA_OPEN_RESET is specified, then the power on defaults are set and any interrupts are disabled and cleared.
DMA_Handle hDma; ... hDma = DMA_open(DMA_CHA0,0);
Example
6-8
DMA_reset DMA_pause
Function Arguments Return Value Description Example
DMA_reset
Function
Resets DMA
void DMA_reset( DMA_Handle hDma ); hDma None Resets the DMA device. Disables and clears the interrupt event and sets the DMA registers to default values. If INV is specified, all DMA devices are reset.
DMA_reset(hDma);
DMA_start
Function
DMA_reset DMA_stop
Function
6-10
DMA_ADDRH
6.4 Macros
The CSL offers a collection of macros that allow individual access to the peripheral registers and fields. To use the DMA macros include csl_dma.h in your project. Because the DMA has several channels, the macros identify the channel used by either the channel number or the handle used.
Address of register LOCALREG and GLOBALREG Gets the address of a DMA register. For local registers:
myvar = DMA_ADDR (DMACSDP1);
Address of register LOCALREG Gets the address of a DMA local register for channel used in hDma
DMA_Handle myHandle; Uint16 myVar ... myVar = DMA_ADDRH (myHandle, DMACSDP); DMA Module 6-11
DMA_FGET
FIELD Symbolic name for field of register REG Possible values: Field names as listed in the TMS320C55x DSP Peripherals Reference Guide (SPRU317C). Only writable fields are allowed. Return Value Description Example 1 Value of register field Gets the DMA register field value For local registers:
Uint16 myregval; ... myregval = DMA_FGET (DMACCR0, AUTOINIT);
Example 2
6-12
DMA_FGETH
LOCALREG
FIELD
Value of register field given by FIELD. Gets the DMA register field value
DMA_Handle myHandle; ... myHandle = DMA_open (DMA_CHA0, DMA_OPEN_RESET); ... myVar = DMA_FGETH (myHandle, DMACCR, AUTOINIT);
DMA Module
6-13
DMA_FMK
FIELD
fieldval
Shifted version of fieldval. fieldval is shifted to the bit numbering appropriate for FIELD. Returns the shifted version of fieldval. Fieldval is shifted to the bit numbering appropriate for FIELD within register REG. This macro allows the user to initialize few fields in REG as an alternative to the DMA_REG_RMK() macro that requires ALL the fields in the register to be initialized. The returned value could be ORed with the result of other _FMK macros, as show below.
Uint16 myregval; myregval = DMA_FMK (DMAGCR, FREE, 1) | DMA_FMK (DMAGCR, EHPIEXCL, 1);
Example
6-14
DMA_FSET
FIELD
fieldval
None Sets the DMA register field value to fieldval. For local registers:
DMA_FSET (DMACCR0, AUTOINIT, 1);
DMA Module
6-15
DMA_FSETH
LOCALREG
FIELD
fieldval
None Sets the DMA register field FIELD of the LOCALREG register to fieldval for the channel associated with handle to the value fieldval.
DMA_Handle myHandle; ... myHandle = DMA_open (DMA_CHA0, DMA_OPEN_RESET); ... DMA_FSETH (myHandle, DMACCR, AUTOINIT, 1);
6-16
DMA_REG_RMK
fieldval
Value of register that corresponds to the concatenation of values passed for the fields. Returns the DMA register value given specific field values. You can use constants or the CSL symbolic constants covered in Section 1.6.
Uint16 myregval; /* free, ehpiexcl, ehpi prio fields */ myregval = DMA_DMAGCR_RMK (0,0,1);
DMA_REG_RMK are typically used to initialize a DMA configuration structure used for the DMA_config() function (see section 6.2).
DMA Module
6-17
DMA_RGET
DMGCR DMGSCR Return Value Description Example 1 value of register Returns the DMA register value For local registers:
Uint16 myvar; myVar = DMA_RGET(DMACSDP1); /*read DMACSDP for channel 1*/
Example 2
6-18
DMA_RSET
LOCALREG
Value of register Returns the DMA value for register LOCALREG for the channel associated with handle.
DMA_Handle myHandle; Uint16 myVar; ... myHandle = DMA_open (DMA_CHA0, DMA_OPEN_RESET); ... myVar = DMA_RGETH (myHandle, DMACSDP);
Example
regval register value that wants to write to register REG Return Value Description Example 1 value of register Sets the DMA register REG value to regval For local registers:
/*DMACSDP for channel 1 = 0x8000 */ DMA_RSET(DMACSDP1, 0x8000);
Example 2
DMA_RSETH
LOCALREG
Sets the DMA register LOCALREG for the channel associated with handle to the value regval.
DMA_Handle myHandle; ... myHandle = DMA_open (DMA_CHA0, DMA_OPEN_RESET); ... DMA_RSETH (myHandle, DMACSDP, 0x123);
6-20
Chapter 7
EMIF Module
This chapter describes the EMIF module, lists the API structure, functions, and macros within the module, and provides an EMIF API reference section.
Topic
7.1 7.2 7.3 7.4
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7-1
Overview
7.1 Overview
The EMIF configuration can be performed by calling either EMIF_config() or any of the SET register macros. Because EMIF_config() initializes 17 control registers, macros are provided to enable efficient access to individual registers when you need to set only one or two. The recommended approach is to use EMIF_config() to initialize the EMIF registers. The RMK macros create individual control-register masks for the following purposes:
- To initialize an EMIF_Config structure that is passed to EMIF_config(). - To use as arguments for the appropriate SET macros. - Other macros are available primarily to facilitate reading and writing
individual bits and fields in the control registers. Section 7.4 includes a description of all EMIF macros. Table 71 lists the configuration structure used to set up the EMIF. Table 72 lists the functions available for use with the EMIF module. Table 73 lists DMA registers and fields.
7-2
Overview
EMIF Module
7-3
Overview
7.1.1
EMIF Registers
7-4
Overview
Field EK1EN,EK1HZ,NOHOLD,HOLDA,HOLD,ARDY EK2EN,EK2HZ,EK2RATE READ_HOLD,WRITE_HOLD,MTYPE,READ_STROBE,TA READ_SETUP,WRITE_HOLD,WRITE_STROBE,WRITE_SETUP READ_HOLD,WRITE_HOLD,MTYPE,READ_STROBE,TA READ_SETUP,WRITE_HOLD,WRITE_STROBE,WRITE_SETUP READ_HOLD,WRITE_HOLD,MTYPE,READ_STROBE,TA READ_SETUP,WRITE_HOLD,WRITE_STROBE,WRITE_SETUP READ_HOLD,WRITE_HOLD,MTYPE,READ_STROBE,TA READ_SETUP,WRITE_HOLD,WRITE_STROBE,WRITE_SETUP SLFRFR,TRC TRP,TRCD,INIT,RFEN,SDWTH PERIOD,COUNTER COUNTER,EXTRA_REFRESHES TCL,TRAS,TRRD,TWR,THZP,RD2RD,RD2DEAC,RD2WR,R2WDQM R2WDQM,WR2WR,WR2DEAC,WR2RD SYNCRL,SYNCWL,CEEXT,RENEN,SNCCLK SYNCRL,SYNCWL,CEEXT,RENEN,SNCCLK SYNCRL,SYNCWL,CEEXT,RENEN,SNCCLK SYNCRL,SYNCWL,CEEXT,RENEN,SNCCLK CES
EMIF Module
7-5
EMIF_Config
EMIF_Config
Structure Members
Members
5502 and 5501 only Uint16 gblctl1 EMIF Global Control Register 1 Uint16 gblctl2 EMIF Global Control Register 2 Uint16 ce1ctl1 CE1 Space Control Register 1 Uint16 ce1ctl2 CE1 Space Control Register 2 Uint16 ce0ctl1 CE0 Space Control Register 1 Uint16 ce0ctl2 CE0 Space Control Register 2 Uint16 ce2ctl1 CE2 Space Control Register 1 Uint16 ce2ctl2 CE2 Space Control Register 2 Uint16 ce3ctl1 CE3 Space Control Register 1 Uint16 ce3ctl2 CE3 Space Control Register 2 Uint16 sdctl1 SDRAM Control Register 1 Uint16 sdctl2 SDRAM Control Register 2
7-6
EMIF_Config
Uint16 sdrfr1 Uint16 sdrfr2 Uint16 sdext1 Uint16 sdext2 Uint16 ce1sec1 Uint16 ce0sec1 Uint16 ce2sec1 Uint16 ce3sec1 Uint16 cescr Description SDRAM Refresh Control Register 1 SDRAM Refresh Control Register 2 SDRAM Extension Register 1 SDRAM Extension Register 2 CE1 Secondary Control Register 1 CE0 Secondary Control Register 1 CE2 Secondary Control Register 2 CE3 Secondary Control Register 1 CE Size Control Register
The EMIF configuration structure is used to set up the EMIF Interface. You create and initialize this structure and then pass its address to the EMIF_config() function. You can use literal values or the EMIF_RMK macros to create the structure member values.
EMIF_Config Config1 = { 0x06CF, /* egcr */ 0xFFFF, /* emirst */ 0x7FFF, /* ce01 */ 0xFFFF, /* ce02 */ 0x00FF, /* ce03 */ 0x7FFF, /* ce11 */ 0xFFFF, /* ce12 */ 0x00FF, /* ce13 */ 0x7FFF, /* ce21 */ 0xFFFF, /* ce22 */ 0x00FF, /* ce23 */ 0x7FFF, /* ce31 */ 0xFFFF, /* ce32 */ 0x00FF, /* ce33 */ 0x07FF, /* sdc1 */ 0x0FFF, /* sdper */ 0x07FF, /* init */ 0x03FF /* sdc2 */ }
Example
EMIF Module
7-7
EMIF_config
7.3 Functions
The following are functions available for use with the ADC module.
EMIF_config
Function
EMIF_config(&MyConfig);
7-8
EMIF_config EMIF_getConfig
Function
EMIF_enterselfRefresh
Function
Arguments
EMIF Module
7-9
EMIF_config EMIF_exitselfRefresh
Function
EMIF_reset
Function
7-10
Macros
7.4 Macros
The CSL offers a collection of macros to gain individual access to the EMIF peripheral registers and fields. Table 74 contains a list of macros available for the EMIF module. To use them, include csl_emif.h.
(b) Macros to read/write EMIF register field values (Applicable only to registers with more than one field) Macro EMIF_FGET() EMIF_FSET() Syntax Uint16 EMIF_FGET(REG, FIELD) Void EMIF_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to EMIF registers and fields (Applies only to registers with more than one field) Macro EMIF_REG_RMK() Syntax Uint16 EMIF_REG_RMK(fieldval_n,fieldval_0) (see note 5) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed EMIF_FMK() Uint16 EMIF_FMK(REG, FIELD, fieldval) (see note 5)
1) REG indicates the register: EGCR, EMIRST, EMIBE, CE01, CE02, CE03, CE11, CE12, CE13, CE21, CE22, CE23, CE31, CE32, CE33, SDC1, SDPER, SDCNT, INIT, SDC2 2) FIELD indicates the register field name as specified in the 55x Peripheral Users Guide. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD). 5) For the special case of the CEx0, CEx1, CEx2, and CEx3, EMIF_REG_RMK(), and EMIF_FMK() both use REG = CEx0, CEx1, CEx2, and CEx3, where x is the letter X
EMIF Module
7-11
7-12
Chapter 8
GPIO Module
This chapter describes the GPIO module, lists the API functions and macros within the module, and provides a GPIO API reference section.
Topic
8.1 8.2 8.3 8.4
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Configuration Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
8-1
Overview
8.1 Overview
The GPIO module is designed to allow central control of the non-multiplexed and address GPIO pins available in the C55x devices. The following three tables list the functions, registers and macros used with this module.
8-2
Overview
PGPIODAT1
Note:
GPIO Module
8-3
GPIO_Config
GPIO_Config
Structure Members
Description
The GPIO configuration structure is used to set up the non-parallel GPIO pins. You create and initialize this structure and then pass its address to the GPIO_config() function. You can use literal values or the GPIO_RMK macros to create the structure member values.
GPIO_ConfigAll
Structure Description
Members
8-4
GPIO_open
8.3 Functions
The following are functions available for the GPIO module. They are supported by C5502 and C5501.
GPIO_close
Function Arguments Return Value Description Example
GPIO_open
Function Arguments
Return Value
GPIO Module
8-5
GPIO_open
Description Before a GPIO pin can be used, it must be reserved for use by the application. Once reserved, it cannot be requested again until, closed by GPIO_close(). The return value is a unique device handle that is used in subsequent GPIO API calls. If the function fails, INV (-1) is returned. For C5502 and C5501, there are four groups of GPIO pins. (See GPIO_pinDirection() for list of pins in each group). GPIO_open() must be called to open one or more pins of only one group at a time. Calling the allocMask of pins in different groups will produce unknown results. Example: The first parameter to GPIO_open() could be (GPIO_GPIO_PIN4 | GPIO_GPIO_PIN2 as they are in the same group, but (GPIO_GPIO_PIN4 | GPIO_PGPIO_PIN2) will produce unknown results. If GPIO_open() is called for one or more pins in a particular group, it cannot be called again to open other pins of the same group unless corresponding GPIO_close() is called. However, GPIO_open() can be called again to open one or more pins of another group. Example: If GPIO_open() is called for the first time with GPIO_GPIO_PIN4 as the first parameter, it can not be called again with GPIO_GPIO_PIN2 parameter, as they belong to the same pin group. However, it can be called again with GPIO_PGPIO_PIN2 as the first parameter. Example
GPIO_Handle hGPIO; hGPio = GPIO_open(GPIO_PGPIO_PIN1,0);
8-6
GPIO_configAll GPIO_config
Function Arguments Return Value Description
Example
GPIO_configAll
Function Arguments Return Value Description Example
GPIO_pinDirection GPIO_pinDirection Sets the GPIO pin as either an input oroutpit pin
Function For C5502 and 5501: void GPIO_pinDirection(GPIO_Handle hGpio, Uint32 pinMask, Uint16 direction); For C5509/C5509A/C5510: void GPIO_pinDirection(Uint32 pinMask, Uint16 direction); hGPIO GPIO Handle returned from previous call to GPIO_open() (This argument is only for C5502 and C5501 CSL) GPIO pins affected by direction
Arguments
pinMask
For 5502 and 5501, pinMask may be any of the following: GPIO Pin Group 0 (Non-Parallel GPIO Pins): GPIO_GPIO_PIN0 GPIO_GPIO_PIN1 GPIO_GPIO_PIN2 GPIO_GPIO_PIN3 GPIO_GPIO_PIN4 GPIO_GPIO_PIN5 GPIO_GPIO_PIN6 GPIO_GPIO_PIN7 GPIO Pin Group 1 (Parallel GPIO Pins 0-15): GPIO_PGPIO_PIN0 GPIO_PGPIO_PIN1 GPIO_PGPIO_PIN2 GPIO_PGPIO_PIN3 GPIO_PGPIO_PIN4 GPIO_PGPIO_PIN5 GPIO_PGPIO_PIN6 GPIO_PGPIO_PIN7 GPIO_PGPIO_PIN8 GPIO_PGPIO_PIN9 GPIO_PGPIO_PIN10 GPIO_PGPIO_PIN11 GPIO_PGPIO_PIN12 GPIO_PGPIO_PIN13
8-8
GPIO_pinDirection
GPIO_PGPIO_PIN14 GPIO_PGPIO_PIN15 GPIO Pin Group 2 (Parallel GPIO Pins 16-31): GPIO_PGPIO_PIN16 GPIO_PGPIO_PIN17 GPIO_PGPIO_PIN18 GPIO_PGPIO_PIN19 GPIO_PGPIO_PIN20 GPIO_PGPIO_PIN21 GPIO_PGPIO_PIN22 GPIO_PGPIO_PIN23 GPIO_PGPIO_PIN24 GPIO_PGPIO_PIN25 GPIO_PGPIO_PIN26 GPIO_PGPIO_PIN27 GPIO_PGPIO_PIN28 GPIO_PGPIO_PIN29 GPIO_PGPIO_PIN30 GPIO_PGPIO_PIN31 GPIO Pin Group 3 (Parellel GPIO Pins 32-45): GPIO_PGPIO_PIN32 GPIO_PGPIO_PIN33 GPIO_PGPIO_PIN34 GPIO_PGPIO_PIN35 GPIO_PGPIO_PIN36 GPIO_PGPIO_PIN37 GPIO_PGPIO_PIN38 GPIO_PGPIO_PIN39 GPIO_PGPIO_PIN40 GPIO_PGPIO_PIN41 GPIO_PGPIO_PIN42 GPIO_PGPIO_PIN43 GPIO_PGPIO_PIN44 GPIO_PGPIO_PIN45 The pinMask may be formed by using a single pin Id listed above or you may combine pin IDs from pins within the same group (i.e., GPIO_PGPIO_PIN23 | GPIO_PGPIO_PIN30) direction Mask used to set pin direction for pins selected in pinMask
GPIO Module 8-9
GPIO_pinDirection
GPIO Pin Group 0 (Non-Parallel GPIO Pins): GPIO_GPIO_PIN0_OUTPUT GPIO_GPIO_PIN1_OUTPUT GPIO_GPIO_PIN2_OUTPUT GPIO_GPIO_PIN3_OUTPUT GPIO_GPIO_PIN4_OUTPUT GPIO_GPIO_PIN5_OUTPUT GPIO_GPIO_PIN6_OUTPUT GPIO_GPIO_PIN7_OUTPUT GPIO_GPIO_PIN0_INPUT GPIO_GPIO_PIN1_INPUT GPIO_GPIO_PIN2_INPUT GPIO_GPIO_PIN3_INPUT GPIO_GPIO_PIN4_INPUT GPIO_GPIO_PIN5_INPUT GPIO_GPIO_PIN6_INPUT GPIO_GPIO_PIN7_INPUT GPIO Pin Group 1 (Parallel GPIO Pins 0-15): GPIO_PGPIO_PIN0_OUTPUT GPIO_PGPIO_PIN1_OUTPUT GPIO_PGPIO_PIN2_OUTPUT GPIO_PGPIO_PIN3_OUTPUT GPIO_PGPIO_PIN4_OUTPUT GPIO_PGPIO_PIN5_OUTPUT GPIO_PGPIO_PIN6_OUTPUT GPIO_PGPIO_PIN7_OUTPUT GPIO_PGPIO_PIN8_OUTPUT GPIO_PGPIO_PIN9_OUTPUT GPIO_PGPIO_PIN10_OUTPUT GPIO_PGPIO_PIN11_OUTPUT GPIO_PGPIO_PIN12_OUTPUT GPIO_PGPIO_PIN13_OUTPUT GPIO_PGPIO_PIN14_OUTPUT GPIO_PGPIO_PIN15_OUTPUT GPIO_PGPIO_PIN0_INPUT GPIO_PGPIO_PIN1_INPUT GPIO_PGPIO_PIN2_INPUT GPIO_PGPIO_PIN3_INPUT
8-10
GPIO_pinDirection
GPIO_PGPIO_PIN4_INPUT GPIO_PGPIO_PIN5_INPUT GPIO_PGPIO_PIN6_INPUT GPIO_PGPIO_PIN7_INPUT GPIO_PGPIO_PIN8_INPUT GPIO_PGPIO_PIN9_INPUT GPIO_PGPIO_PIN10_INPUT GPIO_PGPIO_PIN11_INPUT GPIO_PGPIO_PIN12_INPUT GPIO_PGPIO_PIN13_INPUT GPIO_PGPIO_PIN14_INPUT GPIO_PGPIO_PIN15_INPUT GPIO Pin Group 2 (Parallel GPIO Pins 16-31): GPIO_PGPIO_PIN16_OUTPUT GPIO_PGPIO_PIN17_OUTPUT GPIO_PGPIO_PIN18_OUTPUT GPIO_PGPIO_PIN19_OUTPUT GPIO_PGPIO_PIN20_OUTPUT GPIO_PGPIO_PIN21_OUTPUT GPIO_PGPIO_PIN22_OUTPUT GPIO_PGPIO_PIN23_OUTPUT GPIO_PGPIO_PIN24_OUTPUT GPIO_PGPIO_PIN25_OUTPUT GPIO_PGPIO_PIN26_OUTPUT GPIO_PGPIO_PIN27_OUTPUT GPIO_PGPIO_PIN28_OUTPUT GPIO_PGPIO_PIN29_OUTPUT GPIO_PGPIO_PIN30_OUTPUT GPIO_PGPIO_PIN31_OUTPUT GPIO_PGPIO_PIN16_INPUT GPIO_PGPIO_PIN17_INPUT GPIO_PGPIO_PIN18_INPUT GPIO_PGPIO_PIN19_INPUT GPIO_PGPIO_PIN20_INPUT GPIO_PGPIO_PIN21_INPUT GPIO_PGPIO_PIN22_INPUT GPIO_PGPIO_PIN23_INPUT GPIO_PGPIO_PIN24_INPUT GPIO_PGPIO_PIN25_INPUT GPIO_PGPIO_PIN26_INPUT
GPIO Module 8-11
GPIO_pinDirection
GPIO_PGPIO_PIN27_INPUT GPIO_PGPIO_PIN28_INPUT GPIO_PGPIO_PIN29_INPUT GPIO_PGPIO_PIN30_INPUT GPIO_PGPIO_PIN31_INPUT GPIO Pin Group 3 (Parellel GPIO Pins 32-45): GPIO_PGPIO_PIN32_OUTPUT GPIO_PGPIO_PIN33_OUTPUT GPIO_PGPIO_PIN34_OUTPUT GPIO_PGPIO_PIN35_OUTPUT GPIO_PGPIO_PIN36_OUTPUT GPIO_PGPIO_PIN37_OUTPUT GPIO_PGPIO_PIN38_OUTPUT GPIO_PGPIO_PIN39_OUTPUT GPIO_PGPIO_PIN40_OUTPUT GPIO_PGPIO_PIN41_OUTPUT GPIO_PGPIO_PIN42_OUTPUT GPIO_PGPIO_PIN43_OUTPUT GPIO_PGPIO_PIN44_OUTPUT GPIO_PGPIO_PIN45_OUTPUT GPIO_PGPIO_PIN32_INPUT GPIO_PGPIO_PIN33_INPUT GPIO_PGPIO_PIN34_INPUT GPIO_PGPIO_PIN35_INPUT GPIO_PGPIO_PIN36_INPUT GPIO_PGPIO_PIN37_INPUT GPIO_PGPIO_PIN38_INPUT GPIO_PGPIO_PIN39_INPUT GPIO_PGPIO_PIN40_INPUT GPIO_PGPIO_PIN41_INPUT GPIO_PGPIO_PIN42_INPUT GPIO_PGPIO_PIN43_INPUT GPIO_PGPIO_PIN44_INPUT GPIO_PGPIO_PIN45_INPUT Direction may be set using any of the symbolic constant defined above. Direction for multiple pins within the same group may be set by ORing together several constants: GPIO_PGPIO_PIN45_INPUT | GPIO_PGPIO_PIN40_OUTPUT Return Value
8-12
None
GPIO_pinEnable
Description Example Sets the direction for oneor more General purpose I/O pins (input or output)
/* sets the pin pgpio1 as an input */ GPIO_handle hGpio = GPIO_open(GPIO_PGPIO_PIN1|GPIO_PGPIO_PIN15); GPIO_pinDirection(hGPio, GPIO_PGPIO_PIN1, GPIO_PGPIO_PIN1_INPUT);
GPIO_pinDisable
Function
Arguments
GPIO_pinEnable
Function
Arguments
GPIO_pinRead GPIO_pinRead
Function
Arguments
Value
GPIO_pinReadAll
Function
Arguments
Value
Reads in the value of the GPIO pins specified by pinMask. The function returns the value in place of the pins. It does not right-justify the value to return a raw result.
int val; /* reads IOO and IO7 pin values */ val=GPIO_pinRead (hGPio,GPIO_GPIO_PIN0| GPIO_GPIO_PIN7);
Example
8-14
GPIO_pinWriteAll GPIO_pinWrite
Function
Arguments
GPIO_pinWriteAll
Function
Arguments
None Writes a value to one or more general purpose output pins. Ths function assumes an in-place value mask for writing to the GPIO pins. It will not left-justify values.
/* writes 1 to IO pin0 and IO pin 5 */ GPIO_pinWrite (hGpio,GPIO_GPIO_PIN0| GPIO_GPIO_PIN5,0x0021);
GPIO Module 8-15
Example
GPIO_pinReset GPIO_pinReset
Function Arguments
GPIO Handle returned from previous call to GPIO_open(). ID of one or more GPIO pins to write. Please see GPIO_pinDirection for list of valid pin IDs.
8-16
Macros
8.4 Macros
The CSL offers a collection of macros to gain individual access to the GPIO peripheral registers and fields. Table 83 contains a list of macros available for the GPIO module. To use them, include csl_gpio.h.
(b) Macros to read/write GPIO register field values (Applicable only to registers with more than one field) Macro GPIO_FGET() GPIO_FSET() Syntax Uint16 GPIO_FGET(REG, FIELD) Void GPIO_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to GPIO registers and fields (Applies only to registers with more than one field) Macro GPIO_REG_RMK() Syntax Uint16 GPIO_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed GPIO_FMK() Uint16 GPIO_FMK(REG, FIELD, fieldval)
1) REG include the registers IODIR, IODATA, GPIODIR, GPIODATA, GPIOEN, AGPIODIR, AGPIODATA, and AGPIOEN. 2) FIELD indicates the register field name - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
GPIO Module
8-17
8-18
Chapter 9
HPI Module
This chapter describes the HPI module, lists the API structure, macros, functions, and provides an HPI API reference. The HPI module applies to the C5502 and C5501 devices.
Topic
9.1 9.2 9.3 9.4
Page
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
9-1
Overview
9.1 Overview
This module enables configuration of the 5502 and 5501 HPI. The HPI module is not handle based. Configuration of the HPI is easily accomplished by calling HPI_config() or any of the SET register macros. Using HPI_config() is the preferred method for configuration. Table 91 Lists the configuration structure for HPI modules Table 92 Lists the function APIs Table 93 Lists the register and bit field names Lists the API macros
9-2
Overview
HPI Module
9-3
Configuration Structures
HPI_Config
Structure Members
9-4
HPI_getConfig
9.3 Functions
The following are functions available for the HPI module.
HPI_config
Function
/* HPWREMU , Select FREE = SOFT = 1 /* HGPIOEN , Disable all GPIO pins /* HPIC , Reset HPI
*/ */ */
HPI_config(&myConfig);
HPI_getConfig
Function
HPI Module
9-5
HPI_ADDR
9.4 Macros
The following is a listing of HPI macros.
9-6
HPI_FSET
Example
HPI Module
9-7
HPI_REG_RMK
val_n is truncated accordingly. Return Value Description Example Value of register that corresponds to the concatenation of values passed for the fields. Returns the HPI register value given specific field values. You can use constants or the CSL symbolic constants covered in Section 1.6.
Uint16 myregval; /* enable HA[0:7], HD[8:15], HD[0:7] for GPIO */ myregval = HPI_HGPIOEN_RMK (0,1,1,1,0,0,0,0,0);
HPI_REG_RMK are typically used to initialize a HPI configuration structure used for the HPI_config() function (see section 9.2).
9-8
HPI_RSET
CSL offers a collection of macros to gain individual access to the GPIO peripheral registers and fields. Table 83 contains a list of macros available for the GPIO module. To use them, include csl_gpio.h.
HPI Module
9-9
HPI_RSET
9-10
Chapter 10
I2C Module
This chapter describes the I2C module, lists the API structure, functions, and macros within the module, and provides an I2C API reference section.
Topic
Page
10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 10.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7 10.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17 10.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-18
10-1
Overview
10.1 Overview
The configuration of the I2C can be performed by using one of the following methods:
- Register-based configuration
A register-based configuration can be performed by calling either I2C_config() or any of the SET register field macros.
- Parameter-based configuration (Recommended)
A parameter-based configuration can be performed by calling I2C_setup(). Using I2C_setup() to initialize the I2C registers is the recommended approach. Compared to the register-based approach, this method provides a higher level of abstraction. The downside is larger code size and higher cycle counts. Table 103 lists DMA registers and fields.
10-2
Overview
I2C Module
10-3
Overview
Field OAR AL , NACK , ARDY , RRDY , XRDY (R)AL, (R)NACK, (R)ARDY, RRDY, (R)XRDY, (R)AD0, (R)AAS, (R)XSMT, (R)RSFULL ,(R)BB ICCL ICCH ICDC (R)DATA SAR (R)DATA BC, FDF, STB, IRS, DLB, RM, XA, TRX, MST, STP, IDLEEN , STT, FREE (R)INTCODE, TESTMD
IPSC
10-4
I2C_Config
I2C_Config
Structure Members
Description
I2C configuration structure used to set up the I2C interface. You create and initialize this structure and then pass its address to the I2C_config() function. You can use either literal values, or I2C_RMK macros to create the structure member values.
I2C_Config 0xFFFF, 0x0000, 0xFFFF, 10, 8, 1, 0xFFFA, 0x0664, 0xFFFF, 0x0000 } Config = { /* I2COAR /* I2CIER /* I2CSTR /* I2CCLKL /* I2CCLKH /* I2CCNT /* I2CSAR /* I2CMDR /* I2CISRC /* I2CPSC
Example
*/ */ */ */ */ */ */ */ */ */
I2C Module
10-5
I2C_Setup I2C_Setup
Structure Members
Description Example
I2C initialization structure used to set up the I2C interface. You create and initialize this structure and then pass its address to the I2C_setup() function.
I2C_Setup Setup = { 0, /* 7 or 10 bit address mode */ 0x0000, /* own address dont care if master */ 144, /* clkout value (Mhz) */ 400, /* a number between 10 and 400 */ 0, /* number of bits/byte to be received or */ /* transmitted (8 bits) */ 0, /* DLB mode */ 1 /* FREE mode of operation */ }
10-6
I2C_config
10.3 Functions
The following are functions available for use with the I2C module.
I2C_config
Function Arguments Return Value Description
and later, use the I2C_start() function to start the I2C peripheral Example
I2C_Config 0xFFFF, 0x0000, 0xFFFF, 10, 8, 1, 0xFFFA, 0x0664, 0xFFFF, 0x0000 }; Config = { /* I2COAR /* I2CIER /* I2CSTR /* I2CCLKL /* I2CCLKH /* I2CCNT /* I2CSAR /* I2CMDR /* I2CSRC /* I2CPSC
*/ */ */ */ */ */ */ */ */ */
I2C_config(&Config);
I2C Module
10-7
I2C_eventDisable
Description Example
I2C_eventEnable
Function Arguments
Description Example
I2C_getConfig
Function Arguments Return Value Description
10-8
I2C_setup
Example
I2C_Config *testConfig; I2C_getConfig(testConfig);
I2C_getEventId
Function
I2C_setup
Function Arguments Return Value Description
Example
I2C_IsrAddr I2C_IsrAddr
Structure Members
Description
I2C structure used to assign functions for each of the five I2C interrupts. The structure member values should be pointers to the functions that are executed when a particular interrupt occurs.
I2C_IsrAddr addr = { myALIsr, myNACKIsr, myARDYIsr, myRRDYIsr, myXRDYIsr };
Example
I2C_read
Function Arguments
10-10
I2C_readByte
Return Value int Value returned 0 1 2 4 Description Description No errors Bus busy; not able to generate start condition Timeout for transmit ready (first byte) Timeout for transmit ready (within main loop)
Performs master/slave receiver functions. Inputs are the data array to be transferred, length of data, master mode, slaveaddress, timeout for errors, and a check for bus busy flag.
Uint16 datareceive[6]={0,0,0,0,0,0}; int x; I2C_Init Init = { 0, /* 7 bit address mode */ 0x0000, /* own address */ 144, /* clkout value (Mhz) */ 400, /* a number between 10 and 400 */ 0, /* 8 bits/byte to be received or transmitted */ 0, /* DLB mode off */ 1 /* FREE mode on */ };
Example
I2C_init(&Init); z=I2C_read(datareceive,6,1,0x50,3,30000,0); /* receives 6 bytes of data /* in master receiver /* SAD..(n)..DP mode /* to from the 0x50 address /* with a timeout of 30000 /* and check for bus busy on
*/ */ */ */ */ */
I2C_readByte
Function Arguments Return Value
I2C_readByte
Description Example Performs a direct 16-bit read from the data receive register I2CDRR.
Uint16 Data; ... Data = I2C_readByte();
This function does not check to see if valid data has been received. For this purpose, use I2C_rrdy().
I2C_reset
Function Arguments Return Value Description Example
I2C_rfull
Function Arguments Return Value Description Example
I2C_rrdy
Function Arguments
10-12
I2C_readByte
Return Value Description Example RRDY Returns RRDY status bit of SPCR1, 0 or 1
Reads the RRDY status bit of the I2CSTR register. A 1 indicates the receiver is ready with data to be read.
if (I2C_rrdy()) { }
I2C_sendStop
Function Arguments Return Value Description Example
Sets the STP bit in the I2CMDR register (generates stop condition)
void I2C_sendStop(); None None Sets the STP bit in the I2CMDR register (generates a stop condition).
I2C_sendStop();
I2C_setCallback
Function Arguments
Description
Example
I2C Module
10-13
I2C_readByte I2C_start
Function Arguments Return Value Description
Example
I2C_start();
I2C_write
Function Arguments
Return Value
10-14
I2C_readByte
Description Performs master/slave transmitter functions. Inputs are the data array to be transferred, length of data, master mode, slaveaddress, and timeout for errors. int timeout Example Timeout for bus busy, no acknowledge, or transmit ready
Uint16 databyte[7]={0,0,10,11,12,13,14}; int x; I2C_Init Init = { 0, /* 7 bit address mode */ 0x0000, /* own address */ 144, /* clkout value (Mhz) */ 400, /* a number between 10 and 400 */ 0, /* 8 bits/byte to be received or transmitted */ 0, /* DLB mode off */ 1 /* FREE mode on */ };
I2C_init(&Init); x=I2C_write (databyte,7,1,0x50,1,30000); /* sends 7 bytes of data /* in master transmitter /* SAD..(n)..DP mode /* to the 0x50 slave /* address with a timeout /* of 30000.
*/ */ */ */ */ */
I2C_writeByte
Function
Example
I2C_readByte I2C_xempty
Function Arguments Return Value
Description Example
Reads the XSMT bit from the I2CSTR register. A 0 indicates the transmit shift (XSR) is empty.
if (I2C_xempty()) { }
I2C_xrdy
Function Arguments Return Value Description
Example
10-16
Macros
10.4 Macros
This section contains descriptions of the macros available in the I2C module. The I2C API defines macros that have been designed for the following purposes:
- The RMK macros create individual control-register masks for the following
purposes:
J J
To initialize a I2C_Config structure that you then pass to functions such as I2C_Config(). To use as arguments for the appropriate RSET macros.
- Other macros are available primarily to facilitate reading and writing indi-
(b) Macros to read/write I2C register field values (Applicable to registers with more than one field) Macro I2C_FGET() I2C_FSET() Syntax Uint16 I2C_FGET(REG, FIELD) Void I2C_FSET(REG,FIELD,Uint16 fieldval)
(c) Macros to create values to I2C registers and fields (Applicable to registers with more than one field) Macro I2C_REG_RMK() Syntax Uint16 I2C_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed I2C_FMK() Uint16 I2C_FMK(REG, FIELD, fieldval)
(d) Macros to read a register address Macro I2C_ADDR() Syntax Uint16 I2C_ADDR(REG)
I2C Module
10-17
Examples
Notes:
1) REG indicates the registers: I2COAR, I2CIMR, I2CSTR, I2CCLKL, I2CCLKH, I2CDRR, I2CCNT, I2CSAR, I2CDXR, I2CMDR, I2CSRC, I2CPSC. 2) FIELD indicates the register field name. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
10.5 Examples
I2C programming examples using CSL are provided in:
- The Programming the C5509 I2C Peripheral Application Report
(SPRA785)
- In the CCS examples directory: examples\<target>\csl\
10-18
Chapter 11
ICACHE Module
This chapter describes the ICACHE module, lists the API structure, functions, and macros within the module, and provides a ICACHE API reference section.
Topic
Page
11.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2 11.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3 11.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5 11.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
11-1
Overview
11.1 Overview
Table 112 lists the configuration structures and functions used with the ICACHE module. Section 11.4 lists the macros available for the ICACHE module. Currently, there are no handles available for the Instruction Cache.
11-2
ICACHE_Config
ICACHE_Config
Structure Members
Global Control Register N-way Control Register (not supported on C5502/5501) Ramset 1 Control Register (not supported on C5502/5501) Ramset 1 Tag Register (not supported on C5502/5501) Ramset 2 Control Register (not supported on C5502/5501) Ramset 2 Tag Register (not supported on C5502/5501)
Description
The ICACHE configuration structure is used to set up the cache. You create and initialize this structure, then pass its address to the ICACHE_config() function. You can use literal values or the ICACHE_RMK macros to create the structure member values.
ICACHE_Config MyConfig = { 0x0060, /* Global Control 0x1000, /* N-way Control 0x0000, /* Ramset 1 Control 0x1000, /* Ramset 1 Tag 0x0000, /* Ramset 1 Control 0x1000 /* Ramset 1 Tag }; ICACHE_config(&MyConfig);
Example
*/ */ */ */ */ */
Example
ICACHE Module
11-3
ICACHE_Setup ICACHE_Setup
Structure Members
Description
ICACHE setup structure is used to configure and enable the ICACHE. The structure is created and initialized. Its address is passed to the ICACHE_setup() function.
ICACHE_Setup Mysetup = { ICACHE_ICGC_RMODE_1RAMSET, 0x50000, 0x0000}; ... ICACHE_setup(&Mysetup);
Example
ICACHE_Tagset
Structure Members
Description Example
ICACHE tag set structure is used to configure the ramset tag registers of the ICACHE.
ICACHE_Tagset Mytagset = { 0x50000, 0x0000}; ... ICACHE_tagset(&Mytagset);
11-4
ICACHE_disable
11.3 Functions
The following are functions available for use with the ICACHE module.
ICACHE_config
Function
Example
ICACHE_disable
Function Arguments Return Value Description
Example
ICACHE Module
11-5
ICACHE_enable ICACHE_enable
Function Arguments Return Value Description
Example
ICACHE_flush
Function Arguments Return Value Description Example
ICACHE_freeze
Function Arguments Return Value Description Example
11-6
ICACHE_unfreeze ICACHE_setup
Function Arguments Return Value Description Example
ICACHE_tagset
Function Arguments Return Value Description
Example
Macros
11.4 Macros
The CSL offers a collection of macros to access CPU control registers and fields. Table 113 lists the ICACHE macros available. To use them include csl_icache.h.
(b) Macros to read/write ICACHE register field values (Applicable only to registers with more than one field) Macro ICACHE_FGET() ICACHE_FSET() Syntax Uint16 ICACHE_FGET(REG, FIELD) void ICACHE_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to write to ICACHE registers and fields (Applicable only to registers with more than one field) Macro ICACHE_REG_RMK() Syntax Uint16 ICACHE_REG_RMK(fieldval_n,...fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field * only writable fields allowed ICACHE_FMK() (d) Macros to read a register address Macro ICACHE_ADDR()
Notes:
1) REG indicates the registers:ICGC, ICWC, ICST, ICRC1&2 or ICRTAG1&2. 2) FIELD indicates the register field name. For REG_FSET and REG__FMK, FIELD must be a writable field. For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG) 4) fieldval indicates the value to write in the field (FIELD)
11-8
Chapter 12
IRQ Module
This chapter describes the IRQ module, lists the API structure and functions within the module, and provides an IRQ API reference section. The IRQ module provides an easy to use interface for enabling/disabling and managing interrupts.
Topic
Page
12.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2 12.2 Using Interrupts with CSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7 12.3 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8 12.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
12-1
Overview
12.1 Overview
The IRQ module provides an interface for managing peripheral interrupts to the CPU. This module provides the following functionality:
- Masking an interrupt in the IMRx register. - Polling for the interrupt status from the IFRx register. - Setting the interrupt vector table address and placing the necessary code
in the interrupt vector table to branch to a user-defined interrupt service routine (ISR).
- Enabling/Disabling Global Interrupts in the ST1 (INTM) bit. - Reading and writing to parameters in the DSP/BIOS dispatch table.
(When the DPS BIOS dispatcher option is enabled in DSP BIOS.) The DSP BIOS dispatcher is responsible for dynamically handling interrupts and maintains a table of ISRs to be executed for specific interrupts. The IRQ module has a set of APIs that update the dispatch table. Table 122 lists the IRQ APIs. The IRQ functions can be used with or without DSP/BIOS; however, if DSP/BIOS is present, do not disable interrupts for long periods of time because this could disrupt the DSP/BIOS environment. IRQ_plug() is the only API function that cannot be used when DSP/BIOS dispatcher is present or DSP/BIOS HWI module is used to configure the interrupt vectors. This function, IRQ_plug(), dynamically places code at the interrupt vector location to branch to a user-defined ISR for a specified event. If you call IRQ_plug() when DSP/BIOS dispatcher is present or HWI module has been used to configure interrupt vectors, this could disrupt the DSP/BIOS operating environment. The API functions that enable DSP/BIOS dispatcher communication are noted in the table. These functions should be used only when DSP/BIOS is present and the DSP/BIOS dispatcher is enabled. Table 123 lists all IRQ logical interrupt events for this module.
12-2
Overview
Overview
The IRQ module defines a set of constants, IRQ_EVT_NNNN, that uniquely identify each of the possible logical interrupts (see Table 123). All of the IRQ APIs operate on logical events.
12-4
Overview
IRQ Module
12-5
Overview
12-6
IRQ Module
12-7
IRQ_Config
IRQ_Config
Structure Members
Uint32 funcArg
Description
This is the IRQ configuration structure used to update a DSP/BIOS table entry. You create and initialize this structure then pass its address to the IRQ_config() function.
IRQ_Config MyConfig = { 0x0000, /* funcAddr */ 0x0300, /* ierMask */ 0x0000, /* cachectrl */ 0x0000, /* funcArg */ };
Example
12-8
IRQ_config
12.4 Functions
The following are functions available for use with the IRQ module.
IRQ_clear
Function
Arguments
IRQ_config
Function
Arguments
None Updates the entry in the DSPBIOS dispatch table for the specified event.
IRQ_config myConfig = { 0X0000, 0X0300, 0X0000, 0X0000 }; IRQ_config (IRQ_EVT_TINT0, &myConfig); IRQ Module 12-9
IRQ_disable IRQ_disable
Function
Arguments
int
IRQ_enable
Function
Arguments
IRQ_getArg
Function
Arguments
12-10
IRQ_globalDisable
Return Value Description Example Value of argument Returns value for specified event.
Uint32 evVal; evVal = IRQ_getArg(IRQ_EVT_TINT0);
IRQ_getConfig
Function
Arguments
Returns current values in DSP/BIOS dispatch table entry for the specified event.
IRQ_Config myConfig; IRQ_getConfig(IRQ_EVT_SINT3, &myConfig);
This function globally disables interrupts by setting the INTM of the ST1 register. The old value of INTM is returned. This is useful for temporarily disabling global interrupts, then enabling them again.
int intm; intm = IRQ_globalDisable(); ... IRQ_globalRestore (intm); IRQ Module 12-11
Example
This function globally Enables interrupts by setting the INTM of the ST1 register. The old value of INTM is returned. This is useful for temporarily enabling global interrupts, then disabling them again.
int intm; intm = IRQ_globalEnable(); ... IRQ_globalRestore (intm);
Example
Example
12-12
IRQ_plug IRQ_map
Function
IRQ_plug
Function
Arguments
funcAddr
0 or 1 Initializes an interrupt vector table vector with the necessary code to branch to the specified ISR. Caution: Do not use this function when DSP/BIOS is present and the dispatcher is enabled.
Example
interrupt void myIsr (); . . . IRQ_plug (IRQ_EVT_TINT0, &myIsr) IRQ Module 12-13
IRQ_setArg IRQ_restore
Function
Arguments
This function restores the events state to the value that was originally passed to it.
int oldint; oldint = IRQ_disable(IRQ_EVT_TINT0); . . . IRQ_restore(IRQ_EVT_TINT0, oldint);
IRQ_setArg
Function
Arguments
None Sets the argument that DSP/BIOS dispatcher will pass to the interrupt service routine for the specified event.
IRQ_setArg(IRQ_EVT_TINT0, val);
12-14
IRQ_test IRQ_setVecs
Function
Old IVPD register value Use this function to set the base address of the interrupt vector table in the IVPD and IVPH registers (both registers are set to the same value). Caution: Changing the interrupt vector table base can have adverse effects on your system because you will be effectively eliminating all previous interrupt settings. There is a strong chance that the DSP/BIOS kernel and RTDX will fail if this function is not used with care.
Example
IRQ_setVecs (0x8000);
IRQ_test
Function
Arguments
Event flag, 0 or 1 Tests an event to see if its flag is set in the IFR register.
while (!IRQ_test(IRQ_EVT_TINT0);
IRQ Module
12-15
IRQ_test
12-16
Chapter 13
McBSP Module
This chapter describes the McBSP module, lists the API structure, functions, and macros within the module, and provides a McBSP API reference section.
Topic
Page
13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2 13.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6 13.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8 13.5 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23 13.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-26
13-1
Overview
13.1 Overview
The McBSP is a handle-based module that requires you to call MCBSP_open() to obtain a handle before calling any other functions. Table 132 lists the structure and functions for use with the McBSP modules. Table 131 lists the configuration structure used to set up the McBSP. Table 132 lists the functions available for use with the McBSP module Table 133 lists McBSP registers and fields.
13-2
Overview
Description Reads the RFULL bit SPCR1 register Reads the RRDY status bit of the SPCR1 register Starts a McBSP receive/transmit based on start flags Writes a 16-bit value to the serial port data transmit register, DXR1 Writes two 16-bit values to the two serial port data transmit registers, DXR2 (16-bit MSB) and DXR1 (16-bit LSB) Reads the XEMPTY bit from the SPCR2 register Reads the XRDY status bit of the SPCR2 register
See page ... 13-18 13-19 13-19 13-21 13-21 13-22 13-22
McBSP Module
13-3
Overview
13-4
Overview
Note:
McBSP Module
13-5
MCBSP_Config
MCBSP_Config
Structure Members
Description
The McBSP configuration structure is used to set up a McBSP port. You create and initialize this structure and then pass its address to the MCBSP_config() function. You can use literal values or the MCBSP_RMK macros to create the structure member values.
13-6
MCBSP_Config
13.3
Example
MCBSP_Config config1 = { 0xFFFF, /* spcr1 */ 0x03FF, /* spcr2 */ 0x7FE0, /* rcr1 */ 0xFFFF, /* rcr2 */ 0x7FE0, /* xcr1 */ 0xFFFF, /* xcr2 */ 0xFFFF, /* srgr1 */ 0xFFFF, /* srgr2 */ 0x03FF, /* mcr1 */ 0x03FF, /* mcr2 */ 0xFFFF, /* pcr */ 0xFFFF, /* rcera */ 0xFFFF, /* rcerb */ 0xFFFF, /* rcerc */ 0xFFFF, /* rcerd */ 0xFFFF, /* rcere */ 0xFFFF, /* rcerf */ 0xFFFF, /* rcerg */ 0xFFFF, /* rcerh */ 0xFFFF, /* xcera */ 0xFFFF, /* xcerb */ 0xFFFF, /* xcerc */ 0xFFFF, /* xcerd */ 0xFFFF, /* xcere */ 0xFFFF, /* xcerf */ 0xFFFF, /* xcerg */ 0xFFFF /* xcerh */ } ... hMcbsp = MCBSP_open(MCBSP_PORT0, MCBSP_OPEN_RESET) ... MCBSP_config(hMcbsp, &config1);
McBSP Module
13-7
MCBSP_channelDisable
13.4 Functions
The following are functions available for use with the McBSP module. MCBSP_channelDisable Disables one or several McBSP channels Function void MCBSP_channelDisable( MCBSP_Handle hMcbsp, Uint16 RegName, Uint16 Channels ); hMcbsp Handle to McBSP port obtained by MCBSP_open() RegName Receive and Transmit Channel Enable Registers: - RCERA - RCERB - XCERA - XCERB - RCERC - RCERD - RCERE - RCERF - RCERG - RCERH - XCERC - XCERD - XCERE - XCERF - XCERG - XCERH Channels Available values for the specific RegName are: - MCBSP_CHAN0 - MCBSP_CHAN1 - MCBSP_CHAN2 - MCBSP_CHAN3 - MCBSP_CHAN4 - MCBSP_CHAN5 - MCBSP_CHAN6 - MCBSP_CHAN7 - MCBSP_CHAN8 - MCBSP_CHAN9 - MCBSP_CHAN10 - MCBSP_CHAN11 - MCBSP_CHAN12
Arguments
13-8
MCBSP_channelEnable
- MCBSP_CHAN13 - MCBSP_CHAN14 - MCBSP_CHAN15
None Disables one or several McBSP channels of the selected register. To disable several channels at the same time, the sign | OR has to be added in between. To see if there is pending data in the receive or transmit buffers before disabling a channel, use MCBSP_rrdy() or MCBSP_xrdy().
Example
/* Disables Channel 0 of the partition A */ MCBSP_channelDisable(hMcbsp,RCERA, MCBSP_CHAN0); /* Disables Channels 1, 2 and 8 of the partition B with |*/ MCBSP_channelDisable(hMcbsp,RCERB, (MCBSP_CHAN1 | MCBSP_CHAN2 | MCBSP_CHAN8));
MCBSP_channelEnable Function
void MCBSP_channelEnable( MCBSP_Handle hMcbsp, Uint16 RegName, Uint16 Channels ); hMcbsp Handle to McBSP port obtained by MCBSP_open()
Arguments
RegName Receive and Transmit Channel Enable Registers: - RCERA - RCERB - XCERA - XCERB - RCERC - RCERD - RCERE - RCERF - RCERG - RCERH - XCERC - XCERD - XCERE
McBSP Module 13-9
MCBSP_channelEnable
Channels
Available values for the specificReg Addr are: - MCBSP_CHAN0 - MCBSP_CHAN1 - MCBSP_CHAN2 - MCBSP_CHAN3 - MCBSP_CHAN4 - MCBSP_CHAN5 - MCBSP_CHAN6 - MCBSP_CHAN7 - MCBSP_CHAN8 - MCBSP_CHAN9 - MCBSP_CHAN10 - MCBSP_CHAN11 - MCBSP_CHAN12 - MCBSP_CHAN13 - MCBSP_CHAN14 - MCBSP_CHAN15
None Enables one or several McBSP channels of the selected register. To enable several channels at the same time, the sign | OR has to be added in between.
Example
/* Enables Channel 0 of the partition A */ MCBSP_channelEnable(hMcbsp,RCERA, MCBSP_CHAN0); /* Enables Channel 1, 4 and 6 of the partition B with | */ MCBSP_channelEnable(hMcbsp,RCERB,(MCBSP_CHAN1| MCBSP_CHAN4 | MCBSP_CHAN6));
13-10
MCBSP_channelStatus
MCBSP_channelStatus Function
Uint16 MCBSP_channelStatus( MCBSP_Handle hMcbsp, Uint16 RegName, Uint16 Channel ); hMcbsp Handle to McBSP port obtained by MCBSP_open()
Arguments
RegName Receive and Transmit Channel Enable Registers: - RCERA - RCERB - XCERA - XCERB - RCERC - RCERD - RCERE - RCERF - RCERG - RCERH - XCERC - XCERD - XCERE - XCERF - XCERG - XCERH Channel Selectable Channels for the specific RegName are: - MCBSP_CHAN0 - MCBSP_CHAN1 - MCBSP_CHAN2 - MCBSP_CHAN3 - MCBSP_CHAN4 - MCBSP_CHAN5 - MCBSP_CHAN6 - MCBSP_CHAN7 - MCBSP_CHAN8 - MCBSP_CHAN9 - MCBSP_CHAN10 - MCBSP_CHAN11 - MCBSP_CHAN12 - MCBSP_CHAN13 - MCBSP_CHAN14 - MCBSP_CHAN15
McBSP Module 13-11
MCBSP_close
Return Value Description Example Channel status 0 - Disabled 1 - Enabled
Returns the channel status by reading the associated bit into the the selected register (RegName). Only one channel can be observed.
Uint16 C1, C4; /* Returns Channel Status of the channel 1 of the partition B */ C1=MCBSP_channelStatus(hMcbsp,RCERB,MCBSP_CHAN1); /* Returns Channel Status of the channel 4 of the partition A */ C4=MCBSP_channelStatus(hMcbsp,RCERA,MCBSP_CHAN4);
MCBSP_close
Function
MCBSP_config
Function
Arguments
None Sets up the McBSP port identified by hMcbsp handle using the configuration structure. The values of the structure are written directly to the Mcbsp port registers.
13-12
MCBSP_config
Note: If you want to configure all McBSP registers without starting the McBSP port, use MCBSP_config() without setting the SPCR2 (XRST, RRST, GRST, and FRST) fields. Then, after you write the first data valid to the DXR registers, call MCBSP_start() when ready to start the McBSP port. This guarantees that the correct value is transmitted/received. Example
MCBSP_Config MyConfig = { 0xFFFF, /* spcr1 */ 0x03FF, /* spcr2 */ 0x7FE0, /* rcr1 */ 0xFFFF, /* rcr2 */ 0x7FE0, /* xcr1 */ 0xFFFF, /* xcr2 */ 0xFFFF, /* srgr1 */ 0xFFFF, /* srgr2 */ 0x03FF, /* mcr1 */ 0x03FF, /* mcr2 */ 0xFFFF, /* pcr */ 0xFFFF, /* rcera */ 0xFFFF, /* rcerb */ 0xFFFF, /* rcerc */ 0xFFFF, /* rcerd */ 0xFFFF, /* rcere */ 0xFFFF, /* rcerf */ 0xFFFF, /* rcerg */ 0xFFFF, /* rcerh */ 0xFFFF, /* xcera */ 0xFFFF, /* xcerb */ 0xFFFF, /* xcerc */ 0xFFFF, /* xcerd */ 0xFFFF, /* xcere */ 0xFFFF, /* xcerf */ 0xFFFF, /* xcerg */ 0xFFFF /* xcerh */ }; ... MCBSP_config(myhMcbsp, &MyConfig);
McBSP Module
13-13
MCBSP_getPort
MCBSP_getConfig
Function
Arguments
None Reads the McBSP configuration into the configuration structure. See also McBSP_Config.
MCBSP_Config myConfig; ... hMcbsp = MCBSP_open(MCBSP_PORT0, 0); MCBSP_getConfig(hMcbsp, &myConfig);
MCBSP_getPort
Function Arguments Return Value Description Example
13-14
MCBSP_getXmt EventID
MCBSP_getRcvEventId Function
Uint16 MCBSP_getRcvEventId( MCBSP_Handle hMcbsp ); hMcbsp Handle to McBSP port obtained by MCBSP_open()
Receiver event ID Retrieves the IRQ receive event ID for a given port. Use this ID to manage the event using the IRQ module.
Uint16 RecvEventId; ... RecvEventId = MCBSP_getRcvEventId(hMcbsp); IRQ_enable(RecvEventId);
MCBSP_getXmt EventID Retrieves the transmit event ID for a given MCBSP port Function Uint16 MCBSP_getXmtEventId( MCBSP_Handle hMcbsp ); hMcbsp Handle to McBSP port obtained by MCBSP_open()
Transmitter event ID Retrieves the IRQ transmit event ID for the given port. Use this ID to manage the event using the IRQ module.
Uint16 XmtEventId; ... XmtEventId = MCBSP_getXmtEventId(hMcbsp); IRQ_enable(XmtEventId);
McBSP Module
13-15
MCBSP_open MCBSP_open
Function
Arguments
MCBSP_Handle
Before a McBSP device can be used, it must first be opened by this function. Once opened, it cannot be opened again until closed (see MCBSP_close). The return value is a unique device handle that is used in subsequent McBSP API calls. If the function fails, INV (1) is returned. If the MCBSP_OPEN_RESET is specified, then the power on defaults are set and any interupts are disabled and cleared.
Example
13-16
MCBSP_open MCBSP_read16
Function
Example
MCBSP_read32
Function
32-bit value (MSW-LSW ordering) A 32-bit read. First, the 16-bit MSW (Most significant word) is read from register DRR2. Then, the 16-bit LSW (least significant word) is read from register DRR1. Depending on the receive word data length you have selected in the RCR1/RCR2 register, the actual data could be 20, 24, or 32 bits. This function does not check to verify that new valid data has been received. Use MCBSP_rrdy() (prior to calling MCBSP_read32()) for this purpose.
Example
MCBSP_reset MCBSP_reset
Function
Example
MCBSP_reset(hMcbsp); MCBSP_reset(INV);
MCBSP_rfull
Function
Description Example
Reads the RFULL bit of the serial port control register 1. (Both RBR and RSR are full. A receive overrun error could have occured.)
if (MCBSP_rfull(hMcbsp)) { }
13-18
MCBSP_start MCBSP_rrdy
Function
Description Example
Reads the RRDY status bit of the SPCR1 register. A 1 indicates the receiver is ready with data to be read.
if (MCBSP_rrdy(hMcbsp)) { val = MCBSP_read16 (hMcbsp); }
MCBSP_start
Function
Arguments
SampleRateGenDelay Sample rate generates delay. MCBSP logic requires two sample_rate generator clock_periods after enabling the sample rate generator for its logic to stabilize. Use this parameter to provide the appropriate delay before starting the MCBSP. A conservative value should be equal to:
McBSP Module 13-19
MCBSP_start
2 Sample_Rate_Generator_Clock_period 4 C55x_Instruction_Cycle
MCBSP_SRGR_DEFAULT_DELAY (0xFFFF value) can be used (maximum value). Return Value Description None Starts a transmit and/or receive operation for a MCBSP port. Note: If you want to configure all McBSP registers without starting the McBSP port, use MCBSP_config() without setting the SPCR2 (XRST, RRST, GRST, and FRST) fields. Then, after you write the first data valid to the DXR registers, call MCBSP_start() when ready to start the McBSP port. This guarantees that the correct value is transmitted/received. Example 1
MCBSP_start(hMcbsp, MCBSP_XMIT_START, 0x3000); ... MCBSP_start(hMcbsp, MCBSP_XMIT_START|MCBSP_SRGR_START| MCBSP_SRGR_FRAMESYNC, 0x1000); MCBSP_start(hMcbsp, MCBSP_SRGR_START|MCBSP_RCV_START, 0x200 );
Example 2
13-20
MCBSP_start MCBSP_write16
Function
Arguments
None Directly writes a 16-bit value to the serial port data transmit register: DXR1. Depending on the receive word data length you have selected in the XCR1/XCR2 registers, the actual data could be 8, 12, or 16 bits long. This function does not verify that the transmitter is ready to transmit a new word. Use MCBSP_xrdy() (prior to calling MCBSP_write16()) for this purpose.
Example
MCBSP_write32
Function
Arguments
None Writes a 32-bit value. Depending on the transmit word data length you have selected in the XCR1|XCR2 registers, the actual data could be 20, 24, or 32 bits long. This function does not check to verify that the transmitter is ready to transmit a new word. Use MCBSP_xrdy() (prior to calling MCBSP_write32()) for this purpose.
Example
MCBSP_xempty MCBSP_xempty
Function
Description Example
Reads the XEMPTY bit from the SPCR2 register. A 0 indicates the transmit shift (XSR) is empty.
if (MCBSP_xempty(hMcbsp)) { }
MCBSP_xrdy
Function
Description
Reads the XRDY status bit of the SPCR2 register. A 1 indicates that the transmitter is ready to transmit a new word. A 0 indicates that the transmitter is not ready to transmit a new word.
if (MCBSP_xrdy(hMcbsp)) { ... MCBSP_write16 (hMcbsp, 0x1234); ... }
Example
13-22
Macros
13.5 Macros
The CSL offers a collection of macros to gain individual access to the McBSP peripheral registers and fields. Table 134 lists macros available for the McBSP module using McBSP port number. Table 135 lists macros available for the McBSP module using handle.
(b) Macros to read/write McBSP register field values (Applicable only to registers with more than one field) Macro MCBSP_FGET() MCBSP_FSET() Syntax Uint16 MCBSP_FGET(REG#, FIELD) Void MCBSP_FSET(REG#, FIELD, Uint16 fieldval)
(c) Macros to create a value for the McBSP registers and fields (Applies only to registers with more than one field) Macro MCBSP_REG_RMK() Syntax Uint16 MCBSP_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed MCBSP_FMK() Uint16 MCBSP_FMK(REG, FIELD, fieldval)
McBSP Module
13-23
Macros
1) REG# indicates, if applicable, a register name with the channel number (example: DMACCR0) 2) REG indicates the registers: SPCR1, SPCR2, RCR1, RCR2, XCR1, XCR2, SRGR1, SRGR2, MCR1, MCR2, RCERA, RCERB, RCERC, RCERD, RCERE, RCERF, RCERG, RCERH, XCERA, XCERB, XCERC, XCERD, XCERE, XCERF, XCERG, XCERH, PCR 3) FIELD indicates the register field name as specified in the 55x DSP Peripherals Reference Guide. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 4) regval indicates the value to write in the register (REG). 5) fieldval indicates the value to write in the field (FIELD).
(b) Macros to read/write McBSP register field values (Applicable only to registers with more than one field) Macro MCBSP_FGETH() MCBSP_FSETH() Syntax Uint16 MCBSP_FGETH(MCBSP_Handle hMCBSP, REG, FIELD) Void MCBSP_FSETH( MCBSP_Handle hMCBSP, REG, FIELD, Uint16 fieldval)
13-24
Macros
1) REG indicates the registers: SPCR1, SPCR2, RCR1, RCR2, XCR1, XCR2, SRGR1, SRGR2, MCR1, MCR2, RCERA, RCERB, RCERC, RCERD, RCERE, RCERF, RCERG, RCERH, XCERA, XCERB, XCERC, XCERD, XCERE, XCERF, XCERG, XCERH, PCR 2) FIELD indicates the register field name as specified in the 55x DSP Peripherals Reference Guide. - For REG_FSETH, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
McBSP Module
13-25
Examples
13.6 Examples
Examples for the McBSP module are found in the CCS examples\<target>\csl directory. Example 131 illustrates the McBSP port initialization using MCBSP_config(). The example also explains how to set the McBSP into digital loopback mode and perform 32-bit reads/writes from/to the serial port.
13-26
Examples
McBSP Module
13-27
13-28
Chapter 14
MMC Module
This chapter contains descriptions of the configuration structures, data strucutres, and functions available in the multimedia controller (MMC) module. This module supports both MMC and SD cards. The initialization and data transfer to MMC and SD cards differ in a few aspects, and there are SD_<function> APIs provided for accessing the SD card. The MMC APIs and data structures that are valid only for MMC cards are marked accordingly. All other APIs can be used for both MMC and SD cards. Note: The SPI mode is no longer supported on the 5509 MMC Controller.
Topic
Page
14.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2 14.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5 14.3 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6 14.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13
14-1
Overview
14.1 Overview
Table 141. MMC Configuration Structures
Config Structure MMC_Config Description MMC configuration structure See Page 14-5
Description Structure used to assign functions for each interrupt Contains card-specific data Contains card-specific data Contains card identification (CID) Contains information about memory cards including CID and CSD structures for MMC/SD cards Extended card-specific data (XCSD) Structure to store commands Structure to store values of all MMC regs Native mode Initialization Structure Structure to store values of MMC response registers
See Page 14-6 14-7 14-8 14-9 14-10 14-10 14-11 14-11 14-12 14-12
14-2
Overview
MMC Module
14-3
Overview
Description Sets the operating voltage window while in Native mode Associated functions to interrupts and installs dispatcher routines Set the relative card address of an attached memory card Halts a current data transfer Waits for a particular field in the MMCST0 register to be set Writes a block of data. This is a blocking function in that it does not return until all data has been transferred Sends broadcast command to SD cards to identify themselves Reads SD specific card ID from MMC response registers Reads SD card-specific data from response registers Asks the SD card to respond with its relative card address Sets the data bus width to either 1 bit or 4 bits
See Page 14-24 14-25 14-25 14-26 14-26 14-27 14-29 14-30 14-30 14-31 14-31
14-4
MMC_Config
MMC_Config
Structure Members
Uint16 mmcctl Uint16 mmcfclk Uint16 mmcclk Uint16 mmcie Uint16 mmctor Uint16 mmctod Uint16 mmcblen Uint16 mmcnblk
/* /* /* /* /* /* /* /*
Control register Functional Clock register Clock Control register Interrupt Enable register Timeout Response register Timeout Data Read register Block Length register Number of Block register
*/ */ */ */ */ */ */ */
Description Example
MMC configuration strucutre used to set up the MMC interface. You create and initialize this structure and then pass its address to the MMC_config() function.
MMC_Config Config = { 0x000F, 0x0F00, 0x0001, 0x0FA0, 0x0500, 0x0500, 0x0200, 0x0001 /* /* /* /* /* /* /* /* MMCCTL MMCFCLK MMCCLK MMCIE MMCTOR MMCTOD MMCBLEN MMCNBLK */ */ */ */ */ */ */ */
};
MMC Module
14-5
MMC_CallBackObj
MMC_CallBackObj
Structure Members
Description Example
14-6
MMC_CardCsdobj MMC_CardCsdobj
Structure Members Uint16 csdStructure Uint16 mmcProt Uint16 taac Uint16 nsac Uint16 tranSpeed Uint16 ccc Uint16 readBlLen Uint16 readBlPartial Uint16 writeBlkMisalign Uint16 readBlkMisalign Uint16 dsrImp Uint16 cSize Uint16 vddRCurrMin Uint16 vddRCurrMax Uint16 vddWCurrMin Uint16 vddWCurrMax Uint16 cSizeMult Uint16 eraseGrpSize Uint16 eraseGrpMult Uint16 wpGrpSize Uint16 wpGrpEnable Uint16 defaultEcc Uint16 r2wFactor Uint16 writeBlLen Uint16 writeBlPartial Uint16 fileFmtGrp Uint16 copy Uint16 permWriteProtect Uint16 tmpWriteProtect 2-bit structure type field 2-bit MMC protocol 8-bit TAAC 8-bit NSAC 8-bit max data transmission speed 12-bit card command classes 4-bit maximum Read Block Length 1-bit indicates if partial read blocks allowed 1-bit flag indicates write block misalignment 1-bit flag indicates read block misalignment 1-bit flag indicates whether card has DSR reg 12-bit device size 3-bit Max. Read Current @ Vdd Min 3-bit Max. Read Current @ Vdd Max 3-bit Max. Write Current @ Vdd Min 3-bit Max. Write Current @ Vdd Max 3-bit device size multiplier 5-bit erase sector size 5-bit erase group multiplier 5-bit write protect group size 1-bit write protect enable flag 2-bit Manufacturer default ECC 3-bit stream write factor 4-bit maximum write block length 1-bit indicates if partial write blocks allowed 1-bit file format group 1-bit copy flag 1-bit to disable/enable permanent write protection 1-bit to disable/enable temporary write protection
MMC Module 14-7
SD_CardCsdObj
2-bit file format 2-bit ECC code 7-bit r/w/e redundancy check
SD_CardCsdObj
Structure Members Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16
14-8
csdStructure taac nsac tranSpeed ccc readBlLen readBlPartial writeBlkMisalign readBlkMisalign dsrImp cSize vddRCurrMin vddRCurrMax vddWCurrMin vddWCurrMax cSizeMult eraseBlkEn sectorSize wpGrpSize wpGrpEnable r2wFactor writeBlLen
2bit structure type field 8-bit TAAC 8-bit NSAC 8-bit max data transmission speed 12-bit card command classes 4-bit maximum Read Block Length 1-bit indicates if partial read blocks allowed 1-bit flag indicates write block misalignment 1-bit flag indicates read block misalignment 1-bit flag indicates whether card has DSR reg 12-bit device size 3-bit Max. Read Current @ Vdd Min 3-bit Max. Read Current @ Vdd Max 3-bit Max. Write Current @ Vdd Min 3-bit Max. Write Current @ Vdd Max 3-bit device size multiplier 1-bit erase single block enable 7-bit erase group size 7-bit write protect group size 1-bit write protect enable flag 3-bit stream write factor 4-bit maximum write block length
MMC_CardIdObj
1-bit indicates if partial write blocks allowed 1-bit file format group 1-bit copy flag 1-bit to disable/enable permanent write protection 1-bit to disable/enable temporary write protection 2-bit file format 7-bit r/w/e redundancy check
MMC_CardIdObj
Structure Members
Uint32 mfgId Uint16 hwRev Uint16 fwRev Uint32 serialNumber Uint16 monthCode Uint16 yearCode Uint16 checksum Description Example
24-bit Manufacturers ID 4-bit Hardware Revision Number 4-bit Firmware Revision Number 24-bit Serial Number 4-bit Manufacturing Date (Month) bit Manufacturing Date (Year) 7-bit crc
MMC Module
14-9
MMC_CardObj MMC_CardObj
Structure Members Uint32 rca Uint16 status Uint16 CardIndex Uint16 cardType Uint32 maxXfrRate Uint32 readAccessTime Uint32 cardCapacity Uint32 lastAddrRead Uint32 lastAddrWritten MMC_CardIdObj cid MMC_CardCsdObj *MMC_csd SD_CardCsdObj *SD_csd; MMC_CardXCsdObj *xcsd Description Example User assigned relative card address (RCA) Last read status value MMC module assigned index for card MMC or SD Maximum transfer rate TAAC exp * mantissa Total memory available on card Last address read from memory card Last address written to on memory card Manufacturers Card ID Card-specific data card either sd or mmc; we will use the appropriate csd. Extended CSD
Contains information about memory cards, including CID and CSD. None
MMC_CardXCsdobj
Structure Members
Uint16 securitySysId Uint16 securitySysVers Uint16 maxLicenses Uint32 xStatus Description Example
14-10
Security System ID Security System Version Maximum number of storable licenses Extended status bits
MMC_MmcRegObj MMC_Cmdobj
Structure Members Uint16 argh Uint16 argl Uint16 cmd Description Example High part of command argument Low part of command argument MMC command
MMC_SetupNative MMC_SetupNative
Structure Members Uint16 dmaEnable Uint16 dat3EdgeDetection Uint16 goIdle Uint16 enableClkPin Uint32 fdiv Uint32 cdiv Uint16 rspTimeout Uint16 dataTimeout uint16 blockLen Description Example Enable/disable DMA for data read/write Set level of edge detection for DAT3 pin Determines if MMC goes IDLE during IDLE instr Memory clk reflected on CLK Pin CPU CLK to MMC function clk divide down MMC func clk to memory clk divide down Number of memory clks to wait before response timeout Number of memory clks to wait before data timeout Block length must be same as CSD
MMC_RspRegObj
Structure Members
Description Example
14-12
MMC_close
14.4 Functions
MMC_close
Function
MMC_config MMC_config
Function
Arguments
Description
Configures the MMC controller by writing the specified values to the MMC control registers. Calls to this function are unnecessary if you have called the MMC_open function using any of the MMC_OPEN_INIT_XXX flags and have set the needed configuration parameters in the MMC_InitObj structure.
MMC_config(myMMC, &myMMCCfg);
Example
MMC_dispatch0
Function Arguments Description Example
MMC_dispatch1
Function Arguments Description Example
14-14
MMC_dxrdy MMC_drrdy
Function
MMC_dxrdy
Function
MMC Module
14-15
MMC_getCardCSD MMC_getCardCSD
Function
void MMC_getCardCSD( MMC_Handle mmc, MMC_CardCSD Obj *csd); mmc csd MMC Handle returned by call to MMC_open Pointer to Card Specific Data object
Arguments
Description
Parses CSD data from response registers. MMC_getCardCSD verifies that the SEND_CSD command has been issued and the response is complete.
MMC_Handle myMmc; MMC_CardCsd Obj *csd; . . . MMC_sendCSD(myMmc); MMC_getCardCSD(myMmc, csd);
Example
MMC_getCardId
Function
Arguments
Description
Parses memory card ID from contents of the MMC controller response registers and returns the card identity in the given card ID object.
MMC_Handle myMmc; MMC_CardIdObj myCardId; myMmc = MMC_open(MMC_DEV1); . . MMC_getCardId(myMmc,&myCardId);
Example
14-16
MMC_getNumberOfCards MMC_getConfig
Function
Arguments
Description
Returns the values of the MMC control registers in the specified MMC configuration structure.
MMC_getConfig(myMMC, &myMMcCfg);
Example
MMC_getNumberOfCards
Function
Uint16 MMC_getNumberOfCards( MMC_Handle mmc, Uint16 *active, Uint16 *inactive ); mmc active inactive MMC Handle returned by call to MMC_open. Pointer to where to return number of active cards. Pointer to where to return number of inactive cards.
Arguments
Description
Returns the number of cards found when MMC_open is called with the MMC_OPEN_SENDALLCID option.
MMC_Handle myMmc; MMC_InitObj myMmcInit; Uint16 n; Uint16 active[i] = {0}; Uint16 inactive[i] = {0}; MyMmc = MMC_open(MMC_DEV1); n = MMC_getNumberOfCards(myMmc, active, inactive); MMC Module 14-17
Example
MMC_getStatus MMC_getStatus
Function
MMC_open
Function
Arguments
Description
MMC_open performs the following tasks: 1) Reserves the specified MMC controller and corresponding MMC port. 2) Enables controller access by setting appropriate bits in the External Bus Selection register.
Example
14-18
MMC_responseDone MMC_read
Function
Arguments
Description Example
Reads a block of data from the pre-selected memory card (see MMC_selectCard) and stores the information in the specified buffer.
MMC_Handle myMmc; Uint16 mybuf[512]; MyMmc = MMC_open(MMC_DEV1); . . . MMC_read(myMmc, 0, mybuf, 512);
MMC_responseDone
Function
Arguments Description
Example
MMC_saveStatus MMC_saveStatus
Function
Saves the current contents of the MMCST0 register in the MMC Handle.
MMC_Handle myMmc; . . . MMC_saveStatus(myMmc);
MMC_selectCard
Function
14-20
MMC_sendAllCID MMC_sendAllCID
Function
Arguments Description
This function sends the MMC_SEND_ALL_CID command to initiate identification of all memory cards attached to the controller. If a response is sent from a card, it returns the information about that card in the specified cardId object.
MMC_Handle myMmc; MMC_CardIdObj myCardId; myMmc = MMC_open(MMC_DEV1, MMC_OPEN_ONLY); . . MMC_SendAllCID(myMmc, &myCardID);
Example
MMC Module
14-21
MMC_sendCmd MMC_sendCmd
Function
Arguments
Description
Function sends the specified command to the memory card associated with the given relative card address. Optionally, the function will wait for a response from the card before returning.
MMC_Handle myMmc; myMmc = MMC_open(MMC_DEV0); . . . MMC_SendCmd(myMmc, MMC_GO_IDLE_STATE, 0, 0, 1);
Example
MMC_sendCSD
Function
Sends a request to card in the identification process to submit its Card Specific Data Structures.
MMC_Handle myMmc; . . . MMC_sendCSD(myMmc);
14-22
MMC_setCardPtr MMC_sendGoIdle
Function
MMC_setCardPtr
Function
Arguments Description
Sets the card pointer in the MMC global status table. This function must be used if the application performs a system/card initialization outside of the MMC_initCard function.
MMC_Handle myMmc; MMC_cardObj *card; MMC_setCardPtr(myMmc, &card);
Example
MMC Module
14-23
MMC_sendOpCond MMC_sendOpCond
Function
int MMC_sendOpCond( MMC_Handle mmc, Uint32 hvddMask ); mmc MMC Handle returned by call to MMC_open hvddMask Mask used to set operating voltage conditions in native mode Sets the operating condition in native mode.
Arguments Description
Example
MMC_Handle myMmc; .
14-24
MMC_setRca
. . /* enables 3.2-3.3V of operating voltage by setting bit 20 */ MMC_sendOpCond(myMmc, 0x00100000)
MMC_setCallBack
Function
Arguments
Description Example
MMC_setRca
Function
Arguments
Description Example
MMC_stop
MMC_CardObj *card; myMmc = MMC_open(MMC_DEV0); . . . MMC_sendAllCid(myMmc, &cardid); . . . MMC_setRca(myMmc, card, 2);
MMC_stop
Function
MMC_waitForFlag
Function
14-26
MMC_write MMC_write
Function
Arguments
Description Example
MMC Module
14-27
MMC_intEnable MMC_intEnable
Function
Arguments
Description
Enables interrupts by writing to the MMCIE register. The functions that service MMC events need to be associated to the interrupts using the MMC_setCallBack before calling this function.
MMC_Handle myMmc; Uint16 enableMask; MMC_callBackObj callback; ... myMmc = MMC_open(MMC_DEV1); . . . MMC_setCallBack(myMmc, &callback); MMC_intEnable(myMMc, 0x200);
Example
14-28
SD_sendAllCID MMC_setCardType
Function
Arguments
Description Example
Sets the card type in the card obj for later reference
MMC_CardObj *card; Uint16 type; . . type = MMC_sendOpCond(myMmc,0x00100000); /* Returns either MMC_CARD or SD_CARD */ . . . MMC_setCardType(card, type);
SD_sendAllCID
Function
Arguments Description
Example
SD_getCardId SD_getCardId
Function
Arguments
Description
Example
SD_getCardCsd
Function
Arguments
Description
Example
14-30
SD_setWidth SD_sendRca
Function
Arguments
Description
The host requests the SD card to set its Relative Card Address and send it to the host once done. This RCA will be used for all future communication with the card.
MMC_Handle mySD; MMC_CardObj *card; . . . SD_sendRca(mySD, card);
Example
SD_setWidth
Function
Arguments
Description Example
The SD card supports a 4-bit width data transfer. The bus width can be set after the card is selected using the MMC_selCard API.
MMC_Handle mySD; Uint16 retVal; MMC_CardObj *card; . . mySD = MMC_open(MMC_DEV1); . . retVal = MMC_selectCard(mySD,card); retVal = SD_setWidth(mySD, 0x4);
MMC Module
14-31
SD_setWidth
14-32
Chapter 15
PLL Module
This chapter describes the PLL module, lists the API structure, functions, and macros within the module, and provides a PLL API reference section.
Topic
Page
15.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2 15.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4 15.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5 15.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7
15-1
Overview
15.1 Overview
The CSL PLL module offers functions and macros to control the Phase Locked Loop of the C55xx. The PLL module is not handle-based. Table 151 lists the configuration structure used to set up the PLL module. Table 152 lists the functions available for use with the PLL module. Table 153 lists PLL registers and fields. Section 15.4 includes a description of available PLL macros.
15-2
Overview
PLLEN, PLLPWRDN, OSCPWRDN, PLLRST, LOCK, STABLE PLLM PLLDIV0, D0EN PLLDIV1, D1EN PLLDIV2, D2EN PLLDIV3, D3EN OSCDIV1, OD1EN WKEN0, WKEN1, WKEN2, WKEN3 CLKMD0 CLKOUTDIS, CLKOSEL
PLL Module
15-3
PLL_Config
PLL_Config
Structure Members
Description
The PLL configuration structure is used to set up the PLL Interface. You create and initialize this structure and then pass its address to the PLL_config() function. You can use literal values or the PLL_RMK macros to create the structure member values.
PLL_Config 1, 1, 31, 3 } Config1 = { /* iai */ /* iob */ /* pllmult */ /* div */
Example
15-4
PLL_config
15.3 Functions
The following are functions available for use with the PLL module.
PLL_config
Function
0x8001, /* PLLDIV0 */ 0x8003, /* PLLDIV1 */ 0x8003, /* PLLDIV2 */ 0x8003, /* PLLDIV3 */ 0x0, 0x0, 0x0, 0x2 }; PLL_config(&MyConfig);
PLL Module 15-5
/* CLKOUTSR */
PLL_config PLL_setFreq
Function
Arguments
Uint16 mode
Uint16 mul Uint16 div0 Uint16 div1 Uint16 div2 Uint16 div3 Uint16 oscdiv Return Value Description Example None
// PLL mode //PLL_PLLCSR_PLLEN_BYPASS_MODE //PLL_PLLCSR_PLLEN_PLL_MODE // Multiply factor, Valid values are (multiply by) 2 to 15. // Sysclk 0 Divide Down, Valid values are 0, (divide by 1) //to 31 (divide by 32) // Sysclk1 Divider, Valid values are 0, 1, and 3 corresponding //to divide by 1, 2, and 4 respectively // Sysclk2 Divider, Valid values are 0, 1, and 3 //corresponding to divide by 1, 2, and 4 respectively // Sysclk3 Divider, Valid values are 0, 1 and 3 //corresponding to divide by 1, 2 and 4 respectively // CLKOUT3(DSP core clock) divider,Valid values are 0 //(divide by 1) to 31 (divide by 32)
Initializes the PLL to produce the desired CPU output frequency (clkout)
1. /* Using PLL_setFreq for devices other than 5502/5501 */ PLL_setFreq (1, 2); // set clkout = 1/2 clkin 2. /* Using PLL_setFreq for 5502 device /* mode = 1 means PLL enabled (nonbypass mode) mul = 5 means multiply by 5 div0 = 0 means Divider0 divides by 1 div1 = 3 means Divider1 divides by 4 div2 = 3 means Divider2 divides by 4 div3 = 3 means Divider3 divides by 4 oscdiv = 1 means Oscillator Divider1 divides by 2 */ PLL_setFreq(1, 5, 0, 3, 3, 3, 1); */
15-6
Macros
15.4 Macros
The CSL offers a collection of macros to gain individual access to the PLL peripheral registers and fields. Table 154 contains a list of macros available for the PLL module. To use them, include csl_pll.h.
(b) Macros to read/write PLL register field values (Applicable only to registers with more than one field) Macro PLL_FGET() PLL_FSET() Syntax Uint16 PLL_FGET(REG, FIELD) Void PLL_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to PLL registers and fields (Applies only to registers with more than one field) Macro PLL_REG_RMK() Syntax Uint16 PLL_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed PLL_FMK() Uint16 PLL_FMK(REG, FIELD, fieldval)
1) REG indicates the register, CLKMD. 2) FIELD indicates the register field name. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
PLL Module
15-7
15-8
Chapter 16
PWR Module
This chapter describes the PWR module, lists the API functions and macros within the module, and provides a PWR API reference section. The CSL PWR module offers functions to select which section in the device will power-down during an IDLE execution.
Topic
Page
16-1
Overview
16.1 Overview
The CSL PWR module offers functions to control the power consumption of different sections in the C55x device. The PWR module is not handle-based. Table 161 lists the functions for use with the PWR modules that order specific parts of the C55x to power down. Table 162 lists DMA registers and fields.
PWR_powerDown Forces the DSP to enter a power-down (IDLE) state (only for C5509 and C5510)
Field
EMIFI, CLKGENI, PERI, CACHEI, DMAI, CPUI EMIFIS, CLKGENIS, PERIS, CACHEIS, DMAIS, CPUIS
16-2
PWR_powerDown
16.2 Functions
The following are functions available for use with the PWR module.
PWR_powerDown Forces DSP to enter power-down state (On C5509 and C5510 only)
Function Arguments void PWR_powerDown (Uint16 wakeUpMode) wakeupMode - PWR_WAKEUP_MI wakes up with an unmasked interrupt and jump to execute the ISRs executed. - PWR_WAKEUP_NMI wakes up with an unmasked interrupt and executes the next following instruction (interrupt is not taken). None This function will Power-down the device in different power-down and wake-up modes by setting the C55x ICR register and invoking the IDLE instruction.
/* This function will power-down the McBSP2 */ /*and wake-up with an unmasked interrupt */ PWR_FSET(ICR, PERI, 1); MCBSP_FSET(PCR2, IDLEEN, 1); PWR_powerDown(PWR_WAKEUP_MI);
PWR Module
16-3
Macros
16.3 Macros
The CSL offers a collection of macros to gain individual access to the PWR peripheral registers and fields.. Table 163 contains a list of macros available for the PWR module. To use them, include csl_pwr.h.
(b) Macros to read/write PWR register field values (Applicable only to registers with more than one field) Macro PWR_FGET() PWR_FSET() Syntax Uint16 PWR_FGET(REG, FIELD) Void PWR_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to PWR registers and fields (Applies only to registers with more than one field) Macro PWR_REG_RMK() Syntax Uint16 PWR_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed PWR_FMK() Uint16 PWR_FMK(REG, FIELD, fieldval)
1) REG indicates the register, ICR, ISTR 2) FIELD indicates the register field name as specified in the 55x DSP Peripherals Reference Guide. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
16-4
Chapter 17
RTC Module
This chapter describes the RTC module, lists the API structure, functions, and macros within the module, and provides an RTC API reference section.
Topic
Page
17.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2 17.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6 17.3 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9 17.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16
17-1
Overview
17.1 Overview
The real-time clock (RTC) provides the following features:
- 100-year calendar up to year 2099 - Counts seconds, minutes, hours, day of the week, date, month, and year
The RTC has a separate clock domain and power supply. The clock is derived from the external 32 KHz crystal. The configuration of the RTC can be performed by using one of the following methods:
- Register-based configuration
A register-based configuration can be performed by calling either RTC_config(), or any of the SET register/field macros.
- Parameter-based configuration
A parameter based configuration can be performed by calling the functions listed in Table 171, such as RTC_setTime(), RTC_setAlarm(). Compared to the register-based approach, this method provides a higher level of abstraction. The downside is larger code size and higher cycle counts.
- ANSI C-Style Time Configuration
Time functions are provided for the RTC module, which performs the same functions as the ANSI C-style standard time functions. The time is obtained, however, from the RTC. Table 173 contains the a list and descriptions of the RTC ANSI C-style functions. For a complete description of the functions, the arguments and structures they use please refer to the TMS320C55x Optimizing Compiler Users Guide (SPRU281). Table 171 lists the configuration structures used to set up the RTC. Table 172 and Table 173 lists the functions available for use with the RTC.
17-2
Table 174 lists macros for the RTC. Table 175 lists RTC registers and fields.
RTC Module
17-3
Description Converts a time to an ASCII string Converts calendar time to local time Returns the difference between two calendar times Converts calendar time to GMT Converts calendar time to local time Converts local time to calendar time Formats a time into a character string Returns the current RTC time and date
For documentation on these functions, please refer to the ANSI C equivalent routines in the TMS320C55x Optimizing C Compiler Users Guide (SPRU281).
17-4
Field SEC SAR MIN MAR HR, AMPM HAR, AMPM DAY, DAEN, DAR DATE MONTH YEAR RS, (R)UIP TM, UIE, AIE, PIE, SET UF, AF, PF, (R)IRQF
RTC Module
17-5
RTC_Alarm
RTC_Alarm
Structure Members
You can use the DONTCARE value for each of the structures member if you want to set a periodic alarm for that specific interval. For example, using the DONTCARE value in the alminute field will generate an alarm interrupt every minute.
Note: Due to hardware limitations, after the first period, the every second periodic alarm does not produce an interrupt. To generate an alarm every second, use instead the update interrupt.
Description
Structure used to set the RTC time. After it is created and initialized, the structure is passed to the RTC_setAlarm() function. The values of the structure must be entered in BCD format. You can use the RTC_decToBcd() and RTC_bcdToDec() functions to switch between decimal and BCD values.
17-6
RTC_Date RTC_Config
Structure Members
Description
RTC configuration structure. This structure is created and initialized, and then passed to the RTC_Config() function. The values put in the structure can be literal values or values created by RTC_REG_RMK macro. For the hour registers, the supported mode is 24-hour. The values of all time, alarm, and calendar fields must be entered in BCD format. You can use the RTC_decToBcd() and RTC_bcdToDec() functions to switch between decimal and BCD values.
RTC_Date
Structure Members
Description
Structure used to set the RTC calendar. After it is created and initialized, the structure is passed to the RTC_setDate() function. The values of the structure must be entered in BCD format. You can use the RTC_decToBcd() and RTC_bcdToDec() functions to switch between decimal and BCD values.
RTC Module 17-7
RTC_Time RTC_IsrAddr
Structure Members
void (*alarmAddr)(void)
void (*updateAddr)(void)
Description
This structure is used to set the RTC callback function. After it is created and initialized, the structure is passed to RTC_setCallback() function. The values of the structure are pointers to the functions that are executed when the corresponding interrupt is enabled. The functions should not be declared with the interrupt keyword.
RTC_Time
Structure Members
Structure used to set the RTC time. After it is created and initialized, the structure is passed to the RTC_setTime() function. The values of the structure must be entered in BCD format. You can use the RTC_decToBcd() and RTC_bcdToDec() functions to switch between decimal and BCD values.
17-8
RTC_decToBcd
RTC_config
Function Arguments Description Example
RTC_decToBcd
Function Arguments
RTC_eventDisable
Description Example Changes a decimal value to a BCD value, which is what RTC needs.
for (i = 10;i<=30;i++) { printf(BCD of %d is %x\n,i,RTC_decToBcd(i)); }
Description Example
Description Example
RTC_getConfig
Function Arguments Description Example
Reads the RTC register values into the RTC configuration register structure.
RTC_Config myConfig; RTC_getConfig(&myConfig);
17-10
RTC_getTime RTC_getDate
Function Arguments
Description Example
Reads the current date from the RTC registers. Only the 24-hour format is supported. The values of the structure are read in BCD format.
RTC_Date getDate; RTC_getDate(&getDate);
RTC_getEventId
Function Arguments Description Example
RTC_getTime
Function Arguments Description
Reads the current time from the RTC registers, in 24-hour format. Only the 24-hour format is supported. The values of the structure are obtained in BCD format.
RTC_Time getTime; RTC_getTime(&getTime);
Example
RTC Module
17-11
RTC_reset RTC_reset
Function Arguments Description
Example
RTC_setAlarm
Function Arguments
Description
Set alarm at a specific time: sec, min, hour, day of week. Only the 24-hour format is supported. The values of the structure must be entered in BCD format.
RTC_Alarm myAlarm = { 0x12, /* alHour , in 24-hour format */ 0x03, /* alMinutes */ 0x03, /* alSeconds */ 0x05, /* alDayw */ }; RTC_setAlarm(&myAlarm); /*This sets the alarm at 12:03:03am, */ /* every week, on Thursday */
Example 1
Example 2
RTC_Alarm myPeriodicAlarm = { 0x1, /* alHour , in 24-hour format */ DONTCARE, /* alMinutes */ 0x0, /* alSeconds */ 0x2, /* alDayw */ }; RTC_setAlarm(&myAlarm); /* This sets the alarm every minute, at */ /* 01:**:00, on Monday of every week */
17-12
RTC_setDate RTC_setCallback
Function Arguments
Description
RTC_setCallback associates a function to each of the RTC interrupt events (periodic interrupt, alarm interrupt, or update ended interrupt):
Example
void myPeriodicIsr(); void myAlarmIsr(); void myUpdateIsr(); RTC_IsrAddr addr = { myPeriodicIsr, void myAlarmIsr, void myUpdateIsr }; RTC_setCallback(&addr);
RTC_setDate
Function Arguments
Description Example
Sets the RTC calendar. Only the 24-hour format is supported. The values of the structure must be entered in BCD format.
RTC_Date myDate = { 0x01, /* Year 2001 */ 0x05, /* Month May*/ 0x10, /* Day of month */ 0x05 /* Day of week Thursday */ }; RTC_setDate(&myDate); RTC Module 17-13
RTC_setPeriodicInterval
RTC_setPeriodicInterval Sets periodic interrupt rate Function Arguments void RTC_setPeriodicInterval(Uint16 interval); interval Symbolic value for periodic interrupt rate. An interval can be one of the following values: - RTC_RATE_NONE - RTC_RATE_122us - RTC_RATE_244us - RTC_RATE_488us - RTC_RATE_976us - RTC_RATE_1_95ms - RTC_RATE_3_9ms - RTC_RATE_7_8125ms - RTC_RATE_15_625ms - RTC_RATE_31_25ms - RTC_RATE_62_5ms - RTC_RATE_125ms - RTC_RATE_250ms - RTC_RATE_500ms - RTC_RATE_1min
Description Example
RTC_setTime
Function Arguments Description Example
Sets the time registers. Only the 24-hour format is supported. The values of the structure must be entered in BCD format.
RTC_Time myTime = { 0x13, /* Hour in 24-hour format */ 0x58, /* Minutes */ 0x30 /* Seconds */ }; RTC_setTime(&myTime);
This example sets the RTC time to 13:58:30 (24-hour format) and is equivalent to 1:58:30 PM (12-hour format).
17-14
RTC_stop RTC_start
Function Arguments Description Example
RTC_stop
Function Arguments Description Example
RTC Module
17-15
RTC_ADDR
17.4 Macros
The following are macros available for use with the RTC module.
RTC_ADDR
Macro Description Example
RTC_FGET
Macro Description Example
RTC_FSET
Macro Description Example
RTC_REG_FMK
Macro Description Example
17-16
RTC_RSET RTC_REG_RMK
Macro Arguments
Creates value of RTC registers (only for registers with more than one field).
Uint16 x, field1, field2, field3; x = RTC_RTDAYW_RMK(field1, field2, field3);
RTC_RGET
Macro Description Example
RTC_RSET
Macro Description Example
RTC Module
17-17
RTC_RSET
17-18
Chapter 18
Timer Module
This chapter describes the TIMER module, lists the API structure, functions and macros within the module, and provides a TIMER API reference section.
Topic
Page
18.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2 18.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3 18.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4 18.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9
18-1
Overview
18.1 Overview
Table 181 lists the configuration structure used to set the TIMER module. Table 182 lists the functions available for the TIMER module. Table 183 lists registers for the TIMER module. Section 18.4 inlcudes descriptions for available TIMER macros.
Field IDLEEN, (R)INTEXT, (R)ERRTIM, FUNC, TLB, SOFT, FREE, PWID, ARB, TSS, CP, POLAR, DATOUT PRD TIM PSC, TDDR
18-2
TIMER_Config
TIMER_Config
Structure Members
Uint16 prd Period Register Uint16 prsc Timer Pre-scaler Register Description The TIMER configuration structure is used to setup a timer device. You create and initialize this structure then pass its address to the TIMER_config() function. You can use literal values or the TIMER_RMK macros to create the structure member values.
TIMER_Config Config1 = { 0x0010, /* tcr */ 0xFFFF, /* prd */ 0xF0F0, /* prsc */ };
Example
Timer Module
18-3
TIMER_close
18.3 Functions
The following are functions available for use with the TIMER module.
TIMER_close
Function
TIMER_Handle Device handler Closes a previously opened timer device. The timer event is disabled and cleared. The timer registers are set to their default values.
TIMER_close(hTimer);
TIMER_config
Function
Arguments
none The values of the configuration structure are written to the timer registers (see also TIMER_Config).
TIMER_Config MyConfig = { 0x0010, /* tcr */ 0xFFFF, /* prd */ 0xF0F0 /* prsc */ }; TIMER_config(hTimer,&MyConfig);
18-4
TIMER_getEventId
TIMER_getConfig Function
Arguments
None Reads the TIMER configuration into the configuration structure. See also TIMER_Config.
TIMER_Config MyConfig; TIMER_getConfig(hTimer,&MyConfig);
Obtains the IRQ event ID for the timer device (see Chapter 10, IRQ Module).
Uint16 TimerEventId; TimerEventId = TIMER_getEventId(hTimer); IRQ_enable(TimerEventId);
Timer Module
18-5
TIMER_open TIMER_open
Function
Arguments
TIMER_Handle Device handler Before a TIMER device can be used, it must first be opened by this function. Once opened, it cannot be opened again until closed, see TIMER_close. The return value is a unique device handle that is used in subsequent TIMER calls. If the function fails, an INV (1) value is returned. If the TIMER_OPEN_RESET is specified, then the power on defaults are set and any interrupts are disabled and cleared.
TIMER_Handle hTimer; ... hTimer = TIMER_open(TIMER_DEV0,0);
Example
18-6
TIMER_stop TIMER_reset
Function
Resets TIMER
void TIMER_reset( TIMER_Handle hTimer ); hTimer none Resets the timer device. Disables and clears the interrupt event and sets the timer registers to default values. If INV (1) is specified, all timer devices are reset.
TIMER_reset(hTimer);
Example
TIMER_start
Function
TIMER_stop
Function
TIMER_tintoutCfg TIMER_tintoutCfg
Function
Arguments
Configures the TIN/TOUT pin of the device using the TCR register
Timer_tintoutCfg(hTimer, 1, /*idleen*/ 1, /*funct*/ 0, /*pwid*/ 0, /*cp*/ 0 /*polar*/ );
18-8
Macros
18.4 Macros
The CSL offers a collection of macros to gain individual access to the TIMER peripheral registers and fields. Table 184 lists of macros available for the TIMER module using TIMER port number and Table 185 lists the macros for the TIMER module using handle. To use them, include csl_timer.h. Table 183 lists DMA registers and fields.
(b) Macros to read/write TIMER register field values (Applicable only to registers with more than one field) Macro TIMER_FGET() TIMER_FSET() Syntax Uint16 TIMER_FGET(REG#, FIELD) Void TIMER_FSET(REG#, FIELD, Uint16 fieldval)
(c) Macros to create value to TIMER registers and fields (Applies only to registers with more than one field) Macro TIMER_REG_RMK() Syntax Uint16 TIMER_REG_RMK(fieldval_n,fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field *only writable fields allowed TIMER_FMK() Uint16 TIMER_FMK(REG, FIELD, fieldval)
1) REG indicates the registers: TCR, PRD, TIM, PRSC 2) REG# indicates, if applicable, a register name with the channel number (example: TCR0) 3) FIELD indicates the register field name as specified in the C55x DSP Peripherals Reference Guide. - For REG_FSET and REG_FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 4) regval indicates the value to write in the register (REG). 5) fieldval indicates the value to write in the field (FIELD).
Timer Module
18-9
Macros
(b) Macros to read/write TIMER register field values (Applicable only to registers with more than one field) Macro TIMER_FGETH() TIMER_FSETH() Syntax Uint16 TIMER_FGETH(TIMER_Handle hTimer, REG, FIELD) Void TIMER_FSETH( TIMER_Handle hTimer, REG, FIELD, Uint16 fieldval)
1) REG indicates the registers: TCR, PRD, TIM, and PRSC 2) FIELD indicates the register field name as specified inthe C55x DSP Peripherals Reference Guide. - For REG_FSETH, FIELD must be a writable field. - For REG_FGETH, the field must be a readable field. 3) regval indicates the value to write in the register (REG). 4) fieldval indicates the value to write in the field (FIELD).
18-10
Chapter 19
UART Module
This chapter describes the UART module, lists the API structure, functions, and macros within the module, and provides a UART API reference section.
Topic
Page
19.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2 19.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5 19.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8 19.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-14
19-1
Overview
19.1 Overview
The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications subsystem of a computer. Asynchronous transmission allows data to be transmitted without a clock signal to the receiver. Instead, the sender and receiver must agree on timing parameters in advance. Special bits are added to each word that is used to synchronize the sending and receiving units. The configuration of UART can be performed by using one of the following methods: 1) Register-based configuration A register-based configuration can be performed by calling either UART_config() or any of the SET register field macros. 2) Parameter-based configuration (Recommended) A parameter-based configuration can be performed by calling UART_setup(). Compared to the register-based approach, this method provides a higher level of abstraction. Table 191 lists the configuration structures and functions used with the UART module.
Type Purpose S F F F F F F F F F F UART configuration structure used to setup the UART Sets up the UART using the configuration structure Disable UART interrupts Enable UART interrupts Read a character from UART by polling This routine reads a string from the uart Write a character from UART by polling This routine writes a string from the uart Reads the UART configuration Read a buffer of data from UART by polling Plugs UART interrupt routines into UART dispatcher table
See page ... 19-5 19-8 19-8 19-9 19-10 19-11 19-11 19-11 19-11 19-12 19-12
19-2
Overview
Type Purpose S F F UART configuration structure used to setup the UART Sets up the UART using the register values passed into the code Write a buffer of data to UART by polling
UART Module
19-3
UART_Setup
UART_Config
Members
Divisor Latch Register (low 8 bits) Divisor Latch Register (high 8 bits) Line Control Register FIFO Control Register Modem Control Register
Description
UART configuration structure. This structure is created and initialized, and then passed to the UART_Config() function.
UART_Setup
Members
Uint16 clkInput
UART input clock frequency. Valid symbolic values are: UART_CLK_INPUT_20 // Input clock = 20MHz UART_CLK_INPUT_40 // Input clock = 40MHz UART_CLK_INPUT_60 // Input clock = 60MHz UART_CLK_INPUT_80 // Input clock = 80MHz UART_CLK_INPUT_100 // Input clock = 100MHz UART_CLK_INPUT_120 // Input clock = 120MHz UART_CLK_INPUT_140 // Input clock = 140MHz
Uint16 baud
Baud Rate (Range: 150 115200). Valid symbolic values are: UART_BAUD_150 UART_BAUD_300 UART_BAUD_600 UART_BAUD_1200 UART_BAUD_1800 UART_BAUD_2000 UART_BAUD_2400 UART_BAUD_3600
UART Module 19-5
UART_Setup
UART_BAUD_4800 UART_BAUD_7200 UART_BAUD_9600 UART_BAUD_14400 UART_BAUD_19200 UART_BAUD_38400 UART_BAUD_57600 UART_BAUD_115200 Uint16 wordLength bits per word (Range: 5,6,7,8). Valid symbolic values are: UART_WORD5 5 bits per word UART_WORD6 6 bits per word UART_WORD7 7 bits per word UART_WORD8 8 bits per word Uint16 stopBits stop bits in a word (1, 1.5, and 2) Valid symbolic values are: UART_STOP1 1 stop bit UART_STOP1_PLUS_HALF 1 and 1/2 stop bits UART_STOP2 Uint16 parity parity setups Valid symbolic values are: UART_DISABLE_PARITY UART_ODD_PARITY UART_EVEN_PARITY UART_MARK_PARITY odd parity even parity mark parity 2 stop bits
(the parity bit is always 1) UART_SPACE_PARITY space parity (the parity bit is always 0)
19-6
UART_Setup
Uint16 fifoControl FIFO Control //Non FIFO mode
Valid symbolic values are: UART_FIFO_DISABLE UART_FIFO_DMA0_TRIG01 //DMA mode 0 and Trigger level 1 UART_FIFO_DMA0_TRIG04 //DMA mode 0 and Trigger level 4 UART_FIFO_DMA0_TRIG08 //DMA mode 0 and Trigger level 8 UART_FIFO_DMA0_TRIG14 //DMA mode 0 and Trigger level 14 UART_FIFO_DMA1_TRIG01 //DMA mode 1 and Trigger level 1 UART_FIFO_DMA1_TRIG04 //DMA mode 1 and Trigger level 4 UART_FIFO_DMA1_TRIG08 //DMA mode 1 and Trigger level 8 UART_FIFO_DMA1_TRIG14 //DMA mode 1 and Trigger level 14 Uint16 loopbackEnable loopback Enable Valid Symbolic values are:
UART_NO_LOOPBACK UART_LOOPBACK
Description
Structure used to init the UART. After created and initialized, it is passed to the UART_setup() function.
UART Module
19-7
UART_config
19.3 Functions
19.3.1 CSL Primary Functions
UART_config
Function Arguments Description Example
UART_eventDisable
Function Arguments
19-8
UART_eventEnable
Description Example It disables the interrupt specified by the ierMask.
UART_eventDisable(UART_TINT);
UART_eventEnable
Function Arguments
UART_ALLINT 0x0f
Description Example
UART Module
19-9
UART_fgetc UART_fgetc
Function Arguments
Description Example
UART_fgets
Function Arguments
Description
This routine reads a string from the uart. The string will be read upto a newline or until the buffer is filled. The string is always NULL terminated and does not have any newline character removed. char readBuf[10]; CSLBool returnFlag
returnFlag = UART_fgets(&readBuf[0], 10, 0);
Example
19-10
UART_getConfig UART_fputc
Function Arguments
Description Example
This routine writes a character out through UART. Example const int putchar = A; CSLBool returnFlag;
ReturnFlag = UART_fputc(putchar, 0);
UART_fputs
Function Arguments
Description Example
This routine writes a string to the uart. The NULL terminator is not written and a newline is not added to the output.
UART_fputs(\n\rthis is a test!\n\r);
UART_getConfig
Function Arguments Description Example
UART_read UART_read
Function Arguments
Description Example
Receive and put the received data to the buffer pointed by pbuf. Uint16 length = 10; char pbuf[length]; CSLBool returnFlag;
ReturnFlag = UART_read(&pbuf[0],length, 0);
UART_setCallback
Function Arguments Description Example
19-12
UART_write UART_setup
Function Arguments Description Example
UART_write
Function Arguments
Description Example
Transmit a buffer of data by polling. Uint16 length = 4; char pbuf[4] = {0x74, 0x65, 0x73, 0x74}; CSLBool returnFlag;
ReturnFlag = UART_write(&pbuf[0],length,0);
UART Module
19-13
UART_write
19.4 Macros
The following macros are used with the UART chip support library.
(a) Macros to read/write UART register values UART_RGET() UART_RSET() Uint16 UART_RGET(REG) void UART_RSET(REG, Uint16 regval)
(b) Macros to read/write UART register field values (Applicable only to registers with more than one field) UART_FGET() UART_FSET() Uint16 UART_FGET(REG, FIELD) void UART_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to write to UART registers and fields (Applicable only to registers with more than one field) UART_REG_RMK() Uint16 UART_REG_RMK(fieldval_n,...fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field * only writable fields allowed UART_FMK()
Notes:
1) REG indicates the registers: URIER, URIIR, URBRB, URTHR, URFCR, URLCR, URMCR, URLSR, URMSR, URDLL or URDLM. 2) FIELD indicates the register field name. 3) or REG_FSET and REG__FMK, FIELD must be a writable field. 4) For REG_FGET, the field must be a readable field. 5) regval indicates the value to write in the register (REG) 6) fieldval indicates the value to write in the field (FIELD)
19-14
UART_write
Syntax
Uint16 UART_ADDR(REG)
1) REG indicates the registers: URIER, URIIR, URBRB, URTHR, URFCR, URLCR, URMCR, URLSR, URMSR, URDLL or URDLM. 2) FIELD indicates the register field name. 3) or REG_FSET and REG__FMK, FIELD must be a writable field. 4) For REG_FGET, the field must be a readable field. 5) regval indicates the value to write in the register (REG) 6) fieldval indicates the value to write in the field (FIELD)
UART Module
19-15
UART_ctsOff UART_ctsOff
Macro Arguments Description Example
UART_ctsOn
Macro Arguments Description Example
UART_isRts
Macro Arguments Description Example
UART_dtcOff
Macro Arguments Description Example
UART_dtcOn
Macro Arguments Description Example
19-16
UART_isDtr UART_riOff
Macro Arguments Description Example
UART_riOn
Macro Arguments Description Example
Sets an RI signal to ON
UART_riOn None Set RI signal on.
UART_riOn;
UART_dsrOff
Macro Arguments Description Example
UART_dsrOn
Macro Arguments Description Example
UART_isDtr
Macro Arguments Description Example
Chapter 20
WDTIM Module
This chapter describes the WDTIM module, lists the API structure, functions, and macros within the module, and provides a WDTIM API reference section.
Topic
Page
20.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2 20.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-3 20.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-4 20.4 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-14
20-1
Overview
20.1 Overview
Table 201 lists the configuration structures and functions used with the WDTIM module.
Desctiption Configures WDTIM using configuration structure Executes the watchdog service sequence
20-2
WDTIM_Config
WDTIM_Config
Structure Members
Members
Example
WDTIM_config(&MyConfig);
WDTIM Module 20-3
WDTIM_close
20.3 Functions
The following functions are available for use with the Watchdog Timer module.
WDTIM_close
Function Arguments Return Value Description Example
WDTIM_config
Function
Function
For 5502 and 5501 only void WDTIM_config( WDTIM_Handle hWdtim, WDTIM_Config *myConfig );
Arguments
For 5509/5509A only myConfig Pointer to the initialized configuration structure For 5502 and 5501 only hWdtim Device Handle; see WDTIM_open myConfig Pointer to the initialized configuration structure None Configures the WDTIMER device using the configuration structure which contains members corresponding to each of the WDTIM registers. These values are directly written to the corresponding WDTIM deviceregisters.
Arguments
20-4
WDTIM_getConfig
Example This is the example skeleton code for 5502 and 5501 only
WDTIM_Handle hWdtim; WDTIM_Config MyConfig; ... WDTIM_config(hWdtim, &MyConfig);
WDTIM_getCnt
Function
Arguments
Device Handle; see WDTIM_open Pointer to obtain CNT3 and CNT4 values Pointer to obtain CNT1 and CNT2 values
WDTIM_getPID WDTIM_getPID
Function
Arguments
Device Handle; see WDTIM_open Pointer to obtain Device type Pointer to obtain device class Pointer to obtain device revision
WDTIM_init64
Function
Arguments
20-6
WDTIM_initChained32
Example
WDTIM_Handle hWdtim; ...... WDTIM_init64( hWdtim, // 0x0000, // 0x5F04, // 0x0000, // 0x0000 //
Handle; see WDTIM_open timer control(not used) control value timer period value timer period value
WDTIM_initChained32
Function
void WDTIM_initChained32( WDTIM_Handle hWdtim, Uint16 gctl, Uint16 ctl1, Uint32 prdHigh, Uint32 prdLow ) hWdtim gctl ctl1 prdHigh prdLow None This API is used to set up and intialize two 32-bit timers in chained mode. It allows to initialize the period and also provide arguments to set up the timer control registers.
WDTIM_Handle hWdtim; ...... WDTIM_initChained32( Handle hWdtim, 0x0000 // Global timer control(not used) 0x5F04 // Timer1 control value 0x0000,// MSB of timer period value 0x0000 // LSB of timer period value );
Arguments
Device Handle; see WDTIM_open Global timer control(not used) Timer1 control value Higher bytes of timer period value Lower bytes of timer period value
Example
WDTIM Module
20-7
WDTIM_initDual32 WDTIM_initDual32
Function
Arguments
Device Handle; see WDTIM_open timer1 control value timer2 control value Timer1 period Timer2 period Prescalar count
Example
20-8
WDTIM_service WDTIM_open
Function
Example
WDTIM_service
Function
Function
WDTIM_start
Description Example Executes the watchdog service sequence
WDTIM_Handle hWdtim; ... WDTIM_service(hWdtim);
WDTIM_start
Starts the watchdog timer operation (5509/5509A)/ Pulls both timers out of reset (5502/5501)
For 5509/5509A only void WDTIM_start( void );
Function
Function
hWdt Device Handle; see WDTIM_open None Starts both the timers running, i.e., timer12 and timer34 are pulled out of reset.
WDTIM_Handle hWdtim; ... WDTIM_start (hWdtim);
20-10
WDTIM_start34 WDTIM_start12
Function
WDTIM_start34
Function
WDTIM Module
20-11
WDTIM_stop WDTIM_stop
Function
hWdtim
WDTIM_stop12
Function
WDTIM_stop34
Function
20-12
WDTIM_wdStart WDTIM_wdStart
Function
WDTIM Module
20-13
Macros
20.4 Macros
The CSL offers a collection of macros to access CPU control registers and fields. For additional details, see section 1.5. Table 202 lists the WDTIM macros available. To use them, include csl_wdtimer.h. Table 33 lists DMA registers and fields.
(b) Macros to read/write WDTIM register field values (Applicable only to registers with more than one field) Macro WDTIM_FGET() WDTIM_FSET() Syntax Uint16 WDTIM_FGET(REG, FIELD) void WDTIM_FSET(REG, FIELD, Uint16 fieldval)
(c) Macros to create value to write to WDTIM registers and fields (Applicable only to registers with more than one field) Macro WDTIM_REG_RMK() Syntax Uint16 WDTIM_REG_RMK(fieldval_n,...fieldval_0) Note: *Start with field values with most significant field positions: field_n: MSB field field_0: LSB field * only writable fields allowed WDTIM_FMK() (d) Macros to read a register address Macro WDTIM_ADDR()
Notes:
1) REG indicates the registers: WDTCR, WDPRD, WDTCR2, or WDTIM. 2) FIELD indicates the register field name. - For REG_FSET and REG__FMK, FIELD must be a writable field. - For REG_FGET, the field must be a readable field. 3) regval indicates the value to write in the register (REG) 4) fieldval indicates the value to write in the field (FIELD)
20-14
Chapter 21
GPT Module
This chapter describes the GPT module, lists the API structure, functions and macros within the module, and provides a GPT API reference section.
Topic
Page
21.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2 21.2 Configuration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-3 21.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-4
21-1
Overview
21.1 Overview
This section describes the interface to the two general purpose timers (GPT0, GPT1) available in TMS320VC5501/5502 DSPs. It also lists the API functions and macros within the module, discusses how to use a GPT device, and provides a GPT API reference section. Table 211 lists the configuration structure used to set the GPT module. Table 212 lists the functions available for the GPT module.
21-2
GPT_OPEN_RESET GPT
GPT_Config
Structure Members
Description
GPT_OPEN_RESET GPT Reset flag, used while opening the GPT device
Constant Description Example GPT_OPEN_RESET This flag is used while opening a GPT device. See GPT_open
GPT Module
21-3
GPT_close
21.3 Functions
The following are functions available for use with the GPT module.
GPT_close
Function
Arguments hGpt Return Value Description none Closes the previously opened GPT device(see GPT_open). The following tasks are performed:
- The GPT event is disabled and cleared - The GPT registers are set to their default values
Example
GPT_config
Function
Arguments hGpt myConfig Return Value Description none Configures the GPT device using the configuration structure which contains members corresponding to each of the GPT registers. These values are directly written to the corresponding GPT device-registers. Device Handle; see GPT_open Pointer to the initialized configuration structure
21-4
GPT_getConfig
Example
GPT_Handle hGpt; GPT_Config MyConfig ... GPT_config(hGpt, &MyConfig);
GPT_getCnt
Function
Arguments hGpt tim34 tim12 Return Value Description Example none Gives the timer count values. tim12 will give CNT1 and CNT2 values aligned in 32-bit format. tim34 will give CNT3 and CNT4 values aligned in 32-bit format.
GPT_Handle hGpt; Uint32 *tim12,*tim34; ... GPT_getCnt(hGpt,tim34,tim12);
Device Handle; see GPT_open Pointer to obtain CNT3 and CNT4 values Pointer to obtain CNT1 and CNT2 values
GPT_getConfig
Function
Arguments hGpt myConfig Device Handle; see GPT_open Pointer to the configuration structure
GPT Module 21-5
GPT_getEventId
Return Value Description Example none Gives the current GPT configuration values.
GPT_Handle hGpt; GPT_Config gptCfg; ..... GPT_getConfig(hGpt, &gptCfg);
GPT_getEventId
Function
Uint16 Event Id value Before using IRQ APIs to setup/enable/disable ISR for device, this function must be used. The return value of this function can later be used as an input to IRQ APIs.
GPT_Handle hGpt; Uint16 gptEvt_Id; ... gptEvt_Id = GPT_getEventId(hGpt); IRQ_clear(gptEvt_Id); IRQ_plus (gptEvt_Id, & gptIsr); IRQ_enable (gptEvt_Id);
Example
GPT_getPID
Function
GPT_init64
GPT_init64
Function
Arguments hGpt gptgctl dt12ctl prdHigh prdLow Return Value Description none This API is used to set up and intialize the timer in 64-bit mode. It allows to initialize the period and also provide arguments to setup the timer control registers.
GPT Module 21-7
Device Handle; see GPT_open Global timer control (not used) timer1 control value MSB of timer period value LSB of timer period value
GPT_initChained32
Example
GPT_Handle hGpt; ...... GPT_init64( hGpt, // Device Handle; see GPT_open 0x0000, // Global timer control(not used) 0x5F04, // timer1 control value 0x0000, // MSB of timer period value 0x0000 // LSB of timer period value );
GPT_initChained32
Function
Arguments hGpt gctl ctl1 prdHigh prdLow Return Value Description none This API is used to set up and intialize two 32-bit timers in chained mode. It allows to initialize the period and also provide arguments to setup the timer control registers.
GPT_Handle hGpt; ...... GPT_initChained32( hGpt, 0x0000, // Global 0x5F04, // Timer1 0x0000, // MSB of 0x0000 // LSB of );
Device Handle; see GPT_open Global timer control (not used) Timer1 control value MSB of timer period value LSB bytes of timer period value
Example
timer control(not used) control value timer period value timer period value
21-8
GPT_initDual32 GPT_initDual32
Function
Arguments hGpt dt1ctl dt2ctl dt1prd dt2prd dt2prsc Return Value Description none This API is used to set up and intialize the timer in dual 32-bit unchained mode. It allows to initialize the period for both the timers and also the prescalar counter which specify the count of the timer.It also provide arguments to setup the timer control registers.
GPT_Handle hGpt; ...... GPT_initDual32( hGpt, 0x3FE, // 0x3FE, // 0x005, // 0x008, // 0x0FF // );
Device Handle; see GPT_open Timer1 control value Timer2 control value Timer1 period Timer2 period Prescalar count
Example
GPT Module
21-9
GPT_open GPT_open
Function
Arguments devNum Open flags Return Value GPT_HandleDevice Handle INV: open failed Description Before the GPT device can be used, it must be opened using this function. Once opened it cannot be opened again until it is closed (see GPT_close). The return value is a unique device handle that is used in subsequent GPT API calls. If the open fails, INV is returned. If the GPT_OPEN_RESET flag is specified, the GPT module registers are set to their power-on defaults and any associated interrupts are disabled and cleared. Example
Handle hGpt; ... hGpt = GPT_open(GPT_DEV0, GPT_OPEN_RESET);
Specifies the GPT device to be opened flags GPT_OPEN_RESET: resets the GPT device
GPT_reset
Function
Resets a GPT
void GPT_reset( GPT_Handle )
hGpt
Arguments hGpt Return Value Description none Resets the timer device. Disables and clears any interrupt events and sets the GPT registers to default values. If the handle is INV (1) , all timer devices are reset. Device Handle; see GPT_open
21-10
GPT_start34
Example
GPT_Handle hGpt; ...... GPT_reset(hGpt);
GPT_start
Function
GPT_start12
Function
GPT_start34
Function
GPT_stop
Return Value Description Example none Starts the 32-bit timer2 device.
GPT_Handle hGpt; .... GPT_start34(hGpt);
GPT_stop
Function
hGpt
Arguments hGpt Return Value Description Example none Stops the timer, if running.
GPT_Handle hGpt; .... GPT_stop(hGpt);
GPT_stop12
Function
hGpt
Arguments hGpt Return Value Description Example none Stops the 32-bit timer1 device, if running.
GPT_Handle hGpt; .... GPT_stop12(hGpt);
21-12
GPT_stop34 GPT_stop34
Function
hGpt
Arguments hGpt Return Value Description Example none Stops the 32-bit timer2 device, if running.
GPT_Handle hGpt; .... GPT_stop34(hGpt);
GPT Module
21-13
GPT_stop34
21-14
Index
Index
A
ADC, registers 3-3 ADC functions ADC_config 3-5 ADC_getConfig 3-5 ADC_read 3-6 ADC_setFreq 3-6 parameter-based functions 3-2 register-based functions 3-2 ADC module configuration structure 3-4 examples 3-9 functions 3-5 include file 1-4 macros 3-8 module support symbol 1-4 ADC_Config 3-4 API modules, illustration of 1-2 architecture, of the CSL 1-2 functions 4-2 overview 4-2 CHIP module functions 4-3 macros 4-4 chip module include file 1-4 module support symbol 1-4 chip support library 1-2 constant values for fields 1-13 constant values for registers 1-13 CSL architecture 1-2 benefits of 1-2 data types 1-7 functions 1-8 generic macros, handle-based 1-12 generic symbolic constants 1-13 introduction to 1-2 macros 1-11 modules and include files 1-4 naming conventions 1-6 CSL , generic functions 1-9 CSL compiling and linking 2-7 destination address 2-2 directory structure 2-7 how to use, overview 2-2 source address 2-2 transfer size 2-2 CSL bool. See data types CSL device support 1-5 CSL_init 2-12 .csldata, allocation of 2-12
generic 1-11
B
build options defining a target device 2-8 defining large memory model 2-10 defining library paths 2-11
C
CHIP functions CHIP_getDieId_High32 4-3 CHIP_getDieId_Low32 4-3 CHIP_getRevId 4-3 CHIP module
Index-1
Index
D
DAT 5-2 module support symbol 1-4 DAT functions DAT_close 5-3 DAT_copy 5-3 DAT_copy2D 5-4 DAT_fill 5-5 DAT_open 5-6 DAT_wait 5-7 DAT module functions 5-2 , 5-3 include file 1-4 overview 5-2 data types 1-7 device support 1-5 device support symbols 1-5 devices. See CSL device support direct register initialization 1-8 directory structure 2-7 documentation 2-7 examples 2-7 include files 2-7 libraries 2-7 source library 2-7 DMA configuration structures, DMA_Config 6-5 DMA functions DMA_close 6-6 DMA_config 6-6 DMA_getConfig 6-7 DMA_getEventId 6-7 DMA_open 6-8 DMA_pause 6-9 DMA_reset 6-9 DMA_start 6-9 DMA_stop 6-10 DMA macros DMA_ADDR 6-11 DMA_ADDRH 6-11 DMA_FGET 6-12 DMA_FGETH 6-13 DMA_FMK 6-14 DMA_FSET 6-15 DMA_FSETH 6-16 DMA_REG_RMK 6-17 DMA_RGET 6-18 DMA_RGETH 6-19 Index-2
DMA_RSET 6-19 DMA_RSETH 6-20 DMA module configuration structure 6-5 functions 6-6 include file 1-4 macros 6-11 module support symbol 1-4 overview 6-2 DMA_AdrPtr. See data types DMA_close 6-2 DMA_config 6-2 DMA_config(), using 2-2 DMA_open 6-2 DMA_reset 6-2 documentation. See directory structure
E
EMIF configuration structure, EMIF_Config 7-6 EMIF functions EMIF_config 7-8 EMIF_enterselfRefresh 7-9 EMIF_exitselfRefresh 7-10 EMIF_getConfig 7-9 EMIF_reset 7-10 EMIF macros, using port number 7-11 EMIF module configuration structures 7-6 functions 7-8 include file 1-4 macros 7-11 module support symbol 1-4 overview 7-2 EMIF_config 7-2 event ID 12-3 See also IRQ module examples See also directory structure McBSP 13-26
F
FIELD 1-13 explanation of 1-11 fieldval, explanation of 1-11 funcArg. See naming conventions
Index
function, naming conventions 1-6 function argument, naming conventions 1-6 function inlining, using 2-12 functional parameters, for use with peripheral initialization 1-10 functions 1-8 generic 1-9
G
generic CSL functions 1-9 GPIO configuration structure GPIO_Config 8-4 GPIO_ConfigAll 8-4 GPIO functions GPIO_close 8-5 GPIO_config 8-7 GPIO_configAll 8-7 GPIO_open 8-5 GPIO_pinDirection 8-8 GPIO_pinDisable 8-13 GPIO_pinEnable 8-13 GPIO_pinRead 8-14 GPIO_pinReadAll 8-14 GPIO_pinReset 8-16 GPIO_pinWrite 8-15 GPIO_pinWriteAll 8-15 GPIO module, configuration structures 8-4 GPIO module functions 8-5 include file 1-4 macros 8-17 module support symbol 1-4 Overview 8-2 GPT configuration structure GPT_Config 21-3 GPT_OPEN_RESET_GPT 21-3 GPT module API reference
GPT_config 21-4 GPT_getCnt 21-5 GPT_getConfig 21-5 GPT_getPID 21-6 GPT_init64 21-7 GPT_initChained32 21-8 GPT_initDual32 21-9 GPT_open 21-10 GPT_reset 21-10 GPT_start 21-11 GPT_start12 21-11 GPT_start34 21-11 GPT_stop 21-12 GPT_stop12 21-12 GPT_stop34 21-13
H
handles resource management 1-14 use of 1-14 HPI module, functions 9-5 HPI Configuration Structures, HPI_Config 9-4 HPI functions HPI_config 9-5 HPI_getConfig 9-5 HPI macros HPI_ADDR 9-6 HPI_FGET 9-6 HPI_FMK 9-7 HPI_FSET 9-7 HPI_REG_RMK 9-8 HPI_RGET 9-9 HPI_RSET 9-9 HPI module HPI configuration structures 9-4 include file 1-4 macros 9-6 module support symbol 1-4 Overview 9-2
configuration structure 21-2 functions 21-2 include file 1-4 module support symbol 1-4 overview 21-2 GPT_functions GPT_close 21-4
21-3
I
I2C Configuration Structures I2C_Config 10-5 I2C_Setup 10-6 I2C Functions, I2C_sendStop 10-13 I2C functions I2C_config 10-7 Index-3
Index
I2C_eventDisable 10-8 I2C_eventEnable 10-8 I2C_getConfig 10-8 I2C_getEventId 10-9 I2C_IsrAddr 10-10 I2C_read 10-10 I2C_readByte 10-11 I2C_reset 10-12 I2C_rfull 10-12 I2C_rrdy 10-12 I2C_setCallback 10-13 I2C_setup 10-9 I2C_start 10-14 I2C_write 10-14 I2C_writeByte 10-15 I2C_xempty 10-16 I2C_xrdy 10-16 I2C module Configuration Structures 10-5 examples 10-18 Functions 10-7 include file 1-4 macros 10-17 module support symbol 1-4 overview 10-2 ICACHE configuration structures ICACHE_Config 11-3 ICACHE_Setup 11-4 ICACHE_Tagset 11-4 ICACHE functions ICACHE_config 11-5 ICACHE_disable 11-5 ICACHE_enable 11-6 ICACHE_flush 11-6 ICACHE_freeze 11-6 ICACHE_setup 11-7 ICACHE_tagset 11-7 ICACHE_unfreeze 11-7 ICACHE macros ICACHE_ADDR 11-8 ICACHE_FGET 11-8 ICACHE_FMK 11-8 ICACHE_FSET 11-8 ICACHE_REG_RMK 11-8 ICACHE_RGET 11-8 ICACHE_RSET 11-8 ICACHE Module include file 1-4 module support Symbol 1-4 Index-4
ICACHE module Configuration Structures 11-3 functions 11-5 macros 11-8 overview 11-2 include Files. See directory structure include files, for CSL modules 1-4 Int16. See data types Int32. See data types IRQ configuration structure, IRQ_Config 12-2 , 12-8 IRQ functions IRQ_clear 12-9 IRQ_config 12-9 IRQ_disable 12-10 IRQ_enable 12-10 IRQ_getArg 12-10 IRQ_getConfig 12-11 IRQ_globalDisable 12-11 IRQ_globalEnable 12-12 IRQ_globalRestore 12-12 IRQ_map 12-13 IRQ_plug 12-13 IRQ_restore 12-14 IRQ_setArg 12-14 IRQ_setVecs 12-15 IRQ_test 12-15 IRQ module Configuration Structures 12-8 functions 12-9 include file 1-4 module support symbol 1-4 overview 12-2 using interrupts 12-7 IRQ_EVT_NNNN 12-4 events list 12-4 IRQ_EVT_WDTINT 12-6
L
large-model library. See CSL device support large/small memory model selection, instructions 2-8 libraries See also directory structure linking to a project 2-10 linker command file creating. See compiling and linking with CSL using 2-12
Index
M
macro, naming conventions 1-6 macros generic 1-11 generic description of
handle-based 1-12 FIELD 1-11 fieldval 1-11 PER 1-11 REG 1-11 REG# 1-11 regval 1-11
McBSP 13-23 McBSP example 13-26 registers 13-3 McBSP , configuration structure 13-6 McBSP configuration structure, MCBSP_Config 13-6 MCBSP Functions, MCBSP_channelStatus 13-11 McBSP functions MCBSP_channelDisable 13-8 MCBSP_channelEnable 13-9 MCBSP_close 13-12 MCBSP_config 13-12 MCBSP_getConfig 13-14 MCBSP_getPort 13-14 MCBSP_getRcvEventID 13-15 MCBSP_getXmtEventID 13-15 MCBSP_open 13-16 MCBSP_read16 13-17 MCBSP_read32 13-17 MCBSP_reset 13-18 MCBSP_rfull 13-18 MCBSP_rrdy 13-19 MCBSP_start 13-19 MCBSP_write16 13-21 MCBSP_write32 13-21 MCBSP_xempty 13-22 MCBSP_xrdy 13-22 MCBSP Macros, MCBSP_FSET 13-23 McBSP macros MCBSP_ADDR 13-24 MCBSP_FGET 13-23 MCBSP_FMK 13-23 MCBSP_REG_RMK 13-23 MCBSP_RGET 13-23
MCBSP_RSET 13-23 using handle 13-24 using port number 13-23 McBSP module API reference 13-8 configuration structure 13-2 functions 13-2 include file 1-4 module support symbol 1-4 overview 13-2 memberName. See naming conventions MMC Configuration Structures, MMC_Config 14-5 Data Structures
Functions
MMC_CardIdobj 14-9 MMC_CardObj 14-10 MMC_CardXCsdObj 14-10 MMC_CmdObj 14-11 MMC_MmcR egObj 14-11 MMC_NativeInitObj 14-12 MMC_RspR egObj 14-12 MMC_close 14-13 MMC_clrR esponse 14-13 MMC_config 14-14 MMC_dispatch0 14-14 MMC_dispatch1 14-14 MMC_drrdy 14-15 MMC_dxrdy 14-15 MMC_getCardCSD 14-16 MMC_getCardId 14-16 MMC_getConfig 14-17 MMC_getNumberOfCards 14-17 MMC_getStatus 14-18 MMC_open 14-18 MMC_readBlock 14-19 MMC_responseDone 14-19 MMC_saveStatus 14-20 MMC_selectCard 14-20 MMC_sendAllCID 14-21 MMC_sendCmd 14-22 MMC_sendCSD 14-22 MMC_sendGoIdle 14-23 MMC_sendOpCond 14-24 MMC_setCallBack 14-25 MMC_setCardPtr 14-23 MMC_setRca 14-25 MMC_stop 14-26
Index-5
Index
O
object types. See Naming Conventions
P
parameter-based configuration, ADC module 3-2 PER 1-13 explanation of 1-11 PER_ADDR 1-12 PER_close 1-9 PER_config 1-9 initialization of registers 1-9 PER_FGET 1-12 PER_FMK 1-12 PER_FSET 1-12 PER_funcName(). See naming conventions PER_Handle. See data types PER_MACRO_NAME. See naming conventions PER_open 1-9 PER_REG_DEFAULT 1-13 PER_REG_FIELD_DEFAULT 1-13 PER_REG_FIELD_SYMVAL 1-13 PER_REG_RMK 1-11 for use with peripheral initialization 1-9 PER_reset 1-9 PER_RGET 1-11 PER_RSET 1-11 PER_setup 1-9 PER_setup(), example of use 1-10 PER_start 1-9 PER_Typename. See naming conventions PER_varName(). See naming conventions peripheral initialization via functional parameters 1-10 using PER_setup 1-10 peripheral initialization via registers 1-9 using PER_config 1-10 peripheral modules descriptions of 1-4 include files 1-4 PLL configuration structure, PLL_Config 15-4 PLL functions PLL_config 15-5 PLL_setFreq 15-6 PLL macros, using port number 15-7
N
naming conventions 1-6 Index-6
Index
PLL module API reference 15-5 configuration structure 15-2 functions 15-2 include file 1-4 macros 15-7 module support symbol 1-4 overview 15-2 PWR functions, PWR_powerDown 16-2 PWR macros 16-4 PWR_ADDR 16-4 PWR_FGET 16-4 PWR_FMK 16-4 PWR_FSET 16-4 PWR_REG_RMK 16-4 PWR_RGET 16-4 PWR_RSET 16-4 PWR module API reference 16-3 functions 16-2 include file 1-4 macros 16-4 module support symbol 1-4 overview 16-2
PWR_powerDown 16-3
R
real-time clock, features of 17-2 REG 1-13 explanation of 1-11 REG#, explanation of 1-11 register-based configuration, ADC module 3-2 Registers, MCBSP 13-3 registers, peripheral initialization 1-9 regval, explanation of 1-11 resource management, using CSL handles 1-14 RTC, ANSI C-style time functions 17-4 RTC configuration structures RTC_Alarm 17-6 RTC_Config 17-7 RTC_Date 17-7 RTC_IsrAddr 17-8 RTC_Time 17-8 RTC functions RTC_bcdToDec 17-9 RTC_config 17-9 RTC_decToBcd 17-9
RTC_getConfig 17-10 RTC_getDate 17-11 RTC_getTime 17-11 RTC_isrDisable 17-10 RTC_isrDisphook 17-13 RTC_isrEnable 17-10 RTC_setAlarm 17-12 RTC_setDate 17-13 RTC_setPeriodicInterval 17-14 RTC_setTime 17-14 RTC macros RTC_ADDR 17-16 RTC_FGET 17-16 RTC_FSET 17-16 RTC_REG_FMK 17-16 RTC_REG_RMK 17-17 RTC_RGET 17-17 RTC_RSET 17-17 RTC module API reference 17-9 configuration structure 17-3 , 17-6 functions 17-3 include file 1-4 macros 17-3 , 17-4 module support symbol 1-4 overview 17-2 RTC_bcdToDec, description of 17-3 RTC_decToBcd, description of 17-3
S
scratch pad memory 2-12 small-model library. See CSL device support source library. See directory structure static inline. See function inlining structure member, naming conventions 1-6 symbolic constant values 1-13 symbolic constants, generic 1-13 SYMVAL 1-13
T
target device, specifying. See compiling and linking with CSL TIMER configuration structure, TIMER_Config 18-3 TIMER functions TIMER_close 18-4 Index-7
Index
TIMER_Config 18-4 TIMER_getConfig 18-5 TIMER_getEventID 18-5 TIMER_open 18-6 TIMER_reset 18-7 TIMER_start 18-7 TIMER_stop 18-7 TIMER_tintoutCfg 18-8 TIMER macros TIMER_ADDR 18-9 TIMER_FGET 18-9 TIMER_FMK 18-9 TIMER_FSET 18-9 TIMER_REG_RMK 18-9 TIMER_RGET 18-9 TIMER_RSET 18-9 using handle 18-10 using port number 18-9 TIMER module API reference 18-4 configuration structure 18-2 functions 18-2 include file 1-4 macros 18-9 module support symbol 1-4 overview 18-2 typedef, naming conventions 1-6
U
UART, Control Signal Macros 19-15 UART configuration structures UART_Config 19-5 UART_Setup 19-5 UART functions UART_config 19-8 UART_eventDisable 19-8 UART_eventEnable 19-9 UART_fgetc 19-10 UART_fgets 19-10 UART_fputc 19-11 UART_fputs 19-11 UART_getConfig 19-11 UART_read 19-12 UART_setCallback 19-12 UART_setup 19-13 UART_write 19-13 UART macros UART_ctsOff 19-16 Index-8
UART_ctsOn 19-16 UART_dsrOff 19-17 UART_dsrOn 19-17 UART_dtcOff 19-16 UART_dtcOn 19-17 UART_isDtr 19-17 UART_isRts 19-16 UART_riOff 19-17 UART_riOn 19-17 WDTIM_ADDR 19-15 WDTIM_FGET 19-14 WDTIM_FMK 19-14 WDTIM_FSET 19-14 WDTIM_REG_RMK 19-14 WDTIM_RGET 19-14 WDTIM_RSET 19-14 UART module configuration structure 19-2 configuration structures 19-5 functions 19-2 , 19-8 include file 1-4 macros 19-14 module support symbol 1-4 overview 19-2 Uchar. See data types Uint16. See data types Uint32. See data types USB module configuration information 1-4 include file 1-4 module support symbol 1-4 using functional parameters 1-8
V
variable, naming conventions 1-6
W
WDTIM configuration structures, WDTIM_Config 20-3 WDTIM functions WDTIM_close 20-4 WDTIM_config 20-4 WDTIM_getCnt 20-5 WDTIM_getPID 20-6 WDTIM_init64 20-6 WDTIM_initChained32 20-7 WDTIM_initDual32 20-8
Index
WDTIM_open 20-9 WDTIM_service 20-9 WDTIM_start 20-10 WDTIM_start12 20-11 WDTIM_start34 20-11 WDTIM_stop 20-12 WDTIM_stop12 20-12 WDTIM_stop34 20-12 WDTIM_wdStart 20-13 WDTIM macros WDTIM_ADDR 20-14 WDTIM_FGET 20-14
WDTIM_FMK 20-14 WDTIM_FSET 20-14 WDTIM_REG_RMK 20-14 WDTIM_RGET 20-14 WDTIM_RSET 20-14 WDTIM module API reference 20-4 APIs 20-2 include file 1-4 macros 20-14 module support symbol 1-4 overview 20-2
Index-9