38#include <dahdi/user.h>
82 if ((
timer->fd = open(
"/dev/dahdi/timer", O_RDWR)) < 0) {
106 samples = (
unsigned int)
roundf((8000.0 / ((
float) rate)));
108 if (ioctl(
timer->fd, DAHDI_TIMERCONFIG, &samples)) {
109 ast_log(
LOG_ERROR,
"Failed to configure DAHDI timing fd for %d sample timer ticks\n",
121 return ioctl(
timer->fd, DAHDI_TIMERACK, &quantity) ? -1 : 0;
129 return ioctl(
timer->fd, DAHDI_TIMERPING, &flags) ? -1 : 0;
137 return ioctl(
timer->fd, DAHDI_TIMERPONG, &flags) ? -1 : 0;
146 res = ioctl(
timer->fd, DAHDI_GETEVENT, &
event);
149 event = DAHDI_EVENT_TIMER_EXPIRED;
153 case DAHDI_EVENT_TIMER_PING:
155 case DAHDI_EVENT_TIMER_EXPIRED:
173#define SEE_TIMING "For more information on Asterisk timing modules, including ways to potentially fix this problem, please see https://docs.asterisk.org/Configuration/Core-Configuration/Timing-Interfaces/\n"
180 fd = open(
"/dev/dahdi/timer", O_RDWR);
186 if (ioctl(
fd, DAHDI_TIMERCONFIG, &x)) {
187 ast_log(
LOG_ERROR,
"You have DAHDI built and drivers loaded, but the DAHDI timer test failed to set DAHDI_TIMERCONFIG to %d.\n" SEE_TIMING, x);
193 ast_log(
LOG_ERROR,
"You have DAHDI built and drivers loaded, but the DAHDI timer could not be polled during the DAHDI timer test.\n" SEE_TIMING);
199 const char dahdi_timer_error[] = {
200 "Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection. You have options:"
201 "\n\t1. You only have to compile DAHDI support into Asterisk if you need it. One option is to recompile without DAHDI support."
202 "\n\t2. You only have to load DAHDI drivers if you want to take advantage of DAHDI services. One option is to unload DAHDI modules if you don't need them."
203 "\n\t3. If you need DAHDI services, you must correctly configure DAHDI."
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
static struct ast_timer * timer
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static struct ast_timing_interface dahdi_timing
static void dahdi_timer_close(void *data)
static int dahdi_timer_set_rate(void *data, unsigned int rate)
static int dahdi_timer_fd(void *data)
static unsigned int dahdi_timer_get_max_rate(void *data)
static void * dahdi_timer_open(void)
static int dahdi_timer_disable_continuous(void *data)
static enum ast_timer_event dahdi_timer_get_event(void *data)
static int dahdi_timer_ack(void *data, unsigned int quantity)
static int dahdi_timer_enable_continuous(void *data)
static int load_module(void)
static void * timing_funcs_handle
static int unload_module(void)
static int dahdi_test_timer(void)
Timing source management.
#define ast_register_timing_interface(i)
Register a set of timing functions.
int ast_unregister_timing_interface(void *handle)
Unregister a previously registered timing interface.
@ AST_TIMING_EVENT_CONTINUOUS
@ AST_TIMING_EVENT_EXPIRED
int ast_wait_for_input(int fd, int ms)