Update of load and log utility.

New firmware and NT mode for PRI card.
This commit is contained in:
armin 2000-12-02 21:39:42 +00:00
parent c904a46177
commit 9a59b46886
9 changed files with 1560 additions and 702 deletions

View File

@ -1,4 +1,7 @@
$Id: CHANGES,v 1.5 2000/07/08 14:18:52 armin Exp $
$Id: CHANGES,v 1.6 2000/12/02 21:39:42 armin Exp $
V2.3 - 2000-12-01 - New load features. NT mode for PRI,
firmware update.
V2.2 - 2000-07-08 - Capable for 2.4 devfs.
("/dev/isdnctrl" -> "/dev/isdn/isdnctrl")

View File

@ -1,7 +1,7 @@
Eiconctrl user utility and firmware for supported active ISDN cards
from Eicon Technology.
Version 2.2 (c) 2000 Cytronics & Melware
Version 2.3 (c) 2000 Cytronics & Melware
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,8 @@ static char dsp_file_format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE]
'\0','\0','\0','\0','\0','\0','\0','\0'
};
*/
#define COMBIFILE DATADIR "/dspdload.bin"
/* #define COMBIFILE DATADIR "/dspdload.bin" */
/*These files will contain the binaries wriiten to card*/
#ifdef DEBUG
@ -101,6 +102,8 @@ dword store_download(char *data, word size, char *store);
int set_alignment_mask(int card_type);
int download(char *block, dword size, int code);
extern char* selected_protocol_code_directory;
extern int selected_bri_code_version;
/*--------------------------------------------------------------------------
* load_combifile() function
@ -114,7 +117,7 @@ int download(char *block, dword size, int code);
* Parameters: cardtype = Card ordinal as specified in cardtype.h
*--------------------------------------------------------------------------*/
void load_combifile(int card_type, word wFeatures)
void load_combifile(int card_type, word wFeatures, int bri_card)
{
int fd;
int count;
@ -126,6 +129,16 @@ void load_combifile(int card_type, word wFeatures)
t_dsp_combifile_directory_entry *directory;
t_dsp_combifile_directory_entry *tmp_directory;
dword download_size;
char COMBIFILE[1024];
strcpy (COMBIFILE, selected_protocol_code_directory);
strcat (COMBIFILE, "dspdload.bin");
if ((bri_card == 1) && (selected_bri_code_version)) {
strcpy (COMBIFILE, selected_protocol_code_directory);
strcat (COMBIFILE, "dspdload.s6");
}
//printf ("I: DSP FILE:<%s>\n", COMBIFILE);
#ifdef DEBUG
int dsp_fd;

View File

@ -53,6 +53,9 @@ int card_id;
extern byte new_cards[];
extern byte cards[];
extern dword selected_protocol_is_dmlt;
extern char* selected_protocol_code_directory;
extern int selected_bri_code_version;
/*int sprintf(char *,char *,...);*/
void *malloc(size_t);
@ -60,15 +63,18 @@ void *malloc(size_t);
* load the specified buffer containing DSP code onto the Diva card
*/
void load_combifile(int card_type, word wFeatures);
void load_combifile(int card_type, word wFeatures, int bri);
int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg , int adapter_instance)
{
int DivaALoad (char *dsp_name,
dia_config_t *options,
dia_card_t *card,
char *msg , int adapter_instance) {
int card_type = -1;
int loadfd; /* Divas file pointer */
int fd; /* file pointer */
struct stat file_info; /* info about file */
dia_load_t load; /* information to load */
char *microcode_dir = DATADIR "/";
char *microcode_dir = selected_protocol_code_directory;
char filename[100];
dia_start_t start;
int rc;
@ -99,89 +105,119 @@ int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg
return(ERR_ETDD_IOCTL);
}
}
card_type = cards[options->card_id + 1];
#if 0
switch (card_type) {
case 0: printf ("I: PRI Card\n"); break;
case 1: printf ("I: BRI Card\n"); break;
case 2: printf ("I: 4BRI Card\n"); break;
default:
printf ("I: unknown CARD\n");
}
#endif
if ((cards[options->card_id + 1] == 2) &&
(adapter_instance == 4)) // Only on first 4BRI virtual adapter
{
strcpy(filename, microcode_dir);
strcat(filename, "/ds4bri.bit");
if ((fd = open(filename, O_RDONLY, 0)) == -1)
{
sprintf(msg,dsp_name);
(void)close(loadfd);
return(ERR_ETDD_DSP);
if ((cards[options->card_id + 1] == 2) &&
(adapter_instance == 4)) { // Only on first 4BRI virtual adapter
strcpy(filename, microcode_dir);
strcat(filename, "/ds4bri.bit");
if ((fd = open(filename, O_RDONLY, 0)) == -1) {
sprintf(msg,dsp_name);
(void)close(loadfd);
return(ERR_ETDD_DSP);
}
if (fstat(fd, &file_info)) {
sprintf(msg,dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_ACCESS);
}
if (file_info.st_size <= 0) {
sprintf(msg,"file error (%s)",dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
if (!(load.code = malloc(file_info.st_size))) {
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_NOMEM);
}
if (read(fd, load.code, file_info.st_size) != file_info.st_size) {
sprintf(msg,"format error, %s", dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
load.length = file_info.st_size;
load.code_type=DIA_FPGA_CODE;
if ((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1) {
fprintf(stderr, "%s LOAD\n", DIVAS_DEVICE);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_IOCTL);
}
free(load.code);
close(fd);
}
if (fstat(fd, &file_info))
{
sprintf(msg,dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_ACCESS);
/*
Download protocol code now
*/
if (selected_protocol_is_dmlt & (1 << card_type)) {
char* p = strstr (dsp_name, ".");
strcpy(filename, microcode_dir);
strcat(filename, "te_dmlt");
strcat(filename, p);
if ((fd = open(filename, O_RDONLY, 0)) >= 0) {
close (fd);
} else {
strcpy(filename, microcode_dir);
strcat(filename, dsp_name);
}
} else {
strcpy(filename, microcode_dir);
strcat(filename, dsp_name);
}
if ( file_info.st_size <= 0 )
{
sprintf(msg,"file error (%s)",dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
/*
Alternative protocol code for BRI ?
*/
if (card_type == 1) {
switch (selected_bri_code_version) {
case 6:
filename[strlen(filename)-1]='6';
break;
default:
}
}
if (!(load.code = malloc(file_info.st_size)))
{
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_NOMEM);
}
// printf ("load %s\n", filename);
if (read(fd, load.code, file_info.st_size) != file_info.st_size)
{
sprintf(msg,"format error, %s", dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
load.length = file_info.st_size;
load.code_type=DIA_FPGA_CODE;
if((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1)
{
fprintf(stderr, "%s LOAD\n", DIVAS_DEVICE);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_IOCTL);
}
free(load.code);
close(fd);
}
/* open file containing DSP code */
strcpy(filename, microcode_dir);
strcat(filename, dsp_name);
/* open this DSP binary for reading */
if ((fd = open(filename, O_RDONLY, 0)) == -1)
{
if ((fd = open(filename, O_RDONLY, 0)) == -1) {
sprintf(msg,dsp_name);
(void)close(loadfd);
return(ERR_ETDD_DSP);
}
if (fstat(fd, &file_info))
{
if (fstat(fd, &file_info)) {
sprintf(msg,dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_ACCESS);
}
if ( file_info.st_size <= 0 )
{
if ( file_info.st_size <= 0 ) {
sprintf(msg,"file error (%s)",dsp_name);
(void)close(loadfd);
(void)close(fd);
@ -189,15 +225,13 @@ int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg
}
/* allocate a buffer and read contents of file into buffer */
if (!(load.code = malloc(file_info.st_size)))
{
if (!(load.code = malloc(file_info.st_size))) {
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_NOMEM);
}
if (read(fd, load.code, file_info.st_size) != file_info.st_size)
{
if (read(fd, load.code, file_info.st_size) != file_info.st_size) {
sprintf(msg,"format error, %s", dsp_name);
(void)close(loadfd);
(void)close(fd);
@ -213,8 +247,7 @@ int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg
load.code_type=DIA_CPU_CODE;
/* assign buffers and length and pass ioctl to /dev/Divas */
if((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1)
{
if((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1) {
fprintf(stderr, "%s LOAD\n", DIVAS_DEVICE);
(void)close(loadfd);
(void)close(fd);
@ -226,48 +259,41 @@ int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg
(void) close(fd);
(void) close(loadfd);
if (cards[options->card_id + 1] == 0)
{
load_combifile(CARDTYPE_DIVASRV_P_9M_PCI, wFeatures);
}
else if (cards[options->card_id + 1] == 1)
{
load_combifile(CARDTYPE_MAESTRA_PCI, wFeatures);
}
else if ((cards[options->card_id + 1] == 2) &&
(adapter_instance == 1)) // Only on last 4BRI virtual adapter
{
load_combifile(CARDTYPE_DIVASRV_Q_8M_PCI, wFeatures);
}
if (cards[options->card_id + 1] == 0) {
load_combifile(CARDTYPE_DIVASRV_P_9M_PCI, wFeatures, 0);
} else if (cards[options->card_id + 1] == 1) {
load_combifile(CARDTYPE_MAESTRA_PCI, wFeatures, 1);
} else if ((cards[options->card_id + 1] == 2) && (adapter_instance == 1)) {
/*
Only on last 4BRI virtual adapter
*/
load_combifile(CARDTYPE_DIVASRV_Q_8M_PCI, wFeatures, 0);
}
/* open the Divas device */
if ((loadfd = open(DIVAS_DEVICE_DFS, O_RDONLY, 0)) < 0)
if ((loadfd = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1)
{
sprintf(msg,DIVAS_DEVICE);
return(ERR_ETDD_OPEN);
}
if ((loadfd = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1) {
sprintf(msg,DIVAS_DEVICE);
return(ERR_ETDD_OPEN);
}
if((ioctl(loadfd, DIA_IOCTL_CONFIG, options)) == -1)
{
fprintf(stderr, "%s CONFIG\n", DIVAS_DEVICE);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
if ((ioctl(loadfd, DIA_IOCTL_CONFIG, options)) == -1) {
fprintf(stderr, "%s CONFIG\n", DIVAS_DEVICE);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
/* Inform /dev/Divas that loading is finished */
if (adapter_instance == 1) // only do this once
{
if((ioctl(loadfd, DIA_IOCTL_START, &start)) == -1)
{
if (adapter_instance == 1) { // only do this once
if((ioctl(loadfd, DIA_IOCTL_START, &start)) == -1) {
fprintf(stderr, "%s START\n", DIVAS_DEVICE);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
}//if (adapter_instance == 1)
(void)close(loadfd);
(void)close(loadfd);
return(ERR_ETDD_OK);
return(ERR_ETDD_OK);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $Id: eiconctrl.c,v 1.20 2000/07/08 14:18:52 armin Exp $
/* $Id: eiconctrl.c,v 1.21 2000/12/02 21:39:42 armin Exp $
*
* Eicon-ISDN driver for Linux. (Control-Utility)
*
@ -21,6 +21,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: eiconctrl.c,v $
* Revision 1.21 2000/12/02 21:39:42 armin
* Update of load and log utility.
* New firmware and NT mode for PRI card.
*
* Revision 1.20 2000/07/08 14:18:52 armin
* Changes for devfs.
*
@ -211,7 +215,7 @@ char *spid_state[] =
__u16 xlog(FILE * stream,void * buffer);
void eiconctrl_usage() {
fprintf(stderr,"Eiconctrl Utility Version 2.2 (c) 2000 Cytronics & Melware\n");
fprintf(stderr,"Eiconctrl Utility Version 2.3 (c) 2000 Cytronics & Melware\n");
fprintf(stderr,"usage: %s add <DriverID> <membase> <irq> (add card)\n",cmd);
fprintf(stderr," or: %s [-d <DriverID>] membase [membase-addr] (get/set memaddr)\n",cmd);
fprintf(stderr," or: %s [-d <DriverID>] irq [irq-nr] (get/set irq)\n",cmd);
@ -239,7 +243,7 @@ void eiconctrl_usage() {
fprintf(stderr," : -o allow disordered info elements\n");
fprintf(stderr," : -z switch to loopback mode\n");
#ifndef HAVE_NPCI
fprintf(stderr,"Please use '%s divaload -h' for divaload options.\n", cmd);
fprintf(stderr,"Please use 'divaload' for DIVA Server options.\n");
#endif
exit(-1);
}
@ -1013,7 +1017,7 @@ void eicon_manage_draw(void)
(man_ent[i].status &0x02) ? 'e' : '-',
(man_ent[i].status &0x04) ? 'p' : '-');
}
sprintf(MLine, "%-17s %s %-55s",
sprintf(MLine, "%-17s %s %-56s",
man_ent[i].Name,
AttSt,
man_ent[i].Var);
@ -1139,6 +1143,12 @@ void eicon_management(void)
case 27:
case 'q':
case 'Q':
move(22,0);
refresh();
endwin();
close(fd);
exit(0);
break;
case KEY_UP:
if (h_line) {
@ -2211,7 +2221,7 @@ int main(int argc, char **argv) {
endwin();
close(fd);
return 0;
exit(0);
}
fprintf(stderr, "unknown command\n");

View File

@ -1,12 +1,12 @@
.\" $Id: eiconctrl.man.in,v 1.11 2000/07/08 14:18:52 armin Exp $
.\" $Id: eiconctrl.man.in,v 1.12 2000/12/02 21:39:42 armin Exp $
.\"
.\" CHECKIN $Date: 2000/07/08 14:18:52 $
.\" CHECKIN $Date: 2000/12/02 21:39:42 $
.\"
.\" Process this file with
.\" groff -man -Tascii eiconctrl.1 for ASCII output, or
.\" groff -man -Tps eiconctrl.1 for PostScript output
.\"
.TH EICONCTRL 8 "@MANDATE@" eiconctrl-V2.2 "Linux System Administration"
.TH EICONCTRL 8 "@MANDATE@" eiconctrl-V2.3 "Linux System Administration"
.SH NAME
eiconctrl \- configure Eicon active ISDN card
.SH SYNOPSIS
@ -146,6 +146,8 @@ automatically.
.TP
.BI "PRI"
When using PRI-PtP set -n -S2
.br
Use option -x to set NT mode.
.TP

Binary file not shown.