Coding Style cleanup, update CHANGELOG
Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
fc6414eca5
commit
6007f3251c
108
CHANGELOG
108
CHANGELOG
|
@ -1,3 +1,111 @@
|
||||||
|
commit fc6414eca55f1fc108fb12fc8cdc43bd8b4463f9
|
||||||
|
Author: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
Date: Tue Dec 18 04:29:55 2007 -0500
|
||||||
|
|
||||||
|
fix easylogo on big endian dev systems
|
||||||
|
|
||||||
|
didnt realize how out of shape easylogo actually was until i tried using it.
|
||||||
|
this patch does byte swapping as need be on the input tga header since the tga
|
||||||
|
is in little endian but the host could just as well be big endian. i didnt
|
||||||
|
bother using bswap macros or such stuff from system headers as nothing in
|
||||||
|
POSIX dictates byte swapping functionality.
|
||||||
|
|
||||||
|
Signed-Off-By: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
commit 38d299c2db81bd889c601b5dfc12c4e83ef83333
|
||||||
|
Author: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
Date: Tue Dec 18 03:23:25 2007 -0500
|
||||||
|
|
||||||
|
cleanup easylogo
|
||||||
|
|
||||||
|
- make the Makefile not suck
|
||||||
|
- include proper headers for prototypes
|
||||||
|
- fix obvious broken handling of strchr() when handling '.' in filenames
|
||||||
|
|
||||||
|
Signed-Off-By: Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
commit 883e3925d99a8dd69c5b0201cba5b1887f88f95c
|
||||||
|
Author: raptorbrino@aim.com <raptorbrino@aim.com>
|
||||||
|
Date: Thu Dec 13 21:23:28 2007 -0500
|
||||||
|
|
||||||
|
Fix build problems under Cygwin
|
||||||
|
|
||||||
|
This patch allows u-boot to build without error in a cygwin
|
||||||
|
environment. Cygwin does not define __u64 in it's
|
||||||
|
include/asm/types.h file. The -idirafter flag in the u-boot
|
||||||
|
build causes the inclusion of the cygwin types.h file as opposed
|
||||||
|
to u-bot/include/asm/types.h file which does define __u64.
|
||||||
|
Subsequently, sha1.c compile fails due to unknown symbol.
|
||||||
|
|
||||||
|
Signed-off-by: Brian Miller <raptorbrino@netscape.net>
|
||||||
|
|
||||||
|
commit 43ef1c381f9195504a2488f5cb909227eb97d475
|
||||||
|
Author: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
|
||||||
|
Date: Fri Nov 30 17:29:59 2007 +0100
|
||||||
|
|
||||||
|
cmd_bmp: Add support for displaying gzip compressed bmps
|
||||||
|
|
||||||
|
The existing code can show information about a gzip compressed BMP
|
||||||
|
image, but can't actually display it.
|
||||||
|
|
||||||
|
Therefore, move the decompression code out of bmp_info() and use it in
|
||||||
|
bmp_display() as well in order to display a compressed BMP image.
|
||||||
|
|
||||||
|
Also, clean things up a bit and fix a memory leak while we're at it.
|
||||||
|
|
||||||
|
[hskinnemoen@atmel.com: a bit of refactoring]
|
||||||
|
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
|
||||||
|
|
||||||
|
commit d197ffd8172c6fdef38733424640a9a47295d6e9
|
||||||
|
Author: Guennadi Liakhovetski <lg@denx.de>
|
||||||
|
Date: Thu Nov 29 21:15:56 2007 +0100
|
||||||
|
|
||||||
|
Fix and optimize MII operations on FEC (MPC8xx) controllers
|
||||||
|
|
||||||
|
This patch fixes several issues at least on a MPC885 based system with two
|
||||||
|
FEC interfaces used in MII mode.
|
||||||
|
|
||||||
|
1. PHY discovery should first read PHY_PHYIDR2 register and only then
|
||||||
|
PHY_PHYIDR1 like cpu/mpc8xx/fec.c::mii_discover_phy() does it,
|
||||||
|
otherwise the values read are wrong. Also notice, that PHY discovery
|
||||||
|
cannot work on MPC88x / MPC87x in setups with both FECs active at all
|
||||||
|
in its present form, because for both interfaces the registers from FEC
|
||||||
|
1 are used to communicate over MII.
|
||||||
|
|
||||||
|
2. Remove code duplication for resetting the FEC by isolating it into a
|
||||||
|
separate function.
|
||||||
|
|
||||||
|
3. Initialize MII on FEC 1 when communicating over FEC 2 in fec_init().
|
||||||
|
|
||||||
|
4. Optimize mii_init() to only reset the FEC 1 controller once.
|
||||||
|
|
||||||
|
5. Fix a typo in mii_init() using index i instead of j thus potentially
|
||||||
|
leading to unpredictable results.
|
||||||
|
|
||||||
|
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
|
||||||
|
|
||||||
|
commit 6a5e1d75bf106fa157e9ce68bcaf4b13e8a1d214
|
||||||
|
Author: Guennadi Liakhovetski <lg@denx.de>
|
||||||
|
Date: Tue Nov 20 13:14:20 2007 +0100
|
||||||
|
|
||||||
|
Fix endianness conversions in rtl8169 driver
|
||||||
|
|
||||||
|
It is unclear on what platforms this driver has been tested, since
|
||||||
|
noone up to now defines CONFIG_RTL8169 in the board configuration
|
||||||
|
header. Now it has been fixed for a big-endian mpc8241 based
|
||||||
|
linkstation platform. This patch presents the necessary endianness
|
||||||
|
conversion fixes.
|
||||||
|
|
||||||
|
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
|
||||||
|
|
||||||
|
commit 07eb02687f008721974a2fb54cd7fdc28033ab3c
|
||||||
|
Author: Wolfgang Denk <wd@denx.de>
|
||||||
|
Date: Wed Jan 9 13:43:38 2008 +0100
|
||||||
|
|
||||||
|
Coding Style clenaup; update CHANGELOG
|
||||||
|
|
||||||
|
Signed-off-by: Wolfgang Denk <wd@denx.de>
|
||||||
|
|
||||||
commit c26acc1a43b31ddca5add42fd0360ff0eee90c80
|
commit c26acc1a43b31ddca5add42fd0360ff0eee90c80
|
||||||
Author: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
|
Author: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
|
||||||
Date: Thu Dec 27 17:13:11 2007 +0100
|
Date: Thu Dec 27 17:13:11 2007 +0100
|
||||||
|
|
|
@ -31,99 +31,90 @@ typedef struct {
|
||||||
} tga_header_t;
|
} tga_header_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char r,g,b ;
|
unsigned char r, g, b;
|
||||||
} rgb_t ;
|
} rgb_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char b,g,r ;
|
unsigned char b, g, r;
|
||||||
} bgr_t ;
|
} bgr_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char Cb,y1,Cr,y2;
|
unsigned char Cb, y1, Cr, y2;
|
||||||
} yuyv_t ;
|
} yuyv_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *data,
|
void *data, *palette;
|
||||||
*palette ;
|
int width, height, pixels, bpp, pixel_size, size, palette_size, yuyv;
|
||||||
int width,
|
} image_t;
|
||||||
height,
|
|
||||||
pixels,
|
|
||||||
bpp,
|
|
||||||
pixel_size,
|
|
||||||
size,
|
|
||||||
palette_size,
|
|
||||||
yuyv;
|
|
||||||
} image_t ;
|
|
||||||
|
|
||||||
void StringUpperCase (char *str)
|
void StringUpperCase (char *str)
|
||||||
{
|
{
|
||||||
int count = strlen(str);
|
int count = strlen (str);
|
||||||
char c ;
|
char c;
|
||||||
|
|
||||||
while(count--)
|
while (count--) {
|
||||||
{
|
c = *str;
|
||||||
c=*str;
|
if ((c >= 'a') && (c <= 'z'))
|
||||||
if ((c >= 'a')&&(c<='z'))
|
*str = 'A' + (c - 'a');
|
||||||
*str = 'A' + (c-'a');
|
str++;
|
||||||
str++ ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringLowerCase (char *str)
|
void StringLowerCase (char *str)
|
||||||
{
|
{
|
||||||
int count = strlen(str);
|
int count = strlen (str);
|
||||||
char c ;
|
char c;
|
||||||
|
|
||||||
while(count--)
|
while (count--) {
|
||||||
{
|
c = *str;
|
||||||
c=*str;
|
if ((c >= 'A') && (c <= 'Z'))
|
||||||
if ((c >= 'A')&&(c<='Z'))
|
*str = 'a' + (c - 'A');
|
||||||
*str = 'a' + (c-'A');
|
str++;
|
||||||
str++ ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void pixel_rgb_to_yuyv (rgb_t *rgb_pixel, yuyv_t *yuyv_pixel)
|
void pixel_rgb_to_yuyv (rgb_t * rgb_pixel, yuyv_t * yuyv_pixel)
|
||||||
{
|
{
|
||||||
unsigned int pR, pG, pB ;
|
unsigned int pR, pG, pB;
|
||||||
|
|
||||||
/* Transform (0-255) components to (0-100) */
|
/* Transform (0-255) components to (0-100) */
|
||||||
pR = rgb_pixel->r * 100 / 255 ;
|
pR = rgb_pixel->r * 100 / 255;
|
||||||
pG = rgb_pixel->g * 100 / 255 ;
|
pG = rgb_pixel->g * 100 / 255;
|
||||||
pB = rgb_pixel->b * 100 / 255 ;
|
pB = rgb_pixel->b * 100 / 255;
|
||||||
|
|
||||||
/* Calculate YUV values (0-255) from RGB beetween 0-100 */
|
/* Calculate YUV values (0-255) from RGB beetween 0-100 */
|
||||||
yuyv_pixel->y1 = yuyv_pixel->y2 = 209 * (pR + pG + pB) / 300 + 16 ;
|
yuyv_pixel->y1 = yuyv_pixel->y2 = 209 * (pR + pG + pB) / 300 + 16;
|
||||||
yuyv_pixel->Cb = pB - (pR/4) - (pG*3/4) + 128 ;
|
yuyv_pixel->Cb = pB - (pR / 4) - (pG * 3 / 4) + 128;
|
||||||
yuyv_pixel->Cr = pR - (pG*3/4) - (pB/4) + 128 ;
|
yuyv_pixel->Cr = pR - (pG * 3 / 4) - (pB / 4) + 128;
|
||||||
|
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printlogo_rgb (rgb_t *data, int w, int h)
|
void printlogo_rgb (rgb_t * data, int w, int h)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x, y;
|
||||||
for (y=0; y<h; y++)
|
|
||||||
{
|
for (y = 0; y < h; y++) {
|
||||||
for (x=0; x<w; x++, data++)
|
for (x = 0; x < w; x++, data++)
|
||||||
if ((data->r < 30)/*&&(data->g == 0)&&(data->b == 0)*/)
|
if ((data->r <
|
||||||
printf(" ");
|
30) /*&&(data->g == 0)&&(data->b == 0) */ )
|
||||||
|
printf (" ");
|
||||||
else
|
else
|
||||||
printf("X");
|
printf ("X");
|
||||||
printf("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printlogo_yuyv (unsigned short *data, int w, int h)
|
void printlogo_yuyv (unsigned short *data, int w, int h)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x, y;
|
||||||
for (y=0; y<h; y++)
|
|
||||||
{
|
for (y = 0; y < h; y++) {
|
||||||
for (x=0; x<w; x++, data++)
|
for (x = 0; x < w; x++, data++)
|
||||||
if (*data == 0x1080) /* Because of inverted on i386! */
|
if (*data == 0x1080) /* Because of inverted on i386! */
|
||||||
printf(" ");
|
printf (" ");
|
||||||
else
|
else
|
||||||
printf("X");
|
printf ("X");
|
||||||
printf("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,22 +124,23 @@ static inline unsigned short le16_to_cpu (unsigned short val)
|
||||||
unsigned char pval[2];
|
unsigned char pval[2];
|
||||||
unsigned short val;
|
unsigned short val;
|
||||||
} swapped;
|
} swapped;
|
||||||
|
|
||||||
swapped.val = val;
|
swapped.val = val;
|
||||||
return (swapped.pval[1] << 8) + swapped.pval[0];
|
return (swapped.pval[1] << 8) + swapped.pval[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int image_load_tga (image_t *image, char *filename)
|
int image_load_tga (image_t * image, char *filename)
|
||||||
{
|
{
|
||||||
FILE *file ;
|
FILE *file;
|
||||||
tga_header_t header ;
|
tga_header_t header;
|
||||||
int i;
|
int i;
|
||||||
unsigned char app ;
|
unsigned char app;
|
||||||
rgb_t *p ;
|
rgb_t *p;
|
||||||
|
|
||||||
if( ( file = fopen( filename, "rb" ) ) == NULL )
|
if ((file = fopen (filename, "rb")) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fread(&header, sizeof(header), 1, file);
|
fread (&header, sizeof (header), 1, file);
|
||||||
|
|
||||||
/* byte swap: tga is little endian, host is ??? */
|
/* byte swap: tga is little endian, host is ??? */
|
||||||
header.ColorMapOrigin = le16_to_cpu (header.ColorMapOrigin);
|
header.ColorMapOrigin = le16_to_cpu (header.ColorMapOrigin);
|
||||||
|
@ -158,211 +150,217 @@ int image_load_tga (image_t *image, char *filename)
|
||||||
header.ImageWidth = le16_to_cpu (header.ImageWidth);
|
header.ImageWidth = le16_to_cpu (header.ImageWidth);
|
||||||
header.ImageHeight = le16_to_cpu (header.ImageHeight);
|
header.ImageHeight = le16_to_cpu (header.ImageHeight);
|
||||||
|
|
||||||
image->width = header.ImageWidth ;
|
image->width = header.ImageWidth;
|
||||||
image->height = header.ImageHeight ;
|
image->height = header.ImageHeight;
|
||||||
|
|
||||||
switch (header.ImageTypeCode){
|
switch (header.ImageTypeCode) {
|
||||||
case 2: /* Uncompressed RGB */
|
case 2: /* Uncompressed RGB */
|
||||||
image->yuyv = 0 ;
|
image->yuyv = 0;
|
||||||
image->palette_size = 0 ;
|
image->palette_size = 0;
|
||||||
image->palette = NULL ;
|
image->palette = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Format not supported!\n");
|
printf ("Format not supported!\n");
|
||||||
return -1 ;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
image->bpp = header.ImagePixelSize ;
|
image->bpp = header.ImagePixelSize;
|
||||||
image->pixel_size = ((image->bpp-1) / 8) + 1 ;
|
image->pixel_size = ((image->bpp - 1) / 8) + 1;
|
||||||
image->pixels = image->width * image->height;
|
image->pixels = image->width * image->height;
|
||||||
image->size = image->pixels * image->pixel_size ;
|
image->size = image->pixels * image->pixel_size;
|
||||||
image->data = malloc(image->size) ;
|
image->data = malloc (image->size);
|
||||||
|
|
||||||
if (image->bpp != 24)
|
if (image->bpp != 24) {
|
||||||
{
|
printf ("Bpp not supported: %d!\n", image->bpp);
|
||||||
printf("Bpp not supported: %d!\n", image->bpp);
|
return -1;
|
||||||
return -1 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(image->data, image->size, 1, file);
|
fread (image->data, image->size, 1, file);
|
||||||
|
|
||||||
/* Swapping R and B values */
|
/* Swapping R and B values */
|
||||||
|
|
||||||
p = image->data ;
|
p = image->data;
|
||||||
for(i=0; i < image->pixels; i++, p++)
|
for (i = 0; i < image->pixels; i++, p++) {
|
||||||
{
|
app = p->r;
|
||||||
app = p->r ;
|
p->r = p->b;
|
||||||
p->r = p->b ;
|
p->b = app;
|
||||||
p->b = app ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swapping image */
|
/* Swapping image */
|
||||||
|
|
||||||
if(!(header.ImageDescriptorByte & 0x20))
|
if (!(header.ImageDescriptorByte & 0x20)) {
|
||||||
{
|
unsigned char *temp = malloc (image->size);
|
||||||
unsigned char *temp = malloc(image->size);
|
int linesize = image->pixel_size * image->width;
|
||||||
int linesize = image->pixel_size * image->width ;
|
|
||||||
void *dest = image->data,
|
void *dest = image->data,
|
||||||
*source = temp + image->size - linesize ;
|
*source = temp + image->size - linesize;
|
||||||
|
|
||||||
printf("S");
|
printf ("S");
|
||||||
if (temp == NULL)
|
if (temp == NULL) {
|
||||||
{
|
printf ("Cannot alloc temp buffer!\n");
|
||||||
printf("Cannot alloc temp buffer!\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(temp, image->data, image->size);
|
memcpy (temp, image->data, image->size);
|
||||||
for(i = 0; i<image->height; i++, dest+=linesize, source-=linesize)
|
for (i = 0; i < image->height;
|
||||||
memcpy(dest, source, linesize);
|
i++, dest += linesize, source -= linesize)
|
||||||
|
memcpy (dest, source, linesize);
|
||||||
|
|
||||||
free( temp );
|
free (temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_ASCII_BANNERS
|
#ifdef ENABLE_ASCII_BANNERS
|
||||||
printlogo_rgb (image->data,image->width, image->height);
|
printlogo_rgb (image->data, image->width, image->height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int image_free (image_t *image)
|
int image_free (image_t * image)
|
||||||
{
|
{
|
||||||
if(image->data != NULL)
|
if (image->data != NULL)
|
||||||
free(image->data);
|
free (image->data);
|
||||||
|
|
||||||
if(image->palette != NULL)
|
if (image->palette != NULL)
|
||||||
free(image->palette);
|
free (image->palette);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int image_rgb_to_yuyv (image_t *rgb_image, image_t *yuyv_image)
|
int image_rgb_to_yuyv (image_t * rgb_image, image_t * yuyv_image)
|
||||||
{
|
{
|
||||||
rgb_t *rgb_ptr = (rgb_t *) rgb_image->data ;
|
rgb_t *rgb_ptr = (rgb_t *) rgb_image->data;
|
||||||
yuyv_t yuyv ;
|
yuyv_t yuyv;
|
||||||
unsigned short *dest ;
|
unsigned short *dest;
|
||||||
int count = 0 ;
|
int count = 0;
|
||||||
|
|
||||||
yuyv_image->pixel_size = 2 ;
|
yuyv_image->pixel_size = 2;
|
||||||
yuyv_image->bpp = 16 ;
|
yuyv_image->bpp = 16;
|
||||||
yuyv_image->yuyv = 1 ;
|
yuyv_image->yuyv = 1;
|
||||||
yuyv_image->width = rgb_image->width ;
|
yuyv_image->width = rgb_image->width;
|
||||||
yuyv_image->height = rgb_image->height ;
|
yuyv_image->height = rgb_image->height;
|
||||||
yuyv_image->pixels = yuyv_image->width * yuyv_image->height ;
|
yuyv_image->pixels = yuyv_image->width * yuyv_image->height;
|
||||||
yuyv_image->size = yuyv_image->pixels * yuyv_image->pixel_size ;
|
yuyv_image->size = yuyv_image->pixels * yuyv_image->pixel_size;
|
||||||
dest = (unsigned short *) (yuyv_image->data = malloc(yuyv_image->size)) ;
|
dest = (unsigned short *) (yuyv_image->data =
|
||||||
yuyv_image->palette = 0 ;
|
malloc (yuyv_image->size));
|
||||||
yuyv_image->palette_size= 0 ;
|
yuyv_image->palette = 0;
|
||||||
|
yuyv_image->palette_size = 0;
|
||||||
|
|
||||||
while((count++) < rgb_image->pixels)
|
while ((count++) < rgb_image->pixels) {
|
||||||
{
|
|
||||||
pixel_rgb_to_yuyv (rgb_ptr++, &yuyv);
|
pixel_rgb_to_yuyv (rgb_ptr++, &yuyv);
|
||||||
|
|
||||||
if ((count & 1)==0) /* Was == 0 */
|
if ((count & 1) == 0) /* Was == 0 */
|
||||||
memcpy (dest, ((void *)&yuyv) + 2, sizeof(short));
|
memcpy (dest, ((void *) &yuyv) + 2, sizeof (short));
|
||||||
else
|
else
|
||||||
memcpy (dest, (void *)&yuyv, sizeof(short));
|
memcpy (dest, (void *) &yuyv, sizeof (short));
|
||||||
|
|
||||||
dest ++ ;
|
dest++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_ASCII_BANNERS
|
#ifdef ENABLE_ASCII_BANNERS
|
||||||
printlogo_yuyv (yuyv_image->data, yuyv_image->width, yuyv_image->height);
|
printlogo_yuyv (yuyv_image->data, yuyv_image->width,
|
||||||
|
yuyv_image->height);
|
||||||
#endif
|
#endif
|
||||||
return 0 ;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int image_save_header (image_t *image, char *filename, char *varname)
|
int image_save_header (image_t * image, char *filename, char *varname)
|
||||||
{
|
{
|
||||||
FILE *file = fopen (filename, "w");
|
FILE *file = fopen (filename, "w");
|
||||||
char app[256], str[256]="", def_name[64] ;
|
char app[256], str[256] = "", def_name[64];
|
||||||
int count = image->size, col=0;
|
int count = image->size, col = 0;
|
||||||
unsigned char *dataptr = image->data ;
|
unsigned char *dataptr = image->data;
|
||||||
if (file==NULL)
|
|
||||||
return -1 ;
|
|
||||||
|
|
||||||
/* Author information */
|
if (file == NULL)
|
||||||
fprintf(file, "/*\n * Generated by EasyLogo, (C) 2000 by Paolo Scaffardi\n *\n");
|
return -1;
|
||||||
fprintf(file, " * To use this, include it and call: easylogo_plot(screen,&%s, width,x,y)\n *\n", varname);
|
|
||||||
fprintf(file, " * Where:\t'screen'\tis the pointer to the frame buffer\n");
|
|
||||||
fprintf(file, " *\t\t'width'\tis the screen width\n");
|
|
||||||
fprintf(file, " *\t\t'x'\t\tis the horizontal position\n");
|
|
||||||
fprintf(file, " *\t\t'y'\t\tis the vertical position\n */\n\n");
|
|
||||||
|
|
||||||
/* Headers */
|
/* Author information */
|
||||||
fprintf(file, "#include <video_easylogo.h>\n\n");
|
fprintf (file,
|
||||||
/* Macros */
|
"/*\n * Generated by EasyLogo, (C) 2000 by Paolo Scaffardi\n *\n");
|
||||||
strcpy(def_name, varname);
|
fprintf (file,
|
||||||
|
" * To use this, include it and call: easylogo_plot(screen,&%s, width,x,y)\n *\n",
|
||||||
|
varname);
|
||||||
|
fprintf (file,
|
||||||
|
" * Where:\t'screen'\tis the pointer to the frame buffer\n");
|
||||||
|
fprintf (file, " *\t\t'width'\tis the screen width\n");
|
||||||
|
fprintf (file, " *\t\t'x'\t\tis the horizontal position\n");
|
||||||
|
fprintf (file, " *\t\t'y'\t\tis the vertical position\n */\n\n");
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
|
fprintf (file, "#include <video_easylogo.h>\n\n");
|
||||||
|
/* Macros */
|
||||||
|
strcpy (def_name, varname);
|
||||||
StringUpperCase (def_name);
|
StringUpperCase (def_name);
|
||||||
fprintf(file, "#define DEF_%s_WIDTH\t\t%d\n", def_name, image->width);
|
fprintf (file, "#define DEF_%s_WIDTH\t\t%d\n", def_name,
|
||||||
fprintf(file, "#define DEF_%s_HEIGHT\t\t%d\n", def_name, image->height);
|
image->width);
|
||||||
fprintf(file, "#define DEF_%s_PIXELS\t\t%d\n", def_name, image->pixels);
|
fprintf (file, "#define DEF_%s_HEIGHT\t\t%d\n", def_name,
|
||||||
fprintf(file, "#define DEF_%s_BPP\t\t%d\n", def_name, image->bpp);
|
image->height);
|
||||||
fprintf(file, "#define DEF_%s_PIXEL_SIZE\t%d\n", def_name, image->pixel_size);
|
fprintf (file, "#define DEF_%s_PIXELS\t\t%d\n", def_name,
|
||||||
fprintf(file, "#define DEF_%s_SIZE\t\t%d\n\n", def_name, image->size);
|
image->pixels);
|
||||||
/* Declaration */
|
fprintf (file, "#define DEF_%s_BPP\t\t%d\n", def_name, image->bpp);
|
||||||
fprintf(file, "unsigned char DEF_%s_DATA[DEF_%s_SIZE] = {\n", def_name, def_name);
|
fprintf (file, "#define DEF_%s_PIXEL_SIZE\t%d\n", def_name,
|
||||||
|
image->pixel_size);
|
||||||
|
fprintf (file, "#define DEF_%s_SIZE\t\t%d\n\n", def_name,
|
||||||
|
image->size);
|
||||||
|
/* Declaration */
|
||||||
|
fprintf (file, "unsigned char DEF_%s_DATA[DEF_%s_SIZE] = {\n",
|
||||||
|
def_name, def_name);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
while(count)
|
while (count)
|
||||||
switch (col){
|
switch (col) {
|
||||||
case 0:
|
case 0:
|
||||||
sprintf(str, " 0x%02x", *dataptr++);
|
sprintf (str, " 0x%02x", *dataptr++);
|
||||||
col++;
|
col++;
|
||||||
count-- ;
|
count--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
fprintf(file, "%s", str);
|
fprintf (file, "%s", str);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
fprintf(file,",");
|
fprintf (file, ",");
|
||||||
fprintf(file, "\n");
|
fprintf (file, "\n");
|
||||||
|
|
||||||
col = 0 ;
|
col = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
strcpy(app, str);
|
strcpy (app, str);
|
||||||
sprintf(str, "%s, 0x%02x", app, *dataptr++);
|
sprintf (str, "%s, 0x%02x", app, *dataptr++);
|
||||||
col++ ;
|
col++;
|
||||||
count-- ;
|
count--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (col)
|
if (col)
|
||||||
fprintf(file, "%s\n", str);
|
fprintf (file, "%s\n", str);
|
||||||
|
|
||||||
/* End of declaration */
|
/* End of declaration */
|
||||||
fprintf(file, "};\n\n");
|
fprintf (file, "};\n\n");
|
||||||
/* Variable */
|
/* Variable */
|
||||||
fprintf(file, "fastimage_t %s = {\n", varname);
|
fprintf (file, "fastimage_t %s = {\n", varname);
|
||||||
fprintf(file, " DEF_%s_DATA,\n", def_name);
|
fprintf (file, " DEF_%s_DATA,\n", def_name);
|
||||||
fprintf(file, " DEF_%s_WIDTH,\n", def_name);
|
fprintf (file, " DEF_%s_WIDTH,\n", def_name);
|
||||||
fprintf(file, " DEF_%s_HEIGHT,\n", def_name);
|
fprintf (file, " DEF_%s_HEIGHT,\n", def_name);
|
||||||
fprintf(file, " DEF_%s_BPP,\n", def_name);
|
fprintf (file, " DEF_%s_BPP,\n", def_name);
|
||||||
fprintf(file, " DEF_%s_PIXEL_SIZE,\n", def_name);
|
fprintf (file, " DEF_%s_PIXEL_SIZE,\n", def_name);
|
||||||
fprintf(file, " DEF_%s_SIZE\n};\n", def_name);
|
fprintf (file, " DEF_%s_SIZE\n};\n", def_name);
|
||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
|
|
||||||
return 0 ;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_FILELEN 256
|
#define DEF_FILELEN 256
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char
|
char inputfile[DEF_FILELEN],
|
||||||
inputfile[DEF_FILELEN],
|
outputfile[DEF_FILELEN], varname[DEF_FILELEN];
|
||||||
outputfile[DEF_FILELEN],
|
|
||||||
varname[DEF_FILELEN];
|
|
||||||
|
|
||||||
image_t rgb_logo, yuyv_logo ;
|
image_t rgb_logo, yuyv_logo;
|
||||||
|
|
||||||
switch (argc){
|
switch (argc) {
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -370,38 +368,34 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
strcpy (varname, argv[2]);
|
strcpy (varname, argv[2]);
|
||||||
else
|
else {
|
||||||
{
|
char *dot = strchr (inputfile, '.');
|
||||||
char *dot = strchr(inputfile, '.');
|
|
||||||
int pos = dot - inputfile;
|
int pos = dot - inputfile;
|
||||||
|
|
||||||
if (dot)
|
if (dot) {
|
||||||
{
|
|
||||||
strncpy (varname, inputfile, pos);
|
strncpy (varname, inputfile, pos);
|
||||||
varname[pos] = 0 ;
|
varname[pos] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 3)
|
if (argc > 3)
|
||||||
strcpy (outputfile, argv[3]);
|
strcpy (outputfile, argv[3]);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
char *dot = strchr (varname, '.');
|
char *dot = strchr (varname, '.');
|
||||||
int pos = dot - varname;
|
int pos = dot - varname;
|
||||||
|
|
||||||
if (dot)
|
if (dot) {
|
||||||
{
|
char app[DEF_FILELEN];
|
||||||
char app[DEF_FILELEN] ;
|
|
||||||
|
|
||||||
strncpy(app, varname, pos);
|
strncpy (app, varname, pos);
|
||||||
app[pos] = 0;
|
app[pos] = 0;
|
||||||
sprintf(outputfile, "%s.h", app);
|
sprintf (outputfile, "%s.h", app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("EasyLogo 1.0 (C) 2000 by Paolo Scaffardi\n\n");
|
printf ("EasyLogo 1.0 (C) 2000 by Paolo Scaffardi\n\n");
|
||||||
|
|
||||||
printf("Syntax: easylogo inputfile [outputvar {outputfile}] \n");
|
printf("Syntax: easylogo inputfile [outputvar {outputfile}] \n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -409,37 +403,36 @@ int main (int argc, char *argv[])
|
||||||
printf(" 'outputvar' is the variable name to create\n");
|
printf(" 'outputvar' is the variable name to create\n");
|
||||||
printf(" 'outputfile' is the output header file (default is 'inputfile.h')\n");
|
printf(" 'outputfile' is the output header file (default is 'inputfile.h')\n");
|
||||||
|
|
||||||
return -1 ;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Doing '%s' (%s) from '%s'...",
|
printf ("Doing '%s' (%s) from '%s'...",
|
||||||
outputfile, varname, inputfile);
|
outputfile, varname, inputfile);
|
||||||
|
|
||||||
/* Import TGA logo */
|
/* Import TGA logo */
|
||||||
|
|
||||||
printf("L");
|
printf ("L");
|
||||||
if (image_load_tga (&rgb_logo, inputfile)<0)
|
if (image_load_tga (&rgb_logo, inputfile) < 0) {
|
||||||
{
|
printf ("input file not found!\n");
|
||||||
printf("input file not found!\n");
|
exit (1);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert it to YUYV format */
|
/* Convert it to YUYV format */
|
||||||
|
|
||||||
printf("C");
|
printf ("C");
|
||||||
image_rgb_to_yuyv (&rgb_logo, &yuyv_logo) ;
|
image_rgb_to_yuyv (&rgb_logo, &yuyv_logo);
|
||||||
|
|
||||||
/* Save it into a header format */
|
/* Save it into a header format */
|
||||||
|
|
||||||
printf("S");
|
printf ("S");
|
||||||
image_save_header (&yuyv_logo, outputfile, varname) ;
|
image_save_header (&yuyv_logo, outputfile, varname);
|
||||||
|
|
||||||
/* Free original image and copy */
|
/* Free original image and copy */
|
||||||
|
|
||||||
image_free (&rgb_logo);
|
image_free (&rgb_logo);
|
||||||
image_free (&yuyv_logo);
|
image_free (&yuyv_logo);
|
||||||
|
|
||||||
printf("\n");
|
printf ("\n");
|
||||||
|
|
||||||
return 0 ;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue