printk.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Created by longjin on 2022/1/21.
  3. //
  4. #pragma once
  5. #define PAD_ZERO 1 // 0填充
  6. #define LEFT 2 // 靠左对齐
  7. #define RIGHT 4 //靠右对齐
  8. #define PLUS 8 // 在正数前面显示加号
  9. #define SPACE 16
  10. #define SPECIAL 32 //在八进制数前面显示 '0o',在十六进制数前面显示 '0x' 或 '0X'
  11. #define is_digit(c) ((c) >= '0' && (c) <= '9') // 用来判断是否是数字的宏
  12. #include "font.h"
  13. #include "glib.h"
  14. #include <stdarg.h>
  15. struct screen_info
  16. {
  17. int width, height; //屏幕大小
  18. int x, y; //光标位置
  19. int char_size_x, char_size_y;
  20. unsigned int *FB_address; //帧缓冲区首地址
  21. unsigned long FB_length; // 帧缓冲区长度
  22. } pos;
  23. extern unsigned char font_ascii[256][16]; //导出ascii字体的bitmap(8*16大小)
  24. char buf[4096]; //vsprintf()的缓冲区
  25. /**
  26. * 将字符串按照fmt和args中的内容进行格式化,然后保存到buf中
  27. * @param buf 结果缓冲区
  28. * @param fmt 格式化字符串
  29. * @param args 内容
  30. * @return 最终字符串的长度
  31. */
  32. int vsprintf(char *buf, const char *fmt, va_list args);