libsangoma  1
Macros | Typedefs | Enumerations | Functions
libsangoma.h File Reference

Wanpipe API Library header for Sangoma AFT T1/E1/Analog/BRI/Serial Hardware -. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/signal.h>
#include <sys/select.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
#include <poll.h>
#include <signal.h>
#include <pthread.h>
#include <stdint.h>
#include "wanpipe_api.h"
#include "wanpipe_events.h"
#include "wanec_api.h"
#include "wanec_iface_api.h"
Include dependency graph for libsangoma.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WANPIPE_TDM_API   1
 Used by compiler and driver to enable TDM API.
 
#define LIBSANGOMA_VERSION(a, b, c)   (((a) << 16) + ((b) << 8) + (c))
 LibSangoma Macro to check the Version Number.
 
#define LIBSANGOMA_VERSION_CODE   LIBSANGOMA_VERSION(3,3,0)
 LibSangoma Current Version Number to be checked against the LIBSANGOMA_VERSION Macro.
 
#define LIBSANGOMA_VERSION_STR   "3.3.0"
 LibSangoma Version in string format.
 
#define WP_API_FEATURE_ANALOG_STATS   1
 
#define sangoma_wait_obj_t   struct sangoma_wait_obj
 
#define SANGOMA_DECLARE_TDM_API_CMD(_name_)   wanpipe_api_t _name_
 Instantiate/Declare a tdm api cmd strucure.
 
#define SANGOMA_INIT_TDM_API_CMD(_name_)
 Initialize the tdm api cmd structure. Set to 0. More...
 
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)   (_name_).wp_cmd.result = SANG_STATUS_GENERAL_ERROR
 Initialize the 'result' in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
 
#define SANGOMA_DECLARE_INIT_TDM_API_CMD(_name_)   wanpipe_tdm_api_t _name_; SANGOMA_INIT_TDM_API_CMD(_name_);
 Declare and initialize the tdm api cmd structure.
 
#define _LIBSNG_CALL
 Not used in Linux.
 
#define INVALID_HANDLE_VALUE   -1
 Invalid file handle value -1, Ported from Windows.
 
#define SANGOMA_INFINITE_API_POLL_WAIT   -1
 Infinite poll timeout value -1, Ported from Windows.
 
#define SANGOMA_WAIT_INFINITE   -1
 
#define __cdecl
 Ported from Windows.
 
#define FALSE   0
 FALSE value is 0, Ported from Windows.
 
#define TRUE   1
 TRUE value is 1, Ported from Windows.
 
#define sangoma_msleep(x)   usleep(x*1000)
 milisecond sleep function
 
#define _getch   getchar
 get character, Ported from Windows
 
#define Sleep   sangoma_msleep
 milisecond sleep function
 
#define _stricmp   strcmp
 _stricmp type mapped to _stricmp, Ported from Windows
 
#define _snprintf   snprintf
 _snprintf type mapped to snprintf, Ported from Windows
 
#define _vsnprintf   vsnprintf
 
#define EnterCriticalSection(arg)   pthread_mutex_lock(arg)
 
#define TryEnterCriticalSection(arg)   (pthread_mutex_trylock(arg)==0 ? 1 : 0)
 
#define LeaveCriticalSection(arg)   pthread_mutex_unlock(arg)
 
#define InitializeCriticalSection(arg)   pthread_mutex_init(arg, NULL);
 
#define sangoma_ctime(time)   ctime((time_t*)time)
 Convert a time value to a string. More...
 
#define FNAME_LEN   100
 string length of a file name
 
#define LIBSNG_FUNC_DBG()   if(0)printf("%s(): line:%d\n", __FUNCTION__, __LINE__)
 
#define LIBSNG_DBG_PRINT   if(0)printf
 
#define DECODE_SANGOMA_WAIT_OBJECT_TYPE(type)
 
#define __sangoma_open_tdmapi_span_chan   __sangoma_open_api_span_chan
 
#define LIBSANGOMA_TDMAPI_CTRL   1
 Global control device feature.
 
#define LIBSANGOMA_GET_LINKSTATUS   1
 Get Link Status feature.
 
#define LIBSANGOMA_GET_FESTATUS   1
 Get Front End Status feature.
 
#define LIBSANGOMA_GET_HWCODING   1
 Get HW Coding Feature.
 
#define LIBSANGOMA_GET_HWDTMF   1
 HW DTMF Feature.
 
#define LIBSANGOMA_SET_FESTATUS   1
 Set Front End Status Feature.
 
#define sangoma_open_tdmapi_span_chan   sangoma_open_api_span_chan
 
#define sangoma_open_tdmapi_span   sangoma_open_api_span
 
#define sangoma_open_tdmapi_ctrl   sangoma_open_api_ctrl
 
#define sangoma_tdm_get_fe_status   sangoma_get_fe_status
 
#define sangoma_socket_close   sangoma_close
 
#define sangoma_tdm_get_hw_coding   sangoma_get_hw_coding
 
#define sangoma_tdm_set_fe_status   sangoma_set_fe_status
 
#define sangoma_tdm_get_link_status   sangoma_get_link_status
 
#define sangoma_tdm_flush_bufs   sangoma_flush_bufs
 
#define sangoma_tdm_cmd_exec   sangoma_cmd_exec
 
#define sangoma_tdm_read_event   sangoma_read_event
 
#define sangoma_readmsg_tdm   sangoma_readmsg
 
#define sangoma_readmsg_socket   sangoma_readmsg
 
#define sangoma_sendmsg_socket   sangoma_writemsg
 
#define sangoma_writemsg_tdm   sangoma_writemsg
 
#define sangoma_create_socket_intr   sangoma_open_api_span_chan
 Backward compatible open span chan call.
 

Typedefs

typedef int HANDLE
 file handle type int, Ported from Windows
 
typedef int DWORD
 DWORD type is int, Ported from Windows.
 
typedef char TCHAR
 TCHAN type mapped to char, Ported from Windows.
 
typedef void * LPTHREAD_START_ROUTINE
 LPTHREAD_START_ROUTINE type mapped to unsigned char *, Ported from Windows.
 
typedef pthread_mutex_t CRITICAL_SECTION
 
typedef struct tm SYSTEMTIME
 
typedef char * LPCTSTR
 
typedef int32_t sangoma_status_t
 return status from sangoma APIs More...
 
typedef wp_api_hdr_t sangoma_api_hdr_t
 Backward comaptible define of wp_api_hdr_t.
 
typedef enum _sangoma_wait_obj_type sangoma_wait_obj_type_t
 Wait object type definition.
 
typedef enum
_sangoma_wait_obj_flags 
sangoma_wait_obj_flags_t
 

Enumerations

enum  _sangoma_wait_obj_type { UNKNOWN_WAIT_OBJ = 0, SANGOMA_GENERIC_WAIT_OBJ = 0, SANGOMA_DEVICE_WAIT_OBJ, SANGOMA_DEVICE_WAIT_OBJ_SIG }
 
enum  _sangoma_wait_obj_flags { SANG_WAIT_OBJ_HAS_INPUT = WP_POLLIN, SANG_WAIT_OBJ_HAS_OUTPUT = WP_POLLOUT, SANG_WAIT_OBJ_HAS_EVENTS = WP_POLLPRI, SANG_WAIT_OBJ_IS_SIGNALED = 0x400 }
 

Functions

sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan (int span, int chan)
 Open a Device based on Span/Chan values. More...
 
sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan (int span, int chan)
 Open a Device based on Span/Chan values. More...
 
sng_fd_t _LIBSNG_CALL sangoma_open_api_span (int span)
 
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name (const char *dev_name)
 Open API device using it's name. For example: Linux: w1g1, Windows wanpipe1_if1. More...
 
sng_fd_t _LIBSNG_CALL sangoma_open_api_ctrl (void)
 Open a Global Control Device. More...
 
sng_fd_t _LIBSNG_CALL sangoma_logger_open (void)
 Open a Global Logger Device. More...
 
sng_fd_t _LIBSNG_CALL sangoma_open_driver_ctrl (int port_no)
 Open a Global Driver Control Device. More...
 
void _LIBSNG_CALL sangoma_close (sng_fd_t *fd)
 Close device file descriptor. More...
 
int _LIBSNG_CALL sangoma_get_open_cnt (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get device open count. More...
 
int _LIBSNG_CALL sangoma_writemsg (sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag)
 Write Data to device. More...
 
int _LIBSNG_CALL sangoma_readmsg (sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
 Read Data from device. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_waitfor (sangoma_wait_obj_t *sangoma_wait_obj, uint32_t inflags, uint32_t *outflags, int32_t timeout)
 
sangoma_status_t _LIBSNG_CALL sangoma_waitfor_many (sangoma_wait_obj_t *sangoma_wait_objects[], uint32_t in_flags[], uint32_t out_flags[], uint32_t number_of_sangoma_wait_objects, int32_t system_wait_timeout)
 
sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_create (sangoma_wait_obj_t **sangoma_wait_object, sng_fd_t fd, sangoma_wait_obj_type_t object_type)
 Create a wait object that will be used with sangoma_waitfor_many() API. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_delete (sangoma_wait_obj_t **sangoma_wait_object)
 De-allocate all resources in a wait object. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_signal (sangoma_wait_obj_t *sangoma_wait_object)
 Set wait object to a signaled state. More...
 
sng_fd_t _LIBSNG_CALL sangoma_wait_obj_get_fd (sangoma_wait_obj_t *sangoma_wait_object)
 Get fd device file descriptor which was the 'fd' parameter for sangoma_wait_obj_create(), not useful for generic objects. More...
 
void _LIBSNG_CALL sangoma_wait_obj_set_context (sangoma_wait_obj_t *sangoma_wait_object, void *context)
 
PVOID _LIBSNG_CALL sangoma_wait_obj_get_context (sangoma_wait_obj_t *sangoma_wait_object)
 Retrieve the user context (if any) that was set via sangoma_wait_obj_set_context. More...
 
int _LIBSNG_CALL sangoma_cmd_exec (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Execute Sangoma API Command. More...
 
int _LIBSNG_CALL sangoma_get_full_cfg (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Read tdm api device configuration. More...
 
int _LIBSNG_CALL sangoma_tdm_set_usr_period (sng_fd_t fd, wanpipe_api_t *tdm_api, int period)
 Set Tx/Rx Period in Milliseconds. More...
 
int _LIBSNG_CALL sangoma_tdm_get_usr_period (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Tx/Rx Period in Milliseconds. More...
 
int _LIBSNG_CALL sangoma_tdm_get_usr_mtu_mru (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Tx/Rx MTU/MRU in bytes. More...
 
int _LIBSNG_CALL sangoma_flush_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Flush all (tx/rx/event) buffers from current channel. More...
 
int _LIBSNG_CALL sangoma_flush_rx_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Flush only rx buffers from current channel. More...
 
int _LIBSNG_CALL sangoma_flush_tx_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Flush only tx buffers from current channel. More...
 
int _LIBSNG_CALL sangoma_flush_event_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Flush only event buffers from current channel. More...
 
int _LIBSNG_CALL sangoma_tdm_enable_rbs_events (sng_fd_t fd, wanpipe_api_t *tdm_api, int poll_in_sec)
 Enable RBS Events on a device. More...
 
int _LIBSNG_CALL sangoma_tdm_disable_rbs_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable RBS Events for a device. More...
 
int _LIBSNG_CALL sangoma_tdm_write_rbs (sng_fd_t fd, wanpipe_api_t *tdm_api, int channel, unsigned char rbs)
 Write RBS Bits on a device. More...
 
int _LIBSNG_CALL sangoma_tdm_read_rbs (sng_fd_t fd, wanpipe_api_t *tdm_api, int channel, unsigned char *rbs)
 Read RBS Bits on a device. More...
 
int _LIBSNG_CALL sangoma_tdm_enable_dtmf_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable DTMF Detection on Octasic chip (if hw supports it) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_dtmf_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable DTMF Detection on Octasic chip (if hw supports it) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_fax_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable FAX Detection on Octasic chip (if hw supports it) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_fax_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable FAX Detection on Octasic chip (if hw supports it) More...
 
int _LIBSNG_CALL sangoma_tdm_get_hw_fax (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get HW FAX Detection State (Enable or Disabled) on Octasic chip (if hw supports it) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_rm_dtmf_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable DTMF Detection on Analog/Remora SLIC Chip. More...
 
int _LIBSNG_CALL sangoma_tdm_disable_rm_dtmf_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable DTMF Detection on Analog/Remora SLIC Chip. More...
 
int _LIBSNG_CALL sangoma_tdm_enable_rxhook_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable RX HOOK Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_rxhook_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable RX HOOK Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_ring_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable RING Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_ring_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable RING Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_ring_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable RING DETECT Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_ring_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable RING DETECT Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_ring_trip_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable RING TRIP Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_ring_trip_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable RING TRIP Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_tone_events (sng_fd_t fd, wanpipe_api_t *tdm_api, uint16_t tone_id)
 Transmit a TONE on this device (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_disable_tone_events (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable TONE Events (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_txsig_onhook (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Tranmsmit TX SIG ON HOOK (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_txsig_offhook (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Tranmsmit TX SIG OFF HOOK (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_txsig_start (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Tranmsmit TX SIG START (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_txsig_kewl (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Tranmsmit TX SIG KEWL START (Analog Only) More...
 
int _LIBSNG_CALL sangoma_tdm_enable_hwec (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable HWEC on this channel. More...
 
int _LIBSNG_CALL sangoma_tdm_disable_hwec (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable HWEC on this channel. More...
 
int _LIBSNG_CALL sangoma_tdm_get_fe_alarms (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned int *alarms)
 Get Front End Alarms (T1/E1 Only) More...
 
int _LIBSNG_CALL sangoma_get_link_status (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *current_status)
 Get Device Link Status (Connected/Disconnected) More...
 
int _LIBSNG_CALL sangoma_set_fe_status (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char new_status)
 Set Device Link Status (Connected/Disconnected) More...
 
int _LIBSNG_CALL sangoma_tdm_set_buffer_multiplier (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned int multiplier)
 Set voice tx/rx buffer multiplier. More...
 
int _LIBSNG_CALL sangoma_enable_bri_bchan_loopback (sng_fd_t fd, wanpipe_api_t *tdm_api, int channel)
 Enable BRI Bchannel loopback - used when debugging bri device. More...
 
int _LIBSNG_CALL sangoma_disable_bri_bchan_loopback (sng_fd_t fd, wanpipe_api_t *tdm_api, int channel)
 Disable BRI Bchannel loopback - used when debugging bri device. More...
 
int _LIBSNG_CALL sangoma_get_tx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Tx Queue Size for this channel. More...
 
int _LIBSNG_CALL sangoma_set_tx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api, int size)
 Get Tx Queue Size for this channel. More...
 
int _LIBSNG_CALL sangoma_get_rx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Rx Queue Size for this channel. More...
 
int _LIBSNG_CALL sangoma_set_rx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api, int size)
 Get Tx Queue Size for this channel. More...
 
int _LIBSNG_CALL sangoma_get_hw_coding (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get HW Voice Coding (ulaw/alaw) More...
 
int _LIBSNG_CALL sangoma_tdm_get_hw_dtmf (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Check if hwdtmf support is available. More...
 
int _LIBSNG_CALL sangoma_tdm_get_hw_ec (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Check if hw echo cancelation support is available. More...
 
int _LIBSNG_CALL sangoma_tdm_get_hwec_chan_status (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Check if hw echo cancelation is enabled on current timeslot. More...
 
int _LIBSNG_CALL sangoma_tdm_get_hwec_persist_status (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Check if hwec persis mode is on: On persist mode hwec is always enabled. More...
 
int _LIBSNG_CALL sangoma_span_chan_toif (int span, int chan, char *interface_name)
 Convert Span & Chan to interface name. More...
 
int _LIBSNG_CALL sangoma_span_chan_fromif (char *interface_name, int *span, int *chan)
 Convert Interace Name to Span & Chan. More...
 
int _LIBSNG_CALL sangoma_interface_wait_up (int span, int chan, int sectimeout)
 Wait for a sangoma device to come up (ie: Linux wait for /dev/wanpipex_1 to come up) More...
 
int _LIBSNG_CALL sangoma_get_driver_version (sng_fd_t fd, wanpipe_api_t *tdm_api, wan_driver_version_t *drv_ver)
 Get Device Driver Version Number. More...
 
int _LIBSNG_CALL sangoma_get_firmware_version (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver)
 Get Hardware/Firmware Version. More...
 
int _LIBSNG_CALL sangoma_get_cpld_version (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver)
 Get AFT CPLD Version. More...
 
int _LIBSNG_CALL sangoma_get_aft_customer_id (sng_fd_t fd, unsigned char *out_customer_id)
 Get Customer-specific ID from AFT hardware, the default value is 0xFF, any change requires special arrangement with Sangoma Technologies. More...
 
int _LIBSNG_CALL sangoma_port_led_ctrl (sng_fd_t fd, unsigned char led_state)
 Control the LED ligths of the TDM port. On (led set based on link status) Off (turn off all led). Used to visually identify a phisical port from software. More...
 
int _LIBSNG_CALL sangoma_fe_reg_write (sng_fd_t fd, uint32_t offset, uint8_t data)
 Write to a front end register. More...
 
int _LIBSNG_CALL sangoma_fe_reg_read (sng_fd_t fd, uint32_t offset, uint8_t *data)
 Read front end register. More...
 
int _LIBSNG_CALL sangoma_get_stats (sng_fd_t fd, wanpipe_api_t *tdm_api, wanpipe_chan_stats_t *stats)
 Get Device Statistics. Statistics will be available in tdm_api->wp_cmd.stats structure. More...
 
int _LIBSNG_CALL sangoma_flush_stats (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Flush/Reset device statistics. More...
 
int _LIBSNG_CALL sangoma_set_rm_rxflashtime (sng_fd_t fd, wanpipe_api_t *tdm_api, int rxflashtime)
 Set rxflashtime for FXS module Wink-Flash Event. More...
 
int _LIBSNG_CALL sangoma_set_rm_tx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api, int value)
 set tx gain for FXO/FXS module More...
 
int _LIBSNG_CALL sangoma_set_rm_rx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api, int value)
 set rx gain for FXO/FXS module More...
 
int _LIBSNG_CALL sangoma_tdm_set_polarity (sng_fd_t fd, wanpipe_api_t *tdm_api, int polarity)
 
int _LIBSNG_CALL sangoma_tdm_txsig_onhooktransfer (sng_fd_t fd, wanpipe_api_t *tdm_api)
 
int _LIBSNG_CALL sangoma_tdm_enable_loop (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Enable channel loop: All rx data will be transmitted back out. More...
 
int _LIBSNG_CALL sangoma_tdm_disable_loop (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Disable channel loop. More...
 
int _LIBSNG_CALL sangoma_read_event (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Read API Events. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_cmd_exec (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_read_event (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Read Wanpipe Logger Events. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_flush_buffers (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Flush Wanpipe Logger internal buffers. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_statistics (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Get Wanpipe Logger statistics. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_reset_statistics (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Reset Wanpipe Logger statistics. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_open_handle_counter (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Get Counter of open Handles/File Descriptors of Wanpipe Logger. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_logger_level (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Get current level (types of events) of Wanpipe Logger. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_logger_set_logger_level (sng_fd_t fd, wp_logger_cmd_t *logger_cmd)
 Set current level (types of events) of Wanpipe Logger. More...
 
int _LIBSNG_CALL sangoma_set_tx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val)
 
int _LIBSNG_CALL sangoma_set_rx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val)
 
int _LIBSNG_CALL sangoma_clear_tx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Clear tx gain from device, set it to 0.0. More...
 
int _LIBSNG_CALL sangoma_clear_rx_gain (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Clear rx gain from device, set it to 0.0. More...
 
int _LIBSNG_CALL sangoma_driver_port_start (sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
 Start a Port, create Sangoma Communication interfaces. More...
 
int _LIBSNG_CALL sangoma_driver_port_stop (sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
 Start a Port, create Sangoma Communication interfaces. More...
 
int _LIBSNG_CALL sangoma_driver_port_set_config (sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no)
 Set Port's "Volatile" configuration. The configuration will not persist between system restarts. Before calling this function please stop the port by calling sangoma_driver_port_stop(). After calling this function please start the port by calling sangoma_driver_port_start(). More...
 
int _LIBSNG_CALL sangoma_driver_port_get_config (sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no)
 Retrieve Port's "Volatile" configuration. More...
 
int _LIBSNG_CALL sangoma_driver_get_hw_info (sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
 Retrieve information about a single instance of Sangoma hardware. More...
 
int _LIBSNG_CALL sangoma_driver_get_version (sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
 Retrieve Driver Version BEFORE any communication interface is configured and sangoma_get_driver_version() can not be called. More...
 
int _LIBSNG_CALL sangoma_driver_hw_rescan (sng_fd_t fd, port_management_struct_t *port_mgmnt, int *detected_port_cnt)
 Rescan the pci and usb bus for newly added hardware. More...
 
int _LIBSNG_CALL sangoma_write_port_config_on_persistent_storage (hardware_info_t *hardware_info, port_cfg_t *port_cfg, unsigned short port_no)
 
int _LIBSNG_CALL sangoma_mgmt_cmd (sng_fd_t fd, wan_udp_hdr_t *wan_udp)
 Execute Sangoma Management Command. More...
 
int _LIBSNG_CALL sangoma_get_fe_status (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *current_status)
 Get Device Link Status (Connected/Disconnected) More...
 
int _LIBSNG_CALL sangoma_tdm_set_codec (sng_fd_t fd, wanpipe_api_t *tdm_api, int codec)
 Set TDM Codec per chan. More...
 
int _LIBSNG_CALL sangoma_tdm_get_codec (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Configured TDM Codec per chan. More...
 
sng_fd_t _LIBSNG_CALL sangoma_create_socket_by_name (char *device, char *card)
 Open a device based on a interface and card name. More...
 
int _LIBSNG_CALL sangoma_interface_toi (char *interface_name, int *span, int *chan)
 Convert Span & Chan to interface name. More...
 
int _LIBSNG_CALL sangoma_tdm_set_power_level (sng_fd_t fd, wanpipe_api_t *tdm_api, int power)
 Set Power Level - so only data matching the power level would be passed up. More...
 
int _LIBSNG_CALL sangoma_tdm_get_power_level (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get Configured Power Level. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_init (char *device_name, wan_custom_param_t custom_params[], unsigned int number_of_custom_params)
 Load Firmware image onto EC chip and allocated per-port resources in HWEC API. All chip-wide configuration paramters, if any, must be specified at the time of chip initialization. Note that Analog card is considered a "single-port" card by HWEC API. That means for Analog cards and for single-port digital cards only a single sangoma_hwec_config_init() call is required, all subsequent calls will have no effect. For multi-port cards, such as A102/A104/A108/A500, the sangoma_hwec_config_init() must be called for each port, at least one time. Only the first call will actually load the Firmware image onto EC chip, all subsequent calls (for other ports) will only add the Port to list of ports which use the HWEC API. Actions of sangoma_hwec_config_init() can be reversed by calling sangoma_hwec_config_release(). When Port is stopped, the HWEC API automatically releases per-port resources and removes the Port from list ports which use HWEC API. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_release (char *device_name)
 Release resources allocated by sangoma_hwec_config_init(). For single-port cards, such as A101 and A200 (A200 is an Analog card and considered sinle-port by HWEC API), a single call to sangoma_hwec_config_release() will free the per-chip resources. For multi-port cards, such as A102/A104/A108/A500, sangoma_hwec_config_release() can be called for each port to remove it from list Ports which are using HWEC API. When sangoma_hwec_config_release() is called for the last Port which was "configured/initialized by HWEC API", the per-chip resources will be freed. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_operation_mode (char *device_name, int mode, unsigned int fe_chan_map)
 Modify channel operation mode. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_on (char *device_name, unsigned int fe_chan_map)
 Set the channel state in the echo canceller to NORMAL/POWER ON. This enables echo cancelation logic inside the chip. The action is internal to EC chip itself, not related to AFT FPGA. This call is slow and should be used only on startup. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_off (char *device_name, unsigned int fe_chan_map)
 Set the channel state in the echo canceller to POWER OFF. This disables echo cancellatio logic inside the chip and data passes unmodified through the ec chip. The action is internal to EC chip itself, not related to AFT FPGA. This call is slow and should be used only on startup. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_enable (char *device_name, unsigned int fe_chan_map)
 Redirect audio stream from AFT FPGA to EC chip. This command effectively enables echo cancellation since data is now forced through the EC chip by the FPGA. Data will be modified by the echo canceller. This command is recommened for fast enabling of Echo Cancellation. Note 1: Chip must be configured and in POWER ON state for echo Chancellation to take place. Note 2: sangoma_tdm_enable_hwec() function can be used to achive the same funcitnality based on file descriptor versus channel map. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_disable (char *device_name, unsigned int fe_chan_map)
 Force AFT FPGA to bypass the echo canceller. This command effectively disables echo cancellation since data will not flowing through the ec chip. Data will not be modified by the echo canceller. This command is recommened for fast disabling of Echo Cancelation. Note: sangoma_tdm_disable_hwec() function can be use to achive the same functionality based on file descriptor versus channel map. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_channel_parameter (char *device_name, char *parameter, char *parameter_value, unsigned int channel_map)
 Modify channel configuration parameters. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_tone_detection (char *device_name, int tone_id, int enable, unsigned int fe_chan_map, unsigned char port_map)
 Enable/Disable tone detection (such as DTMF) of channels from channel map. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_print_statistics (char *device_name, int full, unsigned int fe_chan_map)
 Read and print Chip/Channel statistics from EC chip. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_load (char *device_name, char *filename, char pcmlaw, int *out_buffer_id)
 Load audio buffer to EC chip. The buffer can be played out using the sangoma_hwec_audio_buffer_playout() function. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_mem_buffer_load (char *device_name, unsigned char *buffer, unsigned int in_size, char pcmlaw, int *out_buffer_id)
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_unload (char *device_name, int in_buffer_id)
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_playout (char *device_name, unsigned int fe_chan_map, unsigned char port, int in_buffer_id, int start, int repeat_cnt, int duration)
 Start playing out an audio buffer previously loaded by sangoma_hwec_audio_buffer_load(). More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_verbosity (int verbosity_level)
 Set Verbosity level of EC API Driver and Library. The level controls amount of data printed to stdout and to wanpipelog.txt (Windows) or /var/log/messages (Linux) for diagnostic purposes. More...
 
void _LIBSNG_CALL sangoma_hwec_initialize_custom_parameter_structure (wan_custom_param_t *custom_param, char *parameter_name, char *parameter_value)
 Initialize Custom Paramter structure. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_channel_statistics (sng_fd_t fd, unsigned int fe_chan, int *hwec_api_return_code, wanec_chan_stats_t *wanec_chan_stats, int verbose, int reset)
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_global_chip_statistics (sng_fd_t fd, int *hwec_api_return_code, wanec_chip_stats_t *wanec_chip_stats, int verbose, int reset)
 Get Global statistics from EC chip. More...
 
sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_chip_image_info (sng_fd_t fd, int *hwec_api_return_code, wanec_chip_image_t *wanec_chip_image, int verbose)
 Get information about Firmware Image of EC chip. More...
 
int _LIBSNG_CALL sangoma_ss7_force_rx (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Force the firmware to pass up a repeating frame. More...
 
int _LIBSNG_CALL sangoma_ss7_get_cfg_status (sng_fd_t fd, wanpipe_api_t *tdm_api, wan_api_ss7_cfg_status_t *ss7_cfg_status)
 Get current ss7 hw configuration. More...
 

Detailed Description

Wanpipe API Library header for Sangoma AFT T1/E1/Analog/BRI/Serial Hardware -.

Provides User a Unified/OS Agnostic API to Wanpipe/Sangoma Drivers and Hardware

Author(s): Nenad Corbic ncorb.nosp@m.ic@s.nosp@m.angom.nosp@m.a.co.nosp@m.m David Rokhvarg david.nosp@m.r@sa.nosp@m.ngoma.nosp@m..com Michael Jerris mike@.nosp@m.jerr.nosp@m.is.co.nosp@m.m Anthony Minessale II anthm.nosp@m.ct@y.nosp@m.ahoo..nosp@m.com

Copyright: (c) 2005-2008 Nenad Corbic ncorb.nosp@m.ic@s.nosp@m.angom.nosp@m.a.co.nosp@m.m

THIS SOFTWARE IS PROVIDED BY Sangoma Technologies ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Sangoma Technologies BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

v.2.0.0 Nenad Corbic Jan 30 2009 Added sangoma_get_driver_version, sangoma_get_firmware_version, sangoma_get_cpld_version functions,sangoma_get_stats,sangoma_flush_stats

Definition in file libsangoma.h.

Macro Definition Documentation

#define SANGOMA_INIT_TDM_API_CMD (   _name_)
Value:
memset(&_name_,0,sizeof(_name_)); \
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104

Initialize the tdm api cmd structure. Set to 0.

Definition at line 101 of file libsangoma.h.

#define sangoma_ctime (   time)    ctime((time_t*)time)

Convert a time value to a string.

Parameters
time_valpointer to time value

Definition at line 291 of file libsangoma.h.

#define DECODE_SANGOMA_WAIT_OBJECT_TYPE (   type)
Value:
type == SANGOMA_GENERIC_WAIT_OBJ ? "SANGOMA_GENERIC_WAIT_OBJ" :\
type == SANGOMA_DEVICE_WAIT_OBJ ? "SANGOMA_DEVICE_WAIT_OBJ" :\
type == SANGOMA_DEVICE_WAIT_OBJ_SIG ? "SANGOMA_DEVICE_WAIT_OBJ_SIG" :\
"Invalid Wait Object type!"
Generic object that can be signaled but is not associated to any sangoma device.
Definition: libsangoma.h:369
Sangoma object associated to some device which cannot be signaled (cannot call sangoma_wait_obj_signa...
Definition: libsangoma.h:371
Sangoma object that is associated to a device AND can be signaled.
Definition: libsangoma.h:373

Definition at line 376 of file libsangoma.h.

#define sangoma_open_tdmapi_span_chan   sangoma_open_api_span_chan

Backward compabile defines

Definition at line 2350 of file libsangoma.h.

Typedef Documentation

typedef int32_t sangoma_status_t

return status from sangoma APIs

LIBSANGOMA_LIGHT can be used to enable only IO and EVENT libsangoma functions. The DRIVER configuration/start/stop functions are not compiled.

LIBSANGOMA_LIGHT depends only on 3 header files. Instead of all wanpipe header files needed for DRIVER management

LIBSANGMOA_LIGHT is NOT enabled by default.

As of now this typedef maps exactly to SANG_STATUS_T, however that is a kernel type, ugly, ugly, uglyyyyy, we should have strictly minimum set of shared data structures between kernel and user many return codes specified in SANG_STATUS_T are kernel specific like FAILED_TO_LOCK_USER_MEMORY or INVALID_IRQL, the libsangoma user does not need that much information, and even if ever needs it we should provide simpler defaults

Definition at line 338 of file libsangoma.h.

Enumeration Type Documentation

Enumerator
UNKNOWN_WAIT_OBJ 

deprecated, use SANGOMA_GENERIC_WAIT_OBJ

SANGOMA_GENERIC_WAIT_OBJ 

Generic object that can be signaled but is not associated to any sangoma device.

SANGOMA_DEVICE_WAIT_OBJ 

Sangoma object associated to some device which cannot be signaled (cannot call sangoma_wait_obj_signal on it)

SANGOMA_DEVICE_WAIT_OBJ_SIG 

Sangoma object that is associated to a device AND can be signaled.

Definition at line 364 of file libsangoma.h.

365 {
367  UNKNOWN_WAIT_OBJ = 0,
enum _sangoma_wait_obj_type sangoma_wait_obj_type_t
Wait object type definition.
Generic object that can be signaled but is not associated to any sangoma device.
Definition: libsangoma.h:369
Sangoma object associated to some device which cannot be signaled (cannot call sangoma_wait_obj_signa...
Definition: libsangoma.h:371
Sangoma object that is associated to a device AND can be signaled.
Definition: libsangoma.h:373
deprecated, use SANGOMA_GENERIC_WAIT_OBJ
Definition: libsangoma.h:367

Function Documentation

sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan ( int  span,
int  chan 
)

Open a Device based on Span/Chan values.

Device OPEN / CLOSE Functions

Parameters
spanspan number starting from 1 to 255
chanchan number starting from 1 to 32
Returns
File Descriptor: -1 error, 0 or positive integer: valid file descriptor

Restriced open, device will allowed to be open only once.

Definition at line 1682 of file libsangoma.c.

References __sangoma_open_api_span_chan(), wanpipe_api_cmd::cmd, INVALID_HANDLE_VALUE, wanpipe_api_cmd::open_cnt, sangoma_close(), sangoma_cmd_exec(), WP_API_CMD_OPEN_CNT, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device(), and sangoma_create_socket_by_name().

1683 {
1685  wanpipe_api_t tdm_api;
1686  int err;
1687 
1688  fd = __sangoma_open_api_span_chan(span, chan);
1689 
1690 #if defined(__WINDOWS__)
1691  if(fd == INVALID_HANDLE_VALUE){
1692  return fd;
1693  }
1694 #else
1695  if (fd < 0) {
1696  return fd;
1697  }
1698 #endif
1699 
1700  memset(&tdm_api,0,sizeof(tdm_api));
1701  tdm_api.wp_cmd.cmd = WP_API_CMD_OPEN_CNT;
1702  err=sangoma_cmd_exec(fd,&tdm_api);
1703  if (err){
1704  sangoma_close(&fd);
1705  return fd;
1706  }
1707 
1708  if (tdm_api.wp_cmd.open_cnt > 1) {
1709  /* this is NOT the first open request for this span/chan */
1710  sangoma_close(&fd);
1711  fd = INVALID_HANDLE_VALUE;/* fd is NOT valid anymore */
1712  }
1713 
1714  return fd;
1715 }
sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan(int span, int chan)
Open a Device based on Span/Chan values.
Definition: libsangoma.c:1740
#define INVALID_HANDLE_VALUE
Invalid file handle value -1, Ported from Windows.
Definition: libsangoma.h:191
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
int sng_fd_t
Windows/Unix file handle abstraction.
wanpipe_api_cmd_t wp_cmd
unsigned int open_cnt
Wanpipe API Command Structure.
void _LIBSNG_CALL sangoma_close(sng_fd_t *fd)
Close device file descriptor.
Definition: libsangoma.c:1818

Here is the call graph for this function:

Here is the caller graph for this function:

sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan ( int  span,
int  chan 
)

Open a Device based on Span/Chan values.

Parameters
spanspan number starting from 1 to 255
chanchan number starting from 1 to 32
Returns
File Descriptor: -1 error, 0 or positive integer: valid file descriptor

Unrestriced open, allows mutiple open calls on a single device

Definition at line 1740 of file libsangoma.c.

References _snprintf, FNAME_LEN, sangoma_open_dev_by_name(), and WP_INTERFACE_NAME_FORM.

Referenced by open_sangoma_device(), and sangoma_open_api_span_chan().

1741 {
1742  char tmp_fname[FNAME_LEN];
1743 
1744  /* Form the Interface Name from span and chan number (i.e. wanpipe1_if1). */
1745  _snprintf(tmp_fname, DEV_NAME_LEN, WP_INTERFACE_NAME_FORM, span, chan);
1746 
1747  return sangoma_open_dev_by_name(tmp_fname);
1748 }
#define _snprintf
_snprintf type mapped to snprintf, Ported from Windows
Definition: libsangoma.h:255
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
Open API device using it&#39;s name. For example: Linux: w1g1, Windows wanpipe1_if1.
Definition: libsangoma.c:1717
#define WP_INTERFACE_NAME_FORM
String define of a wanpipe interface name.

Here is the call graph for this function:

Here is the caller graph for this function:

sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name ( const char *  dev_name)

Open API device using it's name. For example: Linux: w1g1, Windows wanpipe1_if1.

Parameters
dev_nameAPI device name
Returns
File Descriptor: -1 error, 0 or positive integer: valid file descriptor

Definition at line 1717 of file libsangoma.c.

References _snprintf, and FNAME_LEN.

Referenced by __sangoma_open_api_span_chan(), sangoma_logger_open(), sangoma_open_api_ctrl(), and sangoma_open_driver_ctrl().

1718 {
1719  char fname[FNAME_LEN];
1720 
1721 #if defined(__WINDOWS__)
1722  _snprintf(fname , FNAME_LEN, "\\\\.\\%s", dev_name);
1723 
1724  return CreateFile( fname,
1725  GENERIC_READ | GENERIC_WRITE,
1726  FILE_SHARE_READ | FILE_SHARE_WRITE,
1727  (LPSECURITY_ATTRIBUTES)NULL,
1728  OPEN_EXISTING,
1729  FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH,
1730  (HANDLE)NULL
1731  );
1732 #else
1733  sprintf(fname,"/dev/%s", dev_name);
1734 
1735  return open(fname, O_RDWR);
1736 #endif
1737 }
#define _snprintf
_snprintf type mapped to snprintf, Ported from Windows
Definition: libsangoma.h:255
int HANDLE
file handle type int, Ported from Windows
Definition: libsangoma.h:258
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348

Here is the caller graph for this function:

sng_fd_t _LIBSNG_CALL sangoma_open_api_ctrl ( void  )

Open a Global Control Device.

Returns
File Descriptor - negative=error 0 or greater = fd

The global control device receives events for all devices configured.

Definition at line 1750 of file libsangoma.c.

References sangoma_open_dev_by_name().

1751 {
1752  return sangoma_open_dev_by_name(WP_CTRL_DEV_NAME);
1753 }
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
Open API device using it&#39;s name. For example: Linux: w1g1, Windows wanpipe1_if1.
Definition: libsangoma.c:1717

Here is the call graph for this function:

sng_fd_t _LIBSNG_CALL sangoma_logger_open ( void  )

Open a Global Logger Device.

Returns
File Descriptor - negative=error 0 or greater = fd

The global Logger device receives Logger Events for all devices configured.

Definition at line 1756 of file libsangoma.c.

References sangoma_open_dev_by_name().

1757 {
1758  return sangoma_open_dev_by_name(WP_LOGGER_DEV_NAME);
1759 }
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
Open API device using it&#39;s name. For example: Linux: w1g1, Windows wanpipe1_if1.
Definition: libsangoma.c:1717

Here is the call graph for this function:

sng_fd_t _LIBSNG_CALL sangoma_open_driver_ctrl ( int  port_no)

Open a Global Driver Control Device.

Returns
File Descriptor - negative=error 0 or greater = fd

The global control device receives events for all devices configured.

Definition at line 107 of file libsangoma_config.c.

References _snprintf, FNAME_LEN, sangoma_open_dev_by_name(), and WP_PORT_NAME_FORM.

108 {
109  char tmp_fname[FNAME_LEN];
110 
111 #if defined(__WINDOWS__)
112  /* Form the Config Device Name (i.e. wanpipe1, wanpipe2,...). */
113  _snprintf(tmp_fname, DEV_NAME_LEN, WP_PORT_NAME_FORM, port_no);
114 #else
115  /* Form the Config Device Name. ("/dev/wanpipe") */
116  _snprintf(tmp_fname, DEV_NAME_LEN, WP_CONFIG_DEV_NAME);
117 #endif
118  return sangoma_open_dev_by_name(tmp_fname);
119 }
#define _snprintf
_snprintf type mapped to snprintf, Ported from Windows
Definition: libsangoma.h:255
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
Open API device using it&#39;s name. For example: Linux: w1g1, Windows wanpipe1_if1.
Definition: libsangoma.c:1717
#define WP_PORT_NAME_FORM
String define of a wanpipe port name.

Here is the call graph for this function:

void _LIBSNG_CALL sangoma_close ( sng_fd_t fd)

Close device file descriptor.

Parameters
fddevice file descriptor
Returns
void

Definition at line 1818 of file libsangoma.c.

References INVALID_HANDLE_VALUE.

Referenced by cleanup(), sangoma_open_api_span_chan(), and sangoma_wait_obj_delete().

1819 {
1820  if (!fd) {
1821  return;
1822  }
1823 #if defined(__WINDOWS__)
1824  if (*fd != INVALID_HANDLE_VALUE){
1825  CloseHandle(*fd);
1826  *fd = INVALID_HANDLE_VALUE;
1827  }
1828 #else
1829  if (*fd >= 0) {
1830  close(*fd);
1831  *fd = -1;
1832  }
1833 #endif
1834 }
#define INVALID_HANDLE_VALUE
Invalid file handle value -1, Ported from Windows.
Definition: libsangoma.h:191

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_get_open_cnt ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get device open count.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
negative or 0: error, greater than 1 : open count

Definition at line 1762 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::open_cnt, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_OPEN_CNT, and wanpipe_api::wp_cmd.

1763 {
1764  int err;
1765 
1766  WANPIPE_API_INIT_CHAN(tdm_api, 0);
1768  tdm_api->wp_cmd.cmd = WP_API_CMD_OPEN_CNT;
1769 
1770  err=sangoma_cmd_exec(fd,tdm_api);
1771  if (err){
1772  return -1;
1773  }
1774 
1775  return tdm_api->wp_cmd.open_cnt;
1776 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int open_cnt

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_writemsg ( sng_fd_t  fd,
void *  hdrbuf,
int  hdrlen,
void *  databuf,
unsigned short  datalen,
int  flag 
)

Write Data to device.

Device READ / WRITE Functions

Parameters
fddevice file descriptor
hdrbufpointer to header structure wp_api_hdr_t
hdrlensize of wp_api_hdr_t
databufpointer to data buffer to be transmitted
datalenlength of data buffer
flagcurrently not used, set to 0
Returns
transmit size, must be equal to datalen, anything else is error

In case of error return code, one must check the header operation_status variable to identify the reason of an error. Please refer to the error codes.

Definition at line 1913 of file libsangoma.c.

References wp_api_hdr::data_length, wan_iovec_list::iovec_list, wan_msghdr::msg_iov, wan_msghdr::msg_iovlen, wp_api_hdr::operation_status, SANG_STATUS_DEVICE_BUSY, SANG_STATUS_IO_ERROR, SANG_STATUS_SUCCESS, and SDLA_DECODE_SANG_STATUS.

Referenced by write_data().

1914 {
1915  int bsent=-1;
1916  wp_api_hdr_t *wp_api_hdr = hdrbuf;
1917 #if defined(__WINDOWS__)
1918  wan_iovec_list_t iovec_list;
1919 #endif
1920 
1921  if (hdrlen != sizeof(wp_api_hdr_t)) {
1922  /* error. Possible cause is a mismatch between versions of API header files. */
1923  DBG_ERR("hdrlen (%i) != sizeof(wp_api_hdr_t) (%i)\n", hdrlen, sizeof(wp_api_hdr_t));
1924  return -1;
1925  }
1926 
1927 #if defined(__WINDOWS__)
1928 
1929  wp_api_hdr->data_length = datalen;
1930 
1931  memset(&iovec_list, 0x00, sizeof(iovec_list));
1932 
1933  iovec_list.iovec_list[0].iov_base = hdrbuf;
1934  iovec_list.iovec_list[0].iov_len = hdrlen;
1935 
1936  iovec_list.iovec_list[1].iov_base = databuf;
1937  iovec_list.iovec_list[1].iov_len = datalen;
1938 
1939  /* queue data for transmission */
1940  if (DoWriteCommand(fd, &iovec_list)) {
1941  /*error*/
1942  DBG_ERR("DoWriteCommand() failed!! Check messages log.\n");
1943  return -1;
1944  }
1945 
1946  bsent=0;
1947  /*check that frame was transmitted*/
1948  switch(wp_api_hdr->operation_status)
1949  {
1950  case SANG_STATUS_SUCCESS:
1951  bsent = datalen;
1952  break;
1953  default:
1954  DBG_ERR("Operation Status: %s(%d)\n",
1955  SDLA_DECODE_SANG_STATUS(wp_api_hdr->operation_status), wp_api_hdr->operation_status);
1956  break;
1957  }/*switch()*/
1958 #else
1959  wan_msghdr_t msg;
1960  wan_iovec_t iov[2];
1961 
1962  memset(&msg,0,sizeof(msg));
1963  memset(&iov[0],0,sizeof(iov[0])*2);
1964 
1965  iov[0].iov_len=hdrlen;
1966  iov[0].iov_base=hdrbuf;
1967 
1968  iov[1].iov_len=datalen;
1969  iov[1].iov_base=databuf;
1970 
1971  msg.msg_iovlen=2;
1972  msg.msg_iov=iov;
1973 
1974  bsent = write(fd,&msg,sizeof(msg));
1975 
1976  if (bsent == (datalen+hdrlen)){
1977  wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_SUCCESS;
1978  bsent-=sizeof(wp_api_hdr_t);
1979  } else if (errno == EBUSY){
1980  wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_DEVICE_BUSY;
1981  } else {
1982  wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_IO_ERROR;
1983  }
1984  wp_api_hdr->wp_api_hdr_data_length=bsent;
1985 
1986 #endif
1987  return bsent;
1988 }
u_int8_t operation_status
Memory Descriptor of a single buffer. This structure used internally by libsangoma.
u_int32_t msg_iovlen
#define SDLA_DECODE_SANG_STATUS(status)
Print decode of Sangoma Return Codes.
Fixed-length List of Memory Descriptors.
Variable-length List of Memory Descriptors.
wan_iovec_t *WP_POINTER_64 msg_iov
Wanpipe API Header Structure.
u_int16_t data_length
wan_iovec_t iovec_list[WAN_IOVEC_LIST_LEN]
struct wp_api_hdr wp_api_hdr_t
Wanpipe API Header Structure.

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_readmsg ( sng_fd_t  fd,
void *  hdrbuf,
int  hdrlen,
void *  databuf,
int  datalen,
int  flag 
)

Read Data from device.

Device READ / WRITE Functions

Parameters
fddevice file descriptor
hdrbufpointer to header structure wp_api_hdr_t
hdrlensize of wp_api_hdr_t
databufpointer to data buffer to be received
datalenlength of data buffer
flagcurrently not used, set to 0
Returns
received size, must be equal to datalen, anything else is error or busy

In case of error return code, one must check the header operation_status variable to identify the reason of error. Please refer to the error codes.

Definition at line 1842 of file libsangoma.c.

References wp_api_hdr::data_length, wan_iovec_list::iovec_list, wan_msghdr::msg_iov, wan_msghdr::msg_iovlen, wp_api_hdr::operation_status, SANG_STATUS_NO_DATA_AVAILABLE, SANG_STATUS_RX_DATA_AVAILABLE, and SDLA_DECODE_SANG_STATUS.

1843 {
1844  int rx_len=0;
1845 
1846 #if defined(__WINDOWS__)
1847  wp_api_hdr_t *rx_hdr = (wp_api_hdr_t*)hdrbuf;
1848  wan_iovec_list_t iovec_list;
1849 
1850  if (hdrlen != sizeof(wp_api_hdr_t)) {
1851  /*error*/
1852  DBG_ERR("hdrlen (%i) != sizeof(wp_api_hdr_t) (%i)\n", hdrlen, sizeof(wp_api_hdr_t));
1853  return -1;
1854  }
1855 
1856  memset(&iovec_list, 0x00, sizeof(iovec_list));
1857 
1858  iovec_list.iovec_list[0].iov_base = hdrbuf;
1859  iovec_list.iovec_list[0].iov_len = hdrlen;
1860 
1861  iovec_list.iovec_list[1].iov_base = databuf;
1862  iovec_list.iovec_list[1].iov_len = datalen;
1863 
1864  if (DoReadCommand(fd, &iovec_list)) {
1865  /*error*/
1866  DBG_ERR("DoReadCommand() failed! Check messages log.\n");
1867  return -4;
1868  }
1869 
1870  switch(rx_hdr->operation_status)
1871  {
1873  /* ok */
1874  break;
1876  /* Note that SANG_STATUS_NO_DATA_AVAILABLE is NOT an error becase
1877  * read() is non-blocking and can be called at any time (by some polling code)*/
1878  return 1; /* return positive value to indicate IOCTL success, user must check 'rx_hdr->operation_status' */
1879  default:
1880  if(libsng_dbg_level)DBG_ERR("Operation Status: %s(%d)\n",
1882  return -5;
1883  }
1884 
1885  rx_len = rx_hdr->data_length;
1886 #else
1887  wan_msghdr_t msg;
1888  wan_iovec_t iov[2];
1889 
1890  memset(&msg,0,sizeof(msg));
1891  memset(&iov[0],0,sizeof(iov[0])*2);
1892 
1893  iov[0].iov_len=hdrlen;
1894  iov[0].iov_base=hdrbuf;
1895 
1896  iov[1].iov_len=datalen;
1897  iov[1].iov_base=databuf;
1898 
1899  msg.msg_iovlen=2;
1900  msg.msg_iov=iov;
1901 
1902  rx_len = read(fd,&msg,sizeof(msg));
1903 
1904  if (rx_len <= sizeof(wp_api_hdr_t)){
1905  return -EINVAL;
1906  }
1907 
1908  rx_len -= sizeof(wp_api_hdr_t);
1909 #endif
1910  return rx_len;
1911 }
u_int8_t operation_status
Memory Descriptor of a single buffer. This structure used internally by libsangoma.
u_int32_t msg_iovlen
#define SDLA_DECODE_SANG_STATUS(status)
Print decode of Sangoma Return Codes.
Fixed-length List of Memory Descriptors.
Variable-length List of Memory Descriptors.
wan_iovec_t *WP_POINTER_64 msg_iov
Wanpipe API Header Structure.
u_int16_t data_length
wan_iovec_t iovec_list[WAN_IOVEC_LIST_LEN]
struct wp_api_hdr wp_api_hdr_t
Wanpipe API Header Structure.
sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_create ( sangoma_wait_obj_t **  sangoma_wait_object,
sng_fd_t  fd,
sangoma_wait_obj_type_t  object_type 
)

Create a wait object that will be used with sangoma_waitfor_many() API.

Device POLL Functions

Parameters
sangoma_wait_objectpointer a single device object
fddevice file descriptor
object_typetype of the wait object. see sangoma_wait_obj_type_t for types
See Also
sangoma_wait_obj_type_t
Returns
SANG_STATUS_SUCCESS: success, or error status
Parameters
sangoma_wait_objectpointer a single device object
fddevice file descriptor
object_typetype of the wait object. see sangoma_wait_obj_type_t for types
See Also
sangoma_wait_obj_type_t
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 1239 of file libsangoma.c.

References FALSE, INVALID_HANDLE_VALUE, SANG_STATUS_FAILED_ALLOCATE_MEMORY, SANG_STATUS_GENERAL_ERROR, SANG_STATUS_INVALID_PARAMETER, SANG_STATUS_SUCCESS, and sangoma_wait_obj_delete().

Referenced by open_sangoma_device().

1240 {
1241  int err = 0;
1242  sangoma_wait_obj_t *sng_wait_obj = NULL;
1243 
1244  if (!sangoma_wait_object) {
1246  }
1247  *sangoma_wait_object = NULL;
1248  sng_wait_obj = malloc(sizeof(**sangoma_wait_object));
1249  if (!sng_wait_obj) {
1251  }
1252 
1253  memset(sng_wait_obj, 0x00, sizeof(*sng_wait_obj));
1254  /* it is a first initialization of the object */
1255  sng_wait_obj->init_flag = LIBSNG_MAGIC_NO;
1256 
1257  sng_wait_obj->fd = fd;
1258  sng_wait_obj->object_type = object_type;
1259 
1260 #if defined(__WINDOWS__)
1261  if (!SANGOMA_OBJ_HAS_DEVICE(sng_wait_obj)) {
1262  sng_wait_obj->signal_object = CreateEvent(NULL, FALSE, FALSE, NULL);
1263  if(!sng_wait_obj->signal_object){
1265  goto failed;
1266  }
1267  err = SANG_STATUS_SUCCESS;
1268  } else {
1269  err = init_sangoma_event_object(sng_wait_obj, fd);
1270  if(SANG_STATUS_SUCCESS != err){
1271  goto failed;
1272  }
1273  }
1274 #else
1275  int flags;
1276  int filedes[2];
1277  if (SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) {
1278  sng_wait_obj->signal_read_fd = INVALID_HANDLE_VALUE;
1279  sng_wait_obj->signal_write_fd = INVALID_HANDLE_VALUE;
1280  /* if we want cross-process event notification we can use a named pipe with mkfifo() */
1281  if (pipe(filedes)) {
1283  goto failed;
1284  }
1285  sng_wait_obj->signal_read_fd = filedes[0];
1286  sng_wait_obj->signal_write_fd = filedes[1];
1287  /* make the read fd non-blocking, multiple threads can wait for it but just one
1288  * wil read the dummy notify character, the others would block otherwise and that's
1289  * not what we want */
1290  flags = fcntl(sng_wait_obj->signal_read_fd, F_GETFL, 0);
1291  if (flags < 0) {
1293  goto failed;
1294  }
1295  flags |= O_NONBLOCK;
1296  fcntl(sng_wait_obj->signal_read_fd, F_SETFL, flags);
1297  flags = fcntl(sng_wait_obj->signal_read_fd, F_GETFL, 0);
1298  if (flags < 0 || !(flags & O_NONBLOCK)) {
1300  goto failed;
1301  }
1302  }
1303 #endif
1304  *sangoma_wait_object = sng_wait_obj;
1305  return err;
1306 
1307 failed:
1308  if (sng_wait_obj) {
1309  sangoma_wait_obj_delete(&sng_wait_obj);
1310  }
1311  return err;
1312 }
#define INVALID_HANDLE_VALUE
Invalid file handle value -1, Ported from Windows.
Definition: libsangoma.h:191
#define FALSE
FALSE value is 0, Ported from Windows.
Definition: libsangoma.h:244
sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_delete(sangoma_wait_obj_t **sangoma_wait_object)
De-allocate all resources in a wait object.
Definition: libsangoma.c:1320

Here is the call graph for this function:

Here is the caller graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_delete ( sangoma_wait_obj_t **  sangoma_wait_object)

De-allocate all resources in a wait object.

De-allocate all resources inside a wait object which were allocated by sangoma_wait_obj_init().

Parameters
sangoma_wait_objectpointer to a pointer to a single device object
Returns
SANG_STATUS_SUCCESS on success or some sangoma status error

Definition at line 1320 of file libsangoma.c.

References INVALID_HANDLE_VALUE, SANG_STATUS_INVALID_DEVICE, SANG_STATUS_SUCCESS, sangoma_close(), and UNKNOWN_WAIT_OBJ.

Referenced by cleanup(), and sangoma_wait_obj_create().

1321 {
1322  sangoma_wait_obj_t *sng_wait_obj = *sangoma_wait_object;
1323 
1324  if(sng_wait_obj->init_flag != LIBSNG_MAGIC_NO){
1325  /* error. object was not initialized by sangoma_wait_obj_init() */
1327  }
1328 
1329 #if defined(__WINDOWS__)
1330  if (sng_wait_obj->signal_object &&
1331  sng_wait_obj->signal_object != INVALID_HANDLE_VALUE) {
1332  sangoma_close(&sng_wait_obj->signal_object);
1333  }
1334 #else
1335  if (SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) {
1336  sangoma_close(&sng_wait_obj->signal_read_fd);
1337  sangoma_close(&sng_wait_obj->signal_write_fd);
1338  }
1339 #endif
1340  sng_wait_obj->init_flag = 0;
1341  sng_wait_obj->object_type = UNKNOWN_WAIT_OBJ;
1342  free(sng_wait_obj);
1343  *sangoma_wait_object = NULL;
1344  return SANG_STATUS_SUCCESS;
1345 }
#define INVALID_HANDLE_VALUE
Invalid file handle value -1, Ported from Windows.
Definition: libsangoma.h:191
deprecated, use SANGOMA_GENERIC_WAIT_OBJ
Definition: libsangoma.h:367
void _LIBSNG_CALL sangoma_close(sng_fd_t *fd)
Close device file descriptor.
Definition: libsangoma.c:1818

Here is the call graph for this function:

Here is the caller graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_signal ( sangoma_wait_obj_t *  sng_wait_obj)

Set wait object to a signaled state.

Parameters
sangoma_wait_objectpointer a single device object that can be signaled
Returns
sangoma_status_t

Definition at line 1353 of file libsangoma.c.

References SANG_STATUS_GENERAL_ERROR, SANG_STATUS_INVALID_DEVICE, and SANG_STATUS_SUCCESS.

1354 {
1355  if (!SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) {
1356  /* even when Windows objects are always signalable for the sake of providing
1357  * a consistent interface to the user we downgrade the capabilities of Windows
1358  * objects unless the sangoma wait object is explicitly initialized as signalable */
1360  }
1361 #if defined(__WINDOWS__)
1362  if(sng_wait_obj->signal_object){
1363  if (!SetEvent(sng_wait_obj->signal_object)) {
1365  }
1366  }
1367 #else
1368  /* at this point we know is a signalable object and has a signal_write_fd */
1369  if (write(sng_wait_obj->signal_write_fd, "s", 1) < 1) {
1371  }
1372 #endif
1373  return SANG_STATUS_SUCCESS;
1374 }
sng_fd_t _LIBSNG_CALL sangoma_wait_obj_get_fd ( sangoma_wait_obj_t *  sng_wait_obj)

Get fd device file descriptor which was the 'fd' parameter for sangoma_wait_obj_create(), not useful for generic objects.

Parameters
sangoma_wait_objectpointer a single device object
Returns
sng_fd_t - device file descriptor

Definition at line 1382 of file libsangoma.c.

Referenced by cleanup(), handle_span_chan(), handle_tdm_event(), and write_data().

1383 {
1384  return sng_wait_obj->fd;
1385 }

Here is the caller graph for this function:

PVOID _LIBSNG_CALL sangoma_wait_obj_get_context ( sangoma_wait_obj_t *  sng_wait_obj)

Retrieve the user context (if any) that was set via sangoma_wait_obj_set_context.

Parameters
sangoma_wait_objectpointer a single device object
Returns
void*

Windows note: must use return type PVOID instead of void* to satisfy WDK compiler.

Parameters
sangoma_wait_objectpointer a single device object
Returns
void*

Definition at line 1406 of file libsangoma.c.

Referenced by cleanup(), and write_data().

1407 {
1408  return sng_wait_obj->context;
1409 }

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_cmd_exec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Execute Sangoma API Command.

Device API COMMAND Functions

Device API COMMAND Functions

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2004 of file libsangoma.c.

References wanpipe_api_cmd::cmd, WANPIPE_IOCTL_API_CMD, and wanpipe_api::wp_cmd.

Referenced by sangoma_disable_bri_bchan_loopback(), sangoma_enable_bri_bchan_loopback(), sangoma_flush_bufs(), sangoma_flush_event_bufs(), sangoma_flush_rx_bufs(), sangoma_flush_stats(), sangoma_flush_tx_bufs(), sangoma_get_cpld_version(), sangoma_get_driver_version(), sangoma_get_fe_status(), sangoma_get_firmware_version(), sangoma_get_full_cfg(), sangoma_get_hw_coding(), sangoma_get_link_status(), sangoma_get_open_cnt(), sangoma_get_rx_queue_sz(), sangoma_get_stats(), sangoma_get_tx_queue_sz(), sangoma_open_api_span_chan(), sangoma_read_event(), sangoma_set_fe_status(), sangoma_set_rm_rx_gain(), sangoma_set_rm_rxflashtime(), sangoma_set_rm_tx_gain(), sangoma_set_rx_queue_sz(), sangoma_set_tx_queue_sz(), sangoma_ss7_force_rx(), sangoma_ss7_get_cfg_status(), sangoma_tdm_disable_dtmf_events(), sangoma_tdm_disable_fax_events(), sangoma_tdm_disable_hwec(), sangoma_tdm_disable_loop(), sangoma_tdm_disable_rbs_events(), sangoma_tdm_disable_ring_detect_events(), sangoma_tdm_disable_ring_events(), sangoma_tdm_disable_ring_trip_detect_events(), sangoma_tdm_disable_rm_dtmf_events(), sangoma_tdm_disable_rxhook_events(), sangoma_tdm_disable_tone_events(), sangoma_tdm_enable_dtmf_events(), sangoma_tdm_enable_fax_events(), sangoma_tdm_enable_hwec(), sangoma_tdm_enable_loop(), sangoma_tdm_enable_rbs_events(), sangoma_tdm_enable_ring_detect_events(), sangoma_tdm_enable_ring_events(), sangoma_tdm_enable_ring_trip_detect_events(), sangoma_tdm_enable_rm_dtmf_events(), sangoma_tdm_enable_rxhook_events(), sangoma_tdm_enable_tone_events(), sangoma_tdm_get_codec(), sangoma_tdm_get_fe_alarms(), sangoma_tdm_get_hw_dtmf(), sangoma_tdm_get_hw_ec(), sangoma_tdm_get_hw_fax(), sangoma_tdm_get_hwec_chan_status(), sangoma_tdm_get_hwec_persist_status(), sangoma_tdm_get_power_level(), sangoma_tdm_get_usr_mtu_mru(), sangoma_tdm_get_usr_period(), sangoma_tdm_read_rbs(), sangoma_tdm_set_buffer_multiplier(), sangoma_tdm_set_codec(), sangoma_tdm_set_power_level(), sangoma_tdm_set_usr_period(), sangoma_tdm_txsig_kewl(), sangoma_tdm_txsig_offhook(), sangoma_tdm_txsig_onhook(), sangoma_tdm_txsig_start(), and sangoma_tdm_write_rbs().

2005 {
2006  int err;
2007 
2008 #if defined(__WINDOWS__)
2009  err = tdmv_api_ioctl(fd, &tdm_api->wp_cmd);
2010 #else
2011  err = ioctl(fd,WANPIPE_IOCTL_API_CMD,&tdm_api->wp_cmd);
2012  if (err < 0){
2013  char tmp[50];
2014  sprintf(tmp,"TDM API: CMD: %i\n",tdm_api->wp_cmd.cmd);
2015  perror(tmp);
2016  return -1;
2017  }
2018 #endif
2019  return err;
2020 }
wanpipe_api_cmd_t wp_cmd
int _LIBSNG_CALL sangoma_get_full_cfg ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Read tdm api device configuration.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2026 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_alarms, wanpipe_api_cmd::hw_mtu_mru, wanpipe_api_cmd::hw_tdm_coding, wanpipe_api_cmd::idle_flag, wanpipe_api_cmd::power_level, wanpipe_api_cmd::rx_disable, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::stats, wanpipe_api_cmd::tdm_codec, wanpipe_api_cmd::tx_disable, wanpipe_api_cmd::usr_mtu_mru, wanpipe_api_cmd::usr_period, WP_API_CMD_GET_FULL_CFG, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device(), sangoma_fe_reg_read(), and sangoma_fe_reg_write().

2027 {
2028  int err;
2029 
2030  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2032  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FULL_CFG;
2033 
2034  err=sangoma_cmd_exec(fd,tdm_api);
2035  if (err){
2036  return err;
2037  }
2038 
2039 #if 0
2040  printf("TDM API CFG:\n");
2041  printf("\thw_tdm_coding:\t%d\n",tdm_api->wp_cmd.hw_tdm_coding);
2042  printf("\thw_mtu_mru:\t%d\n",tdm_api->wp_cmd.hw_mtu_mru);
2043  printf("\tusr_period:\t%d\n",tdm_api->wp_cmd.usr_period);
2044  printf("\ttdm_codec:\t%d\n",tdm_api->wp_cmd.tdm_codec);
2045  printf("\tpower_level:\t%d\n",tdm_api->wp_cmd.power_level);
2046  printf("\trx_disable:\t%d\n",tdm_api->wp_cmd.rx_disable);
2047  printf("\ttx_disable:\t%d\n",tdm_api->wp_cmd.tx_disable);
2048  printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_cmd.usr_mtu_mru);
2049  printf("\tidle flag:\t0x%02X\n",tdm_api->wp_cmd.idle_flag);
2050 
2051 #ifdef WP_API_FEATURE_FE_ALARM
2052  printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_cmd.fe_alarms);
2053 #endif
2054 
2055  printf("\trx pkt\t%d\ttx pkt\t%d\n",tdm_api->wp_cmd.stats.rx_packets,
2056  tdm_api->wp_cmd.stats.tx_packets);
2057  printf("\trx err\t%d\ttx err\t%d\n",
2058  tdm_api->wp_cmd.stats.rx_errors,
2059  tdm_api->wp_cmd.stats.tx_errors);
2060 #ifndef __WINDOWS__
2061  printf("\trx ovr\t%d\ttx idl\t%d\n",
2062  tdm_api->wp_cmd.stats.rx_fifo_errors,
2063  tdm_api->wp_cmd.stats.tx_carrier_errors);
2064 #endif
2065 #endif
2066 
2067  return 0;
2068 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
unsigned int usr_mtu_mru
unsigned int hw_tdm_coding
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int rx_disable
unsigned int fe_alarms
unsigned int hw_mtu_mru
wanpipe_chan_stats_t stats
unsigned int tx_disable
unsigned int usr_period
unsigned int tdm_codec
unsigned int idle_flag
unsigned int power_level

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_set_usr_period ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  period 
)

Set Tx/Rx Period in Milliseconds.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
periodvalue in miliseconds (1,2,5,10)
Returns
non-zero: error, 0: ok

Only valid in CHAN Operation Mode

Definition at line 2126 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::usr_period, WP_API_CMD_SET_USR_PERIOD, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2127 {
2128  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2131  tdm_api->wp_cmd.usr_period = period;
2132  return sangoma_cmd_exec(fd,tdm_api);
2133 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int usr_period

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_usr_period ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx/Rx Period in Milliseconds.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
negative: error or configured period value

Definition at line 2142 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::usr_period, WP_API_CMD_GET_USR_PERIOD, and wanpipe_api::wp_cmd.

2143 {
2144  int err;
2145 
2146  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2149 
2150  err=sangoma_cmd_exec(fd,tdm_api);
2151  if (err){
2152  return err;
2153  }
2154 
2155  return tdm_api->wp_cmd.usr_period;
2156 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int usr_period

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_usr_mtu_mru ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx/Rx MTU/MRU in bytes.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
negative: error or configured mtu/mru in bytes

Definition at line 2276 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::usr_mtu_mru, WP_API_CMD_GET_USR_MTU_MRU, and wanpipe_api::wp_cmd.

2277 {
2278  int err;
2279 
2280  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2283 
2284  err=sangoma_cmd_exec(fd,tdm_api);
2285  if (err){
2286  return err;
2287  }
2288 
2289  return tdm_api->wp_cmd.usr_mtu_mru;
2290 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
unsigned int usr_mtu_mru
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_flush_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush all (tx/rx/event) buffers from current channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2329 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FLUSH_BUFFERS, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2330 {
2331  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2333  tdm_api->wp_cmd.cmd = WP_API_CMD_FLUSH_BUFFERS;
2334  return sangoma_cmd_exec(fd,tdm_api);
2335 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_flush_rx_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only rx buffers from current channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2337 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FLUSH_RX_BUFFERS, and wanpipe_api::wp_cmd.

2338 {
2339  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2342  return sangoma_cmd_exec(fd,tdm_api);
2343 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_flush_tx_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only tx buffers from current channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2345 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FLUSH_TX_BUFFERS, and wanpipe_api::wp_cmd.

2346 {
2347  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2350  return sangoma_cmd_exec(fd,tdm_api);
2351 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_flush_event_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only event buffers from current channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2353 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FLUSH_EVENT_BUFFERS, and wanpipe_api::wp_cmd.

2354 {
2355  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2358  return sangoma_cmd_exec(fd,tdm_api);
2359 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_rbs_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  poll_in_sec 
)

Enable RBS Events on a device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
poll_in_secdriver poll period for rbs events
Returns
non-zero: error, 0: ok

Definition at line 2361 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rbs_poll, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_ENABLE_RBS_EVENTS, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2362 {
2363  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2366  tdm_api->wp_cmd.rbs_poll = poll_in_sec;
2367  return sangoma_cmd_exec(fd,tdm_api);
2368 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
unsigned int rbs_poll
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_rbs_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RBS Events for a device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2370 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_DISABLE_RBS_EVENTS, and wanpipe_api::wp_cmd.

Referenced by cleanup().

2370  {
2371 
2372  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2375  return sangoma_cmd_exec(fd,tdm_api);
2376 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_write_rbs ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  channel,
unsigned char  rbs 
)

Write RBS Bits on a device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
channelt1/e1 timeslot
rbsrbs bits (ABCD)
Returns
non-zero: error, 0: ok

Definition at line 2378 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rbs_tx_bits, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_WRITE_RBS_BITS, and wanpipe_api::wp_cmd.

2379 {
2380  WANPIPE_API_INIT_CHAN(tdm_api, channel);
2383  tdm_api->wp_cmd.rbs_tx_bits=rbs;
2384  return sangoma_cmd_exec(fd,tdm_api);
2385 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int rbs_tx_bits

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_read_rbs ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  channel,
unsigned char *  rbs 
)

Read RBS Bits on a device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
channelt1/e1 timeslot
rbspointer to rbs bits (ABCD)
Returns
non-zero: error, 0: ok

Definition at line 2387 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rbs_rx_bits, wanpipe_api_cmd::rbs_tx_bits, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_READ_RBS_BITS, and wanpipe_api::wp_cmd.

2388 {
2389  int err;
2390  WANPIPE_API_INIT_CHAN(tdm_api, channel);
2392  tdm_api->wp_cmd.cmd = WP_API_CMD_READ_RBS_BITS;
2393  tdm_api->wp_cmd.rbs_tx_bits=0;
2394 
2395  err=sangoma_cmd_exec(fd,tdm_api);
2396  if (err){
2397  return err;
2398  }
2399 
2400  *rbs=(unsigned char)tdm_api->wp_cmd.rbs_rx_bits;
2401  return 0;
2402 }
unsigned int rbs_rx_bits
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int rbs_tx_bits

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable DTMF Detection on Octasic chip (if hw supports it)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2636 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DTMF, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2637 {
2638  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2640  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2641  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_DTMF;
2642  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2643  return sangoma_cmd_exec(fd,tdm_api);
2644 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable DTMF Detection on Octasic chip (if hw supports it)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2646 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, WP_API_EVENT_DTMF, and wanpipe_api::wp_cmd.

Referenced by cleanup().

2647 {
2648  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2650  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2651  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_DTMF;
2652  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2653  return sangoma_cmd_exec(fd,tdm_api);
2654 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_fax_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable FAX Detection on Octasic chip (if hw supports it)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2601 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, WP_API_EVENT_FAX_DETECT, and wanpipe_api::wp_cmd.

2602 {
2603  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2605  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2606  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_FAX_DETECT;
2607  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2608  return sangoma_cmd_exec(fd,tdm_api);
2609 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_fax_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable FAX Detection on Octasic chip (if hw supports it)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2611 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, WP_API_EVENT_FAX_DETECT, and wanpipe_api::wp_cmd.

2612 {
2613  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2615  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2616  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_FAX_DETECT;
2617  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2618  return sangoma_cmd_exec(fd,tdm_api);
2619 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_hw_fax ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get HW FAX Detection State (Enable or Disabled) on Octasic chip (if hw supports it)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: Disabled, 1: Enabled

Supported only on cards that have HWEC

Definition at line 2621 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_FAX_DETECT, and wanpipe_api::wp_cmd.

2622 {
2623  int err;
2624  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2627  err=sangoma_cmd_exec(fd,tdm_api);
2628  if (err){
2629  return err;
2630  }
2631  return tdm_api->wp_cmd.hw_fax;
2632 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_rm_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable DTMF Detection on Analog/Remora SLIC Chip.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2656 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2657 {
2658  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2660  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2661  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RM_DTMF;
2662  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2663  return sangoma_cmd_exec(fd,tdm_api);
2664 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_rm_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable DTMF Detection on Analog/Remora SLIC Chip.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2666 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

Referenced by cleanup().

2667 {
2668  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2670  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2671  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RM_DTMF;
2672  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2673  return sangoma_cmd_exec(fd,tdm_api);
2674 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_rxhook_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RX HOOK Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2676 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2677 {
2678  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2680  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2681  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RXHOOK;
2682  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2683  return sangoma_cmd_exec(fd,tdm_api);
2684 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_rxhook_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RX HOOK Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2686 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

Referenced by cleanup().

2687 {
2688  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2690  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2691  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RXHOOK;
2692  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2693  return sangoma_cmd_exec(fd,tdm_api);
2694 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_ring_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2696 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2697 {
2698  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2700  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2701  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING;
2702  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2703  return sangoma_cmd_exec(fd,tdm_api);
2704 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_ring_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2706 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

2707 {
2708  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2710  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2711  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING;
2712  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2713  return sangoma_cmd_exec(fd,tdm_api);
2714 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_ring_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING DETECT Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2716 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2717 {
2718  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2720  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2721  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_DETECT;
2722  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2723  return sangoma_cmd_exec(fd,tdm_api);
2724 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_ring_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING DETECT Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2726 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

2727 {
2728  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2730  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2731  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_DETECT;
2732  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2733  return sangoma_cmd_exec(fd,tdm_api);
2734 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_ring_trip_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING TRIP Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2736 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2737 {
2738  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2740  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2741  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_TRIP_DETECT;
2742  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2743  return sangoma_cmd_exec(fd,tdm_api);
2744 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_ring_trip_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING TRIP Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2746 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

2747 {
2748  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2750  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2751  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_TRIP_DETECT;
2752  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2753  return sangoma_cmd_exec(fd,tdm_api);
2754 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_tone_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
uint16_t  tone_id 
)

Transmit a TONE on this device (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
tone_idtone type to transmit
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2796 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2797 {
2798  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2800  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2801  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TONE;
2802  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2803  tdm_api->wp_cmd.event.wp_api_event_tone_type = tone_id;
2804  return sangoma_cmd_exec(fd,tdm_api);
2805 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_tone_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable TONE Events (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2807 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

2808 {
2809  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2811  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2812  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TONE;
2813  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2814  tdm_api->wp_cmd.event.wp_api_event_tone_type = 0x00;
2815  return sangoma_cmd_exec(fd,tdm_api);
2816 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_txsig_onhook ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG ON HOOK (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2776 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2777 {
2778  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2780  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2781  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_ONHOOK;
2782  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2783  return sangoma_cmd_exec(fd,tdm_api);
2784 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_txsig_offhook ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG OFF HOOK (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2786 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2787 {
2788  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2790  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2791  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_OFFHOOK;
2792  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2793  return sangoma_cmd_exec(fd,tdm_api);
2794 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_txsig_start ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG START (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2766 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2767 {
2768  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2770  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2771  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_START;
2772  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2773  return sangoma_cmd_exec(fd,tdm_api);
2774 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_txsig_kewl ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG KEWL START (Analog Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on Analog Cards

Definition at line 2756 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2757 {
2758  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2760  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2761  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_KEWL;
2762  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2763  return sangoma_cmd_exec(fd,tdm_api);
2764 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_hwec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable HWEC on this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2819 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2820 {
2821  /* intentionally NOT initializing chan - caller must do it */
2823  tdm_api->wp_cmd.cmd = WP_API_CMD_ENABLE_HWEC;
2824  return sangoma_cmd_exec(fd,tdm_api);
2825 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_hwec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable HWEC on this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Supported only on cards that have HWEC

Definition at line 2827 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2828 {
2829  /* intentionally NOT initializing chan - caller must do it */
2831  tdm_api->wp_cmd.cmd = WP_API_CMD_DISABLE_HWEC;
2832  return sangoma_cmd_exec(fd,tdm_api);
2833 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_fe_alarms ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned int *  alarms 
)

Get Front End Alarms (T1/E1 Only)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
alarmsbit map status of T1/E1 alarms
Returns
non-zero: error, 0: ok

Supported only on T1/E1 Cards

Definition at line 2841 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_alarms, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2842 {
2843  int err;
2844 
2845  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2847  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_ALARMS;
2848 
2849  err=sangoma_cmd_exec(fd,tdm_api);
2850  if (err){
2851  return err;
2852  }
2853 
2854  *alarms=tdm_api->wp_cmd.fe_alarms;
2855 
2856  return 0;
2857 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int fe_alarms

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_get_link_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned char *  current_status 
)

Get Device Link Status (Connected/Disconnected)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
current_statuspointer where result will be filled: 0=Link UP 1=Link Down
Returns
non-zero: error, 0: ok -> check current_status

Definition at line 2876 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2877 {
2878  int err;
2879 
2880  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2882  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_STATUS;
2883  err = sangoma_cmd_exec(fd, tdm_api);
2884  *current_status = tdm_api->wp_cmd.fe_status;
2885 
2886  return err;
2887 }
unsigned char fe_status
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_set_fe_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned char  new_status 
)

Set Device Link Status (Connected/Disconnected)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
new_statusnew status 0=Link UP 1=Link Down
Returns
non-zero: error, 0: ok

Definition at line 2890 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2891 {
2892  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2894  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_FE_STATUS;
2895  tdm_api->wp_cmd.fe_status = new_status;
2896  return sangoma_cmd_exec(fd, tdm_api);
2897 }
unsigned char fe_status
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_set_buffer_multiplier ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned int  multiplier 
)

Set voice tx/rx buffer multiplier.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
multiplierbuffer multiplier value 0-disable or 1 to TDMAPI_MAX_BUFFER_MULTIPLIER
Returns
non-zero: error, 0: ok

Definition at line 2406 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_BUFFER_MULTIPLIER, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2407 {
2408 
2409  int err;
2410  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2413  *((unsigned int*)&tdm_api->wp_cmd.data[0]) = multiplier;
2414 
2415  err=sangoma_cmd_exec(fd,tdm_api);
2416  if (err){
2417  return err;
2418  }
2419 
2420  return 0;
2421 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_enable_bri_bchan_loopback ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  channel 
)

Enable BRI Bchannel loopback - used when debugging bri device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
channelbri bchannel 1 or 2
Returns
non-zero: error, 0: ok

Definition at line 2911 of file libsangoma.c.

References wp_api_event::channel, wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.

2912 {
2913  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2915  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2916  tdm_api->wp_cmd.event.channel = (unsigned char)channel;
2917  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_BRI_CHAN_LOOPBACK;
2918  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
2919  return sangoma_cmd_exec(fd, tdm_api);
2920 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
u_int8_t channel
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_disable_bri_bchan_loopback ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  channel 
)

Disable BRI Bchannel loopback - used when debugging bri device.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
channelbri bchannel 1 or 2
Returns
non-zero: error, 0: ok

Definition at line 2900 of file libsangoma.c.

References wp_api_event::channel, wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.

2901 {
2902  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2904  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
2905  tdm_api->wp_cmd.event.channel = (unsigned char)channel;
2906  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_BRI_CHAN_LOOPBACK;
2907  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE;
2908  return sangoma_cmd_exec(fd, tdm_api);
2909 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
u_int8_t channel
wp_api_event_t event
#define WP_API_EVENT_DISABLE
Option to disable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_get_tx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx Queue Size for this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2922 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::tx_queue_sz, WP_API_CMD_GET_TX_Q_SIZE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2923 {
2924  int err;
2925 
2926  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2928  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_TX_Q_SIZE;
2929  tdm_api->wp_cmd.tx_queue_sz = 0;
2930 
2931  err=sangoma_cmd_exec(fd, tdm_api);
2932  if (err < 0) {
2933  return err;
2934  }
2935 
2936  return tdm_api->wp_cmd.tx_queue_sz;
2937 }
unsigned int tx_queue_sz
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_set_tx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  size 
)

Get Tx Queue Size for this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
sizetx queue size (minimum value of 1)
Returns
non-zero: error, 0: ok

Definition at line 2939 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::tx_queue_sz, WP_API_CMD_SET_TX_Q_SIZE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2940 {
2941  if (size < 0) {
2942  return -1;
2943  }
2944  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2946  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_TX_Q_SIZE;
2947  tdm_api->wp_cmd.tx_queue_sz = size;
2948  return sangoma_cmd_exec(fd, tdm_api);
2949 }
unsigned int tx_queue_sz
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_get_rx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Rx Queue Size for this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

Definition at line 2951 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rx_queue_sz, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_RX_Q_SIZE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2952 {
2953  int err;
2954 
2955  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2957  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_RX_Q_SIZE;
2958  tdm_api->wp_cmd.rx_queue_sz = 0;
2959 
2960  err=sangoma_cmd_exec(fd, tdm_api);
2961  if (err < 0) {
2962  return err;
2963  }
2964 
2965  return tdm_api->wp_cmd.rx_queue_sz;
2966 
2967 }
unsigned int rx_queue_sz
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_set_rx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  size 
)

Get Tx Queue Size for this channel.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
sizerx queue size (minimum value of 1)
Returns
non-zero: error, 0: ok

Definition at line 2969 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rx_queue_sz, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_RX_Q_SIZE, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2970 {
2971  if (size < 0) {
2972  return -1;
2973  }
2974 
2975  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2977  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_RX_Q_SIZE;
2978  tdm_api->wp_cmd.rx_queue_sz = size;
2979  return sangoma_cmd_exec(fd, tdm_api);
2980 }
unsigned int rx_queue_sz
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_get_hw_coding ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get HW Voice Coding (ulaw/alaw)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
the low level voice coding, depending on configuration. (WP_MULAW or WP_ALAW)

Definition at line 2164 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_tdm_coding, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_CODING, and wanpipe_api::wp_cmd.

2165 {
2166  int err;
2167 
2168  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2170  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_CODING;
2171  err=sangoma_cmd_exec(fd,tdm_api);
2172  if (err){
2173  return err;
2174  }
2175  return tdm_api->wp_cmd.hw_tdm_coding;
2176 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
unsigned int hw_tdm_coding
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_hw_dtmf ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hwdtmf support is available.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

This function will check if hw supports HW DTMF.

Definition at line 2185 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_dtmf, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_DTMF, and wanpipe_api::wp_cmd.

2186 {
2187  int err;
2188 
2189  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2191  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_DTMF;
2192  err=sangoma_cmd_exec(fd,tdm_api);
2193  if (err){
2194  return err;
2195  }
2196  return tdm_api->wp_cmd.hw_dtmf;
2197 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int hw_dtmf

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_hw_ec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hw echo cancelation support is available.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: disable, >0:enabled

This function will check if hw supports HW EC.

Definition at line 2205 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC, and wanpipe_api::wp_cmd.

2206 {
2207  int err;
2208 
2209  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2211  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_EC;
2212  err=sangoma_cmd_exec(fd,tdm_api);
2213  if (err){
2214  return err;
2215  }
2216  return tdm_api->wp_cmd.hw_ec;
2217 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_hwec_chan_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hw echo cancelation is enabled on current timeslot.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: disabled, >0: enabled

This function will check if hw echo cancelation is enable on current timeslot.

Definition at line 2228 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC_CHAN, and wanpipe_api::wp_cmd.

2229 {
2230  int err;
2231 
2232  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2235  err=sangoma_cmd_exec(fd,tdm_api);
2236  if (err){
2237  return err;
2238  }
2239  return tdm_api->wp_cmd.hw_ec;
2240 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_hwec_persist_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hwec persis mode is on: On persist mode hwec is always enabled.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: disabled, >0: enabled

This function will check if hw persist mode is enabled.

Definition at line 2254 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC_PERSIST, and wanpipe_api::wp_cmd.

2255 {
2256  int err;
2257 
2258  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2261  err=sangoma_cmd_exec(fd,tdm_api);
2262  if (err){
2263  return err;
2264  }
2265  return tdm_api->wp_cmd.hw_ec;
2266 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_span_chan_toif ( int  span,
int  chan,
char *  interface_name 
)

Convert Span & Chan to interface name.

Device OPEN / CLOSE Functions

Parameters
spanspan number starting from 1 to 255
chanchan number starting from 1 to 32
interface_namepointer to string where interface name will be written
Returns
non-zero = error, 0 = ok

Definition at line 1566 of file libsangoma.c.

References WP_INTERFACE_NAME_FORM.

1567 {
1568 #if defined(__WINDOWS__)
1569  /* Form the Interface Name from span and chan number (i.e. wanpipe1_if1). */
1570  sprintf(interface_name, WP_INTERFACE_NAME_FORM, span, chan);
1571 #else
1572  sprintf(interface_name,"s%ic%i",span,chan);
1573 #endif
1574  return 0;
1575 }
#define WP_INTERFACE_NAME_FORM
String define of a wanpipe interface name.
int _LIBSNG_CALL sangoma_span_chan_fromif ( char *  interface_name,
int *  span,
int *  chan 
)

Convert Interace Name to Span & Chan.

Parameters
interface_namepointer to string containing interface name
spaninteger pointer where to write span value
chaninteger pointer where to write chan value
Returns
non-zero = error, 0 = ok

Definition at line 1640 of file libsangoma.c.

References FNAME_LEN.

1641 {
1642  char *p = NULL, *sp = NULL, *ch = NULL;
1643  int ret = 0;
1644  char data[FNAME_LEN];
1645 
1646  /* Windows: Accept WANPIPEx_IFy or wanpipex_ify
1647  * where x is the span and y is the chan. */
1648 
1649  strncpy(data, interface_name, FNAME_LEN);
1650  if ((data[0])) {
1651  for (p = data; *p; p++) {
1652 #if defined(__WINDOWS__)
1653  if (sp && (*p == 'F'||*p == 'f')) {
1654 #else
1655  if (sp && *p == 'c') {
1656 #endif
1657  *p = '\0';
1658  ch = (p + 1);
1659  break;
1660 #if defined(__WINDOWS__)
1661  } else if (*p == 'E'||*p == 'e') {
1662 #else
1663  } else if (*p == 's') {
1664 #endif
1665  sp = (p + 1);
1666  }
1667  }
1668 
1669  if(ch && sp) {
1670  *span = atoi(sp);
1671  *chan = atoi(ch);
1672  ret = 1;
1673  } else {
1674  *span = -1;
1675  *chan = -1;
1676  }
1677  }
1678 
1679  return ret;
1680 }
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348
int _LIBSNG_CALL sangoma_interface_wait_up ( int  span,
int  chan,
int  sectimeout 
)

Wait for a sangoma device to come up (ie: Linux wait for /dev/wanpipex_1 to come up)

Parameters
spanspan number of the device to wait
chanchan number of the device to wait
sectimeouthow many seconds to wait for the device to come up, -1 to wait forever
Returns
non-zero = error, 0 = ok

Definition at line 1608 of file libsangoma.c.

References FNAME_LEN, and WP_INTERFACE_NAME_FORM.

1609 {
1610 #if defined(__WINDOWS__)
1611  /* Windows does not need to wait for interfaces to come up */
1612  return 0;
1613 #else
1614  char interface_name[FNAME_LEN];
1615  struct stat statbuf;
1616  struct timeval endtime = {0,0};
1617  struct timeval curtime = {0,0};
1618  int counter;
1619  int rc;
1620  if (sectimeout >= 0 && gettimeofday(&endtime, NULL)) {
1621  return -1;
1622  }
1623  snprintf(interface_name, sizeof(interface_name), "/dev/" WP_INTERFACE_NAME_FORM, span, chan);
1624  endtime.tv_sec += sectimeout;
1625  do {
1626  counter = 0;
1627  while ((rc = stat(interface_name, &statbuf)) && errno == ENOENT && counter != 10) {
1628  poll(0, 0, 100); // test in 100ms increments
1629  counter++;
1630  }
1631  if (!rc || errno != ENOENT) break;
1632  if (gettimeofday(&curtime, NULL)) {
1633  return -1;
1634  }
1635  } while (sectimeout < 0 || timercmp(&endtime, &curtime,>));
1636  return rc;
1637 #endif
1638 }
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348
#define WP_INTERFACE_NAME_FORM
String define of a wanpipe interface name.
int _LIBSNG_CALL sangoma_get_driver_version ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
wan_driver_version_t drv_ver 
)

Get Device Driver Version Number.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
drv_verdriver version structure that will contain the driver version
Returns
non-zero = error, 0 = ok

Definition at line 2982 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_DRIVER_VERSION, and wanpipe_api::wp_cmd.

2983 {
2984  int err;
2985 
2986  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2989 
2990  err = sangoma_cmd_exec(fd, tdm_api);
2991  if (err == 0) {
2992  if (tdm_api->wp_cmd.data_len == sizeof(wan_driver_version_t)) {
2993  if (drv_ver) {
2994  memcpy(drv_ver,&tdm_api->wp_cmd.version,sizeof(wan_driver_version_t));
2995  }
2996  } else {
2997  return -1;
2998  }
2999  }
3000 
3001  return err;
3002 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_get_firmware_version ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned char *  ver 
)

Get Hardware/Firmware Version.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
verhardware/firmware version number
Returns
non-zero = error, 0 = ok

Definition at line 3004 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FIRMWARE_VERSION, and wanpipe_api::wp_cmd.

3005 {
3006  int err;
3007 
3008  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3011 
3012  err = sangoma_cmd_exec(fd, tdm_api);
3013  if (err == 0) {
3014  if (tdm_api->wp_cmd.data_len == sizeof(unsigned char)) {
3015  *ver = tdm_api->wp_cmd.data[0];
3016  } else {
3017  return -1;
3018  }
3019  }
3020 
3021  return err;
3022 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_get_cpld_version ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned char *  ver 
)

Get AFT CPLD Version.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
verAFT CPLD version number
Returns
non-zero = error, 0 = ok

Definition at line 3024 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_CPLD_VERSION, and wanpipe_api::wp_cmd.

3025 {
3026  int err;
3027 
3028  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3030  tdm_api->wp_cmd.cmd = WP_API_CMD_CPLD_VERSION;
3031 
3032  err = sangoma_cmd_exec(fd, tdm_api);
3033  if (err == 0) {
3034  if (tdm_api->wp_cmd.data_len == sizeof(unsigned char)) {
3035  *ver = tdm_api->wp_cmd.data[0];
3036  } else {
3037  return -1;
3038  }
3039  }
3040 
3041  return err;
3042 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_get_aft_customer_id ( sng_fd_t  fd,
unsigned char *  out_customer_id 
)

Get Customer-specific ID from AFT hardware, the default value is 0xFF, any change requires special arrangement with Sangoma Technologies.

Parameters
fddevice file descriptor
out_customer_idAFT Customer ID
Returns
non-zero = error, 0 = ok

Definition at line 3044 of file libsangoma.c.

References SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_mgmt_cmd(), and WANPIPEMON_AFT_CUSTOMER_ID.

3045 {
3046  wan_udp_hdr_t wan_udp;
3047 
3048  memset(&wan_udp, 0x00, sizeof(wan_udp));
3049 
3050  wan_udp.wan_udphdr_command = WANPIPEMON_AFT_CUSTOMER_ID;
3051  wan_udp.wan_udphdr_return_code = SANG_STATUS_UNSUPPORTED_FUNCTION;
3052  wan_udp.wan_udphdr_data_len = 0;
3053 
3054  if (sangoma_mgmt_cmd(fd, &wan_udp)) {
3055  return SANG_STATUS_IO_ERROR;
3056  }
3057 
3058  if (wan_udp.wan_udphdr_return_code) {
3060  }
3061 
3062  *out_customer_id = sangoma_get_wan_udphdr_data_byte(&wan_udp, 0);
3063 
3064  return 0;
3065 }
int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t *wan_udp)
Execute Sangoma Management Command.
Wanpipe UDP Structure used for Maintenance and Debugging.
Definition: wanpipe_api.h:92

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_port_led_ctrl ( sng_fd_t  fd,
unsigned char  led_ctrl 
)

Control the LED ligths of the TDM port. On (led set based on link status) Off (turn off all led). Used to visually identify a phisical port from software.

Parameters
fddevice file descriptor
led_state0=off 1=on
Returns
non-zero = error, 0 = ok

Definition at line 3068 of file libsangoma.c.

References SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_mgmt_cmd(), and WANPIPEMON_LED_CTRL.

3069 {
3070  wan_udp_hdr_t wan_udp;
3071 
3072  memset(&wan_udp, 0x00, sizeof(wan_udp));
3073 
3074  wan_udp.wan_udphdr_command = WANPIPEMON_LED_CTRL;
3075  wan_udp.wan_udphdr_return_code = SANG_STATUS_UNSUPPORTED_FUNCTION;
3076  wan_udp.wan_udphdr_data_len = 1;
3077  wan_udp.wan_udphdr_data[0] = led_ctrl;
3078 
3079  if (sangoma_mgmt_cmd(fd, &wan_udp)) {
3080  return SANG_STATUS_IO_ERROR;
3081  }
3082 
3083  if (wan_udp.wan_udphdr_return_code) {
3085  }
3086 
3087  return 0;
3088 }
int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t *wan_udp)
Execute Sangoma Management Command.
Wanpipe UDP Structure used for Maintenance and Debugging.
Definition: wanpipe_api.h:92

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_fe_reg_write ( sng_fd_t  fd,
uint32_t  offset,
uint8_t  data 
)

Write to a front end register.

Parameters
fddevice file descriptor
offsetoffset of front end register
datavalue to write
Returns
non-zero = error, 0 = ok

Definition at line 3092 of file libsangoma.c.

References wanpipe_api_cmd::chan, SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_get_full_cfg(), sangoma_mgmt_cmd(), and wanpipe_api::wp_cmd.

3093 {
3094  int chan=0;
3095  wan_udp_hdr_t wan_udp;
3096  sdla_fe_debug_t *fe_debug;
3097  memset(&wan_udp, 0x00, sizeof(wan_udp));
3098 
3099  {
3100  int err;
3101  wanpipe_api_t tdm_api;
3102  memset(&tdm_api,0,sizeof(tdm_api));
3103  err=sangoma_get_full_cfg(fd, &tdm_api);
3104  if (err) {
3105  return err;
3106  }
3107  chan=tdm_api.wp_cmd.chan;
3108  if (chan)
3109  chan--;
3110  }
3111 
3112  wan_udp.wan_udphdr_command = WAN_FE_SET_DEBUG_MODE;
3113  wan_udp.wan_udphdr_data_len = sizeof(sdla_fe_debug_t);
3114  wan_udp.wan_udphdr_return_code = 0xaa;
3115  fe_debug = (sdla_fe_debug_t*)wan_udp.wan_udphdr_data;
3116 
3117  fe_debug->type = WAN_FE_DEBUG_REG;
3118  fe_debug->mod_no = chan;
3119  fe_debug->fe_debug_reg.reg = offset;
3120  fe_debug->fe_debug_reg.value = data;
3121  fe_debug->fe_debug_reg.read = 0;
3122 
3123  if (sangoma_mgmt_cmd(fd, &wan_udp)) {
3124  return SANG_STATUS_IO_ERROR;
3125  }
3126 
3127  if (wan_udp.wan_udphdr_return_code) {
3129  }
3130 
3131  return 0;
3132 }
int _LIBSNG_CALL sangoma_get_full_cfg(sng_fd_t fd, wanpipe_api_t *tdm_api)
Read tdm api device configuration.
Definition: libsangoma.c:2026
int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t *wan_udp)
Execute Sangoma Management Command.
wanpipe_api_cmd_t wp_cmd
Wanpipe UDP Structure used for Maintenance and Debugging.
Definition: wanpipe_api.h:92
unsigned char chan
Wanpipe API Command Structure.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_fe_reg_read ( sng_fd_t  fd,
uint32_t  offset,
uint8_t *  data 
)

Read front end register.

Parameters
fddevice file descriptor
offsetoffset of front end register
datavalue of the read register
Returns
non-zero = error, 0 = ok

Definition at line 3134 of file libsangoma.c.

References wanpipe_api_cmd::chan, SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_get_full_cfg(), sangoma_mgmt_cmd(), and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

3135 {
3136  int chan=0;
3137  wan_udp_hdr_t wan_udp;
3138  sdla_fe_debug_t *fe_debug;
3139  memset(&wan_udp, 0x00, sizeof(wan_udp));
3140 
3141  {
3142  int err;
3143  wanpipe_api_t tdm_api;
3144  memset(&tdm_api,0,sizeof(tdm_api));
3145  err=sangoma_get_full_cfg(fd, &tdm_api);
3146  if (err) {
3147  return err;
3148  }
3149  chan=tdm_api.wp_cmd.chan;
3150  if (chan)
3151  chan--;
3152  }
3153 
3154  wan_udp.wan_udphdr_command = WAN_FE_SET_DEBUG_MODE;
3155  wan_udp.wan_udphdr_data_len = sizeof(sdla_fe_debug_t);
3156  wan_udp.wan_udphdr_return_code = 0xaa;
3157  fe_debug = (sdla_fe_debug_t*)wan_udp.wan_udphdr_data;
3158 
3159  fe_debug->type = WAN_FE_DEBUG_REG;
3160  fe_debug->mod_no = chan;
3161  fe_debug->fe_debug_reg.reg = offset;
3162  fe_debug->fe_debug_reg.read = 1;
3163 
3164  if (sangoma_mgmt_cmd(fd, &wan_udp)) {
3165  return SANG_STATUS_IO_ERROR;
3166  }
3167 
3168  if (wan_udp.wan_udphdr_return_code) {
3170  }
3171 
3172  *data = fe_debug->fe_debug_reg.value;
3173 
3174  return 0;
3175 }
int _LIBSNG_CALL sangoma_get_full_cfg(sng_fd_t fd, wanpipe_api_t *tdm_api)
Read tdm api device configuration.
Definition: libsangoma.c:2026
int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t *wan_udp)
Execute Sangoma Management Command.
wanpipe_api_cmd_t wp_cmd
Wanpipe UDP Structure used for Maintenance and Debugging.
Definition: wanpipe_api.h:92
unsigned char chan
Wanpipe API Command Structure.

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_get_stats ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
wanpipe_chan_stats_t stats 
)

Get Device Statistics. Statistics will be available in tdm_api->wp_cmd.stats structure.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
statsstats structure will be filled with device stats. (Optional, can be left NULL)
Returns
non-zero = error, 0 = ok

Definition at line 3281 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::stats, WP_API_CMD_GET_STATS, and wanpipe_api::wp_cmd.

3282 {
3283  int err;
3284 
3285  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3287  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_STATS;
3288 
3289  err = sangoma_cmd_exec(fd, tdm_api);
3290  if (err == 0) {
3291  if (stats) {
3292  memcpy(stats, &tdm_api->wp_cmd.stats, sizeof(wanpipe_chan_stats_t));
3293  }
3294  }
3295 
3296  return err;
3297 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
TDM API channel statistics.
wanpipe_chan_stats_t stats

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_flush_stats ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush/Reset device statistics.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero = error, 0 = ok

Definition at line 3299 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_RESET_STATS, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

3300 {
3301  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3303  tdm_api->wp_cmd.cmd = WP_API_CMD_RESET_STATS;
3304  return sangoma_cmd_exec(fd, tdm_api);
3305 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_set_rm_rxflashtime ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  rxflashtime 
)

Set rxflashtime for FXS module Wink-Flash Event.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
rxflashtimetime value
Returns
non-zero = error, 0 = ok

Definition at line 3307 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::rxflashtime, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_RM_RXFLASHTIME, and wanpipe_api::wp_cmd.

3308 {
3309  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3312  tdm_api->wp_cmd.rxflashtime=rxflashtime;
3313  return sangoma_cmd_exec(fd, tdm_api);
3314 }
unsigned int rxflashtime
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_set_rm_tx_gain ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  value 
)

set tx gain for FXO/FXS module

Parameters
fddevice file descriptor
tdm_apitdm api command structure
valuetxgain (FXO - txgain value ranges from -150 to 120 , FXS - txgain value 35,-35)
Returns
non-zero = error, 0 = ok

Definition at line 3317 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, WP_API_EVENT_SET_RM_TX_GAIN, and wanpipe_api::wp_cmd.

3318 {
3319  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3321  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
3322  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_SET_RM_TX_GAIN;
3323  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
3324  tdm_api->wp_cmd.event.wp_api_event_gain_value = value;
3325  return sangoma_cmd_exec(fd, tdm_api);
3326 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_set_rm_rx_gain ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  value 
)

set rx gain for FXO/FXS module

Parameters
fddevice file descriptor
tdm_apitdm api command structure
valuerxgain (FXO - rxgain value ranges from -150 to 120 , FXS -rxgain value 35,-35)
Returns
non-zero = error, 0 = ok

Definition at line 3328 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_ENABLE, WP_API_EVENT_SET_RM_RX_GAIN, and wanpipe_api::wp_cmd.

3329 {
3330  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3332  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT;
3333  tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_SET_RM_RX_GAIN;
3334  tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE;
3335  tdm_api->wp_cmd.event.wp_api_event_gain_value = value;
3336  return sangoma_cmd_exec(fd, tdm_api);
3337 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wp_api_event_t event
#define WP_API_EVENT_ENABLE
Option to enable command.

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_enable_loop ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable channel loop: All rx data will be transmitted back out.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero = error, 0 = ok

Definition at line 3367 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_ENABLE_LOOP, and wanpipe_api::wp_cmd.

3368 {
3369  int err;
3370 
3371  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3373  tdm_api->wp_cmd.cmd = WP_API_CMD_ENABLE_LOOP;
3374  err = sangoma_cmd_exec(fd, tdm_api);
3375  return err;
3376 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_disable_loop ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable channel loop.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero = error, 0 = ok

Definition at line 3378 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_DISABLE_LOOP, and wanpipe_api::wp_cmd.

3379 {
3380  int err;
3381 
3382  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3384  tdm_api->wp_cmd.cmd = WP_API_CMD_DISABLE_LOOP;
3385  err = sangoma_cmd_exec(fd, tdm_api);
3386  return err;
3387 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_read_event ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Read API Events.

Device EVENT Function

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero: error, 0: ok

The TDM API structure will be populated with a TDM API or WAN Event. This function usually used after wait() function indicated that event has occured.

Definition at line 2426 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_EVENT_DTMF, WP_API_EVENT_RBS, wanpipe_api::wp_callback, and wanpipe_api::wp_cmd.

Referenced by handle_tdm_event().

2427 {
2428 
2429 #ifdef WP_API_FEATURE_EVENTS
2430  wp_api_event_t *rx_event;
2431  int err;
2432 
2433  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2435  tdm_api->wp_cmd.cmd = WP_API_CMD_READ_EVENT;
2436 
2437  err=sangoma_cmd_exec(fd,tdm_api);
2438  if (err){
2439  return err;
2440  }
2441 
2442  rx_event = &tdm_api->wp_cmd.event;
2443 
2444 #ifdef WP_API_DEPRECATED_FEATURE_READ_CALLBACK_FUNCTIONS
2445  /*
2446  The use of callbacks here is purely optional and is left
2447  here for backward compatibility purposes. By default user
2448  should handle events outside this funciton. This function
2449  should only be used to read the event
2450  */
2451 
2452  switch (rx_event->wp_api_event_type){
2453 
2454  case WP_API_EVENT_RBS:
2455  if (tdm_api->wp_callback.wp_rbs_event) {
2456  tdm_api->wp_callback.wp_rbs_event(fd,rx_event->wp_api_event_rbs_bits);
2457  }
2458  break;
2459 
2460 #ifdef WP_API_FEATURE_DTMF_EVENTS
2461  case WP_API_EVENT_DTMF:
2462  if (tdm_api->wp_callback.wp_dtmf_event) {
2463  tdm_api->wp_callback.wp_dtmf_event(fd,
2464  rx_event->wp_api_event_dtmf_digit,
2465  rx_event->wp_api_event_dtmf_type,
2466  rx_event->wp_api_event_dtmf_port);
2467  }
2468  break;
2469 #endif
2470 
2471  case WP_API_EVENT_RXHOOK:
2472  if (tdm_api->wp_callback.wp_rxhook_event) {
2473  tdm_api->wp_callback.wp_rxhook_event(fd,
2474  rx_event->wp_api_event_hook_state);
2475  }
2476  break;
2477 
2478  case WP_API_EVENT_RING_DETECT:
2479  if (tdm_api->wp_callback.wp_ring_detect_event) {
2480  tdm_api->wp_callback.wp_ring_detect_event(fd,
2481  rx_event->wp_api_event_ring_state);
2482  }
2483  break;
2484 
2485  case WP_API_EVENT_RING_TRIP_DETECT:
2486  if (tdm_api->wp_callback.wp_ring_trip_detect_event) {
2487  tdm_api->wp_callback.wp_ring_trip_detect_event(fd,
2488  rx_event->wp_api_event_ring_state);
2489  }
2490  break;
2491 
2492 #ifdef WP_API_FEATURE_FE_ALARM
2493  case WP_API_EVENT_ALARM:
2494  if (tdm_api->wp_callback.wp_fe_alarm_event) {
2495  tdm_api->wp_callback.wp_fe_alarm_event(fd,
2496  rx_event->wp_api_event_alarm);
2497  }
2498  break;
2499 #endif
2500 
2501 #ifdef WP_API_FEATURE_LINK_STATUS
2502  /* Link Status */
2503  case WP_API_EVENT_LINK_STATUS:
2504  if(tdm_api->wp_callback.wp_link_status_event){
2505  tdm_api->wp_callback.wp_link_status_event(fd,
2506  rx_event->wp_api_event_link_status);
2507  }
2508 
2509  break;
2510 #endif
2511 
2512 #ifdef WP_API_FEATURE_POL_REV
2513  case WP_API_EVENT_POLARITY_REVERSE:
2514  break;
2515 #endif
2516  default:
2517 #ifdef __WINDOWS__
2518  if(0)printf("Warning: libsangoma: %s fd=0x%p: Unknown TDM event!", __FUNCTION__,fd);
2519 #else
2520  if(0)printf("Warning: libsangoma: %s fd=%d: Unknown TDM event!", __FUNCTION__, fd);
2521 #endif
2522  break;
2523  }
2524 
2525 #endif
2526 
2527 
2528  return 0;
2529 #else
2530  printf("Error: Read Event not supported!\n");
2531  return -1;
2532 #endif
2533 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
wanpipe_api_callbacks_t wp_callback
Wanpipe API Event Structure.
wp_api_event_t event

Here is the call graph for this function:

Here is the caller graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_logger_read_event ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Read Wanpipe Logger Events.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

The Logger API structure will be populated with a Logger Event. This function usually used after wait() function indicated that an event has occured.

Definition at line 2556 of file libsangoma.c.

2557 {
2558  logger_cmd->cmd = WP_API_LOGGER_CMD_READ_EVENT;
2559  return sangoma_logger_cmd_exec(fd, logger_cmd);
2560 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_flush_buffers ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Flush Wanpipe Logger internal buffers.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2562 of file libsangoma.c.

2563 {
2564  logger_cmd->cmd = WP_API_LOGGER_CMD_FLUSH_BUFFERS;
2565  return sangoma_logger_cmd_exec(fd, logger_cmd);
2566 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_statistics ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Get Wanpipe Logger statistics.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2568 of file libsangoma.c.

2569 {
2570  logger_cmd->cmd = WP_API_LOGGER_CMD_GET_STATS;
2571  return sangoma_logger_cmd_exec(fd, logger_cmd);
2572 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_reset_statistics ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Reset Wanpipe Logger statistics.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2574 of file libsangoma.c.

2575 {
2576  logger_cmd->cmd = WP_API_LOGGER_CMD_RESET_STATS;
2577  return sangoma_logger_cmd_exec(fd, logger_cmd);
2578 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_open_handle_counter ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Get Counter of open Handles/File Descriptors of Wanpipe Logger.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2580 of file libsangoma.c.

2581 {
2582  logger_cmd->cmd = WP_API_LOGGER_CMD_OPEN_CNT;
2583  return sangoma_logger_cmd_exec(fd, logger_cmd);
2584 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_get_logger_level ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Get current level (types of events) of Wanpipe Logger.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2586 of file libsangoma.c.

2587 {
2588  logger_cmd->cmd = WP_API_LOGGER_CMD_GET_LOGGER_LEVEL;
2589  return sangoma_logger_cmd_exec(fd, logger_cmd);
2590 }
sangoma_status_t _LIBSNG_CALL sangoma_logger_set_logger_level ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Set current level (types of events) of Wanpipe Logger.

Parameters
fddevice file descriptor
logger_cmdLogger API command structure
Returns
SANG_STATUS_SUCCESS: ok, else: error

Definition at line 2592 of file libsangoma.c.

2593 {
2594  logger_cmd->cmd = WP_API_LOGGER_CMD_SET_LOGGER_LEVEL;
2595  return sangoma_logger_cmd_exec(fd, logger_cmd);
2596 }
int sangoma_clear_tx_gain ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Clear tx gain from device, set it to 0.0.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero = error, 0 = ok
int sangoma_clear_rx_gain ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Clear rx gain from device, set it to 0.0.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
non-zero = error, 0 = ok
int _LIBSNG_CALL sangoma_driver_port_start ( sng_fd_t  fd,
port_management_struct_t *  port_mgmnt,
unsigned short  port_no 
)

Start a Port, create Sangoma Communication interfaces.

Device PORT Control Functions

Parameters
[in]fdPort Device file descriptor
[out]port_mgmntpointer to a port_management_struct_t structure. On return, sangoma_driver_port_start() updates operation_status field of this structure.
[in]port_no1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2.
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_mgmt->operation_status.

Definition at line 151 of file libsangoma_config.c.

References SANG_STATUS_GENERAL_ERROR, and sangoma_port_mgmnt_ioctl().

152 {
153  int err;
154  port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR;
155  port_mgmnt->command_code = START_PORT_VOLATILE_CONFIG;
156  port_mgmnt->port_no = port_no;
157 
158  err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt);
159  if (err) {
160  /* ioctl failed */
161  return err;
162  }
163 
164  return port_mgmnt->operation_status;
165 }
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_driver_port_stop ( sng_fd_t  fd,
port_management_struct_t *  port_mgmnt,
unsigned short  port_no 
)

Start a Port, create Sangoma Communication interfaces.

Parameters
[in]fdPort Device file descriptor
[out]port_mgmntpointer to a port_management_struct_t structure. On return, sangoma_driver_port_stop() updates operation_status field of this structure.
[in]port_no1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2.
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_mgmt->operation_status.

Definition at line 167 of file libsangoma_config.c.

References SANG_STATUS_CAN_NOT_STOP_DEVICE_WHEN_ALREADY_STOPPED, SANG_STATUS_GENERAL_ERROR, SANG_STATUS_SUCCESS, and sangoma_port_mgmnt_ioctl().

168 {
169  int err;
170  port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR;
171  port_mgmnt->command_code = STOP_PORT;
172  port_mgmnt->port_no = port_no;
173 
174  err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt);
175  if (err) {
176  /* ioctl failed */
177  return err;
178  }
179 
180  switch(port_mgmnt->operation_status)
181  {
183  /* This is not an error, rather a state indication.
184  * Return SANG_STATUS_SUCCESS, but real return code will be available
185  * for the caller at port_mgmnt->operation_status. */
186  err = SANG_STATUS_SUCCESS;
187  break;
188  default:
189  err = port_mgmnt->operation_status;
190  break;
191  }
192 
193  return err;
194 }
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_driver_port_set_config ( sng_fd_t  fd,
port_cfg_t *  port_cfg,
unsigned short  port_no 
)

Set Port's "Volatile" configuration. The configuration will not persist between system restarts. Before calling this function please stop the port by calling sangoma_driver_port_stop(). After calling this function please start the port by calling sangoma_driver_port_start().

Parameters
[in]fdPort Device file descriptor
[in,out]port_cfgpointer to port_cfg_t structure that specifies complete Port configuration. On return, sangoma_driver_port_set_config() updates operation_status field of this structure.
[in]port_no1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2.
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_cfg->operation_status.

Definition at line 244 of file libsangoma_config.c.

References SANG_STATUS_GENERAL_ERROR.

245 {
246  port_cfg->operation_status = SANG_STATUS_GENERAL_ERROR;
247  port_cfg->command_code = SET_PORT_VOLATILE_CONFIG;
248  port_cfg->port_no = port_no;
249 
250  return sangoma_port_cfg_ioctl(fd, port_cfg);
251 }
int _LIBSNG_CALL sangoma_driver_port_get_config ( sng_fd_t  fd,
port_cfg_t *  port_cfg,
unsigned short  port_no 
)

Retrieve Port's "Volatile" configuration.

Parameters
[in]fdPort Device file descriptor
[out]port_cfgpointer to port_cfg_t structure. On return, sangoma_driver_port_get_config() will copy current Port configuration into this structure.
[in]port_noplease see comment of sangoma_driver_port_set_config()
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_cfg->operation_status.

Definition at line 253 of file libsangoma_config.c.

References SANG_STATUS_GENERAL_ERROR.

254 {
255  port_cfg->operation_status = SANG_STATUS_GENERAL_ERROR;
256  port_cfg->command_code = GET_PORT_VOLATILE_CONFIG;
257  port_cfg->port_no = port_no;
258  return sangoma_port_cfg_ioctl(fd, port_cfg);
259 }
int _LIBSNG_CALL sangoma_driver_get_hw_info ( sng_fd_t  fd,
port_management_struct_t *  port_mgmnt,
unsigned short  port_no 
)

Retrieve information about a single instance of Sangoma hardware.

Parameters
[in]fdPort Device file descriptor
[out]port_mgmntpointer to port_management_struct_t structure which will contain hardware_info_t at it's "data" field, when this function returns.
[in]port_noplease see comment of sangoma_driver_port_set_config()
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_mgmt->operation_status.

Definition at line 196 of file libsangoma_config.c.

References SANG_STATUS_GENERAL_ERROR, and sangoma_port_mgmnt_ioctl().

197 {
198  int err;
199  port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR;
200  port_mgmnt->command_code = GET_HARDWARE_INFO;
201  port_mgmnt->port_no = port_no;
202 
203  err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt);
204  if (err) {
205  return err;
206  }
207 
208  return port_mgmnt->operation_status;
209 }
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_driver_get_version ( sng_fd_t  fd,
port_management_struct_t *  port_mgmnt,
unsigned short  port_no 
)

Retrieve Driver Version BEFORE any communication interface is configured and sangoma_get_driver_version() can not be called.

Parameters
[in]fdPort Device file descriptor
[out]port_mgmntpointer to port_management_struct_t structure which will contain wan_driver_version_t at it's "data" field, when this function returns.
[in]port_noplease see comment of sangoma_driver_port_set_config()
Returns
non-zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero: no system error. Check port_mgmt->operation_status.

Definition at line 211 of file libsangoma_config.c.

References sangoma_port_mgmnt_ioctl().

212 {
213  int err;
214  port_mgmnt->command_code = GET_DRIVER_VERSION;
215  port_mgmnt->port_no = port_no;
216 
217  err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt);
218  if (err) {
219  return err;
220  }
221 
222  return port_mgmnt->operation_status;
223 }
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_driver_hw_rescan ( sng_fd_t  fd,
port_management_struct_t *  port_mgmnt,
int *  cnt 
)

Rescan the pci and usb bus for newly added hardware.

Parameters
[in]fdPort Device file descriptor
[out]port_mgmntpointer to port_management_struct_t structure which will contain wan_driver_version_t at it's "data" field, when this function returns.
[out]detected_port_cntnewly detected ports.
Returns
less than zero: system error. Call OS specific code to find cause of the error. Linux example: strerror(errno) Windows example: combination of GetLastError()/FormatMessage() zero or greater: number of new ports found.

Definition at line 226 of file libsangoma_config.c.

References sangoma_port_mgmnt_ioctl().

227 {
228  int err;
229  port_mgmnt->command_code = WANPIPE_HARDWARE_RESCAN;
230  port_mgmnt->port_no = 1;
231 
232  err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt);
233  if (err < 0) {
234  return err;
235  }
236 
237  *cnt=port_mgmnt->port_no;
238 
239  return port_mgmnt->operation_status;
240 }
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_mgmt_cmd ( sng_fd_t  fd,
wan_udp_hdr_t wan_udp 
)

Execute Sangoma Management Command.

Device MANAGEMENT Functions

Parameters
fddevice file descriptor
wan_udpmanagement command structure
Returns
non-zero: error, 0: ok

Definition at line 122 of file libsangoma_config.c.

References WANPIPE_IOCTL_PIPEMON.

Referenced by sangoma_fe_reg_read(), sangoma_fe_reg_write(), sangoma_get_aft_customer_id(), and sangoma_port_led_ctrl().

123 {
124  int err=0;
125 #if defined(__WINDOWS__)
126  if(UdpManagementCommand(fd, wan_udp)){
127  err = 1;
128  }
129 #else
130  unsigned char id = 0;
131 
132  wan_udp->wan_udphdr_request_reply = 0x01;
133  wan_udp->wan_udphdr_id = id;
134  wan_udp->wan_udphdr_return_code = WAN_UDP_TIMEOUT_CMD;
135 
136  err=ioctl(fd,WANPIPE_IOCTL_PIPEMON,wan_udp);
137  if (err < 0) {
138  err = 1;
139  }
140 #endif
141  if(err){
142  /* The ioctl failed. */
143  return err;
144  }
145 
146  /* The ioctl was successfull. The caller must check
147  * value of wan_udp->wan_udphdr_return_code. */
148  return 0;
149 }

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_get_fe_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
unsigned char *  current_status 
)

Get Device Link Status (Connected/Disconnected)

Parameters
fddevice file descriptor
tdm_apitdm api command structure
current_statuspointer where result will be filled: 0=Link UP 1=Link Down
Returns
non-zero: error, 0: ok -> check current_status

Deprecated - replaced by sangoma_tdm_get_link_status function

Definition at line 2860 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, and wanpipe_api::wp_cmd.

2861 {
2862  int err;
2863 
2864  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2866  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_STATUS;
2867  err = sangoma_cmd_exec(fd, tdm_api);
2868  *current_status = tdm_api->wp_cmd.fe_status;
2869 
2870  return err;
2871 }
unsigned char fe_status
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_set_codec ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  codec 
)

Set TDM Codec per chan.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
codeccodec to set (ulaw/alaw/slinear)
Returns
non-zero: error, 0: ok

Deprecated Function - Here for backward compatibility Only valid in CHAN Operation Mode

Definition at line 2082 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::tdm_codec, WP_API_CMD_SET_CODEC, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

2083 {
2084  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2086  tdm_api->wp_cmd.cmd = WP_API_CMD_SET_CODEC;
2087  tdm_api->wp_cmd.tdm_codec = codec;
2088  return sangoma_cmd_exec(fd,tdm_api);
2089 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int tdm_codec

Here is the call graph for this function:

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_codec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Configured TDM Codec per chan.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
negative: error or configured codec value

Deprecated Function - Here for backward compatibility Only valid in CHAN Operation Mode

Definition at line 2103 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::tdm_codec, WP_API_CMD_GET_CODEC, and wanpipe_api::wp_cmd.

2104 {
2105  int err;
2106 
2107  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2109  tdm_api->wp_cmd.cmd = WP_API_CMD_GET_CODEC;
2110 
2111  err=sangoma_cmd_exec(fd,tdm_api);
2112  if (err){
2113  return err;
2114  }
2115 
2116  return tdm_api->wp_cmd.tdm_codec;
2117 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int tdm_codec

Here is the call graph for this function:

sng_fd_t _LIBSNG_CALL sangoma_create_socket_by_name ( char *  device,
char *  card 
)

Open a device based on a interface and card name.

Parameters
deviceinterface name
cardcard name
Returns
File Descriptor: -1 error, 0 or positive integer: valid file descriptor

Deprecated - here for backward compatibility

Definition at line 1778 of file libsangoma.c.

References sangoma_interface_toi(), and sangoma_open_api_span_chan().

1779 {
1780  int span,chan;
1781  sangoma_interface_toi(device,&span,&chan);
1782 
1783  return sangoma_open_api_span_chan(span,chan);
1784 }
int _LIBSNG_CALL sangoma_interface_toi(char *interface_name, int *span, int *chan)
Convert Span &amp; Chan to interface name.
Definition: libsangoma.c:1577
sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan(int span, int chan)
Open a Device based on Span/Chan values.
Definition: libsangoma.c:1682

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_interface_toi ( char *  interface_name,
int *  span,
int *  chan 
)

Convert Span & Chan to interface name.

Parameters
interface_namepointer to string where interface name will be written
spanspan number starting from 1 to 255
chanchan number starting from 1 to 32
Returns
non-zero = error, 0 = ok Deprecated - here for backward compatibility

Definition at line 1577 of file libsangoma.c.

References FNAME_LEN.

Referenced by sangoma_create_socket_by_name().

1578 {
1579  char *p=NULL, *sp = NULL, *ch = NULL;
1580  int ret = 0;
1581  char data[FNAME_LEN];
1582 
1583  strncpy(data, interface_name, FNAME_LEN);
1584  if ((data[0])) {
1585  for (p = data; *p; p++) {
1586  if (sp && *p == 'g') {
1587  *p = '\0';
1588  ch = (p + 1);
1589  break;
1590  } else if (*p == 'w') {
1591  sp = (p + 1);
1592  }
1593  }
1594 
1595  if(ch && sp) {
1596  *span = atoi(sp);
1597  *chan = atoi(ch);
1598  ret = 1;
1599  } else {
1600  *span = -1;
1601  *chan = -1;
1602  }
1603  }
1604 
1605  return ret;
1606 }
#define FNAME_LEN
string length of a file name
Definition: libsangoma.h:348

Here is the caller graph for this function:

int _LIBSNG_CALL sangoma_tdm_set_power_level ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
int  power 
)

Set Power Level - so only data matching the power level would be passed up.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
powervalue of power
Returns
non-zero: error, 0: ok

Deprecated - not used/implemented

Definition at line 2298 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::power_level, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_POWER_LEVEL, and wanpipe_api::wp_cmd.

2299 {
2300  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2303  tdm_api->wp_cmd.power_level = power;
2304  return sangoma_cmd_exec(fd,tdm_api);
2305 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int power_level

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_tdm_get_power_level ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Configured Power Level.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
negative: error or configured power level

Deprecated - not used/implemented

Definition at line 2313 of file libsangoma.c.

References wanpipe_api_cmd::cmd, wanpipe_api_cmd::power_level, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_POWER_LEVEL, and wanpipe_api::wp_cmd.

2314 {
2315  int err;
2316 
2317  WANPIPE_API_INIT_CHAN(tdm_api, 0);
2320 
2321  err=sangoma_cmd_exec(fd,tdm_api);
2322  if (err){
2323  return err;
2324  }
2325 
2326  return tdm_api->wp_cmd.power_level;
2327 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd
unsigned int power_level

Here is the call graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_init ( char *  device_name,
wan_custom_param_t  custom_params[],
unsigned int  number_of_custom_params 
)

Load Firmware image onto EC chip and allocated per-port resources in HWEC API. All chip-wide configuration paramters, if any, must be specified at the time of chip initialization. Note that Analog card is considered a "single-port" card by HWEC API. That means for Analog cards and for single-port digital cards only a single sangoma_hwec_config_init() call is required, all subsequent calls will have no effect. For multi-port cards, such as A102/A104/A108/A500, the sangoma_hwec_config_init() must be called for each port, at least one time. Only the first call will actually load the Firmware image onto EC chip, all subsequent calls (for other ports) will only add the Port to list of ports which use the HWEC API. Actions of sangoma_hwec_config_init() can be reversed by calling sangoma_hwec_config_release(). When Port is stopped, the HWEC API automatically releases per-port resources and removes the Port from list ports which use HWEC API.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Note that wanpipe1_if1 and wanpipe1_if2 will access the same Port - wanpipe1. Linux: wanpipe1, wanpipe2...
custom_params[]- (optional) array of custom paramter structures.
This is list of Echo Cancellation chip parameters:

Chip parameter                  Chip parameter value
=================               =======================
WANEC_TailDisplacement          0-896
WANEC_MaxPlayoutBuffers         0-4678
WANEC_EnableExtToneDetection    TRUE | FALSE
WANEC_EnableAcousticEcho        TRUE | FALSE
number_of_custom_params- (optional) number of structures in custom_params[]. Minimum value is 1, maximum is 4, if any other value the custom_params[] will be ignored.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 215 of file libsangoma_hwec.c.

References SANG_STATUS_FAILED_ALLOCATE_MEMORY, and SANG_STATUS_SUCCESS.

216 {
218  wanec_api_config_t config;
219 
220  memset(&config, 0x00, sizeof(config));
221 
222  if (number_of_custom_params >= 1 && number_of_custom_params <= 4) {
223 
224  wan_custom_param_t *custom_parms_ptr;
225  unsigned int i, custom_params_memory_size;
226 
227  custom_params_memory_size = sizeof(wan_custom_param_t) * number_of_custom_params;
228 
229  /* Do NOT change memory at custom_params[] (it belongs to the caller).
230  * Instead allocate temporary buffer, and use information in custom_params[]
231  * for proper initialization the temproary buffer and
232  * and send if down to API driver. */
233  custom_parms_ptr = malloc(custom_params_memory_size);
234  if (!custom_parms_ptr) {
236  }
237 
238  memset(custom_parms_ptr, 0x00, custom_params_memory_size);
239 
240  for (i = 0; i < number_of_custom_params; i++) {
241 
242  strcpy( custom_parms_ptr[i].name, custom_params[i].name );
243 
244  if (sangoma_hwec_is_numeric_parameter(custom_params[i].name)) {
245  custom_parms_ptr[i].dValue = atoi(custom_params[i].sValue);
246  } else {
247  strcpy(custom_parms_ptr[i].sValue, custom_params[i].sValue);
248  }
249  } /* for() */
250 
251  config.conf.param_no = number_of_custom_params;
252  config.conf.params = custom_parms_ptr;
253 
254  }/* if() */
255 
256  /* Load firmware on EC chip AND apply configuration, if any. */
257  rc = wanec_api_config( device_name, libsng_hwec_verbosity_level, &config );
258 
259  if (config.conf.params) {
260  free(config.conf.params);
261  }
262 
263  return rc;
264 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_release ( char *  device_name)

Release resources allocated by sangoma_hwec_config_init(). For single-port cards, such as A101 and A200 (A200 is an Analog card and considered sinle-port by HWEC API), a single call to sangoma_hwec_config_release() will free the per-chip resources. For multi-port cards, such as A102/A104/A108/A500, sangoma_hwec_config_release() can be called for each port to remove it from list Ports which are using HWEC API. When sangoma_hwec_config_release() is called for the last Port which was "configured/initialized by HWEC API", the per-chip resources will be freed.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Note that wanpipe1_if1 and wanpipe1_if2 will access the same Port - wanpipe1. Linux: wanpipe1, wanpipe2...
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 283 of file libsangoma_hwec.c.

284 {
285  sangoma_status_t rc;
286  wanec_api_release_t release;
287 
288  memset(&release, 0, sizeof(wanec_api_release_t));
289 
290  rc = wanec_api_release( device_name, libsng_hwec_verbosity_level, &release );
291 
292  return rc;
293 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_operation_mode ( char *  device_name,
int  mode,
unsigned int  fe_chan_map 
)

Modify channel operation mode.

Modify channel operation mode.

Parameters
modeOne of WANEC_API_OPMODE_? values defined in wanpipe_api_iface.h: WANEC_API_OPMODE_NORMAL, WANEC_API_OPMODE_HT_FREEZE, WANEC_API_OPMODE_HT_RESET, WANEC_API_OPMODE_POWER_DOWN, WANEC_API_OPMODE_NO_ECHO, WANEC_API_OPMODE_SPEECH_RECOGNITION.
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 298 of file libsangoma_hwec.c.

Referenced by sangoma_hwec_config_power_off(), and sangoma_hwec_config_power_on().

299 {
300  sangoma_status_t rc;
301  wanec_api_opmode_t opmode;
302 
303  memset(&opmode, 0, sizeof(wanec_api_opmode_t));
304 
305  opmode.mode = mode;
306  opmode.fe_chan_map = fe_chan_map;
307 
308  /* modes are:
309  WANEC_API_OPMODE_NORMAL,
310  WANEC_API_OPMODE_HT_FREEZE,
311  WANEC_API_OPMODE_HT_RESET,
312  WANEC_API_OPMODE_POWER_DOWN,
313  WANEC_API_OPMODE_NO_ECHO,
314  WANEC_API_OPMODE_SPEECH_RECOGNITION.
315  */
316  rc = wanec_api_opmode(device_name, libsng_hwec_verbosity_level, &opmode);
317 
318  return rc;
319 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338

Here is the caller graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_on ( char *  device_name,
unsigned int  fe_chan_map 
)

Set the channel state in the echo canceller to NORMAL/POWER ON. This enables echo cancelation logic inside the chip. The action is internal to EC chip itself, not related to AFT FPGA. This call is slow and should be used only on startup.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 338 of file libsangoma_hwec.c.

References sangoma_hwec_config_operation_mode().

339 {
340  return sangoma_hwec_config_operation_mode(device_name, WANEC_API_OPMODE_NORMAL, fe_chan_map);
341 }
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_operation_mode(char *device_name, int mode, unsigned int fe_chan_map)
Modify channel operation mode.

Here is the call graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_off ( char *  device_name,
unsigned int  fe_chan_map 
)

Set the channel state in the echo canceller to POWER OFF. This disables echo cancellatio logic inside the chip and data passes unmodified through the ec chip. The action is internal to EC chip itself, not related to AFT FPGA. This call is slow and should be used only on startup.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 361 of file libsangoma_hwec.c.

References sangoma_hwec_config_operation_mode().

362 {
363  return sangoma_hwec_config_operation_mode(device_name, WANEC_API_OPMODE_POWER_DOWN, fe_chan_map);
364 }
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_operation_mode(char *device_name, int mode, unsigned int fe_chan_map)
Modify channel operation mode.

Here is the call graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_enable ( char *  device_name,
unsigned int  fe_chan_map 
)

Redirect audio stream from AFT FPGA to EC chip. This command effectively enables echo cancellation since data is now forced through the EC chip by the FPGA. Data will be modified by the echo canceller. This command is recommened for fast enabling of Echo Cancellation. Note 1: Chip must be configured and in POWER ON state for echo Chancellation to take place. Note 2: sangoma_tdm_enable_hwec() function can be used to achive the same funcitnality based on file descriptor versus channel map.

Redirect audio stream from AFT FPGA to EC chip. This command effectively enables echo cancellation since data is now forced through the EC chip by the FPGA. Data will be modified by the echo canceller. This command is recommened for fast enabling of Echo Cancellation. Note 1: Chip must be configured and in POWER ON state for echo Chancellation to take place. Note 2: sangoma_tdm_enable_hwec() function can be use to achive the same funcitnality based on file descriptor versus channel map.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 389 of file libsangoma_hwec.c.

390 {
391  return sangoma_hwec_bypass(device_name, 1 /* enable */, fe_chan_map);
392 }
sangoma_status_t _LIBSNG_CALL sangoma_hwec_disable ( char *  device_name,
unsigned int  fe_chan_map 
)

Force AFT FPGA to bypass the echo canceller. This command effectively disables echo cancellation since data will not flowing through the ec chip. Data will not be modified by the echo canceller. This command is recommened for fast disabling of Echo Cancelation. Note: sangoma_tdm_disable_hwec() function can be use to achive the same functionality based on file descriptor versus channel map.

Force AFT FPGA to bypass the echo canceller. This command effectively disables echo cancellation since data will not be flowing through the ec chip. Data will not be modified by the echo canceller. This command is recommened for fast disabling of Echo Cancelation. Note: sangoma_tdm_disable_hwec() function can be used to achive the same functionality based on file descriptor versus channel map.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 416 of file libsangoma_hwec.c.

417 {
418  return sangoma_hwec_bypass(device_name, 0 /* disable */, fe_chan_map);;
419 }
sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_channel_parameter ( char *  device_name,
char *  parameter,
char *  parameter_value,
unsigned int  channel_map 
)

Modify channel configuration parameters.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
parameterEcho Cancellation channel parameter

This channel parameters are listed under "Channel parameter":

Channel parameter Channel parameter value ================= ======================= WANEC_EnableNlp TRUE | FALSE WANEC_EnableTailDisplacement TRUE | FALSE WANEC_TailDisplacement 0-896 WANEC_SoutLevelControl TRUE | FALSE WANEC_RinAutomaticLevelControl TRUE | FALSE WANEC_SoutAutomaticLevelControl TRUE | FALSE WANEC_SoutAdaptiveNoiseReduction TRUE | FALSE WANEC_RoutNoiseReduction TRUE | FALSE WANEC_ComfortNoiseMode COMFORT_NOISE_NORMAL COMFORT_NOISE_FAST_LATCH COMFORT_NOISE_EXTENDED COMFORT_NOISE_OFF WANEC_DtmfToneRemoval TRUE | FALSE WANEC_AcousticEcho TRUE | FALSE WANEC_NonLinearityBehaviorA 0-13 WANEC_NonLinearityBehaviorB 0-8 WANEC_DoubleTalkBehavior DT_BEH_NORMAL DT_BEH_LESS_AGGRESSIVE WANEC_AecTailLength 128 (default), 256, 512 or 1024 WANEC_EnableToneDisabler TRUE | FALSE

Parameters
parameter_valuechannel parameter value, listed under "Channel parameter value"
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status
Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
parameterEcho Cancellation channel parameter

This is list of Echo Cancellation channel parameters:

Channel parameter Channel parameter value ================= ======================= WANEC_EnableNlp TRUE | FALSE WANEC_EnableTailDisplacement TRUE | FALSE WANEC_TailDisplacement 0-896 WANEC_SoutLevelControl TRUE | FALSE WANEC_RinAutomaticLevelControl TRUE | FALSE WANEC_SoutAutomaticLevelControl TRUE | FALSE WANEC_SoutAdaptiveNoiseReduction TRUE | FALSE WANEC_RoutNoiseReduction TRUE | FALSE WANEC_ComfortNoiseMode COMFORT_NOISE_NORMAL COMFORT_NOISE_FAST_LATCH COMFORT_NOISE_EXTENDED COMFORT_NOISE_OFF WANEC_DtmfToneRemoval TRUE | FALSE WANEC_AcousticEcho TRUE | FALSE WANEC_NonLinearityBehaviorA 0-13 WANEC_NonLinearityBehaviorB 0-8 WANEC_DoubleTalkBehavior DT_BEH_NORMAL DT_BEH_LESS_AGGRESSIVE WANEC_AecTailLength 128 (default), 256, 512 or 1024 WANEC_EnableToneDisabler TRUE | FALSE

Parameters
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 464 of file libsangoma_hwec.c.

References sangoma_hwec_initialize_custom_parameter_structure().

465 {
466  sangoma_status_t rc;
467  wanec_api_modify_t channelModify;
468  wan_custom_param_t custom_param;
469 
470  memset(&channelModify, 0x00, sizeof(channelModify));
471 
472  sangoma_hwec_initialize_custom_parameter_structure(&custom_param, parameter, parameter_value);
473 
474  channelModify.fe_chan_map = channel_map;
475  channelModify.conf.param_no = 1;
476  channelModify.conf.params = &custom_param;
477 
478  rc = wanec_api_modify( device_name, libsng_hwec_verbosity_level, &channelModify );
479 
480  return rc;
481 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
void _LIBSNG_CALL sangoma_hwec_initialize_custom_parameter_structure(wan_custom_param_t *custom_param, char *parameter_name, char *parameter_value)
Initialize Custom Paramter structure.

Here is the call graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_tone_detection ( char *  device_name,
int  tone_id,
int  enable,
unsigned int  fe_chan_map,
unsigned char  port_map 
)

Enable/Disable tone detection (such as DTMF) of channels from channel map.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
tone_idSee wanpipe_api_iface.h for list of valid tones
enableA flag, if 1 - the specified tone will be detected, if 0 - specified tone will not be detected.
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
port_mapPort of tone detection - Rx, Tx. See wanpipe_events.h for list of valid ports (WAN_EC_CHANNEL_PORT_SOUT...).
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 505 of file libsangoma_hwec.c.

506 {
507  sangoma_status_t rc;
508  wanec_api_tone_t tone;
509 
510  memset(&tone, 0, sizeof(wanec_api_tone_t));
511 
512  tone.id = tone_id;
513  tone.enable = enable;
514  tone.fe_chan_map = fe_chan_map;
515  tone.port_map = port_map;
516  tone.type_map = WAN_EC_TONE_PRESENT | WAN_EC_TONE_STOP;
517 
518  rc = wanec_api_tone( device_name, libsng_hwec_verbosity_level, &tone );
519 
520  return rc;
521 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_print_statistics ( char *  device_name,
int  full,
unsigned int  fe_chan 
)

Read and print Chip/Channel statistics from EC chip.

Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fullFlag to read full statistics, if set to 1.
fe_chanChannel number (a timeslot for Digital, a line for Analog) where the call will read statistics. Values from 1 to 31 will indicate the channel nuber. A value of zero will indicate request to print global chip statistics, not per-channel statistics.
Returns
SANG_STATUS_SUCCESS: success, or error status
Parameters
device_nameSangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2...
fullFlag to read full statistics, if set to 1.
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will read statistics.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 541 of file libsangoma_hwec.c.

542 {
543  sangoma_status_t rc;
544  wanec_api_stats_t stats;
545 
546  memset(&stats, 0, sizeof(wanec_api_stats_t));
547 
548  stats.full = full;
549  stats.fe_chan = fe_chan;
550  stats.reset = 0; /* do not reset */
551 
552  rc = wanec_api_stats( device_name, libsng_hwec_verbosity_level, &stats );
553 
554  return rc;
555 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_load ( char *  device_name,
char *  filename,
char  pcmlaw,
int *  out_buffer_id 
)

Load audio buffer to EC chip. The buffer can be played out using the sangoma_hwec_audio_buffer_playout() function.

Parameters
filenamename of the audio file (without the extension). Actual file must have .pcm extension. Location: Windows: SystemRoot% (ex: c:) Linux: /etc/wanpipe/buffers
out_buffer_idwhen the buffer is loaded on the chip, it is assigned an ID. This ID should be used when requesting to play out the buffer.
Returns
SANG_STATUS_SUCCESS: success, or error status
Parameters
bufferPointer to in memory buffer to be loaded on the chip.
sizeSize of buffer.
out_buffer_idwhen the buffer is loaded on the chip, it is assigned an ID. This ID should be used when requesting to play out the buffer.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 574 of file libsangoma_hwec.c.

References SANG_STATUS_SUCCESS.

575 {
576  sangoma_status_t rc;
577  wanec_api_bufferload_t bufferload;
578 
579  memset(&bufferload, 0, sizeof(wanec_api_bufferload_t));
580  *out_buffer_id = -1;
581 
582  bufferload.buffer = filename;
583  bufferload.pcmlaw = pcmlaw;
584 
585  rc = wanec_api_buffer_load( device_name, libsng_hwec_verbosity_level, &bufferload );
586  if( rc ) {
587  return rc;
588  }
589 
590  *out_buffer_id = bufferload.buffer_id;
591 
592  return SANG_STATUS_SUCCESS;
593 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_playout ( char *  device_name,
unsigned int  fe_chan_map,
unsigned char  port,
int  in_buffer_id,
int  start,
int  repeat_cnt,
int  duration 
)

Start playing out an audio buffer previously loaded by sangoma_hwec_audio_buffer_load().

Parameters
fe_chan_mapBitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect.
port_mapPort where the buffer will be played out. This is the channel port on which the buffer will be played (WAN_EC_CHANNEL_PORT_SOUT or WAN_EC_CHANNEL_PORT_ROUT)
in_buffer_idID of the buffer which will be unloaded. The ID must be initialized by sangoma_hwec_audio_bufferload().
startIf 1 - start the play out, 0 - stop the play out
repeat_cntNumber of times to play out the same buffer
durationMaximum duration of the playout, in milliseconds. If it takes less then 'duration' to play out the whole buffer, it will be repeated to fill 'duration' amount of time. If 'duration' is set to non-zero, this parameter overrides the repeat_cnt flag.
Returns
SANG_STATUS_SUCCESS: success, or error status

Definition at line 677 of file libsangoma_hwec.c.

References start().

680 {
681  sangoma_status_t rc;
682  wanec_api_playout_t playout;
683 
684  memset(&playout, 0, sizeof(wanec_api_playout_t));
685 
686  playout.start = start;
687  playout.fe_chan = fe_chan_map;
688  playout.buffer_id = in_buffer_id;
689  playout.port = port;
690  playout.notifyonstop = 1;
691  playout.user_event_id = 0xA5; /* dummy value */
692  playout.repeat_cnt = repeat_cnt;
693  playout.duration = (duration) ? duration : cOCT6100_INVALID_VALUE; /* default is no duration */
694 
695  rc = wanec_api_playout( device_name, libsng_hwec_verbosity_level, &playout);
696 
697  return rc;
698 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
int start(sangoma_interface *sang_if)
Run the main sangoma interface hanlder code.
Definition: sample.cpp:153

Here is the call graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_verbosity ( int  verbosity_level)

Set Verbosity level of EC API Driver and Library. The level controls amount of data printed to stdout and to wanpipelog.txt (Windows) or /var/log/messages (Linux) for diagnostic purposes.

Set Verbosity level of EC API. The level controls amount of data printed to stdout and wanpipelog.txt for diagnostic purposes.

Parameters
verbosity_levelValid values are from 0 to 3.
Returns
SANG_STATUS_SUCCESS: success, or error status
Parameters
verbosity_levelValid values are from 0 to 3.
Returns
SANG_STATUS_SUCCESS: success - the level was changed to 'verbosity_level', SANG_STATUS_INVALID_PARAMETER: error - the level was not changed because new level is invalid

Definition at line 712 of file libsangoma_hwec.c.

References SANG_STATUS_INVALID_PARAMETER, and SANG_STATUS_SUCCESS.

713 {
714  if (verbosity_level >= 0 || verbosity_level <= 3) {
715  libsng_hwec_verbosity_level = verbosity_level;
716  wanec_api_set_lib_verbosity(verbosity_level);
717  return SANG_STATUS_SUCCESS;
718  }
720 }
void _LIBSNG_CALL sangoma_hwec_initialize_custom_parameter_structure ( wan_custom_param_t *  custom_param,
char *  parameter_name,
char *  parameter_value 
)

Initialize Custom Paramter structure.

Parameters
parameter_nameParameter Name
parameter_valueParameter Value
Returns
None

Definition at line 166 of file libsangoma_hwec.c.

Referenced by sangoma_hwec_config_channel_parameter().

167 {
168  memset(custom_param, 0x00, sizeof(*custom_param));
169 
170  strncpy( custom_param->name, parameter_name, sizeof(custom_param->name) );
171 
172  if (sangoma_hwec_is_numeric_parameter(parameter_name)) {
173  custom_param->dValue = atoi(parameter_value);
174  } else {
175  strncpy(custom_param->sValue, parameter_value, sizeof(custom_param->sValue));
176  }
177 }

Here is the caller graph for this function:

sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_global_chip_statistics ( sng_fd_t  fd,
int *  hwec_api_return_code,
wanec_chip_stats_t *  wanec_chip_stats,
int  verbose,
int  reset 
)

Get Global statistics from EC chip.

Parameters
fddevice file descriptor
hwec_api_return_codewill contain one of WAN_EC_API_RC_x codes which are defined in wanec_iface_api.h
wanec_chip_statsstructure will be filled with HWEC channel statistics.
verboseFlag indicating to the Driver to print additional information about the command into Wanpipe Log file.
resetFlag to reset (flush) global statistics to zero, if set to 1.
Returns
SANG_STATUS_SUCCESS: success, or error status of IOCTL

Definition at line 793 of file libsangoma_hwec.c.

References SANG_STATUS_SUCCESS.

795 {
796 
797  sangoma_status_t err;
798  wan_ec_api_t ec_api;
799 
800  memset(&ec_api, 0x00, sizeof(ec_api));
801 
802  ec_api.cmd = WAN_EC_API_CMD_STATS_FULL;
803 
804  ec_api.verbose = verbose;
805 
806  /* indicate to Driver to get chip stats, not channel stats, by setting fe_chan_map to zero */
807  ec_api.fe_chan_map = 0;
808 
809  /* user may want to reset (clear) Chip statistics */
810  ec_api.u_chip_stats.reset = reset;
811 
812  err = sangoma_hwec_ioctl(fd, &ec_api);
813  if (err) {
814  /* error in IOCTL */
815  return err;
816  }
817 
818  /* copy stats from driver buffer to user buffer */
819  memcpy(wanec_chip_stats, &ec_api.u_chip_stats, sizeof(*wanec_chip_stats));
820 
821  *hwec_api_return_code = ec_api.err;
822 
823  return SANG_STATUS_SUCCESS;
824 
825 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_chip_image_info ( sng_fd_t  fd,
int *  hwec_api_return_code,
wanec_chip_image_t *  wanec_chip_image,
int  verbose 
)

Get information about Firmware Image of EC chip.

Parameters
fddevice file descriptor
hwec_api_return_codewill contain one of WAN_EC_API_RC_x codes which are defined in wanec_iface_api.h
wanec_chip_image_tstructure will be filled with HWEC channel statistics.
verboseFlag indicating to the Driver to print additional information about the command into Wanpipe Log file.
Returns
SANG_STATUS_SUCCESS: success, or error status of IOCTL

Definition at line 843 of file libsangoma_hwec.c.

References SANG_STATUS_SUCCESS.

845 {
846  sangoma_status_t err;
847  wan_ec_api_t ec_api;
848 
849  memset(&ec_api, 0x00, sizeof(ec_api));
850 
851  ec_api.cmd = WAN_EC_API_CMD_STATS_IMAGE;
852 
853  ec_api.verbose = verbose;
854 
855  /* driver will copy image information into wanec_chip_image->f_ChipImageInfo */
856  ec_api.u_chip_image.f_ChipImageInfo = wanec_chip_image->f_ChipImageInfo;
857 
858  err = sangoma_hwec_ioctl(fd, &ec_api);
859  if (err) {
860  /* error in IOCTL */
861  return err;
862  }
863 
864  *hwec_api_return_code = ec_api.err;
865 
866  return SANG_STATUS_SUCCESS;
867 }
int32_t sangoma_status_t
return status from sangoma APIs
Definition: libsangoma.h:338
int _LIBSNG_CALL sangoma_ss7_force_rx ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Force the firmware to pass up a repeating frame.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
Returns
SANG_STATUS_SUCCESS: success, or error status of IOCTL

Definition at line 3400 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SS7_FORCE_RX, and wanpipe_api::wp_cmd.

3401 {
3402  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3404  tdm_api->wp_cmd.cmd = WP_API_CMD_SS7_FORCE_RX;
3405  return sangoma_cmd_exec(fd, tdm_api);
3406 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_ss7_get_cfg_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
wan_api_ss7_cfg_status_t ss7_cfg_status 
)

Get current ss7 hw configuration.

Parameters
fddevice file descriptor
tdm_apitdm api command structure
ss7_cfg_statusss7 configuration status structure
Returns
SANG_STATUS_SUCCESS: success, or error status of IOCTL

Definition at line 3410 of file libsangoma.c.

References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SS7_GET_CFG_STATUS, and wanpipe_api::wp_cmd.

Referenced by open_sangoma_device().

3411 {
3412  int err;
3413 
3414  WANPIPE_API_INIT_CHAN(tdm_api, 0);
3417 
3418  err = sangoma_cmd_exec(fd, tdm_api);
3419  if (err == 0) {
3420  if (ss7_cfg_status) {
3421  memcpy(ss7_cfg_status, &tdm_api->wp_cmd.ss7_cfg_status, sizeof(wan_api_ss7_cfg_status_t));
3422  }
3423  }
3424 
3425  return err;
3426 }
int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api)
Execute Sangoma API Command.
Definition: libsangoma.c:2004
#define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Initialize the &#39;result&#39; in wanpipe_api_t to SANG_STATUS_GENERAL_ERROR.
Definition: libsangoma.h:104
wanpipe_api_cmd_t wp_cmd

Here is the call graph for this function:

Here is the caller graph for this function: