pcbit: drop unusable remnants

With the un-distributable confhexbin.c file, that provided the essential
function convhexbin(), gone, it is not sensible ito keep the ruins that
do not compile any more.

Thanks to git, the 'pcbitctrl' utility can get resusitated once someone
writes a free convhexbin() routine that is compliant to the unfree one..
Until then: R.I.P.
master
Peter Marschall 11 years ago
parent d8fc639095
commit 6cea8d15ed
  1. 3
      Makefile
  2. 2
      README
  3. 6
      doc/Configure.help
  4. 61
      pcbit/Makefile.in
  5. 106
      pcbit/README.pt
  6. 3543
      pcbit/configure
  7. 47
      pcbit/configure.in
  8. 2
      pcbit/install-sh
  9. 71
      pcbit/pcbit.h
  10. 605
      pcbit/pcbitctl.c
  11. 24
      pcbit/pcbitctl.man.in
  12. 1
      scripts/config.in
  13. 1
      scripts/defconfig

@ -50,9 +50,6 @@ endif
ifeq ($(CONFIG_ICNCTRL),y)
SUBDIRS := $(SUBDIRS) icn
endif
ifeq ($(CONFIG_PCBITCTL),y)
SUBDIRS := $(SUBDIRS) pcbit
endif
ifeq ($(CONFIG_HISAXCTRL),y)
SUBDIRS := $(SUBDIRS) hisax
endif

@ -8,7 +8,6 @@ This package contains the following stuff:
iprofd, daemon for realizing AT&W0 on ttyI's.
icnctrl, setup utility for the icn driver.
hisaxctrl, setup utility for the HiSax driver.
pcbitctl, setup utility for the pcbit driver.
avmcapictrl setup utility for the avmb1 driver.
actctrl setup utility for the act2000 driver.
eiconctrl setup utility for the eicon driver.
@ -67,7 +66,6 @@ IMPORTANT:
act2000: tools for IBM Active 2000
eicon: tools for Eicon.Diehl *active* cards
icn: tools for ICN 2B and 4B
pcbit: tools for PCBIT-D
loop: tools for the loopback isdn device
These packages will appear on ftp.isdn4linux.de when they are ready.

@ -199,12 +199,6 @@ CONFIG_ACTCTRL_DEBUG
of the IBM Active 2000 driver. This feature may be helpful when
debugging the driver.
Build pcbitctl
CONFIG_PCBITCTL
This program is used to configure the pcbit driver. With this tool
you can download protocol firmware into cards.
This program is documented in pcbitctl (8).
Build eiconctrl
CONFIG_EICONCTRL
This program is used to configure the Eicon driver. With

@ -1,61 +0,0 @@
# $Id: Makefile.in,v 1.11 2002/07/19 19:03:57 keil Exp $
#
# Makefile for pcbitctl
# (C) 1997 Fritz Elfert
#
#
SHELL = /bin/sh
CFLAGS = -Wall -Wstrict-prototypes -O2 -g
INCLUDES = -I. -DDEBUG
LDFLAGS = -L../lib @LIBS@
PROGRAM = pcbitctl
MODULES = pcbitctl.o convhexbin.o
MANPAGE = pcbitctl.8
SBINDIR = @CONFIG_SBINDIR@
MANDIR = @CONFIG_MANDIR@
MAN8DIR = $(MANDIR)/man8
INSTALL = @INSTALL@
INSTALL_PROGRAM = $(INSTALL) -o 0 -g 0 -m 0750
INSTALL_MAN = $(INSTALL) -o 0 -g 0 -m 0644
prefix = @prefix@
exec_prefix = @exec_prefix@
CC = @CC@
.SUFFIXES:
.SUFFIXES: .c .o
%.o: %.c Makefile
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
all: $(PROGRAM)
config:
@./configure
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
$(PROGRAM): $(MODULES)
$(CC) $(CFLAGS) $? $(LDFLAGS) -o $@
install-man: $(PROGRAM).man
mkdir -p $(DESTDIR)$(MAN8DIR)
$(INSTALL_MAN) $< $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
install: $(PROGRAM) install-man
$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)
install-strip: $(PROGRAM) install-man
$(INSTALL_PROGRAM) -s $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)
uninstall:
rm -f $(DESTDIR)$(SBINDIR)/$(PROGRAM) $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
clean:
rm -f *.o *~ $(PROGRAM) *.man
distclean: clean
rm -f config.status config.cache config.log Makefile

@ -1,106 +0,0 @@
------------------------------------------------------------------------------
README file for the PCBIT-D Device Driver.
------------------------------------------------------------------------------
This README file is in portuguese since the board is manufactured and
used, to my knowledge, only in Portugal.
In case you are interessed in a translation just mail me.
------------------------------------------------------------------------------
O driver para a PCBIT implementa as funções de comunicação com a
placa e uma maquina de estados que controla o establecimento de
ligacoes. Destina-se a ser utilizado em conjunto com o modulo
"isdn4linux" (ftp://ftp.franken.de/pub/isdn4linux) que se espera que
integre futuramente a distribuição do kernel. Este modulo realiza o
interface entre o ISDN e os interfaces normais de um sistema Unix
(ttys e devices de rede).
O driver destina-se a ser instalado em "run-time" no kernel através
do comando "insmod".
exemplo: root_shell# insmod pcbit [irq=X mem=0x?????]
A PCBIT utiliza por defeito o endereço de memoria 0xD0000 e o irq 5.
Caso os parametros de irq e memória base não sejam fornecidos o
driver tentará utilizar os valores por defeito.
A PCBIT necessita, na sua versão mais comum, que seja feito o load do
firmware. O comando pcbitctl permite, apos a instalacao do driver,
carregar o firmware da placa. O firmware não é distribuido com o
driver podendo encontrar-se nas disquetes que vêm com a placa ou em
ftp://puma.inesc.pt/.
São necessários os ficheiros:
- stpd.1
- stpd.2
- bitd.hex
Aviso: Estes ficheiros são distribuidos em modo de ficheiro de texto
de DOS. O comando pcbitctl necessita desses ficheiros em modo binario
(i.e. um ficheiro normal sem os LF e Ctrl-Z).
Para os utilizadores da RCU:
A RCU utiliza routers cisco como pontos de entrada, configurados para
utilizar PPP sincrono (i.e. encapsulação PPP sobre tramas HDLC no
canal B). Como tal é necessário utilizar devices de rede isdn com
encapsulação "syncPPP".
um exemplo de um script de para iniciar um interface:
#!/bin/bash
PATH=$PATH:<PATH_TO_ISDN_STUFF>
isdnctrl addif ippp0
isdnctrl l2_prot ippp0 hdlc
isdnctrl l3_prot ippp0 trans
isdnctrl encap ippp0 syncppp
isdnctrl addphone ippp0 out <num_isdn_da_rcu>
ifconfig ippp0 <ip-atribuido-ao-utilizador> pointopoint <ip-do-router>
route add default ippp0
isdnctrl huptimeout ippp0 180
ipppd /dev/ippp0 /dev/ippp1 useifip \
-detach debug \
mru 1524 -ac -vj \
+ua /etc/ppp/isdn-auth
nota:
o ficheiro /etc/ppp/isdn-auth é um ficheiro da forma:
username
passwd
o interface de rede é activado (e a conexão isdn establecida) quando
o utilizador der algum comando que implique acesso á rede.
ex: ping -c 1 <hostname>.
[normalmente existe um delay de 3-4 segundos no establecimento da ligação]
BUGS:
- o driver não permite um reload do firmware após o firmware ter sido
carregado.
- existem erros de comunicação driver/placa que se exibem em
situações de tráfego intenso. (alguns deste problemas podem mesmo ser
provocados por bugs no firmware da placa)
Mailing lists:
isdn4linux - isdn4linux@hub-wue.franken.de (majordomo)
enviar:
- informação sobre bugs, comentários, sujestões e patchs ao código p/
roque@di.fc.ul.pt.
- flames p/
/dev/null
Pedro.

3543
pcbit/configure vendored

File diff suppressed because it is too large Load Diff

@ -1,47 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(convhexbin.c)
AC_PREFIX_DEFAULT(/usr)
I4LVERSION=${I4LVERSION:-"?.?"}
CONFIG_SBINDIR=${CONFIG_CARD_SBINDIR:-"/sbin"}
CONFIG_MANDIR=${CONFIG_MANDIR:-"/usr/man"}
MANDATE=`grep CHECKIN pcbitctl.man.in | awk '{print $4}'`
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h)
dnl Find current kernel source
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS(strerror)
dnl Optional sbin directory
AC_ARG_WITH(sbin,
[ --with-sbin=DIR Set dir where binary is istalled. [/sbin]],
CONFIG_SBINDIR="${withval}"
AC_DEFINE(CONFIG_SBINDIR,"${withval}"),
)
dnl Optional man directory
AC_ARG_WITH(man,
[ --with-man=DIR Set manpage dir. [/usr/man]],
CONFIG_MANDIR="${withval}"
AC_DEFINE(CONFIG_MANDIR,"${withval}"),
)
AC_SUBST(INSTALL)
AC_SUBST(CONFIG_MANDIR)
AC_SUBST(CONFIG_SBINDIR)
AC_SUBST(MANDATE)
AC_SUBST(CONFIG_MANDIR)
AC_SUBST(I4LVERSION)
AC_OUTPUT(Makefile pcbitctl.man)

@ -1,2 +0,0 @@
#!/bin/sh
exit 0

@ -1,71 +0,0 @@
/* API only version generated from kernel drivers/isdn/pcbit/pcbit.h */
/*
* PCBIT-D device driver definitions
*
* Copyright (C) 1996 Universidade de Lisboa
*
* Written by Pedro Roque Marques (roque@di.fc.ul.pt)
*
* This software may be used and distributed according to the terms of
* the GNU General Public License, incorporated herein by reference.
*/
#ifndef PCBIT_H
#define PCBIT_H
#define MAX_PCBIT_CARDS 4
#define BLOCK_TIMER
/* isdn_ctrl only allows a long sized argument */
struct pcbit_ioctl {
union {
struct byte_op {
ushort addr;
ushort value;
} rdp_byte;
unsigned long l2_status;
} info;
};
#define PCBIT_IOCTL_GETSTAT 0x01 /* layer2 status */
#define PCBIT_IOCTL_LWMODE 0x02 /* linear write mode */
#define PCBIT_IOCTL_STRLOAD 0x03 /* start load mode */
#define PCBIT_IOCTL_ENDLOAD 0x04 /* end load mode */
#define PCBIT_IOCTL_SETBYTE 0x05 /* set byte */
#define PCBIT_IOCTL_GETBYTE 0x06 /* get byte */
#define PCBIT_IOCTL_RUNNING 0x07 /* set protocol running */
#define PCBIT_IOCTL_WATCH188 0x08 /* set watch 188 */
#define PCBIT_IOCTL_PING188 0x09 /* ping 188 */
#define PCBIT_IOCTL_FWMODE 0x0A /* firmware write mode */
#define PCBIT_IOCTL_STOP 0x0B /* stop protocol */
#define PCBIT_IOCTL_APION 0x0C /* issue API_ON */
#define PCBIT_GETSTAT (PCBIT_IOCTL_GETSTAT + IIOCDRVCTL)
#define PCBIT_LWMODE (PCBIT_IOCTL_LWMODE + IIOCDRVCTL)
#define PCBIT_STRLOAD (PCBIT_IOCTL_STRLOAD + IIOCDRVCTL)
#define PCBIT_ENDLOAD (PCBIT_IOCTL_ENDLOAD + IIOCDRVCTL)
#define PCBIT_SETBYTE (PCBIT_IOCTL_SETBYTE + IIOCDRVCTL)
#define PCBIT_GETBYTE (PCBIT_IOCTL_GETBYTE + IIOCDRVCTL)
#define PCBIT_RUNNING (PCBIT_IOCTL_RUNNING + IIOCDRVCTL)
#define PCBIT_WATCH188 (PCBIT_IOCTL_WATCH188 + IIOCDRVCTL)
#define PCBIT_PING188 (PCBIT_IOCTL_PING188 + IIOCDRVCTL)
#define PCBIT_FWMODE (PCBIT_IOCTL_FWMODE + IIOCDRVCTL)
#define PCBIT_STOP (PCBIT_IOCTL_STOP + IIOCDRVCTL)
#define PCBIT_APION (PCBIT_IOCTL_APION + IIOCDRVCTL)
#define MAXSUPERLINE 3000
#define L2_DOWN 0
#define L2_LOADING 1
#define L2_LWMODE 2
#define L2_FWMODE 3
#define L2_STARTING 4
#define L2_RUNNING 5
#define L2_ERROR 6
#endif

@ -1,605 +0,0 @@
/*
* Copyright (C) 1996 Universidade de Lisboa
*
* Writen by Pedro Roque Marques (roque@di.fc.ul.pt)
*
* This software may be used and distributed according to the terms of
* the GNU Public License, incorporated herein by reference.
*/
/*
* PCBIT-D firmware loader
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <getopt.h>
#include <linux/isdn.h>
#include <pcbit.h>
#define MAXLINEHEX 80
#define NUM_LIN 32
#define MAXSUPERLINE 3000
static void usage(char *);
static int loadfw(int, char *, int);
static int writefw(int, char*);
static int bitd_read(unsigned char* buf, int *len, int nlines, FILE* fp);
static int issue_ioctl(int board, int cmd);
extern int convhexbin (char *filename, unsigned char *buf, int size);
int main(int argc, char *argv[])
{
int option_index = 0;
char fwfile[FILENAME_MAX];
int force = 0;
int board = 0;
char c, choice = 0; /* {ping,stop,load} */
static struct option long_options[] =
{
{"ping", 0, 0, 'p'},
{"stop", 0, 0, 's'},
{"force", 0, 0, 'f'},
{"load", 1, 0, 'l'},
{"board", 1, 0, 'b'},
{0, 0, 0, 0}
};
while (1) {
c = getopt_long(argc, argv, "psfl:b:", long_options,
&option_index);
if ( c == -1 )
break;
switch(c) {
case 'p':
case 's':
choice = c;
break;
case 'l':
choice = c;
strcpy(fwfile, optarg);
break;
case 'b':
board = atoi(optarg);
break;
case 'f':
force = 1;
break;
default:
fprintf(stderr, "unknown option %c\n", c);
break;
}
if (choice)
break;
}
switch (choice) {
case 's':
issue_ioctl(board, PCBIT_STOP);
break;
case 'p':
issue_ioctl(board, PCBIT_PING188);
break;
case 'l':
return loadfw(board, fwfile, force);
break;
default:
usage(argv[0]);
return 1;
}
return 0;
}
static void usage(char *name){
fprintf(stderr, "usage:"
"\t%s ping\n"
"\t%s stop\n"
"\t%s load [-f] <firmware>\n",
name, name, name);
}
static int getrdp_byte(int fd, int board, ushort addr, unsigned short * value)
{
isdn_ioctl_struct io_cmd;
struct pcbit_ioctl * pcbit_cmd;
strcpy(io_cmd.drvid, "pcbitX");
io_cmd.drvid[5] = '0' + board;
pcbit_cmd = (struct pcbit_ioctl *) &io_cmd.arg;
pcbit_cmd->info.rdp_byte.addr = addr;
pcbit_cmd->info.rdp_byte.value = 0x0000;
if (ioctl(fd, PCBIT_GETBYTE, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
*value = pcbit_cmd->info.rdp_byte.value;
return 0;
}
static int setrdp_byte(int fd, int board, ushort addr, unsigned char value)
{
isdn_ioctl_struct io_cmd;
struct pcbit_ioctl * pcbit_cmd;
strcpy(io_cmd.drvid, "pcbitX");
io_cmd.drvid[5] = '0' + board;
pcbit_cmd = (struct pcbit_ioctl *) &io_cmd.arg;
pcbit_cmd->info.rdp_byte.addr = addr;
pcbit_cmd->info.rdp_byte.value = value;
if (ioctl(fd, PCBIT_SETBYTE, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
return 0;
}
static int testrdp(int fd, int board)
{
int retv;
unsigned short value;
retv = setrdp_byte(fd, board, 0x0000, 0x55);
if (!retv)
return retv;
value = 0x00;
retv = getrdp_byte(fd, board, 0x0000, &value);
if (!retv)
return retv;
if (value != 0x55)
{
fprintf(stderr, "test_board: values don't match\n");
return -1;
}
retv = setrdp_byte(fd, board, 0x0000, 0xaa);
if (!retv)
return retv;
value = 0x00;
retv = getrdp_byte(fd, board, 0x0000, &value);
if (!retv)
return retv;
if (value != 0xaa)
{
fprintf(stderr, "test_board: values don't match\n");
return -1;
}
return 0;
}
int issue_ioctl(int board, int cmd)
{
int fd;
isdn_ioctl_struct io_cmd;
struct pcbit_ioctl * pcbit_cmd;
if ( (fd = open("/dev/isdnctrl", O_RDWR)) == -1) {
fprintf(stderr, "error opening /dev/isdnctl: %s\n",
strerror(errno));
return errno;
}
strcpy(io_cmd.drvid, "pcbitX");
io_cmd.drvid[5] = '0' + board;
pcbit_cmd = (struct pcbit_ioctl *) &io_cmd.arg;
if (ioctl(fd, cmd, &io_cmd) < 0) {
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
return 0;
}
static int loadfw(int board, char *fname, int force)
{
int fd;
int attempt, retv, i, j;
unsigned short value;
isdn_ioctl_struct io_cmd;
struct pcbit_ioctl * pcbit_cmd;
unsigned char stpd1[1024], stpd2[1024], zerobuf[1024];
unsigned char execstr[7] = {
0x01,
0x04,
0x00,
0x00,
0x00,
0x00,
0x12
};
/*
* 1. get_status
* 2. load stpd.1
* 3. load stpd.2
* 4. test
* 5. firmware load
* 6. execute
* 7. set_protocol_running
*/
strcpy(io_cmd.drvid, "pcbitX");
io_cmd.drvid[5] = '0' + board;
pcbit_cmd = (struct pcbit_ioctl *) &io_cmd.arg;
if ( (fd = open("/dev/isdnctrl", O_RDWR)) == -1) {
fprintf(stderr, "error opening /dev/isdnctl: %s\n",
strerror(errno));
return errno;
}
if (ioctl(fd, PCBIT_GETSTAT, &io_cmd) < 0) {
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
if (pcbit_cmd->info.l2_status == L2_RUNNING) {
if (force) {
if (ioctl(fd, PCBIT_STOP, &io_cmd) < 0) {
fprintf(stderr, "ioctl failed: %s\n",
strerror(errno));
return errno;
}
}
else {
fprintf(stderr, "PCBIT-D driver is up and running. no action nedded\n");
return 0;
}
}
#ifdef DEBUG
fprintf(stderr, "1. Status check OK\n");
#endif
/*
* load stpd.{1,2}
*/
memset(stpd1, 0, 1024);
memset(stpd2, 0, 1024);
if ( convhexbin("stpd.1", stpd1, 1024) < 0 )
{
fprintf(stderr, "error reading stpd.1\n");
return -1;
}
if ( convhexbin("stpd.2", stpd2, 1024) < 0 )
{
fprintf(stderr, "error reading stpd.2\n");
return -1;
}
#ifdef DEBUG
fprintf(stderr, "2. stpd.{1,2} loaded \n");
#endif
if (ioctl(fd, PCBIT_STRLOAD, &io_cmd) < 0)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
if (ioctl(fd, PCBIT_WATCH188, &io_cmd) < 0) {
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
if (ioctl(fd, PCBIT_LWMODE, &io_cmd) < 0)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
memset(zerobuf, 0, 1024);
testrdp(fd, board);
#ifdef DEBUG
fprintf(stderr, "3.a linear write mode\n");
#endif
write(fd, zerobuf, 1024);
sleep(1);
if (testrdp(fd, board))
{
fprintf(stderr, "error: testrdp\n");
return -1;
}
write(fd, stpd1, 1024);
sleep(1);
for (j=0; j<2; j++) {
for (i=0; i<60; i++)
{
getrdp_byte(fd, board, 0x03fd, &value);
if (value == 0x55)
break;
if (write(fd, stpd1, 1021) < 0)
{
printf("error in write\n");
return -1;
}
usleep(200000);
/*
setrdp_byte(fd, board, 0x03fd, 0x00);
setrdp_byte(fd, board, 0x03ff, 0x00);
*/
}
if (i == 60)
{
printf("error in stpd.1 load\n");
return -1;
}
for (i=0; i<180; i++)
{
getrdp_byte(fd, board, 0x03ff, &value);
if (value == 0x55)
break;
usleep(20000);
}
if (i == 180)
{
printf("error in stpd.1 load - 2 val \n");
return -1;
}
getrdp_byte(fd, board, 0x03fe, &value);
if (value == 0x1f)
{
printf("1f\n");
break;
}
setrdp_byte(fd, board, 0x03fe, 0x00);
setrdp_byte(fd, board, 0x03ff, 0x00);
}
#ifdef DEBUG
fprintf(stderr, "3.c stpd.1 writen\n");
#endif
memcpy(stpd2 + 0x3e0, stpd1 + 0x3e0, 0x10);
if (write(fd, stpd2, 1023) < 0)
{
fprintf(stderr, "write failed: %s\n", strerror(errno));
return errno;
}
value = 0x00;
attempt = 0;
while(1)
{
if ((retv = getrdp_byte(fd, board, 0x03ff, &value)))
{
fprintf(stderr, "read_byte: error\n");
return retv;
}
if (value == 0x55)
break;
setrdp_byte(fd, board, 0x03ff, 0x00);
if (attempt==120)
{
fprintf(stderr, "Communication error\n");
return -1;
}
else
attempt++;
usleep(50);
}
#ifdef DEBUG
fprintf(stderr, "3.d stpd.2 writen\n");
#endif
if (ioctl(fd, PCBIT_FWMODE, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
#ifdef DEBUG
fprintf(stderr, "4.a load mode\n");
#endif
if (writefw(fd, fname))
return -1;
/* execute */
if (write(fd, execstr, 7) < 0)
{
fprintf(stderr, "write failed: %s\n", strerror(errno));
return errno;
}
#ifdef DEBUG
fprintf(stderr, "4.b execute\n");
#endif
/*
sleep(10);
if (ioctl(fd, PCBIT_STRLOAD, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
if (ioctl(fd, PCBIT_APION, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
if (ioctl(fd, PCBIT_PING188, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
sleep(5);
*/
if (ioctl(fd, PCBIT_ENDLOAD, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
#ifdef DEBUG
fprintf(stderr, "4.c load ok\n");
#endif
sleep(2);
if (ioctl(fd, PCBIT_RUNNING, &io_cmd) == -1)
{
fprintf(stderr, "ioctl failed: %s\n", strerror(errno));
return errno;
}
#ifdef DEBUG
fprintf(stderr, "5. running\n");
#endif
return 0;
}
static int writefw(int fd, char* fname)
{
FILE *fp;
char shdr[80];
char buf[MAXSUPERLINE];
int i, len;
if ((fp=fopen(fname, "rb")) == NULL)
{
fprintf(stderr, "error in fopen %s:%s\n", fname, strerror(errno));
return -1;
}
fgets (shdr, 80, fp);
fprintf(stderr, "Loading %s \n", shdr);
len = MAXSUPERLINE;
while((i=bitd_read (buf + 3, &len, 80, fp))) {
buf[0]=0;
*((short *)&buf[1])=(short)(len);
if (write(fd, buf, len + 3) < 0)
{
fprintf(stderr, "load firmware - error in write:%s\n",strerror(errno));
return errno;
}
fprintf(stderr, ".");
fflush(stderr);
}
fprintf(stderr, "\n load complete\n");
fclose(fp);
fprintf(stderr, "Firmware loaded\n");
return 0;
}
/*
* Discard 1st char (':') and convert the rest to bin
*/
static int bitd_read(unsigned char* buf, int *len, int nlines, FILE* fp)
{
char line[80];
int i, j;
unsigned int val;
int aux = 0;
*len = 1;
for (i = 0; i < nlines; i++) {
if (fgets(line, 80, fp) == NULL)
break;
aux += strlen(line) - 1;
line[strlen(line) - 1] = 0;
for (j=1; line[j]; j+=2) {
sscanf(line + j, "%02x", &val);
buf[(*len)++] = val;
}
}
buf[0] = i;
return aux;
}

@ -1,24 +0,0 @@
.\" $Id: pcbitctl.man.in,v 1.1 1998/10/13 22:36:58 keil Exp $
.\"
.\" CHECKIN $Date: 1998/10/13 22:36:58 $
.\"
.\" Process this file with
.\" groff -man -Tascii pcbitctl.8 for ASCII output, or
.\" groff -man -Tps pcbitctl.8 for PostScript output
.\"
.TH PCBITCTL 8 "@MANDATE@" isdn4k-utils-@I4LVERSION@ "Linux System Administration"
.SH NAME
pcbitctl \- PCBIT-D firmware loader
.SH SYNOPSIS
.BI "pcbitctl load [-f] <firmware>"
.br
.SH DESCRIPTION
.I pcbitctl
is a programm to load PCBIT-D firmware
.LP
.SH AUTHOR
Pedro Roque Marques (roque@di.fc.ul.pt)
.LP
.SH SEE ALSO
.I isdnctrl\c
\&(8).

@ -71,7 +71,6 @@ if [ "$CONFIG_ICNCTRL" = "y" ]; then
bool 'Enable icnctrl debug-option' CONFIG_ICNCTRL_DEBUG
fi
bool 'actctrl' CONFIG_ACTCTRL
bool 'pcbitctl' CONFIG_PCBITCTL
bool 'avmcapictrl / capiinit' CONFIG_AVMCAPICTRL
if [ -f $CONFIG_KERNELDIR/drivers/isdn/act2000/act2000.h ] ; then
bool 'actctrl' CONFIG_ACTCTRL

@ -46,7 +46,6 @@ CONFIG_IPROFD=y
CONFIG_HISAXCTRL=y
CONFIG_ICNCTRL=y
# CONFIG_ICNCTRL_DEBUG is not set
CONFIG_PCBITCTL=y
CONFIG_AVMCAPICTRL=y
CONFIG_ACTCTRL=y
CONFIG_LOOPCTRL=n

Loading…
Cancel
Save