From: Stefan E. <se...@us...> - 2002-05-10 08:26:19
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv4757 Modified Files: pcmcia.c Log Message: - removed dead code - cosmetic changes Index: pcmcia.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/pcmcia.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- pcmcia.c 30 Apr 2002 19:00:29 -0000 1.6 +++ pcmcia.c 10 May 2002 08:26:15 -0000 1.7 @@ -23,32 +23,6 @@ * * $Id$ * - * $Log$ - * Revision 1.6 2002/04/30 19:00:29 seletz - * - BUGFIX: MEMb() macro was using u16 instead of u8. - * - corrected the previous checked in fixes - * - * Revision 1.5 2002/04/29 18:13:36 choover - * fix -Wall warnings - * - * Revision 1.4 2002/04/27 04:59:59 timriker - * turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems - * - * Revision 1.3 2002/04/26 09:22:05 seletz - * - added original copyright from Brad Parker - * - corrected EMAIL addr - * - * Revision 1.2 2002/04/24 14:27:08 seletz - * - first round of bugfixing. Now at last one can read 512 byte sectors - * of a CF in true-ide mode. See system3.c::pcmciatest(). - * - * Still WIP. YMMV, and so on.... - * - * Revision 1.1 2002/04/18 19:52:49 seletz - * - Added PCMCIA and IDE framework. Based on Brad Parker's code. - * NOTE NOTE NOTE: - * This is all Work-In-Progress (you have been warned) - * */ /********************************************************************** @@ -76,21 +50,18 @@ */ #define WEAK_SYM __attribute__ (( weak )) -#define MEM(adr) (*((u32 *)(adr))) #define MEMb(adr) (*((u8 *)(adr))) -#define SET(reg,bit) ((reg) |= (1<<(bit))) -#define CLR(reg,bit) ((reg) &= ~(1<<(bit))) #define PCMCIA_DEBUG 1 #ifdef PCMCIA_DEBUG -# define _DBG( args... ) printf( args ) +# define DBG( x, args... ) if ( pcmcia_dbg>x ) printf( args ); #else -# define _DBG( args... ) +# define DBG( x, args... ) #endif /********************************************************************** - * Typen + * types */ typedef struct { u16 status; @@ -105,7 +76,7 @@ } pcmcia_slot_t; /********************************************************************** - * Programmglobale Variable + * program globals */ pcmcia_slot_t pcmcia_slots[ PCMCIA_MAX_SLOTS ] = { @@ -126,30 +97,29 @@ /********************************************************************** - * Modulglobale Variable + * module globals */ #ident "$Id$" #ifdef PCMCIA_DEBUG -static int dbg = 1; +static int pcmcia_dbg = 1; #else -static int dbg = 0; +static int pcmcia_dbg = 0; #endif /********************************************************************** - * Prototypen + * prototypes */ static int pcmcia_print_fixed(volatile u8 *p); static int pcmcia_print_funcid(int func); /********************************************************************** - * Exportierte Funktionen + * exported functions */ void pcmcia_dbg_set( int level ) { - printf( "pcmcia: debug level set to %d\n", level ); - dbg = level; + pcmcia_dbg = level; } /* do whatever is needed to get pcmcia initialized */ @@ -190,7 +160,7 @@ pcmcia_slots[slot].status &= ~PCMCIA_SS_DETECT; } - _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); + DBG( 1, "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); DONE: #else #warning "FIXME: non sa1111 systems not yet supported" @@ -219,7 +189,7 @@ pcmcia_slots[slot].status |= PCMCIA_SS_ENABLED; - _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); + DBG( 1, "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); DONE: #else #warning "FIXME: non sa1111 systems not yet supported" @@ -248,7 +218,7 @@ pcmcia_slots[slot].status &= ~PCMCIA_SS_ENABLED; - _DBG( "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); + DBG( 1, "%s: slot %d status: %x\n", __FUNCTION__, slot, pcmcia_slots[slot].status ); DONE: #else #warning "FIXME: non sa1111 systems not yet supported" @@ -280,7 +250,7 @@ break; } - _DBG( "%s: slot %d reset\n", __FUNCTION__, slot ); + DBG( 1, "%s: slot %d reset\n", __FUNCTION__, slot ); #else #warning "FIXME: non sa1111 systems not yet supported" #endif @@ -356,7 +326,7 @@ else break; } - printf("%s\n", id_str); + DBG( 1, "%s: id_str='%s'\n", __FUNCTION__, id_str); return (1); /* don't know */ } @@ -402,7 +372,7 @@ ident = pcmcia_slots[slot].ident; - if (dbg > 0) printf("PCMCIA MEM: %p\n", cfg_mem_addr); + DBG( 1, "%s: PCMCIA MEM: %p\n", __FUNCTION__, cfg_mem_addr); start = p = (volatile u8 *)cfg_mem_addr; @@ -415,9 +385,10 @@ } len = *p; p += 2; - if (dbg > 10) { +#if PCMCIA_DEBUG + if (pcmcia_dbg > 10) { volatile u8 *q = p; - printf ("\nTuple code %2x length %d\n\tData:", + printf("\nTuple code %2x length %d\n\tData:", code, len); for (i = 0; i < len; ++i) { @@ -425,15 +396,16 @@ q+= 2; } } +#endif switch (code) { case CISTPL_VERS_1: ident = p + 4; - _DBG( "%s: ident=%p\n", __FUNCTION__, ident ); + DBG( 1, "%s: ident=%p\n", __FUNCTION__, ident ); break; case CISTPL_FUNCID: func_id = *p; - _DBG( "%s: func_id=%d\n", __FUNCTION__, func_id ); + DBG( 1, "%s: func_id=%d\n", __FUNCTION__, func_id ); break; case CISTPL_FUNCE: if (n_features < PCMCIA_MAX_FEATURES) @@ -442,7 +414,7 @@ case CISTPL_CONFIG: config_base = (*(p+6) << 8) + (*(p+4)); pcmcia_slots[slot].config_base = config_base; - _DBG( "%s: config_base=0x%04x\n", __FUNCTION__, config_base ); + DBG( 1, "%s: config_base=0x%04x\n", __FUNCTION__, config_base ); default: break; } @@ -464,15 +436,6 @@ } } -#if 0 - /* hmmm, should this happen here? - * FIXME: provide extra function? - */ -#define COR_FUNC_ENA 0x01 - /* set configuration option register to enable card */ - *((u8 *)(cfg_mem_addr + config_base)) = COR_FUNC_ENA; -#endif - ret = 0; DONE: return ret; @@ -501,8 +464,8 @@ goto DONE; } - _DBG( "%s: base=%p\n", __FUNCTION__, (void *)pcmcia_slots[slot].base); - _DBG( "%s: attr_base=%p\n", __FUNCTION__, (void *)pcmcia_slots[slot].attr_base); + DBG( 1, "%s: base=%p\n", __FUNCTION__, (void *)pcmcia_slots[slot].base); + DBG( 1, "%s: attr_base=%p\n", __FUNCTION__, (void *)pcmcia_slots[slot].attr_base); if ( base ) *base = pcmcia_slots[slot].base; if ( attr ) *attr = pcmcia_slots[slot].attr_base; @@ -535,7 +498,7 @@ goto DONE; } - _DBG( "%s: cfg_base=0x%03x\n", __FUNCTION__, pcmcia_slots[slot].config_base); + DBG( 1, "%s: cfg_base=0x%03x\n", __FUNCTION__, pcmcia_slots[slot].config_base); if ( cfg_base ) *cfg_base = pcmcia_slots[slot].config_base; @@ -578,7 +541,7 @@ offset ); - _DBG( "%s: ATTR_REG(0x%02x) => 0x%02x\n", __FUNCTION__, + DBG( 1, "%s: ATTR_REG(0x%02x) => 0x%02x\n", __FUNCTION__, offset, *value ); ret = 0; @@ -609,7 +572,7 @@ goto DONE; } - _DBG( "%s: ATTR_REG(0x%02x) <= 0x%02x\n", __FUNCTION__, + DBG( 1, "%s: ATTR_REG(0x%02x) <= 0x%02x\n", __FUNCTION__, offset, value ); MEMb( pcmcia_slots[slot].attr_base + @@ -623,7 +586,7 @@ } /********************************************************************** - * Statische Funktionen + * static functions */ /* print function id strings */ |