Analog Devices VisualDSP++ 5.0 Service Manual
Analog Devices VisualDSP++ 5.0 Service Manual

Analog Devices VisualDSP++ 5.0 Service Manual

Visualdsp++ 5.0 device drivers and system for blackfin processors
Table of Contents

Advertisement

Quick Links

W5.0

Device Drivers and System Services

Manual for Blackfin
®
Processors
Revision 3.2, August 2008
Part Number
82-000430-01
Analog Devices, Inc.
a
One Technology Way
Norwood, Mass. 02062-9106

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VisualDSP++ 5.0 and is the answer not in the manual?

Questions and answers

Summary of Contents for Analog Devices VisualDSP++ 5.0

  • Page 1: Device Drivers And System Services

    W5.0 Device Drivers and System Services Manual for Blackfin ® Processors Revision 3.2, August 2008 Part Number 82-000430-01 Analog Devices, Inc. One Technology Way Norwood, Mass. 02062-9106...
  • Page 2: Copyright Information

    Analog Devices, Inc. Printed in the USA. Disclaimer Analog Devices, Inc. reserves the right to change this product without prior notice. Information furnished by Analog Devices is believed to be accurate and reliable. However, no responsibility is assumed by Analog Devices for its use;...
  • Page 3: Table Of Contents

    Accessing Documentation From the Web ......xxxvii Viewing Help Files ............xxxvii Notation Conventions .............. xxxviii INTRODUCTION System Services Overview .............. 1-2 General ................... 1-3 Application Interface ............... 1-7 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 4 Accessing the Device Driver API ........1-25 Device Driver File Locations ..........1-27 Linking in the Device Driver Library ........ 1-28 Rebuilding the Device Driver Library ........ 1-29 Examples on Distribution ..........1-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 5 Modifying IMASK ..............2-14 Examples ..................2-15 File Structure ................2-16 Interrupt Manager API Reference ..........2-17 Notation Conventions ............2-17 adi_int_Init ................2-18 adi_int_Terminate ..............2-19 adi_int_CECHook ..............2-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 6 Running Applications on Both Cores ........3-8 Synchronization Between Cores ..........3-10 Built-In Lock Variable and Linking Considerations ....3-10 SDRAM Initialization Prior to Loading an Executable ....3-13 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 7 ..........3-38 Public Data Types and Enumerations ........... 3-42 ADI_PWR_COMMAND ............. 3-42 ADI_PWR_COMMAND_PAIR ........... 3-47 ADI_PWR_CSEL ..............3-47 ADI_PWR_DF ..............3-48 ADI_PWR_INPUT_DELAY ..........3-48 ADI_PWR_OUTPUT_DELAY ..........3-48 ADI_PWR_MODE .............. 3-49 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 8 EXTERNAL BUS INTERFACE UNIT MODULE Introduction ................. 4-2 Using the EBIU Module ............... 4-3 EBIU API Reference ..............4-10 Notation Conventions ............4-10 adi_ebiu_AdjustSDRAM ............4-11 adi_ebiu_Control ..............4-12 adi_ebiu_GetConfigSize ............4-15 viii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 9 ADI_EBIU_SDRAM_ENABLE ........4-38 ADI_EBIU_SDRAM_BANK_SIZE ........4-39 ADI_EBIU_SDRAM_BANK_COL_WIDTH ....4-39 ADI_EBIU_SDRAM_MODULE_TYPE ......4-39 ADI_EBIU_CMD_SET_SDRAM_SCTLE ....... 4-40 ADI_EBIU_SDRAM_EMREN ......... 4-40 ADI_EBIU_SDRAM_PASR ..........4-41 ADI_EBIU_SDRAM_TCSR ..........4-41 ADI_EBIU_SDRAM_SRFS ..........4-41 ADI_EBIU_SDRAM_EBUFE .......... 4-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 10 ..............5-9 adi_dcb_RegisterISR ............. 5-11 Handling Critical Regions Within Callbacks ......5-11 DCB Manager API Reference ............5-12 Notation Conventions ............5-12 adi_dcb_Close ..............5-13 adi_dcb_Control ..............5-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 11 Controlling Memory Streams ........... 6-7 Opening Memory Streams ........... 6-7 Memory Transfers ............... 6-8 One-Dimensional Transfers (Linear Transfers) ....6-8 Two-Dimensional Transfers ..........6-9 Closing Memory Streams ..........6-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 12 Descriptor-Based Sub-Modes ..........6-24 Loopback Sub-Mode ............6-24 Streaming Sub-Mode ............6-25 DMA Channel to Peripheral Mapping ........6-26 Sensing a Mapping ............6-27 Setting a Mapping ............6-27 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 13 ............6-39 adi_dma_Init ................ 6-40 adi_dma_MemoryClose ............6-41 adi_dma_MemoryCopy ............6-42 adi_dma_MemoryCopy2D ............ 6-44 adi_dma_MemoryOpen ............6-46 adi_dma_Open ..............6-48 adi_dma_Queue ..............6-50 adi_dma_SetMapping ............6-51 adi_dma_Terminate ............... 6-52 VisualDSP++ 5.0 Device Drivers and System xiii Services Manual for Blackfin Processors...
  • Page 14 ADI_DMA_EVENT ............6-58 ADI_DMA_MODE ............6-59 ADI_DMA_PMAP ............6-60 ADI_DMA_RESULT ............6-60 ADI_DMA_STREAM_ID ..........6-60 ADI_DMA_TC_PARAMETER ........6-61 ADI_DMA_CONFIG_REG Field Values ......6-61 ADI_DMA_DMA2D ............6-61 ADI_DMA_DI_EN ............6-61 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 15 ..............7-5 adi_flag_SetDirection ............7-5 adi_flag_Set ................ 7-5 adi_flag_Clear ..............7-6 adi_flag_Toggle ..............7-6 adi_flag_Sense ..............7-6 Callbacks ................7-6 adi_flag_InstallCallback ............7-7 adi_flag_RemoveCallback ........... 7-8 adi_flag_SuspendCallbacks ..........7-9 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 16 ............... 7-16 adi_flag_Close ..............7-17 adi_flag_Init ................. 7-18 adi_flag_Open ..............7-20 adi_flag_SetDirection ............7-21 adi_flag_Terminate ............... 7-22 adi_flag_Set ................7-23 adi_flag_Toggle ..............7-24 adi_flag_Sense ..............7-25 adi_flag_InstallCallback ............7-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 17 Timer IDs ................8-4 Basic Timer Functions ............. 8-4 adi_tmr_Open ..............8-4 adi_tmr_Close ..............8-4 adi_tmr_Reset ..............8-5 General-Purpose Timer Functions ..........8-5 adi_tmr_GPControl ............8-5 adi_tmr_GPGroupEnable ........... 8-5 VisualDSP++ 5.0 Device Drivers and System xvii Services Manual for Blackfin Processors...
  • Page 18 Termination ..............8-15 Timer Service API Reference ............8-15 Notation Conventions ............8-15 adi_tmr_Init ................. 8-16 adi_tmr_Open ..............8-17 adi_tmr_Terminate ............... 8-18 adi_tmr_Close ..............8-19 adi_tmr_Reset ............... 8-20 xviii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 19 Using the Port Control Manager ............ 9-3 Port Control Manager API Reference ..........9-5 Notation Conventions ............. 9-5 adi_ports_Init ................. 9-6 adi_ports_Terminate ..............9-7 adi_ports_EnablePPI ............... 9-8 adi_ports_EnableSPI ............... 9-9 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 20 Opening a Device ............10-10 Configuring a Device ............10-11 Dataflow Method ............10-12 Enabling Dataflow ............10-15 Providing Buffers to a Device .......... 10-15 Closing a Device ............. 10-16 Callbacks ................ 10-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 21 Callback Events .............. 10-32 Return Codes ..............10-32 Circular Buffer Callback Options ........10-33 Buffer Data Types ............10-33 Physical Driver Entry Point ..........10-34 API Function Definitions ..........10-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 22 Physical Driver Design .............. 10-45 Physical Driver Design Overview ......... 10-45 Physical Device Driver API Description ....... 10-47 Physical Driver Include File (“xxx.h”) ........10-48 Extensible Definitions ............ 10-48 ADI_DEV_PDD_ENTRY_POINT ........ 10-50 xxii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 23 Device Manager Public Data Types and Enumerations ....10-66 ADI_DEV_BUFFER_TYPE ..........10-66 ADI_DEV_MODE ............. 10-67 ADI_DEV_DIRECTION ........... 10-67 CALLBACK EVENTS ............10-68 RESULT CODES ............... 10-69 COMMAND IDs ............... 10-72 ADI_DEV_1D_BUFFER ............ 10-75 ADI_DEV_2D_BUFFER ............ 10-76 VisualDSP++ 5.0 Device Drivers and System xxiii Services Manual for Blackfin Processors...
  • Page 24 ..............10-89 Examples .................. 10-90 REAL-TIME CLOCK SERVICE Introduction ................11-1 Operation .................. 11-2 Initialization ................. 11-2 Termination ................11-3 Setting and Reading the Date and Time ........ 11-4 xxiv VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 25 RTC Service Application Programming Interface (API) ....11-16 Notation and Naming Conventions ........11-16 RTC Service API Functions ..........11-17 adi_rtc_Init() ..............11-18 adi_rtc_Terminate() ............11-19 adi_rtc_SetDateTime() ............11-20 adi_ rtc_GetDateTime() ............11-21 adi_rtc_InstallCallback() ............. 11-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 26 System Service Requirements ............12-7 Interrupt Manager Service ............. 12-8 Deferred Callback Service ............. 12-9 DMA Service ..............12-10 Semaphore Service .............. 12-10 Real-Time Clock Service ............. 12-11 Device Manager ..............12-11 xxvi VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 27 ..............12-31 adi_fss_IsEOF ..............12-32 adi_fss_FileRemove ............. 12-33 adi_fss_FileRename ............. 12-34 adi_fss_DirOpen ..............12-35 adi_fss_DirClose ..............12-36 adi_fss_DirRead ..............12-37 adi_fss_DirSeek ..............12-38 adi_fss_DirTell ..............12-39 adi_fss_DirRewind .............. 12-40 VisualDSP++ 5.0 Device Drivers and System xxvii Services Manual for Blackfin Processors...
  • Page 28 .................. 12-52 fclose .................. 12-53 fwrite .................. 12-54 fread ................... 12-55 fprintf ................. 12-56 fscanf .................. 12-57 fgetc ................... 12-58 fgets ................... 12-59 fputc ................... 12-60 fputs ................... 12-61 xxviii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 29 ................12-75 remove ................12-76 Extensibility ................12-77 Examples .................. 12-77 HardDiskAccess ..............12-78 Description ..............12-78 Configuration ..............12-79 HardDiskFormat ..............12-79 Description ..............12-80 Configuration ..............12-80 VisualDSP++ 5.0 Device Drivers and System xxix Services Manual for Blackfin Processors...
  • Page 30 Contents Shell_Browser ..............12-80 Description ..............12-80 Configuration ..............12-81 INDEX VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 31: Preface

    Thank you for purchasing Analog Devices, Inc. development software for Analog Devices embedded processors. Purpose of This Manual The VisualDSP++ 5.0 Update 4 Device Drivers and System Services Manual for Blackfin Processors contains information about the Analog Devices device driver model and system services library suite. Included are archi- tectural descriptions of the device driver design and each system service component.
  • Page 32: Manual Contents Description

    Blackfin processor. • Chapter 8, “Timer Service” Describes the timer service that provides interface into the core, watchdog, and general-purpose timers of the Blackfin processor. xxxii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 33 Describes the file system service (FSS), which provides access to mass storage media from the Blackfin processor. What’s New in This Manual This revision (3.2) of the VisualDSP++ 5.0 Update 4 Device Drivers and System Services Manual for Blackfin Processors contains the following changes/additions: •...
  • Page 34: Technical Or Customer Support

    Technical or Customer Support Technical or Customer Support You can reach Analog Devices, Inc. Customer Support in the following ways: • Visit the Embedded Processing and DSP products Web site at http://www.analog.com/processors/technical_support • E-mail tools questions to processor.tools.support@analog.com • E-mail processor questions to processor.support@analog.com (World wide support)
  • Page 35: Product Information

    Preface Product Information Product information can be obtained from the Analog Devices Web site, VisualDSP++ online Help system, and a technical library CD. Analog Devices Web Site The Analog Devices Web site, , provides information www.analog.com about a broad range of products—analog integrated circuits, amplifiers, converters, and digital signal processors.
  • Page 36 To order the technical library CD, go to http://www.analog.com/proces- , navigate to the manuals page for your sors/technical_library processor, click the request CD check mark, and fill out the order form. xxxvi VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 37: Notation Conventions

    Preface Data sheets, which can be downloaded from the Analog Devices Web site, change rapidly, and therefore are not included on the technical library CD. Technical manuals change periodically. Check the Web site for the latest manual revisions and associated documentation errata.
  • Page 38 A Warning identifies conditions or inappropriate usage of the product that could lead to conditions that are potentially hazardous for devices users. In the online version of this book, the word Warning appears instead of this symbol. xxxviii VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 39: Introduction

    Currently, the system services and device drivers are available for use with the following Blackfin families: ADSP-BF531/532/533, ADSP-BF534/536/537, ADSP-BF538/539, ADSP-BF542/544/547/548/549, ADSP-BF522/524/526, ADSP-BF532/525/527, and ADSP-BF561. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 40: System Services Overview

    “Application Interface” on page 1-7 • “Dependencies” on page 1-8 • “Initialization” on page 1-10 • “Termination” on page 1-10 • “System Services Directory and File Structure” on page 1-11 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 41: General

    • Set core and system clock operating frequencies with a func- tion call. • Set and detect the internal voltage regulator settings. • Transition the processor among the various operating modes including, full-on, active, sleep, and so on. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 42 • DMA Management Service – The DMA management service provides access into the DMA controller of a Blackfin processor. The DMA management service allows the application to schedule VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 43 -type functions. memcpy • Programmable Flag Service – The programmable flag service provides a simple interface into the programmable flags, sometimes called general-purpose I/O, of the Blackfin processor. This allows VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 45: Application Interface

    Introduction • Device Manager – The device driver model is used to control devices, both internal and external to Analog Devices processors. Specific functionality allow the application to: • Open and close devices used by the application. • Configure and control devices.
  • Page 46: Dependencies

    Applications do not have to all the services. Further, each service does not need all the resources associated with the system that the service is controlling. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 47 Refer to the development toolset documentation for more information. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 48: Initialization

    For applications that need to terminate services, as with the initialization sequence, there is a preferred sequence of terminating the services. 1-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 49: System Services Directory And File Structure

    Accessing the System Services API Applications using system services should include the directory in the (compiler and/or assembler) Blackfin/include/services preprocessor search path. User source files that access any of the system VisualDSP++ 5.0 Device Drivers and System 1-11 Services Manual for Blackfin Processors...
  • Page 50 The ADSP-BF531 processor __ADSPBF531__ The ADSP-BF532 processor __ADSPBF532__ The ADSP-BF533 processor __ADSPBF533__ The ADSP-BF534 processor __ADSPBF534__ The ADSP-BF535 processor __ADSPBF535__ The ADSP-BF536 processor __ADSPBF536__ The ADSP-BF537 processor __ADSPBF537__ 1-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 51: Linking In The System Services Library

    You should ensure that the appropri- ate library is included in the list of object files for the linker. VisualDSP++ 5.0 Device Drivers and System 1-13 Services Manual for Blackfin Processors...
  • Page 52 For example, an application targeting silicon revision 0.2 of the ADSP-BF532 processor without an RTOS should link with the file from the subdirectory. libss1532.dlb Blackfin/lib/bf532_rev_0.2 As another example, an application developer who wants a version of the 1-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 53: Rebuilding The System Services Library

    VisualDSP++ development toolset. All code for the system services library is located in the following directories: • – This directory contains the Analog Devices built Blackfin/lib versions of the system service library files ( *.dlb •...
  • Page 54: Examples

    Dual-Core Considerations For information on how to use the system services on dual-core ADSP-BF561 processors, see “Dual-Core Considerations” on page 3-5. 1-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 55: Rtos Considerations

    SIC_IARx (that is, during the call to adi_dev_Open() • Prohibited interrupt levels – Appendix A of the VisualDSP++ 5.0 Kernel (VDK) User’s Guide details four interrupt levels [EVT3 (EVX), EVT6 (IVTMR), IVG14, and IVG15] which are reserved VisualDSP++ 5.0 Device Drivers and System...
  • Page 56: Deployment Of Services Within A Multi-Threaded Application

    • Initialization – Initialization of system services and the device manager is performed only once per application. Since their use may be required in several threads, it is important that the 1-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 57: Device Driver Overview

    The Analog Devices device driver model provides a simple, convenient method for applications to control devices commonly found in and around Analog Devices processors. It has also provides a simple and effi- cient mechanism for the creation of new device drivers.
  • Page 58: Application Interface

    • – Opens a device for use. adi_dev_Open() • – Closes down a device. adi_dev_Close() • – Provides a device with buffers for inbound data. adi_dev_Read() 1-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 59: Device Driver Architecture

    It would be wasteful to force each physical driver to provide logic that operates both synchronously and asynchronously. The device man- ager provides this functionality, relieving each physical driver from reimplementing this capability. VisualDSP++ 5.0 Device Drivers and System 1-21 Services Manual for Blackfin Processors...
  • Page 60 “bit banging” and control and status regis- ter manipulations of the physical device. All device-specific information is contained and isolated in the physical driver. 1-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 61: Interaction With System Services

    As such, it is good practice to initialize the required system services prior to initializing the device manager. Refer to the “Initialization” on page 1-10 for information on system services initialization. VisualDSP++ 5.0 Device Drivers and System 1-23 Services Manual for Blackfin Processors...
  • Page 62: Termination

    Other development toolsets may use other directory names for their toolkits, but the device driver files can always be found within the directory tree. Blackfin 1-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 63: Accessing The Device Driver Api

    For example, user code that accesses the Analog Devices parallel peripheral interface (PPI) driver would include the following lines in their source file (in order): #include <services/services.h>...
  • Page 64 The file contains adi_dev.h the list of processor families that are supported by the device driver model. 1-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 65: Device Driver File Locations

    The source code for an off-chip peripheral driver should be included in the source file list of the VisualDSP++ project. For example, if using the AD1836 device driver, the file $ADI_DSP\Blackfin\lib\src\drivers\codec\adi_ad1836.c should be included in the source file list. VisualDSP++ 5.0 Device Drivers and System 1-27 Services Manual for Blackfin Processors...
  • Page 66: Linking In The Device Driver Library

    Device Driver Overview Linking in the Device Driver Library All object code for the device manager and Analog Devices-supplied phys- ical drivers is included in the device driver library file. This file is found in directory. In this directory is a device driver library file Blackfin/lib for each supported processor variant.
  • Page 67: Rebuilding The Device Driver Library

    – This directory contains all the source Blackfin/lib/src/drivers code files and non-API include files for the device manager and Analog Devices-provided physical drivers. Also in this directory are VisualDSP++ project files that can be used to rebuild the libraries. •...
  • Page 68: Examples On Distribution

    The device driver distribution includes examples that illustrate how to use the device drivers. Refer to these examples for additional information on how to use the device drivers effectively. 1-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 69: Interrupt Manager

    “Protecting Critical Code Regions” on page 2-12 • “Modifying IMASK” on page 2-14 • “Examples” on page 2-15 • “File Structure” on page 2-16 • “Interrupt Manager API Reference” on page 2-17 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 70: Introduction

    CEC for processing. The SIC provides a rich set of function- ality for the processing and handling of peripheral interrupts. In addition to allowing/disallowing peripheral interrupts to be routed to the CEC, the VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 71 Because there is no reason to provide multiple interrupt managers on single-core devices, this service is not supported. Application developers should not attempt to instantiate more than one interrupt manager per core. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 72: Interrupt Manager Initialization

    However, if the application hooks in secondary interrupt handlers, the application must provide additional memory to support the secondary handlers. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 73: Interrupt Manager Termination

    If interrupt manager services are required after the termination function is called, the application must reinitialize interrupt manager services by calling the function. adi_pwr_Init VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 74: Core Event Controller Functions

    ADI_INT_RESULT_NOT_PROCESSED The interrupt manager then automatically invokes the next interrupt han- dler, if any, that is hooked into the same IVG level. If the event that VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 75 ADI_INT_RESULT_PROCESSED interrupt manager calls the last secondary handler that was hooked, followed by the second to last installed handler, and so on. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 76: Adi_Int_Cecunhook() Function

    Instead, they should return using the return function. Interrupt handlers are in fact nothing more than typical C-callable subroutines. Therrefore, each peripheral interrupt handler must conform to the following template, ADI_INT_HANDLER(mjk_SPORT_RX_handler) // user code VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 77: System Interrupt Controller Functions

    This enumeration is defined in the file. Refer to this header file adi_int.h for the complete list of values for each supported Blackfin processor. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 78: Adi_Int_Sicdisable

    2-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 79: Adi_Int_Sicsetivg

    Also note that it is possible to configure the SIC so that a peripheral inter- rupt wakes up the core from an idled state but does not process the interrupt. This may or may not be the intended operation. VisualDSP++ 5.0 Device Drivers and System 2-11 Services Manual for Blackfin Processors...
  • Page 80: Protecting Critical Code Regions

    The principle and usage, however, are the same, regardless of implementation. In this way, application code always operates the same way, and does not change, regardless of the operating environment. 2-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 81 Foo() of code. The function also has a critical region of code. Foo() Value = adi_int_EnterCriticalRegion(pArg); // critical section of code Foo(); // call to Foo() adi_int_ExitCriticalRegion(Value); VisualDSP++ 5.0 Device Drivers and System 2-13 Services Manual for Blackfin Processors...
  • Page 82: Modifying Imask

    In order to ensure compatibility across all operating environments, the interrupt manager provides functions that allow bits within the reg- IMASK ister to be set or cleared. Depending on the operating environment, these 2-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 83: Examples

    IMASK control the CEC. Examples Examples demonstrating use of the interrupt manager can be found in the subdirectories. Blackfin/EZ-Kits VisualDSP++ 5.0 Device Drivers and System 2-15 Services Manual for Blackfin Processors...
  • Page 84: File Structure

    , where di_int_xxx.c the operating environment being targeted. These files should never be linked into an application because the appropriate system services library file contains all required object code. 2-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 85: Interrupt Manager Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 2-17 Services Manual for Blackfin Processors...
  • Page 86: Adi_Int_Init

    On return, this argument contains the number of secondary *pMaxEntries handler entries that the interrupt manager can support given the memory supplied. Parameter passed to the *pEnterCriticalArg adi_int_EnterCriticalRegion Return Value Return values include: Successfully initialized. ADI_INT_RESULT_SUCCESS 2-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 87: Adi_Int_Terminate

    SIC control functions before calling adi_int_Terminate() Prototype ADI_INT_RESULT adi_int_Terminate(void); Arguments None Return Value The function returns if successful. Any other ADI_INT_RESULT_SUCCESS value indicates an error. VisualDSP++ 5.0 Device Drivers and System 2-19 Services Manual for Blackfin Processors...
  • Page 88: Adi_Int_Cechook

    Prototype ADI_INT_RESULT adi_int_CECHook( IVG, ADI_INT_HANDLER_FN Handler, void *ClientArg, NestingFlag 2-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 89 Return values include: Interrupt handler was successfully hooked into the ADI_INT_RESULT_SUCCESS chain. Insufficient memory is available to insert the handler ADI_INT_RESULT_NO_MEMORY into the chain. IVG level is invalid. ADI_INT_RESULT_INVALID_IVG VisualDSP++ 5.0 Device Drivers and System 2-21 Services Manual for Blackfin Processors...
  • Page 90: Adi_Int_Cecunhook

    Prototype ADI_INT_RESULT adi_int_CECUnhook( IVG, ADI_INT_HANDLER_FN Handler, void *ClientArg 2-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 91 Return Value Return values include: Interrupt handler was successfully unhooked from the ADI_INT_RESULT_SUCCESS chain. IVG level is invalid. ADI_INT_RESULT_INVALID_IVG VisualDSP++ 5.0 Device Drivers and System 2-23 Services Manual for Blackfin Processors...
  • Page 92: Adi_Int_Clearimaskbits

    Regardless of the implementation details, the API is consistent from envi- ronment to operating environment. Changes to application software are not required when code is moved to a different operating environment. Prototype void adi_int_ClearIMASKBits( ADI_INT_IMASK BitsToClear 2-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 93 ‘1’ clears the corresponding bit in the IMASK register. A bit with the value of ‘0’ leaves the corresponding bit in the IMASK register unchanged. Return Value None VisualDSP++ 5.0 Device Drivers and System 2-25 Services Manual for Blackfin Processors...
  • Page 94: Adi_Int_Entercriticalregion

    Application software does not need to change when moving to a different operating environment or moving from one Blackfin derivative to another. 2-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 95 Return Value The return value from this function should always be passed to the corresponding function. adi_int_ExitCriticalRegion VisualDSP++ 5.0 Device Drivers and System 2-27 Services Manual for Blackfin Processors...
  • Page 96: Adi_Int_Exitcriticalregion

    See the function for more information. adi_int_EnterCriticalRegion Prototype void adi_int_ExitCriticalRegion( void *pArg Arguments Return value from the corresponding pArg function call adi_int_EnterCriticalRegion() Return Value None 2-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 97: Adi_Int_Sicdisable

    Arguments enumeration value that identi- PeripheralID ADI_INT_PERIPHERAL_ID fies an interrupt source Return Value System interrupt controller has been success- ADI_INT_RESULT_SUCCESS fully configured. Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERALID VisualDSP++ 5.0 Device Drivers and System 2-29 Services Manual for Blackfin Processors...
  • Page 98: Adi_Int_Sicenable

    PeripheralID ADI_INT_PERIPHERAL_ED fies a peripheral interrupt source Return Value Return values include: System interrupt controller has been success- ADI_INT_RESULT_SUCCESS fully configured. Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERAL_ID 2-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 99: Adi_Int_Sicgetivg

    Return Value The function returns if successful. Other possi- ADI_INT_RESULT_SUCCESS ble return values include: Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERAL_ID Interrupt vector group level is invalid. ADI_INT_RESULT_INVALID_IVG VisualDSP++ 5.0 Device Drivers and System 2-31 Services Manual for Blackfin Processors...
  • Page 100: Adi_Int_Sicinterruptasserted

    The function returns one of the following values: Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERAL_ID Specified peripheral is asserting an interrupt. ADI_INT_RESULT_ASSERTED Specified peripheral is not asserting an interrupt. ADI_INT_RESULT_NOT_ASSERTED 2-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 101: Adi_Int_Sicsetivg

    Return Value The function returns , if successful. Other possi- ADI_INT_RESULT_SUCCESS ble return values include: Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERAL_ID Interrupt vector group level is invalid. ADI_INT_RESULT_INVALID_IVG VisualDSP++ 5.0 Device Drivers and System 2-33 Services Manual for Blackfin Processors...
  • Page 102: Adi_Int_Setimaskbits

    Regardless of the implementation details, the API is consistent from envi- ronment to operating environment. Application software does not have to change when moving to a different operating environment. Prototype void adi_int_SetIMASKBits( ADI_INT_IMASK BitsToSet 2-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 103 IMASK register. A bit with a value of ‘1’ sets the corresponding bit in the IMASK register. A bit with the value of ‘0’ leaves the corresponding bit in the IMASK register unchanged. Return Value None VisualDSP++ 5.0 Device Drivers and System 2-35 Services Manual for Blackfin Processors...
  • Page 104: Adi_Int_Sicwakeup

    Enables/disables waking up the core(s) upon triggering of WakeupFlag the peripheral interrupt ( TRUE/FALSE Return Value Return values include: System interrupt controller has been ADI_INT_RESULT_SUCCESS successfully configured. Peripheral ID specified is invalid. ADI_INT_RESULT_INVALID_PERIPHERAL_ID 2-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 105: Power Management Module

    “PM Module Operation – Getting Started” on page 3-3 • “Power Management API Reference” on page 3-15 • “Public Data Types and Enumerations” on page 3-42 • “PM Module Macros” on page 3-56 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 106: Introduction

    In both cases, validity checks are performed at all stages, ensuring that the processor is not stalled or harmed. “PM Module Operation – Getting Started” on page 3-3 describes the basic operating stages required to use the power management module. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 107: Pm Module Operation - Getting Started

    Power Management Module The power management module uses an unambiguous naming convention to safeguard against conflicts with other software libraries provided by Analog Devices or other companies. To this end, all enumeration values statements use the prefix, and functions and global...
  • Page 108 The following statement requests the PM module set the core and system clock frequencies to the maximum values possible. adi_pwr_SetFreq( // Core clock frequency (MHz) // System clock frequency (MHz) ADI_PWR_DF_ON // Do not adjust the PLL input divider VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 109: Dual-Core Considerations

    ADI_PWR_CMD_SET_AUTO_SYNC_ENABLED with a NULL argument, as shown in the following command-pair table for the ADSP-BF561 EZ-KIT Lite. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 110: Synchronization Requirement

    SDRAM memory space, while the SDRAM timing parame- ters are updated. There are two possible operating modes: running on one core, and running applications on both cores. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 111: Running Applications On One Core Only

    { asm(“IDLE;”); Whenever core B wakes up (due to the PLL programming sequence exe- cuted by the power management service) it is immediately returned to the IDLE state. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 112: Running Applications On Both Cores

    Once activated, the built-in synchronization has exclusive control over supplemental interrupt 0 and chains an appropriate interrupt handler to the appropriate IVG level using the interrupt manager. This prevents the VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 113 ADI_PWR_CMD_SET_CLIENT_HANDLE Specifies a value/address void* which is sent to both the call- back functions as the sole argu- ment. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 114: Synchronization Between Cores

    ("l2_shared") testset_t adi_pwr_lockvar = 0; where the memory input section, , is mapped to the l2_shared output section in both the default and generated linker MEM_L2_SRAM description files ( .ldf 3-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 115 Power Management Module According to Appendix A of the VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Processors, there are two possible approaches for building applications that run across both cores. • One application per core, where executables are built for each core using two passes of the linker •...
  • Page 116 . For example: ..\CoreA\Release\CoreA.dxe #define OTHERCORE ..\CoreA\Release\CoreA.dxe #if defined(OTHERCORE) Refer to Appendix A of the VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Processors and the VisualDSP++ 5.0 Linker and Utili- ties Manual for details. 3-12 VisualDSP++ 5.0 Device Drivers and System...
  • Page 117: Sdram Initialization Prior To Loading An Executable

    SDRAM prior to loading the application. This is achieved by using an initialization block as described in the VisualDSP++ 5.0 Loader and Utilities manual, where the example given demonstrates the initialization of SDRAM.
  • Page 118: Sdram Initialization Prior To Loading An Executable

    IDDE, either use the Custom Board Support feature, now available with VisualDSP++5.0 (described in Help\Graphical Environment\Custom ), or simply change the values at the bottom of the relevant Board Support file after backing up the original file. .xml 3-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 119: Power Management Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 3-15 Services Manual for Blackfin Processors...
  • Page 120: Adi_Pwr_Adjustfreq

    ADI_PWR_RESULT_SUCCESS Process completed successfully. ADI_PWR_RESULT_SUCCESS PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED Invalid value for has been specified. ADI_PWR_RESULT_INVALID_CSEL CSEL 3-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 121 Power Management Module Invalid value for has been specified. ADI_PWR_RESULT_INVALID_SSEL SSEL Core clock divider is greater than the sys- ADI_PWR_INVALID_CSEL_SSEL_COMBINATION tem clock divider value, or both ADI_PWR_CSEL_NONE are specified. ADI_PWR_SSEL_NONE VisualDSP++ 5.0 Device Drivers and System 3-17 Services Manual for Blackfin Processors...
  • Page 122: Adi_Pwr_Control

    The last entry ADI_PWR_COMMAND_PAIR in the table must be ADI_PWR_CMD_END ADI_PWR_COMMAND_PAIR table[] = { { ADI_PWR_CMD_SET_INPUT_DELAY, (void*)ADI_PWR_INPUT_DELAY_ENABLE { ADI_PWR_CMD_SET_OUTPUT_DELAY, (void*)ADI_PWR_OUTPUT_DELAY_ENABLE { ADI_PWR_CMD_END, 0} adi_pwr_Control( ADI_PWR_CMD_TABLE, 3-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 123 Invalid command has been specified. ADI_PWR_RESULT_BAD_COMMAND PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED Input delay value is invalid. ADI_PWR_RESULT_INVALID_INPUT_DELAY Output delay value is invalid. ADI_PWR_RESULT_INVALID_OUTPUT_DELAY PLL lock count value is invalid. ADI_PWR_RESULT_INVALID_LOCKCNT VisualDSP++ 5.0 Device Drivers and System 3-19 Services Manual for Blackfin Processors...
  • Page 124: Adi_Pwr_Getconfigsize

    , incorporate the size of the EBIU module config- ADI_PWR_SIZEOF_CONFIG uration, regardless whether the latter is initialized. Prototype size_t adi_pwr_GetConfigSize(void); Return Value The size of the configuration structure. 3-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 125: Adi_Pwr_Getfreq

    In the debug variant of the library, the function returns adi_pwr_GetFreq one of the following result codes; otherwise, the function returns ADI_PWR_RESULT_SUCCESS Process completed successfully. ADI_PWR_RESULT_SUCCESS PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED VisualDSP++ 5.0 Device Drivers and System 3-21 Services Manual for Blackfin Processors...
  • Page 126: Adi_Pwr_Getpowermode

    This function returns the current power mode of the processor (only applicable for full-on and active modes). Prototype ADI_PWR_MODE adi_pwr_GetPowerMode(void); Return Value The current power mode as an value. ADI_PWR_MODE 3-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 127: Adi_Pwr_Getpowersaving

    , and the nominal values as per the maximum possible unity (that is, at VLEV = 1.3 V Prototype u32 adi_pwr_GetPowerSaving(void); Return Value The percentage power saving value. VisualDSP++ 5.0 Device Drivers and System 3-23 Services Manual for Blackfin Processors...
  • Page 128 EZ-KIT ADI_PWR_COMMAND_PAIR Lite values: ADI_PWR_COMMAND_PAIR ezkit_init[] = { { ADI_PWR_CMD_SET_PROC_VARIANT, ADI_PWR_PROC_BF533SKBC600 }, { ADI_PWR_CMD_SET_PACKAGE, ADI_PWR_PACKAGE_MBGA }, { ADI_PWR_CMD_SET_VDDEXT, ADI_PWR_VDDEXT_330 }, { ADI_PWR_CMD_SET_CLKIN, 25 /* MHz */ }, 3-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 129: Adi_Pwr_Init

    ADI_PWR_VDDEXT voltage level applied to the internal voltage regulator (mandatory). See “ADI_PWR_VDDEXT” on page 3-53. value (see ADI_PWR_CMD_SET_IVG interrupt_kind exception.h specifies the IVG level for the event. PLL_WAKEUP VisualDSP++ 5.0 Device Drivers and System 3-25 Services Manual for Blackfin Processors...
  • Page 130 IVG level that is assigned to sup- ADI_PWR_CMD_SET_COREB_SUPP_INT0_IVG plemental interrupt 0 on core B. This command is passed to on core B adi_pwr_Init() only. 3-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 131 B adi_pwr_Init() only. value/address that is ADI_PWR_CMD_SET_CLIENT_HANDLE void* sent to the callback functions. This command is passed to on core B adi_pwr_Init() only. Prototype ADI_EBIU_RESULT adi_pwr_Init( ADI_PWR_COMMAND_PAIR *table VisualDSP++ 5.0 Device Drivers and System 3-27 Services Manual for Blackfin Processors...
  • Page 132 For example, if passing a table of com- mands to the function, the following command adi_pwr_Init() should be added to the table: { ADI_PWR_CMD_SET_FREQ_AS_MHZ, NULL }, Table 3-5 lists and explains the return codes. 3-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 133 IVG level supplied is invalid. ADI_PWR_RESULT_INVALID_IVG Input delay value is invalid. ADI_PWR_RESULT_INVALID_INPUT_DELAY Output delay value is invalid. ADI_PWR_RESULT_INVALID_OUTPUT_DELAY PLL lock count value is invalid. ADI_PWR_RESULT_INVALID_LOCKCNT Invalid EZ-KIT Lite type specified. ADI_PWR_RESULT_INVALID_EZKIT VisualDSP++ 5.0 Device Drivers and System 3-29 Services Manual for Blackfin Processors...
  • Page 134: Adi_Pwr_Loadconfig

    ADI_PWR_RESULT_SUCCESS Function completed successfully. ADI_PWR_RESULT_SUCCESS Value of is insufficient. ADI_PWR_RESULT_NO_MEMORY szConfig Address of is zero. ADI_PWR_RESULT_FAILED hConfig PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED 3-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 135: Adi_Pwr_Reset

    Power Management Module adi_pwr_Reset Description This function resets the PLL controller to its hardware reset values. Prototype void adi_pwr_Reset(void); Arguments None Return Value None VisualDSP++ 5.0 Device Drivers and System 3-31 Services Manual for Blackfin Processors...
  • Page 136: Adi_Pwr_Saveconfig

    ADI_PWR_RESULT_SUCCESS Function completed successfully. ADI_PWR_RESULT_SUCCESS Value of is insufficient. ADI_PWR_RESULT_NO_MEMORY szConfig Address of is zero. ADI_PWR_RESULT_FAILED hConfig PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED 3-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 137: Adi_Pwr_Setfreq

    To determine the values set by this function, use adi_pwr_GetFreq Prototype ADI_PWR_RESULT adi_pwr_SetFreq( const u32 fcclk, const u32 fsclk, const ADI_PWR_DF df); VisualDSP++ 5.0 Device Drivers and System 3-33 Services Manual for Blackfin Processors...
  • Page 138 In the debug variant of the library, the function returns adi_pwr_SetFreq one of the following result codes, otherwise, it returns ADI_PWR_RESULT_SUCCESS Process completed successfully. ADI_PWR_RESULT_SUCCESS PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED 3-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 139: Adi_Pwr_Setmaxfreqforvolt

    Voltage regulator is bypassed. A call to ADI_PWR_RESULT_VR_BYPASSED with a non-zero adi_dma_SetVoltageRegulator switching frequency value is required prior to this call. “adi_pwr_SetVoltageRegulator” on page 3-38. PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED VisualDSP++ 5.0 Device Drivers and System 3-35 Services Manual for Blackfin Processors...
  • Page 140: Adi_Pwr_Setpowermode

    ADSP-BF531, ADSP-BF532, and ADSP-BF533 processor cores, pin on the processor is asserted on reset, causing the SCKE SDRAM to exit self-refresh mode. This behavior is a constraint of 3-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 141 Process completed successfully. ADI_PWR_RESULT_SUCCESS PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED Either an incorrect mode has been requested or the ADI_PWR_RESULT_INVALID_MODE requested mode cannot be reached from the current mode. VisualDSP++ 5.0 Device Drivers and System 3-37 Services Manual for Blackfin Processors...
  • Page 142: Adi_Pwr_Setvoltageregulator

    “ADI_PWR_VR_CKELOW” on page 3-54. enumeration value indicating whether the voltage regulator USBWE ADI_PWR_VR_USBWE can be awakened from power-down by activity on the USB interface. See “ADI_PWR_VR_USBWE” on page 3-54. 3-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 143 3-55. Use the value to bypass the ADI_PWR_VR_FREQ_POWERDOWN on-board voltage regulator. value specifying the internal loop ADI_PWR_CMD_SET_VR_GAIN ADI_PWR_VR_GAIN gain of the switching regulator loop. See “ADI_PWR_VR_GAIN” on page 3-55. VisualDSP++ 5.0 Device Drivers and System 3-39 Services Manual for Blackfin Processors...
  • Page 144 If the requested voltage level is insufficient to sustain the current frequency values, the function returns an error without amending any settings. 3-40 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 145 CANWE value is invalid. ADI_PWR_RESULT_INVALID_VR_CLKBUFOE CLKBUFOE value is invalid. ADI_PWR_RESULT_INVALID_VR_CKELOW CKELOW wakeup value is invalid. ADI_PWR_RESULT_INVALID_VR_USBWE argument is unrecognized. ADI_PWR_RESULT__BAD_COMMAND Command PM module has not been initialized. ADI_PWR_RESULT_NOT_INITIALIZED VisualDSP++ 5.0 Device Drivers and System 3-41 Services Manual for Blackfin Processors...
  • Page 146: Public Data Types And Enumerations

    See “ADI_PWR_INPUT_DELAY” on page 3-48. value specifying ADI_PWR_CMD_SET_OUTPUT_DELAY ADI_PWR_OUTPUT_DELAY whether to add approximately 200 ps of delay to external memory output signals. See “ADI_PWR_OUTPUT_DELAY” on page 3-48. 3-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 147 CCLK value. These values are used ADI_PWR_VLEV instead of the data sheet values. value specifying the IVG level for the ADI_PWR_CMD_SET_IVG event. This defaults to 7. PLL_WAKEUP VisualDSP++ 5.0 Device Drivers and System 3-43 Services Manual for Blackfin Processors...
  • Page 148 “ADI_PWR_VR_PHYWE” on page 3-56. enumeration value indicat- ADI_PWR_CMD_SET_VR_CANWE ADI_PWR_VR_CANWE ing whether to enable or disable the CANWE (for processors with CAN interface only). See “ADI_PWR_VR_CANWE” on page 3-54. 3-44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 149 ADI_PWR_CMD_GET_VR_WAKE ADI_PWR_VR_WAKE can be awakened from power-down upon an interrupt from the RTC or a low-going edge on pin. See “ADI_PWR_VR_WAKE” RESET# on page 3-56. VisualDSP++ 5.0 Device Drivers and System 3-45 Services Manual for Blackfin Processors...
  • Page 150 CKELOW abled (processors with bit only). See CKELOW “ADI_PWR_VR_CKELOW” on page 3-54. value containing the value in the ADI_PWR_CMD_GET_PLL_LOCKCNT register. PLL_LOCKCNT 3-46 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 151: Adi_Pwr_Command_Pair

    Divides voltage core oscillator frequency by 1. ADI_PWR_CSEL_1 Divides voltage core oscillator frequency by 2. ADI_PWR_CSEL_2 Divides voltage core oscillator frequency by 4. ADI_PWR_CSEL_4 Divides voltage core oscillator frequency by 4. ADI_PWR_CSEL_8 VisualDSP++ 5.0 Device Drivers and System 3-47 Services Manual for Blackfin Processors...
  • Page 152: Adi_Pwr_Df

    Do not add output delay. ADI_PWR_OUTPUT_DELAY_DISABLE Add approximately 200 ps of delay to external ADI_PWR_OUTPUT_DELAY_ENABLE memory output signals. See ADSP-BF533 Blackfin Processor Hardware Reference, Revision 3.2, July 2006, page 8-4. 3-48 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 153: Adi_Pwr_Mode

    - identified by the hemispherical contacts on ADI_PWR_PACKAGE_MBGA MBGA the under surface of the processor. - identified by the leg contacts around the ADI_PWR_PACKAGE_LQFP LQFP edges of the processor. VisualDSP++ 5.0 Device Drivers and System 3-49 Services Manual for Blackfin Processors...
  • Page 154: Adi_Pwr_Pcc133_Compliance

    Table 3-7. PM Module Return Values Return Value Explanation Routine completed successfully. ADI_PWR_RESULT_SUCCESS Generic failure was encountered. ADI_PWR_RESULT_FAILED Insufficient memory for configura- ADI_PWR_RESULT_NO_MEMORY tion values to be stored. Command is not recognized. ADI_PWR_RESULT_BAD_COMMAND 3-50 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 155 Voltage regulator cannot be set ADI_PWR_RESULT_VOLTAGE_REGULATOR_BYPASSED since it is in bypass mode. argument is invalid or insuffi- ADI_PWR_RESULT_INVALID_VR_VLEV VLEV cient to sustain the current core and system clock frequencies. VisualDSP++ 5.0 Device Drivers and System 3-51 Services Manual for Blackfin Processors...
  • Page 156: Adi_Pwr_Ssel

    Divides voltage core oscillator frequency by 9. ADI_PWR_SSEL_9 Divides voltage core oscillator frequency by 10. ADI_PWR_SSEL_10 Divides voltage core oscillator frequency by 11. ADI_PWR_SSEL_11 Divides voltage core oscillator frequency by 12. ADI_PWR_SSEL_12 3-52 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 157: Adi_Pwr_Vddext

    1.00 V ADI_PWR_VLEV_100 1.05 V ADI_PWR_VLEV_105 1.10 V ADI_PWR_VLEV_110 1.15 V ADI_PWR_VLEV_115 1.20 V (default) ADI_PWR_VLEV_120 1.25 V ADI_PWR_VLEV_125 1.30 V ADI_PWR_VLEV_130 1.35 V ADI_PWR_VLEV_135 1.40 V ADI_PWR_VLEV_140 VisualDSP++ 5.0 Device Drivers and System 3-53 Services Manual for Blackfin Processors...
  • Page 158: Adi_Pwr_Vr_Canwe

    SDRAM to remain in self-refresh mode. Drive high on reset; SDRAM contents are ADI_PWR_VR_PHYWE_DISABLED SCKE invalidated. Drive low on reset; SDRAM contents are ADI_PWR_VR_PHYWE_ENABLED SCKE maintained. 3-54 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 159: Adi_Pwr_Vr_Clkbufoe

    The higher the gain, the quicker the set- tling time. High gain settings cause greater overshoot in the process. ADI_PWR_VR_GAIN_5 ADI_PWR_VR_GAIN_110 20 (default) ADI_PWR_VR_GAIN_20 ADI_PWR_VR_GAIN_50 VisualDSP++ 5.0 Device Drivers and System 3-55 Services Manual for Blackfin Processors...
  • Page 160: Adi_Pwr_Vr_Phywe

    ADI_PWR_VLEV_120 Returns the voltage in volts as a float for the given ADI_PWR_VOLTS(V) level. Returns an integer value of the voltage in millivolts ADI_PWR_MILLIVOLTS(V) for the given level. 3-56 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 161 Equivalent processor type to ADI_PWR_PROC_BF532SBBZ400 ADI_PWR_PROC_BF531_OR_BF532 Equivalent processor type to ADI_PWR_PROC_BF531SBBC400 ADI_PWR_PROC_BF531_OR_BF532 Equivalent processor type to ADI_PWR_PROC_BF531SBST400 ADI_PWR_PROC_BF531_OR_BF532 Equivalent processor type to ADI_PWR_PROC_BF531SBSTZ400 ADI_PWR_PROC_BF531_OR_BF532 Equivalent processor type to ADI_PWR_PROC_BF531SBBZ400 ADI_PWR_PROC_BF531_OR_BF532 VisualDSP++ 5.0 Device Drivers and System 3-57 Services Manual for Blackfin Processors...
  • Page 162 Equivalent processor type to ADI_PWR_PROC_BF534SBBC1Z400 ADI_PWR_PROC_BF534SBBC1400 Equivalent processor type to ADI_PWR_PROC_BF534SBBC2Z400 ADI_PWR_PROC_BF534SBBC1400 Equivalent processor type to ADI_PWR_PROC_BF534SBBC1Z500 ADI_PWR_PROC_BF534SBBC1500 Equivalent processor type to ADI_PWR_PROC_BF534SBBC2Z500 ADI_PWR_PROC_BF534SBBC1500 Equivalent processor type to ADI_PWR_PROC_BF541SKBC1600 ADI_PWR_PROC_BF548SKBC1600 3-58 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 163 Equivalent processor type to ADI_PWR_PROC_BF544SBBC1533 ADI_PWR_PROC_BF548SBBC1533 Equivalent processor type to ADI_PWR_PROC_BF544SBBC1400 ADI_PWR_PROC_BF548SBBC1400 Equivalent processor type to ADI_PWR_PROC_BF549SKBC1600 ADI_PWR_PROC_BF548SKBC1600 Equivalent processor type to ADI_PWR_PROC_BF549SBBC1533 ADI_PWR_PROC_BF548SBBC1533 Equivalent processor type to ADI_PWR_PROC_BF549SBBC1400 ADI_PWR_PROC_BF548SBBC1400 VisualDSP++ 5.0 Device Drivers and System 3-59 Services Manual for Blackfin Processors...
  • Page 164 PM Module Macros 3-60 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 165: External Bus Interface Unit Module

    “Using the EBIU Module” on page 4-3 • “EBIU API Reference” on page 4-10 • “Public Data Types and Enumerations” on page 4-24 • “Setting Control Values in the EBIU Module” on page 4-31 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 166: Introduction

    EBIU module. Sample code is also included. The EBIU module uses an unambiguous naming convention to safeguard against conflicts with other software libraries provided by Analog Devices or other companies. All enumeration values and...
  • Page 167: Using The Ebiu Module

    {ADI_EBIU_BANK_ALL, { ADI_EBIU_ASYNCH_ST_3_CYCLES, { 0, ADI_EBIU_TIMING_UNIT_NANOSEC } } }; ADI_EBIU_ASYNCH_BANK_TIMING asynch_bank_hold_time = {ADI_EBIU_BANK_ALL, { ADI_EBIU_ASYNCH_HT_2_CYCLES, { 0, ADI_EBIU_TIMING_UNIT_NANOSEC } } }; ADI_EBIU_ASYNCH_BANK_TIMING asynch_bank_read_access_time = {ADI_EBIU_BANK_ALL, { 0xB, { 0, ADI_EBIU_TIMING_UNIT_NANOSEC } } VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 168 /* set up the command pair table using the above definitions */ ADI_EBIU_COMMAND_PAIR ebiu_init_table[] = { { ADI_EBIU_CMD_SET_SDRAM_BANK_SIZE, (void*)&bank_size }, { ADI_EBIU_CMD_SET_SDRAM_BANK_COL_WIDTH, (void*)&bank_width }, { ADI_EBIU_CMD_SET_SDRAM_CL_THRESHOLD, (void*)cl_threshold }, { ADI_EBIU_CMD_SET_SDRAM_TRASMIN, (void*)&trasmin }, { ADI_EBIU_CMD_SET_SDRAM_TRPMIN, (void*)&trpmin }, VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 169 The EBIU module should be initialized prior to initializing the power management module, so that subsequent calls to in the power manage- adi_pwr_SetFreq adi_pwr_SetMaxFreqForVolt ment module will automatically adjust the SDRAM or DDR. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 170 { 2, {15, ADI_EBIU_TIMING_UNIT_NANOSEC /* cycles from active command to next R/W */ ADI_EBIU_TIMING_VALUE REFI = { 1037,{7777, ADI_EBIU_TIMING_UNIT_NANOSEC}}; /* cycles from one REFRESH signal to the next */ VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 171 { ADI_EBIU_CMD_SET_DDR_RCD, (void*)&RCD }, /* command to set cycles from active command to a read-write assertion */ { ADI_EBIU_CMD_END, 0 } /* indicate the last command of the table */ VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 172 // set bank size to 32MB bank_size.value.size = ADI_EBIU_SDRAM_BANK_32MB; ADI_EBIU_COMMAND_PAIR ebiu_init_table[] = { // MT48LC16M16-75 module { ADI_EBIU_CMD_SET_SDRAM_MODULE, (void*)ADI_EBIU_SDRAM_MODULE_MT48LC16M16A2_75 }, { ADI_EBIU_CMD_SET_SDRAM_BANK_SIZE, (void*)&bank_size }, { ADI_EBIU_CMD_END, 0 } adi_ebiu_Init(ebiu_init_table, 0); VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 173 SCLK changes. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 174: Ebiu Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values 4-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 175: Adi_Ebiu_Adjustsdram

    The function returns the following values in debug or release mode. Process completed successfully. ADI_EBIU_RESULT_SUCCESS SDRAM has not been successfully initialized, or ADI_EBIU_RESULT_NOT_INITIALIZED SDRAM had not been enabled. VisualDSP++ 5.0 Device Drivers and System 4-11 Services Manual for Blackfin Processors...
  • Page 176: Adi_Ebiu_Control

    The last ADI_EBIU_COMMAND_PAIR command-value entry in the table must be {ADI_EBIU_CMD_END, ADI_EBIU_COMMAND_PAIR table[] = { { ADI_EBIU_CMD_SET_SDRAM_FBBRW, (void*)ADI_EBIU_SDRAM_FBBRW_ENABLE }, { ADI_EBIU_CMD_SET_SDRAM_CDDBG, (void*)ADI_EBIU_CDDBG_ENABLE }, { ADI_EBIU_CMD_END, 0 } 4-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 177 In debug mode, one of the following values listed in Table 4-1 is returned; otherwise, ADI_EBIU_RESULT_SUCCESS is returned, depending on whether ADI_EBIU_RESULT_NOT_INITIALIZED the EBIU module has been successfully initialized. VisualDSP++ 5.0 Device Drivers and System 4-13 Services Manual for Blackfin Processors...
  • Page 178 Invalid asynchronous memory read access time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK _READ_ACCESS_TIME Invalid asynchronous memory write access time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK _WRITE_ACCESS_TIME Invalid asynchronous memory bank setup time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK _SETUP_TIME Invalid asynchronous memory bank hold time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK _HOLD_TIME 4-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 179: Adi_Ebiu_Getconfigsize

    This value is also available via the macro. ADI_EBIU_SIZEOF_CONFIG Prototype size_t adi_ebiu_GetConfigSize(void); Return Value The size of the configuration structure. VisualDSP++ 5.0 Device Drivers and System 4-15 Services Manual for Blackfin Processors...
  • Page 180: Adi_Ebiu_Init

    (cycles, ms) 1 Column address strobe 2 Required delay between issuing a command and a command, Bank Activate Precharge and between the command and the exit from self-refresh. Self-Refresh 4-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 181 Precharge to active time ADI_EBIU_CMD_SET_DDR_RP ADI_EBIU_TIMING_VALUE Interval between setting ADI_EBIU_CMD_SET_DDR_MRD ADI_EBIU_TIMING_VALUE of mode register and next command Write to read ADI_EBIU_CMD_SET_DDR_WTR ADI_EBIU_TIMING_VALUE interval Write recovery time ADI_EBIU_CMD_SET_DDR_WR ADI_EBIU_TIMING_VALUE VisualDSP++ 5.0 Device Drivers and System 4-17 Services Manual for Blackfin Processors...
  • Page 182 SDRAM is adjusted according to changes in . Subsequent calls to the function are SCLK ignored. Prototype ADI_EBIU_RESULT adi_ebiu_Init( const ADI_EBIU_COMMAND_PAIR *ConfigData, const u16 Reserved 4-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 183 Invalid column address width is speci- ADI_EBIU_RESULT_INVALID_SDRAM_COL_WIDTH fied. Invalid value is specified. ADI_EBIU_RESULT_INVALID_SDRAM_TWRMIN TWRMIN Invalid value is specified. ADI_EBIU_RESULT_INVALID_SDRAM_EMREN EMREN Invalid value is specified. ADI_EBIU_RESULT_INVALID_SDRAM_PASR PASR Invalid value is specified. ADI_EBIU_RESULT_INVALID_SDRAM_TCSR TCSR VisualDSP++ 5.0 Device Drivers and System 4-19 Services Manual for Blackfin Processors...
  • Page 184 Invalid active to R/W interval ADI_EBIU_RESULT_INVALID_DDR_RCD Invalid delay R/W to valid data ADI_EBIU_RESULT_INVALID_DDR_CAS Invalid partial array self-refresh ADI_EBIU_RESULT_INVALID_DDR_PASR request Invalid soft reset request ADI_EBIU_RESULT_INVALID_DDR_SOFT_RESET Invalid self-refresh request ADI_EBIU_RESULT_INVALID_DDR_SELF_REFRESH_REQUEST 4-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 185 ADI_EBIU_RESULT_INVALID_ASYNCH_BANK_WRITE_ACCESS _TIME Invalid setup time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK_SETUP_TIME Invalid hold time ADI_EBIU_RESULT_INVALID_ASYNCH_BANK_HOLD_TIME Invalid selection for ADI_EBIU_RESULT_INVALID_ASYNCH_BANK_ARDY_ENABLE ARDY enable Invalid selection for ADI_EBIU_RESULT_INVALID_ASYNCH_BANK_ARDY_ ARDY polarity POLARITY EBIU service already initialized ADI_EBIU_RESULT_ALREADY_INITIALIZED VisualDSP++ 5.0 Device Drivers and System 4-21 Services Manual for Blackfin Processors...
  • Page 186: Adi_Ebiu_Loadconfig

    In the debug variant of the library, one of the following values is returned; otherwise, is returned. ADI_EBIU_RESULT_SUCCESS Process completed successfully. ADI_EBIU_RESULT_SUCCESS Value is too small. ADI_EBIU_RESULT_NO_MEMORY szConfig SDRAM has not been successfully initialized. ADI_EBIU_RESULT_NOT_INITIALIZED 4-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 187: Adi_Ebiu_Saveconfig

    In the debug variant of the library, one of the following values is returned; otherwise, is returned. ADI_EBIU_RESULT_SUCCESS Process completed successfully. ADI_EBIU_RESULT_SUCCESS Value is too small. ADI_EBIU_RESULT_NO_MEMORY szConfig SDRAM has not been successfully initialized. ADI_EBIU_RESULT_NOT_INITIALIZED VisualDSP++ 5.0 Device Drivers and System 4-23 Services Manual for Blackfin Processors...
  • Page 188: Public Data Types And Enumerations

    EBIU_SDBCTL specified. Invalid value for the field ADI_EBIU_RESULT_INVALID_SDRAM_COL_WIDTH EBCAW of the register is EBIU_SDBCTL specified. Invalid value for the field ADI_EBIU_RESULT_INVALID_SDRAM_CDDBG CDDBG of the register is EBIU_SDGCTL specified. 4-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 189 TWRMIN ified and causes to be greater than 3. Insufficient memory to ADI_EBIU_RESULT_NO_MEMORY load/save configuration. Invalid EZ-KIT revision ADI_EBIU_RESULT_INVALID_EZKIT Invalid value ADI_EBIU_RESULT_INVALID_SDRAM_SCTLE SCTLE Invalid SDRAM module type ADI_EBIU_RESULT_INVALID_SDRAM_MODULE VisualDSP++ 5.0 Device Drivers and System 4-25 Services Manual for Blackfin Processors...
  • Page 190 Invalid mode register selection ADI_EBIU_RESULT_INVALID_DDR_MRD Invalid active to R/W interval ADI_EBIU_RESULT_INVALID_DDR_RCD Invalid R/W to valid data ADI_EBIU_RESULT_INVALID_DDR_CAS interval Invalid partial array self-refresh ADI_EBIU_RESULT_INVALID_DDR_PASR request Invalid soft reset request ADI_EBIU_RESULT_INVALID_DDR_SOFT_RESET 4-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 191: Adi_Ebiu_Sdram_Bank_Value

    ADI_EBIU_TIME integral number of a given unit. It is defined as: typedef struct ADI_EBIU_TIME { value; ADI_EBIU_TIMING_UNIT units; } ADI_EBIU_TIME; VisualDSP++ 5.0 Device Drivers and System 4-27 Services Manual for Blackfin Processors...
  • Page 192: Adi_Ebiu_Timing_Value

    SCLK units (for example, nanoseconds or milliseconds). 4-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 193: Adi_Ebiu_Asynch_Bank_Timing

    Timing values used to set the asynchronous memory control registers should be derived from the appropriate data sheet for the type of memory device used. VisualDSP++ 5.0 Device Drivers and System 4-29 Services Manual for Blackfin Processors...
  • Page 194: Adi_Ebiu_Asynch_Bank_Value

    16-bit packing enabled or 32-bit packing disabled. (See “ADI_EBIU_ASYNCH_BANK_DATA_PATH” on page 4-45.) typedef struct ADI_EBIU_ASYNCH_BANK_VALUE u32 bank_number; union ADI_EBIU_ASYNCH_BANK_ARDY_POLARITY ardy_polarity; ADI_EBIU_ASYNCH_BANK_ARDY_ENABLE ardy_enable; #if defined(__ADSP_TETON__) ADI_EBIU_ASYNCH_BANK_DATA_PATH data_path; 4-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 195: Setting Control Values In The Ebiu Module

    Defines the end of a table of command pairs. ADI_EBIU_CMD_END value specifying ADI_EBIU_CMD_SET_SDRAM_EBUFE ADI_EBIU_SDRAM_EBUFE whether external buffers are used when several SDRAM devices are used. See “ADI_EBIU_SDRAM_EBUFE” on page 4-42. VisualDSP++ 5.0 Device Drivers and System 4-31 Services Manual for Blackfin Processors...
  • Page 196 4-29. value specify- ADI_EBIU_CMD_SET_ASYNCH_BANK_WRITE_ ADI_EBIU_ASYNCH_BANK_TIMING ing an and an ACCESS_TIME ADI_EBIU_BANK_NUMBER that specifies the ADI_EBIU_TIMING_VALUE write access time in either cycles or timing units. “ADI_EBIU_ASYNCH_BANK_TIMING” on page 4-29. 4-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 197 See “ADI_EBIU_SDRAM_BANK_VALUE” on page 4-27 “ADI_EBIU_SDRAM_BANK_COL_WIDTH” on page 4-39. value specifying the frequency thresh- ADI_EBIU_CMD_SET_SDRAM_CL_THRESHOLD SCLK old, which determines the CAS latency value to use. VisualDSP++ 5.0 Device Drivers and System 4-33 Services Manual for Blackfin Processors...
  • Page 198 EBIU_SDGCTL word containing the entire contents of the ADI_EBIU_CMD_SET_SDBCTL_REG register EBIU_SDBCTL value specifying ADI_EBIU_CMD_SET_SDRAM_EMREN ADI_EBIU_SDRAM_EMREN whether low power (2.5 V) SDRAM is used. See “ADI_EBIU_SDRAM_MODULE_TYPE” on page 4-39. 4-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 199 Set DDR precharge to active interval ADI_EBIU_CMD_SET_DDR_RP Set DDR interval between setting of mode ADI_EBIU_CMD_SET_DDR_MRD register and next command Set DDR interval between write and read ADI_EBIU_CMD_SET_DDR_WTR command VisualDSP++ 5.0 Device Drivers and System 4-35 Services Manual for Blackfin Processors...
  • Page 200 ADI_EBIU_ASYNCH_BANK_DATA_PATH fies whether or not 16-bit packing is enabled. See “ADI_EBIU_ASYNCH_BANK_DATA_PATH” on page 4-45. value specify- ADI_EBIU_CMD_SET_ASYNCH_BANK_ENABLE ADI_EBIU_ASYNCH_BANK_ENABLE ing which banks to enable. See “ADI_EBIU_ASYNCH_BANK_ENABLE” on page 4-45. 4-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 201 SDRAM. Automatically set upon initialization. See “ADI_EBIU_SDRAM_ENABLE” on page 4-38. value enabling/dis- ADI_EBIU_CMD_SET_SDRAM_SRFS ADI_EBIU_SDRAM_SRFS abling self-refresh of SDRAM during inactivity. “ADI_EBIU_SDRAM_TCSR” on page 4-41. Request DDR self-refresh ADI_EBIU_CMD_DDR_SELF_REFRESH_REQUEST VisualDSP++ 5.0 Device Drivers and System 4-37 Services Manual for Blackfin Processors...
  • Page 202: Adi_Ebiu_Command_Pair

    Enables SDRAM. ADI_EBIU_SDRAM_EBE_ENABLE The default value is specified by the following macro: #define ADI_EBIU_SDRAM_EBE_DEFAULT ADI_EBIU_SDRAM_EBE_DISABLE Refer to SDRAM Selection Guidelines and Configuration for ADI Processors, EE-210, October 27, 2003. 4-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 203: Adi_Ebiu_Sdram_Bank_Size

    ADI_EBIU_SDRAM_MODULE_TYPE This enumeration specifies an SDRAM module type when the command is used to initialize the SDRAM con- ADI_EBIU_CMD_SET_SDRAM_MODULE troller. The enumerator values contain relevant module information such VisualDSP++ 5.0 Device Drivers and System 4-39 Services Manual for Blackfin Processors...
  • Page 204: Adi_Ebiu_Cmd_Set_Sdram_Sctle

    ADI_EBIU_CMD_SET_SDRAM_BANK_SIZE command. Because Analog Devices EZ-KIT Lite boards include SDRAM supplied by Micron, this information applies only to Micron parts. The list of valid enumeration values are found in the API header file, adi_pwr.h...
  • Page 205: Adi_Ebiu_Sdram_Pasr

    #define ADI_EBIU_SDRAM_TCSR_DEFAULT ADI_EBIU_SDRAM_TCSR_45DEG ADI_EBIU_SDRAM_SRFS This enumeration specifies whether the EBIU is to enable/disable SDRAM self-refresh during periods of inactivity. This enumeration corresponds to the bit in the register. SRFS EBIU_SDGCTL VisualDSP++ 5.0 Device Drivers and System 4-41 Services Manual for Blackfin Processors...
  • Page 206: Adi_Ebiu_Sdram_Ebufe

    This enumeration corresponds to the bit in the SCLK PUPSD register. EBIU_SDGCTL No delay to the power-up start sequence. ADI_EBIU_SDRAM_PUPSD_NODELAY Power-up start sequence is delayed by 15 cycles. ADI_EBIU_SDRAM_PUPSD_15CYCLES SCLK 4-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 207: Adi_Ebiu_Sdram_Psm

    Fast back-to-back, read-write access disabled. ADI_EBIU_SDRAM_FBBRW_DISABLE SDRAM read and write operations occur on ADI_EBIU_SDRAM_FBBRW_ENABLE consecutive cycles. The default value is specified by the following macro: #define ADI_EBIU_SDRAM_FBBRW_DEFAULT ADI_EBIU_SDRAM_FBBRW_DISABLE VisualDSP++ 5.0 Device Drivers and System 4-43 Services Manual for Blackfin Processors...
  • Page 208: Adi_Ebiu_Sdram_Cddbg

    Command is for bank 0. ADI_EBIU_BANK_0 Command is for bank 1. ADI_EBIU_BANK_1 Command is for bank 2. ADI_EBIU_BANK_2 Command is for bank 3. ADI_EBIU_BANK_3 Command is for ALL four banks. ADI_EBIU_BANK_ALL 4-44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 209: Adi_Ebiu_Asynch_Bank_Enable

    It corresponds to bits in the asynchronous memory global control register, where BXPEN is the bank number. 16-bit packing in NOT enabled. ADI_EBIU_ASYNCH_BANK_DATA_PATH_32 16-bit packing is enabled. ADI_EBIU_ASYNCH_BANK_DATA_PATH_16 VisualDSP++ 5.0 Device Drivers and System 4-45 Services Manual for Blackfin Processors...
  • Page 210: Adi_Ebiu_Asynch_Bank_Ardy_Enable

    BXHT in the asynchronous memory bank control 0 register (for banks 0 and 1) or the asynchronous memory bank control 1 register (for banks 2 and 3). 4-46 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 211: Adi_Ebiu_Asynch_Setup_Time

    When cycles are used, the enumeration specifies the number of ADI_EBIU_ASYNCH_TRANSITION_TIME cycles of transition time. It corresponds to the bit (where is the BXHT VisualDSP++ 5.0 Device Drivers and System 4-47 Services Manual for Blackfin Processors...
  • Page 212 0 and 1) or the asynchronous memory bank control 1 register (for banks 2 and 3). 4 cycles transition time ADI_EBIU_ASYNCH_TT_4_CYCLES 1 cycles transition time ADI_EBIU_ASYNCH_TT_1_CYCLES 2 cycles transition time ADI_EBIU_ASYNCH_TT_2_CYCLES 3 cycles transition time ADI_EBIU_ASYNCH_TT_3_CYCLES 4-48 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 213: Deferred Callback Manager

    The need to execute a client callback function normally occurs while exe- cuting an interrupt service routine (ISR) at relatively high priority. The general rule for such ISRs is to keep the amount of time spent in them as VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 214 (RTOS). Implementations of the module exist for Express Logic’s ThreadX, Green Hills Software’ INTEGRITY, as well as Analog Devices VDK. The number of queues available and their length is determined by the cli- ent application upon module and queue initialization.
  • Page 215: Using The Deferred Callback Manager

    • Posting callbacks to the required queue • Dispatching callbacks according to the priority level deter- mined upon posting • Performing housekeeping functions • Closing the queue • Terminating the DCB manager VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 216 DCB manager. On the assumption that the sample application requires that only one interrupt handler be defined per IVG level, initialize the interrupt manager with the following code: u32 ne; adi_int_Init(NULL,0,&ne,NULL); VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 217 (void*) mjk_dcb_QueueData, // Address of memory to be used 5*ADI_DCB_ENTRY_SIZE, // for a queue 5 deep. &nqe; // on return this should be the // same as the required number of VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 218 For any reason, flushing the queue of entries for the above callback can be achieved in one of two ways: by calling the function adi_dcb_Remove directly or by calling it indirectly using the function. adi_dcb_Control VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 219 // Address of callback function to // flush Finally, if required, the queue can be closed and the DCB manager terminated: adi_dcb_Close( p_DCB_handle, // handle to required queue server adi_dcb_Terminate(); VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 220: Interoperability With An Rtos

    To implement these functions under an alternative RTOS (for example, Linux), developers must provide replacement definitions in equivalent files. These functions are described in this section in more detail. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 221 IVG level of the appropriate queue. This argument is ignored by IvgLevel VDK. structure used to pass information to the under- ADI_DCB_ENTRY_HDR lying RTOS is defined as: typedef struct ADI_DCB_ENTRY_HDR { struct ADI_DCB_ENTRY_HDR *pNext; ADI_DCB_DEFERRED_FNpDeferredFunction; } ADI_DCB_ENTRY_HDR; VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 222 The adi_dcb_DispatchCallbacks deferred procedure call server within the appropriate RTOS must pass the pointer to the function upon its deferred adi_dcb_DispatchCallbacks execution. 5-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 223: Adi_Dcb_Registerisr

    If critical regions are required within a callback function, you must be aware of any restrictions imposed by the underlying RTOS. For example, VDK-based applications are prohibited from calling functions from within the PushCriticalRegion/PopCriticalRegion interrupt level. VisualDSP++ 5.0 Device Drivers and System 5-11 Services Manual for Blackfin Processors...
  • Page 224: Dcb Manager Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values 5-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 225: Adi_Dcb_Close

    Handle provided does not represent a valid queue ADI_DCB_RESULT_NO_SUCH_QUEUE server. Callbacks are on the queue awaiting dispatch. If this ADI_DCB_RESULT_QUEUE_IN_USE does not matter, then flush the queue first before clos- ing. VisualDSP++ 5.0 Device Drivers and System 5-13 Services Manual for Blackfin Processors...
  • Page 226: Adi_Dcb_Control

    ADI_DCB_CMD_PAIR, (void*)&cmd • A table of structures is passed. The last ADI_DCB_COMMAND_PAIR entry in the table must be ADI_DCB_CMD_END ADI_DCB_COMMAND_PAIR table[2] = { {ADI_DCB_CMD_FLUSH_QUEUE, (void*)ClientCallback, {ADI_DCB_CMD_END, O} 5-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 227 ADI_DCB_CMD_TABLE, (void*)table Refer to “ADI_DCB_COMMAND” on page 5-26 for the complete list of commands and associated values. Prototype ADI_DMA_RESULT adi_dcb_Control( ADI_DCB_HANDLE hServer, ADI_DCB_COMMAND command, void *value VisualDSP++ 5.0 Device Drivers and System 5-15 Services Manual for Blackfin Processors...
  • Page 228 In debug mode, this routine returns one of the following result codes; oth- erwise, is always returned. ADI_DCB_RESULT_SUCCESS Handle of the required queue server is invalid. ADI_DCB_RESULT_NO_SUCH_QUEUE Either the command kind or the value specified is ADI_DCB_RESULT_BAD_COMMAND invalid. 5-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 229: Adi_Dcb_Init

    Handle to data area containing critical region data. This is hCriticalRegionData passed to where it is used adi_int_EnterCriticalRegion internally by the module. See “Interrupt Manager” for fur- ther details. VisualDSP++ 5.0 Device Drivers and System 5-17 Services Manual for Blackfin Processors...
  • Page 230 Successfully initialized the queue server. ADI_DCB_RESULT_SUCCESS Insufficient memory for one queue entry was encoun- ADI_DCB_RESULT_NO_MEMORY tered. DCB manager has already been initialized for this pro- ADI_DCB_RESULT_CALL_IGNORED cessor core. 5-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 231: Adi_Dcb_Open

    IVG level. The interrupt manager must be initialized prior to opening a queue server. Prototype ADI_DCB_RESULT adi_dcb_Open ( IvgLevel, void *QueueMemData, size_t szQueue, *NumEntries, ADI_DCB_HANDLE *hServer VisualDSP++ 5.0 Device Drivers and System 5-19 Services Manual for Blackfin Processors...
  • Page 232 Queue server was successfully initialized. ADI_DCB_RESULT_SUCCESS Insufficient memory for one queue entry was encoun- ADI_DCB_RESULT_NO_MEMORY tered. Queue server has already been opened for use by the ADI_DCB_RESULT_QUEUE_IN_USE specified IVG. 5-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 233: Adi_Dcb_Post

    To run all callbacks at the same priority level, assign the same priority to each callback posted. Prototype ADI_DCB_RESULT adi_dcb_Post( ADI_DCB_HANDLE *hServer, Priority; ADI_DCB_CALLBACK_FN Callback, void *pHandle, u32Arg, void *pArg VisualDSP++ 5.0 Device Drivers and System 5-21 Services Manual for Blackfin Processors...
  • Page 234 In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_DCB_RESULT_SUCCESS Entry was successfully queued. ADI_DCB_RESULT_SUCCESS No vacant queue entry available. ADI_DCB_RESULT_NO_MEMORY Handle provided does not represent a valid queue ADI_DCB_RESULT_NO_SUCH_QUEUE server. 5-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 235: Adi_Dcb_Remove

    ADI_DCB_RESULT_FLUSHED_OK Entries were successfully removed. ADI_DCB_RESULT_FLUSHED_OK Routine found no entries to be removed. ADI_DCB_RESULT_NONE_FLUSHED Handle provided does not represent a valid queue ADI_DCB_RESULT_NO_SUCH_QUEUE server. VisualDSP++ 5.0 Device Drivers and System 5-23 Services Manual for Blackfin Processors...
  • Page 236: Adi_Dcb_Terminate

    DCB manager by adi_dcb_Terminate() dissociating the supplied memory (see “adi_dcb_Init” on page 5-17) and critical region data. Prototype ADI_DCB_RESULT adi_dcb_Terminate ( void ); Return Value is always returned. ADI_DCB_RESULT_SUCCESS 5-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 237: Public Data Types And Macros

    5-26. For example, the following command could be sent to the DCB manager to flush all callbacks in the queue: ADI_DCB_COMMAND_PAIR CMD = { ADI_DCB_CMD_FLUSH_QUEUE, NULL }; VisualDSP++ 5.0 Device Drivers and System 5-25 Services Manual for Blackfin Processors...
  • Page 238: Adi_Dcb_Command

    ADI_DCB_DEFERRED_FN typedef function: typedef void (*ADI_DCB_DEFERRED_FN) (ADI_DCB_ENTRY *); 5-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 239: Adi_Dcb_Result

    5-26. Handle provided does not represent a valid queue ADI_DCB_RESULT_NO_SUCH_QUEUE server registered with the DCB manager. Either the command kind or the value specified is ADI_DCB_RESULT_BAD_COMMAND invalid. VisualDSP++ 5.0 Device Drivers and System 5-27 Services Manual for Blackfin Processors...
  • Page 240 Public Data Types and Macros 5-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 241: Dma Manager

    “Introduction” on page 6-2 • “Theory of Operation” on page 6-3 • “DMA Manager API Reference” on page 6-32 • “Public Data Structures, Enumerations, and Macros” on page 6-53 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 242: Introduction

    For example, if an interrupt is raised on each inner loop of a circular 2-D DMA transfer, an event can be passed to the callback function at the completion of each inner loop. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 243: Theory Of Operation

    • Be as portable as possible by providing a consistent interface across all processor families and variants. Additionally, the DMA manager uses an unambiguous naming convention to safeguard against con- flicts with other software libraries provided by Analog Devices or elsewhere. To this end, all enumeration values and...
  • Page 244: Dma Manager Initialization

    For example, if the client wants to initialize the DMA manager and has at most four DMA channels and one memory DMA stream open simulta- neously, the amount of required memory is: (ADI_DMA_BASE_MEMORY + (ADI_DMA_CHANNEL_MEMORY * 6)). VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 245: Dma Manager Termination

    DMA manager via the function can be reused by the client. adi_dma_Init() In many embedded systems, the DMA manager is never terminated. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 246: Memory Dma And Peripheral Dma

    DMA, or alternatively can control memory DMA as a single memory stream using the higher-level functions. adi_dma_MemoryXXXX() VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 247: Controlling Memory Streams

    NULL value. If a NULL value is supplied, the DMA manager makes live callbacks to the application. Live call- backs are made during hardware interrupt time. If a deferred VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 248: Memory Transfers

    • The source starting address from which data is copied • The width of each element (in bytes) to be copied. The DMA manager uses this value to schedule 8-, 16-, or 32-bit transfers. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 249: Two-Dimensional Transfers

    • The width of each element (in bytes) copied. The DMA manager uses this value to schedule 8-, 16-, or 32-bit transfers. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 250: Closing Memory Streams

    Controlling DMA on a channel-by-channel basis allows for the tightest control of DMA scheduling. Before a channel can be used, it must be opened first and then configured. 6-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 251: Opening Dma Channels

    (such as a DMA error). When the callback function is actually invoked, deferred or live, depends on the callback service handle value that is supplied. VisualDSP++ 5.0 Device Drivers and System 6-11 Services Manual for Blackfin Processors...
  • Page 252: Single Transfers

    The DMA manager include file provides macros, that allow the client to quickly and easily create a configuration word. The fol- lowing fields within the configuration word are the only fields for which values must be provided. 6-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 253 After the last element in each inner loop, the value is YModify applied instead, except on the very last element of the transfer. VisualDSP++ 5.0 Device Drivers and System 6-13 Services Manual for Blackfin Processors...
  • Page 254 Optionally, the client can direct the DMA manager to generate callbacks at the completion of each sub-buffer, to generate call- backs at the completion of the entire buffer, or not to generate callbacks. 6-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 255 Set this parameter to the number of elements in XCount a single sub-buffer. • The value. The width (in bytes) of an element. Allowed XModify values are 1, 2, and 4 only. VisualDSP++ 5.0 Device Drivers and System 6-15 Services Manual for Blackfin Processors...
  • Page 256 Using the large descriptor chaining mode, the client provides the DMA manager with one or more descriptor chains, as shown in Figure 6-2. 6-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 257 For the large descriptor chaining mode, descriptors are of the type , which is a data type that defines a large ADI_DMA_DESCRIPTOR_LARGE model descriptor. When calling the function, the client adi_dma_Queue() VisualDSP++ 5.0 Device Drivers and System 6-17 Services Manual for Blackfin Processors...
  • Page 258 (Transfer Element Size) Elements are 2 bytes wide (16 bits). ADI_DMA_WD_SIZE_16BIT Elements are 4 bytes wide (32 bits). ADI_DMA_WD_SIZE_32BIT One-dimensional (linear) transfer DMA2D ADI_DMA_DMA2D_LINEAR (Dimension Select) Two-dimensional transfer ADI_DMA_DMA2D_2D 6-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 259 If dataflow is enabled on an inbound channel prior to providing descriptors, it is possible for data to be received by the DMA channel but not have anywhere to store it. VisualDSP++ 5.0 Device Drivers and System 6-19 Services Manual for Blackfin Processors...
  • Page 260: Arrays Of Descriptors

    6-62. In most cases, the client passes the following parameters to the function: adi_dma_Control() • The channel handle. This is the value provided to the client during function. adi_dma_Open 6-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 261: Closing A Dma Channel

    In addition to polling and callbacks, the memory stream functions offer a synchronous capability. When used synchronously, the functions return to adi_dma_MemoryCopy() adi_dma_MemoryCopy2D() the client only when the transfer is complete. VisualDSP++ 5.0 Device Drivers and System 6-21 Services Manual for Blackfin Processors...
  • Page 262: Polling

    When using memory streams, if the client provided a callback function as a parameter to the adi_dma_MemoryCopy() adi_dma_MemoryCopy2D() functions, the callback function is invoked by the DMA manager when the transfer is complete. 6-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 263: Circular Transfer Callbacks

    When using any of the descriptor-based transfer methods , or ADI_DMA_MODE_DESCRIPTOR_LARGE ADI_DMA_MODE_DESCRIPTOR_SMALL ), the client uses the configuration word of the ADI_DMA_DESCRIPTOR_ARRAY descriptor to define whether a callback is generated following processing VisualDSP++ 5.0 Device Drivers and System 6-23 Services Manual for Blackfin Processors...
  • Page 264: Descriptor-Based Sub-Modes

    6-3. For example, with loopback sub-mode, the client can provide the descriptors at initialization time, allow the DMA manager to process the descriptors, and never need to resupply the DMA manager with additional descriptors. 6-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 265: Streaming Sub-Mode

    When not streaming, the DMA manager also pauses the DMA controller when a channel has exhausted its supply of descriptors. VisualDSP++ 5.0 Device Drivers and System 6-25 Services Manual for Blackfin Processors...
  • Page 266: Dma Channel To Peripheral Mapping

    DMA channels to peripherals. These functions can be called at any time after the DMA manager is initialized, but they must be processed before the channel is opened. 6-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 267: Sensing A Mapping

    The DMA manager uses the services of the interrupt manager to configure all DMA-related interrupts. All hooking of interrupts is isolated into the functions, and all unhooking adi_dma_Open() adi_dma_MemoryOpen() of interrupts occurs in the adi_dma_Close() adi_dma_MemoryClose() functions. VisualDSP++ 5.0 Device Drivers and System 6-27 Services Manual for Blackfin Processors...
  • Page 268: Hooking Interrupts

    IVG handler chain. In addition, if no other open channels are mapped to the same IVG as the channel being closed, the function unhooks the DMA data handler from the chain adi_dma_Close() of handlers for that IVG. 6-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 269: Two-Dimensional Dma

    (data) for processing. frame[6][6] After the data has been processed, the values are then copied back to the original location. Figure 6-4 illustrates the area of the frame to process. VisualDSP++ 5.0 Device Drivers and System 6-29 Services Manual for Blackfin Processors...
  • Page 270 For example, modify to receive a stream of R,G,B,R,G,B,… values from an N x M frame, consider Figure 6-5. 6-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 271: Dma Traffic Control

    It contains fields to specify which DMA controller the command is being issued for, which of the traffic control parameters to set ( ), and the value to set it to. VisualDSP++ 5.0 Device Drivers and System 6-31 Services Manual for Blackfin Processors...
  • Page 272: Dma Manager Api Reference

    Table 6-1. DMA Manager API Functions Function Description Primary Functions Provides a single or circular buffer. adi_dma_Buffer “adi_dma_Buffer” on page 6-34. Closes a DMA channel. adi_dma_Close “adi_dma_Close” on page 6-36. 6-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 273 “adi_dma_MemoryClose” on page 6-41. Copies memory in a linear, one-dimensional fashion. adi_dma_MemoryCopy “adi_dma_MemoryCopy” on page 6-42. Copies memory in a two-dimensional fashion. adi_dma_MemoryCopy2D “adi_dma_MemoryCopy2D” on page 6-44. VisualDSP++ 5.0 Device Drivers and System 6-33 Services Manual for Blackfin Processors...
  • Page 274: Adi_Dma_Buffer

    This function assigns a one-shot or a circular buffer to a DMA channel and configures the DMA channel according to the parameters supplied. Prototype ADI_DMA_RESULT adi_dma_Buffer( ADI_DMA_CHANNEL_HANDLE ChannelHandle, void *StartAddress, ADI_DMA_CONFIG_REG Config, XCount, XModify, YCount, YModify 6-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 275 ADI_DMA_RESULT_BAD_HANDLE ChannelHandle nel handle. DMA channel has not been opened for either ADI_DMA_RESULT_BAD_MODE single or circular buffer operation. DMA operation is in progress. ADI_DMA_RESULT_ALREADY_RUNNING VisualDSP++ 5.0 Device Drivers and System 6-35 Services Manual for Blackfin Processors...
  • Page 276: Adi_Dma_Close

    Return Value DMA channel successfully closed. ADI_DMA_RESULT_SUCCESS does not point to a ADI_DMA_RESULT_BAD_HANDLE ChannelHandle valid channel. Data handler and/or error handler can- ADI_DMA_RESULT_CANT_UNHOOK_INTERRUPT not be unhooked. 6-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 277: Adi_Dma_Control

    . For example, { ADI_DMA_CMD_END, 0 } ADI_DMA_CMD_VALUE_PAIR table = { {ADI_DMA_CMD_SET_LOOPBACK, (void*)LoopbackFlag}, {ADI_DMA_CMD_SET_DATAFLOW, (void*)TRUE}, { ADI_DMA_CMD_END, NULL }; adi_dma_Control(ChannelHandle,ADI_DMA_CMD_TABLE,&table); VisualDSP++ 5.0 Device Drivers and System 6-37 Services Manual for Blackfin Processors...
  • Page 278 Command is invalid. Either a bad command or a spe- ADI_DMA_RESULT_BAD_COMMAND cific command is not allowed in this context. Commands could not be performed as the channel is ADI_DMA_RESULT_ALREADY_RUNNING currently transferring data. 6-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 279: Adi_Dma_Getmapping

    Return Value Device is identified and DMA information is returned. ADI_DMA_RESULT_SUCCESS Bad peripheral value was encountered. ADI_DMA_RESULT_BAD_PERIPHERAL No mapping was found for the device. ADI_DMA_RESULT_NOT_MAPPED VisualDSP++ 5.0 Device Drivers and System 6-39 Services Manual for Blackfin Processors...
  • Page 280: Adi_Dma_Init

    Return Value This function returns if successful; any other ADI_DMA_RESULT_SUCCESS value indicates an error. Possible errors include: Insufficient memory is available to initialize the DMA ADI_DMA_RESULT_NOMEMORY manager. 6-40 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 281: Adi_Dma_Memoryclose

    Return Value The function returns if successful; any other ADI_DMA_RESULT_SUCCESS value indicates an error. Possible errors include: parameter does not point to a valid mem- ADI_DMA_RESULT_BAD_HANDLE StreamHandle ory stream. VisualDSP++ 5.0 Device Drivers and System 6-41 Services Manual for Blackfin Processors...
  • Page 282: Adi_Dma_Memorycopy

    Callback function called when the transfer completes. If NULL, the ClientCallback call to the function is considered syn- adi_dma_MemoryCopy() chronous and does not return to the client until the transfer has completed. 6-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 283 Possible errors include: parameter does not point to a valid mem- ADI_DMA_RESULT_BAD_HANDLE StreamHandle ory stream. Memory stream already has a transfer in progress. ADI_DMA_RESULT_IN_USE VisualDSP++ 5.0 Device Drivers and System 6-43 Services Manual for Blackfin Processors...
  • Page 284: Adi_Dma_Memorycopy2D

    Callback function called when the transfer completes. If NULL, ClientCallback the call to the function is considered syn- adi_dma_MemoryCopy() chronous and does not return to the client until the transfer has completed. 6-44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 285 Possible errors include: parameter does not point to a valid mem- ADI_DMA_RESULT_BAD_HANDLE StreamHandle ory stream. Memory stream already has a transfer in progress. ADI_DMA_RESULT_IN_USE VisualDSP++ 5.0 Device Drivers and System 6-45 Services Manual for Blackfin Processors...
  • Page 286: Adi_Dma_Memoryopen

    Handle to the deferred callback service used for any mem- DCBServiceHandle ory stream events. A value of NULL means that deferred callbacks are not used and all callbacks occur at DMA inter- rupt time. 6-46 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 287 ADI_DMA_RESULT_SUCCESS value indicates an error. Possible errors include: All channel memory is in use. ADI_DMA_RESULT_ALL_IN_USE System cannot hook a DMA data or error inter- ADI_DMA_RESULT_CANT_HOOK_INTERRUPT rupt. VisualDSP++ 5.0 Device Drivers and System 6-47 Services Manual for Blackfin Processors...
  • Page 288: Adi_Dma_Open

    Prototype ADI_DMA_RESULT adi_dma_Open( ADI_DMA_CHANNEL_ID ChannelID ADI_DMA_MANAGER_HANDLE ManagerHandle void *ClientHandle, ADI_DMA_CHANNEL_HANDLE *pChannelHandle, ADI_DMA_MODE Mode, ADI_DCB_HANDLE DCBServiceHandle, ADI_DCB_CALLBACK_FN ClientCallback 6-48 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 289 Possible errors include: All channel memory is in use. ADI_DMA_RESULT_ALL_IN_USE System cannot hook a DMA data or error ADI_DMA_RESULT_CANT_HOOK_INTERRUPT interrupt. VisualDSP++ 5.0 Device Drivers and System 6-49 Services Manual for Blackfin Processors...
  • Page 290: Adi_Dma_Queue

    ADI_DMA_RESULT_BAD_HANDLE ChannelHandle dle. Descriptor handle is NULL. ADI_DMA_RESULT_BAD_DESCRIPTOR Cannot submit additional descriptors to a channel ADI_DMA_RESULT_ALREADY_RUNNING configured for a loopback with dataflow enabled. 6-50 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 291: Adi_Dma_Setmapping

    Channel ID that is mapped to the peripheral. ChannelID Return Value Channel was successfully mapped. ADI_DMA_RESULT_SUCCESS Bad peripheral value was encountered. ADI_DMA_RESULT_BAD_PERIPHERAL Mapping could not be performed as the channel is ADI_DMA_RESULT_ALREADY_RUNNING currently transferring data. VisualDSP++ 5.0 Device Drivers and System 6-51 Services Manual for Blackfin Processors...
  • Page 292: Adi_Dma_Terminate

    This function closes down all DMA activity and terminates the DMA manager. Prototype ADI_DMA_RESULT adi_dma_Terminate( ADI_DMA_MANAGER_HANDLE ManagerHandle, Arguments Handle to the DMA manager ManagerHandle Return Value The function returns if successful; any other ADI_DMA_RESULT_SUCCESS value indicates an error. 6-52 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 293: Public Data Structures, Enumerations, And Macros

    • “Data Types” • “Data Structures” on page 6-55 • “General Enumerations” on page 6-58 • “ADI_DMA_CONFIG_REG Field Values” on page 6-61 • “DMA Commands” on page 6-62 VisualDSP++ 5.0 Device Drivers and System 6-53 Services Manual for Blackfin Processors...
  • Page 294: Data Types

    By using the handle/union, a single func- adi_dma_Queue() tion is needed, instead of separate functions for each of the descriptor data types. typedef union ADI_DMA_DESCRIPTOR_UNION { ADI_DMA_DESCRIPTOR_SMALL Small; ADI_DMA_DESCRIPTOR_LARGE Large; 6-54 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 295: Adi_Dma_Stream_Handle

    ADI_DMA_2D_TRANSFER source or destination component of a two-dimensional memory copy. typedef struct ADI_DMA_2D_TRANSFER { void *StartAddress; XCount; XModify; YCount; YModify; } ADI_DMA_2D_TRANSFER; VisualDSP++ 5.0 Device Drivers and System 6-55 Services Manual for Blackfin Processors...
  • Page 296: Adi_Dma_Config_Reg

    } ADI_DMA_DESCRIPTOR_ARRAY; ADI_DMA_DESCRIPTOR_LARGE structure defines the contents of a large ADI_DMA_DESCRIPTOR_LARGE descriptor. typedef struct ADI_DMA_DESCRIPTOR_LARGE { struct ADI_DMA_DESCRIPTOR_LARGE *pNext; void *StartAddress; ADI_DMA_CONFIG_REG Config; XCount; XModify; YCount; YModify; } ADI_DMA_DESCRIPTOR_LARGE; 6-56 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 297: Adi_Dma_Descriptor_Small

    DMA controller to set, where multiple con- ControllerID trollers are available, the first controller starting at 0. The field Value specifies the value to write. typedef struct ADI_DMA_TC_SET ADI_DMA_TC_PARAMETER ParameterID; ControllerID; Value; } ADI_DMA_TC_SET; VisualDSP++ 5.0 Device Drivers and System 6-57 Services Manual for Blackfin Processors...
  • Page 298: Adi_Dma_Tc_Get

    ADI_DMA_EVENT reported to the client’s callback function. Associated with the parameter is another parameter that points to the ADI_DMA_EVENT companion argument, , for the event. pArg 6-58 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 299: Adi_Dma_Mode

    It takes the following values: Undefined ADI_DMA_DATA_MODE_UNDEFINED Single one-shot buffer ADI_DMA_DATA_MODE_SINGLE Single circular buffer ADI_DMA_DATA_MODE_CIRCULAR Array of descriptors ADI_DMA_DATA_MODE_DESCRIPTOR_ARRAY Chain of small descriptors ADI_DMA_DATA_MODE_DESCRIPTOR_SMALL Chain of large descriptors ADI_DMA_DATA_MODE_DESCRIPTOR_LARGE VisualDSP++ 5.0 Device Drivers and System 6-59 Services Manual for Blackfin Processors...
  • Page 300: Adi_Dma_Pmap

    This value is used in the adi_dma_MemoryOpen() function to identify which stream to open. The specific enumeration val- ues are dependent on the specific processor being targeted. 6-60 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 301: Adi_Dma_Tc_Parameter

    2-D DMA operation ADI_DMA_2D ADI_DMA_DI_EN Disables callbacks on completion. ADI_DMA_DI_EN_DISABLE Enables callbacks on completion. ADI_DMA_DI_EN_ENABLE ADI_DMA_DI_SEL Callback after completing whole buffer (default) ADI_DMA_DI_SEL_OUTER_LOOP Callback after completing each inner loop ADI_DMA_DI_SEL_INNER_LOOP VisualDSP++ 5.0 Device Drivers and System 6-61 Services Manual for Blackfin Processors...
  • Page 302: Adi_Dma_En

    Command ID Value Description Pointer to a table of ADI_DMA_CMD_TABLE ADI_DMA_CMD_VALUE_PAIR * commands Pointer to a single ADI_DMA_CMD_PAIR ADI_DMA_CMD_VALUE_PAIR * command pair NULL Signifies end of table. ADI_DMA_CMD_END 6-62 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 303 TRUE - in progress, FALSE - not in progress. Sets a traffic control ADI_DMA_CMD_SET_TC ADI_DMA_TC_SET * (period) parameter. Senses a traffic con- ADI_DMA_CMD_GET_TC ADI_DMA_TC_GET * trol (count) parame- ter. VisualDSP++ 5.0 Device Drivers and System 6-63 Services Manual for Blackfin Processors...
  • Page 304 Public Data Structures, Enumerations, and Macros 6-64 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 305: Programmable Flag Service

    This chapter contains the following sections: • “Introduction” on page 7-2 • “Operation” on page 7-3 • “Flag Service API Reference” on page 7-15 • “Public Data Types, Enumerations, and Macros” on page 7-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 306: Introduction

    The latter can be managed via the port con- trol service within the system services library. (Note that device drivers for ADSP-BF534/536/537 processors automatically make the appropriate calls into the port control service without any user intervention.) VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 307: Operation

    VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 308: Termination

    , defines flag IDs for each flag supported by the adi_flag.h processor. Flag IDs are of the form , where x uniquely identi- ADI_FLAG_x fies the specific flag. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 309: Flag Control Functions

    7-21. adi_flag_Set When configured as an output, the function sets the adi_flag_Set() value of the flag to a logical 1, driving high. Refer also to “adi_flag_Set” on page 7-23. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 310: Adi_Flag_Clear

    Deferred callbacks mean that callbacks are not made at interrupt time but rather deferred to a lower-priority using a specified deferred callback service. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 311: Adi_Flag_Installcallback

    • Level high – callback generated when the level is high • Level low – callback generated when the level is low • Rising edge – callback generated on the rising edge VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 312: Adi_Flag_Removecallback

    Unless reinstalled, no further callbacks occur for the specified flag. After calling this function, the memory freed by removing the callback is available for the flag service VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 313: Adi_Flag_Suspendcallbacks

    The example illustrates how the output flag is controlled and then illustrates how a call- back function is used to sense changes on a flag. All flag service functions VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 314: Initialization

    // return value u32 ResponseCount; // number of callbacks supported Result = adi_flag_Init(FlagServiceData, sizeof(FlagServiceData), &ResponseCount, NULL); Upon completing this function, the flag service is initialized and is ready for use. 7-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 315: Opening A Flag

    Result = adi_flag_Set(ADI_FLAG_PF0); // sets output value to logical high (1) Result = adi_flag_Clear(ADI_FLAG_PF0); // sets output value to logical low (0) Result = adi_flag_Toggle(ADI_FLAG_PF0); // toggles from current value VisualDSP++ 5.0 Device Drivers and System 7-11 Services Manual for Blackfin Processors...
  • Page 316: Sensing The Value Of A Flag

    The following fragment illustrates how to install a callback function and the actual call- back function. Result = adi_flag_InstallCallback(ADI_FLAG_PF1, ADI_INT_PFA, ADI_FLAG_TRIGGER_LEVEL_HIGH, TRUE, (void *)0x12345678, NULL, Callback); 7-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 317: Suspending And Resuming Callbacks

    Now the callback function will again be invoked when the trigger condi- tion occurs. Removing Callbacks If an application no longer needs the callback, it removes the callback with the following call. Result = adi_flag_RemoveCallback(ADI_FLAG_PF1); VisualDSP++ 5.0 Device Drivers and System 7-13 Services Manual for Blackfin Processors...
  • Page 318: Termination

    ADI_FLAG_RESULT Result; // return value Result = adi_flag_Terminate(); After termination, any memory provided to the flag service during instal- lation is freed up for reuse by the application. 7-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 319: Flag Service Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 7-15 Services Manual for Blackfin Processors...
  • Page 320: Adi_Flag_Clear

    Enumerator value that uniquely identifies the flag to FlagID close Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 321: Adi_Flag_Close

    Enumerator value that uniquely identifies the flag to FlagID close Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-17 Services Manual for Blackfin Processors...
  • Page 322: Adi_Flag_Init

    Handle to data area containing critical region data. This is *pEnterCriticalParam passed to where it is used adi_int_EnterCriticalRegion internally of the module. See “Interrupt Manager” on page 2-1 for further details. 7-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 323 Programmable Flag Service Return Value Flag service was successfully initialized. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-19 Services Manual for Blackfin Processors...
  • Page 324: Adi_Flag_Open

    Enumerator value that uniquely identifies the flag to FlagID open Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 325: Adi_Flag_Setdirection

    Direction to which the flag is configured Direction Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-21 Services Manual for Blackfin Processors...
  • Page 326: Adi_Flag_Terminate

    Prototype ADI_FLAG_RESULT adi_flag_Terminate( void Arguments None. Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 327: Adi_Flag_Set

    Enumerator value that uniquely identifies the flag FlagID to control Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-23 Services Manual for Blackfin Processors...
  • Page 328: Adi_Flag_Toggle

    Enumerator value that uniquely identifies the flag FlagID to control Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 329: Adi_Flag_Sense

    Pointer to location where the value of the flag is pValue stored Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-25 Services Manual for Blackfin Processors...
  • Page 330: Adi_Flag_Installcallback

    This function does not alter the flag values, direction, and so on. Prototype ADI_FLAG_RESULT adi_flag_InstallCallback( ADI_FLAG_ID FlagID, ADI_INT_PERIPHERAL_ID PeripheralID, ADI_FLAG_TRIGGER Trigger, WakeupFlag, void *ClientHandle, ADI_DCB_HANDLE DCBHandle, ADI_DCB_CALLBACK_FN ClientCallback 7-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 331 Address of the client’s callback function ClientCallback Return Value Flag service was successfully initialized. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-27 Services Manual for Blackfin Processors...
  • Page 332: Adi_Flag_Removecallback

    Enumerator value that uniquely identifies the flag FlagID whose callback is removed Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 333: Adi_Flag_Suspendcallbacks

    (see interrupt manager and adi_int.h.) Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-29 Services Manual for Blackfin Processors...
  • Page 334: Adi_Flag_Suspendcallbacks

    (see interrupt manager and adi_int.h.) Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. 7-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 335: Adi_Flag_Settrigger

    Trigger condition that generates the callback Trigger Return Value Function completed successfully. ADI_FLAG_RESULT_SUCCESS Any other value Error has occurred. “ADI_FLAG_RESULT” on page 7-33 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 7-31 Services Manual for Blackfin Processors...
  • Page 336: Public Data Types, Enumerations, And Macros

    , where “ ” is the ADI_FLAG_Pxy port ID and “ ” is the index into the port for the flag. Refer to adi_flag.h for further details. 7-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 337: Associated Macros

    (0x80002) error returned from inter- ADI_FLAG_RESULT_INTERRUPT_MANAGER_ERROR rupt manager (0x80003) no callback installed for ADI_FLAG_RESULT_ERROR_REMOVING_CALLBACK given ID (0x80004) all flag slots in use ADI_FLAG_RESULT_ALL_IN_USE (0x80005) error within port control ADI_FLAG_RESULT_PORT_CONTROL_ERROR VisualDSP++ 5.0 Device Drivers and System 7-33 Services Manual for Blackfin Processors...
  • Page 338: Adi_Flag_Event

    Event codes for the flag service begin with the value , for easy identification. ADI_FLAG_ENUMERATION_START Event code Description The trigger condition for the specified flag ADI_FLAG_EVENT_CALLBACK occurred. 7-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 339: Adi_Flag_Trigger

    ADI_FLAG_TRIGGER_BOTH_EDGE ADI_FLAG_DIRECTION enumeration defines the direction (input or ADI_FLAG_DIRECTION output) for a flag pin. Flag is configured as an input. ADI_FLAG_DIRECTION_INPUT Flag is configured as an output. ADI_FLAG_DIRECTION_OUTPUT VisualDSP++ 5.0 Device Drivers and System 7-35 Services Manual for Blackfin Processors...
  • Page 340 Public Data Types, Enumerations, and Macros 7-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 341: Timer Service

    This chapter contains the following sections: • “Introduction” on page 8-2 • “Operation” on page 8-3 • “Timer Service API Reference” on page 8-15 • “Public Data Types, Enumerations, and Macros” on page 8-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 342: Introduction

    No user intervention is required. The timer service uses an unambiguous naming convention to safeguard against conflicts with other software libraries provided by Analog Devices or elsewhere. All enumeration values and statements use the...
  • Page 343: Operation

    Parameter checking in the debug versions of the system services library provides a more complete test of API function parameters and for condi- tions that may cause errors. Analog Devices strongly recommends that development work be done using the debug versions of the system service library, while final test and deployment be done with the release version of the library.
  • Page 344: Timer Ids

    Future Black- fin processors may require this function to manipulate the hardware in some way when closing a timer. Refer also to “adi_tmr_Close” on page 8-19. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 345: Adi_Tmr_Reset

    The function uses best efforts to simultaneously enable or disable the group of timers. If the underlying hardware of the specific Blackfin device allows the timers to be controlled simultaneously, the function takes the VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 346: Core Timer Functions

    Analogous to the general-purpose timer and core timer control functions, this function is passed a command ID specifying the parameter of the function being addressed, and a command-specific parameter. Refer also “adi_tmr_WatchdogControl” on page 8-22. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 347: Peripheral Timer Functions

    When a client installs a timer callback, a parameter to the function dictates if the callback is live or deferred. Live callbacks mean that the client’s callback function is called at VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 348: Adi_Tmr_Installcallback

    – a value provided by the client when the callback is ClientHandle installed • – indicates a timer callback event ADI_TMR_EVENT_TIMER_EXPIRED • – the timer ID of the timer that generates the callback TimerID VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 349: Adi_Tmr_Removecallback

    In practice, check this error code to ensure the function completed successfully. For the purposes of this example only, the return value is not checked. VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 350: Opening A Timer

    After the timer is opened, the timer can be configured. The adi_tmr_GPControl() adi_tmr_CoreControl() functions are used to configure adi_tmr_WatchdogControl() general-purpose timers, core timers, and the watchdog timers, respectively. 8-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 351 Result = adi_tmr_GPControl(ADI_TMR_GP_TIMER_1, ADI_TMR_GP_CMD_SET_PERIOD, (void *)0x800000); Result = adi_tmr_GPControl(ADI_TMR_GP_TIMER_1, ADI_TMR_GP_CMD_SET_WIDTH, (void *)0x400000); Result = adi_tmr_GPControl(ADI_TMR_GP_TIMER_1, ADI_TMR_GP_CMD_SET_TIMER_MODE, (void *)0x1); Result = adi_tmr_WatchdogControl (ADI_TMR_WDOG_CMD_EVENT_SELECT, (void *)0x0); Result = adi_tmr_WatchdogControl (ADI_TMR_WDOG_CMD_SET_COUNT, (void *)0x12345678); VisualDSP++ 5.0 Device Drivers and System 8-11 Services Manual for Blackfin Processors...
  • Page 352: Enabling And Disabling Timers

    As with the enabling of general-purpose timers, timers can be disabled simultaneously. The following code fragment illustrates how to disable the watchdog timer and simultaneously disable gen- eral-purpose timers 0 and 1. 8-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 353: Installing A Callback Function

    (ADI_TMR_WDOG_TIMER, TRUE, (void *)0x33333333, NULL, Callback); void Callback(void *ClientHandle, u32 Event, void *pArg) { // Event = ADI_TMR_EVENT_TIMER_EXPIRED switch ((u32)pArg) { case ADI_TMR_GP_TIMER_0: // do processing when gp timer 0 expires VisualDSP++ 5.0 Device Drivers and System 8-13 Services Manual for Blackfin Processors...
  • Page 354: Removing Callbacks

    The following frag- ment illustrates how to remove the callbacks. Result = adi_tmr_RemoveCallback(ADI_TMR_GP_TIMER_0); Result = adi_tmr_RemoveCallback(ADI_TMR_GP_TIMER_1); Result = adi_tmr_RemoveCallback(ADI_TMR_CORE_TIMER); Result = adi_tmr_RemoveCallback(ADI_TMR_WDOG_TIMER); 8-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 355: Timer Service Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 8-15 Services Manual for Blackfin Processors...
  • Page 356: Adi_Tmr_Init

    2-1 for further details. Return Value Timer service was successfully initialized. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. 8-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 357: Adi_Tmr_Open

    Enumerator value that uniquely identifies the timer to TimerID open Return Value Operation was successful. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-17 Services Manual for Blackfin Processors...
  • Page 358: Adi_Tmr_Terminate

    ADI_TMR_RESULT adi_tmr_Terminate ( void Arguments None Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. 8-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 359: Adi_Tmr_Close

    Enumerator value that uniquely identifies the timer to TimerID close Return Value Operation was successful. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-19 Services Manual for Blackfin Processors...
  • Page 360: Adi_Tmr_Reset

    Enumerator value that uniquely identifies the timer FlagID to reset Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. 8-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 361: Adi_Tmr_Corecontrol

    Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-21 Services Manual for Blackfin Processors...
  • Page 362: Adi_Tmr_Watchdogcontrol

    Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. 8-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 363: Adi_Tmr_Gpcontrol

    Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-23 Services Manual for Blackfin Processors...
  • Page 364: Adi_Tmr_Gpgroupenable

    TMRx ADSP-BF531/532/533 and ADSP-BF561 processors, no port control logic is necessary. No further user action with the port control service is required. Prototype void adi_tmr_GPGroupEnable ( TimerID, EnableFlag 8-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 365 FALSE Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-25 Services Manual for Blackfin Processors...
  • Page 366: Adi_Tmr_Installcallback

    This function does not alter timer configurations, values, or other settings in any way. Prototype void adi_tmr_InstallCallback ( TimerID, WakeupFlag, void *ClientHandle, ADI_DCB_HANDLE DCBHandle, ADI_DCB_CALLBACK_FN ClientCallback 8-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 367 Address of the client’s callback function ClientCallback Return Value Flag service was successfully initialized. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-27 Services Manual for Blackfin Processors...
  • Page 368: Adi_Tmr_Removecallback

    Enumerator value that uniquely identifies the timer TimerID whose callback is removed Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. 8-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 369: Adi_Tmr_Getperipheralid

    Pointer to location where the peripheral ID for the pPeripheralID specified timer is stored Return Value Function completed successfully. ADI_TMR_RESULT_SUCCESS Any other value Error has occurred. “ADI_TMR_RESULT” on page 8-32 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 8-29 Services Manual for Blackfin Processors...
  • Page 370: Public Data Types, Enumerations, And Macros

    IDs can be created by the macro, where “ ” is in the range ADI_TMR_CREATE_GP_TIMER_ID(x) of 0 to (but not including) the value ADI_TMR_GP_TIMER_COUNT 8-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 371: Associated Macros

    Gets the timer index given a timer ID. ADI_TMR_GET_TIMER_INDEX Gets the mask for a general-purpose timer(s) given ADI_TMR_GET_GP_TIMER_MASK a single timer ID or logical ORing of multiple timer IDs. VisualDSP++ 5.0 Device Drivers and System 8-31 Services Manual for Blackfin Processors...
  • Page 372: Adi_Tmr_Result

    Operation is not appropriate to the ADI_TMR_RESULT_BAD_TIMER_TYPE timer ID supplied. Invalid command. ADI_TMR_RESULT_BAD_COMMAND Interrupt manager service returned ADI_FLAG_RESULT_INTERRUPT_MANAGER_ERROR an error. Callback is already installed on the ADI_TMR_RESULT_CALLBACK_ALREADY_INSTALLED given timer. 8-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 373: Adi_Tmr_Event

    End of command ADI_TMR_CORE_CMD_END table Command pair ADI_TMR_CORE_CMD_PAIR ADI_TMR_CORE_CMD_ VALUE_PAIR * – active mode Sets active or low ADI_TMR_CORE_CMD_SET_ACTIVE_MODE TRUE – low power power mode of FALSE timer. VisualDSP++ 5.0 Device Drivers and System 8-33 Services Manual for Blackfin Processors...
  • Page 374: Adi_Tmr_Wdog_Cmd

    The Value void * meaning of the parameter depends on the command ID being Value passed. Table 8-2 also describes the parameter for each command Value 8-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 375: Adi_Tmr_Gp_Cmd

    These command IDs are passed as a parameter to the function. In addition to the command ID, the adi_tmr_GPCommand() VisualDSP++ 5.0 Device Drivers and System 8-35 Services Manual for Blackfin Processors...
  • Page 376 TRUE pulse the timer. – negative FALSE action pulse – count to end Sets the count method. ADI_TMR_GP_CMD_SET_COUNT_METHOD TRUE of period – count to end FALSE of width 8-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 377 – width register error Stores the interrupt ADI_TMR_GP_CMD_IS_INTERRUPT_ASSERTED u32 * – asserted assertion status in the TRUE – not asserted specified location. FALSE Ignored Clears the timer’s ADI_TMR_GP_CMD_CLEAR_INTERRUPT interrupt. VisualDSP++ 5.0 Device Drivers and System 8-37 Services Manual for Blackfin Processors...
  • Page 378 PWM mode. – enabled Enables or disables the ADI_TMR_GP_CMD_ENABLE_TIMER TRUE – disabled timer. FALSE Number of SCLK ADI_TMR_GP_CMD_SET_ENABLE_DELAY cycles to delay between the enabling of each timer 8-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 379 “Introduction” on page 9-2 • “Using the Port Control Manager” on page 9-3 • “Port Control Manager API Reference” on page 9-5 • “Public Data Types, Enumerations, and Macros” on page 9-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 380: Introduction

    ADSP-BF534, ADSP-BF536, and ADSP-BF537 Blackfin processors. The port control manager uses an unambiguous naming convention to safeguard against conflicts with other software libraries provided by Analog Devices or elsewhere. All enumeration values and state- typedef ments use the...
  • Page 381: Using The Port Control Manager

    // Do not invert PPI_FS1 & PPI_FS2 // set PPI_COUNT to 1 to sample 2 16-bit words. u16 ppi_count = 1; u16 ppi_frame = 1; ADI_DEV_CMD_VALUE_PAIR PPI_config[] = { { ADI_PPI_CMD_SET_CONTROL_REG, (void*)(*(u16*)&ppi_control) { ADI_PPI_CMD_SET_TRANSFER_COUNT_REG, (void*)(*(u16*)&ppi_count) VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 382 // Enable // Enable Data Flow adi_dev_Control(ppiHandle, ADI_DEV_CMD_SET_DATAFLOW, 1); Finally, when the port control manager is no longer required, the service is terminated with a call to a di_ports_Terminate3 adi_ports_Terminate(); VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 383: Port Control Manager Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 384: Adi_Ports_Init

    See “Interrupt Manager” on page 2-1 for further details. Return Value Port control manager was successfully initialized. ADI_PORTS_RESULT_SUCCESS VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 385: Adi_Ports_Terminate

    Port Control Service adi_ports_Terminate Description function terminates the port control manager. adi_ports_Terminate Prototype ADI_PORTS_RESULT adi_ports_Terminate ( void Arguments None Return Value Function completed successfully. ADI_PORTS_RESULT_SUCCESS VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 386: Adi_Ports_Enableppi

    In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_PORTS_RESULT_SUCCESS Function completed successfully. ADI_PORTS_RESULT_SUCCESS Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 387: Adi_Ports_Enablespi

    In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_PORTS_RESULT_SUCCESS Function completed successfully. ADI_PORTS_RESULT_SUCCESS Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 388: Adi_Ports_Enablesport

    In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_PORTS_RESULT_SUCCESS Function completed successfully. ADI_PORTS_RESULT_SUCCESS Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE 9-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 389: Adi_Ports_Enableuart

    In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_PORTS_RESULT_SUCCESS Function completed successfully. ADI_PORTS_RESULT_SUCCESS Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE VisualDSP++ 5.0 Device Drivers and System 9-11 Services Manual for Blackfin Processors...
  • Page 390: Adi_Ports_Enablecan

    In debug mode, this routine returns one of the following result codes. Otherwise, is always returned. ADI_PORTS_RESULT_SUCCESS Function completed successfully. ADI_PORTS_RESULT_SUCCESS Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE 9-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 391: Adi_Ports_Enabletimer

    Alternatively, the TACLKx flag pins can provide the clock signal to the general-purpose timers in PWM_OUT mode. For details, see “Timer Service” on page 8-1. Timers must be configured for WDTH_CAP mode. For details, see “Timer Service” on page 8-1. VisualDSP++ 5.0 Device Drivers and System 9-13 Services Manual for Blackfin Processors...
  • Page 392 Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE One of the required pins has already been ADI_PORTS_RESULT_PIN_ALREADY_IN_USE assigned a different functionality. 9-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 393: Adi_Ports_Enablegpio

    Address of the array is NULL. ADI_PORTS_RESULT_NULL_ARRAY Directives Invalid directive value has been passed. ADI_PORTS_RESULT_BAD_DIRECTIVE One of the required pins has already been ADI_PORTS_RESULT_PIN_ALREADY_IN_USE assigned a different functionality. VisualDSP++ 5.0 Device Drivers and System 9-15 Services Manual for Blackfin Processors...
  • Page 394: Adi_Ports_Result

    Description Function executed correctly. ADI_PORTS_RESULT_SUCCESS Function execution not completed. ADI_PORTS_RESULT_FAILED 0x90001 Invalid directive value has been ADI_PORTS_RESULT_BAD_ DIRECTIVE passed. 0x90002 Address of the array is ADI_PORTS_RESULT_NULL_ARRAY Directives NULL. 9-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 395: Directive Enumeration Values

    ADI_PORTS_DIR_SPORT1_BASE_RX Enables flag pins for basic SPORT transmit operation. ADI_PORTS_DIR_SPORT1_BASE_TX Enables flag pin for SPORT secondary data receive. ADI_PORTS_DIR_SPORT1_RXSE Enables flag pin for SPORT secondary data transmit. ADI_PORTS_DIR_SPORT1_TXSE VisualDSP++ 5.0 Device Drivers and System 9-17 Services Manual for Blackfin Processors...
  • Page 396 Enables PF1 pin for GPIO use. ADI_PORTS_DIR_GPIO_PF1 Enables PF2 pin for GPIO use. ADI_PORTS_DIR_GPIO_PF2 Enables PF3 pin for GPIO use. ADI_PORTS_DIR_GPIO_PF3 Enables PF4 pin for GPIO use. ADI_PORTS_DIR_GPIO_PF4 9-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 397 Enables PG9 pin for GPIO use. ADI_PORTS_DIR_GPIO_PG9 Enables PG10 pin for GPIO use. ADI_PORTS_DIR_GPIO_PG10 Enables PG11 pin for GPIO use. ADI_PORTS_DIR_GPIO_PG11 Enables PG12 pin for GPIO use. ADI_PORTS_DIR_GPIO_PG12 VisualDSP++ 5.0 Device Drivers and System 9-19 Services Manual for Blackfin Processors...
  • Page 398 Enables PH12 pin for GPIO use. ADI_PORTS_DIR_GPIO_PH12 Enables PH13 pin for GPIO use. ADI_PORTS_DIR_GPIO_PH13 Enables PH14 pin for GPIO use. ADI_PORTS_DIR_GPIO_PH14 Enables PH15 pin for GPIO use. ADI_PORTS_DIR_GPIO_PH15 9-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 399 10 DEVICE DRIVER MANAGER This chapter describes the Analog Devices device driver model. Use the device driver model to control devices, both internal and external, to Ana- log Devices processors. This includes on-board peripherals, such as SPORTs and parallel peripheral interface (PPI), and off-chip connected devices such as codecs and converters.
  • Page 400 The objective of this model is to provide a simple, efficient framework that works for the majority of applications. 10-2 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 401: Device Driver Model Overview

    RTOS. Some real-time operating systems require that applications go through the RTOS in order to access device drivers. In these systems, the RTOS is simply viewed as a client to the device manager. VisualDSP++ 5.0 Device Drivers and System 10-3 Services Manual for Blackfin Processors...
  • Page 402 API in the proper sequence, performs synchro- nization services as needed, and controls all peripheral DMA (via the system services DMA manager) for devices that are supported by peripheral DMA. 10-4 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 403 The device driver model and system services can be built and run under any of the known code generation toolchains. VisualDSP++ 5.0 Device Drivers and System 10-5 Services Manual for Blackfin Processors...
  • Page 404: Using The Device Manager

    In addition to the API functions into the device manager, the application provides the device manager with a callback function. Often, the device manager or physical driver encounters an event that needs to be passed to 10-6 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 405: Data

    The device manager API defines the ADI_DEV_ data type as a pointer to a union of a one-dimensional buffer, a BUFFER two-dimensional buffer, and a circular buffer. Though each of these types VisualDSP++ 5.0 Device Drivers and System 10-7 Services Manual for Blackfin Processors...
  • Page 406: Initializing The Device Manager

    Macros ) are provided to ADI_DEV_BASE_MEMORY ADI_DEV_DEVICE_MEMORY define the amount of memory (in bytes) required for the base memory and incremental device driver memory, respectively. 10-8 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 407: Device Manager Termination

    The device manager closes any open physical devices and then returns to the caller. After the return from the adi_dev_Terminate() VisualDSP++ 5.0 Device Drivers and System 10-9 Services Manual for Blackfin Processors...
  • Page 408: Opening A Device

    NULL, DCBHandle all callbacks are live; meaning they are not deferred and are executed immediately (typically at interrupt time). The parameter ClientCallback points to the client’s callback function. 10-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 409: Configuring A Device

    ID to set the volume level of the output. The application developer should check the physical driver docu- mentation to determine which parameters are configurable and the configuration choices. VisualDSP++ 5.0 Device Drivers and System 10-11 Services Manual for Blackfin Processors...
  • Page 410: Dataflow Method

    SUB-BUFFER 0 SUB-BUFFER 1 CONTIGUOUS BUFFER . . . SUB-BUFFER N CALLBACK ON SUB-BUFFER COMPLETE CALLBACK ON ENTIRE BUFFER COMPLETE Figure 10-2. Circular Buffer Operation 10-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 411 The device manager guarantees to pro- cess the buffers in the order they are provided to the device manager. START . . . BUFFER N BUFFER 0 BUFFER 1 Figure 10-3. Chained Buffers VisualDSP++ 5.0 Device Drivers and System 10-13 Services Manual for Blackfin Processors...
  • Page 412 START . . . BUFFER 1 BUFFER N BUFFER 0 Figure 10-4. Chained Buffers With Loopback 10-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 413: Enabling Dataflow

    900900 bytes in size ( ). The sub-buffer count in this case is 525. 525 * 1716 Regardless of how many sub-buffers are provided, with the circular VisualDSP++ 5.0 Device Drivers and System 10-15 Services Manual for Blackfin Processors...
  • Page 414: Closing A Device

    Events include expected events (such as completion of buffer processing) or unexpected events (such as an error occurring on a device). Typically, the client’s callback function 10-16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 415: Initialization Sequence

    In this stackable fashion, it is possible to create more complex drivers such as the AD1836 driver or a TCP/IP stack driver that sit on top of an Ethernet controller. VisualDSP++ 5.0 Device Drivers and System 10-17 Services Manual for Blackfin Processors...
  • Page 416: Deciding On A Dataflow Method

    Circular When using streaming audio or video, the streaming sub-mode is highly recommended to avoid clicks and pops with audio data and glitches on video data. 10-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 417: Sequential With And Without Loopback

    • – This field indicates the number of elements ElementCount pointed to by the data pointer. VisualDSP++ 5.0 Device Drivers and System 10-19 Services Manual for Blackfin Processors...
  • Page 418 For information describing whether this field is used by the particular device driver, refer to the documentation specific to the device driver, located in the …/Blackfin/doc subdirectory. 10-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 419 // storage for data static ADI_DEV_1D_BUFFER Buffer; // the actual buffer // create buffer for the driver to process Buffer.Data = Data; Buffer.ElementCount = SAMPLES_PER_BUFFER; Buffer.ElementWidth = 2; VisualDSP++ 5.0 Device Drivers and System 10-21 Services Manual for Blackfin Processors...
  • Page 420 Buffer[i].CallbackParameter = &Buffer[i]; // gen call- back, pArg = buffer address Buffer[i].pNext = &Buffer[i+1]; // point to the next in chain Buffer[NUM_BUFFERS - 1].pNext = NULL; // terminate the chain of buffers 10-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 421: Creating Two-Dimensional Buffers

    – If this field is NULL, the device driver does CallbackParameter not call back the application after the buffer is processed by the device driver. If non-NULL, the device driver invokes the VisualDSP++ 5.0 Device Drivers and System 10-23 Services Manual for Blackfin Processors...
  • Page 422 75 bytes of data, the driver may set this value to 75. This would indicate that although 100 bytes was requested, only 75 bytes were available. For information describing 10-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 423 = &Frames[i][0]; Buffer[i].ElementWidth = 2; Buffer[i].XCount = (COLUMNS >> 1); Buffer[i].XModify = 2; Buffer[i].YCount = ROWS; Buffer[i].YModify = 2; Buffer[i].CallbackParameter = &Buffer[i]; // gen callback, pArg = buffer address VisualDSP++ 5.0 Device Drivers and System 10-25 Services Manual for Blackfin Processors...
  • Page 424: Creating Circular Buffers

    – This field specifies the number of sub-buffers SubBufferCount into which the data is divided. • – This field specifies the number of ele- SubBufferElementCount ments in each sub-buffer. 10-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 425 // storage for data static ADI_DEV_CIRCULAR_BUFFER Buffer; // the actual buffer // create buffer for the driver to process Buffer.Data = Data; Buffer.ElementWidth = 1; Buffer.SubBufferCount = SUB_BUFFERS; Buffer.SubBufferElementCount = SUB_BUFFER_ELEMENTS; VisualDSP++ 5.0 Device Drivers and System 10-27 Services Manual for Blackfin Processors...
  • Page 426: Creating Sequential One-Dimensional Buffers

    • – Populate the field with this ADI_DEV_DIRECTION_OUTBOUND value if the buffer is for data that is transmitted out through the device. 10-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 427 SeqBuffer[0].Buffer.CallbackParameter = NULL; // no callback SeqBuffer[0].Buffer.pNext = (ADI_DEV_1D_BUFFER *)&SeqBuffer[1]; SeqBuffer[0].Direction = ADI_DEV_DIRECTION_OUTBOUND; // create inbound buffer for the driver to process SeqBuffer[1].Buffer.Data = InboundData; SeqBuffer[1].Buffer.ElementCount = INBOUND_ELEMENTS; VisualDSP++ 5.0 Device Drivers and System 10-29 Services Manual for Blackfin Processors...
  • Page 428: Device Manager Design

    API are key to understanding the design of the device manager. The device manager API is described in the file, which is adi_dev.h located in the directory. Blackfin/Include/Drivers 10-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 429: Memory Usage Macros

    Next in the file are enumerations for the various dataflow adi_dev.h methods supported by the device manager and enumerations indicating dataflow direction. These enumerations are not extensible by physical drivers. VisualDSP++ 5.0 Device Drivers and System 10-31 Services Manual for Blackfin Processors...
  • Page 430: Command Ids

    The device manager defines some typical return codes. Similar to command IDs and callback events, physical drivers can add their own return codes beginning with the enumeration start value for the driver. 10-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 431: Circular Buffer Callback Options

    The adi_ API functions use the data dev_Read adi_dev_Write ADI_DEV_BUFFER type when passing buffers to these functions. VisualDSP++ 5.0 Device Drivers and System 10-33 Services Manual for Blackfin Processors...
  • Page 432: Physical Driver Entry Point

    Settings ADI_DEV_DEVICE opened. This provides a quick and efficient means to initialize an ADI_ structure without having to populate each item individually. DEV_DEVICE 10-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 433: Static Function Declarations

    The critical region pointers are then stored, and the data structure for each device that can be supported is marked as available for use. The function then returns to the caller. VisualDSP++ 5.0 Device Drivers and System 10-35 Services Manual for Blackfin Processors...
  • Page 434: Adi_Dev_Open Functional Description

    Once dataflow is terminated, any DMA channels that were opened for the device are closed. The function of the adi_pdd_Close 10-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 435: Adi_Dev_Read Functional Description

    Lastly, a check is made to see if the device is operating in synchronous or asynchronous mode. If it is operating in asynchronous mode, the adi_ function returns to the application immediately. If it is dev_Read VisualDSP++ 5.0 Device Drivers and System 10-37 Services Manual for Blackfin Processors...
  • Page 436: Adi_Dev_Write Functional Description

    10-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 437 DMA channels are necessary in support of the device. The physical driver is interrogated via the function as to which DMA controller and adi_pdd_Control VisualDSP++ 5.0 Device Drivers and System 10-39 Services Manual for Blackfin Processors...
  • Page 438 • The device always has buffers to process and never runs out of buffers. This means the application guarantees devices that are opened for inbound or bidirectional dataflow 10-40 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 439: Static Functions

    As such, if the deferred callback service is in use, the invocation of the function in the device manager is deferred by the physical PDDCallback driver. In this way, the function can directly call the client’s PDDCallback callback function. VisualDSP++ 5.0 Device Drivers and System 10-41 Services Manual for Blackfin Processors...
  • Page 440: Dmacallback

    DMACallback the DMA manager. In this way, the function can directly call dmaCallback the client’s callback function. 10-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 441: Preparebufferlist

    VisualDSP++ 5.0 Device Drivers and System 10-43 Services Manual for Blackfin Processors...
  • Page 442: Setdataflow

    DMA. Once the physical driver has disabled dataflow, any and all DMA channels that were opened for the device are closed. This is affected by calls to the DMA manager. 10-44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 443: Physical Driver Design

    Each physical driver in the system is controlled independently from the other physical drivers in the system. Although multiple physical drivers may exist simultaneously in a system, multiple physical drivers should never control the same device. VisualDSP++ 5.0 Device Drivers and System 10-45 Services Manual for Blackfin Processors...
  • Page 444 If directed to use deferred callbacks, physical drivers use the services of the deferred callback manager exclusively in order to post callbacks into the device manager. See “Deferred Callback Manager” on page 5-1 for more information. 10-46 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 445: Physical Device Driver Api Description

    – Provides buffers for reception of data from a device adi_pdd_Read • – Provides buffers containing data for transmission adi_pdd_Write out the device • – Configures the device adi_pdd_Control VisualDSP++ 5.0 Device Drivers and System 10-47 Services Manual for Blackfin Processors...
  • Page 446: Extensible Definitions

    PPI physical driver should include include files. The include file and adi_dev.h adi_ppi.h adi_dev.h physical driver include files for all Analog Devices-provided drivers are found in the directory. Blackfin/Include/Drivers Extensible Definitions The physical driver can define its own extensions to the command IDs,...
  • Page 447 The physical driver could return an error code that provides a high level of detail as to what caused the error. VisualDSP++ 5.0 Device Drivers and System 10-49 Services Manual for Blackfin Processors...
  • Page 448: Adi_Dev_Pdd_Entry_Point

    The entry point is a simple structure that contains the addresses of the physical driver API functions in the fol- lowing order. ADI_DEV_PDD_ENTRY_POINT PPIEntryPoint = { adi_pdd_Open, adi_pdd_Close, adi_pdd_Read, adi_pdd_Write, adi_pdd_Control 10-50 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 449: Adi_Pdd_Open Functional Description

    Device Driver Manager Source code for all Analog Devices-supplied physical drivers is located in directory. Blackfin/Lib/Src/Drivers All code within the driver source is in support of the five physical driver API functions. These functions and the logic that they need to provide are described in sections that follow.
  • Page 450: Adi_Pdd_Control Functional Description

    • – Turns on and turns off the flow of ADI_DEV_CMD_SET_DATAFLOW data through the device 10-52 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 451: Adi_Pdd_Read Functional Description

    This greatly simplifies device drivers for devices that are sup- ported by processor DMA. Physical drivers that are supported by VisualDSP++ 5.0 Device Drivers and System 10-53 Services Manual for Blackfin Processors...
  • Page 452 10-54 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 453: Adi_Pdd_Write Functional Description

    If a buffer is not flagged for a call- back, the physical driver does not notify the device manager when the buffer is processed. However, if the buffer is flagged for a callback, once VisualDSP++ 5.0 Device Drivers and System 10-55 Services Manual for Blackfin Processors...
  • Page 454: Adi_Pdd_Close Functional Description

    All resources that were allocated in support of the device are released. For example, if an error interrupt was hooked during the adi_ function, it is released as part of the function. pdd_Open adi_pdd_Close 10-56 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 455: Device Manager Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 10-57 Services Manual for Blackfin Processors...
  • Page 456: Adi_Dev_Close

    Return Value Device closed successfully. ADI_DEV_RESULT_SUCCESS Device handle does not identify a valid device. ADI_DEV_RESULT_BAD_DEVICE_HANDLE Error occurred while closing down DMA for ADI_DEV_RESULT_DMA_ERROR the device. Device-specific return code 10-58 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 457: Adi_Dev_Control

    Function completed successfully. ADI_DEV_RESULT_SUCCESS Device handle does not identify a valid device. ADI_DEV_RESULT_BAD_DEVICE_HANDLE Error was reported while configuring the DMA ADI_DEV_RESULT_DMA_ERROR manager. Command is not supported. ADI_DEV_RESULT_NOT_SUPPORTED Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-59 Services Manual for Blackfin Processors...
  • Page 458: Adi_Dev_Init

    Parameter that is passed to the function that protects critical *pEnterCriticalParam areas of code Return Value Device manager was successfully initialized. ADI_DEV_RESULT_SUCCESS Insufficient memory has been supplied to device manager. ADI_DEV_RESULT_NO_MEMORY 10-60 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 459: Adi_Dev_Open

    For example, if there are four serial ports, they are numbered 0 through 3. Identifier defined by the application. The device manager passes this *ClientHandle value back to the client as an argument in the callback function. VisualDSP++ 5.0 Device Drivers and System 10-61 Services Manual for Blackfin Processors...
  • Page 460 Device manager handle does not point to a ADI_DEV_RESULT_BAD_MANAGER_HANDLE device manager. Insufficient memory is available to open the ADI_DEV_RESULT_NO_MEMORY device. Device is already in use. ADI_DEV_RESULT_DEVICE_IN_USE Device-specific return code 10-62 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 461: Adi_Dev_Read

    Device handle does not identify a valid device. ADI_DEV_RESULT_BAD_DEVICE_HANDLE Error was reported while configuring the DMA ADI_DEV_RESULT_DMA_ERROR manager. Dataflow method has not yet been set. ADI_DEV_RESULT_DATAFLOW_UNDEFINED Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-63 Services Manual for Blackfin Processors...
  • Page 462: Adi_Dev_Terminate

    Prototype u32 adi_dev_Terminate( ADI_DEV_MANAGER_HANDLE ManagerHandle Arguments Handle to the device manager ManagerHandle Return Value This function returns if successful; any other ADI_DEV_RESULT_SUCCESS value indicates an error. 10-64 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 463: Adi_Dev_Write

    Device handle does not identify a valid device. ADI_DEV_RESULT_BAD_DEVICE_HANDLE Error was reported while configuring the ADI_DEV_RESULT_DMA_ERROR DMA manager. Dataflow method has not yet been set. ADI_DEV_RESULT_DATAFLOW_UNDEFINED Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-65 Services Manual for Blackfin Processors...
  • Page 464: Device Manager Public Data Types And Enumerations

    Buffer to chain with the existing switch buffer ADI_DEV_UPDATE_SWITCH Skip this buffer and DMA channel (for multi-DMA devices) ADI_DEV_BUFFER_SKIP Table of buffers ADI_DEV_BUFFER_TABLE End of buffer array ADI_DEV_BUFFER_END a 10-66 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 465: Adi_Dev_Mode

    ADI_DEV_DIRECTION The following table describes the values for ADI_DEV_DIRECTION enumeration. Table 10-3. ADI_DEV_DIRECTION Name Description Undefined direction ADI_DEV_DIRECTION_UNDEFINED Inbound direction (read) ADI_DEV_DIRECTION_INBOUND VisualDSP++ 5.0 Device Drivers and System 10-67 Services Manual for Blackfin Processors...
  • Page 466: Callback Events

    0x40000000 - starting point ADI_DEV_EVENT_START 0x0001 - buffer completed processing ADI_DEV_EVENT_BUFFER_PROCESSED 0x0002 - a circular sub-buffer has been processed ADI_DEV_EVENT_SUB_BUFFER_PROCESSED 0x0003 - DMA controller generated an error inter- ADI_DEV_EVENT_DMA_ERROR_INTERRUPT rupt 10-68 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 467: Result Codes

    ADI_DEV_RESULT_NO_MEMORY No longer used ADI_DEV_RESULT_NOT_USED_1 Bad device number ADI_DEV_RESULT_BAD_DEVICE_NUMBER Data direction not supported ADI_DEV_RESULT_DIRECTION_NOT_SUPPORTED Bad device handle ADI_DEV_RESULT_BAD_DEVICE_HANDLE Bad device manager handle ADI_DEV_RESULT_BAD_MANAGER_HANDLE Bad physical driver handle ADI_DEV_RESULT_BAD_PDD_HANDLE VisualDSP++ 5.0 Device Drivers and System 10-69 Services Manual for Blackfin Processors...
  • Page 468 Open function Requires unidirectional device ADI_DEV_RESULT_REQUIRES_UNIDIRECTIONAL_DEVICE Requires bidirectional device ADI_DEV_RESULT_REQUIRES_BIDIRECTIONAL_DEVICE TWI locked in other operation ADI_DEV_RESULT_TWI_LOCKED Requires configuration table for the ADI_DEV_RESULT_REQUIRES_TWI_CONFIG_TABLE TWI driver Command not supported ADI_DEV_RESULT_CMD_NOT_SUPPORTED 10-70 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 469 Bad IVG number detected ADI_DEV_RESULT_BAD_IVG Invalid buffer pair provided with ADI_DEV_RESULT_SWITCH_BUFFER_PAIR_INVALID switch/update switch buffer type No DMA channel available to process ADI_DEV_RESULT_DMA_CHANNEL_UNAVAILABLE command/buffer Buffer table nesting is not allowed ADI_DEV_RESULT_ATTEMPTED_BUFFER_TABLE_NESTING VisualDSP++ 5.0 Device Drivers and System 10-71 Services Manual for Blackfin Processors...
  • Page 470: Command Ids

    Enable/disable dataflow ADI_DEV_CMD_SET_DATAFLOW TRUE FALSE Set dataflow method ADI_DEV_CMD_SET_ TRUE FALSE DATAFLOW_METHOD No longer used ADI_DEV_CMD_NOT_USED_1 Set device to synchronous I/O ADI_DEV_CMD_SET_ TRUE FALSE SYNCHRONOUS No longer used ADI_DEV_CMD_NOT_USED_2 10-72 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 471 DMA OUTBOUND_DMA_CHANNEL_ID Query whether device ADI_DEV_CMD_GET_2D_ u32* supports 2D transfers SUPPORT Enable/disable error reporting ADI_DEV_CMD_SET_ERROR_ TRUE FALSE REPORTING Notification of impending ADI_DEV_CMD_FREQUENCY_ ADI_DEV_FREQUENCIES* core/system frequency change CHANGE_PROLOG VisualDSP++ 5.0 Device Drivers and System 10-73 Services Manual for Blackfin Processors...
  • Page 472 BLOCK_WRITE BLOCK* Update the data pointer in a ADI_DEV_CMD_UPDATE_1D_ ADI_DEV_1D_BUFFER* single 1D buffer DATA_POINTER Update the data pointer in a ADI_DEV_CMD_UPDATE_2D_ ADI_DEV_2D_BUFFER* single 2D buffer DATA_POINTER 10-74 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 473: Adi_Dev_1D_Buffer

    Data void* Data element count ElementCount Data element width (in bytes) ElementWidth Callback value CallbackParameter void* flag pArg Processed flag ProcessedFlag volatile u32 Number of bytes processed ProcessedElementCount VisualDSP++ 5.0 Device Drivers and System 10-75 Services Manual for Blackfin Processors...
  • Page 474: Adi_Dev_2D_Buffer

    XModify XMODIFY value for 2D YCount YCOUNT value for 2D YModify YMODIFY Callback value CallbackParameter void* flag pArg Processed flag ProcessedFlag volatile u32 Number of bytes processed ProcessedElementCount 10-76 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 475: Adi_Dev_Circular_Buffer

    SubBufferCount Number of data elements in SubBufferElementCount one sub-buffer Data element width (in bytes) ElementWidth Circular buffer callback switch CallbackType ADI_DEV_CIRCULAR_CALLBACK Device-specific pointer to pAdditionalInfo void* additional information VisualDSP++ 5.0 Device Drivers and System 10-77 Services Manual for Blackfin Processors...
  • Page 476: Adi_Dev_Seq_1D_Buffer

    ADI_DEV_BUFFER_PAIR dimensional buffer. The following table describes the elements of this data structure. Table 10-11. ADI_DEV_BUFFER_PAIR Name Type Description Buffer Buffer ADI_DEV_1D_BUFFER Direction Direction ADI_DEV_DIRECTION 10-78 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 477: Adi_Dev_Dma_Info

    Table 10-13. ADI_DEV_DMA_ACCESS Name Type Description Number of DMA channels to access and selected device DmaChannelCount Start location of an array for the DMA-related data pData void* VisualDSP++ 5.0 Device Drivers and System 10-79 Services Manual for Blackfin Processors...
  • Page 478: Adi_Dev_Frequencies

    The following table describes the elements of this data structure. Table 10-15. ADI_DEV_ACCESS_REGISTER Name Type Description Device register address Address Data to be written to, or read from the register Data 10-80 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 479: Adi_Dev_Access_Register_Block

    Address of register to be accessed Address Register field to be accessed (see off-chip driver header file) Field Data to be written to, or read from the register field Data VisualDSP++ 5.0 Device Drivers and System 10-81 Services Manual for Blackfin Processors...
  • Page 480: Adi_Dev_Buffer

    Table 10-18. ADI_DEV_BUFFER Name Type Description One-dimensional buffer OneD ADI_DEV_1D_BUFFER Two-dimensional buffer TwoD ADI_DEV_2D_BUFFER Circular buffer Circular ADI_DEV_CIRCULAR_BUFFER One-dimensional sequential buffer Seq1D ADI_DEV_SEQ_1D_BUFFER Buffer pair BufferPair ADI_DEV_BUFFER_PAIR 10-82 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 481: Physical Driver Api Reference

    Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 10-83 Services Manual for Blackfin Processors...
  • Page 482: Adi_Pdd_Close

    Prototype u32 adi_pdd_Close( ADI_PDD_DEVICE_HANDLE PDDHandle Arguments Handle used to identify the device PDDHandle Return Value Device closed successfully. ADI_DEV_RESULT_SUCCESS Device-specific code 10-84 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 483: Adi_Pdd_Control

    Handle used to identify the device PDDHandle Command identifier Command Address of command-specific parameter pArg Return Value Function completed successfully. ADI_DEV_RESULT_SUCCESS Command is not supported. ADI_DEV_RESULT_NOT_SUPPORTED Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-85 Services Manual for Blackfin Processors...
  • Page 484: Adi_Pdd_Open

    Pointer to a location where the physical driver stores a *pPDDHandle handle that uniquely identifies the device to the physical driver 10-86 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 485 Address of the device manager’s callback function DMCallback Return Value Device opened successfully. ADI_DEV_RESULT_SUCCESS Device manager handle does not point to a device man- ADI_DEV_RESULT_DEVICE_IN_USE ager. Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-87 Services Manual for Blackfin Processors...
  • Page 486: Adi_Pdd_Read

    Address of the buffer or first buffer in a chain of buffers *pBuffer Return Value Function completed successfully. ADI_DEV_RESULT_SUCCESS PDD handle does not identify a valid device. ADI_DEV_RESULT_BAD_PDD_HANDLE Device-specific return code 10-88 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 487: Adi_Pdd_Write

    Address of the buffer or first buffer in a chain of buffers *pBuffer Return Value Function completed successfully. ADI_DEV_RESULT_SUCCESS PDD handle does not identify a valid device. ADI_DEV_RESULT_BAD_PDD_HANDLE Device-specific return code VisualDSP++ 5.0 Device Drivers and System 10-89 Services Manual for Blackfin Processors...
  • Page 488: Examples

    Devices device drivers are provided with the device driver and system services distribution media. For examples of applications using the device drivers, see the Black- directory. Source code for all Analog Devices-provided fin/EZ-Kits device drivers is located in the directory.
  • Page 489: Introduction

    There is an alarm VisualDSP++ 5.0 Device Drivers and System 11-1 Services Manual for Blackfin Processors...
  • Page 490: Operation

    The debug version of the system services library provides parameter check- ing for a more complete test of the API function parameters and other error conditions. Analog Devices strongly recommends that development work be done using the debug versions of the system services library, and that final test and deployment be done with the release version of the library.
  • Page 491: Termination

    When the application no longer requires the real-time clock service, it calls the termination function, . This function adi_rtc_Terminate() removes any callbacks that were installed, cleaning up all statically-defined data structures. VisualDSP++ 5.0 Device Drivers and System 11-3 Services Manual for Blackfin Processors...
  • Page 492: Setting And Reading The Date And Time

    To use this func- RTC_STAT tion, the application declares a structure of type , which is a C-standard time structure defined in the system include file, . The application time.h 11-4 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 493: Real-Time Clock Events

    . This event stays enabled and periodic interrupts ADI_RTC_EVENT_SECONDS continue to occur every second, until the application disables the event, by passing the argument to the ADI_RTC_EVENT_SECONDS function. adi_rtc_RemoveCallback() VisualDSP++ 5.0 Device Drivers and System 11-5 Services Manual for Blackfin Processors...
  • Page 494: One Minute Periodic Event

    . This event stays enabled and periodic interrupts ADI_RTC_EVENT_DAYS continue to occur each day until the application disables the event by pass- ing the argument to the ADI_RTC_EVENT_DAYS adi_rtc_RemoveCallback() function. 11-6 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 495: Periodic Or One-Shot Stopwatch Event

    This interrupting event becomes enabled when the application passes the argument to the func- ADI_RTC_EVENT_EACH_DAY_ALM adi_rtc_InstallCallback() tion, also passing a structure containing the time of day that the alarm VisualDSP++ 5.0 Device Drivers and System 11-7 Services Manual for Blackfin Processors...
  • Page 496: Pending Writes Complete Event

    The application provides the callback function, which controls how each event is processed, and also an optional data structure, comprised of event-specific information, that is passed to the 11-8 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 497: The Callback List

    ClientHandle function, containing information to be stored adi_rtc_InstallCallback in the callback list and passed to the callback when it occurs. VisualDSP++ 5.0 Device Drivers and System 11-9 Services Manual for Blackfin Processors...
  • Page 498: Removing A Callback

    This user-defined adi_rtc_InstallCallback structure contains event-specific information to be stored in the callback list entry. When the event occurs, the interrupt manager executes the 11-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 499: Coding Example

    ClientHandle information that it must pass to the callback. Coding Example example is installed with VisualDSP++ 5.0. This PeriodicStopwatch example demonstrates the use of the functions adi_rtc_InstallCallback for setting up a stopwatch event and servic- adi_rtc_RemoveCallback ing it within a callback.
  • Page 500 Below is a code example from within the callback function where the stop- watch event is processed. static void RTCCallback ( void *ClientHandle, u32 Event, void *pArg ) STOPWATCH_INFO CountdownStruct = 11-12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 501 If the counter wrapped to zero, we would not stop */ && (CountdownStruct.NumRepetitions != 0 ) ) ) adi_rtc_RemoveCallback( ADI_RTC_EVENT_STOPWATCH ); StopwatchCompleteFlag = 1; SWEventCounter = 0; else VisualDSP++ 5.0 Device Drivers and System 11-13 Services Manual for Blackfin Processors...
  • Page 502 /* zero this flag */ StopwatchCompleteFlag = 0; /* initialize the static stopwatch event counter */ SWEventCounter = 0; /* When re-enabled, the stopwatch will be set for 5 seconds*/ 11-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 503 /* wait for the stopwatch event to occur. After 5 seconds it will repeat three times. */ while( StopwatchCompleteFlag == 0 ); /* arrive here after 20 seconds */ VisualDSP++ 5.0 Device Drivers and System 11-15 Services Manual for Blackfin Processors...
  • Page 504: Rtc Service Application Programming Interface (Api)

    RTC service application program interface (API). Notation and Naming Conventions To safeguard against conflicts with other software libraries provided by Analog Devices (or other sources), the real-time clock service uses an unambiguous naming convention in which enumeration values and type- statements use the .
  • Page 505: Rtc Service Api Functions

    The result codes are defined in Table 11-4 on page 11-30. This table describes the structures and data types in the API. VisualDSP++ 5.0 Device Drivers and System 11-17 Services Manual for Blackfin Processors...
  • Page 506: Adi_Rtc_Init()

    Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. 11-18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 507: Adi_Rtc_Terminate()

    The function takes no arguments. Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 11-19 Services Manual for Blackfin Processors...
  • Page 508: Adi_Rtc_Setdatetime()

    Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. 11-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 509: Adi_ Rtc_Getdatetime

    The function takes one argument, a pointer to a structure. Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 11-21 Services Manual for Blackfin Processors...
  • Page 510: Adi_Rtc_Installcallback()

    RTC service uses this info to install alarm call- void* Value backs or stopwatch callbacks. It specifies num- ber of seconds or date/time. For other callbacks, it is not used. 11-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 511 Real-Time Clock Service Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 11-23 Services Manual for Blackfin Processors...
  • Page 512: Adi_Rtc_Removecallback()

    Event ID Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. 11-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 513: Adi_Rtc_Enablewakeup()

    TRUE Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 11-25 Services Manual for Blackfin Processors...
  • Page 514: Adi_Rtc_Disablewakeup()

    FALSE Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. 11-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 515: Adi_Rtc_Resetstopwatch()

    Return Value No error has been encountered. ADI_RTC_RESULT_SUCCESS Any other value Error has occurred. Table 11-4 on page 11-30 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 11-27 Services Manual for Blackfin Processors...
  • Page 516: Real-Time Clock Service Api Data Types And Enumerations

    It also describes the asynchronous event types and the result codes that can be returned from an RTC function. tm structure A C-standard time structure is provided in the VisualDSP++ 5.0 system include file, . This structure contains fields for the second, minute, time.h...
  • Page 517: Event Ids

    C Run-Time Library ctime reference section of the VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Processors. Event IDs There are eight possible asynchronous events that are defined by the...
  • Page 518: Result Codes

    (0xA0008) no RTC service for this processor ADI_RTC_RESULT_SERVICE_NOT_SUPPORTED (0xA0009) service was already initialized ADI_RTC_RESULT_ALREADY_INITIALIZED (0xA000A) cannot install same callback twice ADI_RTC_RESULT_CALLBACK_ALREADY_INSTALLED (0xA000B) cannot install both alarm callbacks ADI_RTC_RESULT_CALLBACK_CONFLICT simultaneously 11-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 519: Interdependencies

    (DCB) manager that the event has occurred. Please refer to Chapter 5, Deferred Callback Manager for details on how the DCB manager processes callbacks. VisualDSP++ 5.0 Device Drivers and System 11-31 Services Manual for Blackfin Processors...
  • Page 520 Interdependencies 11-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 521: System Service Requirements

    “The Standard C I/O Interface Functions” on page 12-57 • “Additional POSIX Functions Supported by the FSS” on page 12-71 • “Extensibility” on page 12-83 • “Examples” on page 12-83 VisualDSP++ 5.0 Device Drivers and System 12-1 Services Manual for Blackfin Processors...
  • Page 522 (“File System Service API Reference” on page 12-18), or if registered, using the extensible standard C I/O interface provided with the I/O library of VisualDSP++ 5.0. Once registered with the I/O library, calls to , and so on are fopen()
  • Page 523 The file system service is designed to function in both standalone and RTOS environments. To this end, several examples are available with VisualDSP++ 5.0 to demonstrate the configuration and use of the FSS. One particular example, the shell browser example, is a multi-threaded,...
  • Page 524 /* Register the FAT File System driver */ { ADI_FSS_CMD_ADD_DRIVER, (void*)&ADI_FAT_Def }, /* Assign the DMA Manager Handle */ { ADI_FSS_CMD_SET_DMA_MGR_HANDLE, (void*)adi_dma_ManagerHandle }, /* Assign the Device Manager Handle */ { ADI_FSS_CMD_SET_DEV_MGR_HANDLE, (void*)adi_dev_ManagerHandle }, 12-4 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 525 The following is the quickest way to get up and running with the above command-value pair table: /* FAT12/16/32 FSD driver */ #define _ADI_FAT_DEFAULT_DEF_ #include <drivers/fsd/fat/adi_fat.h> /* ATAPI interface */ #define _ADI_ATAPI_DEFAULT_DEF_ #include <drivers/pid/atapi/adi_atapi.h> VisualDSP++ 5.0 Device Drivers and System 12-5 Services Manual for Blackfin Processors...
  • Page 526 The file system service is now ready for use through its direct API. How- ever, for greater portability of applications and libraries, the FSS is best used indirectly through the standard C I/O interface. VisualDSP++ 5.0 provides the ability to extend the file I/O support beyond the host PC access (PRIMIO) that is the default.
  • Page 527 File System Service The definition of the structure can be found in Chapter 3 of the DevEntry VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Proces- sors. The declaration of can be found in the file adi_fss_entry in the folder of the adi_fss_deventry.c...
  • Page 528: Interrupt Manager Service

    API function for all peripherals in your application. adi_int_SICSetIVG() For example, to set the ATAPI priorities you would do the following: adi_int_SICSetIVG(ADI_INT_DMA10_ATAPI_RX, 10); adi_int_SICSetIVG(ADI_INT_DMA11_ATAPI_TX, 11); 12-8 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 529: Deferred Callback Service

    HardDiskAccess example. The size of the queue depends on your requirements but a good starting point is to use four entries in the queue: #define SIZE_DCB_QUEUE ((ADI_DCB_ENTRY_SIZE)*4) VisualDSP++ 5.0 Device Drivers and System 12-9 Services Manual for Blackfin Processors...
  • Page 530: Dma Service

    The value given to the must be incremented ADI_SSL_SEM_NUM_SEMAPHORES by the number of semaphores required for the required FSS configuration. 12-10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 531: Real-Time Clock Service

    PID and FSD instances appropriate for the required FSS configuration. For more details, see the appropriate device driver docu- mentation in the folders, Blackfin\Docs\drivers\fsd Blackfin\Docs\drivers\pid VisualDSP++ 5.0 Device Drivers and System 12-11 Services Manual for Blackfin Processors...
  • Page 532: Advanced Configuration

    ADI_DEV_CMD_VALUE_PAIR the system services’ device driver model. Valid commands for the driver configuration table are presented in the individual driver documents, found in the VisualDSP++ 5.0 installation in the appropriate sub-folder under Blackfin\Docs\drivers\fsd . An example would be to assign a heap index...
  • Page 533 PID with the file system service; these items are reassigned within the FSS. If they have no direct relevance to the application itself, they can be assigned NULL and 1 respectively. VisualDSP++ 5.0 Device Drivers and System 12-13 Services Manual for Blackfin Processors...
  • Page 534: Dynamic Memory Usage

    The use of dynamic memory within all parts of the FSS framework frees the application devel- oper from having to estimate the amount of memory required at build time. 12-14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 535 DMA transfer buffers. Management of these categories of memory is implemented by the use of custom (or user) heaps, available VisualDSP++ 5.0 Device Drivers and System 12-15 Services Manual for Blackfin Processors...
  • Page 536 Advanced Configuration with VisualDSP++ 5.0. Each component of the FSS framework allocates general memory off the single general heap defined in the FSS. For cache memory requirements, each component can be assigned a separate cache heap to use. Two commands are defined to assign the indexes of general and cache heaps.
  • Page 537: File Cache

    The cluster size depends on the size and format (for example, FAT12, FAT16 or FAT32) of the media. The FSS requests the block size from the appropriate FSD upon opening a VisualDSP++ 5.0 Device Drivers and System 12-17 Services Manual for Blackfin Processors...
  • Page 538: File System Service Api Reference

    Notation and Naming Conventions To safeguard against conflicts with other software libraries provided by Analog Devices, or other sources, the file system service uses an unambig- uous naming convention in which enumeration values and typedef statements use the prefix.
  • Page 539 Name – Name and purpose of the function Description – Function specification Prototype – Required header file and functional prototype Arguments – Description of function arguments Return Value – Description of function return values VisualDSP++ 5.0 Device Drivers and System 12-19 Services Manual for Blackfin Processors...
  • Page 540: Adi_Fss_Init

    (0xB0013) Number of cache sub-blocks to ADI_FSS_CMD_SET_NUMBER_CACHE_SUB_BLOCKS use (min 1). It is highly recommended not to alter this value. (0xB0006) Sets client function ADI_FSS_CMD_SET_MALLOC_FUNC malloc (0xB0007) Sets client function ADI_FSS_CMD_SET_REALLOC_FUNC realloc 12-20 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 541 ADI_FSS_DEVICE_DEF ture. Prior to using this command, the appropriate device driver must be opened and configured. Prototype ADI_FSS_RESULT adi_fss_Init ( ADI_FSS_CMD_VALUE_PAIR *pTable VisualDSP++ 5.0 Device Drivers and System 12-21 Services Manual for Blackfin Processors...
  • Page 542 Pointer to table of command-pair values used to initialize the FSS module pTable Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-22 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 543: Adi_Fss_Terminate

    The function takes no arguments. Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-23 Services Manual for Blackfin Processors...
  • Page 544: Adi_Fss_Control

    USB flash drive or SD card is inserted or removed. (0xB001C) Sets the handle that is sent as the first argu- ADI_FSS_CMD_SET_MEDIA_CHANGE_ ment to the callback function upon media change. HANDLE 12-24 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 545 Pointer to command-specific value Value Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-25 Services Manual for Blackfin Processors...
  • Page 546 Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-26 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 547 FSS Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-27 Services Manual for Blackfin Processors...
  • Page 548 DeviceHandle interface driver Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-28 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 549 DeviceHandle interface driver Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-29 Services Manual for Blackfin Processors...
  • Page 550: Adi_Fss_Fileopen

    Append mode ADI_FSS_MODE_APPEND Create file if not found ADI_FSS_MODE_CREATE Truncate file if existing file opened for write ADI_FSS_MODE_TRUNCATE Prototype: ADI_FSS_RESULT adi_fss_FileOpen ADI_FSS_WCHAR *name, namelen, mode, ADI_FSS_FILE_HANDLE *FileHandle ); 12-30 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 551 Location to store handle identifying file stream FileHandle Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-31 Services Manual for Blackfin Processors...
  • Page 552: Adi_Fss_Fileclose

    Handle identifying file stream FileHandle Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-32 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 553: Adi_Fss_Filewrite

    Location to store actual size written BytesWritten Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-33 Services Manual for Blackfin Processors...
  • Page 554: Adi_Fss_Fileread

    Location to store actual size read BytesRead Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-34 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 555: Adi_Fss_Fileseek

    Using clears the EOF flag associ- adi_fss_FileSeek ated with that stream. Prototype u32 adi_fss_FileSeek ( ADI_FSS_FILE_HANDLE FileHandle, offset, Origin, *tellpos VisualDSP++ 5.0 Device Drivers and System 12-35 Services Manual for Blackfin Processors...
  • Page 556 Location to store current position after seek tellpos Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-36 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 557: Adi_Fss_Filetell

    Location to store current position tellpos Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-37 Services Manual for Blackfin Processors...
  • Page 558: Adi_Fss_Iseof

    No error has been encountered. ADI_FSS_RESULT_SUCCESS End of file has been reached. ADI_FSS_RESULT_EOF Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-38 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 559: Adi_Fss_Fileremove

    Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-39 Services Manual for Blackfin Processors...
  • Page 560: Adi_Fss_Filerename

    Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-40 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 561: Adi_Fss_Diropen

    Location to store handle identifying directory stream DirHandle Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-41 Services Manual for Blackfin Processors...
  • Page 562: Adi_Fss_Dirclose

    Handle identifying directory stream DirHandle Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-42 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 563: Adi_Fss_Dirread

    Location to store pointer to directory entry structure pDirEntry Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-43 Services Manual for Blackfin Processors...
  • Page 564: Adi_Fss_Dirseek

    Position (in bytes) in directory stream to seek Seekpos Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-44 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 565: Adi_Fss_Dirtell

    Location to store current position tellpos Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-45 Services Manual for Blackfin Processors...
  • Page 566: Adi_Fss_Dirrewind

    Handle identifying directory stream DirHandle Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-46 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 567: Adi_Fss_Dirchange

    Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. See the Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-47 Services Manual for Blackfin Processors...
  • Page 568: Adi_Fss_Getcurrentdir

    Location to store length of name array namelen Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-48 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 569: Adi_Fss_Dircreate

    Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. VisualDSP++ 5.0 Device Drivers and System 12-49 Services Manual for Blackfin Processors...
  • Page 570: Adi_Fss_Dirremove

    Return Value No error has been encountered. ADI_FSS_RESULT_SUCCESS Any other value Error has occurred. Table 12-1 on page 12-55 for a list of return codes. 12-50 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 571: File System Service Api Data Types And Enumerations

    The data type is defined as: typedef char ADI_FSS_VOLUME_IDENT; ADI_FSS_FILE_HANDLE is an opaque data type used to uniquely iden- ADI_FSS_FILE_HANDLE tify the file stream to manipulate. It is defined as: typedef void *ADI_FSS_FILE_HANDLE; VisualDSP++ 5.0 Device Drivers and System 12-51 Services Manual for Blackfin Processors...
  • Page 572: Adi_Fss_Dir_Handle

    } ADI_FSS_CMD_VALUE_PAIR; where the fields are assigned as shown in the following table. ID of command to execute CommandID Associated value as appropriate for the command ID Value 12-52 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 573: Adi_Fss_Dir_Entry

    { DeviceNumber; ADI_DEV_PDD_ENTRY_POINT *pEntryPoint; ADI_DEV_CMD_VALUE_PAIR *pConfigTable; void *pCriticalRegionData; ADI_DEV_DIRECTION Direction; ADI_DEV_DEVICE_HANDLE DeviceHandle; ADI_FSS_VOLUME_IDENT DefaultMountPoint; } ADI_FSS_DEVICE_DEF; where the assigned fields are shown in the following table. VisualDSP++ 5.0 Device Drivers and System 12-53 Services Manual for Blackfin Processors...
  • Page 574 This is especially useful for removable media types such as USB memory sticks, SD cards, and optical media. This can be left as NULL if no preference is desired. 12-54 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 575: Result Codes

    (0xB0007) insufficient memory to ADI_FSS_RESULT_NO_MEMORY perform request (0xB0008) device driver cannot be ADI_FSS_RESULT_INVALID_DEVICE initialized (0xB0009) no valid file descriptor at ADI_FSS_RESULT_BAD_FILE_HANDLE address supplied (0xB000A) invalid path specified for ADI_FSS_RESULT_BAD_NAME file/directory VisualDSP++ 5.0 Device Drivers and System 12-55 Services Manual for Blackfin Processors...
  • Page 576 (0xB000D) invalid partition specified ADI_FSS_RESULT_BAD_VOLUME (0xB000E) command code is ADI_FSS_RESULT_NOT_SUPPORTED not supported (0xB0010) timeout has occurred ADI_FSS_RESULT_TIMEOUT (0xB0011) bad cache handle ADI_FSS_RESULT_BAD_CACHE_HANDLE (0xB0012) cannot create semaphore ADI_FSS_RESULT_CANT_CREATE_SEMAPHORE in file cache 12-56 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 577: The Standard C I/O Interface Functions

    This list details most of the available functions, but any function defined for file access results in appropriate (primitive) calls to the <stdio.h> FSS API. VisualDSP++ 5.0 Device Drivers and System 12-57 Services Manual for Blackfin Processors...
  • Page 578: Fopen

    The Standard C I/O Interface Functions fopen Description function opens a named file in accordance to the mode flags. fopen Prototype FILE * fopen ( const char *name, const char *mode ); 12-58 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 579: Fclose

    File System Service fclose Description function closes a file identified by fclose stream Prototype int fclose ( FILE * stream); VisualDSP++ 5.0 Device Drivers and System 12-59 Services Manual for Blackfin Processors...
  • Page 580: Fwrite

    The Standard C I/O Interface Functions fwrite Description function writes data elements of bytes to the file fwrite size identified by stream Prototype int fwrite (void *buffer, size_t size, size_t num, FILE *stream); 12-60 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 581: Fread

    File System Service fread Description function reads data elements of bytes from the file fread size identified by stream Prototype int fread (void *buffer, size_t size, size_t num, FILE *stream); VisualDSP++ 5.0 Device Drivers and System 12-61 Services Manual for Blackfin Processors...
  • Page 582: Fprintf

    Description function writes to the file identified by as determined fprintf stream by the format string. The VisualDSP++ 5.0 I/O library performs all the required format processing. Prototype int fprintf (FILE *stream, const char *fmt, ...); 12-62 VisualDSP++ 5.0 Device Drivers and System...
  • Page 583: Fscanf

    Description function reads from the file identified by as deter- fscanf stream mined by the format string. The VisualDSP++ 5.0 I/O library performs all the required format processing. Prototype int fscanf (FILE *stream, const char *fmt, ...); VisualDSP++ 5.0 Device Drivers and System...
  • Page 584: Fgetc

    The Standard C I/O Interface Functions fgetc Description function reads the next byte from the file identified by fgetc stream Prototype int fgetc (FILE *stream); 12-64 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 585: Fgets

    Description function reads the next bytes from the file identified by fgets into the character array. stream Prototype char * fgets (char *buf, int n, FILE *stream ); VisualDSP++ 5.0 Device Drivers and System 12-65 Services Manual for Blackfin Processors...
  • Page 586: Fputc

    The Standard C I/O Interface Functions fputc Description function writes the byte to the file indentified by fputc stream Prototype int fputc (int ci, FILE *stream ); 12-66 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 587: Fputs

    File System Service fputs Description function writes the text string, , to the file indentified by fputs stream Prototype int fputs (const char *s, FILE *stream ); VisualDSP++ 5.0 Device Drivers and System 12-67 Services Manual for Blackfin Processors...
  • Page 588: Fseek

    The Standard C I/O Interface Functions fseek Description function moves the current file position. fseek Prototype int fseek (FILE *stream, long offset, int origin ); 12-68 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 589: Ftell

    File System Service ftell Description function returns the current position in a file. ftell Prototype long ftell (FILE *stream ); VisualDSP++ 5.0 Device Drivers and System 12-69 Services Manual for Blackfin Processors...
  • Page 590: Feof

    The Standard C I/O Interface Functions feof Description function returns whether the current file is at end-of-file (EOF). feof Prototype int feof (FILE *stream ); 12-70 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 591: Additional Posix Functions Supported By The Fss

    VisualDSP++ 5.0 I/O library but are limited to PRIMIO access to the file system of the host PC. To use all functions in this section, you will need to include the FSS header file, , in your application source file.
  • Page 592: Opendir

    Additional POSIX Functions Supported by the FSS opendir Description This function opens the specified directory for processing by readdir , and readdir_r telldir seekdir rewinddir closedir Prototype DIR *opendir ( const char *dirname ) 12-72 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 593: Closedir

    File System Service closedir Description This function closes access to a directory structure pointed to by the dirp argument. Prototype int closedir ( DIR * dirp ) VisualDSP++ 5.0 Device Drivers and System 12-73 Services Manual for Blackfin Processors...
  • Page 594: Readdir

    The filenames are returned in the order in which they are stored by the file system. Prototype struct dirent *readdir ( DIR *dirp ) 12-74 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 595: Readdir_R

    NULL upon reaching the end of the directory stream. Like readdir positions the directory stream at the next entry upon return. Prototype int readdir_r ( DIR *dirp, struct dirent *entry, struct dirent **result ) VisualDSP++ 5.0 Device Drivers and System 12-75 Services Manual for Blackfin Processors...
  • Page 596: Rewinddir

    Additional POSIX Functions Supported by the FSS rewinddir Description This function rewinds the specified directory. Prototype void rewinddir ( DIR *dirp ) 12-76 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 597: Seekdir

    Prototype void seekdir ( DIR *dirp, long loc ); VisualDSP++ 5.0 Device Drivers and System 12-77 Services Manual for Blackfin Processors...
  • Page 598: Telldir

    Additional POSIX Functions Supported by the FSS telldir Description function obtains the current location associated with the telldir() specified directory stream. Prototype long telldir ( DIR *dirp ); 12-78 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 599: Mkdir

    File System Service mkdir Description function creates the specified directory. The argument is mkdir mode ignored by the FSS. Prototype int mkdir ( const char *path, mode_t mode ) VisualDSP++ 5.0 Device Drivers and System 12-79 Services Manual for Blackfin Processors...
  • Page 600: Rmdir

    Additional POSIX Functions Supported by the FSS rmdir Description utility deletes the specified directory. rmdir Prototype int rmdir ( const char *path ); 12-80 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 601: Rename

    File System Service rename Description function renames the file from rename _oldnm _newnm Prototype int rename ( const char *_oldnm, const char *_newnm ); VisualDSP++ 5.0 Device Drivers and System 12-81 Services Manual for Blackfin Processors...
  • Page 602: Remove

    Additional POSIX Functions Supported by the FSS remove Description function removes the specified file. remove Prototype int remove ( const char *_filename ); 12-82 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 603: Extensibility

    System Service API Data Types and Enumerations” on page 12-51. Examples Included with VisualDSP++ 5.0 are some examples to demonstrate how the FSS is configured and how it can be used. As examples, their scope of operation has been purposely limited; please employ caution when using them as a basis for your own applications.
  • Page 604: Harddiskaccess

    5. Lists the contents of that directory. 6. Performs a checksum operation on the created file and displays the results. 7. Removes that file. 8. Moves back to the root directory. 12-84 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 605: Configuration

    This program is used to format the attached hard disk as a single, 32GB FAT 32 partition. This example is only relevant to the ADSP-BF548 EZ-KIT Lite development board. VisualDSP++ 5.0 Device Drivers and System 12-85 Services Manual for Blackfin Processors...
  • Page 606: Description

    “help” or “?”. Likewise, the syntax of any individual command can be obtained by typing the command followed by . For example, rmdir -h lists the syntax and purpose of the command. 12-86 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 607 FSS in particular, in a threaded environment. VisualDSP++ 5.0 Device Drivers and System 12-87 Services Manual for Blackfin Processors...
  • Page 608 2:30 P.M. on Monday, September 17, 2007, enter the follow- ing at the prompt: . Enter for full usage date mon 091714302007 'date -h' details. 12-88 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 609 DMA_SUPPORT command, 10-53 ADI_DEV_1D_BUFFER data type, 10-7, ADI_DEV_CMD_PDD_START 10-33 enumeration value, 10-32 ADI_DEV_2D_BUFFER, 10-76 ADI_DEV_CMD_SET_DATAFLOW ADI_DEV_2D_BUFFER data type, 10-7, command, 10-15, 10-40, 10-44, 10-33 10-52 ADI_DEV_ACCESS_REGISTER, 10-80 VisualDSP++ 5.0 Device Drivers and System I -1 Services Manual for Blackfin Processors...
  • Page 610 ADI_DEV_MODE_CIRCULAR ADI_DMA_CHANNEL_MEMORY dataflow method, 10-43 macro, ADI_DEV_NOT_SUPPORTED return adi_dma_Close function, 6-36 code, 10-55 ADI_DMA_CMD_GET_TRANSFER_ adi_dev_Open function, 1-20, 10-10, STATUS command, 6-22 10-16, 10-36, 10-61 ADI_DMA_CMD_SET_STREAMING command, 6-25 I -2 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 611 6-17, 6-48 ADI_EBIU_SDRAM_EBUFE ADI_DMA_PMAP enumeration, 6-60 enumeration, 4-42 adi_dma_Queue function, 6-50, 10-37 ADI_EBIU_SDRAM_EMREN ADI_DMA_RESULT enumeration result enumeration, 4-40 code, 6-60 ADI_EBIU_SDRAM_ENABLE adi_dma_SetMapping function, 6-51 enumeration, 4-38 VisualDSP++ 5.0 Device Drivers and System I -3 Services Manual for Blackfin Processors...
  • Page 612 7-33 ADI_FSS_WCHAR, 12-45 adi_flag_ResumeCallbacks function, 7-9, adi_int_CECHook function, 2-6, 2-20 7-30 adi_int_CECUnhook function, 2-8, 2-22 adi_flag_Sense function, 7-6, 7-25 adi_int_ClearIMASKBits function, 2-15, adi_flag_SetDirection function, 7-5, 7-21 2-24 I -4 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 613 3-45 adi_ports_EnableCAN function, 9-12 ADI_PWR__CMD_PAIR command, adi_ports_EnableGPIO function, 9-15 3-42 adi_ports_EnablePPI function, ADI_PWR_CMD_SET_CCLK_TABLE adi_ports_EnableSPI function, command, 3-43 adi_ports_EnableSPORT function, 9-10 ADI_PWR_CMD_SET_CLKIN adi_ports_EnableTimer function, 9-13 command, 3-43 VisualDSP++ 5.0 Device Drivers and System I -5 Services Manual for Blackfin Processors...
  • Page 614 3-44 ADI_PWR_PROC_BF532SBBC400 ADI_PWR_CMD_SET_VR_WAKE macro, 3-57 command, 3-44 ADI_PWR_PROC_BF532SBBZ400 ADI_PWR__CMD_TABLE command, macro, 3-57 3-42 ADI_PWR_PROC_BF532SBST400 ADI_PWR_COMMAND enumeration macro, 3-57 type, 3-42 ADI_PWR_PROC_BF533SBBZ500 ADI_PWR_COMMAND_PAIR data macro, 3-57 type, 3-47 I -6 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 615 3-32 11-31 adi_pwr_SetFreq function, 3-33 adi_rtc_EnableWakeup, 11-25, 11-31 adi_pwr_SetMaxFreqForVolt function, ADI_RTC_ENUMERATION_START, 3-35 11-30 adi_pwr_SetPowerMode function, 3-36 ADI_RTC_EVENT_DAYS, 11-29 adi_pwr_SetVoltageRegulator function, ADI_RTC_EVENT_EACH_DAY_ALM, 3-38 11-29 ADI_RTC_EVENT_HOURS, 11-29 VisualDSP++ 5.0 Device Drivers and System I -7 Services Manual for Blackfin Processors...
  • Page 616 11-30 8-34 ADI_RTC_RESULT_ERROR_ adi_tmr_WatchdogControl function, 8-6, REMOVING_CALLBACK, 11-30 8-22 ADI_RTC_RESULT_FAILED, 11-30 advanced configuration, 12-12 ADI_RTC_RESULT_INTERRUPT_ alarm MANAGER_ERROR, 11-30 each day, 11-7 ADI_RTC_RESULT_INVALID_ once only, 11-7 EVENT_ID, 11-30 I -8 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 617 6-22 transmitting outbound data, 10-89 memory, testing count, channel handle, 6-11 circular callback dataflow method, 10-12 defined, 11-8 transfer, 6-23 example, 11-12 transfer operating mode, 6-14 executing, VisualDSP++ 5.0 Device Drivers and System I -9 Services Manual for Blackfin Processors...
  • Page 618 3-24 ADI_DEV_CIRCULAR_BUFFER, critical code region 10-77 interrupt manager, 2-12 ADI_DEV_DMA_ACCESS, 10-79 protecting, 2-12 ADI_DEV_DMA_INFO, 10-79 removing protect condition, 2-28 ADI_DEV_FREQUENCIES, 10-80 setting protective condition, 2-26 ADI_DEV_SEQ_1D_BUFFER, 10-78 I -10 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 619 10-10, 10-36 chain (small), 6-20 opening for use, 10-51, 10-61 contents of array element, 6-56 setting configuration parameter, 10-85 queueing to DMA channel, 6-50 shutting down, 10-56 VisualDSP++ 5.0 Device Drivers and System I -11 Services Manual for Blackfin Processors...
  • Page 620 6-25 EBIU_SDRRC register terminating, 6-5, 6-52 adi_ebiu_AdjustSDRAM function, 4-11 DMA peripheral map (PMAP) ID, 10-53 adjusting SDRAM refresh rate, 4-18 DMA traffic control, 6-31 setting, 4-16 I -12 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 621 See 12-51 EBIU module system service requirements, 12-7 termination, 12-7 file system service API reference, 12-17 flag IDs, 7-4, 7-32 flag pins, VisualDSP++ 5.0 Device Drivers and System I -13 Services Manual for Blackfin Processors...
  • Page 622 12-41 rewinddir, 12-70 adi_fss_DirClose, 12-36 rmdir, 12-74 adi_fss_DirCreate, 12-43 seekdir, 12-71 adi_fss_DirOpen, 12-35 telldir, 12-72 adi_fss_DirRead, 12-37 fwrite, 12-54 adi_fss_DirRemove, 12-44 adi_fss_DirRewind, 12-40 adi_fss_DirSeek, 12-38 adi_fss_DirTell, 12-39 I -14 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 623 (IVG), DCB manager, 5-17 ISR, 11-10 device manager, 1-23 IVG, 11-3, 11-10 DMA manager, IVG levels, EBIU module, 4-16 interrupt manager, power management module, 3-24 VisualDSP++ 5.0 Device Drivers and System I -15 Services Manual for Blackfin Processors...
  • Page 624 DMA stream pBuffer parameter, 10-37 closing, 6-41 PDDCallback function, 10-41, 10-49 opening for use, 6-46 pDeviceHandle parameter, 10-10 memory streams pEntryPoint parameter, 10-10 closing, 6-10 controlling, I -16 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 625 DMA configuration control register, PLL_STAT register, 3-43 10-43 port control manager processor power mode, setting, 3-36, 3-49 assigning programmable flag pins to processor variants, 1-12, 1-26 functions, programmable flags, defined, VisualDSP++ 5.0 Device Drivers and System I -17 Services Manual for Blackfin Processors...
  • Page 626 2-11 revision number references, 1-14 SIC interrupt wakeup register, 2-11 rewinddir, 12-70 SIC wakeup register, 2-36 rmdir, 12-74 __SILICON_REVISION__ macro, 1-16, RTC_ICTL, 11-24, 11-27 1-30 RTC_ISTAT, 11-10 I -18 VisualDSP++ 5.0 Device Drivers and System Services Manual for Blackfin Processors...
  • Page 627 8-10 system interrupt controller (SIC) opening, 8-10 defined, opening for use, 8-17 disabling an interrupt, 2-29 removing a callback, enabling an interrupt, 2-30 removing callbacks, 8-14 functions, VisualDSP++ 5.0 Device Drivers and System I -19 Services Manual for Blackfin Processors...
  • Page 628 6-21 wakeup flag, trigger type, watchdog timer two-dimensional commands, 8-34 DMA, 6-29 configuring, 8-6, 8-22 memory copy, 6-44 functions, two-dimensional memory transfers, write command, 4-17 VisualDSP++ 5.0 Device Drivers and System I -20 Services Manual for Blackfin Processors...

Table of Contents