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

📄 lcd.h

📁 用于Linux 2.4内核的LCD及键盘驱动
💻 H
字号:
#ifndef LCD_H#define LCD_H#define SUCCESS      0		/*function successfully return */#define DEVICE_NAME "my_lcd"	/*define lcd device name */#define LCD_MAJOR   188		/*define the lcd device major number *//**Mpc860 memory control register set*/#define BR7_SET 0x80000401#define OR7_SET 0xffff0ff4/**Set led control */#define LED_ADDR 0x8000001b#define LED_OFF  0xff#define LED_ON  0x80/**Lcd control command*/#define ENABLE_OFF 0x00#define ENABLE_ON 0x02#define WRITE_REG 0x00#define WRITE_DATA 0x01#define FUNCTION_SET   0x1c#define DISPLAY_OFF    0x10#define DISPLAY_ON     0x70#define DISPLAY_CLEAR  0x80#define INPUT_MODE_SET 0x60#define CHANGE_LINE    0x03#define LCD_BASE  0x80000000#define LCD_DATA_ADDR 0x8000001d#define LCD_CTRREG_ADDR 0x80000017#define LCD_VIRT_LENGTH 0x1ff/**Define bit-swap operations*/#define S_B7(x) (((x) & 0x80)>>7)#define S_B6(x) (((x) & 0x40)>>5)#define S_B5(x) (((x) & 0x20)>>3)#define S_B4(x) (((x) & 0x10)>>1)#define S_B3(x) (((x) & 0x08)<<1)#define S_B2(x) (((x) & 0x04)<<3)#define S_B1(x) (((x) & 0x02)<<5)#define S_B0(x) (((x) & 0x01)<<7)#define BIT_SWAP(x) (S_B7(x) | S_B6(x)|S_B5(x) | S_B4(x)| S_B3(x)                                 | S_B2(x)| S_B1(x)| S_B0(x))/**Standard device_driver function prototypes declaratioins*/static int device_open (struct inode *, struct file *);static int device_release (struct inode *, struct file *);static ssize_t device_write (struct file *, const char *, size_t, loff_t *);/**Standard moudle functions prototypes declarations*/int init_module (void);void cleanup_module (void);/**LCD control functions prototypes declarations*/static int lcd_init (void);static void lcd_ctr_init (void);static int init_mem (void);static void lcd_set (unsigned char);static void showch (unsigned char);struct file_operations lcd_ops = {write:device_write,open:device_open,release:device_release,};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -