bottom_half.txt
来自「嵌入式linux学习之uclinux步进电机驱动实例(测试平台S3C44B0X,」· 文本 代码 · 共 48 行
TXT
48 行
static int using_jiffies = 0;
static struct wait_queue *tick_die_wait_queue = NULL;
static void timer_tick_handler(void *junk);
static struct tq_struct tick_queue_entry = {
NULL, 0, timer_tick_handler, NULL
};
static void bottom_half()
{
int rc;
char c;
tick_counter++;
if(tick_die_wait_queue){
using_jiffies = 0;
wake_up(tick_die_wait_queue);
}else{
if((skipticks == 0) || ((tick_counter % skipticks) == 0)){
if((xdest == xpos) && (ydest == ypos) && (zdest == zpos)){
while((rc = ring_buffer_read(&write_buffer, &c, 1)) == 1){
parse_one_char(c);
if((xdest != xpos) || (ydest != ypos) || (zdest != zpos)){
break;
}
}
if(write_is_sleeping){
wake_up_interruptible(&write_wait);
}
}
}
move_one_step();
if(using_jiffies){
queue_task(&tick_queue_entry, &tq_timer);
}
}
}
static void timer_tick_hander(void *junk)
{
bottom_half();
}
void interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
{
bottom_half();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?