fixed formatting

This commit is contained in:
Markus Fröschle
2014-06-23 18:23:44 +00:00
parent 067b31c31d
commit 68aac6bf71
4 changed files with 137 additions and 110 deletions

View File

@@ -35,7 +35,7 @@
//#define DEBUG_PCI //#define DEBUG_PCI
#ifdef DEBUG_PCI #ifdef DEBUG_PCI
#define dbg(format, arg...) do { xprintf("DEBUG: " format "", ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format, __FUNCTION__, ##arg); } while (0)
#else #else
#define dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif /* DEBUG_PCI */ #endif /* DEBUG_PCI */
@@ -162,7 +162,7 @@ static int32_t pci_get_interrupt_cause(int32_t *handles)
return handle; return handle;
} }
} }
dbg("%s: no interrupt cause found\r\n", __FUNCTION__); dbg("%s: no interrupt cause found\r\n");
return -1; return -1;
} }
@@ -189,7 +189,7 @@ void irq5_handler(void)
newvalue = pci_call_interrupt_chain(handle, value); newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value) if (newvalue == value)
{ {
dbg("%s: interrupt not handled!\r\n", __FUNCTION__); dbg("%s: interrupt not handled!\r\n");
} }
} }
} }
@@ -211,7 +211,7 @@ void irq7_handler(void)
newvalue = pci_call_interrupt_chain(handle, value); newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value) if (newvalue == value)
{ {
dbg("%s: interrupt not handled!\r\n", __FUNCTION__); dbg("%s: interrupt not handled!\r\n");
} }
} }
} }
@@ -649,7 +649,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
*/ */
struct pci_rd *rd = &descriptors[barnum]; struct pci_rd *rd = &descriptors[barnum];
dbg("%s: address = %08x\r\n", __FUNCTION__, address); dbg("%s: address = %08x\r\n", address);
if (IS_PCI_MEM_BAR(address)) if (IS_PCI_MEM_BAR(address))
{ {
/* adjust base address to card's alignment requirements */ /* adjust base address to card's alignment requirements */
@@ -738,10 +738,10 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
/* write it to PCIERBAR and enable ROM */ /* write it to PCIERBAR and enable ROM */
pci_write_config_longword(handle, PCIERBAR, swpl(address | 1)); pci_write_config_longword(handle, PCIERBAR, swpl(address | 1));
dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", __FUNCTION__, handle, address | 1); dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", handle, address | 1);
/* read value back just to be sure */ /* read value back just to be sure */
dbg("%s: PCIERBAR = %p\r\n", __FUNCTION__, swpl(pci_read_config_longword(handle, PCIERBAR))); dbg("%s: PCIERBAR = %p\r\n", swpl(pci_read_config_longword(handle, PCIERBAR)));
rd->next = sizeof(struct pci_rd); rd->next = sizeof(struct pci_rd);

View File

@@ -50,7 +50,7 @@
#define DBG_RADEON #define DBG_RADEON
#ifdef DBG_RADEON #ifdef DBG_RADEON
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG %s(): " format, __FUNCTION__, ##arg); } while (0)
#else #else
#define dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_RADEON */ #endif /* DBG_RADEON */
@@ -315,7 +315,7 @@ long radeon_cursor_init(struct fb_info *info)
int size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; int size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT;
unsigned long fbarea = offscreen_alloc(rinfo->info, size_bytes + 256); unsigned long fbarea = offscreen_alloc(rinfo->info, size_bytes + 256);
dbg("radeonfb: %s: fbarea: %p\r\n", __FUNCTION__, fbarea); dbg("radeonfb: %s: fbarea: %p\r\n", fbarea);
if (!fbarea) if (!fbarea)
rinfo->cursor_start = 0; rinfo->cursor_start = 0;

View File

@@ -18,7 +18,7 @@
#define DBG_MODES #define DBG_MODES
#ifdef DBG_MODES #ifdef DBG_MODES
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0) #define dbg(format, arg...) do { xprintf("DEBUG: " format, __FUNCTION__, ##arg); } while (0)
#else #else
#define dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_MODES */ #endif /* DBG_MODES */

View File

@@ -11,7 +11,12 @@
* option any later version. See doc/license.txt for details. * option any later version. See doc/license.txt for details.
*/ */
#define DBG_VIDEL 0 #define DBG_VIDEL
#ifdef DBG_VIDEL
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_VIDEL */
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -332,11 +337,14 @@ const VMODE_ENTRY *lookup_videl_mode(int16_t mode,int16_t monitor)
{ {
const VMODE_ENTRY *vmode_init_table, *p; const VMODE_ENTRY *vmode_init_table, *p;
if (mode&VIDEL_VGA) { if (mode&VIDEL_VGA)
{
vmode_init_table = vga_init_table; vmode_init_table = vga_init_table;
/* ignore bits that don't affect initialisation data */ /* ignore bits that don't affect initialisation data */
mode &= ~(VIDEL_VERTICAL|VIDEL_PAL); mode &= ~(VIDEL_VERTICAL|VIDEL_PAL);
} else { }
else
{
vmode_init_table = nonvga_init_table; vmode_init_table = nonvga_init_table;
} }
@@ -372,11 +380,14 @@ static int16_t determine_vctl(int16_t mode,int16_t monitor)
{ {
int16_t vctl; int16_t vctl;
if (mode&VIDEL_VGA) { if (mode & VIDEL_VGA)
{
vctl = (mode & VIDEL_80COL) ? 0x08 : 0x04; vctl = (mode & VIDEL_80COL) ? 0x08 : 0x04;
if (mode & VIDEL_VERTICAL) if (mode & VIDEL_VERTICAL)
vctl |= 0x01; vctl |= 0x01;
} else { }
else
{
vctl = (mode & VIDEL_80COL) ? 0x04 : 0x00; vctl = (mode & VIDEL_80COL) ? 0x04 : 0x00;
if (mode & VIDEL_VERTICAL) if (mode & VIDEL_VERTICAL)
vctl |= 0x02; vctl |= 0x02;
@@ -385,7 +396,8 @@ static int16_t determine_vctl(int16_t mode,int16_t monitor)
if (!(mode & VIDEL_COMPAT)) if (!(mode & VIDEL_COMPAT))
return vctl; return vctl;
switch(mode&VIDEL_BPPMASK) { switch (mode & VIDEL_BPPMASK)
{
case VIDEL_1BPP: case VIDEL_1BPP:
if (!(mode & VIDEL_VGA) && (monitor == MON_MONO)) if (!(mode & VIDEL_VGA) && (monitor == MON_MONO))
vctl = 0x08; vctl = 0x08;
@@ -414,8 +426,11 @@ static int16_t determine_regc0(int16_t mode,int16_t monitor)
return (monitor == MON_TV) ? 0x0183 : 0x0181; return (monitor == MON_TV) ? 0x0183 : 0x0181;
/* handle ST-compatible modes */ /* handle ST-compatible modes */
if ((mode&(VIDEL_80COL|VIDEL_BPPMASK)) == (VIDEL_80COL|VIDEL_1BPP)) { /* 80-column, 2-colour */ if ((mode & (VIDEL_80COL | VIDEL_BPPMASK)) == (VIDEL_80COL | VIDEL_1BPP))
switch(monitor) { {
/* 80-column, 2-colour */
switch(monitor)
{
case MON_MONO: case MON_MONO:
return 0x0080; return 0x0080;
case MON_TV: case MON_TV:
@@ -476,7 +491,9 @@ static int set_videl_vga(int16_t mode)
videlword(0xc0) = determine_regc0(mode,monitor); videlword(0xc0) = determine_regc0(mode,monitor);
videlword(0x66) = 0x0000; /* clear SPSHIFT */ videlword(0x66) = 0x0000; /* clear SPSHIFT */
switch(mode&VIDEL_BPPMASK) { /* set SPSHIFT / ST shift */ switch(mode & VIDEL_BPPMASK)
{
/* set SPSHIFT / ST shift */
case VIDEL_1BPP: /* 2 colours (mono) */ case VIDEL_1BPP: /* 2 colours (mono) */
if (monitor == MON_MONO) if (monitor == MON_MONO)
videlregs[0x60] = 0x02; videlregs[0x60] = 0x02;
@@ -518,8 +535,8 @@ int16_t vsetmode(int16_t mode)
if (mode == -1) if (mode == -1)
return current_video_mode; return current_video_mode;
#if DBG_VIDEL #ifdef DBG_VIDEL
kprintf("vsetmode(0x%04x)\n", mode); xprintf("vsetmode(0x%04x)\n", mode);
#endif #endif
if (set_videl_vga(mode) < 0) /* invalid mode */ if (set_videl_vga(mode) < 0) /* invalid mode */
@@ -577,13 +594,17 @@ int32_t vgetsize(int16_t mode)
monitor = vmontype(); monitor = vmontype();
mode &= VIDEL_VALID; /* ignore invalid bits */ mode &= VIDEL_VALID; /* ignore invalid bits */
if ((mode&VIDEL_BPPMASK) > VIDEL_TRUECOLOR) { /* fixup invalid bpp */ if ((mode & VIDEL_BPPMASK) > VIDEL_TRUECOLOR)
{
/* fixup invalid bpp */
mode &= ~VIDEL_BPPMASK; mode &= ~VIDEL_BPPMASK;
mode |= VIDEL_TRUECOLOR; mode |= VIDEL_TRUECOLOR;
} }
p = lookup_videl_mode(mode, monitor); p = lookup_videl_mode(mode, monitor);
if (!p) { /* invalid mode */ if (!p)
{
/* invalid mode */
if (mode & VIDEL_COMPAT) if (mode & VIDEL_COMPAT)
return ST_VRAM_SIZE; return ST_VRAM_SIZE;
mode &= ~(VIDEL_OVERSCAN|VIDEL_PAL);/* ignore less-important bits */ mode &= ~(VIDEL_OVERSCAN|VIDEL_PAL);/* ignore less-important bits */
@@ -606,15 +627,18 @@ int32_t vgetsize(int16_t mode)
* convert from Falcon palette format to STe palette format * convert from Falcon palette format to STe palette format
*/ */
#define falc2ste(a) ((((a) >> 1) & 0x08) | (((a) >> 5) & 0x07)) #define falc2ste(a) ((((a) >> 1) & 0x08) | (((a) >> 5) & 0x07))
static void convert2ste(int16_t *ste,int32_t *falcon) static void convert2ste(int16_t *ste,int32_t *falcon)
{ {
union { union
{
int32_t l; int32_t l;
uint8_t b[4]; uint8_t b[4];
} u; } u;
int i; int i;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++)
{
u.l = *falcon++; u.l = *falcon++;
*ste++ = (falc2ste(u.b[0]) << 8) | (falc2ste(u.b[1]) << 4) | falc2ste(u.b[3]); *ste++ = (falc2ste(u.b[0]) << 8) | (falc2ste(u.b[1]) << 4) | falc2ste(u.b[3]);
} }
@@ -655,7 +679,8 @@ static int use_ste_palette(int16_t videomode)
int16_t vsetrgb(int16_t index,int16_t count, int32_t *rgb) int16_t vsetrgb(int16_t index,int16_t count, int32_t *rgb)
{ {
int32_t *shadow, *source; int32_t *shadow, *source;
union { union
{
int32_t l; int32_t l;
uint8_t b[4]; uint8_t b[4];
} u; } u;
@@ -708,7 +733,8 @@ int16_t vsetrgb(int16_t index,int16_t count,int32_t *rgb)
int16_t vgetrgb(int16_t index,int16_t count,int32_t *rgb) int16_t vgetrgb(int16_t index,int16_t count,int32_t *rgb)
{ {
int32_t *shadow; int32_t *shadow;
union { union
{
int32_t l; int32_t l;
uint8_t b[4]; uint8_t b[4];
} u; } u;
@@ -722,7 +748,8 @@ int16_t vgetrgb(int16_t index,int16_t count,int32_t *rgb)
return -1; /* Generic error */ return -1; /* Generic error */
shadow = falcon_shadow_palette + index; shadow = falcon_shadow_palette + index;
while(count--) { while (count--)
{
u.l = *shadow++; u.l = *shadow++;
u.b[2] = u.b[1]; /* shift R & G right*/ u.b[2] = u.b[1]; /* shift R & G right*/
u.b[1] = u.b[0]; u.b[1] = u.b[0];