#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"


Go to the source code of this file.
Defines | |
| #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 | 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. | |
| #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 |
| #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 |
| #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. | |
| #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 |
| typedef int | DWORD |
| typedef char | TCHAR |
| typedef void * | LPTHREAD_START_ROUTINE |
| typedef pthread_mutex_t | CRITICAL_SECTION |
| typedef struct tm | SYSTEMTIME |
| typedef char * | LPCTSTR |
| typedef int32_t | sangoma_status_t |
| return status from sangoma APIs | |
| 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. | |
| sng_fd_t _LIBSNG_CALL | __sangoma_open_api_span_chan (int span, int chan) |
| Open a Device based on Span/Chan values. | |
| 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. | |
| sng_fd_t _LIBSNG_CALL | sangoma_open_api_ctrl (void) |
| Open a Global Control Device. | |
| sng_fd_t _LIBSNG_CALL | sangoma_logger_open (void) |
| Open a Global Logger Device. | |
| sng_fd_t _LIBSNG_CALL | sangoma_open_driver_ctrl (int port_no) |
| Open a Global Driver Control Device. | |
| void _LIBSNG_CALL | sangoma_close (sng_fd_t *fd) |
| Close device file descriptor. | |
| int _LIBSNG_CALL | sangoma_get_open_cnt (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get device open count. | |
| int _LIBSNG_CALL | sangoma_writemsg (sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag) |
| Write Data to device. | |
| int _LIBSNG_CALL | sangoma_readmsg (sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag) |
| Read Data from device. | |
| 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. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_wait_obj_delete (sangoma_wait_obj_t **sangoma_wait_object) |
| De-allocate all resources in a wait object. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_wait_obj_signal (sangoma_wait_obj_t *sangoma_wait_object) |
| Set wait object to a signaled state. | |
| 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. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_cmd_exec (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Execute Sangoma API Command. | |
| int _LIBSNG_CALL | sangoma_get_full_cfg (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Read tdm api device configuration. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_tdm_get_usr_period (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get Tx/Rx Period in Milliseconds. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_flush_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Flush all (tx/rx/event) buffers from current channel. | |
| int _LIBSNG_CALL | sangoma_flush_rx_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Flush only rx buffers from current channel. | |
| int _LIBSNG_CALL | sangoma_flush_tx_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Flush only tx buffers from current channel. | |
| int _LIBSNG_CALL | sangoma_flush_event_bufs (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Flush only event buffers from current channel. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_tdm_disable_rbs_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable RBS Events for a device. | |
| 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. | |
| 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. | |
| 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). | |
| 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). | |
| 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). | |
| 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). | |
| 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). | |
| 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. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_tdm_enable_rxhook_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Enable RX HOOK Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_disable_rxhook_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable RX HOOK Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_enable_ring_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Enable RING Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_disable_ring_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable RING Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_enable_ring_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Enable RING DETECT Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_disable_ring_detect_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable RING DETECT Events (Analog Only). | |
| 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). | |
| 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). | |
| 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). | |
| int _LIBSNG_CALL | sangoma_tdm_disable_tone_events (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Enable TONE Events (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_txsig_onhook (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Tranmsmit TX SIG ON HOOK (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_txsig_offhook (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Tranmsmit TX SIG OFF HOOK (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_txsig_start (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Tranmsmit TX SIG START (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_txsig_kewl (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Tranmsmit TX SIG KEWL START (Analog Only). | |
| int _LIBSNG_CALL | sangoma_tdm_enable_hwec (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Enable HWEC on this channel. | |
| int _LIBSNG_CALL | sangoma_tdm_disable_hwec (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable HWEC on this channel. | |
| 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). | |
| 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). | |
| 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). | |
| 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. | |
| 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. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_get_tx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get Tx Queue Size for this channel. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_get_rx_queue_sz (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get Rx Queue Size for this channel. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_get_hw_coding (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get HW Voice Coding (ulaw/alaw). | |
| int _LIBSNG_CALL | sangoma_tdm_get_hw_dtmf (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Check if hwdtmf support is available. | |
| 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. | |
| 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. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_span_chan_toif (int span, int chan, char *interface_name) |
| Convert Span & Chan to interface name. | |
| int _LIBSNG_CALL | sangoma_span_chan_fromif (char *interface_name, int *span, int *chan) |
| Convert Interace Name to Span & Chan. | |
| 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). | |
| 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. | |
| int _LIBSNG_CALL | sangoma_get_firmware_version (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver) |
| Get Hardware/Firmware Version. | |
| int _LIBSNG_CALL | sangoma_get_cpld_version (sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver) |
| Get AFT CPLD Version. | |
| 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. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_fe_reg_write (sng_fd_t fd, uint32_t offset, uint8_t data) |
| Write to a front end register. | |
| int _LIBSNG_CALL | sangoma_fe_reg_read (sng_fd_t fd, uint32_t offset, uint8_t *data) |
| Read front end register. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_flush_stats (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Flush/Reset device statistics. | |
| 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. | |
| 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 | |
| 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 | |
| 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. | |
| int _LIBSNG_CALL | sangoma_tdm_disable_loop (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Disable channel loop. | |
| int _LIBSNG_CALL | sangoma_read_event (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Read API Events. | |
| 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. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_logger_flush_buffers (sng_fd_t fd, wp_logger_cmd_t *logger_cmd) |
| Flush Wanpipe Logger internal buffers. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_logger_get_statistics (sng_fd_t fd, wp_logger_cmd_t *logger_cmd) |
| Get Wanpipe Logger statistics. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_logger_reset_statistics (sng_fd_t fd, wp_logger_cmd_t *logger_cmd) |
| Reset Wanpipe Logger statistics. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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(). | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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). | |
| int _LIBSNG_CALL | sangoma_tdm_set_codec (sng_fd_t fd, wanpipe_api_t *tdm_api, int codec) |
| Set TDM Codec per chan. | |
| int _LIBSNG_CALL | sangoma_tdm_get_codec (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get Configured TDM Codec per chan. | |
| sng_fd_t _LIBSNG_CALL | sangoma_create_socket_by_name (char *device, char *card) |
| Open a device based on a interface and card name. | |
| int _LIBSNG_CALL | sangoma_interface_toi (char *interface_name, int *span, int *chan) |
| Convert Span & Chan to interface name. | |
| 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. | |
| int _LIBSNG_CALL | sangoma_tdm_get_power_level (sng_fd_t fd, wanpipe_api_t *tdm_api) |
| Get Configured Power Level. | |
| 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. | |
| 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. | |
| sangoma_status_t _LIBSNG_CALL | sangoma_hwec_config_operation_mode (char *device_name, int mode, unsigned int fe_chan_map) |
| Modify channel operation mode. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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(). | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
Provides User a Unified/OS Agnostic API to Wanpipe/Sangoma Drivers and Hardware Author(s): Nenad Corbic <ncorbic@sangoma.com> David Rokhvarg <davidr@sangoma.com> Michael Jerris <mike@jerris.com> Anthony Minessale II <anthmct@yahoo.com>
Copyright: (c) 2005-2008 Nenad Corbic <ncorbic@sangoma.com>
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sangoma Technologies nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
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.
| #define SANGOMA_INIT_TDM_API_CMD | ( | _name_ | ) |
Value:
memset(&_name_,0,sizeof(_name_)); \ SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
Definition at line 98 of file libsangoma.h.
| #define sangoma_ctime | ( | time | ) | ctime((time_t*)time) |
Convert a time value to a string.
| time_val | pointer to time value |
Definition at line 288 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!"
Definition at line 373 of file libsangoma.h.
| #define sangoma_open_tdmapi_span_chan sangoma_open_api_span_chan |
Backward compabile defines
Definition at line 2299 of file libsangoma.h.
| 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 335 of file libsangoma.h.
Definition at line 361 of file libsangoma.h.
00362 { 00364 UNKNOWN_WAIT_OBJ = 0, 00366 SANGOMA_GENERIC_WAIT_OBJ = 0, 00368 SANGOMA_DEVICE_WAIT_OBJ, 00370 SANGOMA_DEVICE_WAIT_OBJ_SIG, 00371 } sangoma_wait_obj_type_t;
| 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
| span | span number starting from 1 to 255 | |
| chan | chan number starting from 1 to 32 |
Definition at line 1670 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().
01671 { 01672 sng_fd_t fd = INVALID_HANDLE_VALUE; 01673 wanpipe_api_t tdm_api; 01674 int err; 01675 01676 fd = __sangoma_open_api_span_chan(span, chan); 01677 01678 #if defined(__WINDOWS__) 01679 if(fd == INVALID_HANDLE_VALUE){ 01680 return fd; 01681 } 01682 #else 01683 if (fd < 0) { 01684 return fd; 01685 } 01686 #endif 01687 01688 memset(&tdm_api,0,sizeof(tdm_api)); 01689 tdm_api.wp_cmd.cmd = WP_API_CMD_OPEN_CNT; 01690 err=sangoma_cmd_exec(fd,&tdm_api); 01691 if (err){ 01692 sangoma_close(&fd); 01693 return fd; 01694 } 01695 01696 if (tdm_api.wp_cmd.open_cnt > 1) { 01697 /* this is NOT the first open request for this span/chan */ 01698 sangoma_close(&fd); 01699 fd = INVALID_HANDLE_VALUE;/* fd is NOT valid anymore */ 01700 } 01701 01702 return fd; 01703 }


| sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan | ( | int | span, | |
| int | chan | |||
| ) |
Open a Device based on Span/Chan values.
| span | span number starting from 1 to 255 | |
| chan | chan number starting from 1 to 32 |
Definition at line 1728 of file libsangoma.c.
References _snprintf, FNAME_LEN, sangoma_open_dev_by_name(), and WP_INTERFACE_NAME_FORM.
Referenced by sangoma_open_api_span_chan().
01729 { 01730 char tmp_fname[FNAME_LEN]; 01731 01732 /* Form the Interface Name from span and chan number (i.e. wanpipe1_if1). */ 01733 _snprintf(tmp_fname, DEV_NAME_LEN, WP_INTERFACE_NAME_FORM, span, chan); 01734 01735 return sangoma_open_dev_by_name(tmp_fname); 01736 }


| 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.
| dev_name | API device name |
Definition at line 1705 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().
01706 { 01707 char fname[FNAME_LEN]; 01708 01709 #if defined(__WINDOWS__) 01710 _snprintf(fname , FNAME_LEN, "\\\\.\\%s", dev_name); 01711 01712 return CreateFile( fname, 01713 GENERIC_READ | GENERIC_WRITE, 01714 FILE_SHARE_READ | FILE_SHARE_WRITE, 01715 (LPSECURITY_ATTRIBUTES)NULL, 01716 OPEN_EXISTING, 01717 FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, 01718 (HANDLE)NULL 01719 ); 01720 #else 01721 sprintf(fname,"/dev/%s", dev_name); 01722 01723 return open(fname, O_RDWR); 01724 #endif 01725 }

| sng_fd_t _LIBSNG_CALL sangoma_open_api_ctrl | ( | void | ) |
Open a Global Control Device.
Definition at line 1738 of file libsangoma.c.
References sangoma_open_dev_by_name().
01739 { 01740 return sangoma_open_dev_by_name(WP_CTRL_DEV_NAME); 01741 }

| sng_fd_t _LIBSNG_CALL sangoma_logger_open | ( | void | ) |
Open a Global Logger Device.
Definition at line 1744 of file libsangoma.c.
References sangoma_open_dev_by_name().
01745 { 01746 return sangoma_open_dev_by_name(WP_LOGGER_DEV_NAME); 01747 }

| sng_fd_t _LIBSNG_CALL sangoma_open_driver_ctrl | ( | int | port_no | ) |
Open a Global Driver Control Device.
Definition at line 107 of file libsangoma_config.c.
References _snprintf, FNAME_LEN, sangoma_open_dev_by_name(), and WP_PORT_NAME_FORM.
00108 { 00109 char tmp_fname[FNAME_LEN]; 00110 00111 #if defined(__WINDOWS__) 00112 /* Form the Config Device Name (i.e. wanpipe1, wanpipe2,...). */ 00113 _snprintf(tmp_fname, DEV_NAME_LEN, WP_PORT_NAME_FORM, port_no); 00114 #else 00115 /* Form the Config Device Name. ("/dev/wanpipe") */ 00116 _snprintf(tmp_fname, DEV_NAME_LEN, WP_CONFIG_DEV_NAME); 00117 #endif 00118 return sangoma_open_dev_by_name(tmp_fname); 00119 }

| void _LIBSNG_CALL sangoma_close | ( | sng_fd_t * | fd | ) |
Close device file descriptor.
| fd | device file descriptor |
Definition at line 1806 of file libsangoma.c.
References INVALID_HANDLE_VALUE.
Referenced by cleanup(), sangoma_open_api_span_chan(), and sangoma_wait_obj_delete().
01807 { 01808 if (!fd) { 01809 return; 01810 } 01811 #if defined(__WINDOWS__) 01812 if (*fd != INVALID_HANDLE_VALUE){ 01813 CloseHandle(*fd); 01814 *fd = INVALID_HANDLE_VALUE; 01815 } 01816 #else 01817 if (*fd >= 0) { 01818 close(*fd); 01819 *fd = -1; 01820 } 01821 #endif 01822 }

| int _LIBSNG_CALL sangoma_get_open_cnt | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get device open count.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 1750 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.
01751 { 01752 int err; 01753 01754 WANPIPE_API_INIT_CHAN(tdm_api, 0); 01755 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 01756 tdm_api->wp_cmd.cmd = WP_API_CMD_OPEN_CNT; 01757 01758 err=sangoma_cmd_exec(fd,tdm_api); 01759 if (err){ 01760 return -1; 01761 } 01762 01763 return tdm_api->wp_cmd.open_cnt; 01764 }

| 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
| fd | device file descriptor | |
| hdrbuf | pointer to header structure wp_api_hdr_t | |
| hdrlen | size of wp_api_hdr_t | |
| databuf | pointer to data buffer to be transmitted | |
| datalen | length of data buffer | |
| flag | currently not used, set to 0 |
Definition at line 1902 of file libsangoma.c.
References wp_api_hdr::data_length, wan_iovec::iov_base, wan_iovec::iov_len, 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().
01903 { 01904 int bsent=-1; 01905 wp_api_hdr_t *wp_api_hdr = hdrbuf; 01906 01907 if (hdrlen != sizeof(wp_api_hdr_t)) { 01908 /* error. Possible cause is a mismatch between versions of API header files. */ 01909 DBG_ERR("hdrlen (%i) != sizeof(wp_api_hdr_t) (%i)\n", hdrlen, sizeof(wp_api_hdr_t)); 01910 return -1; 01911 } 01912 01913 #if defined(__WINDOWS__) 01914 01915 wp_api_hdr->data_length = datalen; 01916 01917 /*queue data for transmission*/ 01918 if(DoWriteCommand(fd, databuf, datalen, hdrbuf, hdrlen)){ 01919 /*error*/ 01920 DBG_ERR("DoWriteCommand() failed!! Check messages log.\n"); 01921 return -1; 01922 } 01923 01924 bsent=0; 01925 /*check that frame was transmitted*/ 01926 switch(wp_api_hdr->operation_status) 01927 { 01928 case SANG_STATUS_SUCCESS: 01929 bsent = datalen; 01930 break; 01931 default: 01932 DBG_ERR("Operation Status: %s(%d)\n", 01933 SDLA_DECODE_SANG_STATUS(wp_api_hdr->operation_status), wp_api_hdr->operation_status); 01934 break; 01935 }/*switch()*/ 01936 #else 01937 wan_msghdr_t msg; 01938 wan_iovec_t iov[2]; 01939 01940 memset(&msg,0,sizeof(msg)); 01941 memset(&iov[0],0,sizeof(iov[0])*2); 01942 01943 iov[0].iov_len=hdrlen; 01944 iov[0].iov_base=hdrbuf; 01945 01946 iov[1].iov_len=datalen; 01947 iov[1].iov_base=databuf; 01948 01949 msg.msg_iovlen=2; 01950 msg.msg_iov=iov; 01951 01952 bsent = write(fd,&msg,sizeof(msg)); 01953 01954 if (bsent == (datalen+hdrlen)){ 01955 wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_SUCCESS; 01956 bsent-=sizeof(wp_api_hdr_t); 01957 } else if (errno == EBUSY){ 01958 wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_DEVICE_BUSY; 01959 } else { 01960 wp_api_hdr->wp_api_hdr_operation_status=SANG_STATUS_IO_ERROR; 01961 } 01962 wp_api_hdr->wp_api_hdr_data_length=bsent; 01963 01964 #endif 01965 return bsent; 01966 }

| 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
| fd | device file descriptor | |
| hdrbuf | pointer to header structure wp_api_hdr_t | |
| hdrlen | size of wp_api_hdr_t | |
| databuf | pointer to data buffer to be received | |
| datalen | length of data buffer | |
| flag | currently not used, set to 0 |
Definition at line 1830 of file libsangoma.c.
References wp_api_element::data, wp_api_hdr::data_length, wp_api_element::hdr, wan_iovec::iov_base, wan_iovec::iov_len, wan_msghdr::msg_iov, wan_msghdr::msg_iovlen, wp_api_hdr::operation_status, SANG_STATUS_BUFFER_TOO_SMALL, SANG_STATUS_IO_ERROR, SANG_STATUS_NO_DATA_AVAILABLE, SANG_STATUS_RX_DATA_AVAILABLE, and SDLA_DECODE_SANG_STATUS.
01831 { 01832 int rx_len=0; 01833 01834 #if defined(__WINDOWS__) 01835 wp_api_hdr_t *rx_hdr = (wp_api_hdr_t*)hdrbuf; 01836 wp_api_element_t wp_api_element; 01837 01838 if(hdrlen != sizeof(wp_api_hdr_t)){ 01839 /*error*/ 01840 DBG_ERR("hdrlen (%i) != sizeof(wp_api_hdr_t) (%i)\n", hdrlen, sizeof(wp_api_hdr_t)); 01841 return -1; 01842 } 01843 01844 wp_api_element.hdr.operation_status = SANG_STATUS_IO_ERROR; 01845 01846 if(DoReadCommand(fd, &wp_api_element)){ 01847 /*error*/ 01848 DBG_ERR("DoReadCommand() failed! Check messages log.\n"); 01849 return -4; 01850 } 01851 01852 memcpy(rx_hdr, &wp_api_element.hdr, sizeof(wp_api_hdr_t)); 01853 01854 switch(rx_hdr->operation_status) 01855 { 01856 case SANG_STATUS_RX_DATA_AVAILABLE: 01857 /* ok */ 01858 if(rx_hdr->data_length <= datalen){ 01859 memcpy(databuf, wp_api_element.data, rx_hdr->data_length); 01860 }else{ 01861 rx_hdr->operation_status = SANG_STATUS_BUFFER_TOO_SMALL; 01862 } 01863 break; 01864 case SANG_STATUS_NO_DATA_AVAILABLE: 01865 /* Note that SANG_STATUS_NO_DATA_AVAILABLE is NOT an error becase 01866 * read() is non-blocking and can be called at any time (by some polling code)*/ 01867 return 1; /* return positive value to indicate success, user must check 'rx_hdr->operation_status' */ 01868 default: 01869 if(libsng_dbg_level)DBG_ERR("Operation Status: %s(%d)\n", 01870 SDLA_DECODE_SANG_STATUS(rx_hdr->operation_status), rx_hdr->operation_status); 01871 return -5; 01872 } 01873 01874 rx_len = rx_hdr->data_length; 01875 #else 01876 wan_msghdr_t msg; 01877 wan_iovec_t iov[2]; 01878 01879 memset(&msg,0,sizeof(msg)); 01880 memset(&iov[0],0,sizeof(iov[0])*2); 01881 01882 iov[0].iov_len=hdrlen; 01883 iov[0].iov_base=hdrbuf; 01884 01885 iov[1].iov_len=datalen; 01886 iov[1].iov_base=databuf; 01887 01888 msg.msg_iovlen=2; 01889 msg.msg_iov=iov; 01890 01891 rx_len = read(fd,&msg,sizeof(msg)); 01892 01893 if (rx_len <= sizeof(wp_api_hdr_t)){ 01894 return -EINVAL; 01895 } 01896 01897 rx_len -= sizeof(wp_api_hdr_t); 01898 #endif 01899 return rx_len; 01900 }
| 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
| sangoma_wait_object | pointer a single device object | |
| fd | device file descriptor | |
| object_type | type of the wait object. see sangoma_wait_obj_type_t for types |
| sangoma_wait_object | pointer a single device object | |
| fd | device file descriptor | |
| object_type | type of the wait object. see sangoma_wait_obj_type_t for types |
Definition at line 1243 of file libsangoma.c.
References 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().
01244 { 01245 int err = 0; 01246 sangoma_wait_obj_t *sng_wait_obj = NULL; 01247 01248 if (!sangoma_wait_object) { 01249 return SANG_STATUS_INVALID_PARAMETER; 01250 } 01251 *sangoma_wait_object = NULL; 01252 sng_wait_obj = malloc(sizeof(**sangoma_wait_object)); 01253 if (!sng_wait_obj) { 01254 return SANG_STATUS_FAILED_ALLOCATE_MEMORY; 01255 } 01256 01257 memset(sng_wait_obj, 0x00, sizeof(*sng_wait_obj)); 01258 /* it is a first initialization of the object */ 01259 sng_wait_obj->init_flag = LIBSNG_MAGIC_NO; 01260 01261 sng_wait_obj->fd = fd; 01262 sng_wait_obj->object_type = object_type; 01263 01264 #if defined(__WINDOWS__) 01265 if (!SANGOMA_OBJ_HAS_DEVICE(sng_wait_obj)) { 01266 sng_wait_obj->signal_object = CreateEvent(NULL, FALSE, FALSE, NULL); 01267 if(!sng_wait_obj->signal_object){ 01268 err = SANG_STATUS_GENERAL_ERROR; 01269 goto failed; 01270 } 01271 err = SANG_STATUS_SUCCESS; 01272 } else { 01273 err = init_sangoma_event_object(sng_wait_obj, fd); 01274 if(SANG_STATUS_SUCCESS != err){ 01275 goto failed; 01276 } 01277 } 01278 #else 01279 int filedes[2]; 01280 if (SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) { 01281 sng_wait_obj->signal_read_fd = INVALID_HANDLE_VALUE; 01282 sng_wait_obj->signal_write_fd = INVALID_HANDLE_VALUE; 01283 /* if we want cross-process event notification we can use a named pipe with mkfifo() */ 01284 if (pipe(filedes)) { 01285 err = SANG_STATUS_GENERAL_ERROR; 01286 goto failed; 01287 } 01288 sng_wait_obj->signal_read_fd = filedes[0]; 01289 sng_wait_obj->signal_write_fd = filedes[1]; 01290 } 01291 #endif 01292 *sangoma_wait_object = sng_wait_obj; 01293 return err; 01294 01295 failed: 01296 if (sng_wait_obj) { 01297 sangoma_wait_obj_delete(&sng_wait_obj); 01298 } 01299 return err; 01300 }


| 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().
| sangoma_wait_object | pointer to a pointer to a single device object |
Definition at line 1308 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().
01309 { 01310 sangoma_wait_obj_t *sng_wait_obj = *sangoma_wait_object; 01311 01312 if(sng_wait_obj->init_flag != LIBSNG_MAGIC_NO){ 01313 /* error. object was not initialized by sangoma_wait_obj_init() */ 01314 return SANG_STATUS_INVALID_DEVICE; 01315 } 01316 01317 #if defined(__WINDOWS__) 01318 if (sng_wait_obj->signal_object && 01319 sng_wait_obj->signal_object != INVALID_HANDLE_VALUE) { 01320 sangoma_close(&sng_wait_obj->signal_object); 01321 } 01322 #else 01323 if (SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) { 01324 sangoma_close(&sng_wait_obj->signal_read_fd); 01325 sangoma_close(&sng_wait_obj->signal_write_fd); 01326 } 01327 #endif 01328 sng_wait_obj->init_flag = 0; 01329 sng_wait_obj->object_type = UNKNOWN_WAIT_OBJ; 01330 free(sng_wait_obj); 01331 *sangoma_wait_object = NULL; 01332 return SANG_STATUS_SUCCESS; 01333 }


| sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_signal | ( | sangoma_wait_obj_t * | sng_wait_obj | ) |
Set wait object to a signaled state.
| sangoma_wait_object | pointer a single device object that can be signaled |
Definition at line 1341 of file libsangoma.c.
References SANG_STATUS_GENERAL_ERROR, SANG_STATUS_INVALID_DEVICE, and SANG_STATUS_SUCCESS.
01342 { 01343 if (!SANGOMA_OBJ_IS_SIGNALABLE(sng_wait_obj)) { 01344 /* even when Windows objects are always signalable for the sake of providing 01345 * a consistent interface to the user we downgrade the capabilities of Windows 01346 * objects unless the sangoma wait object is explicitly initialized as signalable */ 01347 return SANG_STATUS_INVALID_DEVICE; 01348 } 01349 #if defined(__WINDOWS__) 01350 if(sng_wait_obj->signal_object){ 01351 if (!SetEvent(sng_wait_obj->signal_object)) { 01352 return SANG_STATUS_GENERAL_ERROR; 01353 } 01354 } 01355 #else 01356 /* at this point we know is a signalable object and has a signal_write_fd */ 01357 if (write(sng_wait_obj->signal_write_fd, "s", 1) < 1) { 01358 return SANG_STATUS_GENERAL_ERROR; 01359 } 01360 #endif 01361 return SANG_STATUS_SUCCESS; 01362 }
| 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.
| sangoma_wait_object | pointer a single device object |
Definition at line 1370 of file libsangoma.c.
Referenced by cleanup(), handle_span_chan(), handle_tdm_event(), and write_data().

| 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.
| sangoma_wait_object | pointer a single device object |
| sangoma_wait_object | pointer a single device object |
Definition at line 1394 of file libsangoma.c.
Referenced by cleanup(), and write_data().

| 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
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 1982 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_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().
01983 { 01984 int err; 01985 01986 #if defined(__WINDOWS__) 01987 err = tdmv_api_ioctl(fd, &tdm_api->wp_cmd); 01988 #else 01989 err = ioctl(fd,WANPIPE_IOCTL_API_CMD,&tdm_api->wp_cmd); 01990 if (err < 0){ 01991 char tmp[50]; 01992 sprintf(tmp,"TDM API: CMD: %i\n",tdm_api->wp_cmd.cmd); 01993 perror(tmp); 01994 return -1; 01995 } 01996 #endif 01997 return err; 01998 }
| int _LIBSNG_CALL sangoma_get_full_cfg | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Read tdm api device configuration.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2004 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, wanpipe_chan_stats::rx_errors, wanpipe_chan_stats::rx_fifo_errors, wanpipe_chan_stats::rx_packets, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::stats, wanpipe_api_cmd::tdm_codec, wanpipe_chan_stats::tx_carrier_errors, wanpipe_api_cmd::tx_disable, wanpipe_chan_stats::tx_errors, wanpipe_chan_stats::tx_packets, 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().
02005 { 02006 int err; 02007 02008 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02009 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02010 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FULL_CFG; 02011 02012 err=sangoma_cmd_exec(fd,tdm_api); 02013 if (err){ 02014 return err; 02015 } 02016 02017 #if 0 02018 printf("TDM API CFG:\n"); 02019 printf("\thw_tdm_coding:\t%d\n",tdm_api->wp_cmd.hw_tdm_coding); 02020 printf("\thw_mtu_mru:\t%d\n",tdm_api->wp_cmd.hw_mtu_mru); 02021 printf("\tusr_period:\t%d\n",tdm_api->wp_cmd.usr_period); 02022 printf("\ttdm_codec:\t%d\n",tdm_api->wp_cmd.tdm_codec); 02023 printf("\tpower_level:\t%d\n",tdm_api->wp_cmd.power_level); 02024 printf("\trx_disable:\t%d\n",tdm_api->wp_cmd.rx_disable); 02025 printf("\ttx_disable:\t%d\n",tdm_api->wp_cmd.tx_disable); 02026 printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_cmd.usr_mtu_mru); 02027 printf("\tidle flag:\t0x%02X\n",tdm_api->wp_cmd.idle_flag); 02028 02029 #ifdef WP_API_FEATURE_FE_ALARM 02030 printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_cmd.fe_alarms); 02031 #endif 02032 02033 printf("\trx pkt\t%d\ttx pkt\t%d\n",tdm_api->wp_cmd.stats.rx_packets, 02034 tdm_api->wp_cmd.stats.tx_packets); 02035 printf("\trx err\t%d\ttx err\t%d\n", 02036 tdm_api->wp_cmd.stats.rx_errors, 02037 tdm_api->wp_cmd.stats.tx_errors); 02038 #ifndef __WINDOWS__ 02039 printf("\trx ovr\t%d\ttx idl\t%d\n", 02040 tdm_api->wp_cmd.stats.rx_fifo_errors, 02041 tdm_api->wp_cmd.stats.tx_carrier_errors); 02042 #endif 02043 #endif 02044 02045 return 0; 02046 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| period | value in miliseconds (1,2,5,10) |
Definition at line 2104 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().
02105 { 02106 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02107 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02108 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_USR_PERIOD; 02109 tdm_api->wp_cmd.usr_period = period; 02110 return sangoma_cmd_exec(fd,tdm_api); 02111 }


| int _LIBSNG_CALL sangoma_tdm_get_usr_period | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get Tx/Rx Period in Milliseconds.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2120 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.
02121 { 02122 int err; 02123 02124 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02125 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02126 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_USR_PERIOD; 02127 02128 err=sangoma_cmd_exec(fd,tdm_api); 02129 if (err){ 02130 return err; 02131 } 02132 02133 return tdm_api->wp_cmd.usr_period; 02134 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2254 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.
02255 { 02256 int err; 02257 02258 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02259 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02260 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_USR_MTU_MRU; 02261 02262 err=sangoma_cmd_exec(fd,tdm_api); 02263 if (err){ 02264 return err; 02265 } 02266 02267 return tdm_api->wp_cmd.usr_mtu_mru; 02268 }

| int _LIBSNG_CALL sangoma_flush_bufs | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Flush all (tx/rx/event) buffers from current channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2307 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().
02308 { 02309 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02310 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02311 tdm_api->wp_cmd.cmd = WP_API_CMD_FLUSH_BUFFERS; 02312 return sangoma_cmd_exec(fd,tdm_api); 02313 }


| int _LIBSNG_CALL sangoma_flush_rx_bufs | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Flush only rx buffers from current channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2315 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.
02316 { 02317 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02318 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02319 tdm_api->wp_cmd.cmd = WP_API_CMD_FLUSH_RX_BUFFERS; 02320 return sangoma_cmd_exec(fd,tdm_api); 02321 }

| int _LIBSNG_CALL sangoma_flush_tx_bufs | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Flush only tx buffers from current channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2323 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.
02324 { 02325 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02326 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02327 tdm_api->wp_cmd.cmd = WP_API_CMD_FLUSH_TX_BUFFERS; 02328 return sangoma_cmd_exec(fd,tdm_api); 02329 }

| int _LIBSNG_CALL sangoma_flush_event_bufs | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Flush only event buffers from current channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2331 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.
02332 { 02333 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02334 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02335 tdm_api->wp_cmd.cmd = WP_API_CMD_FLUSH_EVENT_BUFFERS; 02336 return sangoma_cmd_exec(fd,tdm_api); 02337 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| poll_in_sec | driver poll period for rbs events |
Definition at line 2339 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().
02340 { 02341 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02342 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02343 tdm_api->wp_cmd.cmd = WP_API_CMD_ENABLE_RBS_EVENTS; 02344 tdm_api->wp_cmd.rbs_poll = poll_in_sec; 02345 return sangoma_cmd_exec(fd,tdm_api); 02346 }


| int _LIBSNG_CALL sangoma_tdm_disable_rbs_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable RBS Events for a device.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2348 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().
02348 { 02349 02350 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02351 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02352 tdm_api->wp_cmd.cmd = WP_API_CMD_DISABLE_RBS_EVENTS; 02353 return sangoma_cmd_exec(fd,tdm_api); 02354 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| channel | t1/e1 timeslot | |
| rbs | rbs bits (ABCD) |
Definition at line 2356 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.
02357 { 02358 WANPIPE_API_INIT_CHAN(tdm_api, channel); 02359 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02360 tdm_api->wp_cmd.cmd = WP_API_CMD_WRITE_RBS_BITS; 02361 tdm_api->wp_cmd.rbs_tx_bits=rbs; 02362 return sangoma_cmd_exec(fd,tdm_api); 02363 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| channel | t1/e1 timeslot | |
| rbs | pointer to rbs bits (ABCD) |
Definition at line 2365 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.
02366 { 02367 int err; 02368 WANPIPE_API_INIT_CHAN(tdm_api, channel); 02369 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02370 tdm_api->wp_cmd.cmd = WP_API_CMD_READ_RBS_BITS; 02371 tdm_api->wp_cmd.rbs_tx_bits=0; 02372 02373 err=sangoma_cmd_exec(fd,tdm_api); 02374 if (err){ 02375 return err; 02376 } 02377 02378 *rbs=(unsigned char)tdm_api->wp_cmd.rbs_rx_bits; 02379 return 0; 02380 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2614 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DTMF, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.
Referenced by open_sangoma_device().
02615 { 02616 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02617 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02618 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02619 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_DTMF; 02620 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02621 return sangoma_cmd_exec(fd,tdm_api); 02622 }


| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2624 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_DTMF, and wanpipe_api::wp_cmd.
Referenced by cleanup().
02625 { 02626 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02627 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02628 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02629 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_DTMF; 02630 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02631 return sangoma_cmd_exec(fd,tdm_api); 02632 }


| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2579 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_FAX_DETECT, and wanpipe_api::wp_cmd.
02580 { 02581 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02582 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02583 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02584 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_FAX_DETECT; 02585 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02586 return sangoma_cmd_exec(fd,tdm_api); 02587 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2589 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_FAX_DETECT, and wanpipe_api::wp_cmd.
02590 { 02591 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02592 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02593 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02594 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_FAX_DETECT; 02595 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02596 return sangoma_cmd_exec(fd,tdm_api); 02597 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2599 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_fax, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_FAX_DETECT, and wanpipe_api::wp_cmd.
02600 { 02601 int err; 02602 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02603 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02604 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_FAX_DETECT; 02605 err=sangoma_cmd_exec(fd,tdm_api); 02606 if (err){ 02607 return err; 02608 } 02609 return tdm_api->wp_cmd.hw_fax; 02610 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2634 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_RM_DTMF, and wanpipe_api::wp_cmd.
Referenced by open_sangoma_device().
02635 { 02636 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02637 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02638 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02639 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RM_DTMF; 02640 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02641 return sangoma_cmd_exec(fd,tdm_api); 02642 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2644 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_RM_DTMF, and wanpipe_api::wp_cmd.
Referenced by cleanup().
02645 { 02646 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02647 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02648 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02649 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RM_DTMF; 02650 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02651 return sangoma_cmd_exec(fd,tdm_api); 02652 }


| int _LIBSNG_CALL sangoma_tdm_enable_rxhook_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Enable RX HOOK Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2654 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_RXHOOK, and wanpipe_api::wp_cmd.
Referenced by open_sangoma_device().
02655 { 02656 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02657 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02658 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02659 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RXHOOK; 02660 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02661 return sangoma_cmd_exec(fd,tdm_api); 02662 }


| int _LIBSNG_CALL sangoma_tdm_disable_rxhook_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable RX HOOK Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2664 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_RXHOOK, and wanpipe_api::wp_cmd.
Referenced by cleanup().
02665 { 02666 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02667 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02668 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02669 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RXHOOK; 02670 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02671 return sangoma_cmd_exec(fd,tdm_api); 02672 }


| int _LIBSNG_CALL sangoma_tdm_enable_ring_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Enable RING Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2674 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_RING, and wanpipe_api::wp_cmd.
02675 { 02676 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02677 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02678 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02679 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING; 02680 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02681 return sangoma_cmd_exec(fd,tdm_api); 02682 }

| int _LIBSNG_CALL sangoma_tdm_disable_ring_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable RING Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2684 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_RING, and wanpipe_api::wp_cmd.
02685 { 02686 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02687 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02688 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02689 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING; 02690 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02691 return sangoma_cmd_exec(fd,tdm_api); 02692 }

| int _LIBSNG_CALL sangoma_tdm_enable_ring_detect_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Enable RING DETECT Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2694 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_RING_DETECT, and wanpipe_api::wp_cmd.
02695 { 02696 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02697 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02698 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02699 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_DETECT; 02700 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02701 return sangoma_cmd_exec(fd,tdm_api); 02702 }

| int _LIBSNG_CALL sangoma_tdm_disable_ring_detect_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable RING DETECT Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2704 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_RING_DETECT, and wanpipe_api::wp_cmd.
02705 { 02706 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02707 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02708 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02709 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_DETECT; 02710 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02711 return sangoma_cmd_exec(fd,tdm_api); 02712 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2714 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_RING_TRIP_DETECT, and wanpipe_api::wp_cmd.
02715 { 02716 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02717 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02718 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02719 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_TRIP_DETECT; 02720 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02721 return sangoma_cmd_exec(fd,tdm_api); 02722 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2724 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_RING_TRIP_DETECT, and wanpipe_api::wp_cmd.
02725 { 02726 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02727 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02728 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02729 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_RING_TRIP_DETECT; 02730 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02731 return sangoma_cmd_exec(fd,tdm_api); 02732 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| tone_id | tone type to transmit |
Definition at line 2774 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_TONE, and wanpipe_api::wp_cmd.
02775 { 02776 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02777 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02778 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02779 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TONE; 02780 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02781 tdm_api->wp_cmd.event.wp_api_event_tone_type = tone_id; 02782 return sangoma_cmd_exec(fd,tdm_api); 02783 }

| int _LIBSNG_CALL sangoma_tdm_disable_tone_events | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Enable TONE Events (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2785 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_DISABLE, WP_API_EVENT_TONE, and wanpipe_api::wp_cmd.
02786 { 02787 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02788 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02789 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02790 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TONE; 02791 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02792 tdm_api->wp_cmd.event.wp_api_event_tone_type = 0x00; 02793 return sangoma_cmd_exec(fd,tdm_api); 02794 }

| int _LIBSNG_CALL sangoma_tdm_txsig_onhook | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Tranmsmit TX SIG ON HOOK (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2754 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_TXSIG_ONHOOK, and wanpipe_api::wp_cmd.
02755 { 02756 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02757 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02758 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02759 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_ONHOOK; 02760 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02761 return sangoma_cmd_exec(fd,tdm_api); 02762 }

| int _LIBSNG_CALL sangoma_tdm_txsig_offhook | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Tranmsmit TX SIG OFF HOOK (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2764 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_TXSIG_OFFHOOK, and wanpipe_api::wp_cmd.
02765 { 02766 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02767 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02768 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02769 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_OFFHOOK; 02770 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02771 return sangoma_cmd_exec(fd,tdm_api); 02772 }

| int _LIBSNG_CALL sangoma_tdm_txsig_start | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Tranmsmit TX SIG START (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2744 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_TXSIG_START, and wanpipe_api::wp_cmd.
02745 { 02746 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02747 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02748 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02749 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_START; 02750 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02751 return sangoma_cmd_exec(fd,tdm_api); 02752 }

| int _LIBSNG_CALL sangoma_tdm_txsig_kewl | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Tranmsmit TX SIG KEWL START (Analog Only).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2734 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_TXSIG_KEWL, and wanpipe_api::wp_cmd.
02735 { 02736 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02737 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02738 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02739 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_TXSIG_KEWL; 02740 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02741 return sangoma_cmd_exec(fd,tdm_api); 02742 }

| int _LIBSNG_CALL sangoma_tdm_enable_hwec | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Enable HWEC on this channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2797 of file libsangoma.c.
References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_ENABLE_HWEC, and wanpipe_api::wp_cmd.
02798 { 02799 /* intentionally NOT initializing chan - caller must do it */ 02800 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02801 tdm_api->wp_cmd.cmd = WP_API_CMD_ENABLE_HWEC; 02802 return sangoma_cmd_exec(fd,tdm_api); 02803 }

| int _LIBSNG_CALL sangoma_tdm_disable_hwec | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable HWEC on this channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2805 of file libsangoma.c.
References wanpipe_api_cmd::cmd, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_DISABLE_HWEC, and wanpipe_api::wp_cmd.
02806 { 02807 /* intentionally NOT initializing chan - caller must do it */ 02808 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02809 tdm_api->wp_cmd.cmd = WP_API_CMD_DISABLE_HWEC; 02810 return sangoma_cmd_exec(fd,tdm_api); 02811 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| alarms | bit map status of T1/E1 alarms |
Definition at line 2819 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_alarms, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_FE_ALARMS, and wanpipe_api::wp_cmd.
02820 { 02821 int err; 02822 02823 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02824 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02825 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_ALARMS; 02826 02827 err=sangoma_cmd_exec(fd,tdm_api); 02828 if (err){ 02829 return err; 02830 } 02831 02832 *alarms=tdm_api->wp_cmd.fe_alarms; 02833 02834 return 0; 02835 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| current_status | pointer where result will be filled: 0=Link UP 1=Link Down |
Definition at line 2854 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_FE_STATUS, and wanpipe_api::wp_cmd.
02855 { 02856 int err; 02857 02858 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02859 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02860 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_STATUS; 02861 err = sangoma_cmd_exec(fd, tdm_api); 02862 *current_status = tdm_api->wp_cmd.fe_status; 02863 02864 return err; 02865 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| new_status | new status 0=Link UP 1=Link Down |
Definition at line 2868 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_FE_STATUS, and wanpipe_api::wp_cmd.
02869 { 02870 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02871 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02872 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_FE_STATUS; 02873 tdm_api->wp_cmd.fe_status = new_status; 02874 return sangoma_cmd_exec(fd, tdm_api); 02875 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| multiplier | buffer multiplier value 0-disable or 1 to TDMAPI_MAX_BUFFER_MULTIPLIER |
Definition at line 2384 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::data, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_BUFFER_MULTIPLIER, and wanpipe_api::wp_cmd.
Referenced by open_sangoma_device().
02385 { 02386 02387 int err; 02388 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02389 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02390 tdm_api->wp_cmd.cmd = WP_API_CMD_BUFFER_MULTIPLIER; 02391 *((unsigned int*)&tdm_api->wp_cmd.data[0]) = multiplier; 02392 02393 err=sangoma_cmd_exec(fd,tdm_api); 02394 if (err){ 02395 return err; 02396 } 02397 02398 return 0; 02399 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| channel | bri bchannel 1 or 2 |
Definition at line 2889 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_CMD_SET_EVENT, WP_API_EVENT_BRI_CHAN_LOOPBACK, WP_API_EVENT_ENABLE, and wanpipe_api::wp_cmd.
02890 { 02891 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02892 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02893 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02894 tdm_api->wp_cmd.event.channel = (unsigned char)channel; 02895 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_BRI_CHAN_LOOPBACK; 02896 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 02897 return sangoma_cmd_exec(fd, tdm_api); 02898 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| channel | bri bchannel 1 or 2 |
Definition at line 2878 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_CMD_SET_EVENT, WP_API_EVENT_BRI_CHAN_LOOPBACK, WP_API_EVENT_DISABLE, and wanpipe_api::wp_cmd.
02879 { 02880 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02881 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02882 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 02883 tdm_api->wp_cmd.event.channel = (unsigned char)channel; 02884 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_BRI_CHAN_LOOPBACK; 02885 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_DISABLE; 02886 return sangoma_cmd_exec(fd, tdm_api); 02887 }

| int _LIBSNG_CALL sangoma_get_tx_queue_sz | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get Tx Queue Size for this channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2900 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().
02901 { 02902 int err; 02903 02904 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02905 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02906 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_TX_Q_SIZE; 02907 tdm_api->wp_cmd.tx_queue_sz = 0; 02908 02909 err=sangoma_cmd_exec(fd, tdm_api); 02910 if (err < 0) { 02911 return err; 02912 } 02913 02914 return tdm_api->wp_cmd.tx_queue_sz; 02915 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| size | tx queue size (minimum value of 1) |
Definition at line 2917 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().
02918 { 02919 if (size < 0) { 02920 return -1; 02921 } 02922 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02923 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02924 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_TX_Q_SIZE; 02925 tdm_api->wp_cmd.tx_queue_sz = size; 02926 return sangoma_cmd_exec(fd, tdm_api); 02927 }


| int _LIBSNG_CALL sangoma_get_rx_queue_sz | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get Rx Queue Size for this channel.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2929 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().
02930 { 02931 int err; 02932 02933 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02934 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02935 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_RX_Q_SIZE; 02936 tdm_api->wp_cmd.rx_queue_sz = 0; 02937 02938 err=sangoma_cmd_exec(fd, tdm_api); 02939 if (err < 0) { 02940 return err; 02941 } 02942 02943 return tdm_api->wp_cmd.rx_queue_sz; 02944 02945 }


| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| size | rx queue size (minimum value of 1) |
Definition at line 2947 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().
02948 { 02949 if (size < 0) { 02950 return -1; 02951 } 02952 02953 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02954 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02955 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_RX_Q_SIZE; 02956 tdm_api->wp_cmd.rx_queue_sz = size; 02957 return sangoma_cmd_exec(fd, tdm_api); 02958 }


| int _LIBSNG_CALL sangoma_get_hw_coding | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get HW Voice Coding (ulaw/alaw).
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2142 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.
02143 { 02144 int err; 02145 02146 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02147 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02148 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_CODING; 02149 err=sangoma_cmd_exec(fd,tdm_api); 02150 if (err){ 02151 return err; 02152 } 02153 return tdm_api->wp_cmd.hw_tdm_coding; 02154 }

| int _LIBSNG_CALL sangoma_tdm_get_hw_dtmf | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Check if hwdtmf support is available.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2163 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.
02164 { 02165 int err; 02166 02167 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02168 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02169 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_DTMF; 02170 err=sangoma_cmd_exec(fd,tdm_api); 02171 if (err){ 02172 return err; 02173 } 02174 return tdm_api->wp_cmd.hw_dtmf; 02175 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2183 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_ec, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC, and wanpipe_api::wp_cmd.
02184 { 02185 int err; 02186 02187 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02188 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02189 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_EC; 02190 err=sangoma_cmd_exec(fd,tdm_api); 02191 if (err){ 02192 return err; 02193 } 02194 return tdm_api->wp_cmd.hw_ec; 02195 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2206 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_ec, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC_CHAN, and wanpipe_api::wp_cmd.
02207 { 02208 int err; 02209 02210 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02211 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02212 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_EC_CHAN; 02213 err=sangoma_cmd_exec(fd,tdm_api); 02214 if (err){ 02215 return err; 02216 } 02217 return tdm_api->wp_cmd.hw_ec; 02218 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2232 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::hw_ec, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_HW_EC_PERSIST, and wanpipe_api::wp_cmd.
02233 { 02234 int err; 02235 02236 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02237 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02238 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_HW_EC_PERSIST; 02239 err=sangoma_cmd_exec(fd,tdm_api); 02240 if (err){ 02241 return err; 02242 } 02243 return tdm_api->wp_cmd.hw_ec; 02244 }

| int _LIBSNG_CALL sangoma_span_chan_toif | ( | int | span, | |
| int | chan, | |||
| char * | interface_name | |||
| ) |
Convert Span & Chan to interface name.
Device OPEN / CLOSE Functions
| span | span number starting from 1 to 255 | |
| chan | chan number starting from 1 to 32 | |
| interface_name | pointer to string where interface name will be written |
Definition at line 1554 of file libsangoma.c.
References WP_INTERFACE_NAME_FORM.
01555 { 01556 #if defined(__WINDOWS__) 01557 /* Form the Interface Name from span and chan number (i.e. wanpipe1_if1). */ 01558 sprintf(interface_name, WP_INTERFACE_NAME_FORM, span, chan); 01559 #else 01560 sprintf(interface_name,"s%ic%i",span,chan); 01561 #endif 01562 return 0; 01563 }
| int _LIBSNG_CALL sangoma_span_chan_fromif | ( | char * | interface_name, | |
| int * | span, | |||
| int * | chan | |||
| ) |
Convert Interace Name to Span & Chan.
| interface_name | pointer to string containing interface name | |
| span | integer pointer where to write span value | |
| chan | integer pointer where to write chan value |
Definition at line 1628 of file libsangoma.c.
References FNAME_LEN.
01629 { 01630 char *p = NULL, *sp = NULL, *ch = NULL; 01631 int ret = 0; 01632 char data[FNAME_LEN]; 01633 01634 /* Windows: Accept WANPIPEx_IFy or wanpipex_ify 01635 * where x is the span and y is the chan. */ 01636 01637 strncpy(data, interface_name, FNAME_LEN); 01638 if ((data[0])) { 01639 for (p = data; *p; p++) { 01640 #if defined(__WINDOWS__) 01641 if (sp && (*p == 'F'||*p == 'f')) { 01642 #else 01643 if (sp && *p == 'c') { 01644 #endif 01645 *p = '\0'; 01646 ch = (p + 1); 01647 break; 01648 #if defined(__WINDOWS__) 01649 } else if (*p == 'E'||*p == 'e') { 01650 #else 01651 } else if (*p == 's') { 01652 #endif 01653 sp = (p + 1); 01654 } 01655 } 01656 01657 if(ch && sp) { 01658 *span = atoi(sp); 01659 *chan = atoi(ch); 01660 ret = 1; 01661 } else { 01662 *span = -1; 01663 *chan = -1; 01664 } 01665 } 01666 01667 return ret; 01668 }
| 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).
| span | span number of the device to wait | |
| chan | chan number of the device to wait | |
| sectimeout | how many seconds to wait for the device to come up, -1 to wait forever |
Definition at line 1596 of file libsangoma.c.
References FNAME_LEN, and WP_INTERFACE_NAME_FORM.
01597 { 01598 #if defined(__WINDOWS__) 01599 /* Windows does not need to wait for interfaces to come up */ 01600 return 0; 01601 #else 01602 char interface_name[FNAME_LEN]; 01603 struct stat statbuf; 01604 struct timeval endtime = {0,0}; 01605 struct timeval curtime = {0,0}; 01606 int counter; 01607 int rc; 01608 if (sectimeout >= 0 && gettimeofday(&endtime, NULL)) { 01609 return -1; 01610 } 01611 snprintf(interface_name, sizeof(interface_name), "/dev/" WP_INTERFACE_NAME_FORM, span, chan); 01612 endtime.tv_sec += sectimeout; 01613 do { 01614 counter = 0; 01615 while ((rc = stat(interface_name, &statbuf)) && errno == ENOENT && counter != 10) { 01616 poll(0, 0, 100); // test in 100ms increments 01617 counter++; 01618 } 01619 if (!rc || errno != ENOENT) break; 01620 if (gettimeofday(&curtime, NULL)) { 01621 return -1; 01622 } 01623 } while (sectimeout < 0 || timercmp(&endtime, &curtime,>)); 01624 return rc; 01625 #endif 01626 }
| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| drv_ver | driver version structure that will contain the driver version |
Definition at line 2960 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::data_len, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, wanpipe_api_cmd::version, WP_API_CMD_DRIVER_VERSION, and wanpipe_api::wp_cmd.
02961 { 02962 int err; 02963 02964 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02965 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02966 tdm_api->wp_cmd.cmd = WP_API_CMD_DRIVER_VERSION; 02967 02968 err = sangoma_cmd_exec(fd, tdm_api); 02969 if (err == 0) { 02970 if (tdm_api->wp_cmd.data_len == sizeof(wan_driver_version_t)) { 02971 if (drv_ver) { 02972 memcpy(drv_ver,&tdm_api->wp_cmd.version,sizeof(wan_driver_version_t)); 02973 } 02974 } else { 02975 return -1; 02976 } 02977 } 02978 02979 return err; 02980 }

| int _LIBSNG_CALL sangoma_get_firmware_version | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api, | |||
| unsigned char * | ver | |||
| ) |
Get Hardware/Firmware Version.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| ver | hardware/firmware version number |
Definition at line 2982 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::data, wanpipe_api_cmd::data_len, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_FIRMWARE_VERSION, and wanpipe_api::wp_cmd.
02983 { 02984 int err; 02985 02986 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02987 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02988 tdm_api->wp_cmd.cmd = WP_API_CMD_FIRMWARE_VERSION; 02989 02990 err = sangoma_cmd_exec(fd, tdm_api); 02991 if (err == 0) { 02992 if (tdm_api->wp_cmd.data_len == sizeof(unsigned char)) { 02993 *ver = tdm_api->wp_cmd.data[0]; 02994 } else { 02995 return -1; 02996 } 02997 } 02998 02999 return err; 03000 }

| int _LIBSNG_CALL sangoma_get_cpld_version | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api, | |||
| unsigned char * | ver | |||
| ) |
Get AFT CPLD Version.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| ver | AFT CPLD version number |
Definition at line 3002 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::data, wanpipe_api_cmd::data_len, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_CPLD_VERSION, and wanpipe_api::wp_cmd.
03003 { 03004 int err; 03005 03006 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03007 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03008 tdm_api->wp_cmd.cmd = WP_API_CMD_CPLD_VERSION; 03009 03010 err = sangoma_cmd_exec(fd, tdm_api); 03011 if (err == 0) { 03012 if (tdm_api->wp_cmd.data_len == sizeof(unsigned char)) { 03013 *ver = tdm_api->wp_cmd.data[0]; 03014 } else { 03015 return -1; 03016 } 03017 } 03018 03019 return err; 03020 }

| 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.
| fd | device file descriptor | |
| out_customer_id | AFT Customer ID |
Definition at line 3022 of file libsangoma.c.
References SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_mgmt_cmd(), and WANPIPEMON_AFT_CUSTOMER_ID.
03023 { 03024 wan_udp_hdr_t wan_udp; 03025 03026 memset(&wan_udp, 0x00, sizeof(wan_udp)); 03027 03028 wan_udp.wan_udphdr_command = WANPIPEMON_AFT_CUSTOMER_ID; 03029 wan_udp.wan_udphdr_return_code = SANG_STATUS_UNSUPPORTED_FUNCTION; 03030 wan_udp.wan_udphdr_data_len = 0; 03031 03032 if (sangoma_mgmt_cmd(fd, &wan_udp)) { 03033 return SANG_STATUS_IO_ERROR; 03034 } 03035 03036 if (wan_udp.wan_udphdr_return_code) { 03037 return SANG_STATUS_UNSUPPORTED_FUNCTION; 03038 } 03039 03040 *out_customer_id = sangoma_get_wan_udphdr_data_byte(&wan_udp, 0); 03041 03042 return 0; 03043 }

| 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.
| fd | device file descriptor | |
| led_state | 0=off 1=on |
Definition at line 3046 of file libsangoma.c.
References SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, sangoma_mgmt_cmd(), and WANPIPEMON_LED_CTRL.
03047 { 03048 wan_udp_hdr_t wan_udp; 03049 03050 memset(&wan_udp, 0x00, sizeof(wan_udp)); 03051 03052 wan_udp.wan_udphdr_command = WANPIPEMON_LED_CTRL; 03053 wan_udp.wan_udphdr_return_code = SANG_STATUS_UNSUPPORTED_FUNCTION; 03054 wan_udp.wan_udphdr_data_len = 1; 03055 wan_udp.wan_udphdr_data[0] = led_ctrl; 03056 03057 if (sangoma_mgmt_cmd(fd, &wan_udp)) { 03058 return SANG_STATUS_IO_ERROR; 03059 } 03060 03061 if (wan_udp.wan_udphdr_return_code) { 03062 return SANG_STATUS_UNSUPPORTED_FUNCTION; 03063 } 03064 03065 return 0; 03066 }

| int _LIBSNG_CALL sangoma_fe_reg_write | ( | sng_fd_t | fd, | |
| uint32_t | offset, | |||
| uint8_t | data | |||
| ) |
Write to a front end register.
| fd | device file descriptor | |
| offset | offset of front end register | |
| data | value to write |
Definition at line 3070 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.
03071 { 03072 int chan=0; 03073 wan_udp_hdr_t wan_udp; 03074 sdla_fe_debug_t *fe_debug; 03075 memset(&wan_udp, 0x00, sizeof(wan_udp)); 03076 03077 { 03078 int err; 03079 wanpipe_api_t tdm_api; 03080 memset(&tdm_api,0,sizeof(tdm_api)); 03081 err=sangoma_get_full_cfg(fd, &tdm_api); 03082 if (err) { 03083 return err; 03084 } 03085 chan=tdm_api.wp_cmd.chan; 03086 if (chan) 03087 chan--; 03088 } 03089 03090 wan_udp.wan_udphdr_command = WAN_FE_SET_DEBUG_MODE; 03091 wan_udp.wan_udphdr_data_len = sizeof(sdla_fe_debug_t); 03092 wan_udp.wan_udphdr_return_code = 0xaa; 03093 fe_debug = (sdla_fe_debug_t*)wan_udp.wan_udphdr_data; 03094 03095 fe_debug->type = WAN_FE_DEBUG_REG; 03096 fe_debug->mod_no = chan; 03097 fe_debug->fe_debug_reg.reg = offset; 03098 fe_debug->fe_debug_reg.value = data; 03099 fe_debug->fe_debug_reg.read = 0; 03100 03101 if (sangoma_mgmt_cmd(fd, &wan_udp)) { 03102 return SANG_STATUS_IO_ERROR; 03103 } 03104 03105 if (wan_udp.wan_udphdr_return_code) { 03106 return SANG_STATUS_UNSUPPORTED_FUNCTION; 03107 } 03108 03109 return 0; 03110 }

| int _LIBSNG_CALL sangoma_fe_reg_read | ( | sng_fd_t | fd, | |
| uint32_t | offset, | |||
| uint8_t * | data | |||
| ) |
Read front end register.
| fd | device file descriptor | |
| offset | offset of front end register | |
| data | value of the read register |
Definition at line 3112 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.
03113 { 03114 int chan=0; 03115 wan_udp_hdr_t wan_udp; 03116 sdla_fe_debug_t *fe_debug; 03117 memset(&wan_udp, 0x00, sizeof(wan_udp)); 03118 03119 { 03120 int err; 03121 wanpipe_api_t tdm_api; 03122 memset(&tdm_api,0,sizeof(tdm_api)); 03123 err=sangoma_get_full_cfg(fd, &tdm_api); 03124 if (err) { 03125 return err; 03126 } 03127 chan=tdm_api.wp_cmd.chan; 03128 if (chan) 03129 chan--; 03130 } 03131 03132 wan_udp.wan_udphdr_command = WAN_FE_SET_DEBUG_MODE; 03133 wan_udp.wan_udphdr_data_len = sizeof(sdla_fe_debug_t); 03134 wan_udp.wan_udphdr_return_code = 0xaa; 03135 fe_debug = (sdla_fe_debug_t*)wan_udp.wan_udphdr_data; 03136 03137 fe_debug->type = WAN_FE_DEBUG_REG; 03138 fe_debug->mod_no = chan; 03139 fe_debug->fe_debug_reg.reg = offset; 03140 fe_debug->fe_debug_reg.read = 1; 03141 03142 if (sangoma_mgmt_cmd(fd, &wan_udp)) { 03143 return SANG_STATUS_IO_ERROR; 03144 } 03145 03146 if (wan_udp.wan_udphdr_return_code) { 03147 return SANG_STATUS_UNSUPPORTED_FUNCTION; 03148 } 03149 03150 *data = fe_debug->fe_debug_reg.value; 03151 03152 return 0; 03153 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| stats | stats structure will be filled with device stats. (Optional, can be left NULL) |
Definition at line 3156 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.
03157 { 03158 int err; 03159 03160 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03161 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03162 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_STATS; 03163 03164 err = sangoma_cmd_exec(fd, tdm_api); 03165 if (err == 0) { 03166 if (stats) { 03167 memcpy(stats, &tdm_api->wp_cmd.stats, sizeof(wanpipe_chan_stats_t)); 03168 } 03169 } 03170 03171 return err; 03172 }

| int _LIBSNG_CALL sangoma_flush_stats | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Flush/Reset device statistics.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 3174 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.
03175 { 03176 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03177 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03178 tdm_api->wp_cmd.cmd = WP_API_CMD_RESET_STATS; 03179 return sangoma_cmd_exec(fd, tdm_api); 03180 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| rxflashtime | time value |
Definition at line 3182 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.
03183 { 03184 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03185 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03186 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_RM_RXFLASHTIME; 03187 tdm_api->wp_cmd.rxflashtime=rxflashtime; 03188 return sangoma_cmd_exec(fd, tdm_api); 03189 }

| 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
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| value | txgain (FXO - txgain value ranges from -150 to 120 , FXS - txgain value 35,-35) |
Definition at line 3192 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_SET_RM_TX_GAIN, and wanpipe_api::wp_cmd.
03193 { 03194 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03195 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03196 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 03197 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_SET_RM_TX_GAIN; 03198 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 03199 tdm_api->wp_cmd.event.wp_api_event_gain_value = value; 03200 return sangoma_cmd_exec(fd, tdm_api); 03201 }

| 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
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| value | rxgain (FXO - rxgain value ranges from -150 to 120 , FXS -rxgain value 35,-35) |
Definition at line 3203 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_SET_EVENT, WP_API_EVENT_ENABLE, WP_API_EVENT_SET_RM_RX_GAIN, and wanpipe_api::wp_cmd.
03204 { 03205 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03206 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03207 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_EVENT; 03208 tdm_api->wp_cmd.event.wp_api_event_type = WP_API_EVENT_SET_RM_RX_GAIN; 03209 tdm_api->wp_cmd.event.wp_api_event_mode = WP_API_EVENT_ENABLE; 03210 tdm_api->wp_cmd.event.wp_api_event_gain_value = value; 03211 return sangoma_cmd_exec(fd, tdm_api); 03212 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 3242 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.
03243 { 03244 int err; 03245 03246 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03247 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03248 tdm_api->wp_cmd.cmd = WP_API_CMD_ENABLE_LOOP; 03249 err = sangoma_cmd_exec(fd, tdm_api); 03250 return err; 03251 }

| int _LIBSNG_CALL sangoma_tdm_disable_loop | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Disable channel loop.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 3253 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.
03254 { 03255 int err; 03256 03257 WANPIPE_API_INIT_CHAN(tdm_api, 0); 03258 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 03259 tdm_api->wp_cmd.cmd = WP_API_CMD_DISABLE_LOOP; 03260 err = sangoma_cmd_exec(fd, tdm_api); 03261 return err; 03262 }

| int _LIBSNG_CALL sangoma_read_event | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Read API Events.
Device EVENT Function
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2404 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::event, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_READ_EVENT, WP_API_EVENT_ALARM, WP_API_EVENT_DTMF, WP_API_EVENT_LINK_STATUS, WP_API_EVENT_POLARITY_REVERSE, WP_API_EVENT_RBS, WP_API_EVENT_RING_DETECT, WP_API_EVENT_RING_TRIP_DETECT, WP_API_EVENT_RXHOOK, wanpipe_api::wp_callback, wanpipe_api::wp_cmd, wanpipe_api_callbacks::wp_dtmf_event, wanpipe_api_callbacks::wp_fe_alarm_event, wanpipe_api_callbacks::wp_link_status_event, wanpipe_api_callbacks::wp_rbs_event, wanpipe_api_callbacks::wp_ring_detect_event, wanpipe_api_callbacks::wp_ring_trip_detect_event, and wanpipe_api_callbacks::wp_rxhook_event.
Referenced by handle_tdm_event().
02405 { 02406 02407 #ifdef WP_API_FEATURE_EVENTS 02408 wp_api_event_t *rx_event; 02409 int err; 02410 02411 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02412 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02413 tdm_api->wp_cmd.cmd = WP_API_CMD_READ_EVENT; 02414 02415 err=sangoma_cmd_exec(fd,tdm_api); 02416 if (err){ 02417 return err; 02418 } 02419 02420 rx_event = &tdm_api->wp_cmd.event; 02421 02422 #ifdef WP_API_DEPRECATED_FEATURE_READ_CALLBACK_FUNCTIONS 02423 /* 02424 The use of callbacks here is purely optional and is left 02425 here for backward compatibility purposes. By default user 02426 should handle events outside this funciton. This function 02427 should only be used to read the event 02428 */ 02429 02430 switch (rx_event->wp_api_event_type){ 02431 02432 case WP_API_EVENT_RBS: 02433 if (tdm_api->wp_callback.wp_rbs_event) { 02434 tdm_api->wp_callback.wp_rbs_event(fd,rx_event->wp_api_event_rbs_bits); 02435 } 02436 break; 02437 02438 #ifdef WP_API_FEATURE_DTMF_EVENTS 02439 case WP_API_EVENT_DTMF: 02440 if (tdm_api->wp_callback.wp_dtmf_event) { 02441 tdm_api->wp_callback.wp_dtmf_event(fd, 02442 rx_event->wp_api_event_dtmf_digit, 02443 rx_event->wp_api_event_dtmf_type, 02444 rx_event->wp_api_event_dtmf_port); 02445 } 02446 break; 02447 #endif 02448 02449 case WP_API_EVENT_RXHOOK: 02450 if (tdm_api->wp_callback.wp_rxhook_event) { 02451 tdm_api->wp_callback.wp_rxhook_event(fd, 02452 rx_event->wp_api_event_hook_state); 02453 } 02454 break; 02455 02456 case WP_API_EVENT_RING_DETECT: 02457 if (tdm_api->wp_callback.wp_ring_detect_event) { 02458 tdm_api->wp_callback.wp_ring_detect_event(fd, 02459 rx_event->wp_api_event_ring_state); 02460 } 02461 break; 02462 02463 case WP_API_EVENT_RING_TRIP_DETECT: 02464 if (tdm_api->wp_callback.wp_ring_trip_detect_event) { 02465 tdm_api->wp_callback.wp_ring_trip_detect_event(fd, 02466 rx_event->wp_api_event_ring_state); 02467 } 02468 break; 02469 02470 #ifdef WP_API_FEATURE_FE_ALARM 02471 case WP_API_EVENT_ALARM: 02472 if (tdm_api->wp_callback.wp_fe_alarm_event) { 02473 tdm_api->wp_callback.wp_fe_alarm_event(fd, 02474 rx_event->wp_api_event_alarm); 02475 } 02476 break; 02477 #endif 02478 02479 #ifdef WP_API_FEATURE_LINK_STATUS 02480 /* Link Status */ 02481 case WP_API_EVENT_LINK_STATUS: 02482 if(tdm_api->wp_callback.wp_link_status_event){ 02483 tdm_api->wp_callback.wp_link_status_event(fd, 02484 rx_event->wp_api_event_link_status); 02485 } 02486 02487 break; 02488 #endif 02489 02490 #ifdef WP_API_FEATURE_POL_REV 02491 case WP_API_EVENT_POLARITY_REVERSE: 02492 break; 02493 #endif 02494 default: 02495 #ifdef __WINDOWS__ 02496 if(0)printf("Warning: libsangoma: %s fd=0x%p: Unknown TDM event!", __FUNCTION__,fd); 02497 #else 02498 if(0)printf("Warning: libsangoma: %s fd=%d: Unknown TDM event!", __FUNCTION__, fd); 02499 #endif 02500 break; 02501 } 02502 02503 #endif 02504 02505 02506 return 0; 02507 #else 02508 printf("Error: Read Event not supported!\n"); 02509 return -1; 02510 #endif 02511 }


| sangoma_status_t _LIBSNG_CALL sangoma_logger_read_event | ( | sng_fd_t | fd, | |
| wp_logger_cmd_t * | logger_cmd | |||
| ) |
Read Wanpipe Logger Events.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2534 of file libsangoma.c.
02535 { 02536 logger_cmd->cmd = WP_API_LOGGER_CMD_READ_EVENT; 02537 return sangoma_logger_cmd_exec(fd, logger_cmd); 02538 }
| sangoma_status_t _LIBSNG_CALL sangoma_logger_flush_buffers | ( | sng_fd_t | fd, | |
| wp_logger_cmd_t * | logger_cmd | |||
| ) |
Flush Wanpipe Logger internal buffers.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2540 of file libsangoma.c.
02541 { 02542 logger_cmd->cmd = WP_API_LOGGER_CMD_FLUSH_BUFFERS; 02543 return sangoma_logger_cmd_exec(fd, logger_cmd); 02544 }
| sangoma_status_t _LIBSNG_CALL sangoma_logger_get_statistics | ( | sng_fd_t | fd, | |
| wp_logger_cmd_t * | logger_cmd | |||
| ) |
Get Wanpipe Logger statistics.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2546 of file libsangoma.c.
02547 { 02548 logger_cmd->cmd = WP_API_LOGGER_CMD_GET_STATS; 02549 return sangoma_logger_cmd_exec(fd, logger_cmd); 02550 }
| sangoma_status_t _LIBSNG_CALL sangoma_logger_reset_statistics | ( | sng_fd_t | fd, | |
| wp_logger_cmd_t * | logger_cmd | |||
| ) |
Reset Wanpipe Logger statistics.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2552 of file libsangoma.c.
02553 { 02554 logger_cmd->cmd = WP_API_LOGGER_CMD_RESET_STATS; 02555 return sangoma_logger_cmd_exec(fd, logger_cmd); 02556 }
| 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.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2558 of file libsangoma.c.
02559 { 02560 logger_cmd->cmd = WP_API_LOGGER_CMD_OPEN_CNT; 02561 return sangoma_logger_cmd_exec(fd, logger_cmd); 02562 }
| 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.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2564 of file libsangoma.c.
02565 { 02566 logger_cmd->cmd = WP_API_LOGGER_CMD_GET_LOGGER_LEVEL; 02567 return sangoma_logger_cmd_exec(fd, logger_cmd); 02568 }
| 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.
| fd | device file descriptor | |
| logger_cmd | Logger API command structure |
Definition at line 2570 of file libsangoma.c.
02571 { 02572 logger_cmd->cmd = WP_API_LOGGER_CMD_SET_LOGGER_LEVEL; 02573 return sangoma_logger_cmd_exec(fd, logger_cmd); 02574 }
| int sangoma_clear_tx_gain | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Clear tx gain from device, set it to 0.0.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
| int sangoma_clear_rx_gain | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Clear rx gain from device, set it to 0.0.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
| 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
| [in] | fd | Port Device file descriptor |
| [out] | port_mgmnt | pointer to a port_management_struct_t structure. On return, sangoma_driver_port_start() updates operation_status field of this structure. |
| [in] | port_no | 1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2. |
Definition at line 151 of file libsangoma_config.c.
References SANG_STATUS_GENERAL_ERROR, and sangoma_port_mgmnt_ioctl().
00152 { 00153 int err; 00154 port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR; 00155 port_mgmnt->command_code = START_PORT_VOLATILE_CONFIG; 00156 port_mgmnt->port_no = port_no; 00157 00158 err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt); 00159 if (err) { 00160 /* ioctl failed */ 00161 return err; 00162 } 00163 00164 return port_mgmnt->operation_status; 00165 }

| 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.
| [in] | fd | Port Device file descriptor |
| [out] | port_mgmnt | pointer to a port_management_struct_t structure. On return, sangoma_driver_port_stop() updates operation_status field of this structure. |
| [in] | port_no | 1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2. |
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().
00168 { 00169 int err; 00170 port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR; 00171 port_mgmnt->command_code = STOP_PORT; 00172 port_mgmnt->port_no = port_no; 00173 00174 err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt); 00175 if (err) { 00176 /* ioctl failed */ 00177 return err; 00178 } 00179 00180 switch(port_mgmnt->operation_status) 00181 { 00182 case SANG_STATUS_CAN_NOT_STOP_DEVICE_WHEN_ALREADY_STOPPED: 00183 /* This is not an error, rather a state indication. 00184 * Return SANG_STATUS_SUCCESS, but real return code will be available 00185 * for the caller at port_mgmnt->operation_status. */ 00186 err = SANG_STATUS_SUCCESS; 00187 break; 00188 default: 00189 err = port_mgmnt->operation_status; 00190 break; 00191 } 00192 00193 return err; 00194 }

| 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().
| [in] | fd | Port Device file descriptor |
| [in,out] | port_cfg | pointer 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_no | 1-based Port Number. Port numbers correspond to Port Names. For example, a 2-Port card will have ports named WANPIPE1 and WANPIPE2. |
Definition at line 244 of file libsangoma_config.c.
References SANG_STATUS_GENERAL_ERROR.
00245 { 00246 port_cfg->operation_status = SANG_STATUS_GENERAL_ERROR; 00247 port_cfg->command_code = SET_PORT_VOLATILE_CONFIG; 00248 port_cfg->port_no = port_no; 00249 00250 return sangoma_port_cfg_ioctl(fd, port_cfg); 00251 }
| 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.
| [in] | fd | Port Device file descriptor |
| [out] | port_cfg | pointer to port_cfg_t structure. On return, sangoma_driver_port_get_config() will copy current Port configuration into this structure. |
| [in] | port_no | please see comment of sangoma_driver_port_set_config() |
Definition at line 253 of file libsangoma_config.c.
References SANG_STATUS_GENERAL_ERROR.
00254 { 00255 port_cfg->operation_status = SANG_STATUS_GENERAL_ERROR; 00256 port_cfg->command_code = GET_PORT_VOLATILE_CONFIG; 00257 port_cfg->port_no = port_no; 00258 return sangoma_port_cfg_ioctl(fd, port_cfg); 00259 }
| 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.
| [in] | fd | Port Device file descriptor |
| [out] | port_mgmnt | pointer to port_management_struct_t structure which will contain hardware_info_t at it's "data" field, when this function returns. |
| [in] | port_no | please see comment of sangoma_driver_port_set_config() |
Definition at line 196 of file libsangoma_config.c.
References SANG_STATUS_GENERAL_ERROR, and sangoma_port_mgmnt_ioctl().
00197 { 00198 int err; 00199 port_mgmnt->operation_status = SANG_STATUS_GENERAL_ERROR; 00200 port_mgmnt->command_code = GET_HARDWARE_INFO; 00201 port_mgmnt->port_no = port_no; 00202 00203 err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt); 00204 if (err) { 00205 return err; 00206 } 00207 00208 return port_mgmnt->operation_status; 00209 }

| 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.
| [in] | fd | Port Device file descriptor |
| [out] | port_mgmnt | pointer to port_management_struct_t structure which will contain wan_driver_version_t at it's "data" field, when this function returns. |
| [in] | port_no | please see comment of sangoma_driver_port_set_config() |
Definition at line 211 of file libsangoma_config.c.
References sangoma_port_mgmnt_ioctl().
00212 { 00213 int err; 00214 port_mgmnt->command_code = GET_DRIVER_VERSION; 00215 port_mgmnt->port_no = port_no; 00216 00217 err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt); 00218 if (err) { 00219 return err; 00220 } 00221 00222 return port_mgmnt->operation_status; 00223 }

| 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.
| [in] | fd | Port Device file descriptor |
| [out] | port_mgmnt | pointer 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_cnt | newly detected ports. |
Definition at line 226 of file libsangoma_config.c.
References sangoma_port_mgmnt_ioctl().
00227 { 00228 int err; 00229 port_mgmnt->command_code = WANPIPE_HARDWARE_RESCAN; 00230 port_mgmnt->port_no = 1; 00231 00232 err = sangoma_port_mgmnt_ioctl(fd, port_mgmnt); 00233 if (err < 0) { 00234 return err; 00235 } 00236 00237 *cnt=port_mgmnt->port_no; 00238 00239 return port_mgmnt->operation_status; 00240 }

| int _LIBSNG_CALL sangoma_mgmt_cmd | ( | sng_fd_t | fd, | |
| wan_udp_hdr_t * | wan_udp | |||
| ) |
Execute Sangoma Management Command.
Device MANAGEMENT Functions
| fd | device file descriptor | |
| wan_udp | management command structure |
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().
00123 { 00124 int err=0; 00125 #if defined(__WINDOWS__) 00126 if(UdpManagementCommand(fd, wan_udp)){ 00127 err = 1; 00128 } 00129 #else 00130 unsigned char id = 0; 00131 00132 wan_udp->wan_udphdr_request_reply = 0x01; 00133 wan_udp->wan_udphdr_id = id; 00134 wan_udp->wan_udphdr_return_code = WAN_UDP_TIMEOUT_CMD; 00135 00136 err=ioctl(fd,WANPIPE_IOCTL_PIPEMON,wan_udp); 00137 if (err < 0) { 00138 err = 1; 00139 } 00140 #endif 00141 if(err){ 00142 /* The ioctl failed. */ 00143 return err; 00144 } 00145 00146 /* The ioctl was successfull. The caller must check 00147 * value of wan_udp->wan_udphdr_return_code. */ 00148 return 0; 00149 }

| 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).
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| current_status | pointer where result will be filled: 0=Link UP 1=Link Down |
Definition at line 2838 of file libsangoma.c.
References wanpipe_api_cmd::cmd, wanpipe_api_cmd::fe_status, sangoma_cmd_exec(), SANGOMA_INIT_TDM_API_CMD_RESULT, WP_API_CMD_GET_FE_STATUS, and wanpipe_api::wp_cmd.
02839 { 02840 int err; 02841 02842 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02843 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02844 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_FE_STATUS; 02845 err = sangoma_cmd_exec(fd, tdm_api); 02846 *current_status = tdm_api->wp_cmd.fe_status; 02847 02848 return err; 02849 }

| int _LIBSNG_CALL sangoma_tdm_set_codec | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api, | |||
| int | codec | |||
| ) |
Set TDM Codec per chan.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| codec | codec to set (ulaw/alaw/slinear) |
Definition at line 2060 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().
02061 { 02062 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02063 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02064 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_CODEC; 02065 tdm_api->wp_cmd.tdm_codec = codec; 02066 return sangoma_cmd_exec(fd,tdm_api); 02067 }


| int _LIBSNG_CALL sangoma_tdm_get_codec | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get Configured TDM Codec per chan.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2081 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.
02082 { 02083 int err; 02084 02085 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02086 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02087 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_CODEC; 02088 02089 err=sangoma_cmd_exec(fd,tdm_api); 02090 if (err){ 02091 return err; 02092 } 02093 02094 return tdm_api->wp_cmd.tdm_codec; 02095 }

| sng_fd_t _LIBSNG_CALL sangoma_create_socket_by_name | ( | char * | device, | |
| char * | card | |||
| ) |
Open a device based on a interface and card name.
| device | interface name | |
| card | card name |
Definition at line 1766 of file libsangoma.c.
References sangoma_interface_toi(), and sangoma_open_api_span_chan().
01767 { 01768 int span,chan; 01769 sangoma_interface_toi(device,&span,&chan); 01770 01771 return sangoma_open_api_span_chan(span,chan); 01772 }

| int _LIBSNG_CALL sangoma_interface_toi | ( | char * | interface_name, | |
| int * | span, | |||
| int * | chan | |||
| ) |
Convert Span & Chan to interface name.
| interface_name | pointer to string where interface name will be written | |
| span | span number starting from 1 to 255 | |
| chan | chan number starting from 1 to 32 |
Definition at line 1565 of file libsangoma.c.
References FNAME_LEN.
Referenced by sangoma_create_socket_by_name().
01566 { 01567 char *p=NULL, *sp = NULL, *ch = NULL; 01568 int ret = 0; 01569 char data[FNAME_LEN]; 01570 01571 strncpy(data, interface_name, FNAME_LEN); 01572 if ((data[0])) { 01573 for (p = data; *p; p++) { 01574 if (sp && *p == 'g') { 01575 *p = '\0'; 01576 ch = (p + 1); 01577 break; 01578 } else if (*p == 'w') { 01579 sp = (p + 1); 01580 } 01581 } 01582 01583 if(ch && sp) { 01584 *span = atoi(sp); 01585 *chan = atoi(ch); 01586 ret = 1; 01587 } else { 01588 *span = -1; 01589 *chan = -1; 01590 } 01591 } 01592 01593 return ret; 01594 }

| 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.
| fd | device file descriptor | |
| tdm_api | tdm api command structure | |
| power | value of power |
Definition at line 2276 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.
02277 { 02278 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02279 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02280 tdm_api->wp_cmd.cmd = WP_API_CMD_SET_POWER_LEVEL; 02281 tdm_api->wp_cmd.power_level = power; 02282 return sangoma_cmd_exec(fd,tdm_api); 02283 }

| int _LIBSNG_CALL sangoma_tdm_get_power_level | ( | sng_fd_t | fd, | |
| wanpipe_api_t * | tdm_api | |||
| ) |
Get Configured Power Level.
| fd | device file descriptor | |
| tdm_api | tdm api command structure |
Definition at line 2291 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.
02292 { 02293 int err; 02294 02295 WANPIPE_API_INIT_CHAN(tdm_api, 0); 02296 SANGOMA_INIT_TDM_API_CMD_RESULT(*tdm_api); 02297 tdm_api->wp_cmd.cmd = WP_API_CMD_GET_POWER_LEVEL; 02298 02299 err=sangoma_cmd_exec(fd,tdm_api); 02300 if (err){ 02301 return err; 02302 } 02303 02304 return tdm_api->wp_cmd.power_level; 02305 }

| 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.
| device_name | Sangoma 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. |
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. |
Definition at line 215 of file libsangoma_hwec.c.
References SANG_STATUS_FAILED_ALLOCATE_MEMORY, and SANG_STATUS_SUCCESS.
00216 { 00217 sangoma_status_t rc = SANG_STATUS_SUCCESS; 00218 wanec_api_config_t config; 00219 00220 memset(&config, 0x00, sizeof(config)); 00221 00222 if (number_of_custom_params >= 1 && number_of_custom_params <= 4) { 00223 00224 wan_custom_param_t *custom_parms_ptr; 00225 unsigned int i, custom_params_memory_size; 00226 00227 custom_params_memory_size = sizeof(wan_custom_param_t) * number_of_custom_params; 00228 00229 /* Do NOT change memory at custom_params[] (it belongs to the caller). 00230 * Instead allocate temporary buffer, and use information in custom_params[] 00231 * for proper initialization the temproary buffer and 00232 * and send if down to API driver. */ 00233 custom_parms_ptr = malloc(custom_params_memory_size); 00234 if (!custom_parms_ptr) { 00235 return SANG_STATUS_FAILED_ALLOCATE_MEMORY; 00236 } 00237 00238 memset(custom_parms_ptr, 0x00, custom_params_memory_size); 00239 00240 for (i = 0; i < number_of_custom_params; i++) { 00241 00242 strcpy( custom_parms_ptr[i].name, custom_params[i].name ); 00243 00244 if (sangoma_hwec_is_numeric_parameter(custom_params[i].name)) { 00245 custom_parms_ptr[i].dValue = atoi(custom_params[i].sValue); 00246 } else { 00247 strcpy(custom_parms_ptr[i].sValue, custom_params[i].sValue); 00248 } 00249 } /* for() */ 00250 00251 config.conf.param_no = number_of_custom_params; 00252 config.conf.params = custom_parms_ptr; 00253 00254 }/* if() */ 00255 00256 /* Load firmware on EC chip AND apply configuration, if any. */ 00257 rc = wanec_api_config( device_name, libsng_hwec_verbosity_level, &config ); 00258 00259 if (config.conf.params) { 00260 free(config.conf.params); 00261 } 00262 00263 return rc; 00264 }
| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Note that wanpipe1_if1 and wanpipe1_if2 will access the same Port - wanpipe1. Linux: wanpipe1, wanpipe2... |
Definition at line 283 of file libsangoma_hwec.c.
00284 { 00285 sangoma_status_t rc; 00286 wanec_api_release_t release; 00287 00288 memset(&release, 0, sizeof(wanec_api_release_t)); 00289 00290 rc = wanec_api_release( device_name, libsng_hwec_verbosity_level, &release ); 00291 00292 return rc; 00293 }
| 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.
| mode | One 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_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 298 of file libsangoma_hwec.c.
Referenced by sangoma_hwec_config_power_off(), and sangoma_hwec_config_power_on().
00299 { 00300 sangoma_status_t rc; 00301 wanec_api_opmode_t opmode; 00302 00303 memset(&opmode, 0, sizeof(wanec_api_opmode_t)); 00304 00305 opmode.mode = mode; 00306 opmode.fe_chan_map = fe_chan_map; 00307 00308 /* modes are: 00309 WANEC_API_OPMODE_NORMAL, 00310 WANEC_API_OPMODE_HT_FREEZE, 00311 WANEC_API_OPMODE_HT_RESET, 00312 WANEC_API_OPMODE_POWER_DOWN, 00313 WANEC_API_OPMODE_NO_ECHO, 00314 WANEC_API_OPMODE_SPEECH_RECOGNITION. 00315 */ 00316 rc = wanec_api_opmode(device_name, libsng_hwec_verbosity_level, &opmode); 00317 00318 return rc; 00319 }

| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 338 of file libsangoma_hwec.c.
References sangoma_hwec_config_operation_mode().
00339 { 00340 return sangoma_hwec_config_operation_mode(device_name, WANEC_API_OPMODE_NORMAL, fe_chan_map); 00341 }

| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 361 of file libsangoma_hwec.c.
References sangoma_hwec_config_operation_mode().
00362 { 00363 return sangoma_hwec_config_operation_mode(device_name, WANEC_API_OPMODE_POWER_DOWN, fe_chan_map); 00364 }

| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 389 of file libsangoma_hwec.c.
| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 416 of file libsangoma_hwec.c.
| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| parameter | Echo Cancellation 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
| parameter_value | channel parameter value, listed under "Channel parameter value" | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| parameter | Echo Cancellation 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
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. |
Definition at line 464 of file libsangoma_hwec.c.
References sangoma_hwec_initialize_custom_parameter_structure().
00465 { 00466 sangoma_status_t rc; 00467 wanec_api_modify_t channelModify; 00468 wan_custom_param_t custom_param; 00469 00470 memset(&channelModify, 0x00, sizeof(channelModify)); 00471 00472 sangoma_hwec_initialize_custom_parameter_structure(&custom_param, parameter, parameter_value); 00473 00474 channelModify.fe_chan_map = channel_map; 00475 channelModify.conf.param_no = 1; 00476 channelModify.conf.params = &custom_param; 00477 00478 rc = wanec_api_modify( device_name, libsng_hwec_verbosity_level, &channelModify ); 00479 00480 return rc; 00481 }

| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| tone_id | See wanpipe_api_iface.h for list of valid tones | |
| enable | A flag, if 1 - the specified tone will be detected, if 0 - specified tone will not be detected. | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. | |
| port_map | Port of tone detection - Rx, Tx. See wanpipe_events.h for list of valid ports (WAN_EC_CHANNEL_PORT_SOUT...). |
Definition at line 505 of file libsangoma_hwec.c.
00506 { 00507 sangoma_status_t rc; 00508 wanec_api_tone_t tone; 00509 00510 memset(&tone, 0, sizeof(wanec_api_tone_t)); 00511 00512 tone.id = tone_id; 00513 tone.enable = enable; 00514 tone.fe_chan_map = fe_chan_map; 00515 tone.port_map = port_map; 00516 tone.type_map = WAN_EC_TONE_PRESENT | WAN_EC_TONE_STOP; 00517 00518 rc = wanec_api_tone( device_name, libsng_hwec_verbosity_level, &tone ); 00519 00520 return rc; 00521 }
| 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.
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| full | Flag to read full statistics, if set to 1. | |
| fe_chan | Channel 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. |
| device_name | Sangoma API device name. Windows: wanpipe1_if1, wanpipe2_if1... Linux: wanpipe1, wanpipe2... | |
| full | Flag to read full statistics, if set to 1. | |
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will read statistics. |
Definition at line 541 of file libsangoma_hwec.c.
00542 { 00543 sangoma_status_t rc; 00544 wanec_api_stats_t stats; 00545 00546 memset(&stats, 0, sizeof(wanec_api_stats_t)); 00547 00548 stats.full = full; 00549 stats.fe_chan = fe_chan; 00550 stats.reset = 0; /* do not reset */ 00551 00552 rc = wanec_api_stats( device_name, libsng_hwec_verbosity_level, &stats ); 00553 00554 return rc; 00555 }
| 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.
| filename | name of the audio file (without the extension). Actual file must have .pcm extension. Location: Windows: SystemRoot% (ex: c:) Linux: /etc/wanpipe/buffers | |
| out_buffer_id | when the buffer is loaded on the chip, it is assigned an ID. This ID should be used when requesting to play out the buffer. |
| buffer | Pointer to in memory buffer to be loaded on the chip. | |
| size | Size of buffer. | |
| out_buffer_id | when the buffer is loaded on the chip, it is assigned an ID. This ID should be used when requesting to play out the buffer. |
Definition at line 574 of file libsangoma_hwec.c.
References SANG_STATUS_SUCCESS.
00575 { 00576 sangoma_status_t rc; 00577 wanec_api_bufferload_t bufferload; 00578 00579 memset(&bufferload, 0, sizeof(wanec_api_bufferload_t)); 00580 *out_buffer_id = -1; 00581 00582 bufferload.buffer = filename; 00583 bufferload.pcmlaw = pcmlaw; 00584 00585 rc = wanec_api_buffer_load( device_name, libsng_hwec_verbosity_level, &bufferload ); 00586 if( rc ) { 00587 return rc; 00588 } 00589 00590 *out_buffer_id = bufferload.buffer_id; 00591 00592 return SANG_STATUS_SUCCESS; 00593 }
| 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().
| fe_chan_map | Bitmap of channels (timeslots for Digital, lines for Analog) where the call will take effect. | |
| port_map | Port 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_id | ID of the buffer which will be unloaded. The ID must be initialized by sangoma_hwec_audio_bufferload(). | |
| start | If 1 - start the play out, 0 - stop the play out | |
| repeat_cnt | Number of times to play out the same buffer | |
| duration | Maximum 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. |
Definition at line 677 of file libsangoma_hwec.c.
00680 { 00681 sangoma_status_t rc; 00682 wanec_api_playout_t playout; 00683 00684 memset(&playout, 0, sizeof(wanec_api_playout_t)); 00685 00686 playout.start = start; 00687 playout.fe_chan = fe_chan_map; 00688 playout.buffer_id = in_buffer_id; 00689 playout.port = port; 00690 playout.notifyonstop = 1; 00691 playout.user_event_id = 0xA5; /* dummy value */ 00692 playout.repeat_cnt = repeat_cnt; 00693 playout.duration = (duration) ? duration : cOCT6100_INVALID_VALUE; /* default is no duration */ 00694 00695 rc = wanec_api_playout( device_name, libsng_hwec_verbosity_level, &playout); 00696 00697 return rc; 00698 }
| 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.
| verbosity_level | Valid values are from 0 to 3. |
| verbosity_level | Valid values are from 0 to 3. |
Definition at line 712 of file libsangoma_hwec.c.
References SANG_STATUS_INVALID_PARAMETER, and SANG_STATUS_SUCCESS.
00713 { 00714 if (verbosity_level >= 0 || verbosity_level <= 3) { 00715 libsng_hwec_verbosity_level = verbosity_level; 00716 wanec_api_set_lib_verbosity(verbosity_level); 00717 return SANG_STATUS_SUCCESS; 00718 } 00719 return SANG_STATUS_INVALID_PARAMETER; 00720 }
| 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.
| parameter_name | Parameter Name | |
| parameter_value | Parameter Value |
Definition at line 166 of file libsangoma_hwec.c.
Referenced by sangoma_hwec_config_channel_parameter().
00167 { 00168 memset(custom_param, 0x00, sizeof(*custom_param)); 00169 00170 strncpy( custom_param->name, parameter_name, sizeof(custom_param->name) ); 00171 00172 if (sangoma_hwec_is_numeric_parameter(parameter_name)) { 00173 custom_param->dValue = atoi(parameter_value); 00174 } else { 00175 strncpy(custom_param->sValue, parameter_value, sizeof(custom_param->sValue)); 00176 } 00177 }

| 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.
| fd | device file descriptor | |
| hwec_api_return_code | will contain one of WAN_EC_API_RC_x codes which are defined in wanec_iface_api.h | |
| wanec_chip_stats | structure will be filled with HWEC channel statistics. | |
| verbose | Flag indicating to the Driver to print additional information about the command into Wanpipe Log file. | |
| reset | Flag to reset (flush) global statistics to zero, if set to 1. |
Definition at line 793 of file libsangoma_hwec.c.
References SANG_STATUS_SUCCESS.
00795 { 00796 00797 sangoma_status_t err; 00798 wan_ec_api_t ec_api; 00799 00800 memset(&ec_api, 0x00, sizeof(ec_api)); 00801 00802 ec_api.cmd = WAN_EC_API_CMD_STATS_FULL; 00803 00804 ec_api.verbose = verbose; 00805 00806 /* indicate to Driver to get chip stats, not channel stats, by setting fe_chan_map to zero */ 00807 ec_api.fe_chan_map = 0; 00808 00809 /* user may want to reset (clear) Chip statistics */ 00810 ec_api.u_chip_stats.reset = reset; 00811 00812 err = sangoma_hwec_ioctl(fd, &ec_api); 00813 if (err) { 00814 /* error in IOCTL */ 00815 return err; 00816 } 00817 00818 /* copy stats from driver buffer to user buffer */ 00819 memcpy(wanec_chip_stats, &ec_api.u_chip_stats, sizeof(*wanec_chip_stats)); 00820 00821 *hwec_api_return_code = ec_api.err; 00822 00823 return SANG_STATUS_SUCCESS; 00824 00825 }
| 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.
| fd | device file descriptor | |
| hwec_api_return_code | will contain one of WAN_EC_API_RC_x codes which are defined in wanec_iface_api.h | |
| wanec_chip_image_t | structure will be filled with HWEC channel statistics. | |
| verbose | Flag indicating to the Driver to print additional information about the command into Wanpipe Log file. |
Definition at line 843 of file libsangoma_hwec.c.
References SANG_STATUS_SUCCESS.
00845 { 00846 sangoma_status_t err; 00847 wan_ec_api_t ec_api; 00848 00849 memset(&ec_api, 0x00, sizeof(ec_api)); 00850 00851 ec_api.cmd = WAN_EC_API_CMD_STATS_IMAGE; 00852 00853 ec_api.verbose = verbose; 00854 00855 /* driver will copy image information into wanec_chip_image->f_ChipImageInfo */ 00856 ec_api.u_chip_image.f_ChipImageInfo = wanec_chip_image->f_ChipImageInfo; 00857 00858 err = sangoma_hwec_ioctl(fd, &ec_api); 00859 if (err) { 00860 /* error in IOCTL */ 00861 return err; 00862 } 00863 00864 *hwec_api_return_code = ec_api.err; 00865 00866 return SANG_STATUS_SUCCESS; 00867 }
1.5.6