Exemple #1
0
int Cirrus_Logic_beep (int frequency, int length)
     {
     char buffer[VOICE_BUF_LEN];
     int watchdog_count = 0;

     reset_watchdog();
     sprintf(buffer, "AT#VBP");
     lprintf(L_MESG, "Checking Beep");

     if (voice_command(buffer, "") != OK)
          return(FAIL);

     while (!check_for_input(voice_fd))
          {
          
          if ((watchdog_count--) <= 0)
               {
               reset_watchdog();
               watchdog_count = cvd.watchdog_timeout.d.i * 1000 /
                cvd.poll_interval.d.i / 2;
               }

          delay(cvd.poll_interval.d.i);
          }

     if (voice_command("", "OK") != VMA_USER_1)
          return(FAIL);

     return(OK);
     }
Exemple #2
0
void loop_test_02(void *pvParameters)
{	
	unsigned int delay = *(unsigned int*)pvParameters;
    uint8_t buf[2] = {0, 0};
    int acc_x = 0, acc_y = 0, acc_z = 0;

    asm("FIQ ON");
    
	i2cInit();
	
    while(1)
    {
	    vTaskDelay( delay / portTICK_RATE_MS );

        #if 1
	    // To read back chip id from BMA180 ( 7bits address = 0x41 )
	    i2cRead(0x41, 0x0, 1, (uint8_t*)&buf); // chip id - 0x03

	    // Read X
	    acc_x =0; buf[0] = 0; buf[1] = 0;
	    i2cRead(0x41, 0x2, 2, (uint8_t*)&buf);
	    acc_x = ((buf[1]<<8) | buf[0]) & 0xFFFC;
	    reset_watchdog();

	    if(acc_x > ACC_MAX)      // side 1
            SpeechIndex = 1;
	    else if(acc_x < ACC_MIN) // side 2
            SpeechIndex = 2;
        
	    // Read Y
	    acc_y =0; buf[0] = 0; buf[1] = 0;
	    i2cRead(0x41, 0x4, 2, (uint8_t*)&buf);
	    acc_y = ((buf[1]<<8) | buf[0]) & 0xFFFC;
	    reset_watchdog();

	    if(acc_x > ACC_MAX)      // side 3
            SpeechIndex = 3;
	    else if(acc_x < ACC_MIN) // side 4
            SpeechIndex = 4;

	    // Read Z
	    acc_z =0; buf[0] = 0; buf[1] = 0;
	    i2cRead(0x41, 0x6, 2, (uint8_t*)&buf);
	    acc_z = ((buf[1]<<8) | buf[0]) & 0xFFFC;
	    reset_watchdog();

	    if(acc_x > ACC_MAX)      // side 5
           SpeechIndex = 5;
	    else if(acc_x < ACC_MIN) // side 6
            SpeechIndex = 6;
        #endif
    }
}
Exemple #3
0
int Cirrus_Logic_set_device (int device)
     {
     reset_watchdog();
     lprintf(L_MESG, "Setting device");

     switch (device)
          {
          case NO_DEVICE:
               voice_command("AT#VLN=0", "OK");
               return(OK);
          case DIALUP_LINE:
               voice_command("AT#VLN=1", "OK");
               return(OK);
          case EXTERNAL_MICROPHONE:
               voice_command("AT#VLN=32", "OK");
               return(OK);
          case INTERNAL_SPEAKER:
               voice_command("AT#VLN=16", "OK");
               return(OK);
          case LOCAL_HANDSET:
               voice_command("AT#VLN=2","OK");
               return(OK);
          }

     lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
      device);
     return(FAIL);
     }
Exemple #4
0
static int Dr_Neuhaus_set_device (int device)
     {
     reset_watchdog();

     switch (device)
          {
          case NO_DEVICE:
               voice_command("AT+VLS=0", "OK");
               return(OK);
          case DIALUP_LINE:
               voice_command("AT+VLS=2", "OK");
               return(OK);
          case INTERNAL_SPEAKER:
               voice_command("AT+VLS=4", "OK");
               return(OK);
          case INTERNAL_MICROPHONE:
	       /* The Smarty has an INTERNAL_MICROPHONE.
		* -- Raoul Boenisch <*****@*****.**>
		*/
               voice_command("AT+VLS=14", "OK");
               return(OK);

          };

     lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
      device);
     return(FAIL);
     }
Exemple #5
0
/* This is normally the Oops function. */
void
die_if_kernel(const char *str, struct pt_regs *regs, long err)
{
	if (user_mode(regs))
		return;

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	/*
	 * This printout might take too long and could trigger
	 * the watchdog normally. If NICE_DOGGY is set, simply
	 * stop the watchdog during the printout.
	 */
	stop_watchdog();
#endif

	handle_BUG(regs);

	printk("%s: %04lx\n", str, err & 0xffff);

	show_registers(regs);

	oops_in_progress = 0;

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	reset_watchdog();
#endif
	do_exit(SIGSEGV);
}
Exemple #6
0
static int ZyXEL_2864_set_device (int device)
     {
     reset_watchdog();

     switch (device)
          {
          case NO_DEVICE:
               voice_command("AT+VLS=0", "OK");
               return(OK);
          case LOCAL_HANDSET:
               voice_command("AT+VLS=1", "OK");
               return(OK);
          case DIALUP_LINE:
          
               if (voice_command("AT+VLS=2", "OK|CONNECT*") == VMA_USER_2)
                    return(VMA_CONNECT);
                    
               return(OK);
          case EXTERNAL_MICROPHONE:
               voice_command("AT+VLS=8", "OK");
               return(OK);
          case INTERNAL_SPEAKER:
               voice_command("AT+VLS=16", "OK");
               return(OK);
          };

     lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
      device);
     return(FAIL);
     }
static void
console_write_direct(struct console *co, const char *buf, unsigned int len)
{
	int i;
	unsigned long flags;

        if (!port)
		return;

	local_irq_save(flags);

	/*           */
	for (i = 0; i < len; i++) {
		/*            */
		if (buf[i] == '\n') {
			while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
			;
			*port->write = '\r';
		}
		/*                                          */
		while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
			;
		*port->write = buf[i];
	}

	/*
                                                                    
                                                                
                                                                    
                                          
 */
	reset_watchdog();

	local_irq_restore(flags);
}
Exemple #8
0
void loop_test_01(void *pvParameters)
{	
	unsigned int delay = *(unsigned int*)pvParameters;

	SACM_A1600_Initial();		// A1600 initial
	
    while(1)
    {
        #ifdef LOOP_PLAY
        // Start
        // SpeechIndex = 0, Say... welcome to tom's wheel
        // SpeechIndex = 1, Say...  1
        // SpeechIndex = 2, Say...  2
        // SpeechIndex = 3, Say...  3
        // SpeechIndex = 4, Say...  4
        // SpeechIndex = 5, Say...  5
        // SpeechIndex = 6, Say...  6
        // Go back to start

	    vTaskDelay( delay / portTICK_RATE_MS );
    	SACM_A1600_Play(SpeechIndex, DAC1 + DAC2, Ramp_Up + Ramp_Dn);

    	if(++SpeechIndex >= MaxSpeechNum)		// next speech
		    SpeechIndex = 0;
		#endif
		
		#ifdef GKEY_PLAY
        vTaskDelay( delay / portTICK_RATE_MS );
    	SACM_A1600_Play(SpeechIndex, DAC1 + DAC2, Ramp_Up + Ramp_Dn);
		#endif

		reset_watchdog(); 

    }
}
Exemple #9
0
static int Multitech_2834_set_device(int device)
     {
     reset_watchdog();

     switch (device)
          {
          case NO_DEVICE:
               voice_command("AT+VLS=0", "OK");
               return(OK);
          case LOCAL_HANDSET:
               voice_command("AT+VLS=2", "OK");
               return(OK);
          case DIALUP_LINE:
               voice_command("AT+VLS=1", "OK"); /* [email protected] */
               return(OK);
          case EXTERNAL_MICROPHONE:
               voice_command("AT+VLS=11", "OK");
               return(OK);
          case INTERNAL_SPEAKER:
               voice_command("AT+VLS=4", "OK");
               return(OK);
          };

     lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
      device);
     return(FAIL);
     }
Exemple #10
0
static int Lucent_set_device (int device)
     {
     reset_watchdog();

     switch (device)
          {
	  case DIALUP_WITH_LOCAL_HANDSET:
          case NO_DEVICE:
               voice_command("AT+VLS=0", "OK");
               return(OK);
          case DIALUP_LINE:
               voice_command("AT+VLS=1", "OK");
               return(OK);
	  case LOCAL_HANDSET:
	    voice_command("AT+VLS=2", "OK");
	    return(OK);
          case INTERNAL_SPEAKER:
               voice_command("AT+VLS=4", "OK");
               return(OK);
          case INTERNAL_MICROPHONE:
               voice_command("AT+VLS=6", "OK");
               return(OK);
	  case DIALUP_WITH_INT_SPEAKER:
	    voice_command("AT+VLS=5", "OK");
	    return(OK);
	  case DIALUP_WITH_INTERNAL_MIC_AND_SPEAKER:
	    voice_command("AT+VLS=7", "OK");
	    return(OK);

          };

     lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
      device);
     return(FAIL);
     }
Exemple #11
0
static int Dolphin_set_device (int device)
{
    reset_watchdog();

    switch (device)
    {
    case NO_DEVICE:

        if (voice_write("AT+VLS=0") != OK)
            return(FAIL);

        if (voice_command("", "AT+VLS=0|OK") == VMA_USER_1)
            voice_command("", "OK");

        return(OK);
    case DIALUP_LINE:
        voice_command("AT+VLS=2", "VCON");
        return(OK);
    case INTERNAL_SPEAKER:
        voice_command("AT+VLS=16", "VCON");
        return(OK);
    };

    lprintf(L_WARN, "%s: Unknown output device (%d)", voice_modem_name,
            device);
    return(FAIL);
}
Exemple #12
0
static int Dolphin_set_compression (p_int *compression, p_int *speed, int *bits)
{
    reset_watchdog();

    if (*compression == 0)
        *compression = 2;

    if (*speed == 0)
        *speed = 9600;

    if (*speed != 9600)
    {
        lprintf(L_WARN, "%s: Illegal sample rate (%d)", voice_modem_name,
                *speed);
        return(FAIL);
    };

    if (*compression != 2)
    {
        lprintf(L_WARN, "%s: Illegal voice compression method (%d)",
                voice_modem_name, *compression);
        return(FAIL);
    };

    *bits = 2;

    if (voice_command("AT+VSM=2", "OK") != VMA_USER_1)
        return(FAIL);

    return(OK);
}
Exemple #13
0
static int Dolphin_init (void)
{
    char buffer[VOICE_BUF_LEN];

    reset_watchdog();
    voice_modem_state = INITIALIZING;
    lprintf(L_MESG, "initializing Dolphin voice modem");

    /*
     * AT+VNH=1 - Disable automatic hangup.
     */

    if (voice_command("AT+VNH=1", "OK") != VMA_USER_1)
        lprintf(L_WARN, "disabling automatic hangup didn't work");

    /*
     * AT+VSD=x,y - Set silence threshold and duration.
     */

    sprintf(buffer, "AT+VSD=%d,%d", (int)cvd.rec_silence_threshold.d.i * 31 / 100,
            (int)cvd.rec_silence_len.d.i);

    if (voice_command(buffer, "OK") != VMA_USER_1)
        lprintf(L_WARN, "setting recording preferences didn't work");

    voice_modem_state = IDLE;
    return(OK);
}
static void boot_moniter_work(struct work_struct *work)
{
    struct aml_wdt_dev *wdev=container_of(work,struct aml_wdt_dev,boot_queue.work);
    reset_watchdog();
    mod_delayed_work(system_freezable_wq, &wdev->boot_queue,
                     round_jiffies(msecs_to_jiffies(wdev->reset_watchdog_time*1000)));
}
static void
console_write_direct(struct console *co, const char *buf, unsigned int len)
{
	int i;
	unsigned long flags;

        if (!port)
		return;

	local_irq_save(flags);

	/* Send data */
	for (i = 0; i < len; i++) {
		/* LF -> CRLF */
		if (buf[i] == '\n') {
			while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
			;
			*port->write = '\r';
		}
		/* Wait until transmitter is ready and send.*/
		while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
			;
		*port->write = buf[i];
	}

	/*
	 * Feed the watchdog, otherwise it will reset the chip during boot.
	 * The time to send an ordinary boot message line (10-90 chars)
	 * varies between 1-8ms at 115200. What makes up for the additional
	 * 90ms that allows the watchdog to bite?
	*/
	reset_watchdog();

	local_irq_restore(flags);
}
Exemple #16
0
/* This is normally the Oops function. */
void die_if_kernel(const char *str, struct pt_regs *regs, long err)
{
	if (user_mode(regs))
		return;

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	/*
	 * This printout might take too long and could trigger
	 * the watchdog normally. If NICE_DOGGY is set, simply
	 * stop the watchdog during the printout.
	 */
	stop_watchdog();
#endif

	oops_enter();
	handle_BUG(regs);

	pr_err("Linux %s %s\n", utsname()->release, utsname()->version);
	pr_err("%s: %04lx\n", str, err & 0xffff);

	show_registers(regs);

	oops_exit();
	oops_in_progress = 0;
	pr_err("\n"); /* Flush mtdoops.  */

#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
	reset_watchdog();
#endif
	do_exit(SIGSEGV);
}
Exemple #17
0
int main()
{
    //unsigned int delay_1 = 5000, delay_2 = 4000;

    bsp_init();

    xSemaphore = xSemaphoreCreateBinary();

    /* Create the tasks defined within this file. */
    //xTaskCreate(CDecoder, "CDecoder", configMINIMAL_STACK_SIZE, NULL, 4, NULL );
    //xTaskCreate(loop_test_01, "loop_test_01", configMINIMAL_STACK_SIZE, (void*)&delay_1, 6, NULL );
    //xTaskCreate(loop_test_02, "loop_test_02", configMINIMAL_STACK_SIZE, (void*)&delay_2, 3, NULL );
    xTaskCreate(led_update, "led_update", configMINIMAL_STACK_SIZE, NULL, 3, &xHandle[led_task] );
    xTaskCreate(key_scan, "key_scan", configMINIMAL_STACK_SIZE, NULL, 5, &xHandle[key_task] );
    xTaskCreate(audio_play, "audio_play", configMINIMAL_STACK_SIZE, NULL, 4, &xHandle[audio_task] );
    
    /* In this port, to use preemptive scheduler define configUSE_PREEMPTION
	as 1 in portmacro.h.  To use the cooperative scheduler define
	configUSE_PREEMPTION as 0. */
    vTaskStartScheduler();     
    
    // RunSchedular fail!!
    while(1)
    {
    	reset_watchdog();  
    }
    
    return 0;
}
Exemple #18
0
static inline irqreturn_t
timer_interrupt(int irq, void *dev_id)
{
	struct pt_regs *regs = get_irq_regs();
	/* acknowledge the timer irq */

#ifdef USE_CASCADE_TIMERS
	*R_TIMER_CTRL =
		IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
		IO_FIELD( R_TIMER_CTRL, timerdiv0, 0) |
		IO_STATE( R_TIMER_CTRL, i1, clr) |
		IO_STATE( R_TIMER_CTRL, tm1, run) |
		IO_STATE( R_TIMER_CTRL, clksel1, cascade0) |
		IO_STATE( R_TIMER_CTRL, i0, clr) |
		IO_STATE( R_TIMER_CTRL, tm0, run) |
		IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
#else
	*R_TIMER_CTRL = r_timer_ctrl_shadow |
		IO_STATE(R_TIMER_CTRL, i0, clr);
#endif

	/* reset watchdog otherwise it resets us! */
	reset_watchdog();

	/* Update statistics. */
	update_process_times(user_mode(regs));

	/* call the real timer interrupt handler */

	do_timer(1);

        cris_do_profile(regs); /* Save profiling information */
        return IRQ_HANDLED;
}
Exemple #19
0
     int V253modem_set_device (int device)
     {
       int Result;
       reset_watchdog();
       lprintf(L_JUNK, "%s: %s: (%d)", voice_modem_name, 
	       voice_device_mode_name(device), device);

     switch (device)
          {
          case NO_DEVICE:
	    Result = voice_command("AT+VLS=0", "OK");
	    break;
          case DIALUP_LINE:
	    Result = voice_command("AT+VLS=1", "OK");
	    break;
          case EXTERNAL_MICROPHONE:
	    Result = voice_command("AT+VLS=11", "OK");
	    break;
          case INTERNAL_MICROPHONE:
	    Result = voice_command("AT+VLS=6", "OK");
	    break;
          case INTERNAL_SPEAKER:
	    Result = voice_command("AT+VLS=4", "OK");
	    break;
          case EXTERNAL_SPEAKER:
	    Result = voice_command("AT+VLS=8", "OK");
	    break;
          case LOCAL_HANDSET :
	    Result = voice_command("AT+VLS=2", "OK");
	    break;
          case DIALUP_WITH_EXT_SPEAKER :
	    Result = voice_command("AT+VLS=9", "OK");
	    break;
          case DIALUP_WITH_INT_SPEAKER :
	    Result = voice_command("AT+VLS=5", "OK");
	    break;
          case DIALUP_WITH_LOCAL_HANDSET :
	    Result = voice_command("AT+VLS=3", "OK");
	    break;
          case DIALUP_WITH_EXTERNAL_MIC_AND_SPEAKER:
	    Result = voice_command("AT+VLS=13", "OK");
	    break;
          case DIALUP_WITH_INTERNAL_MIC_AND_SPEAKER:
	    Result = voice_command("AT+VLS=7", "OK");
	    break;
	  default:
	    lprintf(L_WARN, "%s: Unknown device (%d)", 
		    voice_modem_name, device);
	    return(FAIL);
          }

     if (Result != VMA_USER_1)   
       {
	 lprintf(L_WARN, "can't set %s (modem hardware can't do that)",
		 voice_device_mode_name(device));
	 return(VMA_DEVICE_NOT_AVAIL);
       }
     return(OK);
     }
static int aml_wdt_ping(struct watchdog_device *wdog)
{
    spin_lock(&wdt_lock);
    reset_watchdog();
    spin_unlock(&wdt_lock);

    return 0;
}
static void aml_wdt_shutdown(struct platform_device *pdev)
{
    struct watchdog_device *wdog = platform_get_drvdata(pdev);
    struct aml_wdt_dev *wdev = watchdog_get_drvdata(wdog);
    if(wdev->reset_watchdog_method==1)
        cancel_delayed_work(&wdev->boot_queue);
    reset_watchdog();
}
Exemple #22
0
int Multitech_5634ZPX_set_compression(p_int *compression, p_int *speed,
 int *bits)
     {
     char buffer[VOICE_BUF_LEN];

     reset_watchdog();

     if (*compression == 0)
          *compression = 132;

     if (*speed == 0)
          *speed = 8000;

     if (*speed != 8000)
          {
          lprintf(L_WARN, "%s: Illegal sample rate (%d)", voice_modem_name,
           (int)*speed);
          return(FAIL);
          }

     /*
        VSM=cml,vsr,scs,sel
	cml: 128-256 (compression method)
		128,"8-BIT LINEAR",(7200,8000,11025)
		129,"16-BIT LINEAR",(7200,8000,11025)
		130,"8-BIT ALAW",(8000)
		131,"8-BIT ULAW",(8000)
		132,"IMA ADPCM",(7200,8000,11025)
	vsr: (voice sample rate)
	scs: 0 (disabled), 1-n (how much noise is silence)
	sel: 0 (disabled), 1-n (.1 sec incr: silence expansion)
     */
     switch (*compression)
          {
          case 4:
               *bits = 4;
               sprintf(buffer, "AT+VSM=2,%d", (int)*speed);

               if (voice_command(buffer, "OK") != VMA_USER_1)
                    return(FAIL);

               break;
          case 132:
               *bits = 4;
               sprintf(buffer, "AT+VSM=132,%d", (int)*speed);

               if (voice_command(buffer, "OK") != VMA_USER_1)
                    return(FAIL);

               break;
          default:
               lprintf(L_WARN, "%s: Illegal voice compression method (%d)",
                voice_modem_name, (int)*compression);
               return(FAIL);
          }

     return(OK);
     }
Exemple #23
0
static int aml_wdt_ping(struct watchdog_device *wdog)
{
	struct aml_wdt_dev *wdev = watchdog_get_drvdata(wdog);
	mutex_lock(&wdev->lock);
	reset_watchdog(wdev);
	mutex_unlock(&wdev->lock);

	return 0;
}
Exemple #24
0
static int UMC_beep(int frequency, int length)
     {
#ifdef UMC_VTS_WORKAROUND
     /*
      * generate a beep with 900Hz
      * sorry: just a near miss.
      */

     TIO tio;
     char *sinewave="\x37\x8c\xc8\x73";
     int sinelen=4;
     int i;

     tio_get(voice_fd, &tio);
     tio_set_flow_control(voice_fd, &tio, FLOW_HARD);
     tio_set(voice_fd, &tio);

     voice_command("AT#VBS=4", "OK");
     voice_command("AT#VTX", "CONNECT");

     lprintf(L_JUNK, "%s->%s: sinewave", program_name, voice_modem_name);

     for (i=length; i>0; i--)
          {

          if (write(voice_fd,sinewave,sinelen) != sinelen)
               lprintf(L_WARN, "%s->%s: write error (errno 0x%x)",
                program_name, voice_modem_name, errno);

          }

     lprintf(L_JUNK, "%s->%s: <DLE> <ETX>", program_name, voice_modem_name);

     if (write(voice_fd, dletx , 2) != 2)
          lprintf(L_WARN, "%s->%s: write error (errno 0x%x)",
           program_name, voice_modem_name, errno);

     tio_set(voice_fd, &voice_tio);
     voice_command("", "VCON");
#else
     char buffer[VOICE_BUF_LEN];

     reset_watchdog();
     if (length > 4000 )
          lprintf(L_WARN, "%s->%s: Warning beeps longer than 4000 ms might not be supported.",
	   program_name, voice_modem_name);

     lprintf(L_JUNK, "%s->%s: Some UMC modems beep with fixed frequency. This is a not a software bug.",
      program_name, voice_modem_name);

     sprintf(buffer, "AT#VTS=[%d,0,%d]", frequency, length / 100);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          return(FAIL);
#endif
     return(OK);
     }
Exemple #25
0
static int Dr_Neuhaus_init (void)
     {
     char buffer[VOICE_BUF_LEN];

     reset_watchdog();
     voice_modem_state = INITIALIZING;
     lprintf(L_MESG, "initializing Dr. Neuhaus voice modem");

     /*
      * AT+VSD=x,y - Set silence threshold and duration.
      */

     sprintf(buffer, "AT+VSD=%d,%d", cvd.rec_silence_threshold.d.i *
      10 / 100 + 123, cvd.rec_silence_len.d.i);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          lprintf(L_WARN, "setting recording preferences didn't work");

     /*
      * AT+VGT - Set the transmit gain for voice samples.
      */

     if (cvd.transmit_gain.d.i == -1)
          cvd.transmit_gain.d.i = 100;

     sprintf(buffer, "AT+VGT=%d", cvd.transmit_gain.d.i * 10 / 100 +
      123);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          lprintf(L_WARN, "setting transmit gain didn't work");

     /*
      * AT+VGR - Set receive gain for voice samples.
      */

     if (cvd.receive_gain.d.i == -1)
          cvd.receive_gain.d.i = 40;

     sprintf(buffer, "AT+VGR=%d", cvd.receive_gain.d.i * 10 / 100 +
      123);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          lprintf(L_WARN, "setting receive gain didn't work");

     if (voice_command("AT+VIT=0", "OK") != VMA_USER_1)
          lprintf(L_WARN, "can't deactivate inactivity timer");

     if (voice_command("AT+VPR=0", "OK") != VMA_USER_1)
          lprintf(L_WARN, "can't select autobauding");

     if (voice_command("AT+VLS=0", "OK") != VMA_USER_1)
          lprintf(L_WARN, "can't deselect all input/output devices");

     voice_modem_state = IDLE;
     return(OK);
     }
static int
Multitech_5600ZDXv_set_compression (p_int *compression, p_int *speed, int *bits)
{
  char buf[VOICE_BUF_LEN];

  reset_watchdog();
  /*
   * Build the speed command and send it
   */
  switch (*speed) {
    case 0:
      *speed = 7200;
      /* FALL THROUGH */
    case 7200:
    case 11025:
      break;

    default:
      lprintf(L_WARN, "%s: Illegal sample rate (%d)", voice_modem_name, (int)*speed);
      return(FAIL);
  }
  if (sprintf(buf, "AT#VSR=%d", (int)*speed) == -1) {
    lprintf(L_ERROR, "%s: Command too long", __FUNCTION__);
  }
  if (voice_command(buf, "OK") != VMA_USER_1) {
    return(FAIL);
  }
  /*
   * Build the number of bits and send it
   */
  switch (*compression) {
    case 0:
      *compression = 2;
      /* FALL THROUGH */
    case 2:
    case 4:
    case 8:
      *bits = *compression;
      break;

    default:
      lprintf(L_WARN,
              "ROCKWELL handle event: Illegal voice compression method (%d)",
              *compression);
      return(FAIL);
  }
  if (sprintf(buf, "AT#VBS=%d", *bits) == -1) {
    lprintf(L_ERROR, "%s: Command too long", __FUNCTION__);
  }
  if (voice_command(buf, "OK") != VMA_USER_1) {
    return(FAIL);
  }
  return (OK);
}
Exemple #27
0
int UMC_switch_to_data_fax(char *mode)
     {
     char buffer[VOICE_BUF_LEN];
     reset_watchdog();
     sprintf(buffer, "AT#CLS=%s", mode);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          return(FAIL);

     return(OK);
     }
Exemple #28
0
static inline irqreturn_t
timer_interrupt(int irq, void *dev_id)
{
	struct pt_regs *regs = get_irq_regs();
	/* acknowledge the timer irq */

#ifdef USE_CASCADE_TIMERS
	*R_TIMER_CTRL =
		IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
		IO_FIELD( R_TIMER_CTRL, timerdiv0, 0) |
		IO_STATE( R_TIMER_CTRL, i1, clr) |
		IO_STATE( R_TIMER_CTRL, tm1, run) |
		IO_STATE( R_TIMER_CTRL, clksel1, cascade0) |
		IO_STATE( R_TIMER_CTRL, i0, clr) |
		IO_STATE( R_TIMER_CTRL, tm0, run) |
		IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
#else
	*R_TIMER_CTRL = r_timer_ctrl_shadow | 
		IO_STATE(R_TIMER_CTRL, i0, clr);
#endif

	/* reset watchdog otherwise it resets us! */
	reset_watchdog();
	
	/* Update statistics. */
	update_process_times(user_mode(regs));

	/* call the real timer interrupt handler */

	do_timer(1);
	
        cris_do_profile(regs); /* Save profiling information */

	/*
	 * If we have an externally synchronized Linux clock, then update
	 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
	 * called as close as possible to 500 ms before the new second starts.
	 *
	 * The division here is not time critical since it will run once in 
	 * 11 minutes
	 */
	if (ntp_synced() &&
	    xtime.tv_sec > last_rtc_update + 660 &&
	    (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 &&
	    (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) {
		if (set_rtc_mmss(xtime.tv_sec) == 0)
			last_rtc_update = xtime.tv_sec;
		else
			last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
	}
        return IRQ_HANDLED;
}
Exemple #29
0
int Cirrus_Logic_answer_phone (void)
     {
     reset_watchdog();
     lprintf(L_MESG, "Answering Call");

     if (voice_command("AT#VLN=1", "OK") != VMA_USER_1)
          return(VMA_ERROR);

     if (voice_command("AT#VIP=1", "OK") != VMA_USER_1)
          return(VMA_ERROR);

     return(VMA_OK);
     }
Exemple #30
0
int Cirrus_Logic_switch_to_data_fax (char *mode)
     {
     char buffer[VOICE_BUF_LEN];

     lprintf(L_MESG, "Switching to data/fax");
     reset_watchdog();
     sprintf(buffer, "AT+FCLASS=%s", mode);

     if (voice_command(buffer, "OK") != VMA_USER_1)
          return(FAIL);

     return(OK);
     }