Linux sound card driver porting and testing

Source: Internet
Author: User

First, analyze the driver, modify the code according to the Development Board

Code is too long, it is not affixed, a few points to note:

1, view Development Board schematic diagram and s3c2410 datasheet,uda1341 l3mode, L3data, L3clock respectively and s3c2410 GPB2, GPB3, GPB4 connected, IISLRCK=GPE0, iissclk= GPE1, Cdclk=gpe2,iissdi=gpe3, Iissdo=gpe4, part of the code is as follows:


2, two important structures: audio_buf_t and audio_stream_t, wherein audio_stream_t a ring buffer for audio stream data;


3, File_operations structure, open (), write (), read (), IOCTL (), release () functions such as the underlying implementation;



4, the principle of DMA;

5, drive loading and unloading, etc.;

Second, add a sound card driver to the kernel

1. Configure the sound card options in the kernel;

Note: The driver for UDA1341 is S3C2410-OSS.C in the linux/sound/oss/directory (Kernel version: Linux-2.6.8.1).

Enter make menuconfig in the kernel tree directory to jump out of the kernel configuration interface:


Then press the down navigation key of the keyboard and pull down to the sound option:


Press ENTER to enter the Sound Options screen:


Select the "Open Sound System" option and enter the OSS options interface:


Select "Open sound System (DEPRECATED)" and "s3c2410 Audio support" respectively, press the space until the options in front <> into *, and then press the TAB key to exit, save the configuration information:


PS : * indicates that the driver is compiled into the kernel, and null means that the driver is not compiled. M indicates that the driver is compiled into a module.

2, compile kernel, generate kernel image zimage;

Under the kernel tree directory, enter the command make Zimage, which will generate the Zimage file in the linux/arch/arm/boot/directory after successful compilation.

3. Open the Samba server, share the kernel image zimage to the Windows platform, and download the Zimage to the Development Board via the DNW software;

After the above steps, the sound card driver is successfully added to the kernel.

Third, test the sound card

1, start the Development Board, check the sound card equipment;


As can be seen from the results, the driver has successfully registered two character devices in the kernel: the main device number of the DSP and MIXER,DSP is 14, the secondary device number is 3;mixer's main device number is 14, the secondary device number is 0.

2. Check if the sound card can be recorded and played properly.


Create temporary folder audio, use the command to implement the recording, generate audio file audio.wav, use the command to achieve playback, pass the test, found that the sound card is working properly.


Problems encountered:

The error "Cat:read Error:illegal seek" occurred while testing the sound card.

Workaround:

Modify the sound card driver to annotate some of the code in the driver's Smdk2410_audio_read function, such as the red circle.


Note: Modify the driver after the The kernel needs to be recompiled, the Zimage file is generated and downloaded to the Development Board.

June 13, 2014 Friday 16:23

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.