|
From: kc8apf at B. <kc...@ma...> - 2009-05-21 06:39:46
|
Author: kc8apf
Date: 2009-05-21 06:39:41 +0200 (Thu, 21 May 2009)
New Revision: 1860
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
Author: Michael Bruck <mb...@di...>
- add 'const' qualifier to function parameters in jtag.c that are not to be modified or freed by the function
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-05-21 04:37:31 UTC (rev 1859)
+++ trunk/src/jtag/jtag.c 2009-05-21 04:39:41 UTC (rev 1860)
@@ -37,7 +37,7 @@
int jtag_flush_queue_count; /* count # of flushes for profiling / debugging purposes */
-static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state),
+static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
int in_num_fields, scan_field_t *in_fields, tap_state_t state);
/* note that this is not marked as static as it must be available from outside jtag.c for those
@@ -554,7 +554,7 @@
cmd_queue_cur_state = cmd_queue_end_state;
}
-void jtag_add_ir_scan_noverify(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+void jtag_add_ir_scan_noverify(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
int retval;
jtag_prelude(state);
@@ -602,7 +602,7 @@
* see jtag_add_ir_scan()
*
*/
-int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
jtag_tap_t *tap;
int nth_tap;
@@ -677,7 +677,7 @@
* This function assumes that the caller handles extra fields for bypassed TAPs
*
*/
-void jtag_add_plain_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
int retval;
@@ -693,7 +693,7 @@
* see jtag_add_plain_ir_scan()
*
*/
-int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
@@ -731,7 +731,7 @@
return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3);
}
-static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state),
+static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
int in_num_fields, scan_field_t *in_fields, tap_state_t state)
{
for (int i = 0; i < in_num_fields; i++)
@@ -802,7 +802,7 @@
* The bypass status of TAPs is set by jtag_add_ir_scan().
*
*/
-void jtag_add_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
int retval;
@@ -818,7 +818,7 @@
* see jtag_add_dr_scan()
*
*/
-int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
int j;
int nth_tap;
@@ -1020,7 +1020,7 @@
* This function assumes that the caller handles extra fields for bypassed TAPs
*
*/
-void jtag_add_plain_dr_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
int retval;
@@ -1036,7 +1036,7 @@
* see jtag_add_plain_dr_scan()
*
*/
-int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
{
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
@@ -1092,7 +1092,7 @@
return ERROR_OK;
}
-void jtag_add_pathmove(int num_states, tap_state_t *path)
+void jtag_add_pathmove(int num_states, const tap_state_t *path)
{
tap_state_t cur_state = cmd_queue_cur_state;
int i;
@@ -1130,7 +1130,7 @@
jtag_error=retval;
}
-int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, tap_state_t *path)
+int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, const tap_state_t *path)
{
/* allocate memory for a new list member */
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
@@ -1367,7 +1367,7 @@
return;
}
-int jtag_scan_size(scan_command_t *cmd)
+int jtag_scan_size(const scan_command_t *cmd)
{
int bit_count = 0;
int i;
@@ -1381,7 +1381,7 @@
return bit_count;
}
-int jtag_build_buffer(scan_command_t *cmd, u8 **buffer)
+int jtag_build_buffer(const scan_command_t *cmd, u8 **buffer)
{
int bit_count = 0;
int i;
@@ -1425,7 +1425,7 @@
return bit_count;
}
-int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
+int jtag_read_buffer(u8 *buffer, const scan_command_t *cmd)
{
int i;
int bit_count = 0;
@@ -1463,7 +1463,7 @@
return retval;
}
-static const char *jtag_tap_name(jtag_tap_t *tap)
+static const char *jtag_tap_name(const jtag_tap_t *tap)
{
return (tap == NULL) ? "(unknown)" : tap->dotted_name;
}
@@ -1535,7 +1535,7 @@
-enum scan_type jtag_scan_type(scan_command_t *cmd)
+enum scan_type jtag_scan_type(const scan_command_t *cmd)
{
int i;
int type = 0;
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-05-21 04:37:31 UTC (rev 1859)
+++ trunk/src/jtag/jtag.h 2009-05-21 04:39:41 UTC (rev 1860)
@@ -561,9 +561,9 @@
*/
extern void jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
/* same as jtag_add_ir_scan except no verify is performed */
-extern void jtag_add_ir_scan_noverify(int num_fields, scan_field_t *fields, tap_state_t state);
-extern int interface_jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern void jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_ir_scan_noverify(int num_fields, const scan_field_t *fields, tap_state_t state);
+extern int interface_jtag_add_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
/* set in_value to point to 32 bits of memory to scan into. This function
* is a way to handle the case of synchronous and asynchronous
@@ -587,11 +587,11 @@
/* This version of jtag_add_dr_scan() uses the check_value/mask fields */
extern void jtag_add_dr_scan_check(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern int interface_jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern void jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern void jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
-extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
+extern int interface_jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
/* Simplest/typical callback - do some conversion on the data clocked in.
@@ -705,8 +705,8 @@
* a partial implementation of pathmove would have little practical
* application.
*/
-extern void jtag_add_pathmove(int num_states, tap_state_t* path);
-extern int interface_jtag_add_pathmove(int num_states, tap_state_t* path);
+extern void jtag_add_pathmove(int num_states, const tap_state_t* path);
+extern int interface_jtag_add_pathmove(int num_states, const tap_state_t* path);
/* go to TAP_IDLE, if we're not already there and cycle
* precisely num_cycles in the TAP_IDLE after which move
@@ -824,10 +824,10 @@
/* execute jtag queue and check value and use mask if mask is != NULL. invokes
* jtag_set_error() with any error. */
extern void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask);
-extern enum scan_type jtag_scan_type(scan_command_t* cmd);
-extern int jtag_scan_size(scan_command_t* cmd);
-extern int jtag_read_buffer(u8* buffer, scan_command_t* cmd);
-extern int jtag_build_buffer(scan_command_t* cmd, u8** buffer);
+extern enum scan_type jtag_scan_type(const scan_command_t* cmd);
+extern int jtag_scan_size(const scan_command_t* cmd);
+extern int jtag_read_buffer(u8* buffer, const scan_command_t* cmd);
+extern int jtag_build_buffer(const scan_command_t* cmd, u8** buffer);
extern void jtag_sleep(u32 us);
extern int jtag_call_event_callbacks(enum jtag_event event);
|