Linux 内核时钟架构之时钟设备描述符
2017-03-24 17:32
393 查看
时钟设备是一种可编程设备,对其编程可产生中断。可以有定时中断,oneshot模式中断等。
/**
* struct clock_event_device - clock event device descriptor
* @event_handler: Assigned by the framework to be called by the low
* level handler of the event source
* @set_next_event: set next event function using a clocksource delta
* @set_next_ktime: set next event function using a direct ktime value
* @next_event: local storage for the next event in oneshot mode
* @max_delta_ns: maximum delta value in ns
* @min_delta_ns: minimum delta value in ns
* @mult: nanosecond to cycles multiplier
* @shift: nanoseconds to cycles divisor (power of two)
* @state_use_accessors:current state of the device, assigned by the core code
* @features: features
* @retries: number of forced programming retries
* @set_state_periodic: switch state to periodic
* @set_state_oneshot: switch state to oneshot
* @set_state_oneshot_stopped: switch state to oneshot_stopped
* @set_state_shutdown: switch state to shutdown
* @tick_resume: resume clkevt device
* @broadcast: function to broadcast events
* @min_delta_ticks: minimum delta value in ticks stored for reconfiguration
* @max_delta_ticks: maximum delta value in ticks stored for reconfiguration
* @name: ptr to clock event name
* @rating: variable to rate clock event devices
* @irq: IRQ number (only for non CPU local devices)
* @bound_on: Bound on CPU
* @cpumask: cpumask to indicate for which CPUs this device works
* @list: list head for the management code
* @owner: module reference
*/
struct clock_event_device {
void (*event_handler)(struct clock_event_device *);
上面这个句柄是此结构的关键,提供中断处理函数。
int (*set_next_event)(unsigned long evt, struct clock_event_device *);
设置下一次中断到期时间。或者说是下一次到期的中断。
int (*set_next_ktime)(ktime_t expires, struct clock_event_device *);
ktime_t next_event;
u64 max_delta_ns;
u64 min_delta_ns;
u32 mult;
u32 shift;
enum clock_event_state state_use_accessors;
unsigned int features;
unsigned long retries;
int (*set_state_periodic)(struct clock_event_device *);
int (*set_state_oneshot)(struct clock_event_device *);
int (*set_state_oneshot_stopped)(struct clock_event_device *);
int (*set_state_shutdown)(struct clock_event_device *);
int (*tick_resume)(struct clock_event_device *);
void (*broadcast)(const struct cpumask *mask);
void (*suspend)(struct clock_event_device *);
void (*resume)(struct clock_event_device *);
unsigned long min_delta_ticks;
unsigned long max_delta_ticks;
const char *name;
int rating;
int irq;
int bound_on;
const struct cpumask *cpumask;
struct list_head list;
struct module *owner;
} ____cacheline_aligned;
相关数据结构定义:
/* The registered clock event devices */ static LIST_HEAD(clockevent_devices); static LIST_HEAD(clockevents_released); /* Protection for the above */ static DEFINE_RAW_SPINLOCK(clockevents_lock); /* Protection for unbind operations */ static DEFINE_MUTEX(clockevents_mutex);
相关文章推荐
- Linux 内核时钟架构之时钟事件设备和tick_device绑定
- Linux 内核时钟架构之时钟事件设备注册
- Linux 内核时钟架构之时钟事件设备SYS接口
- Linux 内核时钟架构之时钟事件设备与tick_device
- Linux 内核时钟架构之时钟源设备注册
- Linux 内核时钟架构之时钟源读取计数
- Linux 内核时钟架构之时钟源设备SR
- Linux设备驱动程序架构分析之platform(基于3.10.1内核)
- Linux 内核时钟架构之时钟源模块对外接口
- Linux设备驱动程序架构分析之I2C架构(基于3.10.1内核)
- Linux 内核时钟架构之时钟源设备再论read
- Linux 内核时钟架构之时钟 tick初始化
- Linux 内核时钟架构之时钟源SYS 接口
- Linux 内核时钟架构之时钟源描述
- linux内核代码架构图-清晰版
- Linux内核的时钟中断机制
- Linux设备模型之tty驱动架构分析
- 面对不断升级的内核,如何学习linux设备驱动
- 从2.4 到2.6:Linux 内核可装载模块机制的改变对设备驱动的影响
- 嵌入式Linux内核时钟初始化问题