From: Kees van Reeuwijk Date: Tue, 9 Feb 2010 15:23:38 +0000 (+0000) Subject: Lots of small code cleanup: make symbols local, remove unused symbols, X-Git-Tag: v3.1.7~298 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/processing.js?a=commitdiff_plain;h=064cb7583a85b27da0deedcc9991fc74d4bf29b1;p=minix.git Lots of small code cleanup: make symbols local, remove unused symbols, fixed a typo, removed a now unused header file. Use #include <..> for header files that represent libraries. --- diff --git a/drivers/amddev/amddev.c b/drivers/amddev/amddev.c index d4ce79b33..7457941e9 100644 --- a/drivers/amddev/amddev.c +++ b/drivers/amddev/amddev.c @@ -53,9 +53,7 @@ static int find_dev(int *devindp, u8_t *capaddrp); static u32_t read_reg(int function, int index); static void write_reg(int function, int index, u32_t value); static void init_domain(int index); -static void init_map(int index); -static int do_add_phys(message *m); -static int do_del_phys(message *m); +static void init_map(unsigned int ix); static int do_add4pci(message *m); static void add_range(u32_t busaddr, u32_t size); static void del_range(u32_t busaddr, u32_t size); @@ -272,7 +270,7 @@ printf("init_domain: busaddr = %p\n", busaddr); read_reg(DEVF_BASE_LO, index)); } -static void init_map(int index) +static void init_map(unsigned int ix) { u32_t v, dom, busno, unit0, unit1; @@ -283,9 +281,9 @@ static void init_map(int index) v= (dom << 26) | (dom << 20) | (busno << 12) | (0 << 11) | (unit1 << 6) | (0 << 5) | (unit0 << 0); - write_reg(DEVF_MAP, index, v); + write_reg(DEVF_MAP, ix, v); - printf("after write: DEVF_MAP: 0x%x\n", read_reg(DEVF_MAP, index)); + printf("after write: DEVF_MAP: 0x%x\n", read_reg(DEVF_MAP, ix)); } #if 0 @@ -330,71 +328,7 @@ static int do_add(message *m) } #endif -static int do_add_phys(message *m) -{ - int i; - phys_bytes start; - size_t size; - - start= m->m2_l1; - size= m->m2_l2; -#if 0 - printf("amddev`do_add_phys: got request for 0x%x@0x%x\n", - size, start); -#endif - - if (start % I386_PAGE_SIZE) - { - printf("amddev`do_add_phys: bad start 0x%x\n", start); - return EINVAL; - } - if (size % I386_PAGE_SIZE) - { - printf("amddev`do_add_phys: bad size 0x%x\n", size); - return EINVAL; - } - add_range(start, size); - - write_reg(DEVF_CR, 0, 0x10); - for (i= 0; i<1000000; i++) - { - if (read_reg(DEVF_CR, 0) & 0x10) - continue; - return OK; - } - return EBUSY; -} - -static int do_del_phys(message *m) -{ - phys_bytes start; - size_t size; - - start= m->m2_l1; - size= m->m2_l2; - -#if 0 - printf("amddev`do_del_phys: got request for 0x%x@0x%x\n", - size, start); -#endif - - if (start % I386_PAGE_SIZE) - { - printf("amddev`do_del_phys: bad start 0x%x\n", start); - return EINVAL; - } - if (size % I386_PAGE_SIZE) - { - printf("amddev`do_del_phys: bad size 0x%x\n", size); - return EINVAL; - } - del_range(start, size); - - write_reg(DEVF_CR, 0, 0x10); - - return OK; -} static int do_add4pci(message *m) { @@ -457,7 +391,7 @@ static int do_add4pci(message *m) static void add_range(u32_t busaddr, u32_t size) { - u32_t o, bit; + u32_t o; #if 0 printf("add_range: mapping 0x%x@0x%x\n", size, busaddr); @@ -465,8 +399,8 @@ static void add_range(u32_t busaddr, u32_t size) for (o= 0; ostate & DEAF) w_reset(); + if (wn->state & DEAF){ + int err = w_reset(); + if( err != OK ){ + return err; + } + } wn->state = IGNORING; return(ENXIO); } @@ -698,7 +697,7 @@ PRIVATE struct device *w_prepare(int device) /*===========================================================================* * check_dma * *===========================================================================*/ -void +PRIVATE void check_dma(struct wini *wn) { unsigned long dma_status = 0; @@ -1121,7 +1120,7 @@ PRIVATE int do_transfer(struct wini *wn, unsigned int precomp, return com_out(&cmd); } -void stop_dma(struct wini *wn) +PRIVATE void stop_dma(struct wini *wn) { int r; @@ -1130,7 +1129,7 @@ void stop_dma(struct wini *wn) if (r != 0) panic("at_wini", "stop_dma: sys_outb failed", r); } -void start_dma(struct wini *wn, int do_write) +PRIVATE void start_dma(struct wini *wn, int do_write) { u32_t v; int r; @@ -1146,7 +1145,7 @@ void start_dma(struct wini *wn, int do_write) if (r != 0) panic("at_wini", "start_dma: sys_outb failed", r); } -int error_dma(struct wini *wn) +PRIVATE int error_dma(struct wini *wn) { int r; u32_t v; @@ -1765,9 +1764,7 @@ PRIVATE void w_need_reset() /*===========================================================================* * w_do_close * *===========================================================================*/ -PRIVATE int w_do_close(dp, m_ptr) -struct driver *dp; -message *m_ptr; +PRIVATE int w_do_close(struct driver *dp, message *m_ptr) { /* Device close: Release a device. */ if (w_prepare(m_ptr->DEVICE) == NIL_DEV) @@ -1870,7 +1867,6 @@ PRIVATE int w_reset() } } } - return(OK); } @@ -2058,7 +2054,7 @@ PRIVATE void atapi_close() /* Should unlock the device. For now do nothing. (XXX) */ } -void sense_request(void) +PRIVATE void sense_request(void) { int r, i; static u8_t sense[100], packet[ATAPI_PACKETSIZE]; @@ -2455,7 +2451,7 @@ PRIVATE void ack_irqs(unsigned int irqs) #define STSTR(a) if (status & STATUS_ ## a) { strcat(str, #a); strcat(str, " "); } #define ERRSTR(a) if (e & ERROR_ ## a) { strcat(str, #a); strcat(str, " "); } -char *strstatus(int status) +PRIVATE char *strstatus(int status) { static char str[200]; str[0] = '\0'; @@ -2470,7 +2466,7 @@ char *strstatus(int status) return str; } -char *strerr(int e) +PRIVATE char *strerr(int e) { static char str[200]; str[0] = '\0'; diff --git a/drivers/at_wini/at_wini.h b/drivers/at_wini/at_wini.h index 258f023e6..df0aa771d 100644 --- a/drivers/at_wini/at_wini.h +++ b/drivers/at_wini/at_wini.h @@ -1,8 +1,6 @@ -#include "../drivers.h" -#include "../libdriver/driver.h" -#include "../libdriver/drvlib.h" - -_PROTOTYPE(int main, (int argc, char *argv[])); +#include +#include +#include #define VERBOSE 0 /* display identify messages during boot */ #define ENABLE_ATAPI 1 /* add ATAPI cd-rom support to driver */ diff --git a/drivers/bios_wini/Makefile b/drivers/bios_wini/Makefile index f0ff487e8..f6a154404 100644 --- a/drivers/bios_wini/Makefile +++ b/drivers/bios_wini/Makefile @@ -12,7 +12,7 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I$i -I.. $(CPROFILE) LDFLAGS = -i -L../libdriver LIBS = -ldriver -lsys -lsys -ltimers diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index 4a3afac81..b142ce261 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -20,9 +20,9 @@ * 14 May 2000 by Kees J. Bot: d-d/i rewrite. */ -#include "../drivers.h" -#include "../libdriver/driver.h" -#include "../libdriver/drvlib.h" +#include +#include +#include #include #include #include @@ -31,12 +31,8 @@ #define ME "BIOS_WINI" -/* Error codes */ -#define ERR (-1) /* general error */ - /* Parameters for the disk drive. */ #define MAX_DRIVES 8 /* this driver supports 8 drives (d0 - d7)*/ -#define MAX_SECS 255 /* bios can transfer this many sectors */ #define NR_MINORS (MAX_DRIVES * DEV_PER_DRIVE) #define SUB_PER_DRIVE (NR_PARTITIONS * NR_PARTITIONS) #define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE) @@ -62,7 +58,6 @@ PRIVATE char *bios_buf_v; PRIVATE phys_bytes bios_buf_phys; PRIVATE int remap_first = 0; /* Remap drives for CD HD emulation */ #define BIOSBUF 16384 -PRIVATE cp_grant_id_t my_bios_grant_id; _PROTOTYPE(int main, (void) ); FORWARD _PROTOTYPE( struct device *w_prepare, (int device) ); diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index 6b8506e98..7717474b9 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -29,7 +29,6 @@ _PROTOTYPE( PRIVATE u32_t io_inl, (u16_t); ); _PROTOTYPE( PRIVATE void io_outl, (u16_t, u32_t); ); _PROTOTYPE( PRIVATE void do_conf, (message *); ); -_PROTOTYPE( PRIVATE void do_fkey, (message *); ); _PROTOTYPE( PRIVATE void do_get_name, (message *); ); _PROTOTYPE( PRIVATE void do_get_stat_s, (message *); ); _PROTOTYPE( PRIVATE void do_interrupt, (dpeth_t *); ); @@ -55,19 +54,16 @@ _PROTOTYPE( PRIVATE void de_get_userdata_s, (int, cp_grant_id_t, /* Error messages */ static char str_CopyErrMsg[] = "unable to read/write user data"; static char str_PortErrMsg[] = "illegal port"; -static char str_RecvErrMsg[] = "receive failed"; static char str_SendErrMsg[] = "send failed"; static char str_SizeErrMsg[] = "illegal packet size"; -static char str_TypeErrMsg[] = "illegal message type"; static char str_UmapErrMsg[] = "Unable to sys_umap"; static char str_BusyErrMsg[] = "Send/Recv failed: busy"; static char str_StatErrMsg[] = "Unable to send stats"; static char str_AlignErrMsg[] = "Bad align of buffer/descriptor"; static char str_DevName[] = "dec21140A:eth#?"; -extern int errno; -static dpeth_t de_table[DE_PORT_NR]; -static char *progname; +PRIVATE dpeth_t de_table[DE_PORT_NR]; +PRIVATE const char *progname; int sef_cb_init(int type, sef_init_info_t *info) { @@ -593,32 +589,8 @@ PRIVATE void de_conf_addr(dpeth_t * dep) return; } -PRIVATE void do_fkey(message *mp) +PRIVATE void de_first_init(dpeth_t *dep) { - dpeth_t *dep; - int port,i; - - printf("\n"); - for (port = 0, dep = de_table; port < DE_PORT_NR; port += 1, dep += 1) { - if (dep->de_mode == DEM_DISABLED) continue; - printf("%s status:\n", dep->de_name); - printf("hwaddr: "); - for(i=0;i<6;i++) - printf("%02X%c",dep->de_address.ea_addr[i], i!=5?':':'\n'); - printf("Tx packets: %-16d Tx kb: %d.%02d\n", dep->de_stat.ets_packetT, - dep->bytes_tx/1024, - (int)(((dep->bytes_tx%1024)/1024.0)*100)); - printf("Rx packets: %-16d Rx kb: %d.%02d\n", dep->de_stat.ets_packetR, - dep->bytes_rx/1024, - (int)(((dep->bytes_rx%1024)/1024.0)*100)); - printf("Rx errors: %-16d Tx errors: %d\n", - dep->de_stat.ets_recvErr, - dep->de_stat.ets_sendErr); - } - return; -} - -PRIVATE void de_first_init(dpeth_t *dep){ int i,j,r; vir_bytes descr_vir = dep->sendrecv_descr_buf; vir_bytes buffer_vir = dep->sendrecv_buf; diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index 92c18e2bf..3382c30d6 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -70,7 +70,7 @@ static dpeth_t de_table[DE_PORT_NR]; static u16_t eth_ign_proto; -static char *progname; +static const char *progname; u32_t system_hz; @@ -83,7 +83,7 @@ typedef struct dp_conf char *dpc_envvar; } dp_conf_t; -dp_conf_t dp_conf[]= /* Card addresses */ +PRIVATE dp_conf_t dp_conf[]= /* Card addresses */ { /* I/O port, IRQ, Buffer address, Env. var. */ { 0x280, 3, 0xD0000, "DPETH0" }, diff --git a/drivers/dp8390/ne2000.c b/drivers/dp8390/ne2000.c index 8d7a84da1..0b678d4ff 100644 --- a/drivers/dp8390/ne2000.c +++ b/drivers/dp8390/ne2000.c @@ -29,10 +29,10 @@ extern u32_t system_hz; _PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat) ); -u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 }; -u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF }; -u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 }; -u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 }; +PRIVATE u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 }; +PRIVATE u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF }; +PRIVATE u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 }; +PRIVATE u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 }; _PROTOTYPE( static int test_8, (dpeth_t *dep, int pos, u8_t *pat) ); _PROTOTYPE( static int test_16, (dpeth_t *dep, int pos, u8_t *pat) ); @@ -42,8 +42,7 @@ _PROTOTYPE( static void milli_delay, (unsigned long millis) ); /*===========================================================================* * ne_probe * *===========================================================================*/ -int ne_probe(dep) -dpeth_t *dep; +int ne_probe(dpeth_t *dep) { int byte; int i; diff --git a/drivers/dpeth/devio.c b/drivers/dpeth/devio.c index b4c1ff5a5..a2a5349ca 100644 --- a/drivers/dpeth/devio.c +++ b/drivers/dpeth/devio.c @@ -62,18 +62,6 @@ PUBLIC void insb(unsigned short int port, int proc_nr, void *buffer, int count) return; } -/* -** Name: unsigned int insw(unsigned short int port, int proc_nr, void *buffer, int count); -** Function: Reads a sequence of words from specified i/o port to user space buffer. -*/ -PUBLIC void insw(unsigned short int port, int proc_nr, void *buffer, int count) -{ - int rc; - - if ((rc = sys_insw(port, proc_nr, buffer, count)) != OK) - warning("insw", rc); - return; -} /* ** Name: void outb(unsigned short int port, unsigned long value); @@ -112,19 +100,6 @@ PUBLIC void outsb(unsigned short port, int proc_nr, void *buffer, int count) return; } -/* -** Name: void outsw(unsigned short int port, int proc_nr, void *buffer, int count); -** Function: Writes a sequence of bytes from user space to specified i/o port. -*/ -PUBLIC void outsw(unsigned short port, int proc_nr, void *buffer, int count) -{ - int rc; - - if ((rc = sys_outsw(port, proc_nr, buffer, count)) != OK) - warning("outsw", rc); - return; -} - #else #error To be implemented #endif /* USE_IOPL */ diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 77268467a..8cf1c6fb8 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -66,7 +66,7 @@ */ extern int errno; static dpeth_t de_table[DE_PORT_NR]; -static char *progname; +static const char *progname; typedef struct dp_conf { /* Configuration description structure */ port_t dpc_port; @@ -582,7 +582,6 @@ PRIVATE void handle_hw_intr(void) /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) ); -EXTERN int env_argc; EXTERN char **env_argv; /* diff --git a/drivers/drivers.h b/drivers/drivers.h index 307906bce..d4b6e6baf 100644 --- a/drivers/drivers.h +++ b/drivers/drivers.h @@ -1,6 +1,10 @@ /* This is the master header for all device drivers. It includes some other * files and defines the principal constants. */ + +#ifndef _INC_DRIVERS_H +#define _INC_DRIVERS_H + #define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */ #define _MINIX 1 /* tell headers to include MINIX stuff */ #define _SYSTEM 1 /* get negative error number in */ @@ -31,3 +35,4 @@ #include #include +#endif diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index 75ad79c5a..9e1602d1b 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -28,7 +28,7 @@ PRIVATE u16_t pcitab_e1000[] = 0, }; -PRIVATE char *progname; +PRIVATE const char *progname; PRIVATE e1000_t e1000_table[E1000_PORT_NR]; _PROTOTYPE( PRIVATE void e1000_init, (message *mp) ); @@ -45,7 +45,6 @@ _PROTOTYPE( PRIVATE void e1000_getname, (message *mp) ); _PROTOTYPE( PRIVATE void e1000_interrupt, (message *mp) ); _PROTOTYPE( PRIVATE void e1000_signal, (void) ); _PROTOTYPE( PRIVATE int e1000_link_changed, (e1000_t *e) ); -_PROTOTYPE( PRIVATE void e1000_report_link, (e1000_t *e) ); _PROTOTYPE( PRIVATE void e1000_stop, (void) ); _PROTOTYPE( PRIVATE e1000_t * e1000_port, (int port) ); _PROTOTYPE( PRIVATE uint32_t e1000_reg_read, (e1000_t *e, uint32_t reg) ); @@ -890,15 +889,6 @@ e1000_t *e; return FALSE; } -/*===========================================================================* - * e1000_report_link * - *===========================================================================*/ -PRIVATE void e1000_report_link(e) -e1000_t *e; -{ - E1000_DEBUG(4, ("%s: report_link()\n", e->name)); -} - /*===========================================================================* * e1000_stop * *===========================================================================*/ diff --git a/drivers/filter/Makefile b/drivers/filter/Makefile index 1346aee4d..ab231958c 100644 --- a/drivers/filter/Makefile +++ b/drivers/filter/Makefile @@ -3,7 +3,7 @@ DRIVER = filter # programs, flags, etc. CC = cc -CFLAGS = -DDEBUG=1 -DDEBUG2=0 +CFLAGS = -I.. -DDEBUG=1 -DDEBUG2=0 LDFLAGS = LIBS = -lsys diff --git a/drivers/filter/crc.c b/drivers/filter/crc.c index 20c91c61f..109407cc5 100644 --- a/drivers/filter/crc.c +++ b/drivers/filter/crc.c @@ -8,7 +8,7 @@ #include -unsigned long crctab[] = { +static unsigned long crctab[] = { 0x7fffffff, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index 284f8a91b..97afc6888 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -875,7 +875,7 @@ static int paired_grant(char *buf1, char *buf2, int request, /*===========================================================================* * single_revoke * *===========================================================================*/ -void single_revoke(cp_grant_id_t gid, iovec_s_t vector[NR_IOREQS], +PRIVATE void single_revoke(cp_grant_id_t gid, iovec_s_t vector[NR_IOREQS], size_t *sizep, int count) { /* Revoke all grants associated with a request to a single driver. diff --git a/drivers/filter/main.c b/drivers/filter/main.c index 1d7fd5a64..b84036783 100644 --- a/drivers/filter/main.c +++ b/drivers/filter/main.c @@ -36,7 +36,7 @@ char BACKUP_LABEL[LABEL_SIZE] = ""; /* backup disk driver label */ int MAIN_MINOR = -1; /* main partition minor nr */ int BACKUP_MINOR = -1; /* backup partition minor nr */ -struct optset optset_table[] = { +PRIVATE struct optset optset_table[] = { { "label0", OPT_STRING, MAIN_LABEL, LABEL_SIZE }, { "label1", OPT_STRING, BACKUP_LABEL, LABEL_SIZE }, { "minor0", OPT_INT, &MAIN_MINOR, 10 }, diff --git a/drivers/filter/md5.c b/drivers/filter/md5.c index f2962242a..a2a4b2961 100644 --- a/drivers/filter/md5.c +++ b/drivers/filter/md5.c @@ -188,7 +188,7 @@ MD5Final (digest, ctx) * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ -void +static void MD5Transform (buf, inraw) uint32 buf[4]; const unsigned char inraw[64]; diff --git a/drivers/filter/optset.c b/drivers/filter/optset.c index a338a4717..f54a5ea1c 100644 --- a/drivers/filter/optset.c +++ b/drivers/filter/optset.c @@ -12,7 +12,6 @@ * May 2009 (D.C. van Moolenbroek) */ -#define _MINIX 1 #include #include #include diff --git a/drivers/floppy/Makefile b/drivers/floppy/Makefile index e690291fd..d32359c5f 100644 --- a/drivers/floppy/Makefile +++ b/drivers/floppy/Makefile @@ -12,7 +12,7 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I$i $(CPROFILE) LDFLAGS = -i -L../libdriver LIBS = -ldriver -lsys -ltimers diff --git a/drivers/floppy/floppy.h b/drivers/floppy/floppy.h index 49e16225e..415a42519 100644 --- a/drivers/floppy/floppy.h +++ b/drivers/floppy/floppy.h @@ -1,7 +1,4 @@ -#include "../drivers.h" -#include "../libdriver/driver.h" -#include "../libdriver/drvlib.h" - -_PROTOTYPE(int main, (void)); - +#include +#include +#include diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index e806bda21..285204218 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -66,11 +66,9 @@ #define tmra_ut timer_t #define tmra_inittimer(tp) tmr_inittimer(tp) -#define Proc_number(p) proc_number(p) #define debug 0 #define RAND_UPDATE /**/ #define printW() ((void)0) -#define vm_1phys2bus(p) (p) #include "assert.h" #include "fxp.h" @@ -115,7 +113,7 @@ static clock_t fxp_next_timeout= 0; /* ignore interrupt for the moment */ #define interrupt(x) 0 -union tmpbuf +PRIVATE union tmpbuf { char pad[4096]; struct cbl_conf cc; @@ -209,22 +207,18 @@ fxp_t; #define FT_82559 0x4 #define FT_82801 0x8 -static fxp_t *fxp_table; -phys_bytes fxp_table_phys; +PRIVATE fxp_t *fxp_table; +PRIVATE phys_bytes fxp_table_phys; -static u16_t eth_ign_proto; -static tmra_ut fxp_watchdog; -static char *progname; +PRIVATE u16_t eth_ign_proto; +PRIVATE tmra_ut fxp_watchdog; +PRIVATE const char *progname; -extern int errno; - -u32_t system_hz; +PRIVATE u32_t system_hz; #define fxp_inb(port, offset) (do_inb((port) + (offset))) -#define fxp_inw(port, offset) (do_inw((port) + (offset))) #define fxp_inl(port, offset) (do_inl((port) + (offset))) #define fxp_outb(port, offset, value) (do_outb((port) + (offset), (value))) -#define fxp_outw(port, offset, value) (do_outw((port) + (offset), (value))) #define fxp_outl(port, offset, value) (do_outl((port) + (offset), (value))) _PROTOTYPE( static void fxp_init, (message *mp) ); @@ -251,7 +245,7 @@ _PROTOTYPE( static void fxp_restart_ru, (fxp_t *fp) ); _PROTOTYPE( static void fxp_getstat, (message *mp) ); _PROTOTYPE( static void fxp_getstat_s, (message *mp) ); _PROTOTYPE( static void fxp_getname, (message *mp) ); -_PROTOTYPE( static int fxp_handler, (fxp_t *fp) ); +_PROTOTYPE( static void fxp_handler, (fxp_t *fp) ); _PROTOTYPE( static void fxp_check_ints, (fxp_t *fp) ); _PROTOTYPE( static void fxp_watchdog_f, (timer_t *tp) ); _PROTOTYPE( static int fxp_link_changed, (fxp_t *fp) ); @@ -2111,8 +2105,7 @@ message *mp; /*===========================================================================* * fxp_getname * *===========================================================================*/ -static void fxp_getname(mp) -message *mp; +static void fxp_getname(message *mp) { int r; @@ -2127,8 +2120,7 @@ message *mp; /*===========================================================================* * fxp_handler * *===========================================================================*/ -static int fxp_handler(fp) -fxp_t *fp; +static void fxp_handler(fxp_t *fp) { int port; u16_t isr; @@ -2178,15 +2170,12 @@ fxp_t *fp; printf("fxp_handler: unhandled interrupt: isr = 0x%02x\n", isr); } - - return 1; } /*===========================================================================* * fxp_check_ints * *===========================================================================*/ -static void fxp_check_ints(fp) -fxp_t *fp; +static void fxp_check_ints(fxp_t *fp) { int n, fxp_flags, prev_tail; int fxp_tx_tail, fxp_tx_nbuf, fxp_tx_threshold; diff --git a/drivers/fxp/fxp.h b/drivers/fxp/fxp.h index 2b2f1730d..208c2db09 100644 --- a/drivers/fxp/fxp.h +++ b/drivers/fxp/fxp.h @@ -7,6 +7,9 @@ and 82562 fast ethernet controllers. Created: Nov 2004 by Philip Homburg */ +#ifndef _INC_FXP_H +#define _INC_FXP_H + #define VERBOSE 0 /* display output during intialization */ /* Revisions in PCI_REV */ @@ -575,3 +578,5 @@ struct rfd /* * $PchId: fxp.h,v 1.1 2004/11/23 14:34:03 philip Exp $ */ + +#endif diff --git a/drivers/fxp/mii.h b/drivers/fxp/mii.h index 7162c26bd..4f71f5e6e 100644 --- a/drivers/fxp/mii.h +++ b/drivers/fxp/mii.h @@ -6,6 +6,9 @@ Created: Nov 2004 by Philip Homburg Definitions for the Media Independent (Ethernet) Interface */ +#ifndef _INC_MII_H +#define _INC_MII_H + /* Registers in the Machine Independent Interface (MII) to the PHY. * IEEE 802.3 (2000 Edition) Clause 22. */ @@ -111,6 +114,7 @@ Definitions for the Media Independent (Ethernet) Interface _PROTOTYPE( void mii_print_stat_speed, (U16_t stat, U16_t extstat) ); _PROTOTYPE( void mii_print_techab, (U16_t techab) ); +#endif /* * $PchId: mii.h,v 1.1 2004/12/27 13:33:30 philip Exp $ */ diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 55d349a58..942891c91 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -131,7 +131,6 @@ _PROTOTYPE( static void lance_init_card, (ether_card_t *ec) ); /* Accesses Lance Control and Status Registers */ _PROTOTYPE( static u8_t in_byte, (port_t port) ); _PROTOTYPE( static u16_t in_word, (port_t port) ); -_PROTOTYPE( static void out_byte, (port_t port, u8_t value) ); _PROTOTYPE( static void out_word, (port_t port, u16_t value) ); _PROTOTYPE( static u16_t read_csr, (port_t ioaddr, u16_t csrno) ); _PROTOTYPE( static void write_csr, (port_t ioaddr, u16_t csrno, u16_t value)); @@ -258,14 +257,13 @@ static int rx_slot_nr = 0; /* Rx-slot number */ static int tx_slot_nr = 0; /* Tx-slot number */ static int cur_tx_slot_nr = 0; /* Tx-slot number */ static char isstored[TX_RING_SIZE]; /* Tx-slot in-use */ -static char *progname; +static const char *progname; phys_bytes lance_buf_phys; /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) ); -EXTERN int env_argc; EXTERN char **env_argv; /*===========================================================================* @@ -1755,17 +1753,6 @@ static u16_t in_word(port_t port) return value; } -/*===========================================================================* - * out_byte * - *===========================================================================*/ -static void out_byte(port_t port, u8_t value) -{ - int r; - - r= sys_outb(port, value); - if (r != OK) - panic("lance","sys_outb failed", r); -} /*===========================================================================* * out_word * diff --git a/drivers/log/Makefile b/drivers/log/Makefile index eecdc5e69..2834aaf74 100644 --- a/drivers/log/Makefile +++ b/drivers/log/Makefile @@ -11,7 +11,7 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I$i $(CPROFILE) LDFLAGS = -i -L../libdriver LIBS = -ldriver -lsys LIB_DEP = ../libdriver/libdriver.a diff --git a/drivers/log/log.h b/drivers/log/log.h index d18030507..3d8c4c362 100644 --- a/drivers/log/log.h +++ b/drivers/log/log.h @@ -1,6 +1,6 @@ /* Includes. */ -#include "../drivers.h" -#include "../libdriver/driver.h" +#include +#include #include #include #include diff --git a/drivers/orinoco/Makefile b/drivers/orinoco/Makefile index 9a1d8900b..f9bce9eb0 100644 --- a/drivers/orinoco/Makefile +++ b/drivers/orinoco/Makefile @@ -11,7 +11,7 @@ d = .. # programs, flags, etc. CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I$i $(CPROFILE) LDFLAGS = -i LIBS = -lsys -ltimers diff --git a/drivers/orinoco/hermes.c b/drivers/orinoco/hermes.c index 8a65b8a03..ff9f62b2c 100644 --- a/drivers/orinoco/hermes.c +++ b/drivers/orinoco/hermes.c @@ -38,14 +38,12 @@ #include "hermes.h" -PRIVATE int this_proc; - /***************************************************************************** * milli_delay * * * * Wait msecs milli seconds * *****************************************************************************/ -void milli_delay(unsigned int msecs) +PRIVATE void milli_delay(unsigned int msecs) { micro_delay((long)msecs * 1000); } @@ -95,7 +93,6 @@ void hermes_struct_init (hermes_t * hw, u32_t address, hw->io_space = io_space; hw->reg_spacing = reg_spacing; hw->inten = 0x0; - this_proc = getprocnr(); } @@ -138,6 +135,19 @@ int hermes_cor_reset (hermes_t *hw) { } +/***************************************************************************** + * hermes_present * + * * + * Check whether we have access to the card. Does the SWSUPPORT0 contain the * + * value we put in it earlier? * + *****************************************************************************/ +PRIVATE int hermes_present (hermes_t * hw) { + int i = hermes_read_reg (hw, HERMES_SWSUPPORT0) == HERMES_MAGIC; + if (!i) + printf("Hermes: Error, card not present?\n"); + return i; +} + /***************************************************************************** * hermes_init * @@ -486,6 +496,20 @@ int hermes_bap_pread (hermes_t * hw, int bap, void *buf, unsigned len, return err; } +/***************************************************************************** + * hermes_write_words * + * * + * Write a sequence of words of the buffer to the card * + *****************************************************************************/ +void hermes_write_words (hermes_t * hw, int off, const void *buf, + unsigned count) { + int i = 0; + + for (i = 0; i < count; i++) { + hermes_write_reg (hw, off, *((u16_t *) buf + i)); + } +} + /***************************************************************************** * hermes_bap_pwrite * * * @@ -519,19 +543,6 @@ int hermes_bap_pwrite (hermes_t * hw, int bap, const void *buf, unsigned len, } -/***************************************************************************** - * hermes_present * - * * - * Check whether we have access to the card. Does the SWSUPPORT0 contain the * - * value we put in it earlier? * - *****************************************************************************/ -int hermes_present (hermes_t * hw) { - int i = hermes_read_reg (hw, HERMES_SWSUPPORT0) == HERMES_MAGIC; - if (!i) - printf("Hermes: Error, card not present?\n"); - return i; -} - /***************************************************************************** * hermes_set_irqmask * @@ -723,20 +734,6 @@ void hermes_read_words (hermes_t * hw, int off, void *buf, unsigned count) { } } -/***************************************************************************** - * hermes_write_words * - * * - * Write a sequence of words of the buffer to the card * - *****************************************************************************/ -void hermes_write_words (hermes_t * hw, int off, const void *buf, - unsigned count) { - int i = 0; - - for (i = 0; i < count; i++) { - hermes_write_reg (hw, off, *((u16_t *) buf + i)); - } -} - /***************************************************************************** * hermes_read_reg * diff --git a/drivers/orinoco/hermes.h b/drivers/orinoco/hermes.h index 0d5607513..7c0b0be34 100644 --- a/drivers/orinoco/hermes.h +++ b/drivers/orinoco/hermes.h @@ -19,7 +19,7 @@ #ifndef _HERMES_H #define _HERMES_H -#include "../drivers.h" +#include #include #include #include @@ -316,18 +316,11 @@ _PROTOTYPE (int hermes_bap_pwrite, (hermes_t * hw, int bap, u16_t offset)); _PROTOTYPE (void hermes_read_words, (hermes_t * hw, int off, void *buf, unsigned count)); -_PROTOTYPE (void hermes_write_words, (hermes_t * hw, int off, - const void *buf, unsigned count)); _PROTOTYPE (int hermes_read_ltv, (hermes_t * hw, int bap, u16_t rid, unsigned buflen, u16_t * length, void *buf)); _PROTOTYPE (int hermes_write_ltv, (hermes_t * hw, int bap, u16_t rid, u16_t length, const void *value)); -_PROTOTYPE (int hermes_present, (hermes_t * hw)); -_PROTOTYPE (int myfunc_read, (vir_bytes src)); -_PROTOTYPE (void myfunc_write, (vir_bytes dst, int val)); -_PROTOTYPE (void hermes_print_ioarea, (hermes_t * hw, int first_reg, - int last_reg)); _PROTOTYPE (int hermes_set_irqmask, (hermes_t * hw, u16_t events)); _PROTOTYPE (u16_t hermes_get_irqmask, (hermes_t * hw)); _PROTOTYPE (int hermes_read_wordrec, (hermes_t * hw, int bap, u16_t rid, @@ -335,5 +328,4 @@ _PROTOTYPE (int hermes_read_wordrec, (hermes_t * hw, int bap, u16_t rid, _PROTOTYPE (int hermes_write_wordrec, (hermes_t * hw, int bap, u16_t rid, u16_t word)); _PROTOTYPE (int hermes_cor_reset, (hermes_t *hw)); -_PROTOTYPE (void milli_delay, (unsigned int msecs)); #endif /* _HERMES_H */ diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index b337292be..e40589ef5 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -62,12 +62,10 @@ #include #include #include -#include "../../kernel/const.h" -#include "../../kernel/config.h" -#include "../../kernel/type.h" +#include +#include +#include -#define tmra_ut timer_t -#define tmra_inittimer(tp) tmr_inittimer(tp) #define VERBOSE 1 /* display message during init */ PRIVATE struct pcitab { @@ -82,7 +80,7 @@ PRIVATE struct pcitab { }; -static tmra_ut or_watchdog; +static timer_t or_watchdog; #include #include @@ -127,8 +125,7 @@ static tmra_ut or_watchdog; #define IRQ_BAP 1 #define ETH_HLEN 14 -static int or_nr_task = ANY; -static t_or or_table[OR_PORT_NR]; +PRIVATE t_or or_table[OR_PORT_NR]; struct ethhdr { u8_t h_dest[ETH_ALEN]; @@ -160,7 +157,7 @@ u8_t encaps_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; ********************************************************************/ /* The frequency of each channel in MHz */ -const long channel_frequency[] = { +PRIVATE const long channel_frequency[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; @@ -227,15 +224,13 @@ _PROTOTYPE (static void or_dump, (message *m)); PRIVATE message m; PRIVATE int int_event_check; /* set to TRUE if events arrived */ -u32_t system_hz; +PRIVATE u32_t system_hz; -static char *progname; -extern int errno; +PRIVATE const char *progname; /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) ); -EXTERN int env_argc; EXTERN char **env_argv; /***************************************************************************** @@ -550,7 +545,7 @@ static void or_init (message * mp) { first_time = 0; or_pci_conf (); /* Configure PCI devices. */ - tmra_inittimer(&or_watchdog); + tmr_inittimer(&or_watchdog); /* Use a synchronous alarm instead of a watchdog timer. */ sys_setalarm(system_hz, 0); } diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index 021921f91..3afd39062 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -91,7 +91,7 @@ PRIVATE int revive_status; /* revive status */ PRIVATE int done_status; /* status of last output completion */ PRIVATE int oleft; /* bytes of output left in obuf */ PRIVATE unsigned char obuf[128]; /* output buffer */ -PRIVATE unsigned char *optr; /* ptr to next char in obuf to print */ +PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */ PRIVATE int orig_count; /* original byte count */ PRIVATE int port_base; /* I/O port for printer */ PRIVATE int proc_nr; /* user requesting the printing */ @@ -103,8 +103,6 @@ PRIVATE int user_safe; /* address or grant? */ PUBLIC int writing; /* nonzero while write is in progress */ PRIVATE int irq_hook_id; /* id of irq hook at kernel */ -extern int errno; /* error number */ - FORWARD _PROTOTYPE( void do_cancel, (message *m_ptr) ); FORWARD _PROTOTYPE( void output_done, (void) ); FORWARD _PROTOTYPE( void do_write, (message *m_ptr, int safe) ); diff --git a/drivers/readclock/readclock.c b/drivers/readclock/readclock.c index 3ae06b633..35709edc1 100644 --- a/drivers/readclock/readclock.c +++ b/drivers/readclock/readclock.c @@ -40,12 +40,9 @@ #include -#include #include #include -#include #include -#include #include #include #include @@ -54,7 +51,6 @@ #include #include #include -#include #include #include @@ -63,8 +59,6 @@ int wflag = 0; /* Set the CMOS clock. */ int Wflag = 0; /* Also set the CMOS clock register bits. */ int y2kflag = 0; /* Interpret 1980 as 2000 for clock with Y2K bug. */ -char clocktz[128]; /* Timezone of the clock. */ - #define MACH_ID_ADDR 0xFFFFE /* BIOS Machine ID at FFFF:000E */ #define PC_AT 0xFC /* Machine ID byte for PC/AT, diff --git a/drivers/rtl8139/Makefile b/drivers/rtl8139/Makefile index 36c1faeee..86a45aada 100644 --- a/drivers/rtl8139/Makefile +++ b/drivers/rtl8139/Makefile @@ -12,9 +12,9 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I../.. -I$i $(CPROFILE) LDFLAGS = -i -LIBS = -lsys -ltimers +LIBS = -lsys -ltimers OBJ = rtl8139.o liveupdate.o diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index d1dc60e13..b4738f1ff 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -189,9 +189,8 @@ _PROTOTYPE( static void tell_dev, (vir_bytes start, size_t size, PRIVATE message m; PRIVATE int int_event_check; /* set to TRUE if events arrived */ -static char *progname; -extern int errno; -u32_t system_hz; +static const char *progname; +PRIVATE u32_t system_hz; /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); diff --git a/drivers/rtl8139/rtl8139.h b/drivers/rtl8139/rtl8139.h index 218be4b5c..0adb74e53 100644 --- a/drivers/rtl8139/rtl8139.h +++ b/drivers/rtl8139/rtl8139.h @@ -4,7 +4,7 @@ ibm/rtl8139.h Created: Aug 2003 by Philip Homburg */ -#include "../drivers.h" +#include #include #include @@ -28,9 +28,9 @@ Created: Aug 2003 by Philip Homburg #include #include #include -#include "../../kernel/const.h" -#include "../../kernel/config.h" -#include "../../kernel/type.h" +#include +#include +#include #define RL_IDR 0x00 /* Ethernet address * Note: RL_9346CR_EEM_CONFIG mode is diff --git a/drivers/rtl8169/Makefile b/drivers/rtl8169/Makefile index 0d9403a60..09410ad51 100644 --- a/drivers/rtl8169/Makefile +++ b/drivers/rtl8169/Makefile @@ -12,7 +12,7 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I../.. -I$i $(CPROFILE) LDFLAGS = -i LIBS = -lsys -ltimers diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index bbdb4bd94..a08661e82 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -6,7 +6,7 @@ * */ -#include "../drivers.h" +#include #include #include @@ -26,13 +26,10 @@ #include #include #include -#include "../../kernel/const.h" -#include "../../kernel/config.h" -#include "../../kernel/type.h" +#include +#include +#include -#define tmra_ut timer_t -#define tmra_inittimer(tp) tmr_inittimer(tp) -#define Proc_number(p) proc_number(p) #define debug 1 #define printW() ((void)0) @@ -182,7 +179,7 @@ re_t; static re_t re_table[RE_PORT_NR]; static u16_t eth_ign_proto; -static tmra_ut rl_watchdog; +static timer_t rl_watchdog; FORWARD _PROTOTYPE(unsigned my_inb, (U16_t port)); FORWARD _PROTOTYPE(unsigned my_inw, (U16_t port)); @@ -618,7 +615,7 @@ message *mp; first_time = 0; rl_pci_conf(); /* Configure PCI devices. */ - tmra_inittimer(&rl_watchdog); + tmr_inittimer(&rl_watchdog); /* Use a synchronous alarm instead of a watchdog timer. */ sys_setalarm(system_hz, 0); } diff --git a/drivers/sb16/sb16.h b/drivers/sb16/sb16.h index 0f0f80a47..958da237b 100644 --- a/drivers/sb16/sb16.h +++ b/drivers/sb16/sb16.h @@ -27,8 +27,8 @@ #define DEFAULT_STEREO 0 /* 0 = mono, 1 = stereo */ /* DMA port addresses */ -#define DMA8_ADDR ((SB_DMA_8 & 3) << 1) + 0x00 -#define DMA8_COUNT ((SB_DMA_8 & 3) << 1) + 0x01 +#define DMA8_ADDR (((SB_DMA_8 & 3) << 1) + 0x00) +#define DMA8_COUNT (((SB_DMA_8 & 3) << 1) + 0x01) #define DMA8_MASK 0x0A #define DMA8_MODE 0x0B #define DMA8_CLEAR 0x0C @@ -50,8 +50,8 @@ #endif -#define DMA16_ADDR ((SB_DMA_16 & 3) << 2) + 0xC0 -#define DMA16_COUNT ((SB_DMA_16 & 3) << 2) + 0xC2 +#define DMA16_ADDR (((SB_DMA_16 & 3) << 2) + 0xC0) +#define DMA16_COUNT (((SB_DMA_16 & 3) << 2) + 0xC2) #define DMA16_MASK 0xD4 #define DMA16_MODE 0xD6 #define DMA16_CLEAR 0xD8 @@ -74,25 +74,25 @@ /* DMA modes */ -#define DMA16_AUTO_PLAY 0x58 + (SB_DMA_16 & 3) -#define DMA16_AUTO_REC 0x54 + (SB_DMA_16 & 3) -#define DMA8_AUTO_PLAY 0x58 + SB_DMA_8 -#define DMA8_AUTO_REC 0x54 + SB_DMA_8 +#define DMA16_AUTO_PLAY (0x58 + (SB_DMA_16 & 3)) +#define DMA16_AUTO_REC (0x54 + (SB_DMA_16 & 3)) +#define DMA8_AUTO_PLAY (0x58 + SB_DMA_8) +#define DMA8_AUTO_REC (0x54 + SB_DMA_8) /* IO ports for soundblaster */ -#define DSP_RESET 0x6 + SB_BASE_ADDR -#define DSP_READ 0xA + SB_BASE_ADDR -#define DSP_WRITE 0xC + SB_BASE_ADDR -#define DSP_COMMAND 0xC + SB_BASE_ADDR -#define DSP_STATUS 0xC + SB_BASE_ADDR -#define DSP_DATA_AVL 0xE + SB_BASE_ADDR -#define DSP_DATA16_AVL 0xF + SB_BASE_ADDR -#define MIXER_REG 0x4 + SB_BASE_ADDR -#define MIXER_DATA 0x5 + SB_BASE_ADDR -#define OPL3_LEFT 0x0 + SB_BASE_ADDR -#define OPL3_RIGHT 0x2 + SB_BASE_ADDR -#define OPL3_BOTH 0x8 + SB_BASE_ADDR +#define DSP_RESET (0x6 + SB_BASE_ADDR) +#define DSP_READ (0xA + SB_BASE_ADDR) +#define DSP_WRITE (0xC + SB_BASE_ADDR) +#define DSP_COMMAND (0xC + SB_BASE_ADDR) +#define DSP_STATUS (0xC + SB_BASE_ADDR) +#define DSP_DATA_AVL (0xE + SB_BASE_ADDR) +#define DSP_DATA16_AVL (0xF + SB_BASE_ADDR) +#define MIXER_REG (0x4 + SB_BASE_ADDR) +#define MIXER_DATA (0x5 + SB_BASE_ADDR) +#define OPL3_LEFT (0x0 + SB_BASE_ADDR) +#define OPL3_RIGHT (0x2 + SB_BASE_ADDR) +#define OPL3_BOTH (0x8 + SB_BASE_ADDR) /* DSP Commands */ @@ -164,7 +164,7 @@ #define DMA_NR_OF_BUFFERS 2 #define DSP_MAX_SPEED 44100 /* Max sample speed in KHz */ #define DSP_MIN_SPEED 4000 /* Min sample speed in KHz */ -#define DSP_MAX_FRAGMENT_SIZE DMA_SIZE / DMA_NR_OF_BUFFERS /* Maximum fragment size */ +#define DSP_MAX_FRAGMENT_SIZE (DMA_SIZE / DMA_NR_OF_BUFFERS) /* Maximum fragment size */ #define DSP_MIN_FRAGMENT_SIZE 1024 /* Minimum fragment size */ #define DSP_NR_OF_BUFFERS 8 diff --git a/drivers/ti1225/Makefile b/drivers/ti1225/Makefile index b197db5dd..d26cdf55e 100644 --- a/drivers/ti1225/Makefile +++ b/drivers/ti1225/Makefile @@ -11,7 +11,7 @@ d = .. # programs, flags, etc. CC = exec cc -CFLAGS = -I$i $(CPROFILE) +CFLAGS = -I.. -I$i $(CPROFILE) LDFLAGS = -i LIBS = -lsys -ltimers diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index 2cc69a229..1254dc29a 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -4,7 +4,7 @@ ti1225.c Created: Dec 2005 by Philip Homburg */ -#include "../drivers.h" +#include #include #include @@ -53,7 +53,6 @@ PRIVATE int debug; FORWARD _PROTOTYPE( void hw_init, (struct port *pp) ); FORWARD _PROTOTYPE( void map_regs, (struct port *pp, u32_t base) ); FORWARD _PROTOTYPE( void do_int, (struct port *pp) ); -FORWARD _PROTOTYPE( u8_t read_exca, (struct port *pp, int socket, int reg) ); FORWARD _PROTOTYPE( void do_outb, (port_t port, u8_t value) ); FORWARD _PROTOTYPE( u8_t do_inb, (port_t port) ); @@ -237,7 +236,7 @@ struct port *pp; } if (v32 == 0) - panic("ti1225", "bad lagacy-mode base address 0x%x\n", v32); + panic("ti1225", "bad legacy-mode base address 0x%x\n", v32); pp->p_exca_port= v32; if (debug) @@ -497,19 +496,6 @@ struct port *pp; } -PRIVATE u8_t read_exca(pp, socket, reg) -struct port *pp; -int socket; -int reg; -{ - u16_t port; - - port= pp->p_exca_port; - if (port == 0) - panic("ti1225", "read_exca: bad port", NO_NUM); - do_outb(port, socket * 0x40 + reg); - return do_inb(port+1); -} PRIVATE u8_t do_inb(port_t port) { diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile index c1d15301a..4d42d0ce5 100644 --- a/drivers/tty/Makefile +++ b/drivers/tty/Makefile @@ -14,7 +14,7 @@ d = .. # programs, flags, etc. MAKE = exec make CC = exec cc -CPPFLAGS = -I../../kernel/arch/$(ARCH)/include -I$i +CPPFLAGS = -I.. -I../.. -I../../kernel/arch/$(ARCH)/include -I$i CFLAGS = $(CPPFLAGS) LDFLAGS = -i LIBS = -lsys -ltimers diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 7fc93ecac..618c98a4e 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -16,7 +16,7 @@ * and the scrolling function worries about wrapping. */ -#include "../drivers.h" +#include #include #include #include @@ -38,10 +38,10 @@ #define TIMER_FREQ 1193182L /* clock frequency for timer in PC and AT */ /* Global variables used by the console driver and assembly support. */ -PUBLIC phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */ -PUBLIC phys_bytes vid_base; -PUBLIC unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */ -PUBLIC unsigned blank_color = BLANK_COLOR; /* display code for blank */ +PRIVATE phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */ +PRIVATE phys_bytes vid_base; +PRIVATE unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */ +PRIVATE unsigned blank_color = BLANK_COLOR; /* display code for blank */ /* Private variables used by the console driver. */ PRIVATE int vid_port; /* I/O port for accessing 6845 */ @@ -63,8 +63,8 @@ PRIVATE int disabled_sm; /* Scroll mode to be restored when re-enabling * console */ -char *console_memory = NULL; -char *font_memory = NULL; +PRIVATE char *console_memory = NULL; +PRIVATE char *font_memory = NULL; /* Per console data. */ typedef struct console { @@ -1040,8 +1040,7 @@ tty_t *tp; /*===========================================================================* * kputc * *===========================================================================*/ -PUBLIC void kputc(c) -int c; +PUBLIC void kputc(int c) { /* Accumulate a single character for a kernel message. Send a notification * the to output driver if an END_OF_KMESS is encountered. diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index cef813543..f1fbfadbf 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -6,7 +6,7 @@ * Feb 04, 1994 loadable keymaps (Marcus Hampel) */ -#include "../drivers.h" +#include #include #include #include @@ -19,21 +19,21 @@ #include #include #include "tty.h" -#include "../../kernel/const.h" -#include "../../kernel/config.h" -#include "../../kernel/type.h" -#include "../../kernel/proc.h" +#include +#include +#include +#include -u16_t keymap[NR_SCAN_CODES * MAP_COLS] = { +PRIVATE u16_t keymap[NR_SCAN_CODES * MAP_COLS] = { #include "keymaps/us-std.src" }; -u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = { +PRIVATE u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = { #include "keymaps/us-std-esc.src" }; -int irq_hook_id = -1; -int aux_irq_hook_id = -1; +PRIVATE int irq_hook_id = -1; +PRIVATE int aux_irq_hook_id = -1; /* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */ #define KEYBD 0x60 /* I/O port for keyboard data */ diff --git a/drivers/tty/rs232.c b/drivers/tty/rs232.c index 0959eb90f..649962627 100644 --- a/drivers/tty/rs232.c +++ b/drivers/tty/rs232.c @@ -166,7 +166,7 @@ typedef struct rs232 { char obuf[RS_OBUFSIZE]; /* output buffer */ } rs232_t; -PUBLIC rs232_t rs_lines[NR_RS_LINES]; +PRIVATE rs232_t rs_lines[NR_RS_LINES]; #if (MACHINE == IBM_PC) /* 8250 base addresses. */ diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index 51f7d3781..dc403adb8 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -57,7 +57,7 @@ * Jul 13, 2004 support for function key observers (Jorrit N. Herder) */ -#include "../drivers.h" +#include #include #include #include @@ -143,10 +143,6 @@ PUBLIC clock_t tty_next_timeout; /* time that the next alarm is due */ PUBLIC struct machine machine; /* kernel environment variables */ PUBLIC u32_t system_hz; -extern PUBLIC unsigned info_location; -extern PUBLIC phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */ -extern PUBLIC phys_bytes vid_base; - /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) ); @@ -1597,6 +1593,15 @@ register tty_t *tp; (*tp->tty_icancel)(tp, 0); } +/*===========================================================================* + * tty_devnop * + *===========================================================================*/ +PRIVATE int tty_devnop(tty_t *tp, int try) +{ + /* Some functions need not be implemented at the device level. */ + return 0; +} + /*===========================================================================* * tty_init * *===========================================================================*/ @@ -1715,17 +1720,6 @@ int enable; /* set timer if true, otherwise unset */ } } -/*===========================================================================* - * tty_devnop * - *===========================================================================*/ -PUBLIC int tty_devnop(tp, try) -tty_t *tp; -int try; -{ - /* Some functions need not be implemented at the device level. */ - return 0; -} - /*===========================================================================* * do_select * *===========================================================================*/ diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index 15bce46af..79cfed7d4 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -157,7 +157,6 @@ _PROTOTYPE( void tty_wakeup, (clock_t now) ); #define tty_reply(c, r, p, s) tty_reply_f(__FILE__, __LINE__, (c), (r), (p), (s)) _PROTOTYPE( void tty_reply_f, (char *f, int l, int code, int replyee, int proc_nr, int status) ); -_PROTOTYPE( int tty_devnop, (struct tty *tp, int try) ); _PROTOTYPE( int select_try, (struct tty *tp, int ops) ); _PROTOTYPE( int select_retry, (struct tty *tp) ); @@ -184,7 +183,6 @@ _PROTOTYPE( void do_video, (message *m) ); _PROTOTYPE( void kb_init, (struct tty *tp) ); _PROTOTYPE( void kb_init_once, (void) ); _PROTOTYPE( int kbd_loadmap, (message *m, int safe) ); -_PROTOTYPE( void do_panic_dumps, (message *m) ); _PROTOTYPE( void do_fkey_ctl, (message *m) ); _PROTOTYPE( void kbd_interrupt, (message *m) ); _PROTOTYPE( void do_kbd, (message *m) ); diff --git a/servers/ds/glo.h b/servers/ds/glo.h deleted file mode 100644 index c500db535..000000000 --- a/servers/ds/glo.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Global variables. */ - -/* The parameters of the call are kept here. */ -extern int who; /* caller's proc number */ -extern int callnr; /* system call number */ -extern int dont_reply; /* normally 0; set to 1 to inhibit reply */ - diff --git a/servers/ds/inc.h b/servers/ds/inc.h index c2fae7621..c0587c6bf 100644 --- a/servers/ds/inc.h +++ b/servers/ds/inc.h @@ -28,5 +28,4 @@ #include #include "proto.h" -#include "glo.h" diff --git a/servers/ds/main.c b/servers/ds/main.c index 9ba8c57f9..d1195ad5d 100644 --- a/servers/ds/main.c +++ b/servers/ds/main.c @@ -12,11 +12,8 @@ #include /* Allocate space for the global variables. */ -endpoint_t who_e; /* caller's proc number */ -int callnr; /* system call number */ -int sys_panic; /* flag to indicate system-wide panic */ - -extern int errno; /* error number set by system library */ +PRIVATE endpoint_t who_e; /* caller's proc number */ +PRIVATE int callnr; /* system call number */ /* Declare some local functions. */ FORWARD _PROTOTYPE(void exit_server, (void) ); diff --git a/servers/ds/proto.h b/servers/ds/proto.h index f15edaafe..3bb3310df 100644 --- a/servers/ds/proto.h +++ b/servers/ds/proto.h @@ -13,5 +13,4 @@ _PROTOTYPE(int do_delete, (message *m_ptr)); _PROTOTYPE(int do_snapshot, (message *m_ptr)); _PROTOTYPE(int do_getsysinfo, (message *m_ptr)); _PROTOTYPE(int sef_cb_init_fresh, (int type, sef_init_info_t *info)); -_PROTOTYPE(int map_service, (struct rprocpub *rpub)); diff --git a/servers/ds/store.c b/servers/ds/store.c index b2dac7da6..e2d1c4aee 100644 --- a/servers/ds/store.c +++ b/servers/ds/store.c @@ -221,6 +221,31 @@ PRIVATE void update_subscribers(struct data_store *dsp, int set) } } +/*===========================================================================* + * map_service * + *===========================================================================*/ +PRIVATE int map_service(struct rprocpub *rpub) +{ +/* Map a new service by registering its label. */ + struct data_store *dsp; + + /* Allocate a new data slot. */ + if((dsp = alloc_data_slot()) == NULL) { + return ENOMEM; + } + + /* Set attributes. */ + strcpy(dsp->key, rpub->label); + dsp->u.u32 = (u32_t) rpub->endpoint; + strcpy(dsp->owner, ds_getprocname(DS_PROC_NR)); + dsp->flags = DSF_IN_USE | DSF_TYPE_LABEL; + + /* Update subscribers having a matching subscription. */ + update_subscribers(dsp, 1); + + return(OK); +} + /*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ @@ -254,32 +279,6 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info) return(OK); } -/*===========================================================================* - * map_service * - *===========================================================================*/ -PUBLIC int map_service(rpub) -struct rprocpub *rpub; -{ -/* Map a new service by registering its label. */ - struct data_store *dsp; - - /* Allocate a new data slot. */ - if((dsp = alloc_data_slot()) == NULL) { - return ENOMEM; - } - - /* Set attributes. */ - strcpy(dsp->key, rpub->label); - dsp->u.u32 = (u32_t) rpub->endpoint; - strcpy(dsp->owner, ds_getprocname(DS_PROC_NR)); - dsp->flags = DSF_IN_USE | DSF_TYPE_LABEL; - - /* Update subscribers having a matching subscription. */ - update_subscribers(dsp, 1); - - return(OK); -} - /*===========================================================================* * do_publish * *===========================================================================*/