blob: 0b58fbd0685ac8991d1626211cb1a2aee77ee24a [file] [log] [blame]
/******************************************************************************
Copyright (c) 2006-2015 Lantiq Deutschland GmbH
Copyright (c) 2015 Lantiq Beteiligungs-GmbH & Co.KG
Copyright 2018, Intel Corporation.
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file dxs_api.c
This file contains the function prototypes specific to the DXS library
interface and is used by applications.
*/
/* ========================================================================== */
/* Includes */
/* ========================================================================== */
#include "dxs.h"
#include "dxs_init.h"
#include "dxs_errno.h"
#include "dxs_error.h"
#include "dxs_config.h"
#include "dxs_bbd.h"
#include "dxs_wait.h"
#include "dxs_sdd.h"
#include "dxs_gpio.h"
#include "dxs_cid.h"
#include "dxs_pcm.h"
#include "dxs_dwld.h"
#include "dxs_sig.h"
#include "dxs_debug_api.h"
#include "dxs_event.h"
#include "dxs_dcdc_hw.h"
#include "dxs_ring.h"
/* ========================================================================== */
/* Macro definitions */
/* ========================================================================== */
#define DXS_DEV_CTX_GET \
do { \
pDev = dxs_get_dev(dxs); \
if (pDev == NULL) { \
DXS_ERROR_PUSH(DXS_statusDevNotFound); \
return DXS_statusDevNotFound; \
} \
} while(0)
#define DXS_DEV_INIT_VALIDATE \
do { \
if (!(pDev->flags & DXS_DEV_INITIALIZED)) { \
DXS_ERROR_PUSH(DXS_statusDevNotInitialized); \
return DXS_statusDevNotInitialized; \
} \
} while(0)
#define DXS_CH_CTX_GET \
do { \
if (line >= pDev->nChannels) { \
DXS_ERROR_PUSH(DXS_statusChannelNotFound); \
return DXS_statusChannelNotFound; \
} \
pCh = &pDev->pChannel[line]; \
if (pCh == NULL){ \
DXS_ERROR_PUSH(DXS_statusChannelNotFound); \
return DXS_statusChannelNotFound; \
} \
} while(0)
#define DXS_API_EXIT(ret) \
do { \
if (ret != DXS_statusOk) { \
DXS_ERROR_PUSH(ret); \
} \
return ret; \
} while(0)
#define DXS_DEV_API_ENTRY \
do { \
DXS_DEV_CTX_GET; \
DXS_ERROR_RESET; \
DXS_DEV_INIT_VALIDATE; \
} while(0)
#define DXS_CH_API_ENTRY \
do { \
DXS_DEV_API_ENTRY; \
DXS_CH_CTX_GET; \
} while(0)
/* ========================================================================== */
/* Type definitions */
/* ========================================================================== */
/* ========================================================================== */
/* Global variables */
/* ========================================================================== */
/* ========================================================================== */
/* Function prototypes */
/* ========================================================================== */
/* ========================================================================== */
/* Function implementation */
/* ========================================================================== */
/**
DXS Device Init
\param dxs - device number
\param chipSelect - CS number
\param irqNumber - IRQ line number
\param dcdcType - DCDC variant handled by DXS_DCDC_Var_t type
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsInit(uint8_t dxs, uint8_t chipSelect, int32_t irqNumber,
uint8_t dcdcType, uint8_t acc_mode)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_CTX_GET;
DXS_ERROR_RESET;
ret = dxs_init(pDev, chipSelect, irqNumber, dcdcType, acc_mode, dxs);
DXS_API_EXIT(ret);
}
/**
DXS Device Exit
\param dxs - device number
\return
- DXS_statusOk
*/
int32_t DxsExit(uint8_t dxs)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_exit(pDev);
DXS_API_EXIT(ret);
}
/**
DXS BBD Download
\param dxs - channel number
\param pBbd - pointer to BBD data
\param nBytes - BBD data size
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsBBD(uint8_t dxs, uint8_t line, uint8_t *pBbd, uint32_t nBytes)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = dxs_bbd_download(pCh, pBbd, nBytes);
DXS_API_EXIT(ret);
}
/**
DXS PRAM Patch Download
\param dxs - device number
\param pPatch - pointer to PRAM patch data
\param nBytes - PRAM patch data size
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPatch(uint8_t dxs, uint8_t *pPatch, uint32_t nBytes)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = DXS_FW_Select(pDev, pPatch, nBytes);
DXS_API_EXIT(ret);
}
/**
DXS Firmware Capabilities Read
\param dxs - device number
\param pCap - pointer to DXS_Caps_t structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsCapabilitiesRead(uint8_t dxs, DXS_Caps_t *pCap)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_caps_read(pDev, pCap);
DXS_API_EXIT(ret);
}
/**
DXS Version Read
\param dxs - device number
\param pVersion - pointer to DXS_Version_t structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsVersionRead(uint8_t dxs, DXS_Version_t *pVersion)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_vers_read(pDev, pVersion);
DXS_API_EXIT(ret);
}
/**
DXS Sleep Mode Enable
\param dxs - device number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsSleepEnable(uint8_t dxs)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_sleep(pDev, 1);
DXS_API_EXIT(ret);
}
/**
DXS Sleep Mode Disable
\param dxs - device number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsSleepDisable(uint8_t dxs)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_sleep(pDev, 0);
DXS_API_EXIT(ret);
}
/**
PCM Interface Enable
\param dxs - device number
\param xoff - transmit bit offset
\param dbl - double bit clock
\param xs - transmit slope
\param rs - receive slope
\param drv0 - bit 0 drive length
\param sh - shift control
\param roff - receive bit offset
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPcmInterfaceEnable(uint8_t dxs, uint8_t xoff, uint8_t dbl,
uint8_t xs, uint8_t rs, uint8_t drv0,
uint8_t sh, uint8_t roff)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_pcm_if_config(pDev, xoff, dbl, xs, rs, drv0, sh, roff);
DXS_API_EXIT(ret);
}
/**
PCM Channel Enable
\param dxs - device number
\param line - line number
\param wb - wideband
\param wbtsc - wideband PCM time slot configuration
\param codec - codec
\param xts - transmit highway time slot
\param rts - receive highway time slot
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPcmChannelEnable(uint8_t dxs, uint8_t line, uint8_t wb, uint8_t wbtsc,
uint8_t codec, uint8_t xts, uint8_t rts)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = dxs_pcm_ch_act(pCh, wb, wbtsc, codec, xts, rts);
DXS_API_EXIT(ret);
}
/**
PCM Channel Disable
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPcmChannelDisable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = dxs_pcm_ch_deact(pCh);
DXS_API_EXIT(ret);
}
/**
PCM Channel Mute in RX direction
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPcmChannelMute(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = dxs_pcm_ch_mute(pCh, 1);
DXS_API_EXIT(ret);
}
/**
PCM Channel Unmute in RX direction
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsPcmChannelUnmute(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = dxs_pcm_ch_mute(pCh, 0);
DXS_API_EXIT(ret);
}
/**
Ring configuration
\param dxs - device number
\param line - line number
\param waveForm - waveform type
\param crestFactor - crest factor
\param frequency - frequency
\param amplitude - amplitude
\param dcOffset - DC offset
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsRingConfig(uint8_t dxs, uint8_t line, uint8_t waveForm,
uint8_t crestFactor, uint8_t frequency,
uint16_t amplitude, uint16_t dcOffset)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_RingConfigAPI(pCh, waveForm, crestFactor, frequency,
amplitude, dcOffset);
DXS_API_EXIT(ret);
}
/**
Message Waiting Lamp configuration
\param dxs - device number
\param line - line number
\param voltage - voltage
\param thresh - threshold
\param slope - slope
\param onTime - on-time
\param offTime - off-time
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsMwlConfig(uint8_t dxs, uint8_t line, uint8_t voltage, uint8_t thresh,
uint16_t slope, uint16_t onTime, uint16_t offTime)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_MwlConfigAPI(pCh, voltage, thresh, slope, onTime, offTime);
DXS_API_EXIT(ret);
}
/**
Digital gain configuration
\param dxs - device number
\param line - line number
\param usg - upstream relative level setting
\param dsg - downstream relative level setting
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGainsSet(uint8_t dxs, uint8_t line, int16_t TxGain, int16_t RxGain)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_GainSet(pCh, TxGain, RxGain);
DXS_API_EXIT(ret);
}
/**
Digital gain readback
\param dxs - device number
\param line - line number
\param pusg - pointer to upstream relative level setting
\param pdsg - pointer to downstream relative level setting
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGainsGet(uint8_t dxs, uint8_t line, int16_t *pTxGain, int16_t *pRxGain)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_GainGet(pCh, pTxGain, pRxGain);
DXS_API_EXIT(ret);
}
/**
Line feeding mode set
\param dxs - device number
\param line - line number
\param mode - line feeding mode
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsLineModeSet(uint8_t dxs, uint8_t line, int mode)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
/* We need to signal that calibration was started by API */
if (mode == DXS_LINE_FEED_CALIBRATE)
(void) DXS_SDD_CalibrationInternalSet(pCh, 0);
ret = DXS_SDD_LineModeSet(pCh, mode);
DXS_API_EXIT(ret);
}
/**
Line feeding mode read
\param dxs - device number
\param line - line number
\param pMode - pointer to line feeding mode
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsLineModeGet(uint8_t dxs, uint8_t line, int *pMode)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_LineModeGet(pCh, pMode);
DXS_API_EXIT(ret);
}
/**
Read from DXS internal register
(requires --enable-debug-api)
\param dxs - device number
\param offset - register offset
\param pValue - pointer to value returned
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugRegRead16(uint8_t dxs, uint8_t offset, uint16_t *pValue)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_reg_read (pDev, offset, pValue, 1);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
/**
Write into DXS internal register
(requires --enable-debug-api)
\param dxs - device number
\param offset - register offset
\param value - value
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugRegWrite16(uint8_t dxs, uint8_t offset, uint16_t value)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
uint16_t temp_value = value;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_reg_write (pDev, offset, &temp_value, 1);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
/**
Read from DXS internal register
(requires --enable-debug-api)
\param dxs - device number
\param offset - register offset
\param pValue - pointer to value returned
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugRegRead32(uint8_t dxs, uint8_t offset, uint32_t *pValue)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_reg_read (pDev, offset, (uint16_t *)pValue, 2);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
/**
Write into DXS internal register
(requires --enable-debug-api)
\param dxs - device number
\param offset - register offset
\param value - value
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugRegWrite32(uint8_t dxs, uint8_t offset, uint32_t value)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
uint32_t temp_value = value;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_reg_write (pDev, offset, (uint16_t *)&temp_value, 2);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
/**
Read DXS firmware command
(requires --enable-debug-api)
\param dxs - device number
\param hdr - command header
\param pLength - length of data
\param pData - pointer to read data into
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugCmdRead(uint8_t dxs, uint32_t hdr,
uint8_t *pLength, uint32_t *pData)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_cmd_read (pDev, hdr, pData, pLength);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
/**
Write DXS firmware command
(requires --enable-debug-api)
\param dxs - device number
\param length - the length of buffer
\param pCmd - pointer to buffer with command
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDebugCmdWrite(uint8_t dxs, uint8_t length, uint32_t *pCmd)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
ret = dxs_cmd_write (pDev, pCmd, length);
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
#if 0
/*
* DxsDebugBBDGet()
* requires --enable-debug-api
*/
int32_t DxsDebugBBDGet(uint8_t dxs, int nBuffer, uchar *pBbd, int *nByte)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_DEBUG_API
/* TODO: ret = dxs_bbd_get (pDev, pCmd, length); */
#endif /* DXS_FEAT_DEBUG_API */
DXS_API_EXIT(ret);
}
#endif
/**
Tone Configuration
(requires --enable-tg)
\param dxs - device number
\param line - line number
\param level1 - level for frequency 1
\param level2 - level for frequency 2
\param freq1 - tone frequency 1
\param freq2 - tone frequency 2
\param amModulated - amplitude modulation flag
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsToneConfig(uint8_t dxs, uint8_t line, int16_t level1,
int16_t level2, uint16_t freq1, uint16_t freq2,
uint8_t amModulated)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_TG
ret = dxs_tone_config(pCh, level1, level2, freq1, freq2, amModulated, 1);
#endif /* DXS_FEAT_TG */
DXS_API_EXIT(ret);
}
/**
Tone Playout Enable
(requires --enable-tg)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsToneEnable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_TG
ret = dxs_tone_start(pCh);
#endif /* DXS_FEAT_TG */
DXS_API_EXIT(ret);
}
/**
Tone Playout Disable
(requires --enable-tg)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsToneDisable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_TG
ret = dxs_tone_stop(pCh);
#endif /* DXS_FEAT_TG */
DXS_API_EXIT(ret);
}
/**
CID Generator Coefficients update
(requires --enable-fsk)
\param dxs - device number
\param line - line number
\param level - CID send level
\param seizure - number of seizure bytes
\param mark - number of mark bits
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsFskConfig(uint8_t dxs, uint8_t line, int16_t level,
uint16_t seizure, uint16_t mark)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_FSK
ret = DXS_FSK_Configure(pCh, level, seizure, mark);
#endif /* DXS_FEAT_FSK */
DXS_API_EXIT(ret);
}
/**
CID Generator Enable
(requires --enable-fsk)
\param dxs - device number
\param line - line number
\param standard - CID standard
\param autodeact - auto deactivation
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsFskEnable(uint8_t dxs, uint8_t line, uint8_t standard, uint8_t autodeact)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_FSK
ret = DXS_FSK_Enable(pCh, standard, autodeact);
#endif /* DXS_FEAT_FSK */
DXS_API_EXIT(ret);
}
/**
CID Generator Disable
(requires --enable-fsk)
\param dxs - device number
\param line - line number
\param autodeact - auto deactivation
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsFskDisable(uint8_t dxs, uint8_t line, uint8_t autodeact)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_FSK
ret = DXS_FSK_Disable(pCh, autodeact);
#endif /* DXS_FEAT_FSK */
DXS_API_EXIT(ret);
}
/**
Send new data to the CID sender
(requires --enable-fsk)
\param dxs - device number
\param line - line number
\param nByte - data buffer size
\param pByte - pointer to data buffer
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsFskData(uint8_t dxs, uint8_t line, uint8_t nByte, uint8_t *pByte)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_FSK
ret = DXS_FSK_Data(pCh, nByte, pByte);
#endif /* DXS_FEAT_FSK */
DXS_API_EXIT(ret);
}
/**
Enable UTD
(requires --enable-utd)
\param dxs - device number
\param line - line number
\param tone_idx - tone index
\param direction - detection direction
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsUtdEnable(uint8_t dxs, uint8_t line, uint16_t tone_idx,
int direction)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_UTD
ret = DXS_SIG_UtdEnable(pCh, tone_idx, direction);
#endif /* DXS_FEAT_UTD */
DXS_API_EXIT(ret);
}
/**
Disable UTD
(requires --enable-utd)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsUtdDisable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_UTD
ret = DXS_SIG_UtdDisable(pCh);
#endif /* DXS_FEAT_UTD */
DXS_API_EXIT(ret);
}
/**
DTMF Receiver Coefficients
(requires --enable-dtmfd)
\param dxs - device number
\param line - line number
\param level - minimum signal level
\param twist - maximum allowed twist
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDtmfConfig(uint8_t dxs, uint8_t line, int16_t level, int16_t twist)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_DTMFD
ret = dxs_dtmf_config(pCh, level, twist);
#endif /* DXS_FEAT_DTMFD */
DXS_API_EXIT(ret);
}
/**
DTMF Receiver Enable
(requires --enable-dtmfd)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDtmfEnable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_DTMFD
ret = dxs_dtmf_enable(pCh, 1);
#endif /* DXS_FEAT_DTMFD */
DXS_API_EXIT(ret);
}
/**
DTMF Receiver Disable
(requires --enable-dtmfd)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsDtmfDisable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_DTMFD
ret = dxs_dtmf_enable(pCh, 0);
#endif /* DXS_FEAT_DTMFD */
DXS_API_EXIT(ret);
}
/**
Set GR-909 limits
(requires --enable-gr909)
\param dxs - device number
\param line - line number
\param pGR909Conf - pointer to SDD GR909 configuration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGr909LimitsSet(uint8_t dxs, uint8_t line,
DXS_GR909Config_t *pGR909Conf)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_GR909
ret = DXS_SDD_GR909LimitsSet(pCh, pGR909Conf);
#endif /* DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
Get GR-909 limits
(requires --enable-gr909)
\param dxs - device number
\param line - line number
\param pGR909Conf - pointer to SDD GR909 configuration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGr909LimitsGet(uint8_t dxs, uint8_t line,
DXS_GR909Config_t *pGR909Conf)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_GR909
ret = DXS_SDD_GR909LimitsGet(pCh, pGR909Conf);
#endif /* DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
Get GR-909 results
(requires --enable-gr909)
\param dxs - device number
\param line - line number
\param pGR909Result - pointer to SDD GR909 result structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGr909ResultGet(uint8_t dxs, uint8_t line,
DXS_GR909Result_t *pGR909Result)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_GR909
ret = DXS_SDD_GR909ResultGet(pCh, pGR909Result);
#endif /* DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
GPIO port configuration
(requires --enable-gpio)
\param dxs - device number
\param pGpioConf - pointer to GPIO configuration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGpioPortConfig(uint8_t dxs, DXS_GpioConfig_t *pGpioConf)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_GPIO
ret = DXS_GPIO_Config(pDev, pGpioConf);
#endif /* DXS_FEAT_GPIO */
DXS_API_EXIT(ret);
}
/**
GPIO write
(requires --enable-gpio)
\param dxs - device number
\param pin - GPIO pin number
\param val - value
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGpioWrite(uint8_t dxs, uint8_t pin, uint8_t val)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_GPIO
ret = DXS_GPIO_Write(pDev, pin, val);
#endif /* DXS_FEAT_GPIO */
DXS_API_EXIT(ret);
}
/**
GPIO read
(requires --enable-gpio)
\param dxs - device number
\param pin - GPIO pin number
\param *value - value
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsGpioRead(uint8_t dxs, uint8_t pin, uint8_t *value)
{
DXS_DEVICE_t *pDev;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_DEV_API_ENTRY;
#ifdef DXS_FEAT_GPIO
ret = DXS_GPIO_Read(pDev, pin, value);
#endif /* DXS_FEAT_GPIO */
DXS_API_EXIT(ret);
}
/**
Read the results of calibration measurements.
\param dxs - device number
\param line - line number
\param pCalibration - pointer to calibration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsCalibrationGet(uint8_t dxs, uint8_t line,
DXS_Calibration_t *pCalibration)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_CalibrationGet(pCh, pCalibration);
DXS_API_EXIT(ret);
}
/**
Write hardware configuration values.
\param dxs - device number
\param line - line number
\param pCalibration - pointer to calibration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsCalibrationSet(uint8_t dxs, uint8_t line,
DXS_Calibration_t *pCalibration)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_CalibrationSet(pCh, pCalibration);
DXS_API_EXIT(ret);
}
/**
Sets the validation times for hook, pulse digit and flashhook.
\param dxs - device number
\param line - line number
\param pTime - type of validation setting, min and max time in
milliseconds.
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsHookValTimeSet(uint8_t dxs, uint8_t line, DXS_HookValTime_t *pTime)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_HSM
ret = DXS_Dial_HookValTimeSet(pCh, pTime);
#endif /* DXS_FEAT_HSM */
DXS_API_EXIT(ret);
}
/**
Get capacitance measurement result
\param dxs - device number
\param line - line number
\param pCapacitance - pointer to capacitance measurement structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsCapMeasurementResultGet(uint8_t dxs, uint8_t line,
DXS_Capacitance_t *pCapacitance)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CAPMEAS
ret = DXS_SDD_CapMeasurementResultGet(pCh, 1, pCapacitance);
#endif /* DXS_FEAT_CAPMEAS */
DXS_API_EXIT(ret);
}
/**
Get continuous measurements result
\param dxs - device number
\param line - line number
\param pResult - pointer to continuous measurement structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsContMeasurementResultGet(uint8_t dxs, uint8_t line,
DXS_ContMeasurementResult_t *pResult)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_SDD_ContMeasurementResultGet(pCh, pResult);
DXS_API_EXIT(ret);
}
/**
Enable metering pulse. The pulse length can be programmed
with SDD_BasicConfig.
(requires --enable-metering)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsMeteringPulseEnable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_METERING
ret = DXS_SIG_MeterPulseEnable(pCh);
#endif /* DXS_FEAT_METERING */
DXS_API_EXIT(ret);
}
/**
Disable metering pulse.
(requires --enable-metering)
\param dxs - device number
\param line - line number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsMeteringPulseDisable(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_METERING
ret = DXS_SIG_MeterPulseDisable(pCh);
#endif /* DXS_FEAT_METERING */
DXS_API_EXIT(ret);
}
/**
Open Loop Calibration
\param dxs - device number
\param line - line number
\param loops - number of loops
\param pOLCalibrationResult - pointer to Open Loop Calibration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsOpenLoopCalibration(uint8_t dxs, uint8_t line, uint8_t loops,
DXS_OLCalibration_t *pOLCalibrationResult)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909)
ret = DXS_SDD_OLCalibration(pCh, loops, pOLCalibrationResult);
#endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
Function to set the Open Loop Calibration configuration
\param dxs - device number
\param line - line number
\param pOLCalibration - pointer to Open Loop Calibration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsOpenLoopConfigSet(uint8_t dxs, uint8_t line,
DXS_OLCalibration_t *pOLCalibration)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909)
ret = DXS_SDD_OLCalibrationConfigSet(pCh, pOLCalibration);
#endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
Function to get the Open Loop Calibration configuration
\param dxs - device number
\param line - line number
\param pOLCalibration - pointer to Open Loop Calibration structure
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsOpenLoopConfigGet(uint8_t dxs, uint8_t line,
DXS_OLCalibration_t *pOLCalibration)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#if defined(DXS_FEAT_CAPMEAS) && defined(DXS_FEAT_GR909)
ret = DXS_SDD_OLCalibrationConfigGet(pCh, pOLCalibration);
#endif /* DXS_FEAT_CAPMEAS && DXS_FEAT_GR909 */
DXS_API_EXIT(ret);
}
/**
Function to start the ACLM measurement
\param dxs - device number
\param line - line number
\param aclm_mt - ACLM measurment code
\return
- \ref DXS_status_t code
*/
int32_t DxsAcLmMeasurementStart(uint8_t dxs, uint8_t line,
DXS_ACLM_Measurement_t aclm_mt)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_ACMETER
ret = DXS_SDD_ACLM_Start(pCh, aclm_mt);
#endif /* DXS_FEAT_ACMETER */
DXS_API_EXIT(ret);
}
/**
Function to retrieve the available ACLM measurement result number
\param dxs - device number
\param line - line number
\param aclm_mt - ACLM measurment code
\param pResNum - ACLM result number (output)
\return
- \ref DXS_status_t code
*/
int32_t DxsAcLmMeasResNumGet(uint8_t dxs, uint8_t line,
DXS_ACLM_Measurement_t aclm_mt,
int32_t *pResNum)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_ACMETER
ret = DXS_SDD_ACLM_ResultGet(pCh,
aclm_mt, DXS_ACLM_RESULT_NUMBER, 0, pResNum);
#endif /* DXS_FEAT_ACMETER */
DXS_API_EXIT(ret);
}
/**
Function to retrieve the argument of particular ACLM measurement index
\param dxs - device number
\param line - line number
\param aclm_mt - ACLM measurment code
\param index - ACLM measurment index
\param pResArg - ACLM result argument (output)
\return
- \ref DXS_status_t code
*/
int32_t DxsAcLmMeasResArgGet(uint8_t dxs, uint8_t line,
DXS_ACLM_Measurement_t aclm_mt,
int32_t index, int32_t *pResArg)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_ACMETER
ret = DXS_SDD_ACLM_ResultGet(pCh,
aclm_mt, DXS_ACLM_RESULT_ARG, index, pResArg);
#endif /* DXS_FEAT_ACMETER */
DXS_API_EXIT(ret);
}
/**
Function to retrieve the result value of particular ACLM measurement index
\param dxs - device number
\param line - line number
\param aclm_mt - ACLM measurment code
\param index - ACLM measurment index
\param pResArg - ACLM result argument (output)
\return
- \ref DXS_status_t code
*/
int32_t DxsAcLmMeasResValGet(uint8_t dxs, uint8_t line,
DXS_ACLM_Measurement_t aclm_mt,
int32_t index, int32_t *pResVal)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_ACMETER
ret = DXS_SDD_ACLM_ResultGet(pCh,
aclm_mt, DXS_ACLM_RESULT_VALUE, index, pResVal);
#endif /* DXS_FEAT_ACMETER */
DXS_API_EXIT(ret);
}
/**
Function to initialize CID interface for a channel
\param dxs - device number
\param line - line number
\param std - CID standard
\param as - CID alert signal
\param fmt - CID data format
\param dtmf_ack_idx - DTMF index for acknowledgment (type2)
\return
- \ref DXS_status_t code
*/
int32_t DxsCidInit (uint8_t dxs, uint8_t line, DXS_CID_Std_t std,
DXS_CID_AS_t as, DXS_CID_DATA_FMT_t fmt, uint8_t dtmf_ack_idx)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_Init(pCh, std, as, fmt, dtmf_ack_idx);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to configure timers for a given CID standard.
\param dxs - device number
\param line - line number
\param std - CID standard
\param pTimers - pointer to timer union
\return
- \ref DXS_status_t code
*/
int32_t DxsCidTimerConfig (uint8_t dxs, uint8_t line, DXS_CID_Std_t std,
DXS_CID_Timers_t *pTimers)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_TimerConfig(pCh, std, pTimers);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to create (or update) the CID message per channel
\param dxs - device number
\param line - line number
\param msg_type - CID message type
\param param - CID message parameter
\param pData - pointer to char data of the parameter value
\param length - length of the data pointed by pData
\return
- \ref DXS_status_t code
*/
int32_t DxsCidMsgSetup(uint8_t dxs, uint8_t line, DXS_CID_MsgType_t msg_type,
DXS_CID_MsgParam_t param, char *pData, uint8_t length)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_MsgUpdate(pCh, msg_type, param, pData, length);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to delete entirely the CID message per channel
\param dxs - device number
\param line - line number
\return
- \ref DXS_status_t code
*/
int32_t DxsCidMsgReset(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_MsgCleanup(pCh);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to start the playout of CID TypeI sequence
\param dxs - device number
\param line - line number
\param std - CID standard
\param as - Alert signal
\param fmt - Data format
\param msg_type - message type selected for playout
\return
- \ref DXS_status_t code
*/
int32_t DxsCidTypeIMsgStart(uint8_t dxs, uint8_t line,
DXS_CID_MsgType_t msg_type)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_TypeI_Play(pCh, msg_type, DXS_CID_CALL_FROM_CID_API);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to start the playout of CID TypeII sequence
\param dxs - device number
\param line - line number
\param std - CID standard
\param as - Alert signal
\param fmt - Data format
\param msg_type - message type selected for playout
\return
- \ref DXS_status_t code
*/
int32_t DxsCidTypeIIMsgStart(uint8_t dxs, uint8_t line,
DXS_CID_MsgType_t msg_type)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_TypeII_Play(pCh, msg_type);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to stop the playout of CID sequence
\param dxs - device number
\param line - line number
\return
- \ref DXS_status_t code
*/
int32_t DxsCidSeqStop(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret = DXS_statusFeatNotCompiledIn;
DXS_CH_API_ENTRY;
#ifdef DXS_FEAT_CID
ret = DXS_CID_Stop(pCh);
#endif /* DXS_FEAT_CID */
DXS_API_EXIT(ret);
}
/**
Function to configure the ringing cadence
\param dxs - device number
\param line - line number
\param pRC - pointer to \ref DXS_RingCadence_t structure
\return
- \ref DXS_status_t code
*/
int32_t DxsRingCadenceInit(uint8_t dxs, uint8_t line, DXS_RingCadence_t *pRC)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_RING_CadenceInit(pCh, pRC);
DXS_API_EXIT(ret);
}
/**
Function to start the ringing cadence
\param dxs - device number
\param line - line number
\return
- \ref DXS_status_t code
*/
int32_t DxsRingCadenceStart(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_RING_CadenceStart(pCh);
DXS_API_EXIT(ret);
}
/**
Function to stop the ringing cadence
\param dxs - device number
\param line - line number
\return
- \ref DXS_status_t code
*/
int32_t DxsRingCadenceStop(uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_RING_CadenceStop(pCh);
DXS_API_EXIT(ret);
}
/**
Prevent ESD mode and line voltage drop
on PCM clock failure
\param dxs - device number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsClockFailLineFeedFreeze (uint8_t dxs)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = DXS_CfEsdSwitch(pDev, 0);
DXS_API_EXIT(ret);
}
/**
Allow ESD mode and line voltage drop
on PCM clock failure
\param dxs - device number
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsClockFailLineFeedUnFreeze (uint8_t dxs)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = DXS_CfEsdSwitch(pDev, 1);
DXS_API_EXIT(ret);
}
/* =================== MULTI-CHANNEL SHARED HW SUPPORT ====================== */
/**
Configure the driver for the master channel.
\param dxs - device number
\param line - line number
\return
- DXS_statusOk
- DXS_statusDevNotFound
- DXS_statusDevNotInitialized
- DXS_statusChannelNotFound
- DXS_statusInvalidParam
*/
int32_t DxsSharedDcDcMasterSet (uint8_t dxs, uint8_t line)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_DCDC_HW_SharedDcDcMasterChSet(pCh);
DXS_API_EXIT(ret);
}
/* ========================================================================== */
/* ===================== E V E N T S U P P O R T ========================== */
/**
Initialize Waiting List
\return
- waiting list instance
*/
DXS_WaitList_t DxsWaitListInit(void)
{
return dxs_wl_init();
}
/**
Initialize Waiting List
\param wl - waiting list instance
*/
void DxsWaitListDestroy(DXS_WaitList_t wl)
{
dxs_wl_destroy(wl);
}
/**
Add device to the waiting list
\param dxs - device number
\param wl - waiting list instance
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsWaitListDevAdd(uint8_t dxs, DXS_WaitList_t wl)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_wl_dev_add(pDev, wl);
DXS_API_EXIT(ret);
}
/**
Remove device from the waiting list
\param dxs - device number
\param wl - waiting list instance
\return
- DXS_statusOk or DXS_statusError
*/
int32_t DxsWaitListDevRemove(uint8_t dxs, DXS_WaitList_t wl)
{
DXS_DEVICE_t *pDev;
int32_t ret;
DXS_DEV_API_ENTRY;
ret = dxs_wl_dev_remove(pDev, wl);
DXS_API_EXIT(ret);
}
/**
Wait on the Waiting List instance
\param wl - waiting list instance
\return
- the first device number on the Waiting List
having non-empty event queue
or negative value in case of error
*/
int32_t DxsWaitForEvent(DXS_WaitList_t wl)
{
return dxs_wait(wl);
}
/**
Read a single event from the device
\param dxs - device number
\param pEvent - pointer to DXS_Event_t structure
\return
- the remaining event count in device event queue
or negative value in case of error
*/
int32_t DxsEventGet(uint8_t dxs, DXS_Event_t *pEvent)
{
DXS_DEVICE_t *pDev;
DXS_DEV_API_ENTRY;
/* no DXS_API_EXIT macro, as the function returns
the event count instead of a status code */
return dxs_event_get(pDev, pEvent);
}
/**
Enable dispatching of a particular event on a given line
to the application.
\param dxs Device number.
\param line Line number.
\param event Event id
\return
Return value according to \ref DXS_status_t.
*/
int32_t DxsEventEnable(uint8_t dxs, uint8_t line, DXS_Event_id_t event)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_EventEnable(pCh, event);
DXS_API_EXIT(ret);
}
/**
Disable dispatching of a particular event on a given line
to the application.
\param dxs Device number.
\param line Line number.
\param event Event id
\return
Return value according to \ref DXS_status_t.
*/
int32_t DxsEventDisable(uint8_t dxs, uint8_t line, DXS_Event_id_t event)
{
DXS_DEVICE_t *pDev;
DXS_CHANNEL_t *pCh;
int32_t ret;
DXS_CH_API_ENTRY;
ret = DXS_EventDisable(pCh, event);
DXS_API_EXIT(ret);
}
/* ========================================================================== */