diff --git a/src/amps/amps.c b/src/amps/amps.c index 747b470..f75e873 100644 --- a/src/amps/amps.c +++ b/src/amps/amps.c @@ -1100,20 +1100,20 @@ void call_down_audio(int callref, uint16_t sequence, uint32_t timestamp, uint32_ void call_down_clock(void) {} /* 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; switch (trans->state) { case TRANS_CALL_MO_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"); amps_release(amps->trans_list, CAUSE_TEMPFAIL); break; 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"); amps_release(amps->trans_list, CAUSE_TEMPFAIL); break; diff --git a/src/amps/transaction.h b/src/amps/transaction.h index 6cd6441..33f8393 100644 --- a/src/amps/transaction.h +++ b/src/amps/transaction.h @@ -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); void trans_new_state(transaction_t *trans, int state); 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); diff --git a/src/anetz/anetz.c b/src/anetz/anetz.c index 3af185b..d77484e 100644 --- a/src/anetz/anetz.c +++ b/src/anetz/anetz.c @@ -186,7 +186,7 @@ int anetz_init(void) return 0; } -static void anetz_timeout(struct timer *timer); +static void anetz_timeout(void *data); static void anetz_go_idle(anetz_t *anetz); /* Create transceiver instance and link to a list. */ @@ -362,9 +362,9 @@ void anetz_receive_tone(anetz_t *anetz, int tone) } /* 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) { case ANETZ_ANRUF: diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c index caa7b2e..5eb1410 100644 --- a/src/bnetz/bnetz.c +++ b/src/bnetz/bnetz.c @@ -150,7 +150,7 @@ int bnetz_init(void) return 0; } -static void bnetz_timeout(struct timer *timer); +static void bnetz_timeout(void *data); static void bnetz_go_idle(bnetz_t *bnetz); /* Create transceiver instance and link to a list. */ @@ -631,9 +631,9 @@ lets see, if noise will not generate a release signal.... } /* 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) { case BNETZ_WAHLABRUF: diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c index 734a3e7..83099f6 100644 --- a/src/cnetz/cnetz.c +++ b/src/cnetz/cnetz.c @@ -835,9 +835,9 @@ const char *chan_type_long_name(enum cnetz_chan_type chan_type) } /* 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; switch (trans->state) { diff --git a/src/cnetz/database.c b/src/cnetz/database.c index d52c6da..0046973 100644 --- a/src/cnetz/database.c +++ b/src/cnetz/database.c @@ -85,9 +85,9 @@ static void remove_db(cnetz_db_t *db) } /* 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; PDEBUG(DDB, DEBUG_INFO, "Check, if subscriber '%d,%d,%05d' is still available.\n", db->futln_nat, db->futln_fuvst, db->futln_rest); diff --git a/src/cnetz/transaction.h b/src/cnetz/transaction.h index 0c1e86c..85019f1 100644 --- a/src/cnetz/transaction.h +++ b/src/cnetz/transaction.h @@ -71,6 +71,6 @@ transaction_t *search_transaction_callref(cnetz_t *cnetz, int callref); transaction_t *search_transaction_queue(void); void trans_new_state(transaction_t *trans, uint64_t state); 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); diff --git a/src/datenklo/am791x.c b/src/datenklo/am791x.c index b3164af..8a29047 100644 --- a/src/datenklo/am791x.c +++ b/src/datenklo/am791x.c @@ -1066,16 +1066,16 @@ static void handle_state(am791x_t *am791x) } /* 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); } -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); } diff --git a/src/datenklo/datenklo.c b/src/datenklo/datenklo.c index e62edbf..aea44a6 100644 --- a/src/datenklo/datenklo.c +++ b/src/datenklo/datenklo.c @@ -1257,9 +1257,9 @@ void sighandler(int sigset) } /* 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 */ datenklo->vtimeout = 1; diff --git a/src/eurosignal/eurosignal.c b/src/eurosignal/eurosignal.c index 7ab3074..d23a500 100644 --- a/src/eurosignal/eurosignal.c +++ b/src/eurosignal/eurosignal.c @@ -234,7 +234,7 @@ void euro_exit(void) flush_id(); } -static void call_timeout(struct timer *timer); +static void call_timeout(void *data); /* 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) @@ -549,9 +549,9 @@ void call_down_clock(void) } /* 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) { case EURO_CALL_ANSWER: diff --git a/src/fuvst/fuvst.c b/src/fuvst/fuvst.c index f86b0a8..ae825fc 100755 --- a/src/fuvst/fuvst.c +++ b/src/fuvst/fuvst.c @@ -591,9 +591,9 @@ static void destroy_transaction(transaction_t *trans) } /* 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"); if (trans->callref) diff --git a/src/imts/imts.c b/src/imts/imts.c index 8395a78..90b4820 100644 --- a/src/imts/imts.c +++ b/src/imts/imts.c @@ -283,7 +283,7 @@ int imts_init(void) 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_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); @@ -899,9 +899,9 @@ static void page_after_digit(imts_t *imts) } /* 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) { case IMTS_IDLE: diff --git a/src/jolly/jolly.c b/src/jolly/jolly.c index 115d561..daf59d9 100644 --- a/src/jolly/jolly.c +++ b/src/jolly/jolly.c @@ -204,8 +204,8 @@ static void jolly_new_state(jolly_t *jolly, enum jolly_state new_state) jolly_display_status(); } -static void jolly_timeout(struct timer *timer); -static void jolly_speech_timeout(struct timer *timer); +static void jolly_timeout(void *data); +static void jolly_speech_timeout(void *data); static void jolly_go_idle(jolly_t *jolly); /* 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 */ -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) { 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) { case STATE_OUT_VERIFY: diff --git a/src/libmobile/call.c b/src/libmobile/call.c index a7858d4..6b0214e 100644 --- a/src/libmobile/call.c +++ b/src/libmobile/call.c @@ -258,7 +258,7 @@ typedef struct process { 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 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; } -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 */ diff --git a/src/libmtp/mtp.c b/src/libmtp/mtp.c index 02afbdd..3ae4811 100644 --- a/src/libmtp/mtp.c +++ b/src/libmtp/mtp.c @@ -29,30 +29,30 @@ #include "../libdebug/debug.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); } -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); } -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); } -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); } diff --git a/src/libosmocc/endpoint.c b/src/libosmocc/endpoint.c index 48290d5..2b6d759 100644 --- a/src/libosmocc/endpoint.c +++ b/src/libosmocc/endpoint.c @@ -278,9 +278,9 @@ reject: } /* 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_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 */ timer_init(&ep->attach_timer, send_attach_ind, ep); if (ep->remote_host) { - send_attach_ind(&ep->attach_timer); + send_attach_ind(ep->attach_timer.data); } } diff --git a/src/libosmocc/socket.c b/src/libosmocc/socket.c index d25e1f1..e41e0fc 100644 --- a/src/libosmocc/socket.c +++ b/src/libosmocc/socket.c @@ -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); } -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; /* 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); -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"); close_conn(conn, OSMO_CC_SOCKET_CAUSE_TIMEOUT); diff --git a/src/libtimer/timer.c b/src/libtimer/timer.c index 174533f..a5fa85c 100644 --- a/src/libtimer/timer.c +++ b/src/libtimer/timer.c @@ -26,6 +26,8 @@ #include #include "timer.h" +//#define DEBUG + static struct timer *timer_head = NULL; 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; } -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) { 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->fn = fn; - timer->priv = priv; + timer->cb = fn; + timer->data = priv; timer->next = NULL; *timer_tail_p = timer; timer_tail_p = &timer->next; timer->linked = 1; +#ifdef DEBUG + fprintf(stderr, "%s: timer=%p linked.\n", __func__, timer); +#endif } void timer_exit(struct timer *timer) @@ -64,6 +69,9 @@ void timer_exit(struct timer *timer) timer_tail_p = &((*timer_tail_p)->next); } timer->linked = 0; +#ifdef DEBUG + fprintf(stderr, "%s: timer=%p unlinked.\n", __func__, timer); +#endif } void timer_start(struct timer *timer, double duration) @@ -75,6 +83,9 @@ void timer_start(struct timer *timer, double duration) timer->duration = 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) @@ -85,6 +96,9 @@ void timer_stop(struct timer *timer) } timer->timeout = 0; +#ifdef DEBUG + fprintf(stderr, "%s: timer=%p stopped.\n", __func__, timer); +#endif } int timer_running(struct timer *timer) @@ -97,23 +111,55 @@ int timer_running(struct timer *timer) return (timer->timeout != 0); } -void process_timer(void) +double process_timer(void) { struct timer *timer; - double now; + double now, timeout = -1.0; now = get_time(); again: timer = timer_head; - while (timer) { - if (timer->linked && timer->timeout > 0 && now >= timer->timeout) { - timer->timeout = 0; - timer->fn(timer); - goto again; + if (timer->linked && timer->timeout > 0) { + /* timeout, handle it, set timeout to 0 */ + if (now >= timer->timeout) { + 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; } + + 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); } diff --git a/src/libtimer/timer.h b/src/libtimer/timer.h index 2073a8f..f7dbbbc 100644 --- a/src/libtimer/timer.h +++ b/src/libtimer/timer.h @@ -4,15 +4,20 @@ struct timer { int linked; /* set is timer is initialized and linked */ double duration; double timeout; - void (*fn)(struct timer *timer); - void *priv; + void (*cb)(void *data); + void *data; }; 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_start(struct timer *timer, double duration); void timer_stop(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); diff --git a/src/mpt1327/mpt1327.c b/src/mpt1327/mpt1327.c index 5fdc2f4..820845c 100755 --- a/src/mpt1327/mpt1327.c +++ b/src/mpt1327/mpt1327.c @@ -199,7 +199,7 @@ void unit_new_state(mpt1327_unit_t *unit, uint64_t 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) { @@ -253,9 +253,9 @@ static void mpt1327_go_idle(mpt1327_t *mpt1327); static void mpt1327_release(mpt1327_unit_t *unit); /* 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 switch (unit->state) { @@ -600,7 +600,7 @@ static void mpt1327_new_state(mpt1327_t *mpt1327, enum mpt1327_state new_state, mpt1327_display_status(); } -static void mpt1327_timeout(struct timer *timer); +static void mpt1327_timeout(void *data); /* 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) @@ -1538,9 +1538,9 @@ void mpt1327_signal_indication(mpt1327_t *mpt1327) } /* 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) { default: diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c index 8a49dc5..9694372 100644 --- a/src/nmt/nmt.c +++ b/src/nmt/nmt.c @@ -259,7 +259,7 @@ static inline int is_chan_class_tc(enum nmt_chan_type chan_type) return 0; } -static void nmt_timeout(struct timer *timer); +static void nmt_timeout(void *data); /* 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) @@ -1677,9 +1677,9 @@ void nmt_receive_frame(nmt_t *nmt, const char *bits, double quality, double leve } /* 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) { case STATE_MO_DIALING: @@ -1692,7 +1692,7 @@ static void nmt_timeout(struct timer *timer) timeout_mt_release(nmt); break; case STATE_ACTIVE: - timeout_active(nmt, timer->duration); + timeout_active(nmt, nmt->timer.duration); break; default: break; diff --git a/src/nmt/sms.c b/src/nmt/sms.c index 87af10a..f774fde 100644 --- a/src/nmt/sms.c +++ b/src/nmt/sms.c @@ -94,7 +94,7 @@ static const char sms_header[] = { * init and exit */ -static void sms_timeout(struct timer *timer); +static void sms_timeout(void *data); /* init instance */ int sms_init_sender(nmt_t *nmt) @@ -675,9 +675,9 @@ release: 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); } diff --git a/src/nmt/transaction.c b/src/nmt/transaction.c index 39aed2f..3e4ef89 100644 --- a/src/nmt/transaction.c +++ b/src/nmt/transaction.c @@ -27,7 +27,7 @@ #include "transaction.h" static transaction_t *trans_list = NULL; -static void transaction_timeout(struct timer *timer); +static void transaction_timeout(void *data); /* link transaction to list */ static void link_transaction(transaction_t *trans) @@ -106,9 +106,9 @@ void destroy_transaction(transaction_t *trans) } /* 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); } diff --git a/src/r2000/r2000.c b/src/r2000/r2000.c index d0397fb..0b7b5cf 100644 --- a/src/r2000/r2000.c +++ b/src/r2000/r2000.c @@ -382,7 +382,7 @@ uint8_t r2000_encode_super(r2000_t *r2000) return super ^ 0x7f; } -static void r2000_timeout(struct timer *timer); +static void r2000_timeout(void *data); /* 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) @@ -1337,9 +1337,9 @@ void r2000_receive_super(r2000_t *r2000, uint8_t super, double quality, double l } /* 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) { case STATE_OUT_IDENT: diff --git a/src/zeitansage/zeitansage.c b/src/zeitansage/zeitansage.c index 5449d21..6b3b0ed 100644 --- a/src/zeitansage/zeitansage.c +++ b/src/zeitansage/zeitansage.c @@ -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); } -static void call_timeout(struct timer *timer); +static void call_timeout(void *data); /* Create call instance */ static zeit_call_t *zeit_call_create(uint32_t callref, const char *id) @@ -317,9 +317,9 @@ void call_down_clock(void) } /* 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; time_t time_sec;