Make libtimer to be osmo_* compatible in some places

This commit is contained in:
Andreas Eversberg
2023-01-20 18:03:44 +01:00
parent 3bc3e67abb
commit f4abbaf027
25 changed files with 141 additions and 90 deletions

View File

@@ -1100,20 +1100,20 @@ void call_down_audio(int callref, uint16_t sequence, uint32_t timestamp, uint32_
void call_down_clock(void) {} void call_down_clock(void) {}
/* Timeout handling */ /* Timeout handling */
void transaction_timeout(struct timer *timer) void transaction_timeout(void *data)
{ {
transaction_t *trans = (transaction_t *)timer->priv; transaction_t *trans = data;
amps_t *amps = trans->amps; amps_t *amps = trans->amps;
switch (trans->state) { switch (trans->state) {
case TRANS_CALL_MO_ASSIGN_CONFIRM: case TRANS_CALL_MO_ASSIGN_CONFIRM:
case TRANS_CALL_MT_ASSIGN_CONFIRM: case TRANS_CALL_MT_ASSIGN_CONFIRM:
PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds not receiving initial SAT signal.\n", timer->duration); PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds not receiving initial SAT signal.\n", trans->timer.duration);
PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call towards network.\n"); PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call towards network.\n");
amps_release(amps->trans_list, CAUSE_TEMPFAIL); amps_release(amps->trans_list, CAUSE_TEMPFAIL);
break; break;
case TRANS_CALL: case TRANS_CALL:
PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds loosing SAT signal.\n", timer->duration); PDEBUG_CHAN(DAMPS, DEBUG_NOTICE, "Timeout after %.0f seconds loosing SAT signal.\n", trans->timer.duration);
PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call towards network.\n"); PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Release call towards network.\n");
amps_release(amps->trans_list, CAUSE_TEMPFAIL); amps_release(amps->trans_list, CAUSE_TEMPFAIL);
break; break;

View File

@@ -53,6 +53,6 @@ transaction_t *search_transaction_number(amps_t *amps, uint32_t min1, uint16_t m
transaction_t *search_transaction_callref(amps_t *amps, int callref); transaction_t *search_transaction_callref(amps_t *amps, int callref);
void trans_new_state(transaction_t *trans, int state); void trans_new_state(transaction_t *trans, int state);
void amps_flush_other_transactions(amps_t *amps, transaction_t *trans); void amps_flush_other_transactions(amps_t *amps, transaction_t *trans);
void transaction_timeout(struct timer *timer); void transaction_timeout(void *data);
const char *trans_short_state_name(int state); const char *trans_short_state_name(int state);

View File

@@ -186,7 +186,7 @@ int anetz_init(void)
return 0; return 0;
} }
static void anetz_timeout(struct timer *timer); static void anetz_timeout(void *data);
static void anetz_go_idle(anetz_t *anetz); static void anetz_go_idle(anetz_t *anetz);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
@@ -362,9 +362,9 @@ void anetz_receive_tone(anetz_t *anetz, int tone)
} }
/* Timeout handling */ /* Timeout handling */
static void anetz_timeout(struct timer *timer) static void anetz_timeout(void *data)
{ {
anetz_t *anetz = (anetz_t *)timer->priv; anetz_t *anetz = data;
switch (anetz->state) { switch (anetz->state) {
case ANETZ_ANRUF: case ANETZ_ANRUF:

View File

@@ -150,7 +150,7 @@ int bnetz_init(void)
return 0; return 0;
} }
static void bnetz_timeout(struct timer *timer); static void bnetz_timeout(void *data);
static void bnetz_go_idle(bnetz_t *bnetz); static void bnetz_go_idle(bnetz_t *bnetz);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
@@ -631,9 +631,9 @@ lets see, if noise will not generate a release signal....
} }
/* Timeout handling */ /* Timeout handling */
static void bnetz_timeout(struct timer *timer) static void bnetz_timeout(void *data)
{ {
bnetz_t *bnetz = (bnetz_t *)timer->priv; bnetz_t *bnetz = data;
switch (bnetz->state) { switch (bnetz->state) {
case BNETZ_WAHLABRUF: case BNETZ_WAHLABRUF:

View File

@@ -835,9 +835,9 @@ const char *chan_type_long_name(enum cnetz_chan_type chan_type)
} }
/* Timeout handling */ /* Timeout handling */
void transaction_timeout(struct timer *timer) void transaction_timeout(void *data)
{ {
transaction_t *trans = (transaction_t *)timer->priv; transaction_t *trans = data;
cnetz_t *cnetz = trans->cnetz; cnetz_t *cnetz = trans->cnetz;
switch (trans->state) { switch (trans->state) {

View File

@@ -85,9 +85,9 @@ static void remove_db(cnetz_db_t *db)
} }
/* Timeout handling */ /* Timeout handling */
static void db_timeout(struct timer *timer) static void db_timeout(void *data)
{ {
cnetz_db_t *db = (cnetz_db_t *)timer->priv; cnetz_db_t *db = data;
int rc; int rc;
PDEBUG(DDB, DEBUG_INFO, "Check, if subscriber '%d,%d,%05d' is still available.\n", db->futln_nat, db->futln_fuvst, db->futln_rest); PDEBUG(DDB, DEBUG_INFO, "Check, if subscriber '%d,%d,%05d' is still available.\n", db->futln_nat, db->futln_fuvst, db->futln_rest);

View File

@@ -71,6 +71,6 @@ transaction_t *search_transaction_callref(cnetz_t *cnetz, int callref);
transaction_t *search_transaction_queue(void); transaction_t *search_transaction_queue(void);
void trans_new_state(transaction_t *trans, uint64_t state); void trans_new_state(transaction_t *trans, uint64_t state);
void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans); void cnetz_flush_other_transactions(cnetz_t *cnetz, transaction_t *trans);
void transaction_timeout(struct timer *timer); void transaction_timeout(void *data);
const char *trans_short_state_name(uint64_t state); const char *trans_short_state_name(uint64_t state);

View File

@@ -1066,16 +1066,16 @@ static void handle_state(am791x_t *am791x)
} }
/* timeout events */ /* timeout events */
static void tx_timeout(struct timer *timer) static void tx_timeout(void *data)
{ {
am791x_t *am791x = (am791x_t *)timer->priv; am791x_t *am791x = data;
handle_tx_state(am791x); handle_tx_state(am791x);
} }
static void rx_timeout(struct timer *timer) static void rx_timeout(void *data)
{ {
am791x_t *am791x = (am791x_t *)timer->priv; am791x_t *am791x = data;
handle_rx_state(am791x); handle_rx_state(am791x);
} }

View File

@@ -1257,9 +1257,9 @@ void sighandler(int sigset)
} }
/* vtimer */ /* vtimer */
static void vtime_timeout(struct timer *timer) static void vtime_timeout(void *data)
{ {
datenklo_t *datenklo = (datenklo_t *)timer->priv; datenklo_t *datenklo = data;
/* check if there is enough data to read */ /* check if there is enough data to read */
datenklo->vtimeout = 1; datenklo->vtimeout = 1;

View File

@@ -234,7 +234,7 @@ void euro_exit(void)
flush_id(); flush_id();
} }
static void call_timeout(struct timer *timer); static void call_timeout(void *data);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int euro_create(const char *kanal, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int fm, int tx, int rx, int repeat, int degraded, int random, uint32_t scan_from, uint32_t scan_to, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback) int euro_create(const char *kanal, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int fm, int tx, int rx, int repeat, int degraded, int random, uint32_t scan_from, uint32_t scan_to, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback)
@@ -549,9 +549,9 @@ void call_down_clock(void)
} }
/* Timeout handling */ /* Timeout handling */
static void call_timeout(struct timer *timer) static void call_timeout(void *data)
{ {
euro_call_t *call = (euro_call_t *)timer->priv; euro_call_t *call = data;
switch (call->state) { switch (call->state) {
case EURO_CALL_ANSWER: case EURO_CALL_ANSWER:

View File

@@ -591,9 +591,9 @@ static void destroy_transaction(transaction_t *trans)
} }
/* Timeout handling */ /* Timeout handling */
void trans_timeout(struct timer *timer) void trans_timeout(void *data)
{ {
transaction_t *trans = (transaction_t *)timer->priv; transaction_t *trans = data;
PDEBUG(DTRANS, DEBUG_NOTICE, "Releasing transaction due to timeout.\n"); PDEBUG(DTRANS, DEBUG_NOTICE, "Releasing transaction due to timeout.\n");
if (trans->callref) if (trans->callref)

View File

@@ -283,7 +283,7 @@ int imts_init(void)
return 0; return 0;
} }
static void imts_timeout(struct timer *timer); static void imts_timeout(void *data);
static void imts_go_idle(imts_t *imts); static void imts_go_idle(imts_t *imts);
static void imts_paging(imts_t *imts, const char *dial_string, int loopback); static void imts_paging(imts_t *imts, const char *dial_string, int loopback);
static void imts_detector_test(imts_t *imts, double length_1, double length_2, double length_3); static void imts_detector_test(imts_t *imts, double length_1, double length_2, double length_3);
@@ -899,9 +899,9 @@ static void page_after_digit(imts_t *imts)
} }
/* Timeout handling */ /* Timeout handling */
static void imts_timeout(struct timer *timer) static void imts_timeout(void *data)
{ {
imts_t *imts = (imts_t *)timer->priv; imts_t *imts = data;
switch (imts->state) { switch (imts->state) {
case IMTS_IDLE: case IMTS_IDLE:

View File

@@ -204,8 +204,8 @@ static void jolly_new_state(jolly_t *jolly, enum jolly_state new_state)
jolly_display_status(); jolly_display_status();
} }
static void jolly_timeout(struct timer *timer); static void jolly_timeout(void *data);
static void jolly_speech_timeout(struct timer *timer); static void jolly_speech_timeout(void *data);
static void jolly_go_idle(jolly_t *jolly); static void jolly_go_idle(jolly_t *jolly);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
@@ -425,9 +425,9 @@ void jolly_receive_dtmf(void *priv, char digit, dtmf_meas_t *meas)
} }
/* Timeout handling */ /* Timeout handling */
static void jolly_timeout(struct timer *timer) static void jolly_timeout(void *data)
{ {
jolly_t *jolly = (jolly_t *)timer->priv; jolly_t *jolly = data;
switch (jolly->state) { switch (jolly->state) {
case STATE_OUT_DIALING: case STATE_OUT_DIALING:
@@ -453,9 +453,9 @@ static void jolly_timeout(struct timer *timer)
} }
} }
static void jolly_speech_timeout(struct timer *timer) static void jolly_speech_timeout(void *data)
{ {
jolly_t *jolly = (jolly_t *)timer->priv; jolly_t *jolly = data;
switch (jolly->state) { switch (jolly->state) {
case STATE_OUT_VERIFY: case STATE_OUT_VERIFY:

View File

@@ -258,7 +258,7 @@ typedef struct process {
static process_t *process_head = NULL; static process_t *process_head = NULL;
static void process_timeout(struct timer *timer); static void process_timeout(void *data);
static void indicate_disconnect_release(int callref, int cause, uint8_t msg_type); static void indicate_disconnect_release(int callref, int cause, uint8_t msg_type);
static process_t *create_process(int callref, enum process_state state) static process_t *create_process(int callref, enum process_state state)
@@ -372,9 +372,9 @@ static void get_process_patterns(process_t *process, int16_t *samples, int lengt
process->audio_pos = pos; process->audio_pos = pos;
} }
static void process_timeout(struct timer *timer) static void process_timeout(void *data)
{ {
process_t *process = (process_t *)timer->priv; process_t *process = data;
{ {
/* announcement timeout */ /* announcement timeout */

View File

@@ -29,30 +29,30 @@
#include "../libdebug/debug.h" #include "../libdebug/debug.h"
#include "mtp.h" #include "mtp.h"
static void mtp_t1(struct timer *timer) static void mtp_t1(void *data)
{ {
mtp_t *mtp = (mtp_t *)timer->priv; mtp_t *mtp = data;
mtp_send(mtp, MTP_PRIM_T1_TIMEOUT, 0, NULL, 0); mtp_send(mtp, MTP_PRIM_T1_TIMEOUT, 0, NULL, 0);
} }
static void mtp_t2(struct timer *timer) static void mtp_t2(void *data)
{ {
mtp_t *mtp = (mtp_t *)timer->priv; mtp_t *mtp = data;
mtp_send(mtp, MTP_PRIM_T2_TIMEOUT, 0, NULL, 0); mtp_send(mtp, MTP_PRIM_T2_TIMEOUT, 0, NULL, 0);
} }
static void mtp_t3(struct timer *timer) static void mtp_t3(void *data)
{ {
mtp_t *mtp = (mtp_t *)timer->priv; mtp_t *mtp = data;
mtp_send(mtp, MTP_PRIM_T3_TIMEOUT, 0, NULL, 0); mtp_send(mtp, MTP_PRIM_T3_TIMEOUT, 0, NULL, 0);
} }
static void mtp_t4(struct timer *timer) static void mtp_t4(void *data)
{ {
mtp_t *mtp = (mtp_t *)timer->priv; mtp_t *mtp = data;
mtp_send(mtp, MTP_PRIM_T4_TIMEOUT, 0, NULL, 0); mtp_send(mtp, MTP_PRIM_T4_TIMEOUT, 0, NULL, 0);
} }

View File

@@ -278,9 +278,9 @@ reject:
} }
/* send attach indication to socket */ /* send attach indication to socket */
void send_attach_ind(struct timer *timer) void send_attach_ind(void *data)
{ {
osmo_cc_endpoint_t *ep = (osmo_cc_endpoint_t *)timer->priv; osmo_cc_endpoint_t *ep = data;
osmo_cc_call_t *call; osmo_cc_call_t *call;
osmo_cc_msg_t *msg; osmo_cc_msg_t *msg;
@@ -1447,7 +1447,7 @@ int osmo_cc_new(osmo_cc_endpoint_t *ep, const char *version, const char *name, u
/* attach to remote host */ /* attach to remote host */
timer_init(&ep->attach_timer, send_attach_ind, ep); timer_init(&ep->attach_timer, send_attach_ind, ep);
if (ep->remote_host) { if (ep->remote_host) {
send_attach_ind(&ep->attach_timer); send_attach_ind(ep->attach_timer.data);
} }
} }

View File

@@ -80,9 +80,9 @@ static void rej_msg(osmo_cc_socket_t *os, uint32_t callref, uint8_t socket_cause
os->recv_msg_cb(os->priv, callref, msg); os->recv_msg_cb(os->priv, callref, msg);
} }
void tx_keepalive_timeout(struct timer *timer) static void tx_keepalive_timeout(void *data)
{ {
osmo_cc_conn_t *conn = (osmo_cc_conn_t *)timer->priv; osmo_cc_conn_t *conn = data;
osmo_cc_msg_t *msg; osmo_cc_msg_t *msg;
/* send keepalive message */ /* send keepalive message */
@@ -93,9 +93,9 @@ void tx_keepalive_timeout(struct timer *timer)
static void close_conn(osmo_cc_conn_t *conn, uint8_t socket_cause); static void close_conn(osmo_cc_conn_t *conn, uint8_t socket_cause);
void rx_keepalive_timeout(struct timer *timer) static void rx_keepalive_timeout(void *data)
{ {
osmo_cc_conn_t *conn = (osmo_cc_conn_t *)timer->priv; osmo_cc_conn_t *conn = data;
PDEBUG(DCC, DEBUG_ERROR, "OsmoCC-Socket failed due to timeout.\n"); PDEBUG(DCC, DEBUG_ERROR, "OsmoCC-Socket failed due to timeout.\n");
close_conn(conn, OSMO_CC_SOCKET_CAUSE_TIMEOUT); close_conn(conn, OSMO_CC_SOCKET_CAUSE_TIMEOUT);

View File

@@ -26,6 +26,8 @@
#include <errno.h> #include <errno.h>
#include "timer.h" #include "timer.h"
//#define DEBUG
static struct timer *timer_head = NULL; static struct timer *timer_head = NULL;
static struct timer **timer_tail_p = &timer_head; static struct timer **timer_tail_p = &timer_head;
@@ -38,7 +40,7 @@ double get_time(void)
return (double)tv.tv_sec + (double)tv.tv_nsec / 1000000000.0; return (double)tv.tv_sec + (double)tv.tv_nsec / 1000000000.0;
} }
void timer_init(struct timer *timer, void (*fn)(struct timer *timer), void *priv) void timer_init(struct timer *timer, void (*fn)(void *data), void *priv)
{ {
if (timer->linked) { if (timer->linked) {
fprintf(stderr, "Timer is already initialized, aborting!\n"); fprintf(stderr, "Timer is already initialized, aborting!\n");
@@ -46,12 +48,15 @@ void timer_init(struct timer *timer, void (*fn)(struct timer *timer), void *priv
} }
timer->timeout = 0; timer->timeout = 0;
timer->fn = fn; timer->cb = fn;
timer->priv = priv; timer->data = priv;
timer->next = NULL; timer->next = NULL;
*timer_tail_p = timer; *timer_tail_p = timer;
timer_tail_p = &timer->next; timer_tail_p = &timer->next;
timer->linked = 1; timer->linked = 1;
#ifdef DEBUG
fprintf(stderr, "%s: timer=%p linked.\n", __func__, timer);
#endif
} }
void timer_exit(struct timer *timer) void timer_exit(struct timer *timer)
@@ -64,6 +69,9 @@ void timer_exit(struct timer *timer)
timer_tail_p = &((*timer_tail_p)->next); timer_tail_p = &((*timer_tail_p)->next);
} }
timer->linked = 0; timer->linked = 0;
#ifdef DEBUG
fprintf(stderr, "%s: timer=%p unlinked.\n", __func__, timer);
#endif
} }
void timer_start(struct timer *timer, double duration) void timer_start(struct timer *timer, double duration)
@@ -75,6 +83,9 @@ void timer_start(struct timer *timer, double duration)
timer->duration = duration; timer->duration = duration;
timer->timeout = get_time() + duration; timer->timeout = get_time() + duration;
#ifdef DEBUG
fprintf(stderr, "%s: timer=%p started %.3f seconds.\n", __func__, timer, duration);
#endif
} }
void timer_stop(struct timer *timer) void timer_stop(struct timer *timer)
@@ -85,6 +96,9 @@ void timer_stop(struct timer *timer)
} }
timer->timeout = 0; timer->timeout = 0;
#ifdef DEBUG
fprintf(stderr, "%s: timer=%p stopped.\n", __func__, timer);
#endif
} }
int timer_running(struct timer *timer) int timer_running(struct timer *timer)
@@ -97,23 +111,55 @@ int timer_running(struct timer *timer)
return (timer->timeout != 0); return (timer->timeout != 0);
} }
void process_timer(void) double process_timer(void)
{ {
struct timer *timer; struct timer *timer;
double now; double now, timeout = -1.0;
now = get_time(); now = get_time();
again: again:
timer = timer_head; timer = timer_head;
while (timer) { while (timer) {
if (timer->linked && timer->timeout > 0 && now >= timer->timeout) { if (timer->linked && timer->timeout > 0) {
timer->timeout = 0; /* timeout, handle it, set timeout to 0 */
timer->fn(timer); if (now >= timer->timeout) {
goto again; timer->timeout = 0;
#ifdef DEBUG
fprintf(stderr, "%s: timer=%p fired.\n", __func__, timer);
#endif
if (!timer->cb)
abort();
timer->cb(timer->data);
timeout = 0.0;
goto again;
}
/* in the future, set timeout to future */
if (timeout < 0.0 || (timer->timeout - now) < timeout)
timeout = timer->timeout - now;
} }
timer = timer->next; timer = timer->next;
} }
return timeout;
}
void osmo_timer_schedule(struct osmo_timer_list *ti, time_t sec, suseconds_t usec)
{
if (!ti->linked)
timer_init(ti, ti->cb, ti->data);
timer_start(ti, (double)sec + (double)usec / 1000000.0);
}
void osmo_timer_del(struct osmo_timer_list *ti)
{
timer_exit(ti);
}
int osmo_timer_pending(struct osmo_timer_list *ti)
{
if (!ti->linked)
return 0;
return (ti->timeout != 0);
} }

View File

@@ -4,15 +4,20 @@ struct timer {
int linked; /* set is timer is initialized and linked */ int linked; /* set is timer is initialized and linked */
double duration; double duration;
double timeout; double timeout;
void (*fn)(struct timer *timer); void (*cb)(void *data);
void *priv; void *data;
}; };
double get_time(void); double get_time(void);
void timer_init(struct timer *timer, void (*fn)(struct timer *timer), void *priv); void timer_init(struct timer *timer, void (*fn)(void *data), void *priv);
void timer_exit(struct timer *timer); void timer_exit(struct timer *timer);
void timer_start(struct timer *timer, double duration); void timer_start(struct timer *timer, double duration);
void timer_stop(struct timer *timer); void timer_stop(struct timer *timer);
int timer_running(struct timer *timer); int timer_running(struct timer *timer);
void process_timer(void); double process_timer(void);
#define osmo_timer_list timer
void osmo_timer_schedule(struct osmo_timer_list *ti, time_t sec, long usec);
void osmo_timer_del(struct osmo_timer_list *ti);
int osmo_timer_pending(struct osmo_timer_list *ti);

View File

@@ -199,7 +199,7 @@ void unit_new_state(mpt1327_unit_t *unit, uint64_t new_state)
unit->state = new_state; unit->state = new_state;
} }
static void unit_timeout(struct timer *timer); static void unit_timeout(void *data);
mpt1327_unit_t *get_unit(uint8_t prefix, uint16_t ident) mpt1327_unit_t *get_unit(uint8_t prefix, uint16_t ident)
{ {
@@ -253,9 +253,9 @@ static void mpt1327_go_idle(mpt1327_t *mpt1327);
static void mpt1327_release(mpt1327_unit_t *unit); static void mpt1327_release(mpt1327_unit_t *unit);
/* Timeout handling */ /* Timeout handling */
static void unit_timeout(struct timer *timer) static void unit_timeout(void *data)
{ {
mpt1327_unit_t *unit = (mpt1327_unit_t *)timer->priv; mpt1327_unit_t *unit = data;
// FIXME: do some retry // FIXME: do some retry
switch (unit->state) { switch (unit->state) {
@@ -600,7 +600,7 @@ static void mpt1327_new_state(mpt1327_t *mpt1327, enum mpt1327_state new_state,
mpt1327_display_status(); mpt1327_display_status();
} }
static void mpt1327_timeout(struct timer *timer); static void mpt1327_timeout(void *data);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int mpt1327_create(enum mpt1327_band band, const char *kanal, enum mpt1327_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db) int mpt1327_create(enum mpt1327_band band, const char *kanal, enum mpt1327_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, int loopback, double squelch_db)
@@ -1538,9 +1538,9 @@ void mpt1327_signal_indication(mpt1327_t *mpt1327)
} }
/* Timeout handling */ /* Timeout handling */
static void mpt1327_timeout(struct timer *timer) static void mpt1327_timeout(void *data)
{ {
mpt1327_t *mpt1327 = (mpt1327_t *)timer->priv; mpt1327_t *mpt1327 = data;
switch (mpt1327->state) { switch (mpt1327->state) {
default: default:

View File

@@ -259,7 +259,7 @@ static inline int is_chan_class_tc(enum nmt_chan_type chan_type)
return 0; return 0;
} }
static void nmt_timeout(struct timer *timer); static void nmt_timeout(void *data);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int nmt_create(int nmt_system, const char *country, const char *kanal, enum nmt_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int send_clock, int loopback) int nmt_create(int nmt_system, const char *country, const char *kanal, enum nmt_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, uint8_t ms_power, uint8_t traffic_area, uint8_t area_no, int compandor, int supervisory, const char *smsc_number, int send_callerid, int send_clock, int loopback)
@@ -1677,9 +1677,9 @@ void nmt_receive_frame(nmt_t *nmt, const char *bits, double quality, double leve
} }
/* Timeout handling */ /* Timeout handling */
static void nmt_timeout(struct timer *timer) static void nmt_timeout(void *data)
{ {
nmt_t *nmt = (nmt_t *)timer->priv; nmt_t *nmt = data;
switch (nmt->state) { switch (nmt->state) {
case STATE_MO_DIALING: case STATE_MO_DIALING:
@@ -1692,7 +1692,7 @@ static void nmt_timeout(struct timer *timer)
timeout_mt_release(nmt); timeout_mt_release(nmt);
break; break;
case STATE_ACTIVE: case STATE_ACTIVE:
timeout_active(nmt, timer->duration); timeout_active(nmt, nmt->timer.duration);
break; break;
default: default:
break; break;

View File

@@ -94,7 +94,7 @@ static const char sms_header[] = {
* init and exit * init and exit
*/ */
static void sms_timeout(struct timer *timer); static void sms_timeout(void *data);
/* init instance */ /* init instance */
int sms_init_sender(nmt_t *nmt) int sms_init_sender(nmt_t *nmt)
@@ -675,9 +675,9 @@ release:
return; return;
} }
static void sms_timeout(struct timer *timer) static void sms_timeout(void *data)
{ {
nmt_t *nmt = (nmt_t *)timer->priv; nmt_t *nmt = data;
sms_release(nmt); sms_release(nmt);
} }

View File

@@ -27,7 +27,7 @@
#include "transaction.h" #include "transaction.h"
static transaction_t *trans_list = NULL; static transaction_t *trans_list = NULL;
static void transaction_timeout(struct timer *timer); static void transaction_timeout(void *data);
/* link transaction to list */ /* link transaction to list */
static void link_transaction(transaction_t *trans) static void link_transaction(transaction_t *trans)
@@ -106,9 +106,9 @@ void destroy_transaction(transaction_t *trans)
} }
/* Timeout handling */ /* Timeout handling */
static void transaction_timeout(struct timer *timer) static void transaction_timeout(void *data)
{ {
transaction_t *trans = (transaction_t *)timer->priv; transaction_t *trans = data;
timeout_mt_paging(trans); timeout_mt_paging(trans);
} }

View File

@@ -382,7 +382,7 @@ uint8_t r2000_encode_super(r2000_t *r2000)
return super ^ 0x7f; return super ^ 0x7f;
} }
static void r2000_timeout(struct timer *timer); static void r2000_timeout(void *data);
/* Create transceiver instance and link to a list. */ /* Create transceiver instance and link to a list. */
int r2000_create(int band, const char *kanal, enum r2000_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, uint16_t relais, uint8_t deport, uint8_t agi, uint8_t sm_power, uint8_t taxe, uint8_t crins, int destruction, uint8_t nconv, int recall, int loopback) int r2000_create(int band, const char *kanal, enum r2000_chan_type chan_type, const char *device, int use_sdr, int samplerate, double rx_gain, double tx_gain, int pre_emphasis, int de_emphasis, const char *write_rx_wave, const char *write_tx_wave, const char *read_rx_wave, const char *read_tx_wave, uint16_t relais, uint8_t deport, uint8_t agi, uint8_t sm_power, uint8_t taxe, uint8_t crins, int destruction, uint8_t nconv, int recall, int loopback)
@@ -1337,9 +1337,9 @@ void r2000_receive_super(r2000_t *r2000, uint8_t super, double quality, double l
} }
/* Timeout handling */ /* Timeout handling */
static void r2000_timeout(struct timer *timer) static void r2000_timeout(void *data)
{ {
r2000_t *r2000 = (r2000_t *)timer->priv; r2000_t *r2000 = data;
switch (r2000->state) { switch (r2000->state) {
case STATE_OUT_IDENT: case STATE_OUT_IDENT:

View File

@@ -159,7 +159,7 @@ static void zeit_calc_time(zeit_call_t *call, time_t time_sec)
PDEBUG(DZEIT, DEBUG_INFO, "The time at the next beep is: %d:%02d:%02d\n", call->h, call->m, call->s); PDEBUG(DZEIT, DEBUG_INFO, "The time at the next beep is: %d:%02d:%02d\n", call->h, call->m, call->s);
} }
static void call_timeout(struct timer *timer); static void call_timeout(void *data);
/* Create call instance */ /* Create call instance */
static zeit_call_t *zeit_call_create(uint32_t callref, const char *id) static zeit_call_t *zeit_call_create(uint32_t callref, const char *id)
@@ -317,9 +317,9 @@ void call_down_clock(void)
} }
/* Timeout handling */ /* Timeout handling */
static void call_timeout(struct timer *timer) static void call_timeout(void *data)
{ {
zeit_call_t *call = (zeit_call_t *)timer->priv; zeit_call_t *call = data;
double now, time_offset; double now, time_offset;
time_t time_sec; time_t time_sec;