Analog Devices, Inc. · NASDAQ:ADI

Analog Devices — Technical Presentation (August 2010)

42 slides from Analog Devices's technical presentation, August 2010

  1. Slide 1: Using System Services Library and Device Drivers with VisualDSP++ Kernel in Blackfin Applications

    Slide 1: Using System Services Library and Device Drivers with VisualDSP++ Kernel in Blackfin Applications

    The World Leader in High Performance Signal Processing Solutions Using System Services Library and Device Drivers with VisualDSP++ Kernel in Blackfin Applications George Kadziolka President, Kaztek Systems

  2. Slide 2: Module Overview

    Slide 2: Module Overview

    Kaztek Systems Module Overview ANALOG DEVICES

  3. Slide 3: Why Use System Services Library and VisualDSP++ Kernel?

    Slide 3: Why Use System Services Library and VisualDSP++ Kernel?

    Why Use System Services Library and VisualDSP++ Kernel? The System Services Library (SSL) abstracts the low level hardware from the application, making it easier to develop for the Blackfin® processor. Application When an application requires a more involved infrastructure to deal with user I/O, dev

  4. Slide 4: System Services Library Device Drivers vs. VisualDSP++ Kernel

    Slide 4: System Services Library Device Drivers vs. VisualDSP++ Kernel

    System Services Library Device Drivers vs. VisualDSP++ Kernel The SSL Device Drivers (DD) work with VDK, and they supersede the VDK DD model for the Blackfin processor family • SSL DD for both on- and off-chip peripherals are actively developed and supported for Blackfin VDK offers a device driver p

  5. Slide 5: Demo Project Overview

    Slide 5: Demo Project Overview

    Demo Project Overview We will walk through the development of a Blackfin project that uses the System Services Library and Device Drivers (SSL/DD) in conjunction with the VisualDSP++ Kernel (VDK). • The demo project will be an Audio Talkthrough application using a pair of push-buttons as a simple up

  6. Slide 6: Prerequisites

    Slide 6: Prerequisites

    Prerequisites The viewer will need a basic understanding of the following concepts (available from existing Analog Devices online learning and development modules or from the multi- day Blackfin Workshop): • VDK basics • Creating VDK projects; setting up threads, semaphores, events, messages; inter-

  7. Slide 7: Blackfin Application Overview

    Slide 7: Blackfin Application Overview

    BLACKFIN APPLICATION OVERVIEW

  8. Slide 8: SSL/VDK Demonstration Project

    Slide 8: SSL/VDK Demonstration Project

    SSL/VDK Demonstration Project Multithreaded VDK Project • Messaging, semaphores, and events will be used for inter-thread synchronization SSL/DD • Several SSL managers, including Interrupt, External Bus Interface Unit (EBIU), Power, Port, Flag, and Device will be used in the demo project • EBIU and

  9. Slide 9: VDK Setup

    Slide 9: VDK Setup

    VDK Setup Four threads in total + main.c • Input • Process • Output • Volume_Ctrl • main.c • VDK and SSL will be initialized and started from main Thread instantiation will be done when VDK starts up • i.e., all four threads will be boot threads

  10. Slide 10: Thread Setup in Kernel Tab

    Slide 10: Thread Setup in Kernel Tab

    Thread Setup in Kernel Tab Project: SSL_DD_VDK_BOLD_App.dpj Parameter Value =] Kernel % System Ge Threads Maximum Running Threads 10 ~~ Thread Types > A Priority 5 Message Enabled true Thread Structure Heap system_heap Stack Heap system_heap Stack Size 255 Source File Input.c Header File Inputh -~™

  11. Slide 11: VDK Setup (continued)

    Slide 11: VDK Setup (continued)

    VDK Setup (continued) Semaphores • ADC_DATA_READY • Posted by the AD1871 Driver Callback to indicate that an Input buffer is ready for processing • DAC_DATA_SENT • Posted by the AD1854 Driver Callback to indicate that an Output buffer has been sent out the DAC Events • VOLUME_ADJUST • Indication tha

  12. Slide 12: Semaphore/Events Setup

    Slide 12: Semaphore/Events Setup

    Semaphore/Events Setup Project: SSL_DD_VDK_BOLD_App.dpj Parameter =] Kernel % System #-* Threads = Semaphores Heap =. & ADC_DATA_READY Initial Value Max Count Initial Delay Period f#-& DAC_DATA_SENT =f Event Bits =f UP_VOLUME Initial Value #- DOWN_VOLUME e-( Events 4) VOLUME_ADJUST Type (tt Dependen

  13. Slide 13: VDK Setup (continued)

    Slide 13: VDK Setup (continued)

    VDK Setup (continued) Message Loopback • Thread scheduling driven mainly by dataflow • IBUFF_PTR_CHANNEL Used to convey pointer to Input buffer that is ready for processing • OBUFF_PTR_CHANNEL Used to convey pointer to Output buffer that is to be filled • CONTROL_CHANNEL Used to convey volume contro

  14. Slide 14: VDK Control Summary Legend (1 of 3)

    Slide 14: VDK Control Summary Legend (1 of 3)

    VDK Control Summary Legend (1 of 3) PEND CHANNEL_ID Callback SEMAPHORE POST CHANNEL_ID MESSAGE Thread PEND O R POST EVENT CODE SIGNALS CONTROLS

  15. Slide 15: VDK Control Summary (2 of 3)

    Slide 15: VDK Control Summary (2 of 3)

    VDK Control Summary (2 of 3) POST IBUFF_PTR_CHANNEL PEN D IBU Input Buff Ptr FF_ POST PEND PTR AD1871 Input _C H Callback Thread AN N EL PEND RETURN_BUFF_CHANNEL ADC_DATA_READY RE PO T UR ST Input Buff Ptr N_ BU Process FF _C Thread HA NN EL EL D N N AN PE H _C TR _P EL FF ST NN U PO ST B HA O E L A

  16. Slide 16: VDK Control Summary (3 of 3)

    Slide 16: VDK Control Summary (3 of 3)

    VDK Control Summary (3 of 3) Process Thread PEND POST NNEL Set UP Event bit RETURN_BUFF_CHANNEL R N_BU FF_CHA RETU N EL VOLUME_MSG D N AN PE C H L_ Flag O PEND Volume_Ctrl R O Callback R Thread NT POST CO VOLUME_ADJUST CONTROL_CHANNEL VOLUME_MSG Set DOWN Event bit

  17. Slide 17: System Services Library Setup

    Slide 17: System Services Library Setup

    System Services Library Setup Initialize required services in main.c • Interrupt Manager • EBIU Manager • Specify SDRAM timing information • Power Manager • Specify CLKIN and Max Frequency information • Direct Memory Access (DMA) Manager • Port Control • Flag Control • Device Manager

  18. Slide 18: AD1871/AD1854 Device Drivers

    Slide 18: AD1871/AD1854 Device Drivers

    AD1871/AD1854 Device Drivers Open AD1871 and AD1854 Device Drivers in Input and Output threads, respectively Callbacks handled live • When opening drivers, place a NULL in the DCB Manager handle field Use circular buffer for data • Callback on sub buffer processed • Post a semaphore in the callback

  19. Slide 19: Flag Setup

    Slide 19: Flag Setup

    Flag Setup Set up appropriate flag pins to be used as interrupt sources • e.g., PB1 (UP) and PB2 (DOWN) on EZ-KIT Lite, going to PF2 and PF3, respectively Register a live callback with each of these two flag pins • If PF2, set UP_VOLUME event bit • If PF3, set DOWN_VOLUME event bit

  20. Slide 20: Thread Overview

    Slide 20: Thread Overview

    THREAD OVERVIEW ANALOG DEVICES

  21. Slide 21: main.c

    Slide 21: main.c

    main.c Technically not a thread • This is the same main() that gets called by the CRT after setup of the run-time environment Initialize VDK Calls adi_ssl_Init() function (part of adi_ssl_Init.c/h) • Found in …/Blackfin/Examples/Common Code/ folder • Responsible for initializing all required System

  22. Slide 22: main.c

    Slide 22: main.c

    main.c #include "VDK.h" #include "my_ssl_init.h" int main(void) { int result; VDK_Initialize(); if(result = my_ssl_Init()) VDK_DispatchThreadError ( VDK_kSSLInitFailure, result ); if(result = adi_pwr_SetFreq(0, 0, ADI_PWR_DF_NONE )) VDK_DispatchThreadError ( VDK_kSSLInitFailure, result ); Reset_ADC_

  23. Slide 23: System Services Library Customization

    Slide 23: System Services Library Customization

    System Services Library Customization SSL setup for a custom target board mainly impacts two managers • EBIU and Power EBIU Manager • Primarily manages the SDRAM (or DDR) controller • Can also specify Asynch bank configurations • Need to describe the data sheet timing parameters for the main externa

  24. Slide 24: EBIU Manager Configuration

    Slide 24: EBIU Manager Configuration

    EBIU Manager Configuration // first we will create a similar table that describes the timing information for the SDRAM we are using //in this case, we are using a pair of Micron MT48LC32M8A2-75 devices. From the datasheet, we get the following: ADI_EBIU_TIMING_VALUEtwrmin = {1,{7500, ADI_EBIU_TIMING

  25. Slide 25: Power Manager Configuration

    Slide 25: Power Manager Configuration

    Power Manager Configuration // next we will define which processor we are using and what the CLKIN frequency is // using a Command/Value pair configuration table ADI_PWR_COMMAND_PAIR MyCustomTarget_Power[] = { { ADI_PWR_CMD_SET_PROC_VARIANT,(void*)ADI_PWR_PROC_BF537SKBC1600 }, // 600Mhz ADSP-BF537 {

  26. Slide 26: Flag Setup Details

    Slide 26: Flag Setup Details

    Flag Setup Details u32 flag_Init(void) { int ssl_ret_value; // setup Volume Up pushbutton first ... if(ssl_ret_value = adi_flag_Open( PB_UP )) { // open desired flag pins return ( ssl_ret_value ); } // set the direction as Input if(ssl_ret_value = adi_flag_SetDirection( PB_UP, ADI_FLAG_DIRECTION_INP

  27. Slide 27: Input Thread

    Slide 27: Input Thread

    Input Thread adi_dev_Open() AD1871 Device Driver • Create Input buffer (ADI_DEV_CIRCULAR_BUFFER) • Set up live callbacks on ADI_DEV_EVENT_SUB_BUFFER_PROCESSED Perform other initializations • Pointer table for sub buffers and VDK_CreateMessage() with initial sub buffer address Steady state • VDK_Pend

  28. Slide 28: Process Thread

    Slide 28: Process Thread

    Process Thread Initialize message_mask • message_mask is used to identify which message channels to pend on Steady state • VDK_PendMessage(message_mask) on specified message channels • VDK_GetMessageReceiveInfo() and Switch on message channel • IBUFF_PTR_CHANNEL VDK_GetMessagePayload() to get Input

  29. Slide 29: Volume_Ctrl Thread

    Slide 29: Volume_Ctrl Thread

    Volume_Ctrl Thread Initializations • VDK_CreateMessage() with initial level setting, VDK_PostMessage() to Process thread Steady state • VDK_PendEvent() on VOLUME_ADJUST event • adi_flag_SuspendCallbacks() and VDK_Sleep() for some amount of time to allow keyswitch debounce • If VDK_GetEventBitValue(

  30. Slide 30: Output Thread

    Slide 30: Output Thread

    Output Thread adi_dev_Open() AD1854 Device Driver • Create Output buffer (ADI_DEV_CIRCULAR_BUFFER) • Set up live callbacks on ADI_DEV_EVENT_SUB_BUFFER_PROCESSED Perform other initializations • Pointer table for sub buffers • VDK_CreateMessage() with initial sub buffer address, VDK_PostMessage() to P

  31. Slide 31: Callbacks

    Slide 31: Callbacks

    Kaztek ) Systems CALLBACKS ANALOG DEVICES

  32. Slide 32: callback() function

    Slide 32: callback() function

    callback() function void callback (void* pHandle, u32 u32Arg, void* pArg); • pHandle is user defined and can be used to identify who generated the callback request • i.e., Flag? AD1871 driver? AD1854 driver? • In this application, pHandle will be used to pass an identifier for a semaphore or event •

  33. Slide 33: Input Thread Callback

    Slide 33: Input Thread Callback

    Input Thread Callback #include <services/services.h> // system service includes #include <drivers/adi_dev.h> // device driver includes void AD1871_callback (void* pHandle, u32 u32Arg, void* pArg ); void AD1871_callback (void* pHandle, u32 u32Arg, void* pArg ) { switch(u32Arg) { case ADI_DEV_EVENT_SU

  34. Slide 34: Registering Semaphore as a Callback Parameter

    Slide 34: Registering Semaphore as a Callback Parameter

    Registering Semaphore as a Callback Parameter Result = adi_dev_Open( adi_dev_ManagerHandle, &ADI_AD1871_EntryPoint, 0, (void*) kADC_DATA_READY, &AD1871_handle, ADI_DEV_DIRECTION_INBOUND, adi_dma_ManagerHandle, NULL, AD1871_callback ); if (Result != ADI_INT_RESULT_SUCCESS) { VDK_DispatchThreadError(V

  35. Slide 35: Demonstration

    Slide 35: Demonstration

    DEMONSTRATION ANALOG DEVICES

  36. Slide 36: Thread Status Display

    Slide 36: Thread Status Display

    Thread Status Display Parameter © Current Tick ~~ Threads &-~ Idle Thread -& Thread (ID : 1) (kinput) -~& Thread (ID : 2) (kProcess) &] Template Name Priority EI Stack Address &] Stack Size Max Stack Used &] NumTimesRun © CreationTime (cycles) © RunStartTime (cycles) © RunLastTime (cycles) ® RunTota

  37. Slide 37: Thread State History Display

    Slide 37: Thread State History Display

    Thread State History Display

  38. Slide 38: Thread State History Display (zoom)

    Slide 38: Thread State History Display (zoom)

    Thread State History Display (zoom)

  39. Slide 39: Summary

    Slide 39: Summary

    SUMMARY ANALOG DEVICES

  40. Slide 40: Summary

    Slide 40: Summary

    Summary We have demonstrated an approach to using System Services Library and Device Drivers with VDK when developing multithreaded applications for the Blackfin processor. • It is recommended that driver callbacks are handled live and then only post semaphores or set/clear event bits • Callbacks ca

  41. Slide 41: Resources

    Slide 41: Resources

    Resources For detailed information on the Blackfin architecture, please refer to the Analog Devices website, which has links to manuals, data sheets, FAQs, a knowledge base, sample code, development tools, and much more: • www.analog.com/blackfin Kaztek Systems provides worldwide technical training

  42. Slide 42: Thank You

    Slide 42: Thank You

    Ohvars " Ge va Kaztek Systems Thank You ANALOG DEVICES

Source: Internet Archive copy of analog.com

More decks from Analog Devices, Inc.

All 53 Analog Devices decks