uncompress.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * linux/include/asm-arm/arch-rpc/uncompress.h
  3. *
  4. * Copyright (C) 1996 Russell King
  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 version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #define VIDMEM ((char *)SCREEN_START)
  11. #include <asm/hardware.h>
  12. #include <asm/io.h>
  13. int video_num_columns, video_num_lines, video_size_row;
  14. int white, bytes_per_char_h;
  15. extern unsigned long con_charconvtable[256];
  16. struct param_struct {
  17. unsigned long page_size;
  18. unsigned long nr_pages;
  19. unsigned long ramdisk_size;
  20. unsigned long mountrootrdonly;
  21. unsigned long rootdev;
  22. unsigned long video_num_cols;
  23. unsigned long video_num_rows;
  24. unsigned long video_x;
  25. unsigned long video_y;
  26. unsigned long memc_control_reg;
  27. unsigned char sounddefault;
  28. unsigned char adfsdrives;
  29. unsigned char bytes_per_char_h;
  30. unsigned char bytes_per_char_v;
  31. unsigned long unused[256/4-11];
  32. };
  33. static const unsigned long palette_4[16] = {
  34. 0x00000000,
  35. 0x000000cc,
  36. 0x0000cc00, /* Green */
  37. 0x0000cccc, /* Yellow */
  38. 0x00cc0000, /* Blue */
  39. 0x00cc00cc, /* Magenta */
  40. 0x00cccc00, /* Cyan */
  41. 0x00cccccc, /* White */
  42. 0x00000000,
  43. 0x000000ff,
  44. 0x0000ff00,
  45. 0x0000ffff,
  46. 0x00ff0000,
  47. 0x00ff00ff,
  48. 0x00ffff00,
  49. 0x00ffffff
  50. };
  51. #define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255)
  52. #define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff)
  53. /*
  54. * params_phys is a linker defined symbol - see
  55. * arch/arm/boot/compressed/Makefile
  56. */
  57. extern __attribute__((pure)) struct param_struct *params(void);
  58. #define params (params())
  59. #ifndef STANDALONE_DEBUG
  60. /*
  61. * This does not append a newline
  62. */
  63. static void putc(int c)
  64. {
  65. extern void ll_write_char(char *, char c, char white);
  66. int x,y;
  67. char *ptr;
  68. x = params->video_x;
  69. y = params->video_y;
  70. if (c == '\n') {
  71. if (++y >= video_num_lines)
  72. y--;
  73. } else if (c == '\r') {
  74. x = 0;
  75. } else {
  76. ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
  77. ll_write_char(ptr, c, white);
  78. if (++x >= video_num_columns) {
  79. x = 0;
  80. if ( ++y >= video_num_lines ) {
  81. y--;
  82. }
  83. }
  84. }
  85. params->video_x = x;
  86. params->video_y = y;
  87. }
  88. static inline void flush(void)
  89. {
  90. }
  91. static void error(char *x);
  92. /*
  93. * Setup for decompression
  94. */
  95. static void arch_decomp_setup(void)
  96. {
  97. int i;
  98. video_num_lines = params->video_num_rows;
  99. video_num_columns = params->video_num_cols;
  100. bytes_per_char_h = params->bytes_per_char_h;
  101. video_size_row = video_num_columns * bytes_per_char_h;
  102. if (bytes_per_char_h == 4)
  103. for (i = 0; i < 256; i++)
  104. con_charconvtable[i] =
  105. (i & 128 ? 1 << 0 : 0) |
  106. (i & 64 ? 1 << 4 : 0) |
  107. (i & 32 ? 1 << 8 : 0) |
  108. (i & 16 ? 1 << 12 : 0) |
  109. (i & 8 ? 1 << 16 : 0) |
  110. (i & 4 ? 1 << 20 : 0) |
  111. (i & 2 ? 1 << 24 : 0) |
  112. (i & 1 ? 1 << 28 : 0);
  113. else
  114. for (i = 0; i < 16; i++)
  115. con_charconvtable[i] =
  116. (i & 8 ? 1 << 0 : 0) |
  117. (i & 4 ? 1 << 8 : 0) |
  118. (i & 2 ? 1 << 16 : 0) |
  119. (i & 1 ? 1 << 24 : 0);
  120. palette_setpixel(0);
  121. if (bytes_per_char_h == 1) {
  122. palette_write (0);
  123. palette_write (0x00ffffff);
  124. for (i = 2; i < 256; i++)
  125. palette_write (0);
  126. white = 1;
  127. } else {
  128. for (i = 0; i < 256; i++)
  129. palette_write (i < 16 ? palette_4[i] : 0);
  130. white = 7;
  131. }
  132. if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
  133. }
  134. #endif
  135. /*
  136. * nothing to do
  137. */
  138. #define arch_decomp_wdog()