~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
cvs/emstar/devel/loc/ar/ar_soundtest.c


  1 /*
  2  *
  3  * Copyright (c) 2005 The Regents of the University of California.  All 
  4  * rights reserved.
  5  *
  6  * Redistribution and use in source and binary forms, with or without
  7  * modification, are permitted provided that the following conditions
  8  * are met:
  9  *
 10  * - Redistributions of source code must retain the above copyright
 11  *   notice, this list of conditions and the following disclaimer.
 12  *
 13  * - Neither the name of the University nor the names of its
 14  *   contributors may be used to endorse or promote products derived
 15  *   from this software without specific prior written permission.
 16  *
 17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
 18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 19  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 20  * PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 25  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28  *
 29  */
 30 
 31 #include <ar.h>
 32 #include <emrun/emrun.h>
 33 
 34 /*
 35  * ar_soundtest
 36  *
 37  * for testing with SPL meter
 38  */
 39 
 40 void usage(char *name)
 41 {
 42   misc_print_usage
 43     (name, 
 44      "",
 45      "  "
 46      );
 47   exit(1);
 48 }
 49 
 50 
 51 void ar_shutdown(void *data)
 52 {
 53   elog(LOG_WARNING, "shutdown called..");
 54   exit(1);
 55 }
 56 
 57 ar_state_t _ar = {
 58   flood_interface: "flood",
 59   sensor_interface: "vxp",
 60   sound_dev: "hw:%d,%d",
 61   curr_temperature: 20,
 62   gpio_channel: -1 ,
 63   chirp_len: CHIRP_CHIPS*MOD_FACTOR*RANGE_FACTOR
 64 };
 65 
 66 
 67 
 68 int main(int argc, char **argv)
 69 {
 70   /* generic init */
 71   misc_init(&argc, argv, CVSTAG);
 72 
 73   _ar.next_seed = 10;
 74   _ar.next_mod = 0;
 75   _ar.next_nocomp = 1;
 76   _ar.next_note = NULL;
 77 
 78   misc_parse_option_as_int(&argc, argv, "mod", 0, &(_ar.next_mod));
 79   misc_parse_option_as_int(&argc, argv, "seed", 0, &(_ar.next_seed));
 80 
 81   /* parse platform */
 82   _ar.platform = misc_parse_out_option(&argc, argv, "platform", 0);
 83   misc_parse_option_as_int(&argc, argv, "gpio-channel", 0, &(_ar.gpio_channel));
 84   int chirp_len = CHIRP_CHIPS*MOD_FACTOR;
 85   _ar.next_chirp = g_new0(int16_t, chirp_len);
 86   ar_pn_generate_chirp(_ar.next_chirp, chirp_len, _ar.next_seed, _ar.next_mod, 1.0);
 87    
 88   /* turn on amplifier via GPIO */
 89   ar_amplifier_enable(&(_ar), 1);
 90 
 91   if (misc_args_remain(&argc, argv))
 92     usage(argv[0]);
 93 
 94   while (1) {
 95     ar_emit_current_chirp(&_ar, 1);
 96   }
 97 
 98   return 0;
 99 }
100 
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.