⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bottom_half.txt

📁 嵌入式linux学习之uclinux步进电机驱动实例(测试平台S3C44B0X,uclinux系统)
💻 TXT
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -