Asterisk - The Open Source Telephony Project
21.4.1
|
Timing source management. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/timing.h"
#include "asterisk/lock.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/time.h"
#include "asterisk/heap.h"
#include "asterisk/module.h"
#include "asterisk/poll-compat.h"
Go to the source code of this file.
Data Structures | |
struct | ast_timer |
struct | timing_holder |
Functions | |
void * | _ast_register_timing_interface (struct ast_timing_interface *funcs, struct ast_module *mod) |
int | ast_timer_ack (const struct ast_timer *handle, unsigned int quantity) |
Acknowledge a timer event. More... | |
void | ast_timer_close (struct ast_timer *handle) |
Close an opened timing handle. More... | |
int | ast_timer_disable_continuous (const struct ast_timer *handle) |
Disable continuous mode. More... | |
int | ast_timer_enable_continuous (const struct ast_timer *handle) |
Enable continuous mode. More... | |
int | ast_timer_fd (const struct ast_timer *handle) |
Get a poll()-able file descriptor for a timer. More... | |
enum ast_timer_event | ast_timer_get_event (const struct ast_timer *handle) |
Retrieve timing event. More... | |
unsigned int | ast_timer_get_max_rate (const struct ast_timer *handle) |
Get maximum rate supported for a timer. More... | |
const char * | ast_timer_get_name (const struct ast_timer *handle) |
Get name of timer in use. More... | |
struct ast_timer * | ast_timer_open (void) |
Open a timer. More... | |
int | ast_timer_set_rate (const struct ast_timer *handle, unsigned int rate) |
Set the timing tick rate. More... | |
int | ast_timing_init (void) |
int | ast_unregister_timing_interface (void *handle) |
Unregister a previously registered timing interface. More... | |
static int | timing_holder_cmp (void *_h1, void *_h2) |
static void | timing_shutdown (void) |
static char * | timing_test (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Variables | |
static struct ast_cli_entry | cli_timing [] |
static struct ast_heap * | timing_interfaces |
Timing source management.
Definition in file timing.c.
int ast_timer_ack | ( | const struct ast_timer * | handle, |
unsigned int | quantity | ||
) |
Acknowledge a timer event.
handle | timer handle returned from timer_open() |
quantity | number of timer events to acknowledge |
-1 | failure, with errno set |
0 | success |
Definition at line 171 of file timing.c.
Referenced by __ast_read(), snoop_read(), softmix_mixing_loop(), and spandsp_fax_read().
void ast_timer_close | ( | struct ast_timer * | handle | ) |
Close an opened timing handle.
handle | timer handle returned from timer_open() |
Definition at line 154 of file timing.c.
References ast_module_unref.
Referenced by ast_channel_destructor(), load_module(), and snoop_destroy().
int ast_timer_disable_continuous | ( | const struct ast_timer * | handle | ) |
Disable continuous mode.
handle | timer handle returned from timer_close() |
-1 | failure, with errno set |
0 | success |
Definition at line 181 of file timing.c.
Referenced by __ast_read().
int ast_timer_enable_continuous | ( | const struct ast_timer * | handle | ) |
Enable continuous mode.
handle | timer handle returned from timer_open() |
Continuous mode causes poll() on the timer's fd to immediately return always until continuous mode is disabled.
-1 | failure, with errno set |
0 | success |
int ast_timer_fd | ( | const struct ast_timer * | handle | ) |
Get a poll()-able file descriptor for a timer.
handle | timer handle returned from timer_open() |
Definition at line 161 of file timing.c.
Referenced by __ast_channel_alloc_ap(), softmix_mixing_loop(), spandsp_fax_new(), and stasis_app_control_snoop().
enum ast_timer_event ast_timer_get_event | ( | const struct ast_timer * | handle | ) |
Retrieve timing event.
handle | timer handle returned by timer_open() |
After poll() indicates that there is input on the timer's fd, this will be called to find out what triggered it.
Definition at line 186 of file timing.c.
Referenced by __ast_read().
unsigned int ast_timer_get_max_rate | ( | const struct ast_timer * | handle | ) |
const char* ast_timer_get_name | ( | const struct ast_timer * | handle | ) |
Get name of timer in use.
handle | timer handle returned by timer_open() |
Definition at line 196 of file timing.c.
Referenced by __ast_channel_alloc_ap().
struct ast_timer* ast_timer_open | ( | void | ) |
Open a timer.
NULL | on error, with errno set |
non-NULL | timer handle on success |
Definition at line 122 of file timing.c.
References ast_calloc, ast_heap_peek(), ast_module_running_ref, and ast_module_unref.
Referenced by __ast_channel_alloc_ap(), load_module(), softmix_bridge_create(), spandsp_fax_new(), and stasis_app_control_snoop().
int ast_timer_set_rate | ( | const struct ast_timer * | handle, |
unsigned int | rate | ||
) |
Set the timing tick rate.
handle | timer handle returned from timer_open() |
rate | ticks per second, 0 turns the ticks off if needed |
Use this function if you want the timer to show input at a certain rate. The other alternative use of a timer is the continuous mode.
-1 | error, with errno set |
0 | success |
Definition at line 166 of file timing.c.
Referenced by __ast_read(), ast_deactivate_generator(), load_module(), set_config(), softmix_mixing_loop(), and stasis_app_control_snoop().
int ast_timing_init | ( | void | ) |
Provided by timing.c
Definition at line 289 of file timing.c.
References ast_cli_register_multiple, ast_heap_create, and ast_register_cleanup().
int ast_unregister_timing_interface | ( | void * | handle | ) |
Unregister a previously registered timing interface.
handle | The handle returned from a prior successful call to ast_register_timing_interface(). |
0 | success |
non-zero | failure |
Definition at line 104 of file timing.c.
References ast_heap_remove().
|
static |