📄 step.h
字号:
#define STEPPER_SET_DEBUG 0X1641
#define STEPPER_SET_SKIPTICKS 0X1642
#define STEPPER_SET_VERBOSE_IO 0X1643
#define STEPPER_SET_VERVOSE_MOVE 0X1644
#define STEPPER_START 0X1645
#define STEPPER_STOP 0X1646
#define STEPPER_CLEAR_BUFFERS 0X1647
#define STEPPER_NOAUTO 0X1648
#define STEPPER_AUTO 0X1649
#include <linux/kernel.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/tqueue.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <string.h>
#include <ring.h>
ring_buffer_t read_buffer;
ring_buffer_t write_buffer;
static int irq = 0;
static int major = 31;
static int stepper_major = 0;
struct wait_queue *read_wait = NULL;
struct wait_queue *write_wait = NULL;
static int verbose_io;
static int verbose_move;
static int base = 0x378;
static int power_down_on_exit = 1;
static int delay = 50000;
static int fastdelay = 0;
static int do_io = 1;
static int read_is_sleeping = 0;
static int write_is_sleeping = 0;
static int abort_read = 0;
static int abort_write = 0;
static int read_is_open = 0;
static int write_is_open = 0;
static int interrupts_are_enabled = 0;
static int autostart = 1;
static int tick_counter = 0;
int xdest = 0;
int xuser = 0;
int xpos = 0;
int ydest = 0;
int yuser = 0;
int ypos = 0;
int zdest = 0;
int zuser = 0;
int zpos = 0;
unsigned short word;
void verbose_outb(int port, int value)
{
printf("outb(%02X, %04X)", port, value);
}
void report_status()
{
char buf[128];
int rc;
int i;
int len;
sprintf(buf, "x = %d, y = %d, z = %d,word = %08X\n", xpos, ypos, zpos, word);
len = strlen(buf);
for(i = 0; i < len; i++){
rc = ring_buffer_write(&read_buffer, &buf[i], 1);
}
if(read_is_sleeping){
wake_up_interruptible(&read_wait);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -