Blackfin Custom Device Drivers Procedures and Results The following is a description of the tests performed on the Blackfin device drivers. Timer Test: ----------- 1) Description The timer test code will cover three timer devices and three timer working modes(PWM, CAP, and ECLK). In the test code, Timer0 is used as PWM mode, Timer1 is used as CAP mode, and Timer2 is used as ECLK mode. Timer0 output is used as the input to both timer1 and timer2. On the Eagle board, pin-A3 of header P8 is timer0 output; pin-B3 of header P8 is timer1 input and the pin-A4 of header P8 is timer2 input. On the Hawk board the pin numbers are the same, but use header P7. So the following actions should be performed: - before testing the CAP feature of timer1, pin-B3 and pin-A3 should be connected. - before testing the ECLK feature of timer2, pin-A4 and pin-A3 should be connected. 2) Process As seen in the following figure, the test process includes all timer device driver operations(e.g. open, ioctl, close, read). -------------------------------- | open timer0, timer1 and timer2 | -------------------------------- | V ---------------------------------------------------- | set timer0 PWM mode and enable timer0 | ---------------------------------------------------- | V ------------------------------------------------------------ | set timer1 CAP mode and enable timer1 | |(the console will display "timer1 ioctl CMD_TIMER_SETMODE". | ------------------------------------------------------------ |<-------------- connect Pin-A3 with Pin-B3 V ------------------------------------------------------- | call timer1 read to wait CAP operation finished, | | and console displays the timer1 width and period value| ------------------------------------------------------- | V ------------------------------------------------------------ | set timer2 ECLK mode and enable timer2 | |(the console will display "timer2 ioctl CMD_TIMER_SETMODE". | ------------------------------------------------------------ |<-------------- connect Pin-A3 with Pin-A4 V ------------------------------------------------------- | call timer2 read to wait ECLK operation finished, | | and console displays the timer2 width and period value| ------------------------------------------------------- | V --------------------------------- | close timer0, timer1 and timer2 | --------------------------------- Connecting PinA3-PinB3, and PinA3-PinA4 should be done during the test procedure. After building a kernel and enabling the timer test procedure you should download the kernel to the system. When a shell prompt is displayed type the following: /bin> timer_test - When the console prints out the line "timer1 ioctl CMD_TIMER_SETMODE", which means the timer1 CAP mode is enabled and the read function has been called, the timer1 input (pin-B3) should be connected with the input signal (timer0 output pin-A3). - When the console prints out the line "timer2 ioctl CMD_TIMER_SETMODE", which means the timer2 ECLK mode is enabled and the read function has been called, the timer2 input (pin-A4) should be connected with the input signal (timer0 output pin-A3). Timer Test Results: ------------------- If the test passed you should see something like the following after moving the jumper around from A3-B3 to A3-A4: /bin> timer_test = 1. open timer0t ======== adsp_timer_open reopen /dev/timer0 adsp_timer_open This timer has been opened /dev/timer0 re-open error close /dev/timer0 adsp_timer_release adsp_timer_fasync adsp_timer_open 2. open timer1 adsp_timer_open 3. open timer2 adsp_timer_open 4. timer0 ioctl CMD_TIMER_SETMODE ioctl setmode5. timer0 ioctl CMD_TIMER_ENABLE ioctl timer enable6. timer1 ioctl CMD_TIMER_SETMODE ioctl setmodeioctl timer enabletimer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 1 interrupt timer1 read period=0x20000, width=0x200006. timer2 ioctl CMD_TIMER_SETMODE ioctl setmodeioctl timer enabletimer 0 interrupt timer 1 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 0 interrupt timer 2 interrupt timer2 read period=0x40001, width=0x40001adsp_timer_release adsp_timer_fasync adsp_timer_release adsp_timer_fasync adsp_timer_release adsp_timer_fasync /bin> RTC Tests: ---------- This is a pretty straight forward test of opening and closing the timer and reading and writing. It basically does a setup and waits for the correct response. To initiate the test type: /bin> rtc_test RTC Test Results: ----------------- If everything worked properly you should output similar to the following: /bin> ./rtc_test ====== RTC Test ==== 0. open and release open /dev/rtc /dev/rtc open error 1. ioctl RTC_UIE_ON RTC read 1 RTC read 2 RTC read 3 RTC read 4 RTC read 5 Current RTC date/time is 240-1-0, 27:48:20. 5. Set RTC Time Set Current RTC date/time to 28-2-102, 08:15:00. Get RTC time Current RTC date/time is 28-2-2002, 08:15:00. 6. Set alarm Time 7. Get alarm Time Alarm time now set to 08:15:50. Waiting 50 seconds for alarm... Okay. Alarm rang. Current RTC date/time is 28-2-2002, 08:15:51. 8. ioctl RTC_AIE_OFF 9. ioctl RTC_SWCNT_ON Current RTC date/time is 28-2-2002, 08:15:55. 10. ioctl RTC_SWCNT_SET Current RTC date/time is 28-2-2002, 08:16:57. 11. ioctl RTC_SWCNT_OFF 12. ioctl RTC_EPOCH_READ ioctl RTC_EPOCH_READ error Current epoch is 13 13. ioctl RTC_EPOCH_SET ioctl RTC_EPOCH_SET error Current RTC date/time is 28-2-2002, 08:16:59. /bin> USB Tests: ---------- Connecting the USB port to an existing windows machine should test the ability of the USB driver to respond to a valid query. This along with the target side test demonstrates the functionality of the USB driver. USB Test Results: ----------------- Plug a USB cable into the USB port (not the JTAG USB port) and into the host PC's USB port. The host system should detect that a new "USB Device" was detected and start the "Add New Hardware Wizard". Just exit out of this window. The following will also be displayed on the Blackfin console: /> Blackfin UDC driver: USB Bus Reset detected Run the USB test routines on the Blackfin board. Note that there are parameters required for each test. If everything is working properly the following output should be displayed: /bin> usb_test r 1 pipe_id=1 Total 0 bytes read from pipe 1 Read data: /bin> usb_test w 1 "USB Test" pipe_id=1 Total 8 bytes written to pipe 1 /bin> usb_test w 2 "Intr Data" pipe_id=2 Total 9 bytes written to pipe 2 /bin> usb_test r 3 10 pipe_id=3 ISO frame numbers = 8 iso_data=0xff7240 Totoal 0 frames got from ISO pipe /bin> usb_test w 3 "12345678" 4 pipe_id=3 ISO frame numbers = 4 iso_data=0x1f32a0 Totoal 4 frames (8 bytes per) sent to ISO pipe /bin> SPORT Tests: ------------ This test will write data to SPORT1 and read from SPORT0. (Since SPORT0 is always connected to the Codec AD1885 on the Eagle board, this test can only be run on a Hawk board.) The following connections are needed to test the SPORT: P6 PIN 2 <------> P7 PIN34 (RFS0 -- TFS1) P6 PIN 3 <------> P7 PIN33 (RSCLK0 -- TSCLK1) P6 PIN 4 <------> P7 PIN35 (DR0 -- DT1) Make sure the jumper named SPORT0=CODEC is NOT connected. SPORT Test Results: ------------------- After typing spt_tst at the shell prompt the following results should be displayed. /bin> spt_tst write ret=8 Revent: 1. ret=16, str = This is recv str[0] = 54 recv str[1] = 68 recv str[2] = 69 recv str[3] = 73 recv str[4] = 20 recv str[5] = 69 recv str[6] = 73 recv str[7] = 20 recv str[8] = 0 recv str[9] = 0 recv str[10] = 0 recv str[11] = 0 recv str[12] = 0 recv str[13] = 0 recv str[14] = 0 recv str[15] = 0 /bin> SPI Tests: ---------- There are 2 SPI ports in the Blackfin system. To test the SPI ports data is written to one port and read back from the other. In order to run this test you need to connect P7-37 to P7-38 on the Hawk board or P8-37 to P8-38 on the Eagle board. The syntax for this command is: spi0app [num] SPI Test Results: ----------------- If everything is working properly you will get the follwing results: /> spi0app 20 Last msg: 77 ffffff88. Total open & close 20 times. The number of open, write, and close sequences to the spi file descriptors is variable, but must be at least 1. PCI Tests: ---------- Since there is no host side test component for the PCI device this component was tested by plugging in a PCI device and querying it. I used an MDS Eagle-35 for the test platform with MDS Hawk-35 for the target device. There is no PCI bus on the Hawk board so this test is only valid on the Eagle system. The Hawk board will respond to PCI queries when the software is enabled. Make sure the "PCI Support" option under "General setup" is selected for the Eagle board's kernel. PCI Test Results: ----------------- After booting the system and observing the PCI initializations. Make sure the /proc filesystem is mounted. If it is not type: mount -t proc proc /proc If everything is mounted you should be able to see the following output when you type: cat /proc/pci PCI devices found: Bus 0, device 1, function 0: Class 0200: PCI device 8086:1209 (rev 9). IRQ 9. Master Capable. Latency=128. Min Gnt=8.Max Lat=56. Non-prefetchable 32 bit memory at 0xe7fff000 [0xe7ffffff]. I/O at 0xffc0 [0xffff]. Non-prefetchable 32 bit memory at 0xe7fc0000 [0xe7fdffff]. Bus 0, device 2, function 0: Class 0604: PCI device 8086:b152 (rev 0). Bus 1, device 0, function 0: Class 0000: PCI device 11d4:1535 (rev 0). Master Capable. Latency=128. Prefetchable 32 bit memory at 0x0 [0x3f]. Audio Tests: ------------ The audio tests are performed by observing the initialization of the driver during boot and then testing the audio device. The test routine connects the microphone input to the speak output with about a 1 second delay between the two. Connect a microphone the MIC AUDIO IN input jack. Connect a speaker to the SPK AUDIO OUT output jack. Make sure the "Sound Card Support" is selected under in the "Sound" option in the kernel. If you are using the Hawk-35 board make sure the SPORT0-CODEC jumper (JP6) is inserted. The Hawk board allows the SPORT0 channel to be used either as an audio connection or a regular SPORT channel. The Eagle board has the SPORT0 channel hard wired to the audio codec. Audio Test Results: ------------------- First verify the following boot messages are seen during kernel load: ... Waiting for AC97 Codec Codec Ready: 0:: 9800, 9800 ac97_codec: AC97 Audio codec, id: 0x4144:0x5360 (Analog Devices AD1885) ac97_codec: wrote OSS mixer 0 (Primary ac97 register 0x02), left vol:67, right vol:67: 0x1515 -> 0x1515 ac97_codec: wrote OSS mixer 4 (Primary ac97 register 0x18), left vol:67, right vol:67: 0x0a0a -> 0x0a0a ac97_codec: wrote OSS mixer 5 (Primary ac97 register 0x0a), left vol:67, right vol:67: 0x000a -> 0x000a ac97_codec: wrote OSS mixer 6 (Primary ac97 register 0x10), left vol:67, right vol:67: 0x0a0a -> 0x0a0a ac97_codec: wrote OSS mixer 7 (Primary ac97 register 0x0e), left vol: 0, right vol: 0: 0x8000 -> 0x8000 ac97_codec: wrote OSS mixer 8 (Primary ac97 register 0x12), left vol:67, right vol:67: 0x0a0a -> 0x0a0a ac97_codec: wrote OSS mixer 10 (Primary ac97 register 0x04), left vol:67, right vol:67: 0x1515 -> 0x1515 ac97_codec: wrote OSS mixer 12 (Primary ac97 register 0x1c), left vol:67, right vol:67: 0x0a0a -> 0x0a0a ac97_codec: wrote OSS mixer 14 (Primary ac97 register 0x16), left vol:67, right vol:67: 0x0a0a -> 0x0a0a ac97_codec: wrote OSS mixer 20 (Primary ac97 register 0x0c), left vol:67, right vol:67: 0x000a -> 0x000a ac97_codec: wrote OSS mixer 21 (Primary ac97 register 0x06), left vol:67, right vol:67: 0x0015 -> 0x0015 ac97_codec: wrote OSS mixer 22 (Primary ac97 register 0x14), left vol:67, right vol:67: 0x0a0a -> 0x0a0a adi_spt_audio: only 48Khz playback available. adi_spt_audio: allocated 65536 (order = 4) bytes at 00fd0000 adi_spt_audio: prog_dmabuf, sample rate = 48000, format = 3, numfrag = 32, fragsize = 2048 dmasize = 65536 adi_spt_audio: 0 bytes in 50 milliseconds ... If these messages are seen you should be able to type the following and get the following response. /> audio_test fd1=3 fd2=4 adi_spt_audio: allocated 65536 (order = 4) bytes at 00ee0000 adi_spt_audio: prog_dmabuf, sample rate = 48000, format = 3, numfrag = 32, fragsize = 2048 dmasize = 65536 adi_spt_audio: allocated 65536 (order = 4) bytes at 00ed0000 adi_spt_audio: prog_dmabuf, sample rate = 48000, format = 3, numfrag = 32, fragsize = 2048 dmasize = 65536 At this point you can talk into the microphone and hear yourself talk with about a 1 second delay.