NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
OMAP-L137 iUniversal + ALSA driver
Contents
What is it?[edit]
This an example of using the ALSA audio driver together with the iUniversal framework for the OMAP-L137 processor.
This application reads an audio file (.dat) in the ARM side, passes a filter in the DSP side using iUniversal, and outputs the audio to the ALSA driver. This is made and tested on the OMAP-L137 EVM.
This is just an example code provided as is, therefore support and updates are not guaranteed.
Prerequisites[edit]
- Install the software (GA version) and setup the hardware according to the Getting Started Guide for OMAP-L137
Installing the Software[edit]
- The software can be downloaded at:
- To untar the file use the command:
- host $ tar -xvvzf alsa_iuniversal.tar.gz
Building the application[edit]
- Correct paths/directories at the .../alsa_iuniversal/Makefile to match your machine. They are compatible with the default paths pointed by the GSG.
- Go to the .../alsa_iuniversal folder and do (as root):
- host $ make clean
- host $ make all
- host $ mkdir $HOME/workdir/filesys/opt/test_audio
- NOTE: EXEC_DIR in the Makefile is $(FILESYS_DIR)/opt/test_audio
- host $ make install
Running the application[edit]
- Copy files to target
- Go to the .../alsa_iuniversal/useful_files directory at your host machine and type the commands (assuming you used the default path at the GSG):
- host $ cp * $HOME/workdir/filesys/opt/test_audio/
- Copy the modules to the target files system
- host $ cd $HOME/workdir/filesys/opt/test_audio/
- host $ cp $HOME/OMAPL137_arm_1_00_00_11/dsplink-1_61_03-prebuilt/packages/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplinkk.ko .
- host $ cp $HOME/OMAPL137_arm_1_00_00_11/codec_engine_2_23_01/examples/apps/system_files/OMAPL137/cmemk.ko .
- NOTE: You can use the pre-built modules above. If you get the message " cmemk: disagrees about version of symbol struct_module" while trying to load the modules, you need to rebuild the kernel and CMEM, please see Building The OMAP-L137 SDK.
- Load Modules on target
- target $ cd /opt/test_audio
- target $ ./loadmodules.sh
- Call the application
- target $ ./remote_ti_platforms_evmOMAPL137_fir.xv5T "plughw:0,0" song.dat 48000 4096 409600
- Where "plughw:0,0" is the audio device, song.dat is the name of the file to be played, the 48000 is the sampling rate (8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200 or 96000), 4096 is the size in bytes of the buffer used (max = 4096), and 409600 is the total data size.
- target $ ./remote_ti_platforms_evmOMAPL137_fir.xv5T "plughw:0,0" song.dat 48000 4096 409600
- If all has gone well and you have some speakers or headphones connected to the headphone output connector on the EVM you should hear the .dat file playing!
Usage notes[edit]
Filter[edit]
The filter that come with the application is a low-pass filter. If you want to change the coefficients of the filter, please go to the file:
.../alsa_iuniversal/packages/ti/sdo/apps/fir/firtest.c
Replace the coeff array:
<syntaxhighlight lang='c'>
static XDAS_Int16 coeff[64] = {
-782, -100, -100, -95, -84, -68, -46, -17, 18, 59, 107, 162, 222, 288, 358, 433, 511, 592, 675, 756, 839, 919, 996, 1070, 1138, 1200, 1256, 1303, 1342, 1372, 1392, 1402, 1402, 1392, 1372, 1342, 1303, 1256, 1200, 1138, 1070, 996, 919, 839, 756, 675, 592, 511, 433, 358, 288, 222, 162, 107, 59, 18, -17, -46, -68, -84, -95, -100, -100, -782,
}; </syntaxhighlight>
with the array of coefficients of the filter you want.
Save the firtest.c file, and rebuild the the project (as root):
host $ make all
host $ make install
Audio file[edit]
The audio file was recorded using the ALSA driver itself.
Used the commands presented in the OMAPL1 Linux Audio Driver WebEx Presentations to copy and playback music on OMAP-L137. The presentations are at the page OMAPL1 PSP WebEx Presentations. See also information at Omapl137_linux_audio_driver - ALSA utils.
- The command used to record is the file is:
target $ arecord -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.dat
- The command used for playback is:
target $ aplay -D 'hw:0,0' -r 48000 -f S16_LE -c 2 song.dat
The file provided with the application was recorded from audio from the DaVinci board's demos.
Important files[edit]
The key files to this application are:
- .../alsa_iuniversal/packages/ti/sdo/apps/fir/smain.c - main function where FIRTEST_main is called.
- .../alsa_iuniversal/packages/ti/sdo/apps/fir/firtest.c - contains function FIRTEST_main that creates the CE and calls the ALSA application (AudioAlsaWriteFromFile). Also contains the FIRTEST_runTests function that calls the filter itself.
- .../alsa_iuniversal/packages/ti/sdo/apps/fir/audioAlsaWriteFromFile.c - contains function AudioAlsaWriteFromFile is the one that reads the file, calls the filter (FIRTEST_runTests) and put the output to the ALSA driver
- .../alsa_iuniversal/packages/ti/sdo/algos/fir/fir_ti_filter.c - Where the filter algorithm is.