Rewrite some functions to ANSI style.
This commit is contained in:
parent
e0f7043e04
commit
c6eb51d66a
17 changed files with 71 additions and 145 deletions
|
@ -20,18 +20,18 @@
|
||||||
|
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
ST_NIL, /* Zero checksums */
|
ST_NIL, /* Zero checksums */
|
||||||
ST_XOR, /* XOR-based checksums */
|
ST_XOR, /* XOR-based checksums */
|
||||||
ST_CRC, /* CRC32-based checksums */
|
ST_CRC, /* CRC32-based checksums */
|
||||||
ST_MD5 /* MD5-based checksums */
|
ST_MD5 /* MD5-based checksums */
|
||||||
};
|
} checksum_type;
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
FLT_WRITE, /* write to up to two disks */
|
FLT_WRITE, /* write to up to two disks */
|
||||||
FLT_READ, /* read from one disk */
|
FLT_READ, /* read from one disk */
|
||||||
FLT_READ2 /* read from both disks */
|
FLT_READ2 /* read from both disks */
|
||||||
};
|
} disk_operation;
|
||||||
|
|
||||||
/* Something was wrong and the disk driver has been restarted/refreshed,
|
/* Something was wrong and the disk driver has been restarted/refreshed,
|
||||||
* so the request needs to be redone.
|
* so the request needs to be redone.
|
||||||
|
@ -43,13 +43,13 @@ enum {
|
||||||
* BD_PROTO: a protocol error has occurred. Refresh it.
|
* BD_PROTO: a protocol error has occurred. Refresh it.
|
||||||
* BD_DATA: a data error has occurred. Refresh it.
|
* BD_DATA: a data error has occurred. Refresh it.
|
||||||
*/
|
*/
|
||||||
enum {
|
typedef enum {
|
||||||
BD_NONE,
|
BD_NONE,
|
||||||
BD_DEAD,
|
BD_DEAD,
|
||||||
BD_PROTO,
|
BD_PROTO,
|
||||||
BD_DATA,
|
BD_DATA,
|
||||||
BD_LAST
|
BD_LAST
|
||||||
};
|
} driver_state;
|
||||||
|
|
||||||
#define DRIVER_MAIN 0
|
#define DRIVER_MAIN 0
|
||||||
#define DRIVER_BACKUP 1
|
#define DRIVER_BACKUP 1
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef _OPTSET_H
|
#ifndef _OPTSET_H
|
||||||
#define _OPTSET_H
|
#define _OPTSET_H
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
OPT_BOOL,
|
OPT_BOOL,
|
||||||
OPT_STRING,
|
OPT_STRING,
|
||||||
OPT_INT
|
OPT_INT
|
||||||
};
|
} opt_type;
|
||||||
|
|
||||||
/* An entry for the parser of an options set. The 'os_name' field must point
|
/* An entry for the parser of an options set. The 'os_name' field must point
|
||||||
* to a string, which is treated case-insensitively; the last entry of a table
|
* to a string, which is treated case-insensitively; the last entry of a table
|
||||||
|
@ -20,7 +20,7 @@ enum {
|
||||||
*/
|
*/
|
||||||
struct optset {
|
struct optset {
|
||||||
char *os_name;
|
char *os_name;
|
||||||
int os_type;
|
opt_type os_type;
|
||||||
void *os_ptr;
|
void *os_ptr;
|
||||||
int os_val;
|
int os_val;
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "floppy.h"
|
#include "floppy.h"
|
||||||
#include <timers.h>
|
#include <timers.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ibm/diskparm.h>
|
#include <ibm/diskparm.h>
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
|
|
||||||
#include <minix/keymap.h>
|
|
||||||
#include <net/hton.h>
|
#include <net/hton.h>
|
||||||
#include <net/gen/ether.h>
|
#include <net/gen/ether.h>
|
||||||
#include <net/gen/eth_io.h>
|
#include <net/gen/eth_io.h>
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
#include "../libdriver/driver.h"
|
#include "../libdriver/driver.h"
|
||||||
#include <sys/ioc_memory.h>
|
#include <sys/ioc_memory.h>
|
||||||
#include <env.h>
|
|
||||||
#include <minix/ds.h>
|
#include <minix/ds.h>
|
||||||
#include <minix/vm.h>
|
#include <minix/vm.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -26,11 +25,8 @@
|
||||||
#include "../../kernel/config.h"
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
|
|
||||||
#include <sys/vm.h>
|
|
||||||
#include <sys/vm_i386.h>
|
#include <sys/vm_i386.h>
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
|
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
|
|
||||||
/* ramdisks (/dev/ram*) */
|
/* ramdisks (/dev/ram*) */
|
||||||
|
|
|
@ -14,8 +14,8 @@ for initializing a character array in C.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
char *progname;
|
static char *progname;
|
||||||
unsigned char buf[1024];
|
static unsigned char buf[1024];
|
||||||
|
|
||||||
static void fatal(char *fmt, ...);
|
static void fatal(char *fmt, ...);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
|
@ -37,12 +37,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hermes.h"
|
#include "hermes.h"
|
||||||
#include <sys/vm.h>
|
|
||||||
#include "assert.h"
|
|
||||||
#include <ibm/pci.h>
|
|
||||||
|
|
||||||
#include "string.h"
|
PRIVATE int this_proc;
|
||||||
int this_proc;
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* milli_delay *
|
* milli_delay *
|
||||||
|
|
|
@ -55,13 +55,10 @@
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <minix/keymap.h>
|
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
#include <timers.h>
|
#include <timers.h>
|
||||||
#include <sys/ioc_memory.h>
|
|
||||||
#include <ibm/pci.h>
|
#include <ibm/pci.h>
|
||||||
#include <minix/ds.h>
|
#include <minix/ds.h>
|
||||||
#include <minix/endpoint.h>
|
#include <minix/endpoint.h>
|
||||||
|
@ -96,7 +93,6 @@ static tmra_ut or_watchdog;
|
||||||
#include <net/gen/eth_io.h>
|
#include <net/gen/eth_io.h>
|
||||||
#include <sys/vm_i386.h>
|
#include <sys/vm_i386.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ main.c
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
|
|
||||||
#include <ibm/pci.h>
|
|
||||||
#include <minix/rs.h>
|
#include <minix/rs.h>
|
||||||
#include <minix/endpoint.h>
|
#include <minix/endpoint.h>
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
|
|
||||||
#define PBT_INTEL_HOST 1
|
#define PBT_INTEL_HOST 1
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
#include "../libdriver/driver.h"
|
#include "../libdriver/driver.h"
|
||||||
#include <sys/ioc_memory.h>
|
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
|
@ -11,10 +11,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <minix/ds.h>
|
#include <minix/ds.h>
|
||||||
#include <minix/keymap.h>
|
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
|
@ -26,10 +24,8 @@
|
||||||
#include <ibm/pci.h>
|
#include <ibm/pci.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioc_memory.h>
|
|
||||||
#include "../../kernel/const.h"
|
#include "../../kernel/const.h"
|
||||||
#include "../../kernel/config.h"
|
#include "../../kernel/config.h"
|
||||||
#include "../../kernel/type.h"
|
#include "../../kernel/type.h"
|
||||||
|
|
|
@ -233,8 +233,7 @@ PRIVATE int dsp_close()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_ioctl
|
* dsp_ioctl
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int dsp_ioctl(m_ptr)
|
PRIVATE int dsp_ioctl(message *m_ptr)
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
phys_bytes user_phys;
|
phys_bytes user_phys;
|
||||||
|
@ -274,8 +273,7 @@ message *m_ptr;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_write
|
* dsp_write
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void dsp_write(m_ptr)
|
PRIVATE void dsp_write(message *m_ptr)
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
message mess;
|
message mess;
|
||||||
|
@ -381,8 +379,8 @@ PRIVATE void dsp_hardware_msg()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_status *
|
* dsp_status *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void dsp_status(m_ptr)
|
PRIVATE void dsp_status(message *m_ptr)
|
||||||
message *m_ptr; /* pointer to the newly arrived message */
|
/* m_ptr pointer to the newly arrived message */
|
||||||
{
|
{
|
||||||
if(revivePending) {
|
if(revivePending) {
|
||||||
m_ptr->m_type = DEV_REVIVE; /* build message */
|
m_ptr->m_type = DEV_REVIVE; /* build message */
|
||||||
|
@ -404,11 +402,7 @@ message *m_ptr; /* pointer to the newly arrived message */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* reply *
|
* reply *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void reply(code, replyee, process, status)
|
PRIVATE void reply(int code, int replyee, int process, int status)
|
||||||
int code;
|
|
||||||
int replyee;
|
|
||||||
int process;
|
|
||||||
int status;
|
|
||||||
{
|
{
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
|
@ -491,8 +485,7 @@ PRIVATE int dsp_reset()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_command
|
* dsp_command
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int dsp_command(value)
|
PRIVATE int dsp_command(int value)
|
||||||
int value;
|
|
||||||
{
|
{
|
||||||
int i, status;
|
int i, status;
|
||||||
|
|
||||||
|
@ -511,8 +504,7 @@ int value;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_set_size
|
* dsp_set_size
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int dsp_set_size(size)
|
static int dsp_set_size(unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
dprint("dsp_set_size(): set fragment size to %u\n", size);
|
dprint("dsp_set_size(): set fragment size to %u\n", size);
|
||||||
|
|
||||||
|
@ -530,8 +522,7 @@ unsigned int size;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_set_speed
|
* dsp_set_speed
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int dsp_set_speed(speed)
|
static int dsp_set_speed(unsigned int speed)
|
||||||
unsigned int speed;
|
|
||||||
{
|
{
|
||||||
dprint("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo);
|
dprint("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo);
|
||||||
|
|
||||||
|
@ -562,8 +553,7 @@ unsigned int speed;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_set_stereo
|
* dsp_set_stereo
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int dsp_set_stereo(stereo)
|
static int dsp_set_stereo(unsigned int stereo)
|
||||||
unsigned int stereo;
|
|
||||||
{
|
{
|
||||||
if(stereo) {
|
if(stereo) {
|
||||||
DspStereo = 1;
|
DspStereo = 1;
|
||||||
|
@ -578,8 +568,7 @@ unsigned int stereo;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_set_bits
|
* dsp_set_bits
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int dsp_set_bits(bits)
|
static int dsp_set_bits(unsigned int bits)
|
||||||
unsigned int bits;
|
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
if(bits != 8 && bits != 16) {
|
if(bits != 8 && bits != 16) {
|
||||||
|
@ -595,8 +584,7 @@ unsigned int bits;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_set_sign
|
* dsp_set_sign
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int dsp_set_sign(sign)
|
static int dsp_set_sign(unsigned int sign)
|
||||||
unsigned int sign;
|
|
||||||
{
|
{
|
||||||
dprint("sb16: set sign to %u\n", sign);
|
dprint("sb16: set sign to %u\n", sign);
|
||||||
|
|
||||||
|
@ -609,9 +597,7 @@ unsigned int sign;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* dsp_dma_setup
|
* dsp_dma_setup
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void dsp_dma_setup(address, count)
|
PRIVATE void dsp_dma_setup(phys_bytes address, int count)
|
||||||
phys_bytes address;
|
|
||||||
int count;
|
|
||||||
{
|
{
|
||||||
pvb_pair_t pvb[9];
|
pvb_pair_t pvb[9];
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,7 @@ PRIVATE void sef_local_startup()
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* mixer_open
|
* mixer_open
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int mixer_open(m_ptr)
|
PRIVATE int mixer_open(message *m_ptr)
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
dprint("mixer_open\n");
|
dprint("mixer_open\n");
|
||||||
|
|
||||||
|
@ -124,8 +123,7 @@ message *m_ptr;
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* mixer_close
|
* mixer_close
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int mixer_close(m_ptr)
|
PRIVATE int mixer_close(message *m_ptr)
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
dprint("mixer_close\n");
|
dprint("mixer_close\n");
|
||||||
|
|
||||||
|
@ -136,8 +134,7 @@ message *m_ptr;
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* mixer_ioctl
|
* mixer_ioctl
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int mixer_ioctl(m_ptr)
|
PRIVATE int mixer_ioctl(message *m_ptr)
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -188,8 +185,7 @@ PRIVATE int mixer_init()
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* mixer_get
|
* mixer_get
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int mixer_get(reg)
|
PRIVATE int mixer_get(int reg)
|
||||||
int reg;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -202,9 +198,8 @@ int reg;
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* get_set_volume *
|
* get_set_volume *
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int get_set_volume(m_ptr, flag)
|
PRIVATE int get_set_volume(message *m_ptr, int flag)
|
||||||
message *m_ptr;
|
/* flag 0 = get, 1 = set */
|
||||||
int flag; /* 0 = get, 1 = set */
|
|
||||||
{
|
{
|
||||||
phys_bytes user_phys;
|
phys_bytes user_phys;
|
||||||
struct volume_level level;
|
struct volume_level level;
|
||||||
|
@ -286,10 +281,11 @@ int flag; /* 0 = get, 1 = set */
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* get_set_input *
|
* get_set_input *
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int get_set_input(m_ptr, flag, channel)
|
PRIVATE int get_set_input(message *m_ptr, int flag, int channel)
|
||||||
message *m_ptr;
|
/*
|
||||||
int flag; /* 0 = get, 1 = set */
|
* flag 0 = get, 1 = set
|
||||||
int channel; /* 0 = left, 1 = right */
|
* channel 0 = left, 1 = right
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
phys_bytes user_phys;
|
phys_bytes user_phys;
|
||||||
struct inout_ctrl input;
|
struct inout_ctrl input;
|
||||||
|
@ -351,9 +347,8 @@ int channel; /* 0 = left, 1 = right */
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* get_set_output *
|
* get_set_output *
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
PRIVATE int get_set_output(m_ptr, flag)
|
PRIVATE int get_set_output(message *m_ptr, int flag)
|
||||||
message *m_ptr;
|
/* flag 0 = get, 1 = set */
|
||||||
int flag; /* 0 = get, 1 = set */
|
|
||||||
{
|
{
|
||||||
phys_bytes user_phys;
|
phys_bytes user_phys;
|
||||||
struct inout_ctrl output;
|
struct inout_ctrl output;
|
||||||
|
|
|
@ -6,7 +6,6 @@ Created: Dec 2005 by Philip Homburg
|
||||||
|
|
||||||
#include "../drivers.h"
|
#include "../drivers.h"
|
||||||
#include <ibm/pci.h>
|
#include <ibm/pci.h>
|
||||||
#include <sys/vm.h>
|
|
||||||
#include <sys/vm_i386.h>
|
#include <sys/vm_i386.h>
|
||||||
|
|
||||||
#include "ti1225.h"
|
#include "ti1225.h"
|
||||||
|
|
|
@ -82,9 +82,7 @@ FORWARD _PROTOTYPE( int pty_select, (tty_t *tp, message *m) );
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_pty *
|
* do_pty *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void do_pty(tp, m_ptr)
|
PUBLIC void do_pty(tty_t *tp, message *m_ptr)
|
||||||
tty_t *tp;
|
|
||||||
message *m_ptr;
|
|
||||||
{
|
{
|
||||||
/* Perform an open/close/read/write call on a /dev/ptypX device. */
|
/* Perform an open/close/read/write call on a /dev/ptypX device. */
|
||||||
pty_t *pp = tp->tty_priv;
|
pty_t *pp = tp->tty_priv;
|
||||||
|
@ -203,9 +201,7 @@ message *m_ptr;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_write *
|
* pty_write *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int pty_write(tp, try)
|
PRIVATE int pty_write(tty_t *tp, int try)
|
||||||
tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* (*dev_write)() routine for PTYs. Transfer bytes from the writer on
|
/* (*dev_write)() routine for PTYs. Transfer bytes from the writer on
|
||||||
* /dev/ttypX to the output buffer.
|
* /dev/ttypX to the output buffer.
|
||||||
|
@ -289,9 +285,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_echo *
|
* pty_echo *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void pty_echo(tp, c)
|
PRIVATE void pty_echo(tty_t *tp, int c)
|
||||||
tty_t *tp;
|
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
/* Echo one character. (Like pty_write, but only one character, optionally.) */
|
/* Echo one character. (Like pty_write, but only one character, optionally.) */
|
||||||
|
|
||||||
|
@ -314,8 +308,7 @@ int c;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_start *
|
* pty_start *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void pty_start(pp)
|
PRIVATE void pty_start(pty_t *pp)
|
||||||
pty_t *pp;
|
|
||||||
{
|
{
|
||||||
/* Transfer bytes written to the output buffer to the PTY reader. */
|
/* Transfer bytes written to the output buffer to the PTY reader. */
|
||||||
int count;
|
int count;
|
||||||
|
@ -355,8 +348,7 @@ pty_t *pp;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_finish *
|
* pty_finish *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void pty_finish(pp)
|
PRIVATE void pty_finish(pty_t *pp)
|
||||||
pty_t *pp;
|
|
||||||
{
|
{
|
||||||
/* Finish the read request of a PTY reader if there is at least one byte
|
/* Finish the read request of a PTY reader if there is at least one byte
|
||||||
* transferred.
|
* transferred.
|
||||||
|
@ -375,9 +367,7 @@ pty_t *pp;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_read *
|
* pty_read *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int pty_read(tp, try)
|
PRIVATE int pty_read(tty_t *tp, int try)
|
||||||
tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at
|
/* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at
|
||||||
* a time, 99% of the writes will be for one byte, so no sense in being smart.)
|
* a time, 99% of the writes will be for one byte, so no sense in being smart.)
|
||||||
|
@ -448,9 +438,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_close *
|
* pty_close *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int pty_close(tp, try)
|
PRIVATE int pty_close(tty_t *tp, int try)
|
||||||
tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* The tty side has closed, so shut down the pty side. */
|
/* The tty side has closed, so shut down the pty side. */
|
||||||
pty_t *pp = tp->tty_priv;
|
pty_t *pp = tp->tty_priv;
|
||||||
|
@ -475,9 +463,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_icancel *
|
* pty_icancel *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int pty_icancel(tp, try)
|
PRIVATE int pty_icancel(tty_t *tp, int try)
|
||||||
tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* Discard waiting input. */
|
/* Discard waiting input. */
|
||||||
pty_t *pp = tp->tty_priv;
|
pty_t *pp = tp->tty_priv;
|
||||||
|
@ -494,9 +480,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_ocancel *
|
* pty_ocancel *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int pty_ocancel(tp, try)
|
PRIVATE int pty_ocancel(tty_t *tp, int try)
|
||||||
tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* Drain the output buffer. */
|
/* Drain the output buffer. */
|
||||||
pty_t *pp = tp->tty_priv;
|
pty_t *pp = tp->tty_priv;
|
||||||
|
@ -510,8 +494,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* pty_init *
|
* pty_init *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void pty_init(tp)
|
PUBLIC void pty_init(tty_t *tp)
|
||||||
tty_t *tp;
|
|
||||||
{
|
{
|
||||||
pty_t *pp;
|
pty_t *pp;
|
||||||
int line;
|
int line;
|
||||||
|
|
|
@ -212,9 +212,7 @@ PRIVATE int my_inb(port_t port)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_write *
|
* rs_write *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_write(tp, try)
|
PRIVATE int rs_write(register tty_t *tp, int try)
|
||||||
register tty_t *tp;
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* (*devwrite)() routine for RS232. */
|
/* (*devwrite)() routine for RS232. */
|
||||||
|
|
||||||
|
@ -335,9 +333,8 @@ int c; /* character to echo */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_ioctl *
|
* rs_ioctl *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_ioctl(tp, dummy)
|
PRIVATE int rs_ioctl(tty_t *tp, int dummy)
|
||||||
tty_t *tp; /* which TTY */
|
/* tp; which TTY */
|
||||||
int dummy;
|
|
||||||
{
|
{
|
||||||
/* Reconfigure the line as soon as the output has drained. */
|
/* Reconfigure the line as soon as the output has drained. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
|
@ -349,8 +346,8 @@ int dummy;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_config *
|
* rs_config *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void rs_config(rs)
|
PRIVATE void rs_config(rs232_t *rs)
|
||||||
rs232_t *rs; /* which line */
|
/* rs which line */
|
||||||
{
|
{
|
||||||
/* Set various line control parameters for RS232 I/O.
|
/* Set various line control parameters for RS232 I/O.
|
||||||
* If DataBits == 5 and StopBits == 2, 8250 will generate 1.5 stop bits.
|
* If DataBits == 5 and StopBits == 2, 8250 will generate 1.5 stop bits.
|
||||||
|
@ -435,8 +432,8 @@ rs232_t *rs; /* which line */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_init *
|
* rs_init *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void rs_init(tp)
|
PUBLIC void rs_init(tty_t *tp)
|
||||||
tty_t *tp; /* which TTY */
|
/* tp which TTY */
|
||||||
{
|
{
|
||||||
unsigned long dummy;
|
unsigned long dummy;
|
||||||
/* Initialize RS232 for one line. */
|
/* Initialize RS232 for one line. */
|
||||||
|
@ -539,8 +536,7 @@ tty_t *tp; /* which TTY */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_interrupt *
|
* rs_interrupt *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void rs_interrupt(m)
|
PUBLIC void rs_interrupt(message *m)
|
||||||
message *m; /* which TTY */
|
|
||||||
{
|
{
|
||||||
unsigned long irq_set;
|
unsigned long irq_set;
|
||||||
int i;
|
int i;
|
||||||
|
@ -557,9 +553,7 @@ message *m; /* which TTY */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_icancel *
|
* rs_icancel *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_icancel(tp, dummy)
|
PRIVATE int rs_icancel(tty_t *tp, int dummy)
|
||||||
tty_t *tp; /* which TTY */
|
|
||||||
int dummy;
|
|
||||||
{
|
{
|
||||||
/* Cancel waiting input. */
|
/* Cancel waiting input. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
|
@ -576,9 +570,7 @@ int dummy;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_ocancel *
|
* rs_ocancel *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_ocancel(tp, dummy)
|
PRIVATE int rs_ocancel(tty_t *tp, int dummy)
|
||||||
tty_t *tp; /* which TTY */
|
|
||||||
int dummy;
|
|
||||||
{
|
{
|
||||||
/* Cancel pending output. */
|
/* Cancel pending output. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
|
@ -595,9 +587,7 @@ int dummy;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_read *
|
* rs_read *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_read(tp, try)
|
PRIVATE int rs_read(tty_t *tp, int try)
|
||||||
tty_t *tp; /* which tty */
|
|
||||||
int try;
|
|
||||||
{
|
{
|
||||||
/* Process characters from the circular input buffer. */
|
/* Process characters from the circular input buffer. */
|
||||||
|
|
||||||
|
@ -644,8 +634,7 @@ int try;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_ostart *
|
* rs_ostart *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void rs_ostart(rs)
|
PRIVATE void rs_ostart(rs232_t *rs)
|
||||||
rs232_t *rs; /* which rs line */
|
|
||||||
{
|
{
|
||||||
/* Tell RS232 there is something waiting in the output buffer. */
|
/* Tell RS232 there is something waiting in the output buffer. */
|
||||||
|
|
||||||
|
@ -656,9 +645,7 @@ rs232_t *rs; /* which rs line */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_break *
|
* rs_break *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_break(tp, dummy)
|
PRIVATE int rs_break(tty_t *tp, int dummy)
|
||||||
tty_t *tp; /* which tty */
|
|
||||||
int dummy;
|
|
||||||
{
|
{
|
||||||
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
|
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
|
@ -676,9 +663,7 @@ int dummy;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs_close *
|
* rs_close *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int rs_close(tp, dummy)
|
PRIVATE int rs_close(tty_t *tp, int dummy)
|
||||||
tty_t *tp; /* which tty */
|
|
||||||
int dummy;
|
|
||||||
{
|
{
|
||||||
/* The line is closed; optionally hang up. */
|
/* The line is closed; optionally hang up. */
|
||||||
rs232_t *rs = tp->tty_priv;
|
rs232_t *rs = tp->tty_priv;
|
||||||
|
@ -694,8 +679,7 @@ int dummy;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* rs232_handler *
|
* rs232_handler *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void rs232_handler(rs)
|
PRIVATE void rs232_handler(struct rs232 *rs)
|
||||||
struct rs232 *rs;
|
|
||||||
{
|
{
|
||||||
/* Interrupt hander for RS232. */
|
/* Interrupt hander for RS232. */
|
||||||
|
|
||||||
|
@ -728,8 +712,8 @@ struct rs232 *rs;
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* in_int *
|
* in_int *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void in_int(rs)
|
PRIVATE void in_int(register rs232_t *rs)
|
||||||
register rs232_t *rs; /* line with input interrupt */
|
/* rs line with input interrupt */
|
||||||
{
|
{
|
||||||
/* Read the data which just arrived.
|
/* Read the data which just arrived.
|
||||||
* If it is the oxoff char, clear OSWREADY, else if OSWREADY was clear, set
|
* If it is the oxoff char, clear OSWREADY, else if OSWREADY was clear, set
|
||||||
|
@ -776,8 +760,8 @@ register rs232_t *rs; /* line with input interrupt */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* line_int *
|
* line_int *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void line_int(rs)
|
PRIVATE void line_int(register rs232_t *rs)
|
||||||
register rs232_t *rs; /* line with line status interrupt */
|
/* rs line with line status interrupt */
|
||||||
{
|
{
|
||||||
/* Check for and record errors. */
|
/* Check for and record errors. */
|
||||||
|
|
||||||
|
@ -793,8 +777,8 @@ register rs232_t *rs; /* line with line status interrupt */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* modem_int *
|
* modem_int *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void modem_int(rs)
|
PRIVATE void modem_int(register rs232_t *rs)
|
||||||
register rs232_t *rs; /* line with modem interrupt */
|
/* rs line with modem interrupt */
|
||||||
{
|
{
|
||||||
/* Get possibly new device-ready status, and clear ODEVREADY if necessary.
|
/* Get possibly new device-ready status, and clear ODEVREADY if necessary.
|
||||||
* If the device just became ready, restart output.
|
* If the device just became ready, restart output.
|
||||||
|
@ -817,8 +801,8 @@ register rs232_t *rs; /* line with modem interrupt */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* out_int *
|
* out_int *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void out_int(rs)
|
PRIVATE void out_int(register rs232_t *rs)
|
||||||
register rs232_t *rs; /* line with output interrupt */
|
/* rs; line with output interrupt */
|
||||||
{
|
{
|
||||||
/* If there is output to do and everything is ready, do it (local device is
|
/* If there is output to do and everything is ready, do it (local device is
|
||||||
* known ready).
|
* known ready).
|
||||||
|
|
Loading…
Reference in a new issue