fix windows compilation
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@1066 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
1caf72ed86
commit
d875a8ae78
|
@ -3107,7 +3107,7 @@ SWITCH_STANDARD_API(oz_function)
|
|||
zap_channel_command(span->channels[chan_id], ZAP_COMMAND_SET_RX_GAIN, &rxgain);
|
||||
zap_channel_command(span->channels[chan_id], ZAP_COMMAND_SET_TX_GAIN, &txgain);
|
||||
} else {
|
||||
for (i = 1; i < span->chan_count; i++) {
|
||||
for (i = 1; i < (int)span->chan_count; i++) {
|
||||
zap_channel_command(span->channels[i], ZAP_COMMAND_SET_RX_GAIN, &rxgain);
|
||||
zap_channel_command(span->channels[i], ZAP_COMMAND_SET_TX_GAIN, &txgain);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,11 @@
|
|||
#define ZAP_TYPES_H
|
||||
#include "fsk.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define ZAP_INVALID_SOCKET INVALID_HANDLE_VALUE
|
||||
#else
|
||||
#define ZAP_INVALID_SOCKET -1
|
||||
#endif
|
||||
#define zap_array_len(obj) sizeof(obj)/sizeof(obj[0])
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -572,7 +572,7 @@ OZ_DECLARE(zap_status_t) zap_span_load_tones(zap_span_t *span, const char *mapna
|
|||
static void reset_gain_table(unsigned char *gain_table, float new_gain, zap_codec_t codec_gain)
|
||||
{
|
||||
/* sample value */
|
||||
unsigned sv = 0;
|
||||
uint8_t sv = 0;
|
||||
/* linear gain factor */
|
||||
float lingain = 0;
|
||||
/* linear value for each table sample */
|
||||
|
@ -590,7 +590,7 @@ static void reset_gain_table(unsigned char *gain_table, float new_gain, zap_code
|
|||
/* for a 0.0db gain table, each alaw/ulaw sample value is left untouched (0 ==0, 1 == 1, 2 == 2 etc)*/
|
||||
sv = 0;
|
||||
while (1) {
|
||||
gain_table[sv] = sv;
|
||||
gain_table[sv] = (unsigned char)sv;
|
||||
if (sv == (ZAP_GAINS_TABLE_SIZE - 1)) {
|
||||
break;
|
||||
}
|
||||
|
@ -600,11 +600,11 @@ static void reset_gain_table(unsigned char *gain_table, float new_gain, zap_code
|
|||
}
|
||||
|
||||
/* use the 20log rule to increase the gain: http://en.wikipedia.org/wiki/Gain, http:/en.wikipedia.org/wiki/20_log_rule#Definitions */
|
||||
lingain = pow(10.0, new_gain/ 20.0);
|
||||
lingain = (float)pow(10.0f, new_gain/20.0f);
|
||||
sv = 0;
|
||||
while (1) {
|
||||
/* get the linear value for this alaw/ulaw sample value */
|
||||
linvalue = codec_gain == ZAP_CODEC_ALAW ? alaw_to_linear(sv) : ulaw_to_linear(sv);
|
||||
linvalue = codec_gain == ZAP_CODEC_ALAW ? (float)alaw_to_linear(sv) : (float)ulaw_to_linear(sv);
|
||||
|
||||
/* multiply the linear value and the previously calculated linear gain */
|
||||
ampvalue = (int)(linvalue * lingain);
|
||||
|
@ -668,8 +668,8 @@ OZ_DECLARE(zap_status_t) zap_span_add_channel(zap_span_t *span, zap_socket_t soc
|
|||
/* set 0.0db gain table */
|
||||
i = 0;
|
||||
while (1) {
|
||||
new_chan->txgain_table[i] = i;
|
||||
new_chan->rxgain_table[i] = i;
|
||||
new_chan->txgain_table[i] = (unsigned char)i;
|
||||
new_chan->rxgain_table[i] = (unsigned char)i;
|
||||
if (i == (sizeof(new_chan->txgain_table)-1)) {
|
||||
break;
|
||||
}
|
||||
|
@ -2736,13 +2736,13 @@ static zap_status_t load_config(void)
|
|||
}
|
||||
} else if (!strncasecmp(var, "cpu_set_alarm_threshold", 22)) {
|
||||
if (atoi(val) > 0 && atoi(val) < 100) {
|
||||
globals.cpu_monitor.set_alarm_threshold = atoi(val);
|
||||
globals.cpu_monitor.set_alarm_threshold = (uint8_t)atoi(val);
|
||||
} else {
|
||||
zap_log(ZAP_LOG_ERROR, "Invalid cpu alarm set threshold %s\n", val);
|
||||
}
|
||||
} else if (!strncasecmp(var, "cpu_reset_alarm_threshold", 22)) {
|
||||
if (atoi(val) > 0 && atoi(val) < 100) {
|
||||
globals.cpu_monitor.reset_alarm_threshold = atoi(val);
|
||||
globals.cpu_monitor.reset_alarm_threshold = (uint8_t)atoi(val);
|
||||
if (globals.cpu_monitor.reset_alarm_threshold > globals.cpu_monitor.set_alarm_threshold) {
|
||||
globals.cpu_monitor.reset_alarm_threshold = globals.cpu_monitor.set_alarm_threshold-10;
|
||||
zap_log(ZAP_LOG_ERROR, "Cpu alarm reset threshold must be lower than set threshold, set threshold to %d\n", globals.cpu_monitor.reset_alarm_threshold);
|
||||
|
@ -3427,6 +3427,7 @@ OZ_DECLARE_NONSTD(zap_status_t) zap_console_stream_write(zap_stream_handle_t *ha
|
|||
|
||||
static void *zap_cpu_monitor_run(zap_thread_t *me, void *obj)
|
||||
{
|
||||
#ifndef WIN32
|
||||
cpu_monitor_t *monitor = (cpu_monitor_t *)obj;
|
||||
struct zap_cpu_monitor_stats *cpu_stats = zap_new_cpu_monitor();
|
||||
if (!cpu_stats) {
|
||||
|
@ -3458,6 +3459,11 @@ static void *zap_cpu_monitor_run(zap_thread_t *me, void *obj)
|
|||
}
|
||||
zap_delete_cpu_monitor(cpu_stats);
|
||||
monitor->running = 0;
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(me);
|
||||
UNREFERENCED_PARAMETER(obj);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,8 +256,8 @@ OZ_DECLARE(zap_status_t) zap_interrupt_create(zap_interrupt_t **ininterrupt, zap
|
|||
|
||||
interrupt->device = device;
|
||||
#ifdef WIN32
|
||||
interrupt->interrupt = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!interrupt->interrupt) {
|
||||
interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!interrupt->event) {
|
||||
zap_log(ZAP_LOG_ERROR, "Failed to allocate interrupt event\n");
|
||||
goto failed;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ OZ_DECLARE(zap_status_t) zap_interrupt_wait(zap_interrupt_t *interrupt, int ms)
|
|||
num++;
|
||||
ints[1] = interrupt->device;
|
||||
}
|
||||
res = WaitForMultipleObjects(num, &ints, FALSE, ms >= 0 ? ms : INFINITE);
|
||||
res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE);
|
||||
switch (res) {
|
||||
case WAIT_TIMEOUT:
|
||||
return ZAP_TIMEOUT;
|
||||
|
@ -360,7 +360,7 @@ OZ_DECLARE(zap_status_t) zap_interrupt_wait(zap_interrupt_t *interrupt, int ms)
|
|||
OZ_DECLARE(zap_status_t) zap_interrupt_signal(zap_interrupt_t *interrupt)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (!SetEvent(interrupt->interrupt)) {
|
||||
if (!SetEvent(interrupt->event)) {
|
||||
zap_log(ZAP_LOG_ERROR, "Failed to signal interrupt\n");
|
||||
return ZAP_FAIL;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ OZ_DECLARE(zap_status_t) zap_interrupt_destroy(zap_interrupt_t **ininterrupt)
|
|||
zap_interrupt_t *interrupt = NULL;
|
||||
interrupt = *ininterrupt;
|
||||
#ifdef WIN32
|
||||
CloseHandle(interrupt->interrupt);
|
||||
CloseHandle(interrupt->event);
|
||||
#else
|
||||
close(interrupt->readfd);
|
||||
close(interrupt->writefd);
|
||||
|
@ -434,6 +434,10 @@ OZ_DECLARE(zap_status_t) zap_interrupt_multiple_wait(zap_interrupt_t *interrupts
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(__WINDOWS__)
|
||||
UNREFERENCED_PARAMETER(interrupts);
|
||||
UNREFERENCED_PARAMETER(size);
|
||||
UNREFERENCED_PARAMETER(ms);
|
||||
#endif
|
||||
return ZAP_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue