linux 0.11 内核学习 console.c,控制台
参考《linux内核完全注释》和网上相关文章
/*
* 控制台显示操作
*/
/*
* linux/kernel/console.c
*
* (C) 1991 Linus Torvalds
*/
/*
* console.c
*
* This module implements the console io functions
* 'void con_init(void)'
* 'void con_write(struct tty_queue * queue)'
* Hopefully this will be a rather complete VT102 implementation.
*
* Beeping thanks to John T Kohl.
*/
/**********************
* con_init con_write *
**********************/
/*
* NOTE!!! We sometimes disable and enable interrupts for a short while
* (to put a word in video IO), but this will work even for keyboard
* interrupts. We know interrupts aren't enabled when getting a keyboard
* interrupt, as we use trap-gates. Hopefully all is well.
*/
/*
* Code to check for different video-cards mostly by Galen Hunt,
* <g-hunt@ee.utah.edu>
*/
#include <linux/sched.h>
#include <linux/tty.h> // 定义tty_struct结构,串行通信方面的参数和常量
#include <asm/io.h> // 硬件对应的汇编io指令
#include <asm/system.h>
/*
* These are set up by the setup-routine at boot-time:
*/
#define ORIG_X (*(unsigned char *)0x90000) // 光标列号
#define ORIG_Y (*(unsigned char *)0x90001) // 光标行号
#define ORIG_VIDEO_PAGE (*(unsigned short *)0x90004) // 显示页面
#define ORIG_VIDEO_MODE ((*(unsigned short *)0x90006) & 0xff) // 显示模式
#define ORIG_VIDEO_COLS (((*(unsigned short *)0x90006) & 0xff00) >> 8) // 字符列数
#define ORIG_VIDEO_LINES (25) // 字符行数
#define ORIG_VIDEO_EGA_AX (*(unsigned short *)0x90008) // ??
#define ORIG_VIDEO_EGA_BX (*(unsigned short *)0x9000a) // 显示内存大小和色彩模式
#define ORIG_VIDEO_EGA_CX (*(unsigned short *)0x9000c) // 显示卡特性参数
#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display,单色文本 */
#define VIDEO_TYPE_CGA 0x11
相关文档:
Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......
有次一个同事问我
swc ^= swc;
是什么意思,我也不知道,查了下,意思应该是将swc变量清0,疑惑的是为什么就不能写成 swc = 0; 呢?不明白
顺便记录下其他的操作,碰到新的再追加:
swc = ~swc; //变量取反 ......
谈谈C语言的malloc()和free()
一、malloc()和free()的基本概念以及基本用法:
1、函数原型及说明:
void *malloc(long NumBytes):该函数分配了NumBytes个字节,并返回了指向这块内存的指针。如果分配失败,则返回一个空指针(NULL)。
关于分配失败的原因,应该有多种,比如说空间不足就是一种。
void free(void *Fir ......
char *strcpy(char *strDes, const char *strSrc)
{
assert((strDes != NULL) && (strSrc != NULL));
char *address = strDes;
while ((*strDes + ......
window下的sqlplus可以通过箭头键,来回看历史命令,用起来非常的方便。
但是在linux里就没有这么方面了,错了一个命令,我们必须重新敲一次,辛苦了手指头叻。
看到一个文章,很方便的一招,给我们带来方便。
通过rlwrap包实现linux里的sqlplus历史命令的功能
可以下载rlwrap包从inthirties里。
这个包依赖readline包 ......