⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ltmodem.h,v

📁 话带数据中传真解调程序
💻 H,V
字号:
head	1.7;access;symbols;locks	root:1.7; strict;comment	@ * @;1.7date	99.12.01.04.11.13;	author ftp;	state Exp;branches;next	1.6;1.6date	99.08.22.03.36.13;	author root;	state Exp;branches;next	1.5;1.5date	99.08.21.04.38.35;	author root;	state Exp;branches;next	1.4;1.4date	99.08.16.03.00.16;	author root;	state Exp;branches;next	1.3;1.3date	99.07.21.03.31.04;	author root;	state Exp;branches;next	1.2;1.2date	99.07.05.03.59.31;	author root;	state Exp;branches;next	1.1;1.1date	99.07.05.03.51.27;	author root;	state Exp;branches;next	;desc@@1.7log@Updated for 0.9.2 catchup build.@text@/*
 *	$Id: ltmodem.h,v 1.6 1999/08/22 03:36:13 root Exp root $
 *
 *	Lucent PCI modem diagnostics tool.
 *
 *	Copyright (c) 1999 Richard J.M. Close
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <ctype.h>

#include "pci_utils.h"
#include "irq.h"
#include "control.h"
#include "voice.h"

#define LTMODEM_VERSION "0.9.2"


/* Options */
static int verbose = 0;		        // Show detailed information.

/* Modem monitoring functions. */
static void
monitor_modem(void);

static int
set_monitoring_interval(void);

/* Modem writing functions. */
static void
set_modem(void);

/* Main command menu. */
void main_menu(void);

void command_mode(void);

void setup_irq(void);

void io_init(void);

// Default is tone dialling.
bool pulseDial = false;

// Dial the number held in the argument string.
void dial(char *s);

// Mess around with the speaker.
void setSpeaker (bool Enabled, unsigned char Volume);

bool waitForAnswerTone (void);


@1.6log@Revised for 0.0.6, added dialling stuff from Pavel and minor mod to initialisation.@text@d2 1a2 1 *	$Id: ltmodem.h,v 1.5 1999/08/21 04:38:35 root Exp root $
d18 1a18 1#include "portIO.h"
d20 2d23 1a23 1/* Format strings used for IRQ numbers and memory addresses */
a24 53#ifdef ARCH_SPARC64
#define IRQ_FORMAT "%08x"
#else
#define IRQ_FORMAT "%d"
#endif

#ifdef HAVE_64BIT_ADDRESS
#define ADDR_FORMAT "%016Lx"
#else
#define ADDR_FORMAT "%08lx"
#endif

#ifdef ARCH_SPARC64
#define IO_FORMAT "%016Lx"
#elif defined(HAVE_64BIT_ADDRESS)
#define IO_FORMAT "%04Lx"
#else
#define IO_FORMAT "%04lx"
#endif

#define LTMODEM_VERSION "0.0.6"

struct device {
  struct device *next;
  struct pci_dev *dev;
  unsigned int config_cnt;
  byte config[256];
};

/* Communication with libpci */

static struct pci_access *pacc;

/* Our view of the PCI bus */

static struct device *first_dev;
static struct device *modem_dev;

/* Tree output */

struct bridge {
  struct bridge *chain;			/* Single-linked list of bridges */
  struct bridge *next, *child;		/* Tree of bridges */
  struct bus *first_bus;		/* List of busses connected to this bridge */
  unsigned int primary, secondary, subordinate;	/* Bus numbers */
  struct device *br_dev;
};

struct bus {
  unsigned int number;
  struct bus *sibling;
  struct device *first_dev, **last_dev;
};
d27 1a27 90static int modem;			/* Boolean: modem has been found = 1 */
/*static int verbose;		Show detailed information */
static int buscentric_view;		/* Show bus addresses/IRQ's instead of CPU-visible ones */
static struct pci_filter filter;	/* Device filter */

/* general scanning stuff. */
static struct device *
scan_device(struct pci_dev *p);
static void
scan_devices(void);

static int
check_root(void);

static int
config_fetch(struct device *d, unsigned int pos, unsigned int len);


/* Config space accesses */
static inline byte
get_conf_byte(struct device *d, unsigned int pos);

static word
get_conf_word(struct device *d, unsigned int pos);

static u32
get_conf_long(struct device *d, unsigned int pos);

/* Count used to access bases of htype0 devices. */
static int htype0_cnt = 6;
/* Array to hold IO addresses and their width (in bytes). */
unsigned int io_address[6];
unsigned int io_length[6];
/* The number of I/O ports found, = length of io_address. */
static unsigned int io_cnt;

/* Sorting */
static int
compare_them(const void *A, const void *B);

static void
sort_them(void);

/* Normal output */
#define FLAG(x,y) ((x & y) ? '+' : '-')

static void
show_bases(struct device *d, int cnt);

static void
show_htype0(struct device *d);

static struct bus *
find_bus(struct bridge *b, unsigned int n);

static struct bus *
new_bus(struct bridge *b, unsigned int n);

static void
insert_dev(struct device *d, struct bridge *b);

/* Bus mapping mode */

struct bus_bridge {
  struct bus_bridge *next;
  byte this, dev, func, first, last, bug;
};

struct bus_info {
  byte exists;
  byte guestbook;
  struct bus_bridge *bridges, *via;
};

static struct bus_info *bus_info;

static void
do_map_bridges(int bus, int min, int max);

/*  Show hexadecimal dump of first 64 bytes of the PCI configuration space
    (the standard header). */
static void
show_hex_dump(struct device *d);

/* Lucent modem specific stuff. */
static int
find_modem(void);

static void
show_modem(void);
a35 6static void
continous_monitoring(int monitor_type, int monitoring_interval);

static void
redisplay_modem_regs(void);

a38 6/* Interactively set the control register. */
static void
set_modem_cont_reg(void);
/* Interactively write to the IO ports. */
static void
set_modem_io(void);
d43 2d51 10@1.5log@*** empty log message ***@text@d2 1a2 1 *	$Id: ltmodem.h,v 1.4 1999/08/16 03:00:16 root Exp $
d198 3@1.4log@Included Pavel's updates and tidy ups.@text@d1 197a197 197/* *	$Id: ltmodem.h,v 1.3 1999/07/21 03:31:04 root Exp root $ * *	Lucent PCI modem diagnostics tool. * *	Copyright (c) 1999 Richard J.M. Close * *	Can be freely distributed and used under the terms of the GNU GPL. */#include <stdio.h>#include <string.h>#include <stdlib.h>#include <stdarg.h>#include <unistd.h>#include <ctype.h>#include "portIO.h"#include "irq.h"/* Format strings used for IRQ numbers and memory addresses */#ifdef ARCH_SPARC64#define IRQ_FORMAT "%08x"#else#define IRQ_FORMAT "%d"#endif#ifdef HAVE_64BIT_ADDRESS#define ADDR_FORMAT "%016Lx"#else#define ADDR_FORMAT "%08lx"#endif#ifdef ARCH_SPARC64#define IO_FORMAT "%016Lx"#elif defined(HAVE_64BIT_ADDRESS)#define IO_FORMAT "%04Lx"#else#define IO_FORMAT "%04lx"#endif#define LTMODEM_VERSION "0.0.5"struct device {  struct device *next;  struct pci_dev *dev;  unsigned int config_cnt;  byte config[256];};/* Communication with libpci */static struct pci_access *pacc;/* Our view of the PCI bus */static struct device *first_dev;static struct device *modem_dev;/* Tree output */struct bridge {  struct bridge *chain;			/* Single-linked list of bridges */  struct bridge *next, *child;		/* Tree of bridges */  struct bus *first_bus;		/* List of busses connected to this bridge */  unsigned int primary, secondary, subordinate;	/* Bus numbers */  struct device *br_dev;};struct bus {  unsigned int number;  struct bus *sibling;  struct device *first_dev, **last_dev;};/* Options */static int modem;			/* Boolean: modem has been found = 1 *//*static int verbose;		Show detailed information */static int buscentric_view;		/* Show bus addresses/IRQ's instead of CPU-visible ones */static struct pci_filter filter;	/* Device filter *//* general scanning stuff. */static struct device *scan_device(struct pci_dev *p);static voidscan_devices(void);static intcheck_root(void);static intconfig_fetch(struct device *d, unsigned int pos, unsigned int len);/* Config space accesses */static inline byteget_conf_byte(struct device *d, unsigned int pos);static wordget_conf_word(struct device *d, unsigned int pos);static u32get_conf_long(struct device *d, unsigned int pos);/* Count used to access bases of htype0 devices. */static int htype0_cnt = 6;/* Array to hold IO addresses and their width (in bytes). */unsigned int io_address[6];unsigned int io_length[6];/* The number of I/O ports found, = length of io_address. */static unsigned int io_cnt;/* Sorting */static intcompare_them(const void *A, const void *B);static voidsort_them(void);/* Normal output */#define FLAG(x,y) ((x & y) ? '+' : '-')static voidshow_bases(struct device *d, int cnt);static voidshow_htype0(struct device *d);static struct bus *find_bus(struct bridge *b, unsigned int n);static struct bus *new_bus(struct bridge *b, unsigned int n);static voidinsert_dev(struct device *d, struct bridge *b);/* Bus mapping mode */struct bus_bridge {  struct bus_bridge *next;  byte this, dev, func, first, last, bug;};struct bus_info {  byte exists;  byte guestbook;  struct bus_bridge *bridges, *via;};static struct bus_info *bus_info;static voiddo_map_bridges(int bus, int min, int max);/*  Show hexadecimal dump of first 64 bytes of the PCI configuration space    (the standard header). */static voidshow_hex_dump(struct device *d);/* Lucent modem specific stuff. */static intfind_modem(void);static voidshow_modem(void);/* Modem monitoring functions. */static voidmonitor_modem(void);static intset_monitoring_interval(void);static voidcontinous_monitoring(int monitor_type, int monitoring_interval);static voidredisplay_modem_regs(void);/* Modem writing functions. */static voidset_modem(void);/* Interactively set the control register. */static voidset_modem_cont_reg(void);/* Interactively write to the IO ports. */static voidset_modem_io(void);/* Main command menu. */void main_menu(void);void setup_irq(void);void io_init(void);@1.3log@See changes to ltmodem.c@text@d2 1a2 1 *	$Id: ltmodem.h,v 1.2 1999/07/05 03:59:31 root Exp root $a15 1#include <sys/io.h>d18 2a19 1#include "pciutils.h"d43 1a43 1#define LTMODEM_VERSION "0.0.4"d193 1a193 2voidmain_menu(void);d195 1a195 3/* Write functions prototypes from pciutils lib, for reference.intpci_write_byte(struct pci_dev *d, int pos, byte data);d197 1a197 10intpci_write_word(struct pci_dev *d, int pos, word data);intpci_write_long(struct pci_dev *d, int pos, u32 data);intpci_write_block(struct pci_dev *d, int pos, byte *buf, int len);*/@1.2log@Added prototypes for new monitoring functions.@text@d2 1a2 1 *	$Id: ltmodem.h,v 0.3 1999/07/05 03:51:27 root Exp root $d43 1a43 1#define LTMODEM_VERSION "0.0.3"d108 3a110 2/* Array to hold IO addresses. */int io_address[6];d112 1a112 1static int io_cnt;a171 2static intset_monitoring_type(void);@1.1log@Initial revision@text@d2 1a2 1 *	$Id: ltmodem.h,v 0.0.3 1999/07/04 22:45:57 rjmc Exp $d169 1a169 1voidd171 1a171 1intd174 1a174 1intd177 1a177 1voidd180 1a180 1voidd184 1a184 1voidd187 1a187 1voidd190 1a190 1void@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -