📄 slic.h
字号:
/*****************************************************************//* Copyright (c) Texas Instruments, Incorporated 2000 *//*****************************************************************//******************************************************************************/
/******************************************************************************/
/* SLIC.H - HC55182 SLIC driver routines */
/* */
/* This module is the device library for the HC55182 SLIC on the */
/* 54XX DSK board. */
/* */
/* MACRO FUNCTIONS: */
/* */
/* FUNCTIONS: */
/* */
/* slic_init() - Perform required initialization and default configuration */
/* slic_reset() - Reset the SLIC */
/* slic_ring() - Ring SLIC */
/* slic_isOnhook() - Determine if SLIC is onhook or offhook */
/* slic_battery() - Select SLIC low battery off or on */
/* slic_set_mode() - Select SLIC operating mode */
/* slic_get_mode() - get SLIC operating mode */
/* */
/******************************************************************************/
#ifndef _SLIC_H_
#define _SLIC_H_
#include <type.h>
/*****************************************************************************/
/* INCLUDES */
/*****************************************************************************/
/*****************************************************************************/
/* DEFINES */
/*****************************************************************************/
#undef OK
#define OK 0
#undef ERROR
#define ERROR -1
#define SLIC_BATTERY_MASK 0x08
#define SLIC_RING_MASK 0x80
#define SLIC_OFFHOOK_MASK 0x10
#define SLIC_MODE_MASK 0x07
/*****************************************************************************/
/* typedefs & enums */
/*****************************************************************************/
// HC55182 SLIC bit Masks
typedef enum
{
SLIC_LOW_BAT = 0x00,
SLIC_HIGH_BAT = 0x08
} SlicBattery, *PSlicBattery;
// HC55182 SLIC control
typedef enum
{
SLIC_LOW_POWER_STBY = 0x0,
SLIC_FORWARD_ACTIVE = 0x1,
SLIC_REVERSE_ACTIVE = 0x3,
SLIC_RINGING = 0x4,
SLIC_FORWARD_LP_BACK = 0x5,
SLIC_TIP_OPEN = 0x6,
SLIC_POWER_DENIAL = 0x7
} SlicMode, *PSlicMode;
/*****************************************************************************/
/* PUBLIC FUNCTION PROTOTYPES */
/*****************************************************************************/
/*****************************************************************************/
/* int slic_init(void) */
/* */
/* This routine performs required initialization and default configuration. */
/* */
/* Parameters: */
/* - None */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int slic_init(void);
/*****************************************************************************/
/* int slic_reset(void) */
/* */
/* This routine resets the HC55182 SLIC registers to their default values */
/* */
/* Parameters: */
/* - None */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int slic_reset(void);
/*****************************************************************************/
/* bool slic_ring(void) */
/* */
/* This routine returns plays a 20 Hz ring tone. */
/* */
/* Parameters: */
/* - on: True - ring */
/* False - no ring */
/* */
/* Return: */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int slic_ring(bool on);
/*****************************************************************************/
/* bool slic_isOffhook(void) */
/* */
/* This routine returns the SLIC's onhook status. */
/* */
/* Parameters: */
/* - none */
/* */
/* Return: */
/* - True - SLIC is offhook */
/* - False - SLIC is onhook */
/* */
/* Notes: */
/* */
/*****************************************************************************/
bool slic_isOffHook(void);
/*****************************************************************************/
/* bool slic_battery(SlicBattery bat) */
/* */
/* This routine selects the SLIC's battery mode. */
/* */
/* Parameters: */
/* - bat: specifies the battery mode. */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int slic_battery(SlicBattery bat);
/*****************************************************************************/
/* bool slic_set_mode(SlicMode mode) */
/* */
/* This routine selects the SLIC's operating mode. */
/* */
/* Parameters: */
/* - mode: specifies the operating mode. */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
int slic_set_mode(SlicMode mode);
/*****************************************************************************/
/* bool slic_get_mode(void) */
/* */
/* This routine returns the SLIC's operating mode. */
/* */
/* Parameters: */
/* - none */
/* */
/* Return: */
/* - SLIC operating mode if success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
SlicMode slic_get_mode(void);
/*****************************************************************************/
/* bool slic_ring_ctrl(u16 ringLen, u16 pauseLen) */
/* */
/* This routine sets the SLIC ring mode. */
/* */
/* Parameters: */
/* - ringLen: ring duration in millisecs (default to 2 secs) */
/* - pauseLen: pause duration in millisecs (default to 2 secs) */
/* */
/* Return: */
/* - OK if success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/*****************************************************************************/
bool slic_ring_ctrl(u16 ringLen, u16 pauseLen);
/*****************************************************************************/
/* bool slic_isRinging(void) */
/* */
/* This routine returns the ststus of the ringer. */
/* */
/* Parameters: */
/* - none */
/* */
/* Return: */
/* - True - SLIC is ringing */
/* - False - ringing is paused */
/* */
/* Notes: */
/* */
/*****************************************************************************/
bool slic_isRinging(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -