Category Archives: LINUX

LINUX 设备驱动模板

Linux下的驱动程序虽然复杂,但是总结下来还是有很多的规律可寻。Linux下的设备驱动开始编程时显得比较容易,可以轻松地开始驱动编写,但是要把驱动写好也的确需要花一定的时间去研究。 1.设备驱动模板 设备驱动模板代码如例程5-4所示。 例程5 4  Mydriver.c #include <linux/module.h>#include <linux/config.h>#include <linux/types.h>#include <linux/kernel.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/miscdevice.h>#include <linux/ioctl.h>#include <linux/interrupt.h>#include <linux/spinlock.h>#include <linux/smp_lock.h>#include <linux/poll.h>#include <linux/sched.h>#include <linux/ioport.h>#include <linux/slab.h>#include <asm/hardware.h>#include <asm/io.h>#include <asm/arch/irqs.h>#include <asm/irq.h>#include <asm/signal.h>#include <asm/uaccess.h>/*定义设备的从设备号*/#define MYDRIVER_MINOR 174/*定义设备相关数据结构*/typedef struct _MYDRIVER_DEV{spinlock_t dev_lock;wait_queue_head_t oWait; int open_count; }MYDRIVER_DEV, *PMYDRIVER_DEV;/*定义设备状态数据结构*/typedef struct _MYDRIVER_DEV_STATS{unsigned … Continue reading

Posted in LINUX | 2 Comments

at91rm9200上移植u-boot(转)

================== 准备工作================= 1.阅读at91rm9200 官方文档有关“引导程序”的章节 对at91rm9200的启动流程有个大概的了解。 at91rm9200引导流程图 Device Setup | | Boot SPI DataFlash Boot --> Download from DataFlash --> run | | TWI EEPROM Boot --> Download from EEPROM --> run | | Parallel Boot --> Download from 8-bit Device … Continue reading

Posted in LINUX | Leave a comment

LINUX终端常用命令

cd      进入目录  如:    cd ..        进入上一层目录    cd /         至根目录    cd file      进入当前某个目录 ls      查看指令 如 ls      查看当前目录下文件以及文件夹,不包含隐藏文件 ls -a   查看当前目录下文件以及文件夹,包含隐藏文件 more  查看文件命令 cat   同上 vi    编绎文件命令 cp    拷贝文件,如 cp file1 /tmp 把当前目录下的file1拷贝至tmp目录 tar -xjvf  解压bz2文件到当前目录 tar -xzvf  … Continue reading

Posted in LINUX | Leave a comment