auofb_ioctl.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * auofb_ioctl.h
  3. *
  4. * Copyright 2009 Bookeen <devs@bookeen.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  18. * MA 02110-1301, USA.
  19. */
  20. #ifndef AUOFB_IOCTL_H
  21. #define AUOFB_IOCTL_H
  22. #pragma pack(1)
  23. typedef struct sAUOCommand_t
  24. {
  25. unsigned long cmd;
  26. unsigned short params[5];
  27. unsigned long datalen;
  28. unsigned short *data;
  29. } sAUOCommand;
  30. #pragma pack()
  31. /* [MTR]: Epson_S1D13521 Like command interface for AUO TCON K1900 */
  32. #define IOCTL_AUO_PREFIX ('A' << 8)
  33. #define IOCTL_AUO_SENDCOMMAND (IOCTL_AUO_PREFIX | 0x01)
  34. /* Command definition *
  35. * 3322 2222 2222 1111 1111 1100 0000 0000 *
  36. * 1098 7654 3210 9876 5432 1098 7654 3210 *
  37. * --------------------------------------- *
  38. * WD pppp CCCC CCCC CCCC CCCC *
  39. *
  40. * W = 'need_wait'
  41. * D = 'have_data'
  42. * p = 'nb_param'
  43. * C = "command"
  44. */
  45. #define SET_AUO_COMMAND(command, nb_param, have_data, need_wait) \
  46. ( ((need_wait & 0x01) << 29) |\
  47. ((have_data & 0x01) << 28) |\
  48. ((nb_param & 0x0F) << 20) |\
  49. (command & 0xFFFF) )
  50. #define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1)
  51. #define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 0, 0, 1)
  52. #define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0)
  53. #define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1)
  54. #define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1)
  55. #define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1)
  56. #define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1)
  57. //#define AUOCMD_LUMINANCE_BALANCE SET_AUO_COMMAND(0x5001, 1, 0, 1)
  58. //#define AUOCMD_AGING_MODE SET_AUO_COMMAND(0x6000, 0, 0, 1)
  59. //#define AUOCMD_AGING_MODE_EXIT SET_AUO_COMMAND(0x6001, 0, 0, 1)
  60. //#define AUOCMD_POWER_CONTROL SET_AUO_COMMAND(0x7000, 2, 0, 1)
  61. #define AUO_DSPPARAM_FLASH (1 << 15)
  62. #define AUO_DSPPARAM_MODE_GRAYwFLASH (0x00 << 12) /* Mode 0: Gray 4bit With Flash */
  63. #define AUO_DSPPARAM_MODE_GRAYnFLASH (0x01 << 12) /* Mode 1: Gray 4bit Without flash */
  64. #define AUO_DSPPARAM_MODE_TEXT (0x02 << 12) /* Mode 2: Text mode 2bit */
  65. #define AUO_DSPPARAM_MODE_HIGHSPEED (0x03 << 12) /* Mode 3: Highspeed mode 1bit */
  66. #define AUO_DSPPARAM_MODE_HANDWRITE (0x04 << 12) /* Mode 4: Handwriting mode 1bit */
  67. #define AUO_DSPPARAM_MODE_AUTOSELECT (0x05 << 12) /* Mode 5: Autoselect mode */
  68. /* INIT_SET command parameters */
  69. #define AUO_INITPARAM_OUT_DATA_ARR (0x01 << 5) /* Set to 0 (default) for normal, 1 for inverse byte order */
  70. #define AUO_INITPARAM_RESOL_800x600 (0x00 << 2) /* Set to 800x600 (default) */
  71. #define AUO_INITPARAM_RESOL_1024x768 (0x01 << 2) /* Set to 1024x768 */
  72. #define AUO_INITPARAM_RESOL_600x800 (0x04 << 2) /* Set to 600x800 */
  73. #define AUO_INITPARAM_RESOL_768x1024 (0x05 << 2) /* Set to 768x1024 */
  74. #define AUO_INITPARAM_UD_FUNC (0x01 << 1) /* Set to 0 (default) to scan down, 1 to scan up */
  75. #define AUO_INITPARAM_SHL_FUNC (0x01 << 0) /* Set to 0 to shift left, 1 (default) to scan right */
  76. #define AUO_INITPARAM_IN_DATA_ARR (0x01 << 6) /* Set to 0 (default) for normal, 1 for inverse byte order */
  77. #define AUO_INITPARAM_INV_DISPLAY (0x01 << 9) /* Set to 0 (default) for normal colors, 1 for inversed colors */
  78. #define AUO_INITPARAM_ROTATION_000 (0x00 << 10) /* Set the rotation to 0° (0) */
  79. #define AUO_INITPARAM_ROTATION_090 (0x01 << 10) /* Set the rotation to 90° (PI/2) */
  80. #define AUO_INITPARAM_ROTATION_180 (0x02 << 10) /* Set the rotation to 180° (PI) */
  81. #define AUO_INITPARAM_ROTATION_270 (0x03 << 10) /* Set the rotation to 270° (1.5*PI) */
  82. #define AUO_INITPARAM_DATA_FILTER (0x01 << 12) /* Data filter (1: active, 0: inactive) */
  83. #define AUO_INITPARAM_TEMP_AVERAGE (0x01 << 13) /* Temperature average (1: active, 0: inactive) */
  84. int Epaper_sendCommand(sAUOCommand *cmd);
  85. /* Please, do not use these #define s */
  86. #define GET_COMMAND_PARAM_NUM(command) ((command >> 20) & 0x0F)
  87. #define GET_COMMAND_HAVE_DATA(command) ((command >> 28) & 0x01)
  88. #define GET_COMMAND_NEED_WAIT(command) ((command >> 29) & 0x01)
  89. #endif /* AUOFB_IOCTL_H */