stroese | 56b9e4f | 2004-12-16 18:43:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003-2004 |
| 3 | * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
stroese | 56b9e4f | 2004-12-16 18:43:13 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * Neutralize little endians. |
| 10 | */ |
| 11 | #define SWAP_LONG(data) ((unsigned long) \ |
Wolfgang Denk | ec7fbf5 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 12 | (((unsigned long)(data) >> 24) | \ |
stroese | 56b9e4f | 2004-12-16 18:43:13 +0000 | [diff] [blame] | 13 | ((unsigned long)(data) << 24) | \ |
| 14 | (((unsigned long)(data) >> 8) & 0x0000ff00 ) | \ |
| 15 | (((unsigned long)(data) << 8) & 0x00ff0000 ))) |
| 16 | #define SWAP_SHORT(data) ((unsigned short) \ |
| 17 | (((unsigned short)(data) >> 8 ) | \ |
| 18 | ((unsigned short)(data) << 8 ))) |
| 19 | #define LOAD_LONG(data) SWAP_LONG(data) |
| 20 | #define LOAD_SHORT(data) SWAP_SHORT(data) |
| 21 | |
Matthias Fuchs | 5dde4e2 | 2009-02-20 10:19:19 +0100 | [diff] [blame] | 22 | #define S1D_WRITE_PALETTE(p,i,r,g,b) \ |
| 23 | { \ |
| 24 | out_8(&((uchar*)(p))[palette_index], (uchar)(i)); \ |
| 25 | out_8(&((uchar*)(p))[palette_index], (uchar)(r)); \ |
| 26 | out_8(&((uchar*)(p))[palette_index], (uchar)(g)); \ |
| 27 | out_8(&((uchar*)(p))[palette_index], (uchar)(b)); \ |
| 28 | } |
stroese | 56b9e4f | 2004-12-16 18:43:13 +0000 | [diff] [blame] | 29 | |
| 30 | typedef struct |
| 31 | { |
| 32 | ushort Index; |
| 33 | uchar Value; |
| 34 | } S1D_REGS; |
| 35 | |
| 36 | typedef struct /**** BMP file info structure ****/ |
| 37 | { |
| 38 | unsigned int biSize; /* Size of info header */ |
| 39 | int biWidth; /* Width of image */ |
| 40 | int biHeight; /* Height of image */ |
| 41 | unsigned short biPlanes; /* Number of color planes */ |
| 42 | unsigned short biBitCount; /* Number of bits per pixel */ |
| 43 | unsigned int biCompression; /* Type of compression to use */ |
| 44 | unsigned int biSizeImage; /* Size of image data */ |
| 45 | int biXPelsPerMeter; /* X pixels per meter */ |
| 46 | int biYPelsPerMeter; /* Y pixels per meter */ |
| 47 | unsigned int biClrUsed; /* Number of colors used */ |
| 48 | unsigned int biClrImportant; /* Number of important colors */ |
| 49 | } BITMAPINFOHEADER; |