OMAP-L137 iUniversal + ALSA driver

From Texas Instruments Wiki
Jump to: navigation, search

What is it?

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

Installing the Software

  1. The software can be downloaded at:
    http://e2e.ti.com/members/1602108/files/alsa_5F00_iuniversal.tar.gz.aspx
  2. To untar the file use the command:
    host $ tar -xvvzf alsa_iuniversal.tar.gz

Building the application

  1. Correct paths/directories at the .../alsa_iuniversal/Makefile to match your machine. They are compatible with the default paths pointed by the GSG.
  2. 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

  1. 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.
  2. Load Modules on target
    target $ cd /opt/test_audio
    target $ ./loadmodules.sh
  3. 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.
  4. 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

Filter


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:

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,
};

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

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

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.

Related Links

Getting Started Guide for OMAP-L137

Getting started with IUNIVERSAL