mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
🆕 完成了printk(暂不支持浮点数打印)
This commit is contained in:
334
kernel/common/font.h
Normal file
334
kernel/common/font.h
Normal file
@ -0,0 +1,334 @@
|
||||
/***************************************************
|
||||
* 版权声明
|
||||
*
|
||||
* 本操作系统名为:MINE
|
||||
* 该操作系统未经授权不得以盈利或非盈利为目的进行开发,
|
||||
* 只允许个人学习以及公开交流使用
|
||||
*
|
||||
* 代码最终所有权及解释权归田宇所有;
|
||||
*
|
||||
* 本模块作者: 田宇
|
||||
* EMail: 345538255@qq.com
|
||||
*
|
||||
*
|
||||
***************************************************/
|
||||
|
||||
#ifndef __FONT_H__
|
||||
#define __FONT_H__
|
||||
|
||||
unsigned char font_ascii[256][16]=
|
||||
{
|
||||
/* 0000 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0010 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0020 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0030 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00}, //33 '!'
|
||||
{0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '"'
|
||||
{0x00,0x44,0x44,0x44,0xfe,0x44,0x44,0x44,0x44,0x44,0xfe,0x44,0x44,0x44,0x00,0x00}, // '#'
|
||||
{0x10,0x3a,0x56,0x92,0x92,0x90,0x50,0x38,0x14,0x12,0x92,0x92,0xd4,0xb8,0x10,0x10}, // '$'
|
||||
{0x62,0x92,0x94,0x94,0x68,0x08,0x10,0x10,0x20,0x2c,0x52,0x52,0x92,0x8c,0x00,0x00}, // '%'
|
||||
{0x00,0x70,0x88,0x88,0x88,0x90,0x60,0x47,0xa2,0x92,0x8a,0x84,0x46,0x39,0x00,0x00}, // '&'
|
||||
{0x04,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '''
|
||||
|
||||
/* 0040 */
|
||||
{0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00}, // '('
|
||||
{0x80,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00}, // ')'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x10,0x92,0x54,0x38,0x54,0x92,0x10,0x00,0x00,0x00,0x00}, // '*'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0xfe,0x10,0x10,0x10,0x00,0x00,0x00,0x00}, // '+'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x08,0x08,0x10}, // ','
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '-'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00}, // '.'
|
||||
{0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x80}, // '/'
|
||||
{0x00,0x18,0x24,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x24,0x18,0x00,0x00}, //48 '0'
|
||||
{0x00,0x08,0x18,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3e,0x00,0x00}, // '1'
|
||||
|
||||
/* 0050 */
|
||||
{0x00,0x18,0x24,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x20,0x40,0x40,0x7e,0x00,0x00}, // '2'
|
||||
{0x00,0x18,0x24,0x42,0x02,0x02,0x04,0x18,0x04,0x02,0x02,0x42,0x24,0x18,0x00,0x00}, // '3'
|
||||
{0x00,0x0c,0x0c,0x0c,0x14,0x14,0x14,0x24,0x24,0x44,0x7e,0x04,0x04,0x1e,0x00,0x00}, // '4'
|
||||
{0x00,0x7c,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x02,0x02,0x42,0x24,0x18,0x00,0x00}, // '5'
|
||||
{0x00,0x18,0x24,0x42,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00}, // '6'
|
||||
{0x00,0x7e,0x42,0x42,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x10,0x10,0x38,0x00,0x00}, // '7'
|
||||
{0x00,0x18,0x24,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x24,0x18,0x00,0x00}, // '8'
|
||||
{0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x26,0x1a,0x02,0x42,0x24,0x18,0x00,0x00}, // '9'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00}, //58 ':'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x08,0x08,0x10}, // ';'
|
||||
|
||||
/* 0060 */
|
||||
{0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x00}, // '<'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00}, // '='
|
||||
{0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x00}, // '>'
|
||||
{0x00,0x38,0x44,0x82,0x82,0x82,0x04,0x08,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00}, // '?'
|
||||
{0x00,0x38,0x44,0x82,0x9a,0xaa,0xaa,0xaa,0xaa,0xaa,0x9c,0x80,0x46,0x38,0x00,0x00}, // '@'
|
||||
{0x00,0x18,0x18,0x18,0x18,0x24,0x24,0x24,0x24,0x7e,0x42,0x42,0x42,0xe7,0x00,0x00}, //65 'A'
|
||||
{0x00,0xf0,0x48,0x44,0x44,0x44,0x48,0x78,0x44,0x42,0x42,0x42,0x44,0xf8,0x00,0x00}, // 'B'
|
||||
{0x00,0x3a,0x46,0x42,0x82,0x80,0x80,0x80,0x80,0x80,0x82,0x42,0x44,0x38,0x00,0x00}, // 'C'
|
||||
{0x00,0xf8,0x44,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0x44,0xf8,0x00,0x00}, // 'D'
|
||||
{0x00,0xfe,0x42,0x42,0x40,0x40,0x44,0x7c,0x44,0x40,0x40,0x42,0x42,0xfe,0x00,0x00}, // 'E'
|
||||
|
||||
/* 0070 */
|
||||
{0x00,0xfe,0x42,0x42,0x40,0x40,0x44,0x7c,0x44,0x44,0x40,0x40,0x40,0xf0,0x00,0x00}, // 'F'
|
||||
{0x00,0x3a,0x46,0x42,0x82,0x80,0x80,0x9e,0x82,0x82,0x82,0x42,0x46,0x38,0x00,0x00}, // 'G'
|
||||
{0x00,0xe7,0x42,0x42,0x42,0x42,0x42,0x7e,0x42,0x42,0x42,0x42,0x42,0xe7,0x00,0x00}, // 'H'
|
||||
{0x00,0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00}, // 'I'
|
||||
{0x00,0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x84,0x48,0x30,0x00}, // 'J'
|
||||
{0x00,0xe7,0x42,0x44,0x48,0x50,0x50,0x60,0x50,0x50,0x48,0x44,0x42,0xe7,0x00,0x00}, // 'K'
|
||||
{0x00,0xf0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0xfe,0x00,0x00}, // 'L'
|
||||
{0x00,0xc3,0x42,0x66,0x66,0x66,0x5a,0x5a,0x5a,0x42,0x42,0x42,0x42,0xe7,0x00,0x00}, // 'M'
|
||||
{0x00,0xc7,0x42,0x62,0x62,0x52,0x52,0x52,0x4a,0x4a,0x4a,0x46,0x46,0xe2,0x00,0x00}, // 'N'
|
||||
{0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00}, // 'O'
|
||||
|
||||
/* 0080 */
|
||||
{0x00,0xf8,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0x40,0x40,0x40,0x40,0xf0,0x00,0x00}, // 'P'
|
||||
{0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x92,0x8a,0x44,0x3a,0x00,0x00}, // 'Q'
|
||||
{0x00,0xfc,0x42,0x42,0x42,0x42,0x7c,0x44,0x42,0x42,0x42,0x42,0x42,0xe7,0x00,0x00}, // 'R'
|
||||
{0x00,0x3a,0x46,0x82,0x82,0x80,0x40,0x38,0x04,0x02,0x82,0x82,0xc4,0xb8,0x00,0x00}, // 'S'
|
||||
{0x00,0xfe,0x92,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00}, // 'T'
|
||||
{0x00,0xe7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x3c,0x00,0x00}, // 'U'
|
||||
{0x00,0xe7,0x42,0x42,0x42,0x42,0x24,0x24,0x24,0x24,0x18,0x18,0x18,0x18,0x00,0x00}, // 'V'
|
||||
{0x00,0xe7,0x42,0x42,0x42,0x5a,0x5a,0x5a,0x5a,0x24,0x24,0x24,0x24,0x24,0x00,0x00}, // 'W'
|
||||
{0x00,0xe7,0x42,0x42,0x24,0x24,0x24,0x18,0x24,0x24,0x24,0x42,0x42,0xe7,0x00,0x00}, // 'X'
|
||||
{0x00,0xee,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00}, // 'Y'
|
||||
|
||||
/* 0090 */
|
||||
{0x00,0xfe,0x84,0x84,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x42,0x82,0xfe,0x00,0x00}, // 'Z'
|
||||
{0x00,0x3e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3e,0x00}, //91 '['
|
||||
{0x80,0x80,0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02}, // '\'
|
||||
{0x00,0x7c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x7c,0x00}, // ']'
|
||||
{0x00,0x10,0x28,0x44,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '^'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x00}, // '_'
|
||||
{0x10,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '`'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x04,0x3c,0x44,0x84,0x84,0x8c,0x76,0x00,0x00}, //97 'a'
|
||||
{0xc0,0x40,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x42,0x64,0x58,0x00,0x00}, // 'b'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x30,0x4c,0x84,0x84,0x80,0x80,0x82,0x44,0x38,0x00,0x00}, // 'c'
|
||||
|
||||
/* 0100 */
|
||||
{0x0c,0x04,0x04,0x04,0x04,0x34,0x4c,0x84,0x84,0x84,0x84,0x84,0x4c,0x36,0x00,0x00}, // 'd'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x82,0x82,0xfc,0x80,0x82,0x42,0x3c,0x00,0x00}, // 'e'
|
||||
{0x0e,0x10,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7c,0x00,0x00}, // 'f'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x36,0x4c,0x84,0x84,0x84,0x84,0x4c,0x34,0x04,0x04,0x38}, // 'g'
|
||||
{0xc0,0x40,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x42,0x42,0x42,0xe3,0x00,0x00}, // 'h'
|
||||
{0x00,0x10,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00}, // 'i'
|
||||
{0x00,0x04,0x04,0x00,0x00,0x0c,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x30}, // 'j'
|
||||
{0xc0,0x40,0x40,0x40,0x40,0x4e,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0xe6,0x00,0x00}, // 'k'
|
||||
{0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00}, // 'l'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xf6,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0xdb,0x00,0x00}, // 'm'
|
||||
|
||||
/* 0110 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0xd8,0x64,0x42,0x42,0x42,0x42,0x42,0x42,0xe3,0x00,0x00}, // 'n'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00}, // 'o'
|
||||
{0x00,0x00,0x00,0x00,0xd8,0x64,0x42,0x42,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0xe0}, // 'p'
|
||||
{0x00,0x00,0x00,0x00,0x34,0x4c,0x84,0x84,0x84,0x84,0x84,0x4c,0x34,0x04,0x04,0x0e}, // 'q'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xdc,0x62,0x42,0x40,0x40,0x40,0x40,0x40,0xe0,0x00,0x00}, // 'r'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x7a,0x86,0x82,0xc0,0x38,0x06,0x82,0xc2,0xbc,0x00,0x00}, // 's'
|
||||
{0x00,0x00,0x10,0x10,0x10,0x7c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0e,0x00,0x00}, // 't'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xc6,0x42,0x42,0x42,0x42,0x42,0x42,0x46,0x3b,0x00,0x00}, // 'u'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xe7,0x42,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x00,0x00}, // 'v'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xe7,0x42,0x42,0x5a,0x5a,0x5a,0x24,0x24,0x24,0x00,0x00}, // 'w'
|
||||
|
||||
/* 0120 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0xc6,0x44,0x28,0x28,0x10,0x28,0x28,0x44,0xc6,0x00,0x00}, // 'x'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xe7,0x42,0x42,0x24,0x24,0x24,0x18,0x18,0x10,0x10,0x60}, // 'y'
|
||||
{0x00,0x00,0x00,0x00,0x00,0xfe,0x82,0x84,0x08,0x10,0x20,0x42,0x82,0xfe,0x00,0x00}, // 'z'
|
||||
{0x00,0x06,0x08,0x10,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x10,0x08,0x06,0x00,0x00}, // '{'
|
||||
{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}, // '|'
|
||||
{0x00,0x60,0x10,0x08,0x08,0x08,0x08,0x06,0x08,0x08,0x08,0x08,0x10,0x60,0x00,0x00}, // '}'
|
||||
{0x00,0x72,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '~'
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0130 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
|
||||
/* 0140 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0150 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0160 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0170 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0180 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0190 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0200 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0210 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0220 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0230 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0240 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
/* 0250~0255 */
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
105
kernel/common/glib.h
Normal file
105
kernel/common/glib.h
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// 内核全局通用库
|
||||
// Created by longjin on 2022/1/22.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#ifndef GLIB_H
|
||||
#define GLIB_H
|
||||
|
||||
//引入对bool类型的支持
|
||||
#include <stdbool.h>
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#define sti() __asm__ __volatile__("sti\n\t" :: \
|
||||
: "memory") //开启外部中断
|
||||
#define cli() __asm__ __volatile__("cli\n\t" :: \
|
||||
: "memory") //关闭外部中断
|
||||
#define nop() __asm__ __volatile__("nop\n\t")
|
||||
|
||||
//内存屏障
|
||||
#define io_mfence() __asm__ __volatile__("mfence\n\t" :: \
|
||||
: "memory") // 在mfence指令前的读写操作当必须在mfence指令后的读写操作前完成。
|
||||
#define io_sfence() __asm__ __volatile__("sfence\n\t" :: \
|
||||
: "memory") // 在sfence指令前的写操作当必须在sfence指令后的写操作前完成
|
||||
#define io_lfence() __asm__ __volatile__("lfence\n\t" :: \
|
||||
: "memory") // 在lfence指令前的读操作当必须在lfence指令后的读操作前完成。
|
||||
|
||||
#define ABS(x) ((x) > 0 ? (x) : -(x)) // 绝对值
|
||||
|
||||
//链表数据结构
|
||||
struct List
|
||||
{
|
||||
struct List *prev, *next;
|
||||
};
|
||||
|
||||
//初始化循环链表
|
||||
static inline void list_init(struct List *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static inline void list_add(struct List *entry, struct List *node)
|
||||
{
|
||||
/**
|
||||
* @brief 将node插入到entry后面
|
||||
* @param entry 给定的节点
|
||||
* @param node 待插入的节点
|
||||
*/
|
||||
|
||||
node->next = entry->next;
|
||||
node->next->prev = node;
|
||||
node->prev = entry;
|
||||
entry->next = node;
|
||||
}
|
||||
|
||||
static inline void list_append(struct List *entry, struct List *node)
|
||||
{
|
||||
/**
|
||||
* @brief 将node添加到给定的list的结尾(也就是当前节点的前面)
|
||||
* @param entry 列表的入口
|
||||
* @param node 待添加的节点
|
||||
*/
|
||||
|
||||
struct List *tail = entry->prev;
|
||||
list_add(tail, node);
|
||||
}
|
||||
|
||||
static inline void list_del(struct List *entry)
|
||||
{
|
||||
/**
|
||||
* @brief 从列表中删除节点
|
||||
* @param entry 待删除的节点
|
||||
*/
|
||||
|
||||
entry->prev->next = entry->next;
|
||||
entry->next = entry->prev;
|
||||
}
|
||||
|
||||
static inline bool list_empty(struct List *entry)
|
||||
{
|
||||
/**
|
||||
* @brief 判断循环链表是否为空
|
||||
* @param entry 入口
|
||||
*/
|
||||
|
||||
if (entry->prev == entry->next)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
//计算字符串的长度(经过测试,该版本比采用repne/scasb汇编的运行速度快16.8%左右)
|
||||
static inline int strlen(char *s)
|
||||
{
|
||||
register int __res = 0;
|
||||
while (s[__res] != '\0')
|
||||
{
|
||||
++__res;
|
||||
}
|
||||
return __res;
|
||||
}
|
||||
|
||||
#endif
|
576
kernel/common/printk.c
Normal file
576
kernel/common/printk.c
Normal file
@ -0,0 +1,576 @@
|
||||
//
|
||||
// Created by longjin on 2022/1/22.
|
||||
//
|
||||
#include "printk.h"
|
||||
#include <math.h>
|
||||
//#include "linkage.h"
|
||||
|
||||
struct screen_info pos;
|
||||
|
||||
void show_color_band(int width, int height, char a, char b, char c, char d)
|
||||
{
|
||||
/** 向帧缓冲区写入像素值
|
||||
* @param address: 帧缓存区的地址
|
||||
* @param val:像素值
|
||||
*/
|
||||
|
||||
for (int i = 0; i < width * height; ++i)
|
||||
{
|
||||
|
||||
*((char *)pos.FB_address + 0) = d;
|
||||
*((char *)pos.FB_address + 1) = c;
|
||||
*((char *)pos.FB_address + 2) = b;
|
||||
*((char *)pos.FB_address + 3) = a;
|
||||
++pos.FB_address;
|
||||
}
|
||||
}
|
||||
|
||||
int calculate_max_charNum(int len, int size)
|
||||
{
|
||||
/**
|
||||
* @brief 计算屏幕上能有多少行
|
||||
* @param len 屏幕长/宽
|
||||
* @param size 字符长/宽
|
||||
*/
|
||||
return len / size;
|
||||
}
|
||||
|
||||
int init_printk(const int width, const int height, unsigned int *FB_address, const int FB_length, const int char_size_x, const int char_size_y)
|
||||
{
|
||||
|
||||
pos.width = width;
|
||||
pos.height = height;
|
||||
pos.char_size_x = char_size_x;
|
||||
pos.char_size_y = char_size_y;
|
||||
pos.max_x = calculate_max_charNum(width, char_size_x);
|
||||
pos.max_y = calculate_max_charNum(height, char_size_y);
|
||||
|
||||
pos.FB_address = FB_address;
|
||||
pos.FB_length = FB_length;
|
||||
|
||||
pos.x = 0;
|
||||
pos.y = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_printk_pos(const int x, const int y)
|
||||
{
|
||||
// 指定的坐标不在屏幕范围内
|
||||
if (!((x >= 0 && x <= pos.max_x) && (y >= 0 && y <= pos.max_y)))
|
||||
return EPOS_OVERFLOW;
|
||||
pos.x = x;
|
||||
pos.y = y;
|
||||
return 0;
|
||||
}
|
||||
int skip_and_atoi(const char **s)
|
||||
{
|
||||
/**
|
||||
* @brief 获取连续的一段字符对应整数的值
|
||||
* @param:**s 指向 指向字符串的指针 的指针
|
||||
*/
|
||||
int ans = 0;
|
||||
while (is_digit(**s))
|
||||
{
|
||||
ans = ans * 10 + (**s) - '0';
|
||||
++(*s);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
void auto_newline()
|
||||
{
|
||||
/**
|
||||
* @brief 超过每行最大字符数,自动换行
|
||||
*
|
||||
*/
|
||||
if (pos.x > pos.max_x)
|
||||
{
|
||||
pos.x = 0;
|
||||
++pos.y;
|
||||
}
|
||||
if (pos.y > pos.max_y)
|
||||
pos.y = 0;
|
||||
}
|
||||
|
||||
static int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
{
|
||||
/**
|
||||
* 将字符串按照fmt和args中的内容进行格式化,然后保存到buf中
|
||||
* @param buf 结果缓冲区
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 内容
|
||||
* @return 最终字符串的长度
|
||||
*/
|
||||
|
||||
char *str, *s;
|
||||
|
||||
str = buf;
|
||||
|
||||
int flags; // 用来存储格式信息的bitmap
|
||||
int field_width; //区域宽度
|
||||
int precision; //精度
|
||||
int qualifier; //数据显示的类型
|
||||
int len;
|
||||
|
||||
//开始解析字符串
|
||||
for (; *fmt; ++fmt)
|
||||
{
|
||||
//内容不涉及到格式化,直接输出
|
||||
if (*fmt != '%')
|
||||
{
|
||||
*str = *fmt;
|
||||
++str;
|
||||
continue;
|
||||
}
|
||||
|
||||
//开始格式化字符串
|
||||
|
||||
//清空标志位和field宽度
|
||||
field_width = flags = 0;
|
||||
|
||||
bool flag_tmp = true;
|
||||
bool flag_break = false;
|
||||
|
||||
++fmt;
|
||||
while (flag_tmp)
|
||||
{
|
||||
switch (*fmt)
|
||||
{
|
||||
case '\0':
|
||||
//结束解析
|
||||
flag_break = true;
|
||||
flag_tmp = false;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
// 左对齐
|
||||
flags |= LEFT;
|
||||
++fmt;
|
||||
break;
|
||||
case '+':
|
||||
//在正数前面显示加号
|
||||
flags |= PLUS;
|
||||
++fmt;
|
||||
break;
|
||||
case ' ':
|
||||
flags |= SPACE;
|
||||
++fmt;
|
||||
break;
|
||||
case '#':
|
||||
//在八进制数前面显示 '0o',在十六进制数前面显示 '0x' 或 '0X'
|
||||
flags |= SPECIAL;
|
||||
++fmt;
|
||||
break;
|
||||
case '0':
|
||||
//显示的数字之前填充‘0’来取代空格
|
||||
flags |= PAD_ZERO;
|
||||
++fmt;
|
||||
break;
|
||||
default:
|
||||
flag_tmp = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag_break)
|
||||
break;
|
||||
|
||||
//获取区域宽度
|
||||
field_width = -1;
|
||||
if (*fmt == '*')
|
||||
{
|
||||
field_width = va_arg(args, int);
|
||||
++fmt;
|
||||
}
|
||||
else if (is_digit(*fmt))
|
||||
{
|
||||
field_width = skip_and_atoi(&fmt);
|
||||
if (field_width < 0)
|
||||
{
|
||||
field_width = -field_width;
|
||||
flags |= LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
//获取小数精度
|
||||
precision = -1;
|
||||
if (*fmt == '.')
|
||||
{
|
||||
++fmt;
|
||||
if (*fmt == '*')
|
||||
{
|
||||
precision = va_arg(args, int);
|
||||
++fmt;
|
||||
}
|
||||
else if is_digit (*fmt)
|
||||
{
|
||||
precision = skip_and_atoi(&fmt);
|
||||
}
|
||||
}
|
||||
|
||||
//获取要显示的数据的类型
|
||||
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z')
|
||||
{
|
||||
qualifier = *fmt;
|
||||
++fmt;
|
||||
}
|
||||
//为了支持lld
|
||||
if (qualifier == 'l' && *fmt == 'l', *(fmt + 1) == 'd')
|
||||
++fmt;
|
||||
|
||||
//转化成字符串
|
||||
long long *ip;
|
||||
switch (*fmt)
|
||||
{
|
||||
//输出 %
|
||||
case '%':
|
||||
*str++ = '%';
|
||||
|
||||
break;
|
||||
// 显示一个字符
|
||||
case 'c':
|
||||
//靠右对齐
|
||||
if (!(flags & LEFT))
|
||||
{
|
||||
while (--field_width > 0)
|
||||
{
|
||||
*str = ' ';
|
||||
++str;
|
||||
}
|
||||
}
|
||||
|
||||
*str++ = (unsigned char)va_arg(args, int);
|
||||
|
||||
while (--field_width > 0)
|
||||
{
|
||||
*str = ' ';
|
||||
++str;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//显示一个字符串
|
||||
case 's':
|
||||
s = va_arg(args, char *);
|
||||
if (!s)
|
||||
s = '\0';
|
||||
len = strlen(s);
|
||||
if (precision < 0)
|
||||
{
|
||||
//未指定精度
|
||||
precision = len;
|
||||
}
|
||||
|
||||
else if (len > precision)
|
||||
{
|
||||
len = precision;
|
||||
}
|
||||
|
||||
//靠右对齐
|
||||
if (!(flags & LEFT))
|
||||
while (len < field_width--)
|
||||
{
|
||||
*str = ' ';
|
||||
++str;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
*str = *s;
|
||||
++s;
|
||||
++str;
|
||||
}
|
||||
|
||||
while (len < field_width--)
|
||||
{
|
||||
*str = ' ';
|
||||
++str;
|
||||
}
|
||||
|
||||
break;
|
||||
//以八进制显示字符串
|
||||
case 'o':
|
||||
flags |= SMALL;
|
||||
case 'O':
|
||||
flags |= SPECIAL;
|
||||
if (qualifier == 'l')
|
||||
str = write_num(str, va_arg(args, long long), 8, field_width, precision, flags);
|
||||
else
|
||||
str = write_num(str, va_arg(args, int), 8, field_width, precision, flags);
|
||||
break;
|
||||
|
||||
//打印指针指向的地址
|
||||
case 'p':
|
||||
if (field_width == 0)
|
||||
{
|
||||
field_width = 2 * sizeof(void *);
|
||||
flags |= PAD_ZERO;
|
||||
}
|
||||
|
||||
str = write_num(str, (unsigned long)va_arg(args, void *), 16, field_width, precision, flags);
|
||||
|
||||
break;
|
||||
|
||||
//打印十六进制
|
||||
case 'x':
|
||||
flags |= SMALL;
|
||||
case 'X':
|
||||
flags |= SPECIAL;
|
||||
if (qualifier == 'l')
|
||||
str = write_num(str, va_arg(args, long long), 16, field_width, precision, flags);
|
||||
else
|
||||
str = write_num(str, va_arg(args, int), 16, field_width, precision, flags);
|
||||
break;
|
||||
|
||||
//打印十进制有符号整数
|
||||
case 'i':
|
||||
case 'd':
|
||||
|
||||
flags |= SIGN;
|
||||
if (qualifier == 'l')
|
||||
str = write_num(str, va_arg(args, long long), 10, field_width, precision, flags);
|
||||
else
|
||||
str = write_num(str, va_arg(args, int), 10, field_width, precision, flags);
|
||||
break;
|
||||
|
||||
//打印十进制无符号整数
|
||||
case 'u':
|
||||
if (qualifier == 'l')
|
||||
str = write_num(str, va_arg(args, unsigned long long), 10, field_width, precision, flags);
|
||||
else
|
||||
str = write_num(str, va_arg(args, unsigned int), 10, field_width, precision, flags);
|
||||
break;
|
||||
|
||||
//输出有效字符数量到*ip对应的变量
|
||||
case 'n':
|
||||
|
||||
if (qualifier == 'l')
|
||||
ip = va_arg(args, long long *);
|
||||
else
|
||||
ip = va_arg(args, int *);
|
||||
|
||||
*ip = str - buf;
|
||||
break;
|
||||
|
||||
//对于不识别的控制符,直接输出
|
||||
default:
|
||||
*str++ = '%';
|
||||
if (*fmt)
|
||||
*str++ = *fmt;
|
||||
else
|
||||
--fmt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*str = '\0';
|
||||
|
||||
//返回缓冲区已有字符串的长度。
|
||||
return str - buf;
|
||||
}
|
||||
|
||||
static char *write_num(char *str, long long num, int base, int field_width, int precision, int flags)
|
||||
{
|
||||
/**
|
||||
* @brief 将数字按照指定的要求转换成对应的字符串
|
||||
*
|
||||
* @param str 要返回的字符串
|
||||
* @param num 要打印的数值
|
||||
* @param base 基数
|
||||
* @param field_width 区域宽度
|
||||
* @param precision 精度
|
||||
* @param flags 标志位
|
||||
*/
|
||||
|
||||
// 首先判断是否支持该进制
|
||||
if (base < 2 || base > 36)
|
||||
return 0;
|
||||
char pad, sign, tmp_num[100];
|
||||
|
||||
const char *digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
// 显示小写字母
|
||||
if (flags & SMALL)
|
||||
digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
// 设置填充元素
|
||||
pad = (flags & PAD_ZERO) ? '0' : ' ';
|
||||
|
||||
sign = 0;
|
||||
if (flags & SIGN && num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = -num;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 设置符号
|
||||
sign = (flags & PLUS) ? '+' : ((flags & SPACE) ? ' ' : 0);
|
||||
}
|
||||
|
||||
// sign占用了一个宽度
|
||||
if (sign)
|
||||
--field_width;
|
||||
|
||||
if (flags & SPECIAL)
|
||||
if (base == 16) // 0x占用2个位置
|
||||
field_width -= 2;
|
||||
else if (base == 8) // O占用一个位置
|
||||
--field_width;
|
||||
|
||||
int js_num = 0; // 临时数字字符串tmp_num的长度
|
||||
|
||||
if (num == 0)
|
||||
tmp_num[js_num++] = '0';
|
||||
else
|
||||
{
|
||||
num = ABS(num);
|
||||
//进制转换
|
||||
while (num > 0)
|
||||
{
|
||||
tmp_num[js_num++] = digits[num % base]; // 注意这里,输出的数字,是小端对齐的。低位存低位
|
||||
num /= base;
|
||||
}
|
||||
}
|
||||
|
||||
if (js_num > precision)
|
||||
precision = js_num;
|
||||
|
||||
field_width -= precision;
|
||||
|
||||
// 靠右对齐
|
||||
if (!(flags & LEFT))
|
||||
while (field_width-- > 0)
|
||||
*str++ = pad;
|
||||
|
||||
if (sign)
|
||||
*str++ = sign;
|
||||
if (flags & SPECIAL)
|
||||
if (base == 16)
|
||||
{
|
||||
*str++ = '0';
|
||||
*str++ = digits[33];
|
||||
}
|
||||
else if (base == 8)
|
||||
*str++ = digits[24]; //注意这里是英文字母O或者o
|
||||
|
||||
while (js_num < precision)
|
||||
{
|
||||
--precision;
|
||||
*str++ = '0';
|
||||
}
|
||||
|
||||
while (js_num-- > 0)
|
||||
*str++ = tmp_num[js_num];
|
||||
|
||||
|
||||
while (field_width-- > 0)
|
||||
*str++ = ' ';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static void putchar(unsigned int *fb, int Xsize, int x, int y, unsigned int FRcolor, unsigned int BKcolor, unsigned char font)
|
||||
{
|
||||
/**
|
||||
* @brief 在屏幕上指定位置打印字符
|
||||
*
|
||||
* @param fb 帧缓存线性地址
|
||||
* @param Xsize 行分辨率
|
||||
* @param x 左上角列像素点位置
|
||||
* @param y 左上角行像素点位置
|
||||
* @param FRcolor 字体颜色
|
||||
* @param BKcolor 背景颜色
|
||||
* @param font 字符的bitmap
|
||||
*/
|
||||
|
||||
unsigned char *font_ptr = font_ascii[font];
|
||||
unsigned int *addr;
|
||||
|
||||
int testbit; // 用来测试某位是背景还是字体本身
|
||||
|
||||
for (int i = 0; i < pos.char_size_y; ++i)
|
||||
{
|
||||
// 计算出帧缓冲区的地址
|
||||
addr = fb + Xsize * (y + i) + x;
|
||||
testbit = (1 << (pos.char_size_x + 1));
|
||||
for (int j = 0; j < pos.char_size_x; ++j)
|
||||
{
|
||||
//从左往右逐个测试相应位
|
||||
testbit >>= 1;
|
||||
if (*font_ptr & testbit)
|
||||
*addr = FRcolor; // 字,显示前景色
|
||||
else
|
||||
*addr = BKcolor; // 背景色
|
||||
|
||||
++addr;
|
||||
}
|
||||
++font_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
int printk_color(unsigned int FRcolor, unsigned int BKcolor, const char *fmt, ...)
|
||||
{
|
||||
/**
|
||||
* @brief 格式化打印字符串
|
||||
*
|
||||
* @param FRcolor 前景色
|
||||
* @param BKcolor 背景色
|
||||
* @param ... 格式化字符串
|
||||
*/
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
int len = vsprintf(buf, fmt, args);
|
||||
|
||||
va_end(args);
|
||||
unsigned char current;
|
||||
|
||||
int i; // 总共输出的字符数
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
current = *(buf + i);
|
||||
//输出换行
|
||||
if (current == '\n')
|
||||
{
|
||||
pos.x = 0;
|
||||
++pos.y;
|
||||
}
|
||||
else if (current == '\t') // 输出制表符
|
||||
{
|
||||
int space_to_print = 8 - pos.x % 8;
|
||||
|
||||
while (space_to_print--)
|
||||
{
|
||||
putchar(pos.FB_address, pos.width, pos.x * pos.char_size_x, pos.y * pos.char_size_y, BLACK, BLACK, ' ');
|
||||
++pos.x;
|
||||
|
||||
auto_newline();
|
||||
}
|
||||
}
|
||||
else if (current == '\b') // 退格
|
||||
{
|
||||
--pos.x;
|
||||
if (pos.x < 0)
|
||||
{
|
||||
--pos.y;
|
||||
if (pos.y <= 0)
|
||||
pos.x = pos.y = 0;
|
||||
else
|
||||
pos.x = pos.max_x;
|
||||
}
|
||||
|
||||
putchar(pos.FB_address, pos.width, pos.x * pos.char_size_x, pos.y * pos.char_size_y, FRcolor, BKcolor, ' ');
|
||||
++pos.x;
|
||||
|
||||
auto_newline();
|
||||
}
|
||||
else
|
||||
{
|
||||
putchar(pos.FB_address, pos.width, pos.x * pos.char_size_x, pos.y * pos.char_size_y, FRcolor, BKcolor, current);
|
||||
++pos.x;
|
||||
auto_newline();
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
124
kernel/common/printk.h
Normal file
124
kernel/common/printk.h
Normal file
@ -0,0 +1,124 @@
|
||||
//
|
||||
// Created by longjin on 2022/1/21.
|
||||
//
|
||||
#pragma once
|
||||
#ifndef PRINTK_H
|
||||
#define PRINTK_H
|
||||
|
||||
#define PAD_ZERO 1 // 0填充
|
||||
#define LEFT 2 // 靠左对齐
|
||||
#define RIGHT 4 // 靠右对齐
|
||||
#define PLUS 8 // 在正数前面显示加号
|
||||
#define SPACE 16
|
||||
#define SPECIAL 32 // 在八进制数前面显示 '0o',在十六进制数前面显示 '0x' 或 '0X'
|
||||
#define SMALL 64 // 十进制以上数字显示小写字母
|
||||
#define SIGN 128 // 显示符号位
|
||||
|
||||
#define is_digit(c) ((c) >= '0' && (c) <= '9') // 用来判断是否是数字的宏
|
||||
|
||||
// 字体颜色的宏定义
|
||||
#define WHITE 0x00ffffff //白
|
||||
#define BLACK 0x00000000 //黑
|
||||
#define RED 0x00ff0000 //红
|
||||
#define ORANGE 0x00ff8000 //橙
|
||||
#define YELLOW 0x00ffff00 //黄
|
||||
#define GREEN 0x0000ff00 //绿
|
||||
#define BLUE 0x000000ff //蓝
|
||||
#define INDIGO 0x0000ffff //靛
|
||||
#define PURPLE 0x008000ff //紫
|
||||
|
||||
// 异常的宏定义
|
||||
#define EPOS_OVERFLOW 1 // 坐标溢出
|
||||
#define EFB_MISMATCH 2 // 帧缓冲区与指定的屏幕大小不匹配
|
||||
|
||||
#include "font.h"
|
||||
#include "glib.h"
|
||||
//#include "linkage.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
struct screen_info
|
||||
{
|
||||
int width, height; //屏幕大小
|
||||
|
||||
int max_x, max_y; // 最大x、y字符数
|
||||
|
||||
int x, y; //光标位置
|
||||
|
||||
int char_size_x, char_size_y;
|
||||
|
||||
unsigned int *FB_address; //帧缓冲区首地址
|
||||
unsigned long FB_length; // 帧缓冲区长度
|
||||
};
|
||||
|
||||
|
||||
extern unsigned char font_ascii[256][16]; //导出ascii字体的bitmap(8*16大小) ps:位于font.h中
|
||||
|
||||
char buf[4096]; //vsprintf()的缓冲区
|
||||
|
||||
/**
|
||||
* @brief 初始化printk的屏幕信息
|
||||
*
|
||||
* @param width 屏幕宽度
|
||||
* @param height 屏幕高度
|
||||
* @param FB_address 帧缓冲区地址
|
||||
* @param FB_length 帧缓冲区长度
|
||||
* @param char_size_x 字符的列坐标
|
||||
* @param char_size_y 字符的行坐标
|
||||
*/
|
||||
int init_printk(const int width, const int height, unsigned int *FB_address, const int FB_length, const int char_size_x, const int char_size_y);
|
||||
/**
|
||||
* @brief Set the printk pos object
|
||||
*
|
||||
* @param x 列坐标
|
||||
* @param y 行坐标
|
||||
*/
|
||||
static int set_printk_pos(const int x, const int y);
|
||||
/**
|
||||
* @brief 将字符串按照fmt和args中的内容进行格式化,然后保存到buf中
|
||||
*
|
||||
* @param buf 结果缓冲区
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 内容
|
||||
* @return 最终字符串的长度
|
||||
*/
|
||||
static int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
|
||||
/**
|
||||
* @brief 将数字按照指定的要求转换成对应的字符串(2~36进制)
|
||||
*
|
||||
* @param str 要返回的字符串
|
||||
* @param num 要打印的数值
|
||||
* @param base 基数
|
||||
* @param field_width 区域宽度
|
||||
* @param precision 精度
|
||||
* @param flags 标志位
|
||||
*/
|
||||
static char* write_num(char *str, long long num, int base, int field_width, int precision, int flags);
|
||||
|
||||
/**
|
||||
* @brief 在屏幕上指定位置打印字符
|
||||
*
|
||||
* @param fb 帧缓存线性地址
|
||||
* @param Xsize 行分辨率
|
||||
* @param x 左上角列像素点位置
|
||||
* @param y 左上角行像素点位置
|
||||
* @param FRcolor 字体颜色
|
||||
* @param BKcolor 背景颜色
|
||||
* @param font 字符的bitmap
|
||||
*/
|
||||
static void putchar(unsigned int *fb, int Xsize, int x, int y, unsigned int FRcolor, unsigned int BKcolor, unsigned char font);
|
||||
|
||||
/**
|
||||
* @brief 格式化打印字符串
|
||||
*
|
||||
* @param FRcolor 前景色
|
||||
* @param BKcolor 背景色
|
||||
* @param ... 格式化字符串
|
||||
*/
|
||||
|
||||
|
||||
#define printk(...) printk_color( WHITE, BLACK, __VA_ARGS__ )
|
||||
|
||||
int printk_color(unsigned int FRcolor, unsigned int BKcolor, const char*fmt, ...);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user