?? tonetimer.c
字號:
/* tone_Timer.c - 音頻服務 應用層 定時器消息函數 */
/* Copyright 1994-2001 Wuhan Jinglun Electronic Co., Ltd. */
/*
modification history
--------------------
*/
/*
DESCRIPTION 根據定時器消息提供相應的服務。
*/
#include "nucleus.h"
#include "routon.h"
#include "debug.h"
#include <stdio.h>
#include <string.h>
#include "pcdisk.h"
#include "codec.h"
#include "intfTone.h"
#include "..\inc\rtn_tone.h"
//1個隊列
//extern NU_TIMER TONE_Timer_HFC_Start;
//extern NU_TIMER TONE_Timer_HFC_Stop;
extern NU_TIMER TONE_Timer_ARM_Start;
extern NU_TIMER TONE_Timer_ARM_Stop;
//extern NU_TIMER TONE_Timer_KEYS_Down;
//extern NU_TIMER TONE_Timer_DTMF_Down;
//2個設備
//extern TONE_APP_DEVICE_INFO_t gTONE_App_Device_Info_HFC;
extern TONE_APP_DEVICE_INFO_t gTONE_App_Device_Info_ARM;
///////////////////////////////////////////////////////////////////////
//中斷服務程序
///////////////////////////////////////////////////////////////////////
#if 0
/**********************************************************************
*
* FUNCTION "tone_HISR_Timer_HFC_Start" 定時器.中斷服務程序
*
***********************************************************************/
void tone_HISR_Timer_HFC_Start(UNSIGNED id)
{
RtnMSG s_msg;
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_HISR_Timer_HFC_Start");
s_msg.msg_len = 3;
s_msg.msg_code = MSG_TONE_TIMER_HFC_START;
status = NU_Send_To_Pipe(&rtn_pipe[TONE], &s_msg, s_msg.msg_len + 4, NU_NO_SUSPEND);
if (status < NU_SUCCESS)
{
PRINTERRR("ERRR: NU_Send_To_Pipe: %d. ", status);
LogError("Error %s L %d\n",__FILE__,__LINE__);
}
//PRINTFLOW("TIMER: Enddd: tone_HISR_Timer_HFC_Start");
return;
}
/**********************************************************************
*
* FUNCTION "tone_HISR_Timer_HFC_Stop" 定時器.中斷服務程序
*
***********************************************************************/
void tone_HISR_Timer_HFC_Stop(UNSIGNED id)
{
RtnMSG s_msg;
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_HISR_Timer_HFC_Stop");
s_msg.msg_len = 3;
s_msg.msg_code = MSG_TONE_TIMER_HFC_STOP;
status = NU_Send_To_Pipe(&rtn_pipe[TONE], &s_msg, s_msg.msg_len + 4, NU_NO_SUSPEND);
if (status < NU_SUCCESS)
{
PRINTERRR("ERRR: NU_Send_To_Pipe: %d. ", status);
LogError("Error %s L %d\n",__FILE__,__LINE__);
}
//PRINTFLOW("TIMER: Enddd: tone_HISR_Timer_HFC_Stop");
return;
}
#endif
/**********************************************************************
*
* FUNCTION "tone_HISR_Timer_ARM_Start" 定時器.中斷服務程序
*
***********************************************************************/
void tone_HISR_Timer_ARM_Start(UNSIGNED id)
{
RtnMSG s_msg;
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_HISR_Timer_ARM_Start");
s_msg.msg_len = 3;
s_msg.msg_code = MSG_TONE_TIMER_ARM_START;
status = NU_Send_To_Pipe(&rtn_pipe[TONE], &s_msg, s_msg.msg_len + 4, NU_NO_SUSPEND);
if (status < NU_SUCCESS)
{
PRINTERRR("ERRR: NU_Send_To_Pipe: %d. ", status);
LogError("Error %s L %d\n",__FILE__,__LINE__);
}
//PRINTFLOW("TIMER: Enddd: tone_HISR_Timer_ARM_Start");
return;
}
/**********************************************************************
*
* FUNCTION "tone_HISR_Timer_ARM_Stop" 定時器.中斷服務程序
*
***********************************************************************/
void tone_HISR_Timer_ARM_Stop(UNSIGNED id)
{
RtnMSG s_msg;
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_HISR_Timer_ARM_Stop");
s_msg.msg_len = 3;
s_msg.msg_code = MSG_TONE_TIMER_ARM_STOP;
status = NU_Send_To_Pipe(&rtn_pipe[TONE], &s_msg, s_msg.msg_len + 4, NU_NO_SUSPEND);
if (status < NU_SUCCESS)
{
PRINTERRR("ERRR: NU_Send_To_Pipe: %d. ", status);
LogError("Error %s L %d\n",__FILE__,__LINE__);
}
//PRINTFLOW("TIMER: Enddd: tone_HISR_Timer_ARM_Stop");
return;
}
///////////////////////////////////////////////////////////////////////
//函數
///////////////////////////////////////////////////////////////////////
#if 0
/**********************************************************************
*
* FUNCTION "tone_Proc_Timer_HFC_Expire_Start" 定時器.中斷服務程序
*
***********************************************************************/
int tone_Proc_Timer_HFC_Expire_Start(TONE_APP_DEVICE_INFO_t * App_Device)
{
// RtnMSG msg;
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_Proc_Timer_HFC_Expire_Start");
//PRINTINFO("tone_App_Data_Buf_Sub_Init: %8d\t iLoop_Period", App_Device->iLoop_Period);
//
//播放次數倒計時
//
App_Device->iLoop_Period--;
//
//如果播放循環結束,則定時器的使命完成
//
if (App_Device->iLoop_Period==0) //循環結束
{
status = NU_Control_Timer(&TONE_Timer_HFC_Start, NU_DISABLE_TIMER);
status = NU_Control_Timer(&TONE_Timer_HFC_Stop, NU_DISABLE_TIMER);
//??? 為什么與ARM的處理不一致,注釋掉后會不會有副作用
//status = HFC_Codec_Close(App_Device->idChannel);
return NU_SUCCESS;
}
//
//打開設備
//
status = HFC_Codec_Open(App_Device->idChannel,
App_Device->idMode, //
App_Device->idOrient);//
//
//寫出數據
//
status = HFC_Codec_Write(App_Device->idChannel,
(char *)App_Device->pBuf,
App_Device->iBuf,
App_Device->iLoop_Series);
//PRINTFLOW("TIMER: Enddd: tone_Proc_Timer_HFC_Expire_Start");
return NU_SUCCESS;
}
/**********************************************************************
*
* FUNCTION "tone_Proc_Timer_HFC_Expire_Stop" 定時器.中斷服務程序
*
***********************************************************************/
int tone_Proc_Timer_HFC_Expire_Stop(TONE_APP_DEVICE_INFO_t * App_Device)
{
STATUS status;
//PRINTFLOW("TIMER: Begin: tone_Proc_Timer_HFC_Expire_Stop");
//
//關閉設備
//
status = HFC_Codec_Close(App_Device->idChannel);
//PRINTFLOW("TIMER: Enddd: tone_Proc_Timer_HFC_Expire_Stop");
return NU_SUCCESS;
}
#endif
/**********************************************************************
*
* FUNCTION "tone_Proc_Timer_ARM_Expire_Start"
*
***********************************************************************/
int tone_Proc_Timer_ARM_Expire_Start(TONE_APP_DEVICE_INFO_t * App_Device)
{
STATUS status;
//
//播放次數倒計時
//
App_Device->iLoop_Period--; //周期循環次數
//
//如果播放循環結束,則定時器的使命完成
//
if (App_Device->iLoop_Period==0)
{
status = NU_Control_Timer(&TONE_Timer_ARM_Start, NU_DISABLE_TIMER);
status = NU_Control_Timer(&TONE_Timer_ARM_Stop, NU_DISABLE_TIMER);
//status = Codec_Close (CodecWrite, App_Device->idOrient, App_Device->idCodec);
return 0;
}
//
//如果播放到聽筒,則要做特殊處理
//
/*
if (App_Device->idOrient == TONE_ORIENT_ID_PHONE)
{
//
//啟動145481應用激勵 2002-05-08, modified, 控制有低層封裝
//
//status = PhDr_Iocntl(0, CNTLID_GCI_B1_ENABLE, 0);
PhDr_Open_codec_A_for_app();
}
*/
//
//打開設備
//
gTONE_App_Device_Info_ARM.idCodec = Codec_Open(CodecWrite, App_Device->idOrient);
//
//寫出數據
//
status = Codec_Write( (char *)App_Device->pBuf,
App_Device->iBuf, //連續循環次數
App_Device->iLoop_Series,
App_Device->idCodec );
return NU_SUCCESS;
}
/**********************************************************************
*
* FUNCTION "tone_Proc_Timer_ARM_Expire_Stop"
*
***********************************************************************/
int tone_Proc_Timer_ARM_Expire_Stop(TONE_APP_DEVICE_INFO_t * App_Device)
{
STATUS status;
//
//關閉設備
//
status = Codec_Close (CodecWrite, App_Device->idOrient, App_Device->idCodec);
//
//關閉145481應用激勵 2002-05-08, modified, 控制有低層封裝
//
//PhDr_Close_codec_A_for_app();
return NU_SUCCESS;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -