Linux sound card driver porting and Testing

Source: Internet
Author: User

1. Analyze the driver and modify the code according to the Development Board

The code is too long to be pasted. Pay attention to the following points:

1. Check the principle diagram of the Development Board and datasheet of the S3C2410. The L3MODE, L3DATA, and L3CLOCK of UDA1341 are connected to gpbs, GPB3, and GPB4 of the S3C2410, respectively. Labels = GPE0, IISSCLK = GPE, IISSDI = GPE3, IISSDO = GPE4, some code is as follows:


2. Two important structures: audio_buf_t and audio_stream_t. audio_stream_t constitute a ring buffer for audio stream data;


3. Underlying Implementation of file_operations struct, open (), write (), read (), ioctl (), release (), and other functions;



4. Principle of DMA;

5. Driver loading and detaching;

2. Add a sound card driver to the kernel

1. Configure the sound card options in the kernel;

Note: The UDA1341 driver s3c2410-oss.c is in the linux/sound/oss/directory (kernel version: Linux-2.6.8.1 ).

Enter make menuconfig in the kernel tree directory, and the Kernel configuration page will pop out:


Then press the down navigation key on the keyboard and drop down to the Sound option:


Press enter to enter the Sound option interface:


Select the "Open Sound System" option and press enter to go to the OSS option interface:


Select "Open Sound System (DEPRECATED)" and "S3C2410 audio support" respectively, press a space until <> change to * Before the option, and press the Tab key to exit, save configuration information:


Ps:*Indicates that the driver is compiled into the kernel. If it is null, the driver is not compiled,MCompile the driver into a module.

2. Compile the kernel and generate the kernel image zImage;

In the kernel tree directory, enter the command make zImage. After compilation, the zImage file is generated in the linux/arch/arm/boot/directory.

3. Open the Samba server, share the kernel image zImage to the windows platform, and then download zImage to the Development Board through the DNW software;

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

3. Test the sound card

1. Start the Development Board and view the sound card device;


From the display results, we can see that the driver has successfully registered two character devices in the kernel: dsp and mixer. The main device Number of dsp is 14, and the second device number is 3; the main device Number of mixer is also 14, and the second device number is 0.

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


Create an audio file named audioand generate the audio file audio.wav using the command to enable sound recording. After testing, the sound card works normally.


Problems:

When the sound card is tested, the error "cat: Read error: Illegal seek" is displayed ".

Solution:

Modify the sound card driver and comment out some code in the smdk2410_audio_read function of the driver, for example, circled in red.


Note: Modify the driverThen, you need to re-compile the kernel, generate the zImage file, and download it to the Development Board.

Friday, June 13, 2014

Related Article

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.