2003-05-16 Marcel Telka <marcel@telka.sk>

* include/part.h (part_print): New function declaration.
	* src/part/part.c: Marked all user visible messages for translation.
	(part_print): New function.
	(parts_print): Simplified. Added part_print() call.
	* po/POTFILES.in: Added src/part/part.c.

	* src/Makefile.am (jtag_DEPENDENCIES): Added flash/libflash.a.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@431 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 22 years ago
parent 8a0331a848
commit d126c4c797

@ -1,3 +1,13 @@
2003-05-16 Marcel Telka <marcel@telka.sk>
* include/part.h (part_print): New function declaration.
* src/part/part.c: Marked all user visible messages for translation.
(part_print): New function.
(parts_print): Simplified. Added part_print() call.
* po/POTFILES.in: Added src/part/part.c.
* src/Makefile.am (jtag_DEPENDENCIES): Added flash/libflash.a.
2003-05-15 Marcel Telka <marcel@telka.sk>
* include/cfi.h (detect_cfi): Added new parameter `adr'.

@ -59,6 +59,7 @@ data_register *part_find_data_register( part_t *p, const char *drname );
void part_set_instruction( part_t *p, const char *iname );
void part_set_signal( part_t *p, const char *pname, int out, int val );
int part_get_signal( part_t *p, const char *pname );
void part_print( part_t *p );
typedef struct parts parts_t;

@ -2,6 +2,7 @@
src/help.c
src/jtag.c
src/part/part.c
src/tap/chain.c
src/tap/parport/direct.c
src/tap/parport/ppdev.c

@ -44,7 +44,7 @@ jtag_SOURCES = \
bsdl2jtag_SOURCES = \
bsdl2jtag.c
jtag_DEPENDENCIES = lib/libjtaglib.a tap/libtap.a part/libpart.a bus/libbus.a
jtag_DEPENDENCIES = lib/libjtaglib.a tap/libtap.a part/libpart.a bus/libbus.a flash/libflash.a
jtag_LDADD = -Ltap -ltap -Lpart -lpart -Llib -ljtaglib -Lbus -lbus -Lflash -lflash @LIBINTL@

@ -22,6 +22,15 @@
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gettext.h"
#define _(s) gettext(s)
#define N_(s) gettext_noop(s)
#define P_(s,p,n) ngettext(s,p,n)
#include <stdlib.h>
#include <string.h>
@ -137,7 +146,7 @@ part_set_signal( part_t *p, const char *pname, int out, int val )
/* search for Boundary Scan Register */
data_register *bsr = part_find_data_register( p, "BSR" );
if (!bsr) {
printf( "%s(%s:%d) Boundary Scan Register (BSR) not found\n", __FUNCTION__, __FILE__, __LINE__ );
printf( _("%s(%s:%d) Boundary Scan Register (BSR) not found\n"), __FUNCTION__, __FILE__, __LINE__ );
return;
}
@ -150,7 +159,7 @@ part_set_signal( part_t *p, const char *pname, int out, int val )
}
if (!s) {
printf( "signal %s not found\n", pname );
printf( _("signal %s not found\n"), pname );
return;
}
@ -158,7 +167,7 @@ part_set_signal( part_t *p, const char *pname, int out, int val )
if (out) {
int control;
if (!s->output) {
printf( "signal %s cannot be set as output\n", pname );
printf( _("signal %s cannot be set as output\n"), pname );
return;
}
bsr->in->data[s->output->bit] = val & 1;
@ -168,7 +177,7 @@ part_set_signal( part_t *p, const char *pname, int out, int val )
bsr->in->data[control] = p->bsbits[s->output->bit]->control_value ^ 1;
} else {
if (!s->input) {
printf( "signal %s cannot be set as input\n", pname );
printf( _("signal %s cannot be set as input\n"), pname );
return;
}
if (s->output)
@ -184,7 +193,7 @@ part_get_signal( part_t *p, const char *pname )
/* search for Boundary Scan Register */
data_register *bsr = part_find_data_register( p, "BSR" );
if (!bsr) {
printf( "%s(%s:%d) Boundary Scan Register (BSR) not found\n", __FUNCTION__, __FILE__, __LINE__ );
printf( _("%s(%s:%d) Boundary Scan Register (BSR) not found\n"), __FUNCTION__, __FILE__, __LINE__ );
return -1;
}
@ -197,18 +206,41 @@ part_get_signal( part_t *p, const char *pname )
}
if (!s) {
printf( "signal %s not found\n", pname );
printf( _("signal %s not found\n"), pname );
return -1;
}
if (!s->input) {
printf( "signal %s is not input signal\n", pname );
printf( _("signal %s is not input signal\n"), pname );
return -1;
}
return bsr->out->data[s->input->bit];
}
void
part_print( part_t *p )
{
char *instruction;
char *dr;
char format[100];
if (!p)
return;
snprintf( format, 100, _("%%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING,
MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER );
if (p->active_instruction) {
instruction = p->active_instruction->name;
dr = p->active_instruction->data_register->name;
} else {
instruction = _("(none)");
dr = _("(none)");
}
printf( format, p->manufacturer, p->part, p->stepping, instruction, dr );
}
/* parts */
parts_t *
@ -268,13 +300,12 @@ parts_print( parts_t *ps, int header )
int i;
char format[100];
snprintf( format, 100, " %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds \n", MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING,
snprintf( format, 100, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING,
MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER );
if (header) {
printf( " No." );
printf( format, "Manufacturer", "Part", "Stepping", "Instruction", "Register" );
for (i = 0; i < 10 + MAXLEN_MANUFACTURER + MAXLEN_PART + MAXLEN_STEPPING + MAXLEN_INSTRUCTION + MAXLEN_DATA_REGISTER; i++ )
printf( format, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") );
for (i = 0; i < strlen( format ) + 1; i++ )
putchar( '-' );
putchar( '\n' );
}
@ -283,15 +314,12 @@ parts_print( parts_t *ps, int header )
return;
for (i = 0; i < ps->len; i++) {
char *instruction = "(none)";
char *dr = "(none)";
part_t *p = ps->parts[i];
if (p->active_instruction) {
instruction = p->active_instruction->name;
dr = p->active_instruction->data_register->name;
}
printf( " %3d", i );
printf( format, p->manufacturer, p->part, p->stepping, instruction, dr );
if (!p)
continue;
printf( _(" %3d "), i );
part_print( p );
}
}

Loading…
Cancel
Save