1、Driver Development PSP, IOM, DDK,Chapter 14c C6000 Embedded Design Workshop Using BIOS,Copyright 2010 Texas Instruments. All rights reserved.,1,Objectives,Provide an overview of the options available for building/using driversDescribe how an IOM driver is built and the functions involvedDescribe wha
2、t is inside the Driver Development Kit (DDK)Provide references for more info,2,Outline,Driver Choices,Creating IOM Drivers,3,Creating/Modifying Drivers,Users have several choices when developing drivers:,PSP Platform Support Package,Use available PSP drivers (could contain more or less than you need
3、)Modify PSP driver (see DDC layer)Do NOT attempt to develop your own PSP driver,1,IOM/DDK I/O Mini Drivers using DDK (Driver Development Kit),Using the DDK, you can create your own IOM-compliant driverCould be the most efficient implementation,2,CSL Chip Support Library APIs,IOM and PSP are built on
4、 CSL APIs underneathNot recommended archaic and prone to errors (but doable),3,4,Modifying PSP Drivers,Online Wiki PSP Overview,Modifying PSP Drivers (see DDC layer),5,Outline,Driver Choices,Creating IOM Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,6,Outline,Driver Choices,Creating IO
5、M Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,7,SIO Review,Common I/O interface: between Tasks and Devices Universal interface to I/O devices Yields improved code maintenance and portability Number of buffers and buffer size are user selectable Unidirectional: streams are input or ou
6、tput - not both Efficiency: block passed by reference instead of by copy SIO_issue passes a “IOM_Packet” buffer descriptor to driver via stream SIO_reclaim waits for a IOM_Packet to be returned by driver via stream Abstraction: TSK author insulated from underlying functionality BIOS (SIO) implicitly
7、 manages two QUEues (todevice & fromdevice) SIO_reclaim synchronized via implicitBIOS (DIO) SEM IOM_Packets (aka DEV_Frames) produced by SIO on stream creation Asynchronous: TSK and driver activity is independent, synchd by buffer passes Buffers: Data buffers must be created - by config tool or TSK,
8、MY_DSP_algo,Task,issue,reclaim,Output IOM,issue,reclaim,SIO,Input IOM,SIO,8,Outline,Driver Choices,Creating IOM Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,9,BIOS I/O Models,Class Drivers,I/O Mini- driver,SIO,Processing Thread Options,Original DEV coding now broken into two parts Cla
9、ss Driver provided by TI I/O Mini Driver I/F to HW (port/peripheral); from DDK, etc Process Thread Author: Choose the class and I/O Mini-drivers desired Same IOM for any class driver “write once, use many Change of Mini-Drivers : new driver, same processing thread & class driver,DIO,TSK or SWI,custo
10、m,GIO,PIP,PIO,SWI,equiv. of old Device Driver “DEV” specn,A single mini-driver can be used with any DSP/BIOS I/O model,10,MiniDriver: Interface to TSK or SWI,myTsk()SIO_create MEM_alloc SIO_issue SIO_issuewhile(1) SIO_reclaim dsp. SIO_issueSIO_idle SIO_reclaim SIO_reclaim MEM_free SIO_delete,createS
11、wi()SIO_create MEM_alloc SIO_issue SIO_issue executeSwi()SIO_reclaim dsp. SIO_issue deleteSwi()SIO_idle SIO_reclaim SIO_reclaim MEM_free SIO_delete,dio_codec . SEM_pend() SEM_post() ? SWI_post() . md_SubmitChan,md_codec .,11,IOM Methods Concepts 1/5,DSK5402_MCBSP_AD50_init - usually an empty fxn,mdB
12、indDev(dgp, devid, dparams) - initialize parameters - acquire resources - initialize h/w - plug ISRs - create/initialize global data structure (devObj),BIOS_init mdBindDev main,12,IOM Methods Concepts 2/5,BIOS_init mdBindDev main myTsk()SIO_create MEM_alloc SIO_issue SIO_issuewhile(1)I SIO_reclaim d
13、sp. SIO_issueSIO_idle SIO_reclaim SIO_reclaim MEM_free SIO_delete,DSK5402_MCBSP_AD50_init - usually an empty fxn,mdBindDev(dgp, devid, dparams) - initialize parameters - acquire resources - initialize h/w - plug ISRs - create/initialize global data structure (devObj),SIO: - create SIO object - creat
14、e IO Packets - call DIO,mdCreateChan() - create QUE - create chan object - enable interrupt,DIO: - create DIO object - create QUE - call mdCreateChan,13,IOM Methods Concepts 3/5,BIOS_init mdBindDev main myTsk()SIO_create MEM_alloc SIO_issue SIO_issuewhile(1)I SIO_reclaim dsp. SIO_issueSIO_idle SIO_r
15、eclaim SIO_reclaim MEM_free SIO_delete,DSK5402_MCBSP_AD50_init - usually an empty fxn,mdBindDev(dgp, devid, dparams) - initialize parameters - acquire resources - initialize h/w - plug ISRs - create/initialize global data structure (devObj),SIO: - create SIO object - create IO Packets - call DIO,DIO
16、: - create DIO object - create QUE - call mdCreateChan,mdCreateChan() - create QUE - create chan object - enable interrupt,SIO: - put *buf in IOP - queue IOP - call DIO,mdSubmitChan() - if no current IOP, begin using this one - else QUE for later use,IOM: ISR - fill buf with data,14,IOM Methods Conc
17、epts 4/5,BIOS_init mdBindDev main myTsk()SIO_create MEM_alloc SIO_issue SIO_issuewhile(1)I SIO_reclaim dsp. SIO_issueSIO_idle SIO_reclaim SIO_reclaim MEM_free SIO_delete,DSK5402_MCBSP_AD50_init - usually an empty fxn,mdBindDev(dgp, devid, dparams) - initialize parameters - acquire resources - initia
18、lize h/w - plug ISRs - create/initialize global data structure (devObj),SIO: - create SIO object - create IO Packets - call DIO,DIO: - create DIO object - create QUE - call mdCreateChan,mdCreateChan() - create QUE - create chan object - enable interrupt,SIO: - put *buf in IOP - queue IOP - call DIO,
19、DIO: - dequeue IOP - pass IOP to IOM - call mdSubmitChan,mdSubmitChan() - if no current IOP, begin using this one - else QUE for later use,SIO: call DIO,DIO: SEM_pend(),IOM: ISR - fill buf with data,15,IOM Methods Concepts 5/5,BIOS_init mdBindDev main myTsk()SIO_create MEM_alloc SIO_issue SIO_issuew
20、hile(1)I SIO_reclaim dsp. SIO_issueSIO_idle SIO_reclaim SIO_reclaim MEM_free SIO_delete,DSK5402_MCBSP_AD50_init - usually an empty fxn,mdBindDev(dgp, devid, dparams) - initialize parameters - acquire resources - initialize h/w - plug ISRs - create/initialize global data structure (devObj),SIO: - cre
21、ate SIO object - create IO Packets - call DIO,DIO: - create DIO object - create QUE - call mdCreateChan,mdCreateChan() - create QUE - create chan object - enable interrupt,SIO: - put *buf in IOP - queue IOP - call DIO,DIO: - dequeue IOP - pass IOP to IOM - call mdSubmitChan,mdSubmitChan() - if no cu
22、rrent IOP, begin using this one - else QUE for later use,IOM: ISR - fill buf with data - when full/empty, run cbFxn(arg, IOP),SIO: call DIO,DIO: SEM_pend(),DIO: callback fxn - queue IOP - SEM_post() - rtn to SIO,SIO: - deque IOP - get buf info from IOP & rtn to TSK,16,Outline,Driver Choices,Creating
23、 IOM Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,17,Device Driver Developers Kit: DDK,Productized Drivers for TI DSP Peripherals Simple Example Applications that Use These Drivers Documentation on Using Existing Drivers & Developing New Drivers Downloadable : Free of Charge / No Run-
24、time Royalties Available via: CCS Update Advisor TI DSP Developers Village () www.TI.com Example Drivers:,18,DDK Documentation,Start Here: DSP/BIOS Driver Developers Guide (SPRU616),Each Device Driver Has Corresponding Documentation (App Note) Usage, Architecture, Data Sheet Every Device Driver proj
25、ect has a Readme File,19,DDK Summary,Productized IOM Drivers for TI DSP Peripherals PCI, USB, Multimedia Card, McBSP, McASP, Video Ports, Codecs, UART Full source code and documentation provided Introduces the new IOM Driver Model to simplify development of new drivers Reusable modules Standard APIs
26、 defined Backwards-compatability is maintained for older BIOS code which uses older driver models Extensible, integrated DSP/BIOS I/O Modules New DEV, PIO, GIO APIs,20,DSP/BIOS McBSP Codec Driver,Generic McBSP-DMA Data Mover Implemented as a stand-alone mini-driver Multi-channel Reusable across code
27、cs Codec Specific Part of Mini-Driver Handles codec specific bind, channel open AIC23, PCM3002, AD50, AD535 Only mdSubmitChan and mdCreateChan Calls Are Handled by the Codec-Specific Portion of the Mini-Driver, So Thats All You Have To Write!,Application/Framework,Device Driver,PIP,PIO Adapter,SIO,D
28、IO Adapter,GIO,Class Driver,Codec-Specific Part of Mini-Driver,Generic McBSP-DMA Data Mover,Mini- Driver,21,Outline,Driver Choices,Creating IOM Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,22,IOM Functions,typedef struct IOM_Fxns IOM_TmdBindDev mdBindDev; initialize port on BIOS start
29、upIOM_TmdUnBindDev mdUnBindDev; currently null fxn, poss. future useIOM_TmdControlChan mdControlChan; response to SIO_ctrl()IOM_TmdCreateChan mdCreateChan; response to SIO_create()IOM_TmdDeleteChan mdDeleteChan; response to SIO_delete()IOM_TmdSubmitChan mdSubmitChan; SIO_issue, _idle, _abort respons
30、e IOM_Fxns;Also, an ISR/HWI is required within the IOM to collect/output the data to/from the buffer issued to the IOM, and route the completed buffer back to the processing thread (TSK, SWI) as a response to the SIO_reclaim() API,23,Outline,Driver Choices,Creating IOM Drivers,SIO Review,Concepts,DDK,IOM Functions,For More Info,24,DDK/IOM For More Information,Download,25,ti,Outline,MainHighlight,MainNormal,SubHighlight,SubNormal,27,Outline,MainHighlight,MainNormal,SubHighlight,SubNormal,28,