mtkfb_console.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __MTK_FB_CONSOLE_H__
  2. #define __MTK_FB_CONSOLE_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <linux/types.h>
  7. #define MFC_CHECK_RET(expr) \
  8. do { \
  9. MFC_STATUS ret = (expr); \
  10. ASSERT(MFC_STATUS_OK == ret); \
  11. } while (0)
  12. typedef enum {
  13. MFC_STATUS_OK = 0,
  14. MFC_STATUS_INVALID_ARGUMENT = -1,
  15. MFC_STATUS_NOT_IMPLEMENTED = -2,
  16. MFC_STATUS_OUT_OF_MEMORY = -3,
  17. MFC_STATUS_LOCK_FAIL = -4,
  18. MFC_STATUS_FATAL_ERROR = -5,
  19. } MFC_STATUS;
  20. typedef void *MFC_HANDLE;
  21. /* --------------------------------------------------------------------------- */
  22. typedef struct {
  23. struct semaphore sem;
  24. uint8_t *fb_addr;
  25. uint32_t fb_width;
  26. uint32_t fb_height;
  27. uint32_t fb_bpp;
  28. uint32_t fg_color;
  29. uint32_t bg_color;
  30. uint32_t screen_color;
  31. uint32_t rows;
  32. uint32_t cols;
  33. uint32_t cursor_row;
  34. uint32_t cursor_col;
  35. uint32_t font_width;
  36. uint32_t font_height;
  37. } MFC_CONTEXT;
  38. /* MTK Framebuffer Console API */
  39. MFC_STATUS MFC_Open(MFC_HANDLE *handle,
  40. void *fb_addr,
  41. unsigned int fb_width,
  42. unsigned int fb_height,
  43. unsigned int fb_bpp, unsigned int fg_color, unsigned int bg_color);
  44. MFC_STATUS MFC_Open_Ex(MFC_HANDLE *handle,
  45. void *fb_addr,
  46. unsigned int fb_width,
  47. unsigned int fb_height,
  48. unsigned int fb_pitch,
  49. unsigned int fb_bpp, unsigned int fg_color, unsigned int bg_color);
  50. MFC_STATUS MFC_Close(MFC_HANDLE handle);
  51. MFC_STATUS MFC_SetColor(MFC_HANDLE handle, unsigned int fg_color, unsigned int bg_color);
  52. MFC_STATUS MFC_ResetCursor(MFC_HANDLE handle);
  53. MFC_STATUS MFC_Print(MFC_HANDLE handle, const char *str);
  54. MFC_STATUS MFC_LowMemory_Printf(MFC_HANDLE handle, const char *str, uint32_t fg_color,
  55. uint32_t bg_color);
  56. MFC_STATUS MFC_SetMem(MFC_HANDLE handle, const char *str, uint32_t color);
  57. uint32_t MFC_Get_Cursor_Offset(MFC_HANDLE handle);
  58. #ifdef __cplusplus
  59. } /* extern C */
  60. #endif
  61. #endif /* __MTK_FB_CONSOLE_H__ */