2003-08-13 Marcel Telka <marcel@telka.sk>
* include/part.h (struct part): Added new member 'id'. (part_alloc): Added new parameter 'id'. * src/detect.c (detect_parts): Added execution JTAG declarations as script. * src/jtag.c (get_token): Added support for in-line comments. * src/cmd/Makefile.am (libcmd_a_SOURCES): Added signal.c, bit.c, and register.c. * src/cmd/bit.c: New file. * src/cmd/register.c: Ditto. * src/cmd/signal.c: Ditto. * src/cmd/cmd.c (cmds): Added cmd_signal, cmd_bit, and cmd_register. * src/cmd/instruction.c (cmd_instruction_run, cmd_instruction_help, cmd_instruction): Added support for new instruction declaration. * src/part/parse.c: File removed. * src/part/Makefile.am (libpart_a_SOURCES): Removed parse.c. * src/cmd/detect.c (cmd_detect_run): Fixed possible NULL pointer dereference. * src/part/part.c (part_alloc): Added new parameter 'id'. (part_free): Addedd id deallocation. (part_print): Added support for instructions without data register. * src/tap/chain.c (chain_shift_data_registers): Ditto. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@506 b68d4a1b-bc3d-0410-92ed-d4ac073336b7master
parent
d9c1bee3af
commit
05d3c24f64
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* 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 the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_bit_run( char *params[] )
|
||||
{
|
||||
part_t *part;
|
||||
data_register *bsr;
|
||||
unsigned int bit;
|
||||
int type;
|
||||
int safe;
|
||||
unsigned int control;
|
||||
|
||||
if ((cmd_params( params ) != 5) && (cmd_params( params ) != 8))
|
||||
return -1;
|
||||
|
||||
|
||||
if (!cmd_test_cable())
|
||||
return 1;
|
||||
|
||||
if (!chain->parts) {
|
||||
printf( _("Run \"detect\" first.\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (chain->active_part >= chain->parts->len) {
|
||||
printf( _("%s: no active part\n"), "bit" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
part = chain->parts->parts[chain->active_part];
|
||||
bsr = part_find_data_register( part, "BSR" );
|
||||
if (bsr == NULL) {
|
||||
printf( _("missing Boundary Scan Register (BSR)\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* bit number */
|
||||
if (cmd_get_number( params[1], &bit ))
|
||||
return -1;
|
||||
|
||||
if (bit >= bsr->in->len) {
|
||||
printf( _("invalid boundary bit number\n") );
|
||||
return 1;
|
||||
}
|
||||
if (part->bsbits[bit] != NULL) {
|
||||
printf( _("duplicate bit declaration\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* bit type */
|
||||
if (strlen( params[2] ) != 1)
|
||||
return -1;
|
||||
switch (params[2][0]) {
|
||||
case 'I':
|
||||
type = BSBIT_INPUT;
|
||||
break;
|
||||
case 'O':
|
||||
type = BSBIT_OUTPUT;
|
||||
break;
|
||||
case 'B':
|
||||
type = BSBIT_BIDIR;
|
||||
break;
|
||||
case 'C':
|
||||
type = BSBIT_CONTROL;
|
||||
break;
|
||||
case 'X':
|
||||
type = BSBIT_INTERNAL;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* default (safe) value */
|
||||
if (strlen( params[3] ) != 1)
|
||||
return -1;
|
||||
|
||||
safe = (params[3][0] == '1') ? 1 : 0;
|
||||
bsr->in->data[bit] = safe;
|
||||
|
||||
/* allocate bsbit */
|
||||
part->bsbits[bit] = bsbit_alloc( bit, params[4], type, part->signals, safe );
|
||||
if (part->bsbits[bit] == NULL) {
|
||||
printf( _("out of memory\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* test for control bit */
|
||||
if (cmd_params( params ) == 5)
|
||||
return 1;
|
||||
|
||||
/* control bit number */
|
||||
if (cmd_get_number( params[5], &control ))
|
||||
return -1;
|
||||
if (control >= bsr->in->len) {
|
||||
printf( _("invalid control bit number\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* control value */
|
||||
if (strlen( params[6] ) != 1)
|
||||
return -1;
|
||||
part->bsbits[bit]->control_value = (params[6][0] == '1') ? 1 : 0;
|
||||
|
||||
/* control state */
|
||||
if ((strlen( params[7] ) != 1) || (params[7][0] != 'Z'))
|
||||
return -1;
|
||||
part->bsbits[bit]->control_state = BSBIT_STATE_Z;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_bit_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s NUMBER TYPE DEFAULT SIGNAL [CBIT CVAL CSTATE]\n"
|
||||
"Define new BSR (Boundary Scan Register) bit for SIGNAL, with\n"
|
||||
"DEFAULT value.\n"
|
||||
"\n"
|
||||
"NUMBER Bit number in the BSR\n"
|
||||
"TYPE Bit type, valid values are I, O, B, C, and X\n"
|
||||
"DEFAULT Default (safe) bit value, valid values are 1, 0, ?\n"
|
||||
"SIGNAL Associated signal name\n"
|
||||
"CBIT Control bit number\n"
|
||||
"CVAL Control value\n"
|
||||
"CSTATE Control state, valid state is only Z\n"
|
||||
), "bit" );
|
||||
}
|
||||
|
||||
cmd_t cmd_bit = {
|
||||
"bit",
|
||||
N_("define new BSR bit"),
|
||||
cmd_bit_help,
|
||||
cmd_bit_run
|
||||
};
|
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* 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 the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_register_run( char *params[] )
|
||||
{
|
||||
part_t *part;
|
||||
unsigned int len;
|
||||
data_register *dr;
|
||||
|
||||
if (cmd_params( params ) != 3)
|
||||
return -1;
|
||||
|
||||
|
||||
if (!cmd_test_cable())
|
||||
return 1;
|
||||
|
||||
if (!chain->parts) {
|
||||
printf( _("Run \"detect\" first.\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (chain->active_part >= chain->parts->len) {
|
||||
printf( _("%s: no active part\n"), "register" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cmd_get_number( params[2], &len ))
|
||||
return -1;
|
||||
|
||||
part = chain->parts->parts[chain->active_part];
|
||||
|
||||
if (part_find_data_register( part, params[1] ) != NULL) {
|
||||
printf( _("Data register '%s' already defined\n"), params[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
dr = data_register_alloc( params[1], len );
|
||||
if (!dr) {
|
||||
printf( _("out of memory\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
dr->next = part->data_registers;
|
||||
part->data_registers = dr;
|
||||
|
||||
/* Boundary Scan Register */
|
||||
if (strcmp( dr->name, "BSR" ) == 0) {
|
||||
int i;
|
||||
|
||||
part->boundary_length = len;
|
||||
part->bsbits = malloc( part->boundary_length * sizeof *part->bsbits );
|
||||
if (!part->bsbits) {
|
||||
printf( _("out of memory\n") );
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < part->boundary_length; i++)
|
||||
part->bsbits[i] = NULL;
|
||||
}
|
||||
|
||||
/* Device Identification Register */
|
||||
if (strcmp( dr->name, "DIR" ) == 0)
|
||||
register_init( dr->out, register_get_string( part->id ) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_register_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s NAME LENGTH\n"
|
||||
"Define new data register with specified NAME and LENGTH.\n"
|
||||
"\n"
|
||||
"NAME Data register name\n"
|
||||
"LENGTH Data register length\n"
|
||||
), "register" );
|
||||
}
|
||||
|
||||
cmd_t cmd_register = {
|
||||
"register",
|
||||
N_("define new data register for a part"),
|
||||
cmd_register_help,
|
||||
cmd_register_run
|
||||
};
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* 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 the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_signal_run( char *params[] )
|
||||
{
|
||||
part_t *part;
|
||||
signal_t *s;
|
||||
|
||||
if (cmd_params( params ) < 2)
|
||||
return -1;
|
||||
|
||||
|
||||
if (!cmd_test_cable())
|
||||
return 1;
|
||||
|
||||
if (!chain->parts) {
|
||||
printf( _("Run \"detect\" first.\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (chain->active_part >= chain->parts->len) {
|
||||
printf( _("%s: no active part\n"), "signal" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
part = chain->parts->parts[chain->active_part];
|
||||
if (part_find_signal( part, params[1] ) != NULL) {
|
||||
printf( _("Signal '%s' already defined\n"), params[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = signal_alloc( params[1] );
|
||||
if (!s) {
|
||||
printf( _("out of memory\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
s->next = part->signals;
|
||||
part->signals = s;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_signal_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s SIGNAL [PINLIST...]\n"
|
||||
"Define new signal with name SIGNAL for a part.\n"
|
||||
"\n"
|
||||
"SIGNAL New signal name\n"
|
||||
"PINLIST List of pins for a signal (not used)\n"
|
||||
), "signal" );
|
||||
}
|
||||
|
||||
cmd_t cmd_signal = {
|
||||
"signal",
|
||||
N_("define new signal for a part"),
|
||||
cmd_signal_help,
|
||||
cmd_signal_run
|
||||
};
|
@ -1,331 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 ETC s.r.o.
|
||||
*
|
||||
* 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 the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2002.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "part.h"
|
||||
#include "register.h"
|
||||
|
||||
static char *
|
||||
get_token( char *buf )
|
||||
{
|
||||
char *t = strtok( buf, " \f\n\r\t\v" );
|
||||
if (t && (*t == '#'))
|
||||
return NULL;
|
||||
return t;
|
||||
}
|
||||
|
||||
part_t *
|
||||
read_part( FILE *f, tap_register *idr )
|
||||
{
|
||||
int line = 0;
|
||||
part_t *part;
|
||||
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
part = part_alloc();
|
||||
if (!part) {
|
||||
printf( _("Out of memory\n") );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
char *t;
|
||||
char buf[1024];
|
||||
|
||||
if (fgets( buf, 1024, f ) == NULL)
|
||||
break;
|
||||
|
||||
line++;
|
||||
|
||||
t = get_token( buf );
|
||||
if (!t)
|
||||
continue;
|
||||
|
||||
/* signal */
|
||||
if (strcmp( t, "pin" ) == 0 || strcmp( t, "signal" ) == 0) {
|
||||
signal_t *s;
|
||||
|
||||
t = get_token( NULL );
|
||||
if (!t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
s = signal_alloc( t );
|
||||
if (!s) {
|
||||
printf( _("(%d) out of memory\n"), line );
|
||||
continue;
|
||||
}
|
||||
s->next = part->signals;
|
||||
part->signals = s;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* register */
|
||||
if (strcmp( t, "register" ) == 0) {
|
||||
char *n = get_token( NULL ); /* register name */
|
||||
int l;
|
||||
data_register *dr;
|
||||
|
||||
t = get_token( NULL ); /* register length */
|
||||
if (!n || !t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
l = strtol( t, &t, 10 );
|
||||
if ((t && *t) || (l < 1)) {
|
||||
printf( _("(%d) invalid register length\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
dr = data_register_alloc( n, l );
|
||||
if (!dr) {
|
||||
printf( _("(%d) out of memory\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
t = get_token( NULL );
|
||||
if (t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
dr->next = part->data_registers;
|
||||
part->data_registers = dr;
|
||||
|
||||
/* Boundary Scan Register */
|
||||
if (strcmp( dr->name, "BSR" ) == 0) {
|
||||
int i;
|
||||
|
||||
part->boundary_length = l;
|
||||
part->bsbits = malloc( part->boundary_length * sizeof *part->bsbits );
|
||||
if (!part->bsbits) {
|
||||
printf( _("(%d) out of memory\n"), line );
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i < part->boundary_length; i++)
|
||||
part->bsbits[i] = NULL;
|
||||
}
|
||||
|
||||
/* Device Identification Register */
|
||||
if (strcmp( dr->name, "DIR" ) == 0)
|
||||
register_init( dr->out, register_get_string( idr ) );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* instruction */
|
||||
if (strcmp( t, "instruction" ) == 0) {
|
||||
t = get_token( NULL ); /* 'length' or instruction name */
|
||||
if (!t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
/* we need 'length' first */
|
||||
if ((strcmp( t, "length" ) != 0) && (part->instruction_length == 0)) {
|
||||
printf( _("(%d) instruction length missing\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp( t, "length" ) == 0) {
|
||||
t = get_token( NULL );
|
||||
if (!t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
part->instruction_length = strtol( t, &t, 10 );
|
||||
if ((t && *t) || (part->instruction_length < 1)) {
|
||||
printf( _("(%d) invalid instruction length\n"), line );
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
char *n = t; /* save instruction name */
|
||||
instruction *i;
|
||||
|
||||
t = get_token( NULL ); /* instruction bits */
|
||||
if (!t || (strlen( t ) != part->instruction_length)) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
i = instruction_alloc( n, part->instruction_length, t );
|
||||
if (!i) {
|
||||
printf( _("(%d) out of memory\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
i->next = part->instructions;
|
||||
part->instructions = i;
|
||||
|
||||
t = get_token( NULL ); /* data register */
|
||||
if (!t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
i->data_register = part_find_data_register( part, t );
|
||||
if (!i->data_register) {
|
||||
printf( _("(%d) unknown data register\n"), line );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
t = get_token( NULL );
|
||||
if (t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* bit */
|
||||
if (strcmp( t, "bit" ) == 0) {
|
||||
int bit;
|
||||
int type;
|
||||
int safe;
|
||||
data_register *bsr = part_find_data_register( part, "BSR" );
|
||||
|
||||
if (!bsr) {
|
||||
printf( _("(%d) missing Boundary Scan Register (BSR)\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get bit number */
|
||||
t = get_token( NULL );
|
||||
bit = strtol( t, &t, 10 );
|
||||
if ((t && *t) || (bit < 0) || (bit >= bsr->in->len)) {
|
||||
printf( _("(%d) invalid boundary bit number\n"), line );
|
||||
continue;
|
||||
}
|
||||
if (part->bsbits[bit]) {
|
||||
printf( _("(%d) duplicate bit declaration\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get bit type */
|
||||
t = get_token( NULL );
|
||||
if (!t || (strlen( t ) != 1)) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
switch (*t) {
|
||||
case 'I':
|
||||
type = BSBIT_INPUT;
|
||||
break;
|
||||
case 'O':
|
||||
type = BSBIT_OUTPUT;
|
||||
break;
|
||||
case 'B':
|
||||
type = BSBIT_BIDIR;
|
||||
break;
|
||||
case 'C':
|
||||
type = BSBIT_CONTROL;
|
||||
break;
|
||||
case 'X':
|
||||
type = BSBIT_INTERNAL;
|
||||
break;
|
||||
default:
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get safe value */
|
||||
t = get_token( NULL );
|
||||
if (!t || (strlen( t ) != 1)) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
safe = (*t == '1') ? 1 : 0;
|
||||
bsr->in->data[bit] = safe;
|
||||
|
||||
/* get bit name */
|
||||
t = get_token( NULL );
|
||||
if (!t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* allocate bsbit */
|
||||
part->bsbits[bit] = bsbit_alloc( bit, t, type, part->signals, safe );
|
||||
if (!part->bsbits[bit]) {
|
||||
printf( _("(%d) out of memory\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* we have control bit? */
|
||||
t = get_token( NULL );
|
||||
if (t) {
|
||||
int control;
|
||||
|
||||
control = strtol( t, &t, 10 );
|
||||
if ((t && *t) || (control < 0)) {
|
||||
printf( _("(%d) invalid control bit number\n"), line );
|
||||
continue;
|
||||
}
|
||||
part->bsbits[bit]->control = control;
|
||||
|
||||
/* control value */
|
||||
t = get_token( NULL );
|
||||
if (!t || (strlen( t ) != 1)) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
part->bsbits[bit]->control_value = (*t == '1') ? 1 : 0;
|
||||
|
||||
/* control state */
|
||||
t = get_token( NULL );
|
||||
if (!t || (strlen( t ) != 1)) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
if (*t != 'Z') {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
part->bsbits[bit]->control_state = BSBIT_STATE_Z;
|
||||
|
||||
t = get_token( NULL );
|
||||
if (t) {
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
printf( _("(%d) parse error\n"), line );
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
Loading…
Reference in New Issue