portio.h

来自「话带数据中传真解调程序」· C头文件 代码 · 共 137 行

H
137
字号
#ifndef PORTIO_H

#define PORTIO_H 1

#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/io.h>
#include <stdio.h>

#include "config.h" 
#include "isa_utils.h"
#include "pci_utils.h"

#include "lib/pci.h"
#include "stdbool.h"
#include "time_utils.h"
#include "modem_globals.h"
#include "homol.h"
#include "init.h"
#include "control.h"
#include "data.h"

#define PRINTF(a...) fprintf(stderr, "# " a)

// IO port subroutines etc.
//
// These routines have been "reverse engineered" from those in in the NT driver code, ltmodem.sys.

void Init_Mars(void);

// Maybe use an object for the modem I/O properties?
// Called by main routine which passes the base addres of the I/O ports.
void port_io_init(unsigned int Portbase1, unsigned int Portbase2);

// Places args in a long word to go to port, then reads back.
unsigned int PciRead_dword (unsigned char arg1, unsigned char arg2, unsigned char arg3);

unsigned int PciRead_word (unsigned char arg1, unsigned char arg2, unsigned char arg3);

void PciWrite_dword (unsigned int arg1, unsigned int arg2, unsigned int* ptrValue);

// Read byte from port at base address plus offset.
unsigned char Read_mdm_byte (unsigned int offset);

// Place value in port (base address in BaseAddress) plus offset.
void Write_mdm_byte (unsigned int portOffset, unsigned char value);

// Place value in port (base address in BaseAddress) plus offset.
void Write_mdm_word (unsigned int portOffset, unsigned short value);

void dp_out_port (int arg);

int dp_in_port(void);

void dp_regwrite (unsigned int port, unsigned char val);

unsigned int dp_regread (unsigned int port);

void dp_regandor (unsigned int port, unsigned int val1, unsigned int val2);

void dp_int_regwrite(unsigned int port, unsigned int val);

int dp_int_regread(unsigned int port);

int dp_dsp_regread (unsigned int arg);

int dp_read_dsp_ram(int where);

void dp_write_dsp_ram(int addr, int val);

void dp_modem_command (unsigned int a0, unsigned int a4, unsigned int a8);

void dp_modem_command_long(int a0, int a4, int a8, int aC, int a10);

//========================================================================
// X stuff!

void x_output_init(void);

void x_output(int arg);

int x_input(int arg);

//========================================================================
//
//

void dp_board_enable(void);
void dp_board_disable (void);

/* Ugly, feel free to rewrite it to be really readable. But I do not care - this function is not critical in any way */
int dp_dsp_rom_checksum(void);

int dp_change_mercury_gain(int a0, int a4, int a8, int aC);

void dp_set_mercury_gain(void);

int readbio(int arg);

void writebio(int val, int strange);

void writebiom(int val, int strange);

void writecioc (unsigned int arg1, unsigned int arg2);

//=================================================================

void dp_init_local_phone_timer(void);

// Probably cellphone related, so not bothered about this.
void cell_init (void);

// Used by dp_init_variables.
void dp_init_blacklist(void);
void dp_init_local_phone_state(void);

// Empty for now.
void set_boardid(void);
void x_output_deinit(void);

extern struct device *modem_dev;
extern unsigned int io_cnt;
extern unsigned int io_address[];
extern unsigned int io_length[];

void continous_monitoring(int monitor_type, int monitoring_interval);

/* Interactively write to the IO ports. */
void set_modem_io(void);

// * Dummy for now. *
void dp_run_rom (void);

#endif /* PORTIO_H */

⌨️ 快捷键说明

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