kal_timer_hrtimer.h File Reference

Implementation of the kal_timer interface based on hrtimer.h. More...

#include <linux/aquosa/qos_debug.h>
#include <linux/aquosa/qos_types.h>
#include <linux/aquosa/qos_memory.h>
#include <linux/hrtimer.h>
#include "kal_time.h"
#include "kal_arg.h"

Go to the source code of this file.

Data Structures

struct  kal_timer
 Implementation of kal_timer based on hrtimer.h. More...

Typedefs

typedef void(* kal_timer_cb )(kal_arg_t cb_data)
typedef struct kal_timer kal_timer_t
 Implementation of kal_timer based on hrtimer.h.
typedef enum hrtimer_restart(* hrtimer_cb )(struct hrtimer *)

Functions

static enum hrtimer_restart hrt_callback (struct hrtimer *hrt)
 kal_timer_cb <-> hrtimer_cb wrapper/adapter
static void kal_timer_init (kal_timer_t *p_timer, kal_timer_cb cb, kal_arg_t cb_data)
static void kal_timer_set_expires (kal_timer_t *p_timer, kal_time_t t)
 Set absolute expiry time and do not start.
static kal_time_t kal_timer_get_expires (kal_timer_t *p_timer)
 Retrieve the absolute expiry time.
static void kal_timer_init_now (kal_timer_t *p_timer, kal_timer_cb cb, kal_arg_t cb_data)
static void kal_timer_del (kal_timer_t *p_timer)
static void kal_timer_set (kal_timer_t *p_timer, kal_time_t t)
 Set absolute expiry time and start the timer.
static kal_time_t kal_timer_get_remaining (kal_timer_t *p_timer)
 Retrieve the remaining time to expiry.
static void kal_timer_forward (kal_timer_t *p_timer, kal_time_t t)
static int kal_timer_pending (kal_timer_t *p_timer)

Detailed Description

Implementation of the kal_timer interface based on hrtimer.h.

The implementation in kal_timer_hrtimer.h may be used independently of the actual type of kal_time.h, thanks to the converion functions defined below (however, optimum configuration is with the kal_time implementation found in kal_time_timespec.h).

Definition in file kal_timer_hrtimer.h.


Typedef Documentation

typedef enum hrtimer_restart(* hrtimer_cb)(struct hrtimer *)

Definition at line 50 of file kal_timer_hrtimer.h.

typedef void(* kal_timer_cb)(kal_arg_t cb_data)

Definition at line 25 of file kal_timer_hrtimer.h.

typedef struct kal_timer kal_timer_t

Implementation of kal_timer based on hrtimer.h.

This type may be logically thought of as a subclass of hrtimer, so that (dynamic) casting from kal_timer * to/from hrtimer * is safe.

Note:
The field handler_running is useful whenever trying to cancel a timer from within its own handler (hrtimer_cancel() hangs the kernel on such a case, contrary to timer_del()). Such variable is set and unset within hrtimer_cb(), without any application-specific spinlock held. However, the only situation in which it is useful is when the application-supplied timer handler tries to delete the same timer, and it works for such a case. On the other hand, when cancelling a timer from non-interrupt context, the timer handler runs atomically w.r.t. the kernel code, thus the latter cannot find handler_running at 1 and erroneously skip the cancel of the timer.

Function Documentation

static enum hrtimer_restart hrt_callback ( struct hrtimer *  hrt  )  [static]

kal_timer_cb <-> hrtimer_cb wrapper/adapter

This callback casts the hrtimer* arg to a kal_timer*, then retrieves from it the actual kal_timer callback and parameter, and calls it.

Definition at line 57 of file kal_timer_hrtimer.h.

References kal_timer_t::handler_running, qos_chk_do, qos_mem_valid(), timer, kal_timer_t::timer_cb, and kal_timer_t::timer_cb_data.

Referenced by kal_timer_init().

static void kal_timer_del ( kal_timer_t p_timer  )  [inline, static]
static void kal_timer_forward ( kal_timer_t p_timer,
kal_time_t  t 
) [inline, static]

Definition at line 124 of file kal_timer_hrtimer.h.

References kal_time_add(), kal_timer_del(), and kal_timer_get_expires().

static kal_time_t kal_timer_get_expires ( kal_timer_t p_timer  )  [inline, static]

Retrieve the absolute expiry time.

Definition at line 89 of file kal_timer_hrtimer.h.

Referenced by kal_timer_forward().

static kal_time_t kal_timer_get_remaining ( kal_timer_t p_timer  )  [inline, static]

Retrieve the remaining time to expiry.

Definition at line 120 of file kal_timer_hrtimer.h.

static void kal_timer_init ( kal_timer_t p_timer,
kal_timer_cb  cb,
kal_arg_t  cb_data 
) [inline, static]
static void kal_timer_init_now ( kal_timer_t p_timer,
kal_timer_cb  cb,
kal_arg_t  cb_data 
) [inline, static]
static int kal_timer_pending ( kal_timer_t p_timer  )  [inline, static]

Definition at line 130 of file kal_timer_hrtimer.h.

Referenced by stop_pending_timers().

static void kal_timer_set ( kal_timer_t p_timer,
kal_time_t  t 
) [inline, static]

Set absolute expiry time and start the timer.

Definition at line 114 of file kal_timer_hrtimer.h.

References kal_timer_del().

Referenced by rres_update_budget(), and set_enforce_timer().

static void kal_timer_set_expires ( kal_timer_t p_timer,
kal_time_t  t 
) [inline, static]

Set absolute expiry time and do not start.

Definition at line 78 of file kal_timer_hrtimer.h.

Referenced by kal_timer_init_now().

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3