Home
(IDK) Video Device Driver User's Guide
Contents
1. 4 2 4 2 Draw a Box in 640x480x8 Display Mode Draw a Box in 640x480x8 Display Mode void Ui in in VD dx dy fo wh tskMainFunc nt8 d t x y dx dy t frameCnt configure the display harwdare IS_config VDIS_640X480X8 get information about the display settings VDIS_settings hres VDIS_settings vres let s go around for three display frames to ensure we render all three display buffers r frameCnt 0 frameCnt lt 3 frameCnt grab the next available display buffer d Uint8 VDIS_toggleBuffs SYS_FOREVER fill display with solid color for y 0 y lt dy y for x 0 x lt dx x d dx y x 0x80 CACHE_flush CACHE_L2ALL 0 0 draw a box around perimeter of display for x 0 x lt dx x d dx 0 x OxFF top for x 0 x lt dx x d dx dy 1 x OxFF bottom for y 0 y lt dy ytt d dx y 0 OxFF left for y 0 y lt dy ytt d dx y dx 1 OxFF AE LLGAE e27 CACHE_flush CACHE_L2ALL 0 0 loop forever ile 1 VDIS_toggleBuffs SYS_FOREVER A Examples 4 3 NTSC Capture to 640x480x16 Display Loopback 4 3 NTSC Capture to 640x480x16 Display Loopback A3 f void tskMainFunc VCAP_Frame input Uint16 output int frameCnt line int ddx ddy cdx cdy Vinte y1 7 erl1
2. flush the cache CACHE_flush CACHE_L2ALL 0 0 cdx cax 2 cdx 2 Examples 4 5 NTSC Capture to 640x480x8 Display Loopback 4 4 NTSC Capture to 640x480x8 Display Loopback void tskMainFunc VCAP_Frame input Uint8 output int frameCnt line int ddx ddy cdx cdy Uint8 yl y2 VDIS_config VDIS_640X480X8 VCAP_config VCAP_NTSC ddx VDIS_settings hres ddy VDIS_settings vres cdx VCAP_settings hres cdy VCAP_settings vres loop forever while 1 4 6 get video buffers input VCAP_getFrame SYS_FOREVER output Uint8 VDIS_toggleBuffs 0 yl Uint8 input gt yl1 y2 Uint8 input gt y2 grab frame for line 0 line lt cdy 2 linet copy odd field Y only DAT_copy amp yl cdx line amp yBuff 2 cdx line cdx copy even field Y only DAT_copy amp y2 cdx line amp yBuff 2 cdx linetcdx cdx DAT_wait DAT_XFRID_WAITALL copy Y data to output display buffer Ky NTSC Capture to 640x480x8 Display Loopback for line 0 line lt cdy 3 line DAT_copy amp yBuff cdx line amp output ddx ddy cdy 2 ddx cdx 2 ddx line cdx DAT_wait DAT_XFRID_WAITALL flush the cache CACHE_flush CACHE_L2ALL 0 0 i af Examples 4 7
3. VDIS_config VDIS_640X480X8 to prime up all three display buffers for x 0 x lt 3 x buff VDIS_toggleBuffs SYS_FOREVER VDIS_fill buff 0x80 this example will fill a color display with bright blue VDIS_open VDIS_config VDIS_640X480X16 to prime up all three display buffers for x 0 x lt 3 x buff VDIS_toggleBuffs SYS_FOREVER VDIS_fill buff 0x001F Built in interrupt service routine for display driver int VDIS_isr none none This is the built in interrupt service routine for the display driver The user should never call this function directly It is exported globally so that it can be referenced in the interrupt service table When using DSP BIOS HWI EXTINT6 must be set to call this function and the Use Dispatcher box MUST be checked VDIS_reset VDIS_open Opens display device Function Arguments Return Value Description Example VDIS_reset Function Arguments Return Value Description Example int VDIS_open none success Returns 0 on failure Failure could happen if required system resources could not be allocated This function opens the display device and must be called before calling any other display APIs Generally this function is called only once at the beginning of your program VDIS_reset is called and system resources are allocated To free up these resources call VDIS_close H
4. again you only close a device when completely done with it Generally an application will open the devices at the beginning and leave them open indefinitely J Open device m VDIS_open m VCAP_open LJ Call device APIs VDIS_config VDIS_toggleBuffs VDIS_fill VCAP_config VCAP_getFrame J Close the devices usually not done m VDIS_close m VCAP_close The open functions are used to do certain initialization and allocates system resources such as EDMA channels Closing a device frees up any resources allocated during open Overview 1 3 Software Architecture 1 3 Software Architecture The device driver software architecture is illustrated in Figure 1 1 It shows the different modules and the interfacing between them The VCARD block repre sents the capture and display drivers The top level modules for the drivers are VDIS and VCAP The VDIS module defines the video display API and the VCAP module defines the video capture API The VDIS module interfaces into the TVP2036 submodule which is responsi ble for configuring the RAMDAC The capture side is a little more complex the VCAP module interfaces to the TVP5022 video decoder module that in turn interfaces to the 12C module and two micro code modules All modules potentially interface into the CSL and DSP BIOS At the top is the application It interfaces into the VCAP and VDIS module and of course may interface into the CSL and DSP BIOS The drive
5. cbl y2 4cr2 eb2 VDIS_config VDIS_640X480X16 VCAP_config VCAP_NTSC ddx VDIS_settings hres ddy VDIS_settings vres cdx VCAP_settings hres cdy VCAP_settings vres loop forever while 1 get video buffers input VCAP_getFrame SYS_FOREVER synchronize to the capture system K output Uint16 VDIS_toggleBuffs 0 yl Uint8 input gt yl1 crl Uint8 input gt cr1l cbl Uint8 input gt cbl y2 Uint8 input gt y2 er2 Uint8 input gt cr2 cb2 Uint8 input gt cb2 grab frame for line 0 line lt cdy 2 linet copy odd field over to working buffer DAT DAT DAT 4 4 _copy amp yl cdx line amp yBuff 2 cdx line cdx _copy amp crl cdx line 2 amp crBuff cdx line cdx 2 _copy amp cb1l cdx line 2 amp cbBuff cdx line cdx 2 NTSC Capture to 640x480x16 Display Loopback copy even field over to working buffer DAT_copy amp y2 cdx line amp yBuff 2 cdx line cdx DAT_copy amp cr2 cdx line 2 amp crBuff cdx linetcdx 2 DAT_copy amp cb2 cdx line 2 amp cbBuff cdx linetcdx 2 DAT_wait DAT_XFRID_WAITALL do color space conversion for line 0 line lt cdy 3 linet yebcr422pl1_to_rgb565_asm coeffs amp yBuff cdx line amp crBuff cdx 2 line amp cbBuff cdx 2 line amp output ddx ddy cdy 2 ddx cdx 2 ddx line cdx
6. Dispatcher box MUST be checked Opens capture device int VCAP_open none success Returns 0 on failure Failure could happen if required system resources could not be allocated This function opens the capture device and must be called before calling any other capture APIs Generally this function is called only once at the beginning of your program VCAP_reset is called and system resources are allocated To free up these resources call VCAP_close Here are the steps taken Check to make sure the capture is not already open i Dynamically create a DSP BIOS semaphore g Call VCAP_reset _j Returns success VCAP_open Resets capture hardware int VCAP_reset none none Video Capture System 3 11 VCAP_settings Description Example VCAP_settings Global Variable Members Description Example 3 12 This function resets the capture hardware which in effect turns it off Here are the steps taken Check to make sure capture is open Clears all FPGA capture registers Disables and clears the capture CPU interrupt Updates VCAP_settings Returns E E E E VCAP_reset Display Code at Selected Address extern far VCAP_Settings VCAP_settings mode Current mode i e VCAP_NTSC hres Horizontal resolution in pixels i e 640 vres Vertical resolution in pixels i e 480 fps Capture rate in frames per second i e 30 This is a global variable exported out of the VCAP mod
7. capture device and frees up any resources allocated during VCAP_open The capture is also reset Generally this function is never called because video applications are usually infinite processing loops Hence the capture is always left open Here are the steps taken 4 Check to make sure the capture is open J Call VCAP_reset Delete the DSP BIOS semaphore _j Returns Example VCAP_close VCAP_config Configures and enables capture hardware Function int VCAP_config int mode Arguments mode Specifies capture mode Supported modes are Return Value Description Example Li VCAP_NTSC 640x480 YCbCr 4 2 2 square pixel 30 fps J VCAP_PAL 768x576 YCbCr 4 2 2 square pixel 25 fps success Returns zero on failure This function configures and enables the capture hardware for the mode spe cified VCAP_config 1l Video Capture System 3 9 VCAP_getFrame Wler Me ige luicmems Returns most recent captured frame of video data Function Arguments Return Value Description Example VCAP_Frame VCAP_getFrame int timeout timeout Specifies how to wait for a new frame 0 don t wait at all n wait for n ticks SYS _ FOREVER wait for ever frame Returns a frame pointer to the latest captured frame The frame object has the following fields void y1 void cr1 void cb1 void y2 void cr2 void cb2 E E E E E E This function returns the most recent captured frame of video
8. of video image processing A key component of this system is the video device drivers that offer a simple API for accessing the video hardware This document describes these drivers and how to use them Topic Page 1 1 Software Module Block Diagram cece eee eee eee H 2 1 2 Using the Driver Library 0 0ceeeeeeeeeeeeeeeeeeeeeeees f1 3 1 3 Software Architecture c s eneee eeen eee Software Module Block Diagram 1 1 Software Module Block Diagram The video hardware has a video capture subsystem with a TVP5022 video de coder chip and a video display subsystem with a TVP3026 RAMDAC There are two independent APIs one for video display VDIS module and one for video capture VCAP module The drivers depend on DSP BIOS II and take advantage of the tasking model using semaphores The drivers also use the chip support library CSL for all on chip DSP peripheral access The driver software is written specifically for the imaging daughter card de signed by TI However the APIs are simple enough that it may possible to port the driver APIs to other hardware platforms The display driver uses triple buffering and these buffers are stored in the DSK s SDRAM The display hardware generates line events that are tied to an EDMA channel that in turn transfers lines of video from the display buffers to the display hardware This display data is sent to the RAMDAC and output onto a standard 15 pin VGA monitor conn
9. rate then the function will continuously return the same frame until a new one comes in On the other hand if the application requests buffers at a rate slower than the capture rate then some captured frames will get lost overwritten Using the Capture APIs 3 4 Using the Capture APIs Once the capture is opend and configured the application only has to call VCAP_getFrame to obtain a new frame of captured data This function takes one argument timeout that determines how to wait Possible values are 0 n or SYS_FOREVER If 0 is used the function will not wait at all and immediately return the next buffer If n an integer value is used then the function will wait for at least that many system ticks see DSP BIOS users guide for a new frame to become available Then the next frame is returned regardless if a new one came in or not Specifying SYS_FOREVER causes the function to wait indefinitely for a new frame to arrive This waiting is done by blocking on a built in semaphore there is no spinning This semaphore is posted once every ver tical sync by the interrupt service routine If you want your application to be syn chronized with the capture use VCAP_getFrame SYS_FOREVER If your application is synchronized some other way with display for example then use VCAP_getFrame 0 cca Note Since VCAP_getFrame blocks on a semaphore it is important that this function ONLY be called from the context of a DSP BIOS task T
10. reset to the beginning of the buffer again These EDMA opera tions happen at a fairly high rate up to around 40 000 transfers per second and transfer up to 1600 bytes each so they are submitted at a high priority see op tions field of EDMA parameters Cae Note Since the display driver depends on DSP BIOS and interrupts are used it is important that the display interrupt service routine VDIS_isr is configured into HWI EXTINT6 in the DSP BIOS configuration tool Also the Use Dis patcher box must be checked If this is not done the display interrupt will never get called and the display semaphore will never get posted Video Display System 2 3 Triple Buffering Scheme 2 3 Triple Buffering Scheme A triple buffering scheme is used for the display such that the application can always get a new buffer without waiting if so desired It works like this one of the buffers is active meaning that the EDMA events are currently moving data from that buffer to the display hardware A second buffer is owned by the application user it s the one your application is currently rendering into The third buffer is the next one the application will get upon calling VDIS_toggle Buffs intermediate As you can see having three buffers allows the ap plication to obtain a buffer without waiting for a new frame If there were only two buffers the swap could only occur on frame boundaries which would mean waiting If the applic
11. 2 Display Timing and Events 0 00 cece eee tee eee eae 2 3 Triple Buffering Scheme 000s cece eee eee tenes 2 4 Using the Display APIs 0 0 aanne 2 5 Display Buffer Format vcerscee sad eeeeterebdecetimee bad eebi oes anewe aaa 2 6 Video Display API Reference VDIS 0 0 00 cece teeta Video Capture System 0c cece eee eee eee 3 1 Capture Block Diagram 1 0 0 0 ccc tee eee eae 3 2 Capture Timing and Events 0 00 cece eee teeta 3 3 Triple Buffering Scheme 0 0 c anane 3 4 Using the Capture APIS 0 ccc ete n eee eae 3 5 Capture Buffer Format 0 cece nett nent neae 3 6 Video Capture API Reference VCAP 0 0c cece eect e eee eee eae CULL 9 ann Re Re eR Re ear nee eee pee ee RR 4 1 Draw a Box in 640x480x16 Display Mode 0 c cece eee ees 4 2 Draw a Box in 640x480x8 Display Mode 02 cece ees 4 3 NTSC Capture to 640x480x16 Display Loopback 4 4 NTSC Capture to 640x480x8 Display Loopback Figures OWwWNND oe N vi Software Architecture Video Display Subsyst Display Buffer Format Video Capture Subsys Capture Buffer Format em Block Diagram tem Block Diagram Chapter 1 Overview The Imaging Developer s Kit or IDK is a complete system consisting of hard ware and software designed to demonstrate the capabilities of Tl s TMS320C6000 family of DSPs in the field
12. Block Diagram 3 1 Capture Block Diagram Figure 3 1 shows the block diagram of the video capture subsystem First of all three capture buffers are hardwired into the SDRAM of the daughter card and a triple buffering scheme is used The daughter card is designed such that data coming in from the TVP5022 decoder chip is automatically stored in the daughter card SDRAM at the appropriate location Software determines which of the three buffers the capture harwdare stores into Figure 3 1 Video Capture Subsystem Block Diagram Daughter Card Video Capture SDRAM Last Active v La TVP5022 NTSC Input Cb1 Cri Y2 y ao 73E DS ra LL Y hak 6711 DSP EMIF Zz INTSEL k Lu Capture Timing and Events 3 2 Capture Timing and Events One event is tied from the capture subsystem to the DSP This is EXTINT5 trig gered by every other VSYNC once per frame which is every other field from the TVP5022 chip and is configured to generate a CPU interrupt The interrupt service routine is defined internal to the driver VCAP_isr This ISR does nothing more than post the capture semaphore which is used by the VCAP_getFrame function to wait for new frames The capture buffers are directly mapped into the DSP s address space as read only This means the CPU or EDMA can directly read these buffers ET Note Since the capture dr
13. Configures the TVP3026 Configures the EDMA Configures the display interrupt Enables everything Synchronizes for two frames Returns O O O O C C C O O L VDIS_config VDIS_640X480X16 Fills buffer with specified pixel value void VDIS_fill void buff Uint32 pixel buff Pointer to display buffer to fill usually obtained by a call to VDIS_toggleBuffs pixel The pixel value to fill with Depends on display mode for 8 bit mode only lower 8 bits are used For 16 bit mode lower 16 bits are used none This function fills a buffer with a specified pixel value The buffer is assumed to have the dimensions defined in VDIS_settings The fill is performed using a CPU for loop and if the current display mode is 8 bpp then 8 bit CPU stores are performed If 16 bpp then 16 bit stores are performed This function in no way attemps to flush the cache when done with the fill operation So keep in mind that after calling VDIS_fill some of the fill data may still be sitting in cache It is up to the user to flush the cache when appropriate Video Display System 2 9 VDIS _isr Example 1 Example 2 VDIS_isr Function Arguments Return Value Description 2 10 Also note that filling a display buffer does not mean it will be displayed right away You still have to cycle that buffer until it is active by calls to VDIS_toggle Buffs this example will fill a greyscale display with light grey La VDIS_open
14. TMS320C6000 Imaging Developer s Kit IDK Video Device Driver User s Guide Literature Number SPRU499 December 2000 wi E TEXAS is 2 SOYINK m INSTRUM ENTS Printed on Recycled Paper IMPORTANT NOTICE Texas Instruments and its subsidiaries Tl reserve the right to make changes to their products or to discontinue any product or service without notice and advise customers to obtain the latest version of relevant information to verify before placing orders that information being relied on is current and complete All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgment including those pertaining to warranty patent infringement and limitation of liability Tl warrants performance of its semiconductor products to the specifications applicable at the time of sale in accordance with Tl s standard warranty Testing and other quality control techniques are utilized to the extent Tl deems necessary to support this warranty Specific testing of all parameters of each device is not necessarily performed except those mandated by government requirements Customers are responsible for their applications using TI components In order to minimize risks associated with the customer s applications adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards Tl assumes no liability for applications assistance or customer product desi
15. allocated for the worst case that is 800x600x16 960 000 bytes each times 3 2 880 000 bytes total When a lower resolution is used some of the space is left unused Figure 2 1 Video Display Subsystem Block Diagram Daughter Card Display Timing TVP3026 To RGB Display RAMDAC Display FIFO A is 5e g 5S FE DSK SDRAM gt Active 6711 DSP EMIF ri Display Buffer 0 zZ x lt i INTSEL i EXTINT6 Intermediate gt Display Buffer 1 Lp User EDMA Controller Display Buffer 2 Display Timing and Events 2 2 Display Timing and Events The Timing block of the diagram is implemented in an FPGA and generates the display HSYNC and VSYNC signals based on programmable parameters VSYNC is connected to EXTINT6 and the HSYNC is connected to EXTINT7 EXTINT6 is configured to generate a CPU interrupt and the interrupt service routine is defined in the video driver VDIS_isr This ISR does nothing more than post the display semaphore which is used by the VDIS_toggleBuffs function to wait for new frames EXTINT7 is configured to trigger an EDMA event that copies one line of display data from the current display buffer to the daughter card FIFO This line of video then gets displayed through the TVP3026 The EDMA parameters are setup to autoincrement to the next line then after a whole frame is displayed the parameters
16. ation attempts to receive buffers faster than they can be displayed 60Hz for example then some frames will be missed This can happen if you call VDIS_toggleBuffs 0 which basically gets the next buffer without waiting for a new one to become available If you call this faster than the display rate then the function will swap between the user buffer and the intermediate buffer over and over again Hence you may end up loosing a frame but no harm is done On the other hand if the application requests buffers at a rate slower than the display rate then some frames will get displayed repeatedly This is because the active buffer will only change if the user called VDIS_toggleBuffs since the last new frame came in Using the Display APIs 2 4 Using the Display APIs Once the display is opend and configured the application only has to call VDIS_toggleBuffs to obtain a new buffer to render into This function takes one argument timeout that determines how to wait Possible values are 0 n or SYS_FOREVER If 0 is used the function will not wait at all and immediately return the next buffer If n an integer value is used then the function will wait for at least that many system ticks see DSP BIOS users guide for a new frame to become available Then the next frame is returned regardless if a new one came in or not Specifying SYS_FOREVER causes the function to wait indefinitely for a new frame to arrive This waiting is done by blocking o
17. ct differently depending on display settings Note Do not write to any members of this structure it is intended to be read only This structured is altered by VDIS_open VDIS_config and VDIS_reset Generally the user calls VDIS_config then uses information from this struc ture Example VDIS_config VDIS_640X480X16 dx VDIS_settings hres dy VDIS_settings vres VOIRE Ce GE Toggles display buffers Function void DIS_toggleBufffs int timeout Arguments timeout Specifies how to wait for a new available display buffer 0 don t wait at all n wait for n ticks SYS _ FOREVER wait for ever Return Value buff Returns a pointer to a free display buffer 2 12 Description Example VDIS_toggleBuffs This function toggles the display buffers and returns a pointer to a free display buffer You have a choice of how you want to wait for the new buffer to become available Specifying 0 means don t wait at all This will return the current avail able buffer regardless if a new display event has occured since the last time you called this function Specifying a positive integer causes this function to block on a semaphore for n system ticks until a new display event occurs If a new event does not occur by the time n ticks expires then the most current free buffer is returned Specifying SYS_FOREVER causes this function to block on a semaphore until a event occurs The display hardware generates an interru
18. data You have a choice of how you want to wait for the new frame Specifying 0 means don t wait at all This will return the most recent frame captured regardless if a new frame has arrived since the last time you called this function Specifying a posi tive integer causes this function to block on a semaphore for n system ticks until a new frame arrives If a new frame does not arrive by the time n ticks ex pires then the most recent frame is returned Specifying SYS_ FOREVER causes this function to block on a semaphore until a new frame arrives The capture hardware generates an interrupt everytime a new frame arrives The interrupt service routine posts the capture semaphore The return value is a pointer to a VCAP_Frame object whose members are pointers to each component of the captured frame VCAP_Frame input while 1 input VCAP_getFrame SYS_FOREVER VCAP_reset VCAP_isr Built in interrupt service routine for capture driver Function void VCAP_isr Arguments Return Value Description VCAP_open Function Arguments Return Value Description Example VCAP_reset Function Arguments Return Value none none This is the built in interrupt service routine for the capture driver The user should never call this function directly It is exported globally so that it can be referenced in the interrupt service table When using DSP BIOS HWI EXTINT5 must be set to call this function and the Use
19. e 4 1 Draw a Box in 640x480x16 Display Mode 0 00ees 4 1 4 2 Draw a Box in 640x480x8 Display Mode 00eeseeees 4 2 4 3 NTSC Capture to 640x480x16 Display Loopback 4 3 4 4 NTSC Capture to 640x480x8 Display Loopback 4 4 Draw a Box in 640x480x16 Display Mode 4 1 Draw a Box in 640x480x16 Display Mode void tskMainFunc Uintl6 d int x y dax dy int frameCnt configure the display harwdare VDIS_config VDIS_640X480X16 get information about the display settings dx VDIS_settings hres dy VDIS_settings vres let s go around for three display frames to ensure we render all three display buffers for frameCnt 0 frameCnt lt 3 frameCnt grab the next available display buffer d Uint16 VDIS_toggleBuffs SYS_FOREVER fill display with solid color for y 0 y lt dy ytt for x 0 x lt dx x d dx y x 0x001F CACHE_flush CACHE_L2ALL 0 0 draw a box around perimeter of display for x 0 x lt dx x d dx 0 x OxF800 top EJ for x 0 x lt dx x d dx dy 1 x 0xF800 bottom for y 0 y lt dy y d dx y 0 OxF800 left for y 0 y lt dy y d dx y dx 1 OxF800 right CACHE_flush CACHE_L2ALL 0 0 loop forever while 1 VDIS_toggleBuffs SYS_FOREVER Ay
20. ector The display hardware also generates a frame interrupt to the DSP every vertical sync The display driver processes this interrupt and uses it to synchronize with the application using a DSP BIOS semaphore The daughter card has dedicated SDRAM for video capture data and triple buffering is used Composite video input goes into a video decoder chip that in turn is written into the capture RAM The capture RAM is memory mapped into the DSPs address space read only This allows the DSP to directly read the frames of captured video The capture hardware also generates frame events that trigger an interrupt to the DSP every vertical sync The capture driv er processes this interrupt and uses it to synchronize with the application using a DSP BIOS semaphore Using the Driver Library 1 2 Using the Driver Library You need to do the following to use the drivers J Include the driver header files m include lt vdis h gt to use display driver E include lt vcap h gt to use capture driver _j Link in the driver library E vcard lib Predefine processor ID symbol required for CSL see CCS project op tions under Compiler gt Preprocessor m d CHIP_6711 J Link in the CSL library file m Icsl6711 lib There are a couple basic steps every application needs to do to use the driver APIs Open a device capture or display call the device APIs then close it when done Once a device is open the APIs may be called over and over
21. ere are the steps taken Check to make sure the display is not already open Open EDMA channel Allocate EDMA reload parameter tables Dynamically create a DSP BIOS semaphore Call VDIS_reset Returns O O O O O L success VDIS_open Resets display hardware int VDIS_reset none none This function resets the display hardware which in effect turns it off Here are the steps taken Check to make sure display is open Disables EDMA channel Clears all FPGA timing parameters Fills all display buffers with O Updates VDIS_settings structure Disables and clears the display CPU interrupt Returns O O O C C O L VDIS_reset Video Display System 2 11 VDIS_ settings VDIS_ settings Global variable exported out of VDIS module Global Variable extern far VDIS_ Settings VDIS_ settings Members mode Current mode i e VDIS_640X480X16 hres Horizontal resolution in pixels i e 640 vres Vertical resolution in pixels i e 480 bpp Bits per pixel i e 16 pitch Display pitch number of bytes from start of one line to the start of the next line i e 640 for 640x480x8 buffsz Total size of one display buffer in bytes fps Display rate in frames per second i e 60 Description This is a global variable exported out of the VDIS module that contains infor mation about the current display mode Its purpose is to make it easy for the application code to read this information It is useful when the application code needs rea
22. fer with a pixel value This function simply uses a CPU for loop to do the fill but does comprehend the pixel depth If you call the fill function note that the cache is not flushed this is up to the user Video Display System 2 5 Using the Display APIs A typical display loop looks something like this execute from the context of a task someTaskFunc open the display if VDIS_open configure the display VDIS_config VDIS_640X480X16 infinite processing loop while 1 get the next available display buffer dispBuff VDIS_toggleBuffs SYS_FOREVER write data to display buffer dispBuff F x 2 6 Display Buffer Format 2 5 Display Buffer Format Figure 2 2 illustrates how the individual display buffers are organized The buffer is stored continuously in memory such that the start of one line backs up against the end of the previous line For 8 bit display modes as in the fig ure each pixel takes up one byte for 16 bit modes 2 bytes are used per pixel Figure 2 2 Display Buffer Format 1 byte pixel 640x480 8 bit greyscale base 0x00000000 base 0x00000280 base 0x00000500 base 0x00000780 base 0x00000A00 480 lines frame base 0x00000C80 base 0x0004AD80 640 pixels line Video Display System 2 7 VDIS_close 2 6 Video Display API Reference VDIS VDIS_close Closes dis
23. gn TI does not warrant or represent that any license either express or implied is granted under any patent right copyright mask work right or other intellectual property right of TI covering or relating to any combination machine or process in which such semiconductor products or services might be or are used Tl s publication of information regarding any third party s products or services does not constitute Tl s approval warranty or endorsement thereof Copyright 2000 Texas Instruments Incorporated Preface Read This First About This Manual The Imaging Developer s Kit IDK is a complete system consisting of hard ware and software designed to demonstrate the capabilities of Tl s TMS320C6000 family of DSPs in the field of video image processing The IDK also serves as a rapid prototyping platform for the development of image and video processing algorithms This document describes the software and hard ware components provided in the IDK How to Use This Manual This document contains the following chapters D Chapter 1 Overview provides information about the software module block diagram software architecture and describes how to use video de vice drivers I Chapter 2 Video Display System provides a block diagram and de scribes the function of the video sisplay system Also contains a video dis play API referemce VDIS Chapter 3 Video Capture System explains and illustrates the video di
24. his means don t call this function from main a Before calling any of the VCAP functions you must first open the capture by calling VCAP_open This function performs some internal initialization and allocates system resources i e semaphore If your application ever finishes with the capture then these resources may be freed up by calling VCAP_close Once the capture is opened it must be configured by calling VCAP_con fig mode where mode is the desired capture mode Currently the driver sup ports these modes D VCAP_NTSC 640x480 YCbCr 4 2 2 square pixel 30 frames second J VCAP_PAL 768x576 YCbCr 4 2 2 square pixel 25 frames second If you ever wish to disable the capture or turn it off call VCAP_reset Video Capture System 3 5 Using the Capture APIs A typical capture loop looks something like this execute from the context of a task someTaskFunc open the capture if VCAP_open configure the capture VCAP_config VCAP_NTSC infinite processing loop while 1 get the next available capture frame input VCAP_getFrame SYS_FOREVER process the captured data x F input 3 6 Capture Buffer Format 3 5 Capture Buffer Format Figure 3 2 illustrates how the individual capture buffers are organized There are three separate buffers used to implement the triple buffering scheme and each buffer is made up of three components Y Cb and C
25. iver depends on DSP BIOS and interrupts are used it is important that the capture interrupt service routine VCAP_isr is config ured into HWI EXTINT5 in the DSP BIOS configuration tool Also the Use Dispatcher box must be checked If this is not done the capture interrupt will never get called and the capture semaphore will never get posted Video Capture System 3 3 Triple Buffering Scheme 3 3 Triple Buffering Scheme A triple buffering scheme is used for the capture such that the application can always get a new buffer without waiting if so desired It works like this one of the buffers is active meaning that the capture hardware is currently storing data into this buffer A second buffer is owned by the application user which is the one your application is currently reading from The third buffer is the last one filled by the capture hardware last active Having three buffers allows the application to obtain a new buffer without waiting for a new frame and the new buffer always containes the most recent captured data If there were only two buffers the swap could only occur on frame boundaries which would mean waiting If the application attempts to grab buffers faster than they can be captured 30Hz for example then duplicate frames will be returned This can happen if you call VCAP_getFrame 0 which basically gets the next frame without wait ing for a new one to become available If you call this faster than the capture
26. n a built in semaphore there is no spinning This semaphore is posted once every ver tical sync by the interrupt service routine If you want your application to be syn chronized with the display use VDIS_toggleBuffs SYS_FOREVER If your application is synchronized some other way with capture for example then use VDIS_toggleBuffs 0 leper ee eee eee irs Note Since VDIS_toggleBuffs blocks on a semaphore it is important that this function ONLY be called from the context of a DSP BIOS task This means don t call this function from main ef Before calling any of the VDIS functions you must first open the display by call ing VDIS_open This function performs some internal initialization and allo cates system resources i e EDMA channel semaphore etc If your applica tion ever finishes with the display then these resources may be freed up by calling VDIS_close Once the display is opened it must be configured by calling VDIS_con fig mode where mode is the desired display mode Currently the driver sup ports these modes i VDIS_640X480X8 640x480 8 bit greyscale 60Hz 1 VDIS_640X480X16 640x480 16 bit color 565 packed format 60Hz i VDIS_800X600X8 800x600 8 bit greyscale 60Hz 1 VDIS_800X600X16 640x480 16 bit color 565 packed format 60Hz If you ever wish to disable the display or turn it off call VDIS_reset You may call VDIS_fill buffPtr pixelValue if you want to fill a buf
27. play device Function Arguments Return Value Description Example VDIS_config Function Arguments Return Value 2 8 void VDIS_close none none This function closes the display device and frees up any resources allocated during VDIS_open The display is also reset Generally this function is never called because video applications are usually infinite processing loops Hence the display is always left open Here are the steps taken Check to make sure the display is open Call VDIS_reset Close the EDMA channel Free the EDMA parameter tables Delete the DSP BIOS semaphore Returns O O O O O O VDIS_close Configures and enables display hardware for mode specified int VDIS_config int mode mode Specifies the video display mode Supported moodes are 1 VDIS_640X480X8 640x480 8bpp greyscale 60Hz Lj VDIS_640X480X16 640x480 16bpp 565 60 Hz i VDIS_800X600X8 800x600 8bpp greyscale 60Hz Lj VDIS_800X600X16 800x600 16bpp 565 60Hz success Returns 0 on failure Description Example VDIS_fill Function Arguments Return Value Description VDIS_fill This function configures and enables the display hardware for the mode speci fied The display must be opened before calling this function See VDSI_open Here are the steps taken Check to make sure display is open Calls VDIS_reset Updates VDIS_ settings structure Sets up FPGA timing parameters
28. pt on every vertical sync event The interrupt service routine posts the display semaphore The return value is a pointer a free display buffer Once you have this pointer you are expected to fill the buffer up with display data You exclusively own this buffer until you call this function again At that time this buffer gets displayed This function performs these basic steps g Links the EDMA to the next display buffer intermediate _j Pends on the display semaphore g Increments an internal buffer index number _j Returns the new buffer pointer execute from the context of a task someTaskFunc open the display if VDIS_open configure the display VDIS_config VDIS_640X480X16 infinite processing loop while 1 get the next available display buffer dispBuff VDIS_toggleBuffs SYS_FOREVER write data to display buffer dispBuff F x Video Display System 2 13 Chapter 3 Video Capture System Topic Page 3 1 Capture Block Diagram cce cece cece ence eee B 2 3 2 Capture Timing and Events ceceeee eee eee ee eee B 3 3 3 Triple Buffering Scheme ois 2 fice cee ete cn tetein pee aie leit ss 3 4 Using the Capt re APIS nnee cence larete ore aiel yelarela a eE B 5 3 5 Capture Buffer Format 0ccc cece eee eee ence eens 3 6 Video Capture API Reference VCAP 0cceeeeeeeeeeees 3 1 Capture
29. r The component sub buffers are not continous This means there may be gaps between the Y Cb and Cr buffers Also there are separate component buffers for the even and odd fields All buffer sub buffer addresses are fixed and hardwired The figure shows the NTSC buffers but the same thing applies for PAL just different dimensions When the user calls VCAP_getFrame the return value is a pointer to a struc ture that has individual members that point to each of the sub component buff ers for both even and odd fields It is up to the user to merge these together if they want the full interlaced frame Video Capture System 3 7 Capture Buffer Format Figure 3 2 Capture Buffer Format 3 8 Daughter Card Video Capture SDRAM 640x480 NTSC YCbCr 4 2 2 Odd Field Even Field y1 640x240 y2 640x240 Cb1 320x240 Cb2 320x240 cri 320x240 Cr2 320x240 VCAP_config 3 6 Video Capture API Reference VCAP VCAP_close Closes capture device Function Arguments Return Value void VCAP_close none none Description This function closes the
30. r software is written entirely in C The modules consist of the following files 1 VDIS vdis h vdis c VCAP vcap h vcap c TVP3026 tvp3026 h tvp3026 c E E J TVP5022 tvp5020 h tvp5020 c g 12C i2c h i2c c E TVP5022NSQP tvp5020nsqp h tvp5020nsqp c C1 TVP5022PSQP tvp5020psqp h tvp5020psqp c Please note that while the code file names above are with reference to TVP5020 they are equally valid for TVP5022 All of these source files are lo cated in the source archive veard sre Software Architecture Figure 1 1 Software Architecture Application VDIS VCAP TVP3026 TVP5022 TVP5022NSQP TVP5022PSQP CSL amp DSP BIOS II Overview 1 5 Od a T 0 gp Video Display System Topic Page 2 1 Display Block Diagram ices scsi ce ttn ercsecanie eterna ne peters aap ictals 2 2 2 2 Display Timing and Events ccceee cece en ee eceeneneee 2 3 2 3 Triple Buffering Scheme e menee aee eerie eter teeter tektites tae 2 4 Using the Display APIS cccccccceeeeeeeeeeeeeeeeees 2 5 fa IEP JEN Er ROEM oconcsonnancannoonoaanoooooAnooosoonnennd 2 6 Video Display API Reference VDIS 22220eeeeeeeee 2 1 Display Block Diagram 2 1 Display Block Diagram Figure 2 1 shows the block diagram of the video display subsystem First of all three display buffers are allocated in bss which gets linked into the DSK s SDRAM These buffers are
31. splay subsystem Chapter 4 Examples provides code examples of video device drivers uses Related Documentation From Texas Instruments The following references are provided for further information Documentation TMS320C6000 Imaging Developer s Kit IDK User s Guide Literature number SPRU494 Text Conventions Text Conventions TMS320C6000 Imaging Developer s Kit IDK Programmer s Guide Literature number SPRU495 C6000 JPEG Information Li TMS320C6000 JPEG Implementation Application Report Literature number SPRA704 J Optimizing JPEG on the TMS320C6211 With 2 Level Cache Application Report Literature number SPRA705 C6000 H 263 Information g H 263 Decoder TMS320C6000 Implementation Application Report Literature number SPRA703 g H 263 Encoder TMS320C6000 Implementation Application Report Literature number SPRA721 The following typographical conventions are used in this specification J Text inside back quotes represents pseudo code Program source code function and macro names parameters and com mand line commands are shown in a mono spaced font Contents OVGFVIOW ect tei aa aa a ue ede ieee wees Celle wet ee a a n 1 1 Software Module Block Diagram 1 2 Using the Driver Library 0 eee tenet ene ee 1 3 Software Architecture 0 ents Video Display System 00 6c ccc 2 1 Display Block Diagram 0 ccc eee ete teen eees 2
32. ule that contains infor mation about the current capture mode It s purpose is to make it easy for the application code to read this information It s useful when the application code needs react differently depending on capture settings Note Do not write to any members of this structure it is intended to be read only This structured is altered by VCAP_open VCAP_config and VCAP_re set Generally the user calls VCAP_config then uses information from this structure VCAP_config VDIS_NTSC dx VCAP_settings hres dy VCAP_settings vres Chapter 4 Examples The examples provided in this section are meant to be illustrative examples of Video Device Drivers use and do not necessarily provide the most perfor mance optimized means of implementing the example scenarios Please refer to the TMS320C6000 Imaging Developer s Kit IDK Programmer s Guide Literature number SPRU495 for further information on performance opti mized implementations of video capture and display All of the examples can assume this for a main function Hef void main initialize the CSL library CSL_init open a DMA channel for the DAT module DAT_open DAT_CHAANY DAT_PRI_LOW DAT_OPEN_2D open up the video systems VDIS_open VCAP_open Remember that the main task tskMain will execute automatically once we exit main and DSP BIOS starts as Topic Pag
Download Pdf Manuals
Related Search
Related Contents
Tripp Lite Heavy-Duty Power Extension Cord, 15A, 14AWG (IEC-320-C14 to IEC-320-C13), 10-ft. Level Measurement Instruments Manuale utente Visualizzatore ad impulsi Fleck Model 9000/9100/9500 Service Manual Pois chiches germés vapeur Philips 6500 series 40PFT6510 40" Full HD 3D compatibility Smart TV Wi-Fi Silver Le radiateur sèche-serviettes qui allie confort et design Copyright © All rights reserved.
Failed to retrieve file