📄 daa.h
字号:
/******************************************************************************/
/******************************************************************************/
/* DAA.H - CPC5604A DAA driver routines */
/* */
/* This module is the device library for the CPC5604A DAA on the */
/* 54XX DSK board. */
/* */
/* MACRO FUNCTIONS: */
/* */
/* FUNCTIONS: */
/* */
/* daa_init() - Perform required initialization and default configuration */
/* daa_reset() - Reset the DAA */
/* daa_ring_detect() - Test if ring is present */
/* daa_cid() - Enable Caller Id Monitoring */
/* daa_onhook() - Place DAA in onhook state */
/* daa_offhook() - Place DAA in offhook state */
/* */
/******************************************************************************/
#ifndef _DAA_H_
#define _DAA_H_
#include <type.h>
/*****************************************************************************/
/* INCLUDES */
/*****************************************************************************/
/*****************************************************************************/
/* DEFINES */
/*****************************************************************************/
#undef OK
#define OK 0
#undef ERROR
#define ERROR -1
#define DAA_STATUS_REG CPLD_STAT_REG
#define DAA_CTRL_REG CPLD_CTRL2_REG
/*****************************************************************************/
/* typedefs & enums */
/*****************************************************************************/
// CPC5604A DAA bit Masks
typedef enum
{
DAA_STATUS_MSK = 0x01, // mask for all DAA status bits
DAA_CTRL_MSK = 0xc0, // mask for all DAA control bits
DAA_RING_MSK = 0x01, // mask for DAA Ring status
DAA_HOOK_MSK = 0x80, // mask for DAA hook control
DAA_CID_MSK = 0x40 // mask for DAA cid control
} DaaMask, *PDaaMask;
// CPC5604A DAA control
typedef enum
{
DAA_ONHOOK = 0x00, //DAA on hook control value
DAA_OFFHOOK = 0x80, //DAA off hook control value
DAA_CID_DISABLE = 0x00, //DAA cid disable control value
DAA_CID_ENABLE = 0x40 //DAA cid enable control value
} DaaCtrl, *PDaaCtrl;
/*****************************************************************************/
/* PUBLIC FUNCTION PROTOTYPES */
/*****************************************************************************/
/*****************************************************************************/
/* int daa_init(void) */
/* */
/* This routine performs required initialization and default configuration. */
/* */
/* Parameters: */
/* - None */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int daa_init(void);
/*****************************************************************************/
/* int daa_reset(void) */
/* */
/* This routine resets the CPC5604A DAA registers to their default values */
/* */
/* Parameters: */
/* - None */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int daa_reset(void);
/*****************************************************************************/
/* bool daa_ring_detect(void) */
/* */
/* This routine returns the current ring status of the DAA. */
/* */
/* Parameters: */
/* - None. */
/* */
/* Return: */
/* - TRUE if ring detected */
/* - FALSE if no ring detected */
/* */
/* Notes: */
/* */
/*****************************************************************************/
bool daa_ring_detect(void);
/*****************************************************************************/
/* int daa_cid(DaaCtrl cid) */
/* */
/* This routine enables or disabled cid monitoring. */
/* */
/* Parameters: */
/* - cid - an element of an enumeration with valid values of: */
/* DAA_CID_ENABLE. */
/* and DAA_CID_DISABLE */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int daa_cid(DaaCtrl cid);
/*****************************************************************************/
/* int daa_onhook(void) */
/* */
/* This routine places the daa in the onhook state. */
/* */
/* Parameters: */
/* - None. */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int daa_onhook(void);
/*****************************************************************************/
/* int daa_offhook(void) */
/* */
/* This routine places the daa in the offhook state. */
/* */
/* Parameters: */
/* - None. */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int daa_offhook(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -