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.
This commit is contained in:
Kees van Reeuwijk 2010-02-09 15:23:38 +00:00
parent 391fd926ff
commit 064cb7583a
52 changed files with 229 additions and 449 deletions

View file

@ -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; o<size; o += I386_PAGE_SIZE)
{
bit= (busaddr+o)/I386_PAGE_SIZE;
table[bit/8] &= ~(1 << (bit % 8));
u32_t bit= (busaddr+o)/I386_PAGE_SIZE;
table[bit/8] &= ~(1U << (bit % 8));
}
}

View file

@ -13,7 +13,7 @@ p = ../libpci
# 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

View file

@ -43,16 +43,23 @@ struct command {
};
/* Timeouts and max retries. */
int timeout_ticks = DEF_TIMEOUT_TICKS, max_errors = MAX_ERRORS;
long w_standard_timeouts = 0, w_pci_debug = 0, w_instance = 0,
disable_dma = 0, atapi_debug = 0, w_identify_wakeup_ticks,
wakeup_ticks, w_atapi_dma;
PRIVATE int timeout_ticks = DEF_TIMEOUT_TICKS;
PRIVATE int max_errors = MAX_ERRORS;
PRIVATE long w_standard_timeouts = 0;
PRIVATE long w_pci_debug = 0;
PRIVATE long w_instance = 0;
PRIVATE long disable_dma = 0;
PRIVATE long atapi_debug = 0;
PRIVATE long w_identify_wakeup_ticks;
PRIVATE long wakeup_ticks;
PRIVATE long w_atapi_dma;
int w_testing = 0, w_silent = 0;
PRIVATE int w_testing = 0;
PRIVATE int w_silent = 0;
int w_next_drive = 0;
PRIVATE int w_next_drive = 0;
u32_t system_hz;
PRIVATE u32_t system_hz;
/* The struct wini is indexed by controller first, then drive (0-3).
* Controller 0 is always the 'compatability' ide controller, at
@ -85,14 +92,9 @@ PRIVATE struct wini { /* main drive struct, one entry per drive */
} wini[MAX_DRIVES], *w_wn;
PRIVATE int w_device = -1;
PRIVATE int w_controller = -1;
PRIVATE int w_major = -1;
PRIVATE int win_tasknr; /* my task number */
PUBLIC int w_command; /* current command in execution */
PRIVATE u8_t w_byteval; /* used for SYS_IRQCTL */
PRIVATE int w_drive; /* selected drive */
PRIVATE int w_controller; /* selected controller */
PRIVATE struct device *w_dv; /* device's base and size */
/* Unfortunately, DMA_SECTORS and DMA_BUF_SIZE are already defined libdriver
@ -179,10 +181,7 @@ FORWARD _PROTOTYPE( int at_vinb, (int line, pvb_pair_t *, int n));
#undef sys_outb
#undef sys_inb
#undef sys_outw
#undef sys_inw
#undef sys_outl
#undef sys_inl
FORWARD _PROTOTYPE( int at_out, (int line, u32_t port, u32_t value,
char *typename, int type));
@ -191,10 +190,7 @@ FORWARD _PROTOTYPE( int at_in, (int line, u32_t port, u32_t *value,
#define sys_outb(p, v) at_out(__LINE__, (p), (v), "outb", _DIO_BYTE)
#define sys_inb(p, v) at_in(__LINE__, (p), (v), "inb", _DIO_BYTE)
#define sys_outw(p, v) at_out(__LINE__, (p), (v), "outw", _DIO_WORD)
#define sys_inw(p, v) at_in(__LINE__, (p), (v), "inw", _DIO_WORD)
#define sys_outl(p, v) at_out(__LINE__, (p), (v), "outl", _DIO_LONG)
#define sys_inl(p, v) at_in(__LINE__, (p), (v), "inl", _DIO_LONG)
/* Entry points to this driver. */
PRIVATE struct driver w_dtab = {
@ -601,9 +597,7 @@ PRIVATE void init_params_pci(int skip)
/*===========================================================================*
* w_do_open *
*===========================================================================*/
PRIVATE int w_do_open(dp, m_ptr)
struct driver *dp;
message *m_ptr;
PRIVATE int w_do_open(struct driver *dp, message *m_ptr)
{
/* Device open: Initialize the controller and read the partition table. */
@ -625,7 +619,12 @@ message *m_ptr;
#if VERBOSE
printf("%s: probe failed\n", w_name());
#endif
if (wn->state & 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';

View file

@ -1,8 +1,6 @@
#include "../drivers.h"
#include "../libdriver/driver.h"
#include "../libdriver/drvlib.h"
_PROTOTYPE(int main, (int argc, char *argv[]));
#include <drivers.h>
#include <libdriver/driver.h>
#include <libdriver/drvlib.h>
#define VERBOSE 0 /* display identify messages during boot */
#define ENABLE_ATAPI 1 /* add ATAPI cd-rom support to driver */

View file

@ -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

View file

@ -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 <drivers.h>
#include <libdriver/driver.h>
#include <libdriver/drvlib.h>
#include <minix/sysutil.h>
#include <minix/safecopies.h>
#include <sys/ioc_disk.h>
@ -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) );

View file

@ -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;

View file

@ -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" },

View file

@ -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;

View file

@ -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 */

View file

@ -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;
/*

View file

@ -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 <errno.h> */
@ -31,3 +35,4 @@
#include <errno.h>
#include <unistd.h>
#endif

View file

@ -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 *
*===========================================================================*/

View file

@ -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

View file

@ -8,7 +8,7 @@
#include <sys/types.h>
unsigned long crctab[] = {
static unsigned long crctab[] = {
0x7fffffff,
0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e,

View file

@ -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.

View file

@ -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 },

View file

@ -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];

View file

@ -12,7 +12,6 @@
* May 2009 (D.C. van Moolenbroek)
*/
#define _MINIX 1
#include <stdlib.h>
#include <string.h>
#include <minix/config.h>

View file

@ -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

View file

@ -1,7 +1,4 @@
#include "../drivers.h"
#include "../libdriver/driver.h"
#include "../libdriver/drvlib.h"
_PROTOTYPE(int main, (void));
#include <drivers.h>
#include <libdriver/driver.h>
#include <libdriver/drvlib.h>

View file

@ -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;

View file

@ -7,6 +7,9 @@ and 82562 fast ethernet controllers.
Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
*/
#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

View file

@ -6,6 +6,9 @@ Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
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 $
*/

View file

@ -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 *

View file

@ -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

View file

@ -1,6 +1,6 @@
/* Includes. */
#include "../drivers.h"
#include "../libdriver/driver.h"
#include <drivers.h>
#include <libdriver/driver.h>
#include <minix/type.h>
#include <minix/const.h>
#include <minix/com.h>

View file

@ -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

View file

@ -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 *

View file

@ -19,7 +19,7 @@
#ifndef _HERMES_H
#define _HERMES_H
#include "../drivers.h"
#include <drivers.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <net/hton.h>
@ -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 */

View file

@ -62,12 +62,10 @@
#include <ibm/pci.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include <kernel/const.h>
#include <kernel/config.h>
#include <kernel/type.h>
#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 <stdio.h>
#include <stdlib.h>
@ -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);
}

View file

@ -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) );

View file

@ -40,12 +40,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
@ -54,7 +51,6 @@
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <minix/com.h>
#include <minix/portio.h>
#include <ibm/cmos.h>
#include <sys/svrctl.h>
@ -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,

View file

@ -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

View file

@ -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) );

View file

@ -4,7 +4,7 @@ ibm/rtl8139.h
Created: Aug 2003 by Philip Homburg <philip@cs.vu.nl>
*/
#include "../drivers.h"
#include <drivers.h>
#include <stdlib.h>
#include <stdio.h>
@ -28,9 +28,9 @@ Created: Aug 2003 by Philip Homburg <philip@cs.vu.nl>
#include <assert.h>
#include <unistd.h>
#include <sys/ioc_memory.h>
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include <kernel/const.h>
#include <kernel/config.h>
#include <kernel/type.h>
#define RL_IDR 0x00 /* Ethernet address
* Note: RL_9346CR_EEM_CONFIG mode is

View file

@ -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

View file

@ -6,7 +6,7 @@
*
*/
#include "../drivers.h"
#include <drivers.h>
#include <stdlib.h>
#include <stdio.h>
@ -26,13 +26,10 @@
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include <kernel/const.h>
#include <kernel/config.h>
#include <kernel/type.h>
#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);
}

View file

@ -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

View file

@ -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

View file

@ -4,7 +4,7 @@ ti1225.c
Created: Dec 2005 by Philip Homburg
*/
#include "../drivers.h"
#include <drivers.h>
#include <ibm/pci.h>
#include <sys/vm_i386.h>
@ -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)
{

View file

@ -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

View file

@ -16,7 +16,7 @@
* and the scrolling function worries about wrapping.
*/
#include "../drivers.h"
#include <drivers.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/vm.h>
@ -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.

View file

@ -6,7 +6,7 @@
* Feb 04, 1994 loadable keymaps (Marcus Hampel)
*/
#include "../drivers.h"
#include <drivers.h>
#include <sys/ioctl.h>
#include <sys/kbdio.h>
#include <sys/time.h>
@ -19,21 +19,21 @@
#include <minix/com.h>
#include <minix/keymap.h>
#include "tty.h"
#include "../../kernel/const.h"
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include "../../kernel/proc.h"
#include <kernel/const.h>
#include <kernel/config.h>
#include <kernel/type.h>
#include <kernel/proc.h>
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 */

View file

@ -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. */

View file

@ -57,7 +57,7 @@
* Jul 13, 2004 support for function key observers (Jorrit N. Herder)
*/
#include "../drivers.h"
#include <drivers.h>
#include <termios.h>
#include <sys/ioc_tty.h>
#include <signal.h>
@ -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 *
*===========================================================================*/

View file

@ -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) );

View file

@ -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 */

View file

@ -28,5 +28,4 @@
#include <signal.h>
#include "proto.h"
#include "glo.h"

View file

@ -12,11 +12,8 @@
#include <minix/endpoint.h>
/* 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) );

View file

@ -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));

View file

@ -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 *
*===========================================================================*/