PageRenderTime 36ms CodeModel.GetById 17ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/arm26/boot/compressed/uncompress.h

https://bitbucket.org/evzijst/gittest
C Header | 110 lines | 80 code | 13 blank | 17 comment | 14 complexity | 764a8dd93d611ac8dd24bbc1bd4d02a1 MD5 | raw file
  1/*
  2 *
  3 *  Copyright (C) 1996 Russell King
  4 *
  5 * This program is free software; you can redistribute it and/or modify
  6 * it under the terms of the GNU General Public License version 2 as
  7 * published by the Free Software Foundation.
  8 */
  9#define VIDMEM ((char *)0x02000000)
 10 
 11int video_num_columns, video_num_lines, video_size_row;
 12int white, bytes_per_char_h;
 13extern unsigned long con_charconvtable[256];
 14
 15struct param_struct {
 16	unsigned long page_size;
 17	unsigned long nr_pages;
 18	unsigned long ramdisk_size;
 19	unsigned long mountrootrdonly;
 20	unsigned long rootdev;
 21	unsigned long video_num_cols;
 22	unsigned long video_num_rows;
 23	unsigned long video_x;
 24	unsigned long video_y;
 25	unsigned long memc_control_reg;
 26	unsigned char sounddefault;
 27	unsigned char adfsdrives;
 28	unsigned char bytes_per_char_h;
 29	unsigned char bytes_per_char_v;
 30	unsigned long unused[256/4-11];
 31};
 32
 33static struct param_struct *params = (struct param_struct *)0x0207c000;
 34 
 35/*
 36 * This does not append a newline
 37 */
 38static void puts(const char *s)
 39{
 40	extern void ll_write_char(char *, unsigned long);
 41	int x,y;
 42	unsigned char c;
 43	char *ptr;
 44
 45	x = params->video_x;
 46	y = params->video_y;
 47
 48	while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
 49		if ( c == '\n' ) {
 50			x = 0;
 51			if ( ++y >= video_num_lines ) {
 52				y--;
 53			}
 54		} else {
 55			ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
 56			ll_write_char(ptr, c|(white<<16));
 57			if ( ++x >= video_num_columns ) {
 58				x = 0;
 59				if ( ++y >= video_num_lines ) {
 60					y--;
 61				}
 62			}
 63		}
 64	}
 65
 66	params->video_x = x;
 67	params->video_y = y;
 68}
 69
 70static void error(char *x);
 71
 72/*
 73 * Setup for decompression
 74 */
 75static void arch_decomp_setup(void)
 76{
 77	int i;
 78	
 79	video_num_lines = params->video_num_rows;
 80	video_num_columns = params->video_num_cols;
 81	bytes_per_char_h = params->bytes_per_char_h;
 82	video_size_row = video_num_columns * bytes_per_char_h;
 83	if (bytes_per_char_h == 4)
 84		for (i = 0; i < 256; i++)
 85			con_charconvtable[i] =
 86				(i & 128 ? 1 << 0  : 0) |
 87				(i & 64  ? 1 << 4  : 0) |
 88				(i & 32  ? 1 << 8  : 0) |
 89				(i & 16  ? 1 << 12 : 0) |
 90				(i & 8   ? 1 << 16 : 0) |
 91				(i & 4   ? 1 << 20 : 0) |
 92				(i & 2   ? 1 << 24 : 0) |
 93				(i & 1   ? 1 << 28 : 0);
 94	else
 95		for (i = 0; i < 16; i++)
 96			con_charconvtable[i] =
 97				(i & 8   ? 1 << 0  : 0) |
 98				(i & 4   ? 1 << 8  : 0) |
 99				(i & 2   ? 1 << 16 : 0) |
100				(i & 1   ? 1 << 24 : 0);
101
102	white = bytes_per_char_h == 8 ? 0xfc : 7;
103
104	if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
105}
106
107/*
108 * nothing to do
109 */
110#define arch_decomp_wdog()