易截截图软件、单文件、免安装、纯绿色、仅160KB

linux 0.11 内核学习 floppy.c,驱动你的软盘


/*
 *  linux/kernel/floppy.c
 *
 *  (C) 1991  Linus Torvalds
 */
/*
 * 02.12.91 - Changed to static variables to indicate need for reset
 * and recalibrate. This makes some things easier (output_byte reset
 * checking etc), and means less interrupt jumping in case of errors,
 * so the code is hopefully easier to understand.
 */
/*
 * This file is certainly a mess. I've tried my best to get it working,
 * but I don't like programming floppies, and I have only one anyway.
 * Urgel. I should check for more errors, and do more graceful error
 * recovery. Seems there are problems with several drives. I've tried to
 * correct them. No promises. 
 */
/*
 * As with hd.c, all routines within this file can (and will) be called
 * by interrupts, so extreme caution is needed. A hardware interrupt
 * handler may not sleep, or a kernel panic will happen. Thus I cannot
 * call "floppy-on" directly, but have to set a special timer interrupt
 * etc.
 *
 * Also, I'm not certain this works on more than 1 floppy. Bugs may
 * abund.
 */
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/fdreg.h> // 软驱头文件,其中包含软驱的常用函数的定义
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>
#define MAJOR_NR 2 // 软驱主设备号
#include "blk.h"
/* 全局标志变量 */
static int recalibrate = 0; // 需要重新校正
static int reset = 0; // 需要重新置位
static int seek = 0; // 寻道
extern unsigned char current_DOR; // 在文件sched.c中定义
#define immoutb_p(val,port) \ // 字节val直接输出到port
__asm__("outb %0,%1\n\tjmp 1f\n1:\tjmp 1f\n1:"::"a" ((char) (val)),"i" (port))
#define TYPE(x) ((x)>>2) // 软驱类型,2--1.2MB,7--1.44MB
#define DRIVE(x) ((x)&0x03) // 软驱序列号0-3对应A-D
/*
 * Note that MAX_ERRORS=8


相关文档:

实战Linux Bluetooth编程 (七) SDP协议

Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......

VMware虚拟机和宿主机共享文件夹(windows,linux)


在Windows宿主机中添加共享文件夹
1.选择 虚拟机 〉设置
2.选择 选项
3.点选 共享文件夹
4.点击Add按钮 打开共享文件夹向导 并点下一步
5.输入共享文件夹名字和位置 并点下一步
   Name —— 这个名字将出现在虚拟机内
   Host folder —— 在宿主机中你想共享的文件夹路 ......

Linux 系统目录介绍

/lib/
— 包含许多被 /bin/ 和 /sbin/  中的程序使用的库文件。目录 /usr/lib/ 中含有更多用于用户程序的库文件。
/lib目录下放置的是/bin和/sbin目录下程序所需的库文件。/lib目录下的文件的名称遵循下面的格式:
libc.so.*
ld*
仅仅被/usr目录下的程序所使用的共享库不必放到/lib目录下。只有/bin和/sbin ......

Linux下看代码的好工具Kscope

Kscope是Linux下的一款类似于SourceInsight工具,下面将其安装过程总结如下:
1.先下载kscope
kscope最新安装版本kscope-1.6.2.tar.gz
http://download.chinaunix.net/download/0006000/5469.shtml
按照说明#./configure
            #make
  &nb ......

linux shell 脚本 调用数据库

最近一直在忙项目,做的过程中遇到一个很纠结的事情。需要用shell脚本轮训数据库,数据执行完毕以后才能调用其他的shell脚本。在这里总结一下,与大家共享。
脚本如下:
shell 脚本如下:
#!/bin/sh
SQL_DIR=/home/tang/tek/sql/tek
SHELL_DIR=/home/tang/tek/sh/tek
LOG_DIR=/home/tang/tek/logs
. /home/tang/.bas ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号