SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
The World Leader in High Performance Signal Processing Solutions




Blackfin Device Drivers
        Presented By:
        David Lannigan
About this Module


    This module discusses the device driver model for the
    Blackfin family of processors.

    It is recommended that users should have an understanding
    of the Blackfin architecture and is familiar with the Blackfin
    System Services software.




2
Module Outline

! Overview
    " General
            Information
     ! Common conventions, terminology, return codes etc.

! Device Driver API
! Buffers
! Dataflow Methods
! UART example (VisualDSP, December 2005 update)




3
Device Driver Model

! Standardized            API for Blackfin processors
    " Userinterface is the same
     ! Regardless of driver

         "   Allows buffers to be passed from driver to driver
     !   Regardless of processor
         "   Application using UART does not change from BF533 to BF537
    " Developers    only have to learn it once
     ! All drivers operate the same way

! Extensible
    " Drivers      can add their own commands (IOCTLs), events etc.
! Goal        is to cover the vast majority
    " Exceptions       will exist



4
Leverages the System Services

! Faster       development
    " Stable   software base
     !   Fewer variables
    " Less   re-invention
     !   Example: drivers do not need to include DMA code
! Modular        software
    " Better   compatibility
     !   Resource control is managed by the system services
    " Easier   integration
     !   Multiple drivers working concurrently
! Portability
    " Driver   for the BF533 works on the BF561



5
System Architecture (Drivers and Services)

                 Application



                RTOS (optional)


                  Device            Device
                  Driver            Driver



                           Device
                           Driver




               System Services

6
Using Device Drivers in VisualDSP Projects

!Application source file
 " #include <services/services.h>           // system services
 " #include <drivers/adi_dev.h>             // device manager
 " #include <drivers/xxx.h>                 // device driver’s .h file
!Source file folder
 " For off-chip device drivers only
   ! Include the device driver’s .c file in the list of source files

!Linker files folder
                                                       Off-chip drivers need to be explicitly included
 " Link with the proper libssl library
   ! Pulls in the system services                           On-chip drivers come in the library

 " Link with the proper libdrv library
   ! Pulls in on-chip device drivers




!Use code elimination option                     in linker
 " Significantly reduces code size

7
Library Configurations

! Debug       version of on-chip driver library
    " Optimizations  off
    " Symbolic information included
    " Can step into the sources
    " Lots of parameter checks
    " Should be the libraries users start with
     !   Examples/demos typically use the debug version
! Release       version on-chip driver library
    " Optimizations  on
    " No symbolic information
    " Can’t step into the sources
    " Few, if any, parameter checks
    " Should be the libraries users end with
     !   Users should release with the release version


8
Library Filenames (pg 1-12 in the manual)
                            libdrvaaa_bbbcc.dlb

aaa – processor variant                        cc – special conditions
532 – BF531, BF532, BF533                      d – debug version
534 – BF534, BF536, BF537                      y – workarounds for all silicon anomolies
561 – BF561                                    dy – debug plus workarounds
                                               blank – no debug, no workarounds

                        _bbb – operating environment
                        blank - standalone




                        i.e. libdrv532dy.dlb
                            •ADSP-BF531, 532 or 533
                            •Debug plus workarounds




9
Finding Device Drivers
! Include         files
     "   C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinincludedrivers

! Source          files
     "   C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinlibsrcdrivers

! Libraries
     "   C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinlib

! Examples
     "   C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF533Drivers

     "   C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF537Drivers

     "   C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF561Drivers


! Documentation
  " Device Driver and System Services User Manual
    ! Blackfin Technical Library at www.analog.com


     "   Device Driver and System Services User Manual Addendum (Sept 2005)
         ! ftp://ftp.analog.com/pub/tools/patches/Blackfin/VDSP++4.0/




10
Memory

! No dynamic memory is used in the device drivers
! Device Manager needs memory to manage devices
     " Supplied  by the application when initialized
     " Dictates how many simultaneously open drivers can be supported

! Physical drivers use static memory for their internal data
! No restrictions on memory placement
     " Code   or data




11
Handles

! Used       in all device drivers (used in most services)
     " Device   Handle       ADI_DEV_HANDLE
! Unique        identifier
     " Always  typedef-ed to a void *
     " Is the address of something
      !   ADI_DEV_HANDLE – points to device specific data
! Client      Handle
     " Whatever  the client wants it to be
     " No significance to the device drivers (or system services)
     " Can be anything that fits in a void *
      ! May point to something important for the client
      ! May be a value of something

      ! May be NULL




12
Return Codes

! Every       (almost every) API function returns a code
     " Zero– universal success
     " Non-zero – some type of error or informative fact

! Each        driver has its own set of return codes
     " Alldrivers return u32 for their return code
     " Pass back driver return codes OR system service return codes

! Resolving        errors
     " Identifythe driver or service that generated the error (services.h)
     " Find value in the .h file for that driver or service




13
Initialization Sequence

! Initialize    services in the following order
     " Omit   any services not required
      1. Interrupt Manager
      2. EBIU

      3. Power

      4. Port Control (BF534, BF536, BF537 only)

      5. Deferred Callback Service

      6. DMA Manager

      7. Flag Service

      8. Timer Service

! After    services are initialized, then initialize device drivers
     " adi_dev_Init()




14
Termination Sequence

!        Termination is often not required in embedded systems
     "        Do not call termination if not required
         !     Code elimination will optimize it out
!        Terminate device drivers before terminating any services
     "        adi_dev_Terminate()
!        Terminate services in the following order
     "        Omit any services not required
         1.    Timer Service
         2.    Flag Service
         3.    DMA Manager
         4.    Deferred Callback Service
         5.    Port Control (BF534, BF536, BF537 only)
         6.    Power
         7.    EBIU
         8.    Interrupt Manager


15
RTOS Considerations

! No      device driver dependencies on RTOS
     " Hence,   no VDK device driver library file
! All     RTOS interactions isolated in the system services
     " Interrupt   Manager
      ! Critical regions
      ! IMASK manipulations

      ! Deferred callbacks

! Identical      device driver API
     " VDK
     " Standalone




16
Device Driver API



               adi_dev_Open()            –   Opens a device driver for use
               adi_dev_Close()           –   Closes a device driver
               adi_dev_Read()            –   Reads data from/provides input buffers




                                                                                      Device Driver
 Application




               adi_dev_Write()           –   Writes data to/provides output buffers
               adi_dev_SequentialIO()    –   Reads and writes data sequentially
               adi_dev_Control()         –   Sets/senses device parameters




                                        Invokes the application’s callback function




17
Device Driver API

! Same        API functions for all drivers (adi_dev.h)
     " UART, PPI, SPI, SPORT, TWI
     " ADC, DAC, video encoders, video decoders etc.



! Device        driver extensions (adi_xxx.h)
     " Can   add custom commands
      !   Passed in via adi_dev_Control()
     " Can   create new return codes
      !   Return values from each of the API functions
     " Can   create additional events
      !   Passed to the client via callback function




18
Device Drivers and System Services

! Device        drivers manage their own system services
     " Drivers   call into system services as required
      !   e.g. PPI driver
          " Calls into DMA Manager

          " Calls into Interrupt Manager

          " Calls into Timer Control                 Application
          " Calls into DCB

     " Application   involvement                    RTOS (optional)
      ! Initialize services
                                                     Device             Device
                                                     Driver             Driver



                                                               Device
                                                               Driver



                                                  System Services

19
Moving Data Through Device Drivers

!Application            provides buffers to device driver for
     processing
     " Buffers    describe the data for the device driver to process
      ! Inbound buffers – Filled with data received from the device
      ! Outbound buffers – Contain data to send out through the device

!Buffer         types
     " One   dimensional                    ADI_DEV_1D_BUFFER
      !   Provided to driver via adi_dev_Read() or adi_dev_Write()
     " Two   dimensional                    ADI_DEV_2D_BUFFER
      !   Provided to driver via adi_dev_Read() or adi_dev_Write()
     " Sequential    (one dimensional) ADI_DEV_SEQ_1D_BUFFER
      !   Provided to driver via adi_dev_SequentialIO()
     " Circular                             ADI_DEV_CIRCULAR_BUFFER
      !   Provided to driver via adi_dev_Read() or adi_dev_Write()
20
One Dimensional Buffer

!    Pointer to the data
     "   Data can exist anywhere in memory
!    Element count
     "   Number of data elements
!    Element width
     "   Width, in bytes, of an element
!    Callback parameter
     "   NULL – no callback when the buffer is processed
     "   Non-NULL – callback generated and this value passed to callback
!    Processed Flag (filled in by device driver)
     "   Set when the buffer is processed by the driver
!    Processed Count (filled in by device driver)
     "   Number of bytes processed in the buffer
!    pNext
     "   Pointer to the next buffer in the chain (NULL if the last/only buffer in chain)
!    pAdditionalInfo
     "   Pointer to any device specific information for the buffer
     "   Not used by most devices

21
Dataflow Methods

! Five    dataflow methods
     " Chaining                               1D and 2D buffers only
     " Chaining with loopback                 1D and 2D buffers only
     " Sequential chaining                    Sequential 1D buffers only
     " Sequential chaining with loopback      Sequential 1D buffers only
     " Circular                               Circular buffers only
! Device       drivers
     " Must   support at least 1 dataflow method
      ! PPI
        " 1D, 2D and Circular

      ! UART

        " 1D

      ! TWI

        " Sequential 1D


22
Chaining Method

! Buffers       are effectively “queued” to the device driver
     " Inbound    buffers in one queue
      !   Buffers processed in the order they are received by adi_dev_Read()
     " Outbound     buffers in another queue
      !   Buffers processed in the order they are received by adi_dev_Write()
! Buffers
     " Can be provided at any time
     " Submitted one at a time or in groups
     " Can point to data of different sizes
! Any,all or no buffers can be tagged to generate a callback
! Once processed, buffer is not used again unless resubmitted




                         #                                    #
23
Chaining with Loopback Method

! Identical     to chaining method except:
     " Device  driver automatically loops back to the first buffer after the
       last buffer in the chain is processed
     " Buffers can be provided only when dataflow is stopped

! Application      does not need to re-supply buffers
     " Lower overhead
     " Device driver never “starves” for data




                     #                                 #
24
Sequential Chaining Method

! Buffers         are effectively “queued” to the device driver
     " Fieldin buffer indicates direction (inbound or outbound)
     " Inbound and outbound buffers in one queue
      !   Buffers processed in the order they are received by adi_dev_SequentialIO()
! Buffers
     " Can be provided at any time
     " Submitted one at a time or in groups
     " Can point to data of different sizes
! Any,all or no buffers can be tagged to generate a callback
! Once processed, buffer is not used again unless resubmitted




           Outbound    Inbound     Inbound                 Outbound
                                                                        Outbound
                                                Inbound

                         #                                   #
25
Sequential Chaining with Loopback Method

! Identical         to sequential method except:
     " Device  driver automatically loops back to the first buffer after the
       last buffer in the chain is processed
     " Buffers can be provided only when dataflow is stopped

! Application         does not need to re-supply buffers
     " Lower overhead
     " Device driver never “starves” for data




         Outbound       Inbound   Inbound             Outbound
                                                                 Outbound
                                            Inbound

                          #                             #
26
Streaming Command

! Can       be used with any chained dataflow method
     " Chaining,     chaining w/loopback, sequential, sequential w/loopback
! Assertions          to device driver
     " Application  will insure the driver never runs out of buffers
     " If buffers with callbacks are used, system timing insures interrupts
       won’t be lost
! Device        drivers maximize throughput
     " Peripheral DMA supported devices use streaming DMA
     " Useful for audio and video
      !   Eliminates clicks, pops, glitches etc.




27
Circular Dataflow Method

! Single       buffer provided to device            Sub-buffer 0
     " Define ‘n’ sub-buffers within the buffer
     " Buffer size limit of 64K bytes
                                                    Sub-buffer 1
! Automatic wrap-around
! Callbacks supported
                                                    Sub-buffer 2
     " None
     " Everysub-buffer completion
     " Whole buffer completion                           …
! When        supported by peripheral DMA
     " Leverages   autobuffer capability          Sub-buffer ‘n – 2’



                                                  Sub-buffer ‘n – 1’




28
Deciding on a Dataflow Method

! Circular
     " Data fits in a 64K byte contiguous block
     " Streaming type data
     " Audio frequently a candidate for circular dataflow
! Chained         without loopback
     " Packet based data
     " Bursty data flow
      !   i.e. Ethernet, UART, USB etc.
! Chained         with loopback
     " Steady data flow
     " Audio, Video
      !   Use streaming to avoid clicks/pops/glitches
! Sequential         w/wout loopback
     " Half-duplex    serial type devices
      !   TWI (I2C compatible)

29
Typical Programming Sequence

                      Opens the driver specifying the device, direction, handles to services etc.




                   Configure the device for the dataflow method, and other configurable parameters




                                                                                                     Device Driver
     Application




                    Provide buffers via adi_dev_Read(), adi_dev_Write () or adi_dev_SequentialIO()




                                                   Enable dataflow




                                                 Driver makes callback when buffer is filled




                    Supply buffers via adi_dev_Read(), adi_dev_Write() or adi_dev_SequentialIO()


30
UART Example

! Echo     program for UART device driver
     " Characters
                entered in terminal are received by the Blackfin
      program and echoed back to the terminal
! Connect  serial cable from BF537 EZ-Kit to PC
! Start hyperterminal
     " 57600   baud, 8 data bits, 1 stop bit, no parity
! Example        demonstrates
     " Usage  of the UART device driver
     " Chained dataflow method
     " Callbacks




31
Programming Sequence for UART Example
                                  Open UART driver for bidirectional dataflow




                          Configure UART driver for chained, baud rate, stop bits etc.




                               Provide buffers for driver to fill via adi_dev_Read()




                                                                                                   UART Driver
     Application




                                                 Enable dataflow




                                               Driver makes callback when buffer is filled




                       Callback provides buffer for transmission out via adi_dev_Write()




                                         Driver makes callback when buffer is transmitted out




                   Callback function provides buffer for driver to fill again via adi_dev_Read()


32
Conclusion

Device drivers provide:
! Faster development
     " Stable   software base for application development
      !   Fewer variables
     " Less   re-invention
      !   Do not need to create everything from scratch
! Modular        software
     " Better   compatibility
      !   Resource control is managed by the system services
     " Easier   integration
      !   Multiple software components working concurrently
! Portability
     " Code    portable to other Blackfin processors


33
Additional Information

! Documentation
     " Device
            Drivers and System Services Manual for Blackfin
      Processors
         − http://www.analog.com/processors/manuals
     " Device   Drivers and System Services Addendum (Sept 2005)
         − ftp://ftp.analog.com/pub/tools/patches/Blackfin/VDSP++4.0/


! For   questions, click “Ask A Question” button or
     send an email to Processor.support@analog.com




34

Contenu connexe

Tendances

Project ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN
 
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...LF_OpenvSwitch
 
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature 'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature Qualcomm Developer Network
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4Qualcomm Developer Network
 
Linux Power Management Slideshare
Linux Power Management SlideshareLinux Power Management Slideshare
Linux Power Management SlidesharePatrick Bellasi
 
Windows内核技术介绍
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍jeffz
 
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Developer Network
 
Understanding and Improving Device Access Complexity
Understanding and Improving Device Access ComplexityUnderstanding and Improving Device Access Complexity
Understanding and Improving Device Access Complexityasimkadav
 
Portal6 komponenten
Portal6 komponentenPortal6 komponenten
Portal6 komponententestkiller
 
SFO15-407: Performance Overhead of ARM Virtualization
SFO15-407: Performance Overhead of ARM VirtualizationSFO15-407: Performance Overhead of ARM Virtualization
SFO15-407: Performance Overhead of ARM VirtualizationLinaro
 
Implementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationImplementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationYan Vugenfirer
 
Project ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Qualcomm Developer Network
 

Tendances (20)

Project ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introduction
 
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...
LF_OVS_17_OvS-CD: Optimizing Flow Classification for OvS using the DPDK Membe...
 
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature 'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature
'Hear' & Now: Software Integration for the Qualcomm Snapdragon Audio Feature
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 4
 
Linux Power Management Slideshare
Linux Power Management SlideshareLinux Power Management Slideshare
Linux Power Management Slideshare
 
Windows内核技术介绍
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍
 
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia SolutionsQualcomm Hexagon SDK: Optimize Your Multimedia Solutions
Qualcomm Hexagon SDK: Optimize Your Multimedia Solutions
 
Understanding and Improving Device Access Complexity
Understanding and Improving Device Access ComplexityUnderstanding and Improving Device Access Complexity
Understanding and Improving Device Access Complexity
 
Portal6 komponenten
Portal6 komponentenPortal6 komponenten
Portal6 komponenten
 
ARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- OverviewARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- Overview
 
SFO15-407: Performance Overhead of ARM Virtualization
SFO15-407: Performance Overhead of ARM VirtualizationSFO15-407: Performance Overhead of ARM Virtualization
SFO15-407: Performance Overhead of ARM Virtualization
 
Implementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationImplementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migration
 
Android Optimization: Myth and Reality
Android Optimization: Myth and RealityAndroid Optimization: Myth and Reality
Android Optimization: Myth and Reality
 
Project ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config tool
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Graphics virtualization
Graphics virtualizationGraphics virtualization
Graphics virtualization
 
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
Developing for Industrial IoT with Linux OS on DragonBoard™ 410c: Session 2
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 

Similaire à Blackfin Device Drivers

Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...44CON
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2rahul_p_shukla
 
VMworld 2013: VMware Horizon Mirage Image Deployment Deep Dive
VMworld 2013: VMware Horizon Mirage Image Deployment Deep DiveVMworld 2013: VMware Horizon Mirage Image Deployment Deep Dive
VMworld 2013: VMware Horizon Mirage Image Deployment Deep DiveVMworld
 
Easily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg asEasily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg asRISC-V International
 
Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyBenjamin Zores
 
DUG'20: 09 - DAOS Middleware Update
DUG'20: 09 - DAOS Middleware UpdateDUG'20: 09 - DAOS Middleware Update
DUG'20: 09 - DAOS Middleware UpdateAndrey Kudryavtsev
 
Creating an Embedded System Lab
Creating an Embedded System LabCreating an Embedded System Lab
Creating an Embedded System LabNonamepro
 
IBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the CloudIBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the CloudAndrew Coleman
 
Installing Cognos 10.2.1: Tips and Tricks from the Trenches
Installing Cognos 10.2.1: Tips and Tricks from the TrenchesInstalling Cognos 10.2.1: Tips and Tricks from the Trenches
Installing Cognos 10.2.1: Tips and Tricks from the TrenchesSenturus
 
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component IntegrationMIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component IntegrationMIPI Alliance
 
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS MOHAMMED FURQHAN
 
WDM - Windows Driver Model overview
WDM - Windows Driver Model overviewWDM - Windows Driver Model overview
WDM - Windows Driver Model overviewPrasad Talekar
 
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat DasNull Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat Dasnullowaspmumbai
 
Impact2014: Introduction to the IBM Java Tools
Impact2014: Introduction to the IBM Java ToolsImpact2014: Introduction to the IBM Java Tools
Impact2014: Introduction to the IBM Java ToolsChris Bailey
 

Similaire à Blackfin Device Drivers (20)

Agnostic Device Drivers
Agnostic Device DriversAgnostic Device Drivers
Agnostic Device Drivers
 
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2
 
Faults inside System Software
Faults inside System SoftwareFaults inside System Software
Faults inside System Software
 
VMworld 2013: VMware Horizon Mirage Image Deployment Deep Dive
VMworld 2013: VMware Horizon Mirage Image Deployment Deep DiveVMworld 2013: VMware Horizon Mirage Image Deployment Deep Dive
VMworld 2013: VMware Horizon Mirage Image Deployment Deep Dive
 
E.s unit 6
E.s unit 6E.s unit 6
E.s unit 6
 
Easily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg asEasily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg as
 
Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform Anatomy
 
DUG'20: 09 - DAOS Middleware Update
DUG'20: 09 - DAOS Middleware UpdateDUG'20: 09 - DAOS Middleware Update
DUG'20: 09 - DAOS Middleware Update
 
Device drivers by prabu m
Device drivers by prabu mDevice drivers by prabu m
Device drivers by prabu m
 
Creating an Embedded System Lab
Creating an Embedded System LabCreating an Embedded System Lab
Creating an Embedded System Lab
 
IBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the CloudIBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the Cloud
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Installing Cognos 10.2.1: Tips and Tricks from the Trenches
Installing Cognos 10.2.1: Tips and Tricks from the TrenchesInstalling Cognos 10.2.1: Tips and Tricks from the Trenches
Installing Cognos 10.2.1: Tips and Tricks from the Trenches
 
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component IntegrationMIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
 
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
A CASE STUDY ON EMBEDDED SYSTEM SOFTWARE STACK LAYERS
 
WDM - Windows Driver Model overview
WDM - Windows Driver Model overviewWDM - Windows Driver Model overview
WDM - Windows Driver Model overview
 
IDAPRO
IDAPROIDAPRO
IDAPRO
 
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat DasNull Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
 
Impact2014: Introduction to the IBM Java Tools
Impact2014: Introduction to the IBM Java ToolsImpact2014: Introduction to the IBM Java Tools
Impact2014: Introduction to the IBM Java Tools
 

Plus de Pantech ProLabs India Pvt Ltd

Choosing the right processor for embedded system design
Choosing the right processor for embedded system designChoosing the right processor for embedded system design
Choosing the right processor for embedded system designPantech ProLabs India Pvt Ltd
 

Plus de Pantech ProLabs India Pvt Ltd (20)

Registration process
Registration processRegistration process
Registration process
 
Choosing the right processor for embedded system design
Choosing the right processor for embedded system designChoosing the right processor for embedded system design
Choosing the right processor for embedded system design
 
Brain Computer Interface
Brain Computer InterfaceBrain Computer Interface
Brain Computer Interface
 
Electric Vehicle Design using Matlab
Electric Vehicle Design using MatlabElectric Vehicle Design using Matlab
Electric Vehicle Design using Matlab
 
Image processing application
Image processing applicationImage processing application
Image processing application
 
Internet of Things using Raspberry Pi
Internet of Things using Raspberry PiInternet of Things using Raspberry Pi
Internet of Things using Raspberry Pi
 
Internet of Things Using Arduino
Internet of Things Using ArduinoInternet of Things Using Arduino
Internet of Things Using Arduino
 
Brain controlled robot
Brain controlled robotBrain controlled robot
Brain controlled robot
 
Brain Computer Interface-Webinar
Brain Computer Interface-WebinarBrain Computer Interface-Webinar
Brain Computer Interface-Webinar
 
Development of Deep Learning Architecture
Development of Deep Learning ArchitectureDevelopment of Deep Learning Architecture
Development of Deep Learning Architecture
 
Future of AI
Future of AIFuture of AI
Future of AI
 
Gate driver design and inductance fabrication
Gate driver design and inductance fabricationGate driver design and inductance fabrication
Gate driver design and inductance fabrication
 
Brainsense -Brain computer Interface
Brainsense -Brain computer InterfaceBrainsense -Brain computer Interface
Brainsense -Brain computer Interface
 
Median filter Implementation using TMS320C6745
Median filter Implementation using TMS320C6745Median filter Implementation using TMS320C6745
Median filter Implementation using TMS320C6745
 
Introduction to Code Composer Studio 4
Introduction to Code Composer Studio 4Introduction to Code Composer Studio 4
Introduction to Code Composer Studio 4
 
Waveform Generation Using TMS320C6745 DSP
Waveform Generation Using TMS320C6745 DSPWaveform Generation Using TMS320C6745 DSP
Waveform Generation Using TMS320C6745 DSP
 
Interfacing UART with tms320C6745
Interfacing UART with tms320C6745Interfacing UART with tms320C6745
Interfacing UART with tms320C6745
 
Switch & LED using TMS320C6745 DSP
Switch & LED using TMS320C6745 DSPSwitch & LED using TMS320C6745 DSP
Switch & LED using TMS320C6745 DSP
 
Led blinking using TMS320C6745
Led blinking using TMS320C6745Led blinking using TMS320C6745
Led blinking using TMS320C6745
 
Introduction to tms320c6745 dsp
Introduction to tms320c6745 dspIntroduction to tms320c6745 dsp
Introduction to tms320c6745 dsp
 

Dernier

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Blackfin Device Drivers

  • 1. The World Leader in High Performance Signal Processing Solutions Blackfin Device Drivers Presented By: David Lannigan
  • 2. About this Module This module discusses the device driver model for the Blackfin family of processors. It is recommended that users should have an understanding of the Blackfin architecture and is familiar with the Blackfin System Services software. 2
  • 3. Module Outline ! Overview " General Information ! Common conventions, terminology, return codes etc. ! Device Driver API ! Buffers ! Dataflow Methods ! UART example (VisualDSP, December 2005 update) 3
  • 4. Device Driver Model ! Standardized API for Blackfin processors " Userinterface is the same ! Regardless of driver " Allows buffers to be passed from driver to driver ! Regardless of processor " Application using UART does not change from BF533 to BF537 " Developers only have to learn it once ! All drivers operate the same way ! Extensible " Drivers can add their own commands (IOCTLs), events etc. ! Goal is to cover the vast majority " Exceptions will exist 4
  • 5. Leverages the System Services ! Faster development " Stable software base ! Fewer variables " Less re-invention ! Example: drivers do not need to include DMA code ! Modular software " Better compatibility ! Resource control is managed by the system services " Easier integration ! Multiple drivers working concurrently ! Portability " Driver for the BF533 works on the BF561 5
  • 6. System Architecture (Drivers and Services) Application RTOS (optional) Device Device Driver Driver Device Driver System Services 6
  • 7. Using Device Drivers in VisualDSP Projects !Application source file " #include <services/services.h> // system services " #include <drivers/adi_dev.h> // device manager " #include <drivers/xxx.h> // device driver’s .h file !Source file folder " For off-chip device drivers only ! Include the device driver’s .c file in the list of source files !Linker files folder Off-chip drivers need to be explicitly included " Link with the proper libssl library ! Pulls in the system services On-chip drivers come in the library " Link with the proper libdrv library ! Pulls in on-chip device drivers !Use code elimination option in linker " Significantly reduces code size 7
  • 8. Library Configurations ! Debug version of on-chip driver library " Optimizations off " Symbolic information included " Can step into the sources " Lots of parameter checks " Should be the libraries users start with ! Examples/demos typically use the debug version ! Release version on-chip driver library " Optimizations on " No symbolic information " Can’t step into the sources " Few, if any, parameter checks " Should be the libraries users end with ! Users should release with the release version 8
  • 9. Library Filenames (pg 1-12 in the manual) libdrvaaa_bbbcc.dlb aaa – processor variant cc – special conditions 532 – BF531, BF532, BF533 d – debug version 534 – BF534, BF536, BF537 y – workarounds for all silicon anomolies 561 – BF561 dy – debug plus workarounds blank – no debug, no workarounds _bbb – operating environment blank - standalone i.e. libdrv532dy.dlb •ADSP-BF531, 532 or 533 •Debug plus workarounds 9
  • 10. Finding Device Drivers ! Include files " C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinincludedrivers ! Source files " C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinlibsrcdrivers ! Libraries " C:Program FilesAnalog DevicesVisualDSP 4.0Blackfinlib ! Examples " C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF533Drivers " C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF537Drivers " C:Program FilesAnalog DevicesVisualDSP 4.0BlackfinEZ-KITsADSP-BF561Drivers ! Documentation " Device Driver and System Services User Manual ! Blackfin Technical Library at www.analog.com " Device Driver and System Services User Manual Addendum (Sept 2005) ! ftp://ftp.analog.com/pub/tools/patches/Blackfin/VDSP++4.0/ 10
  • 11. Memory ! No dynamic memory is used in the device drivers ! Device Manager needs memory to manage devices " Supplied by the application when initialized " Dictates how many simultaneously open drivers can be supported ! Physical drivers use static memory for their internal data ! No restrictions on memory placement " Code or data 11
  • 12. Handles ! Used in all device drivers (used in most services) " Device Handle ADI_DEV_HANDLE ! Unique identifier " Always typedef-ed to a void * " Is the address of something ! ADI_DEV_HANDLE – points to device specific data ! Client Handle " Whatever the client wants it to be " No significance to the device drivers (or system services) " Can be anything that fits in a void * ! May point to something important for the client ! May be a value of something ! May be NULL 12
  • 13. Return Codes ! Every (almost every) API function returns a code " Zero– universal success " Non-zero – some type of error or informative fact ! Each driver has its own set of return codes " Alldrivers return u32 for their return code " Pass back driver return codes OR system service return codes ! Resolving errors " Identifythe driver or service that generated the error (services.h) " Find value in the .h file for that driver or service 13
  • 14. Initialization Sequence ! Initialize services in the following order " Omit any services not required 1. Interrupt Manager 2. EBIU 3. Power 4. Port Control (BF534, BF536, BF537 only) 5. Deferred Callback Service 6. DMA Manager 7. Flag Service 8. Timer Service ! After services are initialized, then initialize device drivers " adi_dev_Init() 14
  • 15. Termination Sequence ! Termination is often not required in embedded systems " Do not call termination if not required ! Code elimination will optimize it out ! Terminate device drivers before terminating any services " adi_dev_Terminate() ! Terminate services in the following order " Omit any services not required 1. Timer Service 2. Flag Service 3. DMA Manager 4. Deferred Callback Service 5. Port Control (BF534, BF536, BF537 only) 6. Power 7. EBIU 8. Interrupt Manager 15
  • 16. RTOS Considerations ! No device driver dependencies on RTOS " Hence, no VDK device driver library file ! All RTOS interactions isolated in the system services " Interrupt Manager ! Critical regions ! IMASK manipulations ! Deferred callbacks ! Identical device driver API " VDK " Standalone 16
  • 17. Device Driver API adi_dev_Open() – Opens a device driver for use adi_dev_Close() – Closes a device driver adi_dev_Read() – Reads data from/provides input buffers Device Driver Application adi_dev_Write() – Writes data to/provides output buffers adi_dev_SequentialIO() – Reads and writes data sequentially adi_dev_Control() – Sets/senses device parameters Invokes the application’s callback function 17
  • 18. Device Driver API ! Same API functions for all drivers (adi_dev.h) " UART, PPI, SPI, SPORT, TWI " ADC, DAC, video encoders, video decoders etc. ! Device driver extensions (adi_xxx.h) " Can add custom commands ! Passed in via adi_dev_Control() " Can create new return codes ! Return values from each of the API functions " Can create additional events ! Passed to the client via callback function 18
  • 19. Device Drivers and System Services ! Device drivers manage their own system services " Drivers call into system services as required ! e.g. PPI driver " Calls into DMA Manager " Calls into Interrupt Manager " Calls into Timer Control Application " Calls into DCB " Application involvement RTOS (optional) ! Initialize services Device Device Driver Driver Device Driver System Services 19
  • 20. Moving Data Through Device Drivers !Application provides buffers to device driver for processing " Buffers describe the data for the device driver to process ! Inbound buffers – Filled with data received from the device ! Outbound buffers – Contain data to send out through the device !Buffer types " One dimensional ADI_DEV_1D_BUFFER ! Provided to driver via adi_dev_Read() or adi_dev_Write() " Two dimensional ADI_DEV_2D_BUFFER ! Provided to driver via adi_dev_Read() or adi_dev_Write() " Sequential (one dimensional) ADI_DEV_SEQ_1D_BUFFER ! Provided to driver via adi_dev_SequentialIO() " Circular ADI_DEV_CIRCULAR_BUFFER ! Provided to driver via adi_dev_Read() or adi_dev_Write() 20
  • 21. One Dimensional Buffer ! Pointer to the data " Data can exist anywhere in memory ! Element count " Number of data elements ! Element width " Width, in bytes, of an element ! Callback parameter " NULL – no callback when the buffer is processed " Non-NULL – callback generated and this value passed to callback ! Processed Flag (filled in by device driver) " Set when the buffer is processed by the driver ! Processed Count (filled in by device driver) " Number of bytes processed in the buffer ! pNext " Pointer to the next buffer in the chain (NULL if the last/only buffer in chain) ! pAdditionalInfo " Pointer to any device specific information for the buffer " Not used by most devices 21
  • 22. Dataflow Methods ! Five dataflow methods " Chaining 1D and 2D buffers only " Chaining with loopback 1D and 2D buffers only " Sequential chaining Sequential 1D buffers only " Sequential chaining with loopback Sequential 1D buffers only " Circular Circular buffers only ! Device drivers " Must support at least 1 dataflow method ! PPI " 1D, 2D and Circular ! UART " 1D ! TWI " Sequential 1D 22
  • 23. Chaining Method ! Buffers are effectively “queued” to the device driver " Inbound buffers in one queue ! Buffers processed in the order they are received by adi_dev_Read() " Outbound buffers in another queue ! Buffers processed in the order they are received by adi_dev_Write() ! Buffers " Can be provided at any time " Submitted one at a time or in groups " Can point to data of different sizes ! Any,all or no buffers can be tagged to generate a callback ! Once processed, buffer is not used again unless resubmitted # # 23
  • 24. Chaining with Loopback Method ! Identical to chaining method except: " Device driver automatically loops back to the first buffer after the last buffer in the chain is processed " Buffers can be provided only when dataflow is stopped ! Application does not need to re-supply buffers " Lower overhead " Device driver never “starves” for data # # 24
  • 25. Sequential Chaining Method ! Buffers are effectively “queued” to the device driver " Fieldin buffer indicates direction (inbound or outbound) " Inbound and outbound buffers in one queue ! Buffers processed in the order they are received by adi_dev_SequentialIO() ! Buffers " Can be provided at any time " Submitted one at a time or in groups " Can point to data of different sizes ! Any,all or no buffers can be tagged to generate a callback ! Once processed, buffer is not used again unless resubmitted Outbound Inbound Inbound Outbound Outbound Inbound # # 25
  • 26. Sequential Chaining with Loopback Method ! Identical to sequential method except: " Device driver automatically loops back to the first buffer after the last buffer in the chain is processed " Buffers can be provided only when dataflow is stopped ! Application does not need to re-supply buffers " Lower overhead " Device driver never “starves” for data Outbound Inbound Inbound Outbound Outbound Inbound # # 26
  • 27. Streaming Command ! Can be used with any chained dataflow method " Chaining, chaining w/loopback, sequential, sequential w/loopback ! Assertions to device driver " Application will insure the driver never runs out of buffers " If buffers with callbacks are used, system timing insures interrupts won’t be lost ! Device drivers maximize throughput " Peripheral DMA supported devices use streaming DMA " Useful for audio and video ! Eliminates clicks, pops, glitches etc. 27
  • 28. Circular Dataflow Method ! Single buffer provided to device Sub-buffer 0 " Define ‘n’ sub-buffers within the buffer " Buffer size limit of 64K bytes Sub-buffer 1 ! Automatic wrap-around ! Callbacks supported Sub-buffer 2 " None " Everysub-buffer completion " Whole buffer completion … ! When supported by peripheral DMA " Leverages autobuffer capability Sub-buffer ‘n – 2’ Sub-buffer ‘n – 1’ 28
  • 29. Deciding on a Dataflow Method ! Circular " Data fits in a 64K byte contiguous block " Streaming type data " Audio frequently a candidate for circular dataflow ! Chained without loopback " Packet based data " Bursty data flow ! i.e. Ethernet, UART, USB etc. ! Chained with loopback " Steady data flow " Audio, Video ! Use streaming to avoid clicks/pops/glitches ! Sequential w/wout loopback " Half-duplex serial type devices ! TWI (I2C compatible) 29
  • 30. Typical Programming Sequence Opens the driver specifying the device, direction, handles to services etc. Configure the device for the dataflow method, and other configurable parameters Device Driver Application Provide buffers via adi_dev_Read(), adi_dev_Write () or adi_dev_SequentialIO() Enable dataflow Driver makes callback when buffer is filled Supply buffers via adi_dev_Read(), adi_dev_Write() or adi_dev_SequentialIO() 30
  • 31. UART Example ! Echo program for UART device driver " Characters entered in terminal are received by the Blackfin program and echoed back to the terminal ! Connect serial cable from BF537 EZ-Kit to PC ! Start hyperterminal " 57600 baud, 8 data bits, 1 stop bit, no parity ! Example demonstrates " Usage of the UART device driver " Chained dataflow method " Callbacks 31
  • 32. Programming Sequence for UART Example Open UART driver for bidirectional dataflow Configure UART driver for chained, baud rate, stop bits etc. Provide buffers for driver to fill via adi_dev_Read() UART Driver Application Enable dataflow Driver makes callback when buffer is filled Callback provides buffer for transmission out via adi_dev_Write() Driver makes callback when buffer is transmitted out Callback function provides buffer for driver to fill again via adi_dev_Read() 32
  • 33. Conclusion Device drivers provide: ! Faster development " Stable software base for application development ! Fewer variables " Less re-invention ! Do not need to create everything from scratch ! Modular software " Better compatibility ! Resource control is managed by the system services " Easier integration ! Multiple software components working concurrently ! Portability " Code portable to other Blackfin processors 33
  • 34. Additional Information ! Documentation " Device Drivers and System Services Manual for Blackfin Processors − http://www.analog.com/processors/manuals " Device Drivers and System Services Addendum (Sept 2005) − ftp://ftp.analog.com/pub/tools/patches/Blackfin/VDSP++4.0/ ! For questions, click “Ask A Question” button or send an email to Processor.support@analog.com 34