📄 dc550_audio.h
字号:
/*****************************************************************************/
/* CONFIDENTIAL */
/* Sigpro Copyright 2003, All rights reserved */
/*****************************************************************************/
/* CLIENT: Telematrix */
/* PROJECT: DC550 Digital Centrex Phone */
/* FILE: dc550_audio.h */
/*****************************************************************************/
/* This is the header file for dc550_audio.c. */
/*****************************************************************************/
#ifndef __DC550_AUDIO_HEADER__
#define __DC550_AUDIO_HEADER__
#include "dc550_local.h"
/******************************************************************************
* CONSTANTS AND DATA TYPES
*****************************************************************************/
#define AUDIO_NOPOWER_RINGVOL 4
#define AUDIO_NOPOWER_SPEAKERVOL 6
/*
* Port Pin Assignments for Audio Routing Signals
* ----------------------------------------------
*
* AUDIO RECEPTION
* ---------------
* Audio signals may be sourced from one of two places, the
* phone line or the DTMF tone generator on the main board.
* This routing is controlled by the RX_SEL signal.
*
* RX_SEL | AUDIO SOURCE
* -----------+---------------------
* 0 | DTMF tone generator
* 1 | Phone line
*
* These audio signals may go to any of three places: the
* handset ear piece, the headset ear piece or the speaker.
* It is possible to route the audio to multiple places.
* The following table shows the signals involved in
* routing the incoming audio signal. A one on any of
* the *_SEL signals will enable that pathway.
*
* SPK_EN | EAR_EN | HEAD_EN | AUDIO CHANNEL
* --------+----------+-----------+-----------------
* 1 | x | x | Speaker On
* x | 1 | x | Handset Ear On
* x | x | 1 | Headset On
*
*
* AUDIO TRANSMISSION
* ------------------
* It is also desirable to transmit audio signals out onto
* the phone line. Audio signals for transmission may be
* generated by either the DTMF tone generator or by a
* user speaking over one of the telephone microphones.
* This selection is controlled by the TX_SEL signal.
*
* TX_SEL | AUDIO SOURCE
* -----------+---------------------
* 0 | DTMF tone generator
* 1 | Phone microphone
*
* When the microphone is selected, there are several more
* signals used to determine which microphone will be routed
* to the phone line. Only one microphone may be enabled at
* a time. The following table describes how to select a
* particular microphone.
*
* MIC_SEL | HEAD_EN | AUDIO CHANNEL
* ---------+-----------+---------------
* 0 | x | Speaker Mic
* 1 | 0 | Handset Mic
* 1 | 1 | Headset Mic
*
*/
#define AUDIO_RX_SEL_DIR P5DIR
#define AUDIO_RX_SEL_OUT P5OUT
#define AUDIO_RX_SEL_MSK 0x20
#define AUDIO_TX_SEL_DIR P5DIR
#define AUDIO_TX_SEL_OUT P5OUT
#define AUDIO_TX_SEL_MSK 0x40
#define AUDIO_MIC_SEL_DIR P5DIR
#define AUDIO_MIC_SEL_OUT P5OUT
#define AUDIO_MIC_SEL_MSK 0x80
#define AUDIO_HEAD_EN_DIR P6DIR
#define AUDIO_HEAD_EN_OUT P6OUT
#define AUDIO_HEAD_EN_MSK 0x80
#define AUDIO_SPKR_EN_DIR P3DIR
#define AUDIO_SPKR_EN_OUT P3OUT
#define AUDIO_SPKR_EN_MSK 0x40
#define AUDIO_EAR_EN_DIR P3DIR
#define AUDIO_EAR_EN_OUT P3OUT
#define AUDIO_EAR_EN_MSK 0x80
/*
* AUDIO_CHANNEL
* -------------
* Enumeration used to identify an audio channel on the
* telephone for the audio interface subroutines.
* AUDIO_OFF - turn all audio channels off.
* In actuality, this will probably
* switch the audio output to the speaker
* and set it to the lowest possible volume
* AUDIO_HANDSET - send outgoing audio signal to the
* telephone handset. Volume level will
* be set to the value received via the
* last call to audio_volume(). If no
* volume level has been explicitly set
* for this audio channel, a default value
* will be used.
* AUDIO_SPEAKER - send outgoing audio signal to the
* telephone speaker. Volume level will
* be set to the value received via the
* last call to audio_volume(). If no
* volume level has been explicitly set
* for this audio channel, a default value
* will be used.
* AUDIO_HEADSET - send outgoing audio signal to the
* external headset. Volume level will
* be set to the value received via the
* last call to audio_volume(). If no
* volume level has been explicitly set
* for this audio channel, a default value
* will be used.
* AUDIO_RINGER - refers to the volume level to use when
* generating the ring tones over the
* telephone speaker. Note that no ring
* tones will ever be sent to the handset
* or headset speakers.
* AUDIO_BUZZER - refers to the volume level to use when
* generating the buzzer tone over the
* current audio channel.
* AUDIO_LAST - sentinel. This value (or larger)
* is an illegal audio channel.
*/
typedef enum enum_AUDIO_CHANNEL {
AUDIO_OFF =0,
AUDIO_HANDSET,
AUDIO_SPEAKER,
AUDIO_HEADSET,
AUDIO_RINGER,
AUDIO_BUZZER,
AUDIO_LAST
} AUDIO_CHANNEL;
/******************************************************************************
* GLOBAL VARIABLES
*****************************************************************************/
/******************************************************************************
* FUNCTION PROTOTYPES
*****************************************************************************/
/*
030321 Modification:
#define QUIET_TICKS (TICKS_PER_SECOND*3)
#define RING_TICKS (TICKS_PER_SECOND*3)
#define WARBLE_TICKS (TICKS_PER_SECOND/20)
*/
/*
* audio_select(channel)
* ---------------------
* Select the output channel for the audio signal
* Input:
* channel - may be one of the following values
* AUDIO_OFF, AUDIO_HANDSET, AUDIO_SPEAKER or
* AUDIO_HEADSET
* Output:
* ERR_NONE - no errors were encountered
* ERR_PARAM - invalid or illegal parameter value
*/
extern int audio_select(AUDIO_CHANNEL channel);
/*
* audio_volume(channel, volume)
* -----------------------------
* Set the volume level for the specified audio channel.
* Inputs:
* channel - may be one of the following values
* AUDIO_OFF, AUDIO_HANDSET, AUDIO_SPEAKER,
* AUDIO_HEADSET, AUDIO_RINGER or AUDIO_BUZZER
* volume - more details later,
* valid digital pot values are 0...255
* Output:
* ERR_NONE - no errors were encountered
* ERR_PARAM - invalid or illegal parameter value
*/
extern int audio_volume(AUDIO_CHANNEL channel, int volume);
/*
* audio_mute(muteOn)
* ------------------
* Enable or disable the telephone's microphones.
* Inputs:
* muteOn - 1 = turn off microphones
* 0 = turn on microphones
* Output:
* ERR_NONE - no errors were encountered
* ERR_PARAM - invalid or illegal parameter value
*/
extern int audio_mute(BOOL muteOn);
/*
* audio_ringer(ringerOn)
* ---------------------
* Turn on/off the ringer.
* Input:
* ringerOn - 1 = turn on the ringer
* 0 = turn off the ringer
* Output:
* ERR_NONE - no errors were encountered
* ERR_PARAM - invalid or illegal parameter value
*/
extern int audio_ringer(BOOL ringerOn);
/*
* audio_buzzer(buzzerOn)
* ----------------------
* Turn on/off the buzzer tone.
* Input:
* buzzerOn - 1 = turn on the buzzer
* 0 = turn off the buzzer
* Output:
* ERR_NONE - no errors were encountered
* ERR_PARAM - invalid or illegal parameter value
*/
extern int audio_buzzer(BOOL buzzerOn);
extern void audio_init(void);
extern void audio_exec(void);
/*
030321 Modification:
extern int audio_ringerStateMachine(void);
*/
#endif /* __DC550_AUDIO_HEADER__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -