cleanup, formatting, unified dbg() diagnostic printouts

This commit is contained in:
Markus Fröschle
2014-01-02 09:47:46 +00:00
parent 3a9fe643c9
commit a223dd3b89
3 changed files with 23 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ int nbuf_init(void)
queue_init(&nbuf_queue[i]);
}
dbg("Creating %d net buffers of %d bytes\r\n", NBUF_MAX, NBUF_SZ);
dbg("%s: Creating %d net buffers of %d bytes\r\n", __FUNCTION__, NBUF_MAX, NBUF_SZ);
for (i = 0; i < NBUF_MAX; ++i)
{
@@ -76,7 +76,7 @@ int nbuf_init(void)
queue_add(&nbuf_queue[NBUF_FREE], (QNODE *)nbuf);
}
dbg("NBUF allocation complete\r\n");
dbg("%s: NBUF allocation complete\r\n", __FUNCTION__);
return 0;
}
@@ -134,7 +134,7 @@ void nbuf_free(NBUF *nbuf)
nbuf->offset = 0;
nbuf->length = NBUF_SZ;
queue_add(&nbuf_queue[NBUF_FREE],(QNODE *)nbuf);
queue_add(&nbuf_queue[NBUF_FREE],(QNODE *) nbuf);
set_ipl(level);
}
@@ -165,7 +165,7 @@ NBUF *nbuf_remove(int q)
void nbuf_add(int q, NBUF *nbuf)
{
int level = set_ipl(7);
queue_add(&nbuf_queue[q],(QNODE *)nbuf);
queue_add(&nbuf_queue[q], (QNODE *) nbuf);
set_ipl(level);
}
@@ -202,16 +202,16 @@ void nbuf_debug_dump(void)
dbg("\tBuffer Location\tOffset\tLength\n");
dbg("--------------------------------------\n");
j = 0;
nbuf = (NBUF *)queue_peek(&nbuf_queue[i]);
nbuf = (NBUF *) queue_peek(&nbuf_queue[i]);
while (nbuf != NULL)
{
dbg("%d\t 0x%08x\t0x%04x\t0x%04x\n",j++,nbuf->data,
nbuf->offset,
nbuf->length);
nbuf = (NBUF *)nbuf->node.next;
nbuf = (NBUF *) nbuf->node.next;
}
}
set_ipl(level);
#endif DBG_NBUF
#endif /* DBG_NBUF */
}

View File

@@ -24,7 +24,7 @@
#include "m5484l.h"
#endif
//#undef DRIVER_MEM_DEBUG
#define DRIVER_MEM_DEBUG
#ifdef DRIVER_MEM_DEBUG
#define dbg(fmt, args...) xprintf(fmt, ##args)
@@ -257,7 +257,7 @@ int driver_mem_free(void *addr)
freeit(p, mpb);
set_ipl(level);
dbg("driver_mem_free(0x%08X)\r\n", addr);
dbg("%s: driver_mem_free(0x%08X)\r\n", __FUNCTION__, addr);
return(0);
}
@@ -291,28 +291,20 @@ void *driver_mem_alloc(long amount)
ret = (void *)m->m_start;
}
set_ipl(level);
dbg("driver_mem_alloc(%d) = 0x%08X\r\n", amount, ret);
dbg("%s: driver_mem_alloc(%d) = 0x%08X\r\n", __FUNCTION__, amount, ret);
return(ret);
}
static int init_count = 0;
static int use_count = 0;
int driver_mem_init(void)
{
if (init_count == 0)
if (use_count == 0)
{
#ifdef USE_RADEON_MEMORY
driver_mem_buffer = (void *) offscreen_reserved();
if (driver_mem_buffer == NULL)
#endif
dbg("%s: initialise driver_mem_buffer[] at %p, size %x\r\n", __FUNCTION__, driver_mem_buffer, DRIVER_MEM_BUFFER_SIZE);
memset(driver_mem_buffer, 0, DRIVER_MEM_BUFFER_SIZE);
if (driver_mem_buffer == NULL)
{
return(-1);
}
pmd.mp_mfl = pmd.mp_rover = &tab_md[0];
tab_md[0].m_link = (MD *) NULL;
tab_md[0].m_start = ((long) driver_mem_buffer + 15) & ~15;
@@ -320,18 +312,17 @@ int driver_mem_init(void)
tab_md[0].m_own = (void *) 1L;
pmd.mp_mal = (MD *) NULL;
memset(driver_mem_buffer, 0, tab_md[0].m_length);
dbg("uncached driver memory buffer at 0x%08X size %d\r\n", tab_md[0].m_start, tab_md[0].m_length);
}
else
{
init_count++;
dbg("%s: uncached driver memory buffer at 0x%08X size %d\r\n", __FUNCTION__, tab_md[0].m_start, tab_md[0].m_length);
}
use_count++;
dbg("%s: driver_mem now has a use count of %d\r\n", __FUNCTION__, use_count);
return(0);
}
void driver_mem_release(void)
{
if (init_count-- == 0)
if (use_count-- == 0)
{
#ifndef CONFIG_USB_MEM_NO_CACHE
#ifdef USE_RADEON_MEMORY
@@ -341,6 +332,7 @@ void driver_mem_release(void)
#endif
#endif
}
dbg("%s: driver_mem use count now %d\r\n", __FUNCTION__, use_count);
}

View File

@@ -14,6 +14,7 @@
#define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_VIDEO */
#ifdef _USE_VIDEL_
#define MON_ALL -1 /* code used in VMODE_ENTRY for match on mode only */
/*
@@ -46,9 +47,6 @@ static const VMODE_ENTRY vga_init_table[] = {
*/
void initialise_palette_registers(int16_t rez,int16_t mode)
{
int16_t mask;
mask = 0x0fff;
initialise_falcon_palette(mode);
}
@@ -274,11 +272,12 @@ void videl_screen_init(void)
setphys(screen_start, 1);
}
#endif /* _USE_VIDEL_ */
static struct fb_info fb;
struct fb_info *info_fb = &fb;
const char monitor_layout[];
const char monitor_layout[1024];
int16_t ignore_edid;
struct mode_option resolution;
int16_t force_measure_pll;
@@ -343,7 +342,7 @@ void video_init(void)
}
index++;
} while (handle > 0);
dbg("%s: RADEON video card %sfound and %sregistered\r\n", __FUNCTION__,
xprintf("%s: RADEON video card %sfound and %sregistered\r\n", __FUNCTION__,
(radeon_found ? "" : "not "), (radeon_found ? "" : "not "));
}