libsangoma.c File Reference

Wanpipe API Code Library for Sangoma AFT T1/E1/Analog/BRI/Serial hardware. More...

#include "libsangoma-pvt.h"

Include dependency graph for libsangoma.c:

Go to the source code of this file.

Functions

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.
int _LIBSNG_CALL sangoma_wait_obj_signal (sangoma_wait_obj_t *sng_wait_obj)
 Set wait object to a signaled state.
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.
void _LIBSNG_CALL sangoma_wait_obj_set_context (sangoma_wait_obj_t *sng_wait_obj, void *context)
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_status_t _LIBSNG_CALL sangoma_waitfor_many (sangoma_wait_obj_t *sng_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_waitfor (sangoma_wait_obj_t *sangoma_wait_obj, uint32_t inflags, uint32_t *outflags, int32_t timeout)
int _LIBSNG_CALL sangoma_span_chan_toif (int span, int chan, char *interface_name)
 Convert Span & Chan to interface name.
int _LIBSNG_CALL sangoma_interface_toi (char *interface_name, int *span, int *chan)
 Convert Span & Chan to interface name.
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_span_chan_fromif (char *interface_name, int *span, int *chan)
 Convert Interace Name to Span & Chan.
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_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_span_chan (int span, int chan)
 Open a Device based on Span/Chan values.
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.
int _LIBSNG_CALL sangoma_get_open_cnt (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Get device open count.
sng_fd_t _LIBSNG_CALL sangoma_create_socket_by_name (char *device, char *card)
 Open a device based on a interface and card name.
sng_fd_t _LIBSNG_CALL sangoma_open_api_span (int span)
void _LIBSNG_CALL sangoma_close (sng_fd_t *fd)
 Close device file descriptor.
int _LIBSNG_CALL sangoma_readmsg (sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
 Read Data from device.
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_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_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.
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_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_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_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.
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_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_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_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_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_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_txsig_kewl (sng_fd_t fd, wanpipe_api_t *tdm_api)
 Tranmsmit TX SIG KEWL START (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_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_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_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_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_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_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_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_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_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_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.
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.

Variables

int libsng_dbg_level = 0


Detailed Description

Wanpipe API Code Library for Sangoma AFT T1/E1/Analog/BRI/Serial 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

Definition in file libsangoma.c.


Function Documentation

sangoma_status_t sangoma_wait_obj_create ( sangoma_wait_obj_t **  sangoma_wait_object,
sng_fd_t  fd,
sangoma_wait_obj_type_t  object_type 
)

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

Device POLL Functions

Parameters:
sangoma_wait_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
See also:
sangoma_wait_obj_type_t
Returns:
SANG_STATUS_SUCCESS: success, or error status
Parameters:
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
See also:
sangoma_wait_obj_type_t
Returns:
SANG_STATUS_SUCCESS: success, or error status

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

sangoma_status_t sangoma_wait_obj_delete ( sangoma_wait_obj_t **  sangoma_wait_object  ) 

De-allocate all resources in a wait object.

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

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

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sangoma_wait_obj_signal ( sangoma_wait_obj_t *  sangoma_wait_object  ) 

Set wait object to a signaled state.

Parameters:
sangoma_wait_object pointer a single device object that can be signaled
Returns:
sangoma_status_t

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 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.

Parameters:
sangoma_wait_object pointer a single device object
Returns:
sng_fd_t - device file descriptor

Definition at line 1370 of file libsangoma.c.

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

01371 {
01372     return sng_wait_obj->fd;
01373 }

Here is the caller graph for this function:

PVOID 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.

Parameters:
sangoma_wait_object pointer a single device object
Returns:
void*
Windows note: must use return type PVOID instead of void* to satisfy WDK compiler.
Parameters:
sangoma_wait_object pointer a single device object
Returns:
void*

Definition at line 1394 of file libsangoma.c.

Referenced by cleanup(), and write_data().

01395 {
01396     return sng_wait_obj->context;
01397 }

Here is the caller graph for this function:

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

Convert Span & Chan to interface name.

Device OPEN / CLOSE Functions

Parameters:
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
Returns:
non-zero = error, 0 = ok

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 sangoma_interface_toi ( char *  interface_name,
int *  span,
int *  chan 
)

Convert Span & Chan to interface name.

Parameters:
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
Returns:
non-zero = error, 0 = ok Deprecated - here for backward compatibility

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 }

Here is the caller graph for this function:

int sangoma_interface_wait_up ( int  span,
int  chan,
int  sectimeout 
)

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

Parameters:
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
Returns:
non-zero = error, 0 = ok

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 sangoma_span_chan_fromif ( char *  interface_name,
int *  span,
int *  chan 
)

Convert Interace Name to Span & Chan.

Parameters:
interface_name pointer to string containing interface name
span integer pointer where to write span value
chan integer pointer where to write chan value
Returns:
non-zero = error, 0 = ok

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 }

sng_fd_t sangoma_open_api_span_chan ( int  span,
int  chan 
)

Open a Device based on Span/Chan values.

Device OPEN / CLOSE Functions

Parameters:
span span number starting from 1 to 255
chan chan number starting from 1 to 32
Returns:
File Descriptor: -1 error, 0 or positive integer: valid file descriptor
Restriced open, device will allowed to be open only once.

Definition at line 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 }            

Here is the call graph for this function:

Here is the caller graph for this function:

sng_fd_t sangoma_open_dev_by_name ( const char *  dev_name  ) 

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

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

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 }

Here is the caller graph for this function:

sng_fd_t __sangoma_open_api_span_chan ( int  span,
int  chan 
)

Open a Device based on Span/Chan values.

Parameters:
span span number starting from 1 to 255
chan chan number starting from 1 to 32
Returns:
File Descriptor: -1 error, 0 or positive integer: valid file descriptor
Unrestriced open, allows mutiple open calls on a single device

Definition at line 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 }            

Here is the call graph for this function:

Here is the caller graph for this function:

sng_fd_t sangoma_open_api_ctrl ( void   ) 

Open a Global Control Device.

Returns:
File Descriptor - negative=error 0 or greater = fd
The global control device receives events for all devices configured.

Definition at line 1738 of file libsangoma.c.

References sangoma_open_dev_by_name().

01739 {
01740     return sangoma_open_dev_by_name(WP_CTRL_DEV_NAME);
01741 }

Here is the call graph for this function:

sng_fd_t sangoma_logger_open ( void   ) 

Open a Global Logger Device.

Returns:
File Descriptor - negative=error 0 or greater = fd
The global Logger device receives Logger Events for all devices configured.

Definition at line 1744 of file libsangoma.c.

References sangoma_open_dev_by_name().

01745 {
01746     return sangoma_open_dev_by_name(WP_LOGGER_DEV_NAME);
01747 }

Here is the call graph for this function:

int sangoma_get_open_cnt ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get device open count.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
negative or 0: error, greater than 1 : open count

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 }

Here is the call graph for this function:

sng_fd_t sangoma_create_socket_by_name ( char *  device,
char *  card 
)

Open a device based on a interface and card name.

Parameters:
device interface name
card card name
Returns:
File Descriptor: -1 error, 0 or positive integer: valid file descriptor
Deprecated - here for backward compatibility

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 }

Here is the call graph for this function:

void sangoma_close ( sng_fd_t fd  ) 

Close device file descriptor.

Parameters:
fd device file descriptor
Returns:
void

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 }

Here is the caller graph for this function:

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

Read Data from device.

Device READ / WRITE Functions

Parameters:
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
Returns:
received size, must be equal to datalen, anything else is error or busy
In case of error return code, one must check the header operation_status variable to identify the reason of error. Please refer to the error codes.

Definition at line 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 }                    

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

Write Data to device.

Device READ / WRITE Functions

Parameters:
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
Returns:
transmit size, must be equal to datalen, anything else is error
In case of error return code, one must check the header operation_status variable to identify the reason of an error. Please refer to the error codes.

Definition at line 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 }

Here is the caller graph for this function:

int sangoma_cmd_exec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Execute Sangoma API Command.

Device API COMMAND Functions

Device API COMMAND Functions

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 sangoma_get_full_cfg ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Read tdm api device configuration.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Set TDM Codec per chan.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
codec codec to set (ulaw/alaw/slinear)
Returns:
non-zero: error, 0: ok
Deprecated Function - Here for backward compatibility Only valid in CHAN Operation Mode

Definition at line 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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_get_codec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Configured TDM Codec per chan.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
negative: error or configured codec value
Deprecated Function - Here for backward compatibility Only valid in CHAN Operation Mode

Definition at line 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 }

Here is the call graph for this function:

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

Set Tx/Rx Period in Milliseconds.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
period value in miliseconds (1,2,5,10)
Returns:
non-zero: error, 0: ok
Only valid in CHAN Operation Mode

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_get_usr_period ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx/Rx Period in Milliseconds.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
negative: error or configured period value

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 }

Here is the call graph for this function:

int sangoma_get_hw_coding ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get HW Voice Coding (ulaw/alaw).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
the low level voice coding, depending on configuration. (WP_MULAW or WP_ALAW)

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 }

Here is the call graph for this function:

int sangoma_tdm_get_hw_dtmf ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hwdtmf support is available.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
This function will check if hw supports HW DTMF.

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 }

Here is the call graph for this function:

int sangoma_tdm_get_hw_ec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hw echo cancelation support is available.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: disable, >0:enabled
This function will check if hw supports HW EC.

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 }

Here is the call graph for this function:

int sangoma_tdm_get_hwec_chan_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Check if hw echo cancelation is enabled on current timeslot.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: disabled, >0: enabled
This function will check if hw echo cancelation is enable on current timeslot.

Definition at line 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 }

Here is the call graph for this function:

int sangoma_tdm_get_hwec_persist_status ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: disabled, >0: enabled
This function will check if hw persist mode is enabled.

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 }     

Here is the call graph for this function:

int sangoma_tdm_get_usr_mtu_mru ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx/Rx MTU/MRU in bytes.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
negative: error or configured mtu/mru in bytes

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 }

Here is the call graph for this function:

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

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
power value of power
Returns:
non-zero: error, 0: ok
Deprecated - not used/implemented

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 }

Here is the call graph for this function:

int sangoma_tdm_get_power_level ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Configured Power Level.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
negative: error or configured power level
Deprecated - not used/implemented

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 }

Here is the call graph for this function:

int sangoma_flush_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_flush_rx_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only rx buffers from current channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

int sangoma_flush_tx_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only tx buffers from current channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 } 

Here is the call graph for this function:

int sangoma_flush_event_bufs ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush only event buffers from current channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }  

Here is the call graph for this function:

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

Enable RBS Events on a device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
poll_in_sec driver poll period for rbs events
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_disable_rbs_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RBS Events for a device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Write RBS Bits on a device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
channel t1/e1 timeslot
rbs rbs bits (ABCD)
Returns:
non-zero: error, 0: ok

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 }        

Here is the call graph for this function:

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

Read RBS Bits on a device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
channel t1/e1 timeslot
rbs pointer to rbs bits (ABCD)
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

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

Set voice tx/rx buffer multiplier.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
multiplier buffer multiplier value 0-disable or 1 to TDMAPI_MAX_BUFFER_MULTIPLIER
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_read_event ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Read API Events.

Device EVENT Function

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
The TDM API structure will be populated with a TDM API or WAN Event. This function usually used after wait() function indicated that event has occured.

Definition at line 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 }  

Here is the call graph for this function:

Here is the caller graph for this function:

sangoma_status_t sangoma_logger_read_event ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Read Wanpipe Logger Events.

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error
The Logger API structure will be populated with a Logger Event. This function usually used after wait() function indicated that an event has occured.

Definition at line 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 sangoma_logger_flush_buffers ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Flush Wanpipe Logger internal buffers.

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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 sangoma_logger_get_statistics ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Get Wanpipe Logger statistics.

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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 sangoma_logger_reset_statistics ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

Reset Wanpipe Logger statistics.

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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 sangoma_logger_get_open_handle_counter ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

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

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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 sangoma_logger_get_logger_level ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

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

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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 sangoma_logger_set_logger_level ( sng_fd_t  fd,
wp_logger_cmd_t *  logger_cmd 
)

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

Parameters:
fd device file descriptor
logger_cmd Logger API command structure
Returns:
SANG_STATUS_SUCCESS: ok, else: error

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_tdm_enable_fax_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_fax_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

int sangoma_tdm_get_hw_fax ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: Disabled, 1: Enabled
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

int sangoma_tdm_enable_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_disable_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_enable_rm_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable DTMF Detection on Analog/Remora SLIC Chip.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_disable_rm_dtmf_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable DTMF Detection on Analog/Remora SLIC Chip.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_enable_rxhook_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RX HOOK Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_disable_rxhook_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RX HOOK Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_tdm_enable_ring_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_ring_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_enable_ring_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING DETECT Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_ring_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING DETECT Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_enable_ring_trip_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable RING TRIP Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_ring_trip_detect_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable RING TRIP Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_txsig_kewl ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG KEWL START (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_txsig_start ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG START (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_txsig_onhook ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG ON HOOK (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_txsig_offhook ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Tranmsmit TX SIG OFF HOOK (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

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

Transmit a TONE on this device (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
tone_id tone type to transmit
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_tone_events ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable TONE Events (Analog Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on Analog Cards

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 }

Here is the call graph for this function:

int sangoma_tdm_enable_hwec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Enable HWEC on this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

int sangoma_tdm_disable_hwec ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable HWEC on this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok
Supported only on cards that have HWEC

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 }

Here is the call graph for this function:

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

Get Front End Alarms (T1/E1 Only).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
alarms bit map status of T1/E1 alarms
Returns:
non-zero: error, 0: ok
Supported only on T1/E1 Cards

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 }         

Here is the call graph for this function:

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

Get Device Link Status (Connected/Disconnected).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
current_status pointer where result will be filled: 0=Link UP 1=Link Down
Returns:
non-zero: error, 0: ok -> check current_status
Deprecated - replaced by sangoma_tdm_get_link_status function

Definition at line 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 }

Here is the call graph for this function:

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

Get Device Link Status (Connected/Disconnected).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
current_status pointer where result will be filled: 0=Link UP 1=Link Down
Returns:
non-zero: error, 0: ok -> check current_status

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 }

Here is the call graph for this function:

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

Set Device Link Status (Connected/Disconnected).

Parameters:
fd device file descriptor
tdm_api tdm api command structure
new_status new status 0=Link UP 1=Link Down
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

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

Disable BRI Bchannel loopback - used when debugging bri device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
channel bri bchannel 1 or 2
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

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

Enable BRI Bchannel loopback - used when debugging bri device.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
channel bri bchannel 1 or 2
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

int sangoma_get_tx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Tx Queue Size for this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Get Tx Queue Size for this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
size tx queue size (minimum value of 1)
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_get_rx_queue_sz ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Get Rx Queue Size for this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Get Tx Queue Size for this channel.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
size rx queue size (minimum value of 1)
Returns:
non-zero: error, 0: ok

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sangoma_get_driver_version ( sng_fd_t  fd,
wanpipe_api_t tdm_api,
wan_driver_version_t *  drv_ver 
)

Get Device Driver Version Number.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
drv_ver driver version structure that will contain the driver version
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

Get Hardware/Firmware Version.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
ver hardware/firmware version number
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

Get AFT CPLD Version.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
ver AFT CPLD version number
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

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

Parameters:
fd device file descriptor
out_customer_id AFT Customer ID
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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.

Parameters:
fd device file descriptor
led_state 0=off 1=on
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

Write to a front end register.

Parameters:
fd device file descriptor
offset offset of front end register
data value to write
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

Read front end register.

Parameters:
fd device file descriptor
offset offset of front end register
data value of the read register
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

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

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

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 }

Here is the call graph for this function:

int _LIBSNG_CALL sangoma_flush_stats ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Flush/Reset device statistics.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

Set rxflashtime for FXS module Wink-Flash Event.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
rxflashtime time value
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

set tx gain for FXO/FXS module

Parameters:
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)
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

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

set rx gain for FXO/FXS module

Parameters:
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)
Returns:
non-zero = error, 0 = ok

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 }

Here is the call graph for this function:

int sangoma_tdm_enable_loop ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

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

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero = error, 0 = ok

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 }      

Here is the call graph for this function:

int sangoma_tdm_disable_loop ( sng_fd_t  fd,
wanpipe_api_t tdm_api 
)

Disable channel loop.

Parameters:
fd device file descriptor
tdm_api tdm api command structure
Returns:
non-zero = error, 0 = ok

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 }      

Here is the call graph for this function:


Generated on Wed Jun 1 17:30:38 2011 for libsangoma by  doxygen 1.5.6