You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Zach W. <zw...@us...> - 2009-11-15 04:06:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c2edc7908fc68594761be3bd390aa6bb5335da60 (commit) from ecc659d44da1c8d2291c22be61d2819b55fa7b17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c2edc7908fc68594761be3bd390aa6bb5335da60 Author: Krzysztof Dziuba <krz...@ga...> Date: Sat Nov 14 20:59:56 2009 +0100 Fix for md* commands, similar to mw*. diff --git a/src/target/target.c b/src/target/target.c index 6ecf16a..2385d0f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2256,7 +2256,8 @@ COMMAND_HANDLER(handle_md_command) return ERROR_COMMAND_SYNTAX_ERROR; unsigned size = 0; - switch (CMD_NAME[2]) { + const char *cmd_name = CMD_NAME; + switch (cmd_name[6]) { case 'w': size = 4; break; case 'h': size = 2; break; case 'b': size = 1; break; ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-15 03:24:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via a502676df7e6e99c29f207003ec02a128012d325 (commit) via bc07ee82fbeb05a93f91d077d0628d4e369c5aeb (commit) via 4d4b2958a5fdf0dfa0f8199535ccd9bd4e66d4af (commit) from c2edc7908fc68594761be3bd390aa6bb5335da60 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a502676df7e6e99c29f207003ec02a128012d325 Author: Zachary T Welch <zw...@su...> Date: Sat Nov 14 06:48:30 2009 -0800 remove unused arm_jtag_buf_to_* helpers Removes unused arm_jtag_buf_* helpers from arm_jtag.[ch]. These could reappear if patches are provided to conver the tree to use them, but this code should not be in the master tree until that series is ready. diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c index 54316b7..af626ec 100644 --- a/src/target/arm_jtag.c +++ b/src/target/arm_jtag.c @@ -114,92 +114,3 @@ int arm_jtag_setup_connection(struct arm_jtag *jtag_info) return jtag_register_event_callback(arm_jtag_reset_callback, jtag_info); } - -/* read JTAG buffer into host-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - uint32_t *dest = priv; - *dest = flip_u32(le_to_h_u32(in_buf), 32); - return ERROR_OK; -} - -/* read JTAG buffer into little-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u32_to_le(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32)); - return ERROR_OK; -} - -/* read JTAG buffer into little-endian uint16_t, flipping bit-order */ -int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u16_to_le(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); - return ERROR_OK; -} - -/* read JTAG buffer into big-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u32_to_be(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32)); - return ERROR_OK; -} - -/* read JTAG buffer into big-endian uint16_t, flipping bit-order */ -int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u16_to_be(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); - return ERROR_OK; -} - -/* read JTAG buffer into uint8_t, flipping bit-order */ -int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - uint8_t *dest = priv; - *dest = flip_u32(le_to_h_u32(in_buf), 32) & 0xff; - return ERROR_OK; -} - -/* not-flipping variants */ -/* read JTAG buffer into host-endian uint32_t */ -int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - uint32_t *dest = priv; - *dest = le_to_h_u32(in_buf); - return ERROR_OK; -} - -/* read JTAG buffer into little-endian uint32_t */ -int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u32_to_le(((uint8_t*)priv), le_to_h_u32(in_buf)); - return ERROR_OK; -} - -/* read JTAG buffer into little-endian uint16_t */ -int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u16_to_le(((uint8_t*)priv), le_to_h_u32(in_buf) & 0xffff); - return ERROR_OK; -} - -/* read JTAG buffer into big-endian uint32_t */ -int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u32_to_be(((uint8_t*)priv), le_to_h_u32(in_buf)); - return ERROR_OK; -} - -/* read JTAG buffer into big-endian uint16_t */ -int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - h_u16_to_be(((uint8_t*)priv), le_to_h_u32(in_buf) & 0xffff); - return ERROR_OK; -} - -/* read JTAG buffer into uint8_t */ -int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - uint8_t *dest = priv; - *dest = le_to_h_u32(in_buf) & 0xff; - return ERROR_OK; -} diff --git a/src/target/arm_jtag.h b/src/target/arm_jtag.h index 46122e4..d9e7f2a 100644 --- a/src/target/arm_jtag.h +++ b/src/target/arm_jtag.h @@ -41,23 +41,6 @@ int arm_jtag_set_instr(struct arm_jtag *jtag_info, int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain); int arm_jtag_setup_connection(struct arm_jtag *jtag_info); -/* JTAG buffers to host, be and le buffers, flipping variants */ -int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field *field); - -/* JTAG buffers to host, be and le buffers */ -int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field *field); -int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field *field); - - /* use this as a static so we can inline it in -O3 and refer to it via a pointer */ static __inline__ void arm7flip32(jtag_callback_data_t arg) { commit bc07ee82fbeb05a93f91d077d0628d4e369c5aeb Author: Zachary T Welch <zw...@su...> Date: Sat Nov 14 06:41:58 2009 -0800 remove unused buf_to_u32_handler Purge an unused routine from the tree and remove a layering violation. If this code is needed, it should reappear somwhere in src/jtag/, where struct scan_field gets defined. diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index e0e7ac1..fdfcf71 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -327,12 +327,3 @@ int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radi return i; } - -int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field *field) -{ - uint32_t *dest = priv; - - *dest = buf_get_u32(in_buf, 0, 32); - - return ERROR_OK; -} diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index d7c887e..2399a6e 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -90,9 +90,6 @@ int str_to_buf(const char *str, int len, uint8_t *bin_buf, int buf_size, int radix); char* buf_to_str(const uint8_t *buf, int size, int radix); -struct scan_field; -int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field *field); - #define CEIL(m, n) (((m) + (n) - 1) / (n)) /* read a uint32_t from a buffer in target memory endianness */ commit 4d4b2958a5fdf0dfa0f8199535ccd9bd4e66d4af Author: Zachary T Welch <zw...@su...> Date: Sat Nov 14 06:30:02 2009 -0800 struct scan_field_s -> struct scan_field Remove obsolete suffix from struct scan_field. Somehow, these definitions did not get updated but did not cause any errors. diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 4b5dfe8..e0e7ac1 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -328,7 +328,7 @@ int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radi return i; } -int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field *field) { uint32_t *dest = priv; diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 5017a35..d7c887e 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -90,8 +90,8 @@ int str_to_buf(const char *str, int len, uint8_t *bin_buf, int buf_size, int radix); char* buf_to_str(const uint8_t *buf, int size, int radix); -struct scan_field_s; -int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field); +struct scan_field; +int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field *field); #define CEIL(m, n) (((m) + (n) - 1) / (n)) diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c index e7dbea4..54316b7 100644 --- a/src/target/arm_jtag.c +++ b/src/target/arm_jtag.c @@ -116,7 +116,7 @@ int arm_jtag_setup_connection(struct arm_jtag *jtag_info) } /* read JTAG buffer into host-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { uint32_t *dest = priv; *dest = flip_u32(le_to_h_u32(in_buf), 32); @@ -124,35 +124,35 @@ int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *f } /* read JTAG buffer into little-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u32_to_le(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32)); return ERROR_OK; } /* read JTAG buffer into little-endian uint16_t, flipping bit-order */ -int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u16_to_le(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); return ERROR_OK; } /* read JTAG buffer into big-endian uint32_t, flipping bit-order */ -int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u32_to_be(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32)); return ERROR_OK; } /* read JTAG buffer into big-endian uint16_t, flipping bit-order */ -int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u16_to_be(((uint8_t*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); return ERROR_OK; } /* read JTAG buffer into uint8_t, flipping bit-order */ -int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field *field) { uint8_t *dest = priv; *dest = flip_u32(le_to_h_u32(in_buf), 32) & 0xff; @@ -161,7 +161,7 @@ int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field_s *fie /* not-flipping variants */ /* read JTAG buffer into host-endian uint32_t */ -int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field *field) { uint32_t *dest = priv; *dest = le_to_h_u32(in_buf); @@ -169,35 +169,35 @@ int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field_s *field) } /* read JTAG buffer into little-endian uint32_t */ -int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u32_to_le(((uint8_t*)priv), le_to_h_u32(in_buf)); return ERROR_OK; } /* read JTAG buffer into little-endian uint16_t */ -int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u16_to_le(((uint8_t*)priv), le_to_h_u32(in_buf) & 0xffff); return ERROR_OK; } /* read JTAG buffer into big-endian uint32_t */ -int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u32_to_be(((uint8_t*)priv), le_to_h_u32(in_buf)); return ERROR_OK; } /* read JTAG buffer into big-endian uint16_t */ -int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field *field) { h_u16_to_be(((uint8_t*)priv), le_to_h_u32(in_buf) & 0xffff); return ERROR_OK; } /* read JTAG buffer into uint8_t */ -int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field_s *field) +int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field *field) { uint8_t *dest = priv; *dest = le_to_h_u32(in_buf) & 0xff; diff --git a/src/target/arm_jtag.h b/src/target/arm_jtag.h index b1905a3..46122e4 100644 --- a/src/target/arm_jtag.h +++ b/src/target/arm_jtag.h @@ -42,20 +42,20 @@ int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain); int arm_jtag_setup_connection(struct arm_jtag *jtag_info); /* JTAG buffers to host, be and le buffers, flipping variants */ -int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_le32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_le16_flip(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_be32_flip(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_be16_flip(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_8_flip(uint8_t *in_buf, void *priv, struct scan_field *field); /* JTAG buffers to host, be and le buffers */ -int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field_s *field); -int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_u32(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_le32(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_le16(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_be32(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_be16(uint8_t *in_buf, void *priv, struct scan_field *field); +int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field *field); /* use this as a static so we can inline it in -O3 and refer to it via a pointer */ ----------------------------------------------------------------------- Summary of changes: src/helper/binarybuffer.c | 9 ----- src/helper/binarybuffer.h | 3 -- src/target/arm_jtag.c | 89 --------------------------------------------- src/target/arm_jtag.h | 17 --------- 4 files changed, 0 insertions(+), 118 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 23:58:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ecc659d44da1c8d2291c22be61d2819b55fa7b17 (commit) from dd47bba6f8c50d202ce716173f8f647dd3f77f49 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ecc659d44da1c8d2291c22be61d2819b55fa7b17 Author: David Brownell <dbr...@us...> Date: Sat Nov 14 14:58:14 2009 -0800 lpc2900.h -- remove from Makefile.am too Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/Makefile.am b/src/flash/Makefile.am index e122451..bbcc34c 100644 --- a/src/flash/Makefile.am +++ b/src/flash/Makefile.am @@ -63,7 +63,6 @@ noinst_HEADERS = \ flash.h \ lpc2000.h \ lpc288x.h \ - lpc2900.h \ lpc3180_nand_controller.h \ mflash.h \ mx3_nand.h \ ----------------------------------------------------------------------- Summary of changes: src/flash/Makefile.am | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 23:54:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via dd47bba6f8c50d202ce716173f8f647dd3f77f49 (commit) from 7f48f463a1441c34790b462add2f43b38b44887b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd47bba6f8c50d202ce716173f8f647dd3f77f49 Author: David Brownell <dbr...@us...> Date: Sat Nov 14 14:53:19 2009 -0800 flash: remove needless lpc2900.h header Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 739ac43..556a151 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -24,8 +24,7 @@ #include "image.h" - -#include "lpc2900.h" +#include "flash.h" #include "binarybuffer.h" #include "armv4_5.h" diff --git a/src/flash/lpc2900.h b/src/flash/lpc2900.h deleted file mode 100644 index 7eeec51..0000000 --- a/src/flash/lpc2900.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by * - * Rolf Meeser <rol...@ya...> * - * * - * 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. * - ***************************************************************************/ - -#ifndef lpc2900_H -#define lpc2900_H - -#include "flash.h" - - -#endif /* lpc2900_H */ ----------------------------------------------------------------------- Summary of changes: src/flash/lpc2900.c | 3 +-- src/flash/lpc2900.h | 27 --------------------------- 2 files changed, 1 insertions(+), 29 deletions(-) delete mode 100644 src/flash/lpc2900.h hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 21:43:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 7f48f463a1441c34790b462add2f43b38b44887b (commit) from c93ae60bce40b196cb5594e8e4723f3d567ff22e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7f48f463a1441c34790b462add2f43b38b44887b Author: David Brownell <dbr...@us...> Date: Sat Nov 14 12:42:50 2009 -0800 remove annoying $URL$ startup message It's completely unused; the obnoxious "DANGER!!!" comments don't even explain what it was doing (shorthand SVN magic). Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/openocd.c b/src/openocd.c index 78f220c..234b01c 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -51,21 +51,6 @@ #define OPENOCD_VERSION \ "Open On-Chip Debugger " VERSION RELSTR " (" PKGBLDDATE ")" -static void print_version(void) -{ - /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */ - LOG_OUTPUT("$URL$\n"); - /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */ - /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */ -} - /* Give TELNET a way to find out what version this is */ COMMAND_HANDLER(handle_version_command) { @@ -257,8 +242,6 @@ int openocd_main(int argc, char *argv[]) } #endif - print_version(); - LOG_OUTPUT("For bug reports, read\n\t" "http://openocd.berlios.de/doc/doxygen/bugs.html" "\n"); ----------------------------------------------------------------------- Summary of changes: src/openocd.c | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-14 20:00:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c93ae60bce40b196cb5594e8e4723f3d567ff22e (commit) from 4088b1e622cff0673f2859de5ee611da736bdba7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c93ae60bce40b196cb5594e8e4723f3d567ff22e Author: Dean Glazeski <dn...@gm...> Date: Sat Nov 14 12:39:08 2009 -0600 Invalid command syntax errors with MWW. This fixes an issue due to the new command handler syntax caused by the mw handler playing with the args pointer before using the CMD_NAME macro. Fix is to move this call above the lines changing args. diff --git a/src/target/target.c b/src/target/target.c index cc8d500..6ecf16a 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2308,6 +2308,7 @@ COMMAND_HANDLER(handle_mw_command) bool physical=strcmp(args[0], "phys")==0; int (*fn)(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); + const char *cmd_name = CMD_NAME; if (physical) { argc--; @@ -2333,7 +2334,7 @@ COMMAND_HANDLER(handle_mw_command) struct target *target = get_current_target(cmd_ctx); unsigned wordsize; uint8_t value_buf[4]; - switch (CMD_NAME[2]) + switch (cmd_name[6]) { case 'w': wordsize = 4; ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-14 16:33:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4088b1e622cff0673f2859de5ee611da736bdba7 (commit) from ab3bdfb2cb7b0c16800195951e4ee549cf8e86a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4088b1e622cff0673f2859de5ee611da736bdba7 Author: Zachary T Welch <zw...@su...> Date: Sat Nov 14 07:29:16 2009 -0800 add openocd.h for top-level declarations Create src/openocd.h to hold declarations previously made internally by src/main.c and src/server/server.c. This ensures all functions are verified to be in-sync at compile time (rather than at link), making it easier to track down bugs. diff --git a/src/Makefile.am b/src/Makefile.am index 7721f34..77ae5ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,6 +16,10 @@ libopenocd_la_SOURCES = \ hello.c \ openocd.c +noinst_HEADERS = \ + openocd.h + + # set the include path found by configure AM_CPPFLAGS = \ -I$(top_srcdir)/src \ diff --git a/src/ecosboard.c b/src/ecosboard.c index 38f3252..e38316c 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -36,6 +36,7 @@ #include "server.h" #include "telnet_server.h" #include "gdb_server.h" +#include "openocd.h" #include <time_support.h> #include <sys/time.h> diff --git a/src/main.c b/src/main.c index c2b53da..a71977d 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "openocd.h" /* This is the main entry for developer PC hosted OpenOCD. * @@ -32,8 +33,6 @@ * Those applications will have their own main() implementation * and use bits and pieces from openocd.c. */ -extern int openocd_main(int argc, char *argv[]); - int main(int argc, char *argv[]) { return openocd_main(argc, argv); diff --git a/src/main.c b/src/openocd.h similarity index 65% copy from src/main.c copy to src/openocd.h index c2b53da..1bf6b7e 100644 --- a/src/main.c +++ b/src/openocd.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005 by Dominic Rath * - * Dom...@gm... * + * Copyright (C) 2005 by Dominic Rath <Dom...@gm...> * + * Copyright (C) 2009 by Zachary T Welch <zw...@su...> * * * * 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 * @@ -18,23 +18,22 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef OPENOCD_H +#define OPENOCD_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* This is the main entry for developer PC hosted OpenOCD. - * - * OpenOCD can also be used as a library that is linked with - * another application(not mainstream yet, but possible), e.g. - * w/as an embedded application. - * - * Those applications will have their own main() implementation - * and use bits and pieces from openocd.c. */ +/** + * Different applications can define this entry point to override + * the default openocd main function. On most systems, this will be + * defined in src/openocd.c. + * @param argc normally passed from main() + * @param argv normally passed from main() + * @returns return code for main() + */ +int openocd_main(int argc, char *argv[]); -extern int openocd_main(int argc, char *argv[]); +/// used by the server_loop() function in src/server/server.c +void openocd_sleep_prelude(void); +/// used by the server_loop() function in src/server/server.c +void openocd_sleep_postlude(void); -int main(int argc, char *argv[]) -{ - return openocd_main(argc, argv); -} +#endif diff --git a/src/server/Makefile.am b/src/server/Makefile.am index 2f07007..6e52fdf 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -1,4 +1,5 @@ AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ -I$(top_srcdir)/src/helper \ -I$(top_srcdir)/src/target \ -I$(top_srcdir)/src/flash \ diff --git a/src/server/server.c b/src/server/server.c index 7416784..92292eb 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -29,6 +29,7 @@ #include "server.h" #include "target.h" +#include "openocd.h" #include <signal.h> @@ -285,9 +286,6 @@ int remove_services(void) return ERROR_OK; } -extern void openocd_sleep_prelude(void); -extern void openocd_sleep_postlude(void); - int server_loop(struct command_context *command_context) { struct service *service; ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 4 ++++ src/ecosboard.c | 1 + src/main.c | 3 +-- src/{flash/ocl/at91sam7x/dcc.h => openocd.h} | 26 +++++++++++++++++--------- src/server/Makefile.am | 1 + src/server/server.c | 4 +--- 6 files changed, 25 insertions(+), 14 deletions(-) copy src/{flash/ocl/at91sam7x/dcc.h => openocd.h} (65%) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 11:22:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ab3bdfb2cb7b0c16800195951e4ee549cf8e86a5 (commit) from ecab0cfe25600ad13c174b78a637515943cc870a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ab3bdfb2cb7b0c16800195951e4ee549cf8e86a5 Author: Ferdinand Postema <fer...@po...> Date: Thu Nov 12 23:21:33 2009 +0100 compile with cygwin (32-bit) Changed some printf format strings.. [dbr...@us...: shrink lines, fix indents] Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 7d7a538..cee55e0 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -1713,13 +1713,13 @@ static int ft2232_execute_sleep(struct jtag_command *cmd) int retval; retval = ERROR_OK; - DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us); + DEBUG_JTAG_IO("sleep %" PRIi32, cmd->cmd.sleep->us); if (ft2232_send_and_recv(first_unsent, cmd) != ERROR_OK) retval = ERROR_JTAG_QUEUE_FAILED; first_unsent = cmd->next; jtag_sleep(cmd->cmd.sleep->us); - DEBUG_JTAG_IO("sleep %i usec while in %s", + DEBUG_JTAG_IO("sleep %" PRIi32 " usec while in %s", cmd->cmd.sleep->us, tap_state_name(tap_get_state())); return retval; diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 931db74..b3d8e15 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -189,7 +189,9 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) uint32_t value; if ((retval = arm966e_read_cp15(target, address, &value)) != ERROR_OK) { - command_print(cmd_ctx, "couldn't access reg %i", address); + command_print(cmd_ctx, + "couldn't access reg %" PRIi32, + address); return ERROR_OK; } if ((retval = jtag_execute_queue()) != ERROR_OK) @@ -197,7 +199,8 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) return retval; } - command_print(cmd_ctx, "%i: %8.8" PRIx32 "", address, value); + command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32, + address, value); } else if (argc == 2) { @@ -205,10 +208,13 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) COMMAND_PARSE_NUMBER(u32, args[1], value); if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK) { - command_print(cmd_ctx, "couldn't access reg %i", address); + command_print(cmd_ctx, + "couldn't access reg %" PRIi32, + address); return ERROR_OK; } - command_print(cmd_ctx, "%i: %8.8" PRIx32 "", address, value); + command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32, + address, value); } } diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index f2b6ff7..f657ddc 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -235,11 +235,12 @@ bye: return retval; } - LOG_DEBUG("added %s watchpoint at 0x%8.8" PRIx32 " of length 0x%8.8x (WPID: %d)", - watchpoint_rw_strings[(*watchpoint_p)->rw], - (*watchpoint_p)->address, - (*watchpoint_p)->length, - (*watchpoint_p)->unique_id ); + LOG_DEBUG("added %s watchpoint at 0x%8.8" PRIx32 + " of length 0x%8.8" PRIx32 " (WPID: %d)", + watchpoint_rw_strings[(*watchpoint_p)->rw], + (*watchpoint_p)->address, + (*watchpoint_p)->length, + (*watchpoint_p)->unique_id ); return ERROR_OK; } diff --git a/src/target/target.c b/src/target/target.c index 85c228a..cc8d500 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2801,13 +2801,15 @@ COMMAND_HANDLER(handle_wp_command) while (watchpoint) { - command_print(cmd_ctx, - "address: 0x%8.8" PRIx32 ", len: 0x%8.8x, r/w/a: %i, value: 0x%8.8" PRIx32 ", mask: 0x%8.8" PRIx32 "", - watchpoint->address, - watchpoint->length, - (int)(watchpoint->rw), - watchpoint->value, - watchpoint->mask); + command_print(cmd_ctx, "address: 0x%8.8" PRIx32 + ", len: 0x%8.8" PRIx32 + ", r/w/a: %i, value: 0x%8.8" PRIx32 + ", mask: 0x%8.8" PRIx32, + watchpoint->address, + watchpoint->length, + (int)watchpoint->rw, + watchpoint->value, + watchpoint->mask); watchpoint = watchpoint->next; } return ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/jtag/ft2232.c | 4 ++-- src/target/arm966e.c | 14 ++++++++++---- src/target/breakpoints.c | 11 ++++++----- src/target/target.c | 16 +++++++++------- 4 files changed, 27 insertions(+), 18 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 02:09:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via aafb916bea1153b8d2f4706e4a62628f49741133 (commit) via 78c6b922e21849ed8a2d3af4ca55c84c3d1ac185 (commit) via a7f5cdf999cd3fb8d3a681bcb6d8f8880faf8a11 (commit) via 04b514707f221ba00ae789e69f6f8047af96125d (commit) from 38e8d60f79fd51424c556e07653713254c2d9b4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aafb916bea1153b8d2f4706e4a62628f49741133 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:26:39 2009 -0800 ARM7/ARM9: use shared examine() method No point in having two identical examine methods for the ARM7TDMI and ARM9TDMI drivers; move, rename, shrink, share. Add a bit of doxygen; stop needlessly exporting a method. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 145c8d1..eb66b12 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -548,8 +548,7 @@ struct target_type arm720t_target = .register_commands = arm720t_register_commands, .target_create = arm720t_target_create, .init_target = arm720t_init_target, - .examine = arm7tdmi_examine, + .examine = arm7_9_examine, .mrc = arm720t_mrc, .mcr = arm720t_mcr, - }; diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index ea04f3f..115a1d6 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -37,7 +37,25 @@ #include "arm_simulator.h" -int arm7_9_debug_entry(struct target *target); +/** + * @file + * Hold common code supporting the ARM7 and ARM9 core generations. + * + * While the ARM core implementations evolved substantially during these + * two generations, they look quite similar from the JTAG perspective. + * Both have similar debug facilities, based on the same two scan chains + * providing access to the core and to an EmbeddedICE module. Both can + * support similar ETM and ETB modules, for tracing. And both expose + * what could be viewed as "ARM Classic", with multiple processor modes, + * shadowed registers, and support for the Thumb instruction set. + * + * Processor differences include things like presence or absence of MMU + * and cache, pipeline sizes, use of a modified Harvard Architecure + * (with separate instruction and data busses from the CPU), support + * for cpu clock gating during idle, and more. + */ + +static int arm7_9_debug_entry(struct target *target); /** * Clear watchpoints for an ARM7/9 target. @@ -1311,7 +1329,7 @@ int arm7_9_halt(struct target *target) * @param target Pointer to target that is entering debug mode * @return Error code if anything fails, otherwise ERROR_OK */ -int arm7_9_debug_entry(struct target *target) +static int arm7_9_debug_entry(struct target *target) { int i; uint32_t context[16]; @@ -2838,6 +2856,42 @@ int arm7_9_blank_check_memory(struct target *target, uint32_t address, uint32_t return ERROR_OK; } +/** + * Perform per-target setup that requires JTAG access. + */ +int arm7_9_examine(struct target *target) +{ + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); + int retval; + + if (!target_was_examined(target)) { + struct reg_cache *t, **cache_p; + + t = embeddedice_build_reg_cache(target, arm7_9); + if (t == NULL) + return ERROR_FAIL; + + cache_p = register_get_last_cache_p(&target->reg_cache); + (*cache_p) = t; + arm7_9->eice_cache = (*cache_p); + + if (arm7_9->armv4_5_common.etm) + (*cache_p)->next = etm_build_reg_cache(target, + &arm7_9->jtag_info, + arm7_9->armv4_5_common.etm); + + target_set_examined(target); + } + + retval = embeddedice_setup(target); + if (retval == ERROR_OK) + retval = arm7_9_setup(target); + if (retval == ERROR_OK && arm7_9->armv4_5_common.etm) + retval = etm_setup(target); + return retval; +} + + COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) { uint32_t value; diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index e46da88..bbe95ca 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -159,5 +159,6 @@ void arm7_9_disable_eice_step(struct target *target); int arm7_9_execute_sys_speed(struct target *target); int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9); +int arm7_9_examine(struct target *target); #endif /* ARM7_9_COMMON_H */ diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index c7bbd77..8be8a12 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -646,42 +646,6 @@ static void arm7tdmi_build_reg_cache(struct target *target) armv4_5->core_cache = (*cache_p); } -int arm7tdmi_examine(struct target *target) -{ - struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - int retval; - - - if (!target_was_examined(target)) - { - /* get pointers to arch-specific information */ - struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache); - struct reg_cache *t = embeddedice_build_reg_cache(target, arm7_9); - if (t == NULL) - return ERROR_FAIL; - - (*cache_p) = t; - arm7_9->eice_cache = (*cache_p); - - if (arm7_9->armv4_5_common.etm) - (*cache_p)->next = etm_build_reg_cache(target, - &arm7_9->jtag_info, - arm7_9->armv4_5_common.etm); - - target_set_examined(target); - } - if ((retval = embeddedice_setup(target)) != ERROR_OK) - return retval; - if ((retval = arm7_9_setup(target)) != ERROR_OK) - return retval; - if (arm7_9->armv4_5_common.etm) - { - if ((retval = etm_setup(target)) != ERROR_OK) - return retval; - } - return ERROR_OK; -} - int arm7tdmi_init_target(struct command_context *cmd_ctx, struct target *target) { arm7tdmi_build_reg_cache(target); @@ -786,5 +750,5 @@ struct target_type arm7tdmi_target = .register_commands = arm7_9_register_commands, .target_create = arm7tdmi_target_create, .init_target = arm7tdmi_init_target, - .examine = arm7tdmi_examine, + .examine = arm7_9_examine, }; diff --git a/src/target/arm7tdmi.h b/src/target/arm7tdmi.h index 85b64be..4ed6f3e 100644 --- a/src/target/arm7tdmi.h +++ b/src/target/arm7tdmi.h @@ -35,6 +35,5 @@ struct arm7tdmi_common int arm7tdmi_init_arch_info(struct target *target, struct arm7tdmi_common *arm7tdmi, struct jtag_tap *tap); int arm7tdmi_init_target(struct command_context *cmd_ctx, struct target *target); -int arm7tdmi_examine(struct target *target); #endif /* ARM7TDMI_H */ diff --git a/src/target/arm920t.c b/src/target/arm920t.c index dd742ca..9aa165c 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -1420,7 +1420,7 @@ struct target_type arm920t_target = .register_commands = arm920t_register_commands, .target_create = arm920t_target_create, .init_target = arm9tdmi_init_target, - .examine = arm9tdmi_examine, + .examine = arm7_9_examine, .mrc = arm920t_mrc, .mcr = arm920t_mcr, }; diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index c7609c4..51b241a 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -877,7 +877,7 @@ struct target_type arm926ejs_target = .register_commands = arm926ejs_register_commands, .target_create = arm926ejs_target_create, .init_target = arm9tdmi_init_target, - .examine = arm9tdmi_examine, + .examine = arm7_9_examine, .virt2phys = arm926ejs_virt2phys, .mmu = arm926ejs_mmu, diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 61f9ae5..931db74 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -268,5 +268,5 @@ struct target_type arm966e_target = .register_commands = arm966e_register_commands, .target_create = arm966e_target_create, .init_target = arm9tdmi_init_target, - .examine = arm9tdmi_examine, + .examine = arm7_9_examine, }; diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index fc11073..44a978a 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -742,41 +742,6 @@ static void arm9tdmi_build_reg_cache(struct target *target) armv4_5->core_cache = (*cache_p); } -int arm9tdmi_examine(struct target *target) -{ - int retval; - struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - - if (!target_was_examined(target)) - { - struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache); - struct reg_cache *t; - /* one extra register (vector catch) */ - t = embeddedice_build_reg_cache(target, arm7_9); - if (t == NULL) - return ERROR_FAIL; - (*cache_p) = t; - arm7_9->eice_cache = (*cache_p); - - if (arm7_9->armv4_5_common.etm) - (*cache_p)->next = etm_build_reg_cache(target, - &arm7_9->jtag_info, - arm7_9->armv4_5_common.etm); - - target_set_examined(target); - } - if ((retval = embeddedice_setup(target)) != ERROR_OK) - return retval; - if ((retval = arm7_9_setup(target)) != ERROR_OK) - return retval; - if (arm7_9->armv4_5_common.etm) - { - if ((retval = etm_setup(target)) != ERROR_OK) - return retval; - } - return ERROR_OK; -} - int arm9tdmi_init_target(struct command_context *cmd_ctx, struct target *target) { @@ -986,5 +951,5 @@ struct target_type arm9tdmi_target = .register_commands = arm9tdmi_register_commands, .target_create = arm9tdmi_target_create, .init_target = arm9tdmi_init_target, - .examine = arm9tdmi_examine, + .examine = arm7_9_examine, }; diff --git a/src/target/arm9tdmi.h b/src/target/arm9tdmi.h index 34a63ee..496e4c5 100644 --- a/src/target/arm9tdmi.h +++ b/src/target/arm9tdmi.h @@ -53,7 +53,6 @@ enum arm9tdmi_vector_bit int arm9tdmi_init_target(struct command_context *cmd_ctx, struct target *target); -int arm9tdmi_examine(struct target *target); int arm9tdmi_init_arch_info(struct target *target, struct arm9tdmi_common *arm9tdmi, struct jtag_tap *tap); int arm9tdmi_register_commands(struct command_context *cmd_ctx); diff --git a/src/target/fa526.c b/src/target/fa526.c index f3df24f..9e7b00d 100644 --- a/src/target/fa526.c +++ b/src/target/fa526.c @@ -393,5 +393,5 @@ struct target_type fa526_target = .register_commands = arm920t_register_commands, .target_create = fa526_target_create, .init_target = arm9tdmi_init_target, - .examine = arm9tdmi_examine, + .examine = arm7_9_examine, }; diff --git a/src/target/feroceon.c b/src/target/feroceon.c index 96a048a..c029e44 100644 --- a/src/target/feroceon.c +++ b/src/target/feroceon.c @@ -646,7 +646,7 @@ int feroceon_examine(struct target *target) struct arm7_9_common *arm7_9; int retval; - retval = arm9tdmi_examine(target); + retval = arm7_9_examine(target); if (retval != ERROR_OK) return retval; commit 78c6b922e21849ed8a2d3af4ca55c84c3d1ac185 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:26:39 2009 -0800 ETM: simplify ETM initialization code paths Return NULL from etm_build_reg_cache() not ERROR_OK; and share code on that fault path. Let ETM code handle any tracking of its cache -- not callers. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index 029dce1..c7bbd77 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -664,12 +664,10 @@ int arm7tdmi_examine(struct target *target) arm7_9->eice_cache = (*cache_p); if (arm7_9->armv4_5_common.etm) - { - struct arm_jtag *jtag_info = &arm7_9->jtag_info; (*cache_p)->next = etm_build_reg_cache(target, - jtag_info, arm7_9->armv4_5_common.etm); - arm7_9->armv4_5_common.etm->reg_cache = (*cache_p)->next; - } + &arm7_9->jtag_info, + arm7_9->armv4_5_common.etm); + target_set_examined(target); } if ((retval = embeddedice_setup(target)) != ERROR_OK) diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 147c090..fc11073 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -759,12 +759,10 @@ int arm9tdmi_examine(struct target *target) arm7_9->eice_cache = (*cache_p); if (arm7_9->armv4_5_common.etm) - { - struct arm_jtag *jtag_info = &arm7_9->jtag_info; (*cache_p)->next = etm_build_reg_cache(target, - jtag_info, arm7_9->armv4_5_common.etm); - arm7_9->armv4_5_common.etm->reg_cache = (*cache_p)->next; - } + &arm7_9->jtag_info, + arm7_9->armv4_5_common.etm); + target_set_examined(target); } if ((retval = embeddedice_setup(target)) != ERROR_OK) diff --git a/src/target/etm.c b/src/target/etm.c index 43158b5..4c94e6b 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -349,10 +349,7 @@ struct reg_cache *etm_build_reg_cache(struct target *target, break; default: LOG_WARNING("Bad ETMv1 protocol %d", config >> 28); - free(reg_cache); - free(reg_list); - free(arch_info); - return ERROR_OK; + goto fail; } } etm_ctx->bcd_vers = bcd_vers; @@ -396,10 +393,7 @@ struct reg_cache *etm_build_reg_cache(struct target *target, if (!etb) { LOG_ERROR("etb selected as etm capture driver, but no ETB configured"); - free(reg_cache); - free(reg_list); - free(arch_info); - return ERROR_OK; + goto fail; } reg_cache->next = etb_build_reg_cache(etb); @@ -409,6 +403,12 @@ struct reg_cache *etm_build_reg_cache(struct target *target, etm_ctx->reg_cache = reg_cache; return reg_cache; + +fail: + free(reg_cache); + free(reg_list); + free(arch_info); + return NULL; } static int etm_read_reg(struct reg *reg) commit a7f5cdf999cd3fb8d3a681bcb6d8f8880faf8a11 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:22:36 2009 -0800 ARM11: switch to new "arm" base type This will enable reusing many common ARM utilities, in particular the ETM and ETB support. The ARM11 support can still be much simplified after this patch, though. Note: none of those common utilities kick in yet... Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index a6f0d3c..4ebe61f 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -689,9 +689,7 @@ static int arm11_poll(struct target *target) { FNC_INFO; int retval; - - struct arm11_common * arm11 = target->arch_info; - + struct arm11_common *arm11 = target_to_arm11(target); uint32_t dscr; CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); @@ -732,7 +730,7 @@ static int arm11_poll(struct target *target) /* architecture specific status reply */ static int arm11_arch_state(struct target *target) { - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); LOG_USER("target halted due to %s\ncpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "", Jim_Nvp_value2name_simple(nvp_target_debug_reason, target->debug_reason)->name, @@ -755,8 +753,7 @@ static int arm11_target_request_data(struct target *target, static int arm11_halt(struct target *target) { FNC_INFO; - - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); LOG_DEBUG("target->state: %s", target_state_name(target)); @@ -825,7 +822,7 @@ static int arm11_resume(struct target *target, int current, // LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", // current, address, handle_breakpoints, debug_execution); - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); LOG_DEBUG("target->state: %s", target_state_name(target)); @@ -1044,7 +1041,7 @@ static int arm11_step(struct target *target, int current, return ERROR_TARGET_NOT_HALTED; } - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); if (!current) R(PC) = address; @@ -1190,8 +1187,8 @@ static int arm11_assert_reset(struct target *target) { FNC_INFO; int retval; + struct arm11_common *arm11 = target_to_arm11(target); - struct arm11_common * arm11 = target->arch_info; retval = arm11_check_init(arm11, NULL); if (retval != ERROR_OK) return retval; @@ -1265,8 +1262,7 @@ static int arm11_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size) { FNC_INFO; - - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); *reg_list_size = ARM11_GDB_REGISTER_COUNT; *reg_list = malloc(sizeof(struct reg*) * ARM11_GDB_REGISTER_COUNT); @@ -1314,7 +1310,7 @@ static int arm11_read_memory_inner(struct target *target, LOG_DEBUG("ADDR %08" PRIx32 " SIZE %08" PRIx32 " COUNT %08" PRIx32 "", address, size, count); - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); retval = arm11_run_instr_data_prepare(arm11); if (retval != ERROR_OK) @@ -1410,7 +1406,7 @@ static int arm11_write_memory_inner(struct target *target, LOG_DEBUG("ADDR %08" PRIx32 " SIZE %08" PRIx32 " COUNT %08" PRIx32 "", address, size, count); - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); retval = arm11_run_instr_data_prepare(arm11); if (retval != ERROR_OK) @@ -1572,8 +1568,7 @@ static int arm11_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { FNC_INFO; - - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); #if 0 if (breakpoint->type == BKPT_SOFT) @@ -1604,8 +1599,7 @@ static int arm11_remove_breakpoint(struct target *target, struct breakpoint *breakpoint) { FNC_INFO; - - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); arm11->free_brps++; @@ -1636,7 +1630,7 @@ static int arm11_run_algorithm(struct target *target, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info) { - struct arm11_common *arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); // enum armv4_5_state core_state = arm11->core_state; // enum armv4_5_mode core_mode = arm11->core_mode; uint32_t context[16]; @@ -1813,7 +1807,13 @@ static int arm11_target_create(struct target *target, Jim_Interp *interp) return ERROR_COMMAND_SYNTAX_ERROR; } - target->arch_info = arm11; + armv4_5_init_arch_info(target, &arm11->arm); + + arm11->jtag_info.tap = target->tap; + arm11->jtag_info.scann_size = 5; + arm11->jtag_info.scann_instr = ARM11_SCAN_N; + /* cur_scan_chain == 0 */ + arm11->jtag_info.intest_instr = ARM11_INTEST; return ERROR_OK; } @@ -1831,8 +1831,7 @@ static int arm11_examine(struct target *target) int retval; FNC_INFO; - - struct arm11_common * arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); /* check IDCODE */ @@ -1865,11 +1864,9 @@ static int arm11_examine(struct target *target) case 0x07B56000: LOG_INFO("found ARM1156"); break; case 0x07B76000: LOG_INFO("found ARM1176"); break; default: - { LOG_ERROR("'target arm11' expects IDCODE 0x*7B*7****"); return ERROR_FAIL; } - } arm11->debug_version = (arm11->didr >> 16) & 0x0F; @@ -1923,8 +1920,8 @@ static int arm11_get_reg(struct reg *reg) /** \todo TODO: Check this. We assume that all registers are fetched at debug entry. */ #if 0 - struct arm11_common *arm11 = target->arch_info; - const struct arm11_reg_defs * arm11_reg_info = arm11_reg_defs + ((struct arm11_reg_state *)reg->arch_info)->def_index; + struct arm11_common *arm11 = target_to_arm11(target); + const struct arm11_reg_defs *arm11_reg_info = arm11_reg_defs + ((struct arm11_reg_state *)reg->arch_info)->def_index; #endif return ERROR_OK; @@ -1935,9 +1932,9 @@ static int arm11_set_reg(struct reg *reg, uint8_t *buf) { FNC_INFO; - struct target * target = ((struct arm11_reg_state *)reg->arch_info)->target; - struct arm11_common *arm11 = target->arch_info; -// const struct arm11_reg_defs * arm11_reg_info = arm11_reg_defs + ((struct arm11_reg_state *)reg->arch_info)->def_index; + struct target *target = ((struct arm11_reg_state *)reg->arch_info)->target; + struct arm11_common *arm11 = target_to_arm11(target); +// const struct arm11_reg_defs *arm11_reg_info = arm11_reg_defs + ((struct arm11_reg_state *)reg->arch_info)->def_index; arm11->reg_values[((struct arm11_reg_state *)reg->arch_info)->def_index] = buf_get_u32(buf, 0, 32); reg->valid = 1; @@ -1948,7 +1945,7 @@ static int arm11_set_reg(struct reg *reg, uint8_t *buf) static int arm11_build_reg_cache(struct target *target) { - struct arm11_common *arm11 = target->arch_info; + struct arm11_common *arm11 = target_to_arm11(target); NEW(struct reg_cache, cache, 1); NEW(struct reg, reg_list, ARM11_REGCACHE_COUNT); @@ -2107,14 +2104,13 @@ static int arm11_mrc_inner(struct target *target, int cpnum, uint32_t *value, bool read) { int retval; - + struct arm11_common *arm11 = target_to_arm11(target); + if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_FAIL; } - - struct arm11_common * arm11 = target->arch_info; uint32_t instr = 0xEE000010 | (cpnum << 8) | diff --git a/src/target/arm11.h b/src/target/arm11.h index f890253..6caad0e 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -23,9 +23,7 @@ #ifndef ARM11_H #define ARM11_H -#include "target.h" -#include "register.h" -#include "jtag.h" +#include "armv4_5.h" #define asizeof(x) (sizeof(x) / sizeof((x)[0])) @@ -80,6 +78,7 @@ enum arm11_debug_version struct arm11_common { + struct arm arm; struct target * target; /**< Reference back to the owner */ /** \name Processor type detection */ @@ -117,8 +116,15 @@ struct arm11_common // GA struct reg_cache *core_cache; + + struct arm_jtag jtag_info; }; +static inline struct arm11_common *target_to_arm11(struct target *target) +{ + return container_of(target->arch_info, struct arm11_common, + arm); +} /** * ARM11 DBGTAP instructions diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 65d4f82..40361dc 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -178,6 +178,8 @@ int arm11_add_debug_SCAN_N(struct arm11_common * arm11, uint8_t chain, tap_state arm11_in_handler_SCAN_N(tmp); + arm11->jtag_info.cur_scan_chain = chain; + return jtag_execute_queue(); } commit 04b514707f221ba00ae789e69f6f8047af96125d Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:22:36 2009 -0800 target: remove unused "bitfield" infrastructure We have too many different registers, and too many version and context dependent interpretations, for this type of bitfield management to be scalable. (Anyone who really wants bitfield interpretation *can* do that in Tcl code...) There are ... quite a few copies of the same ARM dummy registers. There should eventually be one copy; this many is craziness. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index 24c6b8f..a6f0d3c 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -246,18 +246,35 @@ enum arm11_regcache_ids #define ARM11_GDB_REGISTER_COUNT 26 -static uint8_t arm11_gdb_dummy_fp_value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +/* FIXME these are *identical* to the ARMv4_5 dummies ... except + * for their names, and being static vs global, and having different + * addresses. Ditto ARMv7a and ARMv7m dummies. + */ + +static uint8_t arm11_gdb_dummy_fp_value[12]; static struct reg arm11_gdb_dummy_fp_reg = { - "GDB dummy floating-point register", arm11_gdb_dummy_fp_value, 0, 1, 96, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point register", + .value = arm11_gdb_dummy_fp_value, + .dirty = 0, + .valid = 1, + .size = 96, + .arch_info = NULL, + .arch_type = 0, }; -static uint8_t arm11_gdb_dummy_fps_value[] = {0, 0, 0, 0}; +static uint8_t arm11_gdb_dummy_fps_value[4]; static struct reg arm11_gdb_dummy_fps_reg = { - "GDB dummy floating-point status register", arm11_gdb_dummy_fps_value, 0, 1, 32, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point status register", + .value = arm11_gdb_dummy_fps_value, + .dirty = 0, + .valid = 1, + .size = 32, + .arch_info = NULL, + .arch_type = 0, }; @@ -1979,8 +1996,6 @@ static int arm11_build_reg_cache(struct target *target) r->value = (uint8_t *)(arm11->reg_values + i); r->dirty = 0; r->valid = 0; - r->bitfield_desc = NULL; - r->num_bitfields = 0; r->arch_type = arm11_regs_arch_type; r->arch_info = rs; diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 6e3eff6..aa05e83 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -32,22 +32,6 @@ #include "binarybuffer.h" -struct bitfield_desc armv4_5_psr_bitfield_desc[] = -{ - {"M[4:0]", 5}, - {"T", 1}, - {"F", 1}, - {"I", 1}, - {"reserved", 16}, - {"J", 1}, - {"reserved", 2}, - {"Q", 1}, - {"V", 1}, - {"C", 1}, - {"Z", 1}, - {"N", 1}, -}; - char* armv4_5_core_reg_list[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13_usr", "lr_usr", "pc", @@ -157,14 +141,26 @@ uint8_t armv4_5_gdb_dummy_fp_value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; struct reg armv4_5_gdb_dummy_fp_reg = { - "GDB dummy floating-point register", armv4_5_gdb_dummy_fp_value, 0, 1, 96, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point register", + .value = armv4_5_gdb_dummy_fp_value, + .dirty = 0, + .valid = 1, + .size = 96, + .arch_info = NULL, + .arch_type = 0, }; uint8_t armv4_5_gdb_dummy_fps_value[] = {0, 0, 0, 0}; struct reg armv4_5_gdb_dummy_fps_reg = { - "GDB dummy floating-point status register", armv4_5_gdb_dummy_fps_value, 0, 1, 32, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point status register", + .value = armv4_5_gdb_dummy_fps_value, + .dirty = 0, + .valid = 1, + .size = 32, + .arch_info = NULL, + .arch_type = 0, }; int armv4_5_get_core_reg(struct reg *reg) @@ -278,8 +274,6 @@ struct reg_cache* armv4_5_build_reg_cache(struct target *target, struct arm *arm reg_list[i].value = calloc(1, 4); reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].arch_type = armv4_5_core_reg_arch_type; reg_list[i].arch_info = &arch_info[i]; } diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 0474a56..c94d3b0 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -35,25 +35,6 @@ #include <string.h> #include <unistd.h> -struct bitfield_desc armv7a_psr_bitfield_desc[] = -{ - {"M[4:0]", 5}, - {"T", 1}, - {"F", 1}, - {"I", 1}, - {"A", 1}, - {"E", 1}, - {"IT[7:2]", 6}, - {"GE[3:0]", 4}, - {"reserved(DNM)", 4}, - {"J", 1}, - {"IT[0:1]", 2}, - {"Q", 1}, - {"V", 1}, - {"C", 1}, - {"Z", 1}, - {"N", 1}, -}; char* armv7a_core_reg_list[] = { @@ -165,12 +146,20 @@ int armv7a_core_reg_map[8][17] = } }; +/* FIXME this dummy is IDENTICAL to the armv4_5, arm11, and armv7m + * ones... except for naming/scoping + */ uint8_t armv7a_gdb_dummy_fp_value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; struct reg armv7a_gdb_dummy_fp_reg = { - "GDB dummy floating-point register", armv7a_gdb_dummy_fp_value, - 0, 1, 96, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point register", + .value = armv7a_gdb_dummy_fp_value, + .dirty = 0, + .valid = 1, + .size = 96, + .arch_info = NULL, + .arch_type = 0, }; void armv7a_show_fault_registers(struct target *target) diff --git a/src/target/armv7m.c b/src/target/armv7m.c index f339645..ff97a4c 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -57,20 +57,33 @@ static char *armv7m_exception_strings[] = "DebugMonitor", "RESERVED", "PendSV", "SysTick" }; -static uint8_t armv7m_gdb_dummy_fp_value[12] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; +/* FIXME these dummies are IDENTICAL to the armv4_5, arm11, and armv7a + * ones... except for naming/scoping + */ +static uint8_t armv7m_gdb_dummy_fp_value[12]; static struct reg armv7m_gdb_dummy_fp_reg = { - "GDB dummy floating-point register", armv7m_gdb_dummy_fp_value, 0, 1, 96, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point register", + .value = armv7m_gdb_dummy_fp_value, + .dirty = 0, + .valid = 1, + .size = 96, + .arch_info = NULL, + .arch_type = 0, }; -static uint8_t armv7m_gdb_dummy_fps_value[] = {0, 0, 0, 0}; +static uint8_t armv7m_gdb_dummy_fps_value[4]; static struct reg armv7m_gdb_dummy_fps_reg = { - "GDB dummy floating-point status register", armv7m_gdb_dummy_fps_value, 0, 1, 32, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point status register", + .value = armv7m_gdb_dummy_fps_value, + .dirty = 0, + .valid = 1, + .size = 32, + .arch_info = NULL, + .arch_type = 0, }; #ifdef ARMV7_GDB_HACKS @@ -78,7 +91,13 @@ uint8_t armv7m_gdb_dummy_cpsr_value[] = {0, 0, 0, 0}; struct reg armv7m_gdb_dummy_cpsr_reg = { - "GDB dummy cpsr register", armv7m_gdb_dummy_cpsr_value, 0, 1, 32, NULL, 0, NULL, 0 + .name = "GDB dummy cpsr register", + .value = armv7m_gdb_dummy_cpsr_value, + .dirty = 0, + .valid = 1, + .size = 32, + .arch_info = NULL, + .arch_type = 0, }; #endif @@ -563,8 +582,6 @@ struct reg_cache *armv7m_build_reg_cache(struct target *target) reg_list[i].value = calloc(1, 4); reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].arch_type = armv7m_core_reg_arch_type; reg_list[i].arch_info = &arch_info[i]; } diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index e73cb7f..292504b 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -201,8 +201,6 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9) reg_list[i].size = eice_regs[i].width; reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].value = calloc(1, 4); reg_list[i].arch_info = &arch_info[i]; reg_list[i].arch_type = embeddedice_reg_arch_type; diff --git a/src/target/etb.c b/src/target/etb.c index 2e8e7ca..e65cd5a 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -150,8 +150,6 @@ struct reg_cache* etb_build_reg_cache(struct etb *etb) reg_list[i].size = 32; reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].value = calloc(1, 4); reg_list[i].arch_info = &arch_info[i]; reg_list[i].arch_type = etb_reg_arch_type; diff --git a/src/target/mips32.c b/src/target/mips32.c index fe22dd5..6432a90 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -90,7 +90,13 @@ uint8_t mips32_gdb_dummy_fp_value[] = {0, 0, 0, 0}; struct reg mips32_gdb_dummy_fp_reg = { - "GDB dummy floating-point register", mips32_gdb_dummy_fp_value, 0, 1, 32, NULL, 0, NULL, 0 + .name = "GDB dummy floating-point register", + .value = mips32_gdb_dummy_fp_value, + .dirty = 0, + .valid = 1, + .size = 32, + .arch_info = NULL, + .arch_type = 0, }; int mips32_core_reg_arch_type = -1; @@ -306,8 +312,6 @@ struct reg_cache *mips32_build_reg_cache(struct target *target) reg_list[i].value = calloc(1, 4); reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].arch_type = mips32_core_reg_arch_type; reg_list[i].arch_info = &arch_info[i]; } diff --git a/src/target/register.h b/src/target/register.h index a907dc2..c21edf6 100644 --- a/src/target/register.h +++ b/src/target/register.h @@ -27,12 +27,6 @@ struct target; -struct bitfield_desc -{ - char *name; - int num_bits; -}; - struct reg { char *name; @@ -40,8 +34,6 @@ struct reg int dirty; int valid; uint32_t size; - struct bitfield_desc *bitfield_desc; - int num_bitfields; void *arch_info; int arch_type; }; diff --git a/src/target/xscale.c b/src/target/xscale.c index ca3ea2a..10ccf5d 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2849,8 +2849,6 @@ static void xscale_build_reg_cache(struct target *target) (*cache_p)->reg_list[i].dirty = 0; (*cache_p)->reg_list[i].valid = 0; (*cache_p)->reg_list[i].size = 32; - (*cache_p)->reg_list[i].bitfield_desc = NULL; - (*cache_p)->reg_list[i].num_bitfields = 0; (*cache_p)->reg_list[i].arch_info = &arch_info[i]; (*cache_p)->reg_list[i].arch_type = xscale_reg_arch_type; arch_info[i] = xscale_reg_arch_info[i]; ----------------------------------------------------------------------- Summary of changes: src/target/arm11.c | 87 +++++++++++++++++++++++++------------------- src/target/arm11.h | 12 +++++-- src/target/arm11_dbgtap.c | 2 + src/target/arm720t.c | 3 +- src/target/arm7_9_common.c | 58 ++++++++++++++++++++++++++++- src/target/arm7_9_common.h | 1 + src/target/arm7tdmi.c | 40 +-------------------- src/target/arm7tdmi.h | 1 - src/target/arm920t.c | 2 +- src/target/arm926ejs.c | 2 +- src/target/arm966e.c | 2 +- src/target/arm9tdmi.c | 39 +------------------- src/target/arm9tdmi.h | 1 - src/target/armv4_5.c | 34 +++++++---------- src/target/armv7a.c | 31 +++++----------- src/target/armv7m.c | 35 +++++++++++++----- src/target/embeddedice.c | 2 - src/target/etb.c | 2 - src/target/etm.c | 16 ++++---- src/target/fa526.c | 2 +- src/target/feroceon.c | 2 +- src/target/mips32.c | 10 ++++-- src/target/register.h | 8 ---- src/target/xscale.c | 2 - 24 files changed, 190 insertions(+), 204 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-14 01:59:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ecab0cfe25600ad13c174b78a637515943cc870a (commit) via 817bf743023de7fea901e89157da57b90c7c326c (commit) via 44d6a531f7ad07ec20962fe1c61bb7787f2c7cf5 (commit) from aafb916bea1153b8d2f4706e4a62628f49741133 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ecab0cfe25600ad13c174b78a637515943cc870a Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:58:14 2009 -0800 ARM11: ETM + ETB support Kick in ETM (and ETB) support for ARM11. Tested on OMAP 2420, so update that configuration. (That's an ARM1136ejs, ETB, OpenGL ES1.1, C55x DSP, etc.) Also update the other ARM11 ETM + ETB targets in the tree to set up these modules. (Not tested.) Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index b30e518..7a30bc7 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -1898,6 +1898,20 @@ static int arm11_examine(struct target *target) if (retval != ERROR_OK) return retval; + /* ETM on ARM11 still uses original scanchain 6 access mode */ + if (arm11->arm.etm && !target_was_examined(target)) { + *register_get_last_cache_p(&target->reg_cache) = + etm_build_reg_cache(target, &arm11->jtag_info, + arm11->arm.etm); + retval = etm_setup(target); + } + + /* FIXME this sets a flag in the (shared) arm11_target structure, + * not in the (per-cpu) "target" structure ... so it's clearly + * wrong in the case of e.g. two different ARM11 chips on the + * same board. (Maybe ARM11 MPCore works though.) Whoever calls + * the examine() method should set a target-specific flag... + */ target_set_examined(target); return ERROR_OK; @@ -2212,5 +2226,5 @@ int arm11_register_commands(struct command_context *cmd_ctx) arm11_handle_vcr, COMMAND_ANY, "Control (Interrupt) Vector Catch Register"); - return ERROR_OK; + return etm_register_commands(cmd_ctx); } diff --git a/tcl/target/imx31.cfg b/tcl/target/imx31.cfg index 9a2aed3..b613ba6 100644 --- a/tcl/target/imx31.cfg +++ b/tcl/target/imx31.cfg @@ -60,3 +60,7 @@ target create $_TARGETNAME arm11 -endian $_ENDIAN -chain-position $_TARGETNAME proc power_restore {} { puts "Sensed power restore. No action." } proc srst_deasserted {} { puts "Sensed nSRST deasserted. No action." } + +# trace setup ... NOTE, "normal full" mode fudges the real ETMv3.1 mode +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb diff --git a/tcl/target/imx35.cfg b/tcl/target/imx35.cfg index b899084..d47abdc 100644 --- a/tcl/target/imx35.cfg +++ b/tcl/target/imx35.cfg @@ -48,3 +48,7 @@ target create $_TARGETNAME arm11 -endian $_ENDIAN -chain-position $_TARGETNAME proc power_restore {} { puts "Sensed power restore. No action." } proc srst_deasserted {} { puts "Sensed nSRST deasserted. No action." } + +# trace setup ... NOTE, "normal full" mode fudges the real ETMv3.1 mode +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb diff --git a/tcl/target/omap2420.cfg b/tcl/target/omap2420.cfg index a579866..5cf47b2 100644 --- a/tcl/target/omap2420.cfg +++ b/tcl/target/omap2420.cfg @@ -49,7 +49,6 @@ $_TARGETNAME configure -work-area-phys 0x40210000 $_TARGETNAME configure -work-area-size 0x00081000 $_TARGETNAME configure -work-area-backup 0 -# trace setup -# REVISIT ... as of 12-June-2009, OpenOCD's ETM code can't talk to ARM11 cores. -#etm config $_TARGETNAME 16 normal full etb -#etb config $_TARGETNAME $_CHIPNAME.etb +# trace setup ... NOTE, "normal full" mode fudges the real ETMv3.1 mode +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb diff --git a/tcl/target/samsung_s3c6410.cfg b/tcl/target/samsung_s3c6410.cfg index e451fd6..9137199 100644 --- a/tcl/target/samsung_s3c6410.cfg +++ b/tcl/target/samsung_s3c6410.cfg @@ -47,3 +47,7 @@ jtag_ntrst_delay 500 #reset configuration reset_config trst_and_srst + +# trace setup ... NOTE, "normal full" mode fudges the real ETMv3.1 mode +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb commit 817bf743023de7fea901e89157da57b90c7c326c Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:56:11 2009 -0800 ARM11: revert etmr/etmw commands These aren't desirable, given "standard" ETM support. Also remove the now-unused arm11_find_target(). Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index 4ebe61f..b30e518 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2076,29 +2076,6 @@ static const uint32_t arm11_coproc_instruction_limits[] = 0xFFFFFFFF, /* value */ }; -static struct arm11_common * arm11_find_target(const char * arg) -{ - struct jtag_tap * tap; - struct target * t; - - tap = jtag_tap_by_string(arg); - - if (!tap) - return 0; - - for (t = all_targets; t; t = t->next) - { - if (t->tap != tap) - continue; - - /* if (t->type == arm11_target) */ - if (0 == strcmp(target_get_name(t), "arm11")) - return t->arch_info; - } - - return 0; -} - static int arm11_mrc_inner(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value, bool read) @@ -2154,58 +2131,6 @@ static int arm11_mcr(struct target *target, int cpnum, return arm11_mrc_inner(target, cpnum, op1, op2, CRn, CRm, &value, false); } -static COMMAND_HELPER(arm11_handle_etm_read_write, bool read) -{ - if (argc != (read ? 2 : 3)) - { - LOG_ERROR("Invalid number of arguments."); - return ERROR_COMMAND_SYNTAX_ERROR; - } - - struct arm11_common * arm11 = arm11_find_target(args[0]); - - if (!arm11) - { - LOG_ERROR("Parameter 1 is not the target name of an ARM11 device."); - return ERROR_COMMAND_SYNTAX_ERROR; - } - - uint32_t address; - COMMAND_PARSE_NUMBER(u32, args[1], address); - - if (!read) - { - uint32_t value; - COMMAND_PARSE_NUMBER(u32, args[2], value); - - LOG_INFO("ETM write register 0x%02" PRIx32 " (%" PRId32 ") = 0x%08" PRIx32 " (%" PRId32 ")", - address, address, value, value); - - CHECK_RETVAL(arm11_write_etm(arm11, address, value)); - } - else - { - uint32_t value; - - CHECK_RETVAL(arm11_read_etm(arm11, address, &value)); - - LOG_INFO("ETM read register 0x%02" PRIx32 " (%" PRId32 ") = 0x%08" PRIx32 " (%" PRId32 ")", - address, address, value, value); - } - - return ERROR_OK; -} - -COMMAND_HANDLER(arm11_handle_etmr) -{ - return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, true); -} - -COMMAND_HANDLER(arm11_handle_etmw) -{ - return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, false); -} - #define ARM11_HANDLER(x) .x = arm11_##x struct target_type arm11_target = { @@ -2259,14 +2184,6 @@ int arm11_register_commands(struct command_context *cmd_ctx) top_cmd = register_command(cmd_ctx, NULL, "arm11", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, top_cmd, "etmr", - arm11_handle_etmr, COMMAND_ANY, - "Read Embedded Trace Macrocell (ETM) register. etmr <jtag_target> <ETM register address>"); - - register_command(cmd_ctx, top_cmd, "etmw", - arm11_handle_etmw, COMMAND_ANY, - "Write Embedded Trace Macrocell (ETM) register. etmr <jtag_target> <ETM register address> <value>"); - /* "hardware_step" is only here to check if the default * simulate + breakpoint implementation is broken. * TEMPORARY! NOT DOCUMENTED! diff --git a/src/target/arm11.h b/src/target/arm11.h index 6caad0e..e48758f 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -190,9 +190,4 @@ struct arm11_reg_state int arm11_register_commands(struct command_context *cmd_ctx); -int arm11_read_etm(struct arm11_common * arm11, uint8_t address, uint32_t *value); -int arm11_write_etm(struct arm11_common * arm11, uint8_t address, uint32_t value); - - - #endif /* ARM11_H */ diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 40361dc..a95dcdd 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -941,80 +941,3 @@ int arm11_read_memory_word(struct arm11_common * arm11, uint32_t address, uint32 return arm11_run_instr_data_finish(arm11); } - -/** Write Embedded Trace Macrocell (ETM) via Scan chain 6 - * - * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0318e/Bcfddjeh.html#Bcfggcbe - * - * \param arm11 Target state variable. - * \param address 7 bit ETM register address - * \param value Value to be written - * - * \return Error status - * - * \remarks This is a stand-alone function that executes the JTAG command queue. - */ -int arm11_write_etm(struct arm11_common * arm11, uint8_t address, uint32_t value) -{ - CHECK_RETVAL(arm11_add_debug_SCAN_N(arm11, 0x06, ARM11_TAP_DEFAULT)); - - /* Uses INTEST for read and write */ - arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); - - struct scan_field chain6_fields[3]; - - uint8_t nRW = 1; - - arm11_setup_field(arm11, 32, &value, NULL, chain6_fields + 0); - arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); - arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); - - arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); - - CHECK_RETVAL(jtag_execute_queue()); - - return ERROR_OK; -} - -/** Read Embedded Trace Macrocell (ETM) via Scan chain 6 - * - * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0318e/Bcfddjeh.html#Bcfggcbe - * - * \param arm11 Target state variable. - * \param address 7 bit ETM register address - * \param value Pointer that receives value that was read - * - * \return Error status - * - * \remarks This is a stand-alone function that executes the JTAG command queue. - */ -int arm11_read_etm(struct arm11_common * arm11, uint8_t address, uint32_t * value) -{ - CHECK_RETVAL(arm11_add_debug_SCAN_N(arm11, 0x06, ARM11_TAP_DEFAULT)); - - /* Uses INTEST for read and write */ - arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); - - struct scan_field chain6_fields[3]; - - uint8_t nRW = 0; - - arm11_setup_field(arm11, 32, NULL, NULL, chain6_fields + 0); - arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); - arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); - - arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); - - /* Data is made available in Capture-DR and shifted out on the next access */ - - arm11_setup_field(arm11, 32, NULL, value, chain6_fields + 0); - arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); - arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); - - arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); - - CHECK_RETVAL(jtag_execute_queue()); - - return ERROR_OK; -} - commit 44d6a531f7ad07ec20962fe1c61bb7787f2c7cf5 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 16:56:11 2009 -0800 iMX2* + ETB targets: hook up ETM and ETB ARM9 cores with an ETB will have a matching ETM. Hook them both up by default. Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/imx25.cfg b/tcl/target/imx25.cfg index 6474a85..ead6610 100644 --- a/tcl/target/imx25.cfg +++ b/tcl/target/imx25.cfg @@ -38,4 +38,9 @@ if { [info exists SDMATAPID ] } { jtag newtap $_CHIPNAME sdma -irlen 5 -expected-id $_SDMATAPID set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME +target create $_TARGETNAME arm926ejs -endian $_ENDIAN \ + -chain-position $_TARGETNAME + +# trace setup +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb diff --git a/tcl/target/imx27.cfg b/tcl/target/imx27.cfg index 039e83c..dabae6d 100644 --- a/tcl/target/imx27.cfg +++ b/tcl/target/imx27.cfg @@ -47,3 +47,7 @@ $_TARGETNAME configure -work-area-virt 0xffff4c00 -work-area-phys 0xffff4c00 \ # arm7_9 dcc_downloads enable + +# trace setup +etm config $_TARGETNAME 16 normal full etb +etb config $_TARGETNAME $_CHIPNAME.etb ----------------------------------------------------------------------- Summary of changes: src/target/arm11.c | 99 ++++++---------------------------------- src/target/arm11.h | 5 -- src/target/arm11_dbgtap.c | 77 ------------------------------- tcl/target/imx25.cfg | 7 ++- tcl/target/imx27.cfg | 4 ++ tcl/target/imx31.cfg | 4 ++ tcl/target/imx35.cfg | 4 ++ tcl/target/omap2420.cfg | 7 +-- tcl/target/samsung_s3c6410.cfg | 4 ++ 9 files changed, 40 insertions(+), 171 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-13 22:45:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 38e8d60f79fd51424c556e07653713254c2d9b4e (commit) via afe0298399bd06700926822e6d49c5bc44151956 (commit) from 6435e75e147a6559ed4f784b5e89c8390e787a2a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 38e8d60f79fd51424c556e07653713254c2d9b4e Author: David Brownell <dbr...@us...> Date: Fri Nov 13 13:44:50 2009 -0800 target.cfg: label ETBs correctly Various cores with an ETB have its TAP misnamed ... either as a boundary scan TAP or as the iMX "Secure JTAG Controller" (which is, among other things, a JRC that could be used to shorten scan chains). Use the correct name for these TAPs, which we can recognize since their IDs were assigned by ARM and these chips all document the presence of an ETB. The 0x2b900f0f is ETB11; the 0x1b900f0f is an older module, just called "ETB". Also shrink the ETB's IR configuration; the default IR-Capture value is fine, and the mask can specify that all four bits are safe to check (per ARM documentation). Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/imx25.cfg b/tcl/target/imx25.cfg index 8f8fa05..6474a85 100644 --- a/tcl/target/imx25.cfg +++ b/tcl/target/imx25.cfg @@ -14,12 +14,12 @@ if { [info exists ENDIAN] } { set _ENDIAN little } -if { [info exists SJCTAPID ] } { - set _SJCTAPID $SJCTAPID +if { [info exists ETBTAPID ] } { + set _ETBTAPID $ETBTAPID } else { - set _SJCTAPID 0x1b900f0f + set _ETBTAPID 0x1b900f0f } -jtag newtap $_CHIPNAME sjc -irlen 4 -expected-id $_SJCTAPID +jtag newtap $_CHIPNAME etb -irlen 4 -irmask 0x0f -expected-id $_ETBTAPID if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID diff --git a/tcl/target/imx27.cfg b/tcl/target/imx27.cfg index 4a93a67..039e83c 100644 --- a/tcl/target/imx27.cfg +++ b/tcl/target/imx27.cfg @@ -21,13 +21,13 @@ if { [info exists ENDIAN] } { # Note above there are 2 taps -# The bs tap -if { [info exists BSTAPID ] } { - set _BSTAPID $BSTAPID +# trace buffer +if { [info exists ETBTAPID ] } { + set _ETBTAPID $ETBTAPID } else { - set _BSTAPID 0x1b900f0f + set _ETBTAPID 0x1b900f0f } -jtag newtap $_CHIPNAME bs -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_BSTAPID +jtag newtap $_CHIPNAME etb -irlen 4 -irmask 0xf -expected-id $_ETBTAPID # The CPU tap if { [info exists CPUTAPID ] } { diff --git a/tcl/target/imx31.cfg b/tcl/target/imx31.cfg index 61a2925..9a2aed3 100644 --- a/tcl/target/imx31.cfg +++ b/tcl/target/imx31.cfg @@ -27,15 +27,15 @@ if { [info exists SDMATAPID ] } { set _SDMATAPID 0x2190101d } -#======================================== -# The "system jtag controller" -# IMX31 reference manual, page 6-28 - figure 6-14 -if { [info exists SJCTAPID ] } { - set _SJCTAPID $SJCTAPID +if { [info exists ETBTAPID ] } { + set _ETBTAPID $ETBTAPID } else { - set _SJCTAPID 0x2b900f0f + set _ETBTAPID 0x2b900f0f } -jtag newtap $_CHIPNAME sjc -irlen 4 -ircapture 0x0 -irmask 0x0 -expected-id $_SJCTAPID + +#======================================== + +jtag newtap $_CHIPNAME etb -irlen 4 -irmask 0xf -expected-id $_ETBTAPID # The "SDMA" - <S>mart <DMA> controller debug tap # Based on some IO pins - this can be disabled & removed diff --git a/tcl/target/imx35.cfg b/tcl/target/imx35.cfg index 32748c5..b899084 100644 --- a/tcl/target/imx35.cfg +++ b/tcl/target/imx35.cfg @@ -27,17 +27,15 @@ if { [info exists SDMATAPID ] } { set _SDMATAPID 0x0882601d } -#======================================== -# The "system jtag controller" -# IMX31 reference manual, page 6-28 - figure 6-14 -if { [info exists SJCTAPID ] } { - set _SJCTAPID $SJCTAPID +if { [info exists ETBTAPID ] } { + set _ETBTAPID $ETBTAPID } else { - set _SJCTAPID 0x2b900f0f + set _ETBTAPID 0x2b900f0f } -jtag newtap $_CHIPNAME sjc -irlen 4 -ircapture 0x0 -irmask 0x0 -expected-id $_SJCTAPID +#======================================== +jtag newtap $_CHIPNAME etb -irlen 4 -irmask 0xf -expected-id $_ETBTAPID jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID # No IDCODE for this TAP diff --git a/tcl/target/samsung_s3c6410.cfg b/tcl/target/samsung_s3c6410.cfg index 594d321..e451fd6 100644 --- a/tcl/target/samsung_s3c6410.cfg +++ b/tcl/target/samsung_s3c6410.cfg @@ -19,11 +19,12 @@ if { [info exists ENDIAN] } { set _ENDIAN little } -if { [info exists BSTAPID ] } { - set _BSTAPID $BSTAPID +# trace buffer +if { [info exists ETBTAPID ] } { + set _ETBTAPID $ETBTAPID } else { # force an error till we get a good number - set _BSTAPID 0x2b900f0f + set _ETBTAPID 0x2b900f0f } if { [info exists CPUTAPID ] } { @@ -35,8 +36,7 @@ if { [info exists CPUTAPID ] } { #jtag scan chain -# I think the "unknown" is the boundry scan tap -jtag newtap $_CHIPNAME unknown -irlen 4 -ircapture 0x1 -irmask 0xe -expected-id $_BSTAPID +jtag newtap $_CHIPNAME etb -irlen 4 -expected-id $_ETBTAPID jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID set _TARGETNAME $_CHIPNAME.cpu commit afe0298399bd06700926822e6d49c5bc44151956 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 13:44:50 2009 -0800 ARM7/9: rm arm7_9_get_arch_pointers() Remove the last external user of arm7_9_get_arch_pointers(), and that annoying downcast utility. Add an is_arm7_9() predicate. Stop returning specious success codes on various failure paths in the ARM7/ARM9 commands which used that downcast utility. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 26d2830..0b492c6 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -46,8 +46,6 @@ static int ocl_protect_check(struct flash_bank *bank) /* flash_bank ocl 0 0 0 0 <target#> */ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command) { - int retval; - struct arm *armv4_5; struct arm7_9_common *arm7_9; struct ocl_priv *ocl; @@ -57,8 +55,9 @@ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command) return ERROR_FLASH_BANK_INVALID; } - if ((retval = arm7_9_get_arch_pointers(bank->target, &armv4_5, &arm7_9)) != ERROR_OK) - return retval; + arm7_9 = target_to_arm7_9(bank->target); + if (!is_arm7_9(arm7_9)) + return ERROR_TARGET_INVALID; ocl = bank->driver_priv = malloc(sizeof(struct ocl_priv)); ocl->jtag_info = &arm7_9->jtag_info; diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index ce2d4f0..ea04f3f 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -167,39 +167,6 @@ int arm7_9_setup(struct target *target) } /** - * Retrieves the architecture information pointers for ARMv4/5 and ARM7/9 - * targets. A return of ERROR_OK signifies that the target is a valid target - * and that the pointers have been set properly. - * - * @param target Pointer to the target device to get the pointers from - * @param armv4_5_p Pointer to be filled in with the common struct for ARMV4/5 - * targets - * @param arm7_9_p Pointer to be filled in with the common struct for ARM7/9 - * targets - * @return ERROR_OK if successful - */ -int arm7_9_get_arch_pointers(struct target *target, struct arm **armv4_5_p, struct arm7_9_common **arm7_9_p) -{ - struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - struct armv4_5_common_s *armv4_5 = &arm7_9->armv4_5_common; - - /* FIXME stop using this routine; just target_to_arm7_9() and - * verify the resulting pointer using a replacement routine - * that emits a usage message. - */ - if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC) - return ERROR_TARGET_INVALID; - - if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC) - return ERROR_TARGET_INVALID; - - *armv4_5_p = armv4_5; - *arm7_9_p = arm7_9; - - return ERROR_OK; -} - -/** * Set either a hardware or software breakpoint on an ARM7/9 target. The * breakpoint is set up even if it is already set. Some actions, e.g. reset, * might have erased the values in Embedded ICE. @@ -2877,25 +2844,24 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) int spsr; int retval; struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (target->state != TARGET_HALTED) { command_print(cmd_ctx, "can't write registers while running"); - return ERROR_OK; + return ERROR_FAIL; } if (argc < 2) { command_print(cmd_ctx, "usage: write_xpsr <value> <not cpsr | spsr>"); - return ERROR_OK; + return ERROR_FAIL; } COMMAND_PARSE_NUMBER(u32, args[0], value); @@ -2922,25 +2888,24 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_im8_command) int spsr; int retval; struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (target->state != TARGET_HALTED) { command_print(cmd_ctx, "can't write registers while running"); - return ERROR_OK; + return ERROR_FAIL; } if (argc < 3) { command_print(cmd_ctx, "usage: write_xpsr_im8 <im8> <rotate> <not cpsr | spsr>"); - return ERROR_OK; + return ERROR_FAIL; } COMMAND_PARSE_NUMBER(u32, args[0], value); @@ -2963,25 +2928,24 @@ COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) uint32_t mode; int num; struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (target->state != TARGET_HALTED) { command_print(cmd_ctx, "can't write registers while running"); - return ERROR_OK; + return ERROR_FAIL; } if (argc < 3) { command_print(cmd_ctx, "usage: write_core_reg <num> <mode> <value>"); - return ERROR_OK; + return ERROR_FAIL; } COMMAND_PARSE_NUMBER(int, args[0], num); @@ -2994,13 +2958,12 @@ COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) COMMAND_HANDLER(handle_arm7_9_dbgrq_command) { struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (argc > 0) @@ -3027,13 +2990,12 @@ COMMAND_HANDLER(handle_arm7_9_dbgrq_command) COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) { struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (argc > 0) @@ -3060,13 +3022,12 @@ COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) { struct target *target = get_current_target(cmd_ctx); - struct arm *armv4_5; - struct arm7_9_common *arm7_9; + struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (!is_arm7_9(arm7_9)) { command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + return ERROR_TARGET_INVALID; } if (argc > 0) diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index 035c5fe..e46da88 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -115,6 +115,11 @@ target_to_arm7_9(struct target *target) armv4_5_common); } +static inline bool is_arm7_9(struct arm7_9_common *arm7_9) +{ + return arm7_9->common_magic == ARM7_9_COMMON_MAGIC; +} + int arm7_9_register_commands(struct command_context *cmd_ctx); int arm7_9_poll(struct target *target); @@ -154,6 +159,5 @@ void arm7_9_disable_eice_step(struct target *target); int arm7_9_execute_sys_speed(struct target *target); int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9); -int arm7_9_get_arch_pointers(struct target *target, struct arm **armv4_5_p, struct arm7_9_common **arm7_9_p); #endif /* ARM7_9_COMMON_H */ ----------------------------------------------------------------------- Summary of changes: src/flash/ocl.c | 7 +-- src/target/arm7_9_common.c | 87 +++++++++++----------------------------- src/target/arm7_9_common.h | 6 ++- tcl/target/imx25.cfg | 8 ++-- tcl/target/imx27.cfg | 10 ++-- tcl/target/imx31.cfg | 14 +++--- tcl/target/imx35.cfg | 12 ++--- tcl/target/samsung_s3c6410.cfg | 10 ++-- 8 files changed, 58 insertions(+), 96 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-13 22:41:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 6435e75e147a6559ed4f784b5e89c8390e787a2a (commit) from ef746e27c55c14b7a4f6381c490e5c175e409c0b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6435e75e147a6559ed4f784b5e89c8390e787a2a Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 13:38:35 2009 -0800 update developer manual for new types Update the style guide and chase obvious references to structures that have been renamed. diff --git a/doc/manual/helper.txt b/doc/manual/helper.txt index 7060607..247d7b4 100644 --- a/doc/manual/helper.txt +++ b/doc/manual/helper.txt @@ -75,7 +75,7 @@ handlers or helpers: The following parameters are defined in the scope of all command handlers and helpers: -- <code>struct command_context_s *cmd_ctx</code> - the command's context +- <code>struct command_context *cmd_ctx</code> - the command's context - <code>unsigned argc</code> - the number of command arguments - <code>const char *args[]</code> - contains the command arguments diff --git a/doc/manual/style.txt b/doc/manual/style.txt index b6d68b4..b4d0216 100644 --- a/doc/manual/style.txt +++ b/doc/manual/style.txt @@ -66,8 +66,9 @@ Finally, try to avoid lines of code that are longer than than 72-80 columns: - most identifiers must use lower-case letters (and digits) only. - macros must use upper-case letters (and digits) only. - OpenOCD identifiers should NEVER use @c MixedCaps. -- structure names must end with the '_s' suffix. -- typedef names must end with the '_t' suffix. +- @c typedef names must end with the '_t' suffix. + - This should be reserved for types that should be passed by value. + - Do @b not mix the typedef keyword with @c struct. - use underline characters between consecutive words in identifiers (e.g. @c more_than_one_word). @@ -77,7 +78,7 @@ Finally, try to avoid lines of code that are longer than than 72-80 columns: - @c // comments -- in new code, prefer these for single-line comments - trailing comma allowed in enum declarations - designated initializers (@{ .field = value @}) -- variables declarations may be mixed with code +- variables declarations should occur at the point of first use - new block scopes for selection and iteration statements @section styletypes Type Guidelines @@ -176,7 +177,7 @@ The following guidelines apply to all Doxygen comment blocks: -# @c function_name() can be used to reference functions (e.g. flash_set_dirty()). -# @c struct_name::member_name should be used to reference structure - fields in the documentation (e.g. @c flash_driver_s::name). + fields in the documentation (e.g. @c flash_driver::name). -# URLS get converted to markup automatically, without any extra effort. -# new pages can be linked into the heirarchy by using the @c \@subpage command somewhere the page(s) under which they should be linked: ----------------------------------------------------------------------- Summary of changes: doc/manual/helper.txt | 2 +- doc/manual/style.txt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-13 22:32:45
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ef746e27c55c14b7a4f6381c490e5c175e409c0b (commit) via 98723c4ecdbe06f90c66f3abec27b792c3b38e34 (commit) from d16968e24f5d9e436ae4e136cd27652c4c948203 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ef746e27c55c14b7a4f6381c490e5c175e409c0b Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 13:30:50 2009 -0800 command_t -> struct command Remove misleading typedef and redundant suffix from struct command. diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 4459364..ad45bd5 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -2474,7 +2474,7 @@ static int sam3_registered; static int sam3_register_commands(struct command_context *cmd_ctx) { - command_t *pCmd; + struct command *pCmd; // only register once if (!sam3_registered) { diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 18cfb98..e0b83d5 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -1180,7 +1180,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command) static int at91sam7_register_commands(struct command_context *cmd_ctx) { - command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", + struct command *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); register_command(cmd_ctx, at91sam7_cmd, "gpnvm", diff --git a/src/flash/avrf.c b/src/flash/avrf.c index ea9f083..e41093d 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -451,7 +451,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) static int avrf_register_commands(struct command_context *cmd_ctx) { - command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", + struct command *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); register_command(cmd_ctx, avr_cmd, "mass_erase", diff --git a/src/flash/cfi.c b/src/flash/cfi.c index d49ddf3..17f5c32 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -590,7 +590,7 @@ static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size) static int cfi_register_commands(struct command_context *cmd_ctx) { - /*command_t *cfi_cmd = */ + /*struct command *cfi_cmd = */ register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, "flash bank cfi <base> <size> <chip_width> <bus_width> <targetNum> [jedec_probe/x16_as_x8]"); /* register_command(cmd_ctx, cfi_cmd, "part_id", cfi_handle_part_id_command, COMMAND_EXEC, diff --git a/src/flash/flash.c b/src/flash/flash.c index 32c1f49..20efa50 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -77,7 +77,7 @@ struct flash_driver *flash_drivers[] = { }; struct flash_bank *flash_banks; -static command_t *flash_cmd; +static struct command *flash_cmd; /* wafer thin wrapper for invoking the flash driver */ static int flash_driver_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index f3d7e5b..df1f082 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -778,7 +778,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) static int lpc2000_register_commands(struct command_context *cmd_ctx) { - command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", + struct command *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", NULL, COMMAND_ANY, NULL); register_command(cmd_ctx, lpc2000_cmd, "part_id", diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 4cf2092..739ac43 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -954,7 +954,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) */ static int lpc2900_register_commands(struct command_context *cmd_ctx) { - command_t *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900", + struct command *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900", NULL, COMMAND_ANY, NULL); register_command( diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index ffa5055..3589e8b 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -875,7 +875,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command) static int lpc3180_register_commands(struct command_context *cmd_ctx) { - command_t *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers"); + struct command *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers"); register_command(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)"); diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 029178d..c2d04ca 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -32,7 +32,7 @@ static int s3c2440_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val static int pxa270_set_gpio_to_output (struct mflash_gpio_num gpio); static int pxa270_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val); -static command_t *mflash_cmd; +static struct command *mflash_cmd; static struct mflash_bank *mflash_bank; diff --git a/src/flash/nand.c b/src/flash/nand.c index 4094eff..be3a669 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -62,7 +62,7 @@ static struct nand_flash_controller *nand_flash_controllers[] = /* configured NAND devices and NAND Flash command handler */ static struct nand_device *nand_devices = NULL; -static command_t *nand_cmd; +static struct command *nand_cmd; /* Chip ID list * diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index bb3d69c..b6c4c44 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -885,7 +885,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) static int pic32mx_register_commands(struct command_context *cmd_ctx) { - command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", + struct command *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", NULL, COMMAND_ANY, "pic32mx flash specific commands"); #if 0 register_command(cmd_ctx, pic32mx_cmd, "lock", diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 910d047..56762d1 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -1162,7 +1162,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) static int stellaris_register_commands(struct command_context *cmd_ctx) { - command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", + struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", NULL, COMMAND_ANY, "stellaris flash specific commands"); register_command(cmd_ctx, stm32x_cmd, "mass_erase", diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index abbf6cb..7ac06a6 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -1183,7 +1183,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command) static int stm32x_register_commands(struct command_context *cmd_ctx) { - command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", + struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", NULL, COMMAND_ANY, "stm32x flash specific commands"); register_command(cmd_ctx, stm32x_cmd, "lock", diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 8307013..71709bb 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -673,7 +673,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) static int str7x_register_commands(struct command_context *cmd_ctx) { - command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", + struct command *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", NULL, COMMAND_ANY, "str7x flash specific commands"); register_command(cmd_ctx, str7x_cmd, "disable_jtag", diff --git a/src/flash/str9x.c b/src/flash/str9x.c index a06bd1e..1506cb5 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -677,7 +677,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command) static int str9x_register_commands(struct command_context *cmd_ctx) { - command_t *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", + struct command *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", NULL, COMMAND_ANY, "str9x flash commands"); register_command(cmd_ctx, str9x_cmd, "flash_config", diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 03a8ea2..d1b02c5 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -1165,7 +1165,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) static int str9xpec_register_commands(struct command_context *cmd_ctx) { - command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", + struct command *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", NULL, COMMAND_ANY, "str9xpec flash specific commands"); register_command(cmd_ctx, str9xpec_cmd, "enable_turbo", diff --git a/src/flash/tms470.c b/src/flash/tms470.c index a5f2f36..b71e9ed 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -819,7 +819,7 @@ static int tms470_erase_sector(struct flash_bank *bank, int sector) static int tms470_register_commands(struct command_context *cmd_ctx) { - command_t *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family"); + struct command *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family"); register_command(cmd_ctx, tms470_cmd, "flash_keyset", tms470_handle_flash_keyset_command, COMMAND_ANY, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); register_command(cmd_ctx, tms470_cmd, "osc_megahertz", tms470_handle_osc_megahertz_command, COMMAND_ANY, "tms470 osc_megahertz <MHz>"); diff --git a/src/hello.c b/src/hello.c index 267cc28..275150a 100644 --- a/src/hello.c +++ b/src/hello.c @@ -50,7 +50,7 @@ COMMAND_HANDLER(handle_hello_command) int hello_register_commands(struct command_context *cmd_ctx) { - struct command_s *cmd = register_command(cmd_ctx, NULL, "hello", + struct command *cmd = register_command(cmd_ctx, NULL, "hello", &handle_hello_command, COMMAND_ANY, "option"); return cmd ? ERROR_OK : -ENOMEM; diff --git a/src/helper/command.c b/src/helper/command.c index 60a4a26..41af035 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -48,7 +48,7 @@ int fast_and_dangerous = 0; Jim_Interp *interp = NULL; static int run_command(struct command_context *context, - command_t *c, const char *words[], unsigned num_words); + struct command *c, const char *words[], unsigned num_words); static void tcl_output(void *privData, const char *file, unsigned line, const char *function, const char *string) @@ -79,7 +79,7 @@ void script_debug(Jim_Interp *interp, const char *name, static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { /* the private data is stashed in the interp structure */ - command_t *c; + struct command *c; struct command_context *context; int retval; int i; @@ -164,7 +164,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return (retval == ERROR_OK)?JIM_OK:JIM_ERR; } -static Jim_Obj *command_name_list(struct command_s *c) +static Jim_Obj *command_name_list(struct command *c) { Jim_Obj *cmd_list = c->parent ? command_name_list(c->parent) : @@ -197,10 +197,10 @@ static void command_helptext_add(Jim_Obj *cmd_list, const char *help) * Find a command by name from a list of commands. * @returns The named command if found, or NULL. */ -static struct command_s *command_find(struct command_s **head, const char *name) +static struct command *command_find(struct command **head, const char *name) { assert(head); - for (struct command_s *cc = *head; cc; cc = cc->next) + for (struct command *cc = *head; cc; cc = cc->next) { if (strcmp(cc->name, name) == 0) return cc; @@ -213,7 +213,7 @@ static struct command_s *command_find(struct command_s **head, const char *name) * @returns Returns false if the named command already exists in the list. * Returns true otherwise. */ -static void command_add_child(struct command_s **head, struct command_s *c) +static void command_add_child(struct command **head, struct command *c) { assert(head); if (NULL == *head) @@ -221,24 +221,24 @@ static void command_add_child(struct command_s **head, struct command_s *c) *head = c; return; } - struct command_s *cc = *head; + struct command *cc = *head; while (cc->next) cc = cc->next; cc->next = c; } -command_t* register_command(struct command_context *context, - command_t *parent, char *name, command_handler_t handler, +struct command* register_command(struct command_context *context, + struct command *parent, char *name, command_handler_t handler, enum command_mode mode, char *help) { if (!context || !name) return NULL; - struct command_s **head = parent ? &parent->children : &context->commands; - struct command_s *c = command_find(head, name); + struct command **head = parent ? &parent->children : &context->commands; + struct command *c = command_find(head, name); if (NULL != c) return c; - c = malloc(sizeof(command_t)); + c = malloc(sizeof(struct command)); c->name = strdup(name); c->parent = parent; @@ -276,7 +276,7 @@ command_t* register_command(struct command_context *context, int unregister_all_commands(struct command_context *context) { - command_t *c, *c2; + struct command *c, *c2; if (context == NULL) return ERROR_OK; @@ -308,7 +308,7 @@ int unregister_all_commands(struct command_context *context) int unregister_command(struct command_context *context, char *name) { - command_t *c, *p = NULL, *c2; + struct command *c, *p = NULL, *c2; if ((!context) || (!name)) return ERROR_INVALID_ARGUMENTS; @@ -414,7 +414,7 @@ void command_print(struct command_context *context, const char *format, ...) va_end(ap); } -static char *__command_name(struct command_s *c, char delim, unsigned extra) +static char *__command_name(struct command *c, char delim, unsigned extra) { char *name; unsigned len = strlen(c->name); @@ -431,13 +431,13 @@ static char *__command_name(struct command_s *c, char delim, unsigned extra) } return name; } -char *command_name(struct command_s *c, char delim) +char *command_name(struct command *c, char delim) { return __command_name(c, delim, 0); } static int run_command(struct command_context *context, - command_t *c, const char *words[], unsigned num_words) + struct command *c, const char *words[], unsigned num_words) { int start_word = 0; if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode))) diff --git a/src/helper/command.h b/src/helper/command.h index 169852e..94d9816 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -60,7 +60,7 @@ typedef int (*command_output_handler_t)(struct command_context *context, struct command_context { enum command_mode mode; - struct command_s *commands; + struct command *commands; int current_target; /* Execute a command. * @@ -131,15 +131,15 @@ struct command_context /// The type signature for commands' handler functions. typedef __COMMAND_HANDLER((*command_handler_t)); -typedef struct command_s +struct command { char *name; - struct command_s *parent; - struct command_s *children; + struct command *parent; + struct command *children; command_handler_t handler; enum command_mode mode; - struct command_s *next; -} command_t; + struct command *next; +}; /** * @param c The command to be named. @@ -149,10 +149,10 @@ typedef struct command_s * are separated by single spaces. The caller must free() the string * when done with it. */ -char *command_name(struct command_s *c, char delim); +char *command_name(struct command *c, char delim); -command_t* register_command(struct command_context *context, - command_t *parent, char *name, command_handler_t handler, +struct command* register_command(struct command_context *context, + struct command *parent, char *name, command_handler_t handler, enum command_mode mode, char *help); int unregister_command(struct command_context *context, char *name); diff --git a/src/jtag/minidummy/minidummy.c b/src/jtag/minidummy/minidummy.c index b01f593..67919e4 100644 --- a/src/jtag/minidummy/minidummy.c +++ b/src/jtag/minidummy/minidummy.c @@ -78,7 +78,7 @@ int interface_jtag_add_plain_ir_scan(int num_fields, const struct scan_field *fi return ERROR_OK; } -/*extern jtag_command_t **jtag_get_last_command_p(void);*/ +/*extern jtag_struct command **jtag_get_last_command_p(void);*/ int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state) { diff --git a/src/jtag/rlink/rlink.c b/src/jtag/rlink/rlink.c index 8f2f26f..8aa0342 100644 --- a/src/jtag/rlink/rlink.c +++ b/src/jtag/rlink/rlink.c @@ -578,7 +578,7 @@ dtc_run_download( struct dtc_reply_queue_entry { struct dtc_reply_queue_entry_s *next; - jtag_command_t *cmd; /* the command that resulted in this entry */ + jtag_struct command *cmd; /* the command that resulted in this entry */ struct { uint8_t *buffer; /* the scan buffer */ @@ -637,7 +637,7 @@ dtc_queue_enqueue_reply( int size, int offset, int length, - jtag_command_t *cmd + jtag_struct command *cmd ) { struct dtc_reply_queue_entry *rq_entry; @@ -1090,7 +1090,7 @@ void rlink_reset(int trst, int srst) static int rlink_scan( - jtag_command_t *cmd, + jtag_struct command *cmd, enum scan_type type, uint8_t *buffer, int scan_size @@ -1378,7 +1378,7 @@ rlink_scan( static int rlink_execute_queue(void) { - jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ + jtag_struct command *cmd = jtag_command_queue; /* currently processed command */ int scan_size; enum scan_type type; uint8_t *buffer; diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 1edf57f..526914a 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -595,7 +595,7 @@ int interface_jtag_add_plain_ir_scan(int num_fields, const struct scan_field *fi return ERROR_OK; } -/*extern jtag_command_t **jtag_get_last_command_p(void);*/ +/*extern jtag_struct command **jtag_get_last_command_p(void);*/ int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state) { diff --git a/src/pld/pld.c b/src/pld/pld.c index f5f3303..fdb276f 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -37,7 +37,7 @@ static struct pld_driver *pld_drivers[] = }; static struct pld_device *pld_devices; -static command_t *pld_cmd; +static struct command *pld_cmd; struct pld_device *get_pld_device_by_num(int num) { diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index 24bcd34..ea9ee0c 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -235,7 +235,7 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command) static int virtex2_register_commands(struct command_context *cmd_ctx) { - command_t *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2", + struct command *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2", NULL, COMMAND_ANY, "virtex2 specific commands"); register_command(cmd_ctx, virtex2_cmd, "read_stat", diff --git a/src/target/arm11.c b/src/target/arm11.c index feaa17b..24c6b8f 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2243,7 +2243,7 @@ int arm11_register_commands(struct command_context *cmd_ctx) { FNC_INFO; - command_t *top_cmd, *mw_cmd; + struct command *top_cmd, *mw_cmd; top_cmd = register_command(cmd_ctx, NULL, "arm11", NULL, COMMAND_ANY, NULL); diff --git a/src/target/arm720t.c b/src/target/arm720t.c index bdbc8dd..145c8d1 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -493,7 +493,7 @@ static int arm720t_mcr(struct target *target, int cpnum, uint32_t op1, uint32_t static int arm720t_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *arm720t_cmd; + struct command *arm720t_cmd; retval = arm7_9_register_commands(cmd_ctx); diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 87a6434..ce2d4f0 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -3121,7 +3121,7 @@ int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9) int arm7_9_register_commands(struct command_context *cmd_ctx) { - command_t *arm7_9_cmd; + struct command *arm7_9_cmd; arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); diff --git a/src/target/arm920t.c b/src/target/arm920t.c index cd63d7b..dd742ca 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -1351,7 +1351,7 @@ static int arm920t_mcr(struct target *target, int cpnum, uint32_t op1, uint32_t int arm920t_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *arm920t_cmd; + struct command *arm920t_cmd; retval = arm9tdmi_register_commands(cmd_ctx); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 47a20cb..c7609c4 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -821,7 +821,7 @@ static int arm926ejs_mmu(struct target *target, int *enabled) int arm926ejs_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *arm926ejs_cmd; + struct command *arm926ejs_cmd; retval = arm9tdmi_register_commands(cmd_ctx); diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 6db7d79..61f9ae5 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -219,7 +219,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) int arm966e_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *arm966e_cmd; + struct command *arm966e_cmd; retval = arm9tdmi_register_commands(cmd_ctx); arm966e_cmd = register_command(cmd_ctx, NULL, "arm966e", diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index b910447..147c090 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -939,7 +939,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) int arm9tdmi_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *arm9tdmi_cmd; + struct command *arm9tdmi_cmd; retval = arm7_9_register_commands(cmd_ctx); arm9tdmi_cmd = register_command(cmd_ctx, NULL, "arm9", diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index f7d5d16..6e3eff6 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -464,7 +464,7 @@ usage: int armv4_5_register_commands(struct command_context *cmd_ctx) { - command_t *armv4_5_cmd; + struct command *armv4_5_cmd; armv4_5_cmd = register_command(cmd_ctx, NULL, "armv4_5", NULL, COMMAND_ANY, diff --git a/src/target/armv7a.c b/src/target/armv7a.c index e40e8fd..0474a56 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -363,8 +363,8 @@ usage: int armv7a_register_commands(struct command_context *cmd_ctx) { - command_t *arm_adi_v5_dap_cmd; - command_t *armv7a_cmd; + struct command *arm_adi_v5_dap_cmd; + struct command *armv7a_cmd; arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap", NULL, COMMAND_ANY, diff --git a/src/target/armv7m.c b/src/target/armv7m.c index a740584..f339645 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -834,7 +834,7 @@ COMMAND_HANDLER(handle_dap_info_command) /** Registers commands used to access DAP resources. */ int armv7m_register_commands(struct command_context *cmd_ctx) { - command_t *arm_adi_v5_dap_cmd; + struct command *arm_adi_v5_dap_cmd; arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap", NULL, COMMAND_ANY, diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 6c61363..730cd33 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1548,7 +1548,7 @@ COMMAND_HANDLER(cortex_a8_handle_dbginit_command) static int cortex_a8_register_commands(struct command_context *cmd_ctx) { - command_t *cortex_a8_cmd; + struct command *cortex_a8_cmd; int retval = ERROR_OK; armv4_5_register_commands(cmd_ctx); diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index bb0b0c4..e236df2 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1931,7 +1931,7 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) static int cortex_m3_register_commands(struct command_context *cmd_ctx) { int retval; - command_t *cortex_m3_cmd; + struct command *cortex_m3_cmd; retval = armv7m_register_commands(cmd_ctx); diff --git a/src/target/etb.c b/src/target/etb.c index 903951f..2e8e7ca 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -405,7 +405,7 @@ COMMAND_HANDLER(handle_etb_config_command) static int etb_register_commands(struct command_context *cmd_ctx) { - command_t *etb_cmd = register_command(cmd_ctx, NULL, "etb", + struct command *etb_cmd = register_command(cmd_ctx, NULL, "etb", NULL, COMMAND_ANY, "Embedded Trace Buffer"); register_command(cmd_ctx, etb_cmd, "config", diff --git a/src/target/etm.c b/src/target/etm.c index ee064eb..43158b5 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -223,7 +223,7 @@ static int etm_register_user_commands(struct command_context *cmd_ctx); static int etm_set_reg_w_exec(struct reg *reg, uint8_t *buf); static int etm_write_reg(struct reg *reg, uint32_t value); -static command_t *etm_cmd; +static struct command *etm_cmd; /* Look up register by ID ... most ETM instances only diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 8301fb0..b0ab1fb 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -60,7 +60,7 @@ COMMAND_HANDLER(handle_etm_dummy_config_command) static int etm_dummy_register_commands(struct command_context *cmd_ctx) { - command_t *etm_dummy_cmd; + struct command *etm_dummy_cmd; etm_dummy_cmd = register_command(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver"); diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index c2e1361..cad4977 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -409,7 +409,7 @@ COMMAND_HANDLER(handle_oocd_trace_resync_command) int oocd_trace_register_commands(struct command_context *cmd_ctx) { - command_t *oocd_trace_cmd; + struct command *oocd_trace_cmd; oocd_trace_cmd = register_command(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD + trace"); diff --git a/src/target/target_request.c b/src/target/target_request.c index 1f02be6..283ce55 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -34,7 +34,7 @@ #include "log.h" -static command_t *target_request_cmd = NULL; +static struct command *target_request_cmd = NULL; static int charmsg_mode = 0; static int target_asciimsg(struct target *target, uint32_t length) diff --git a/src/target/trace.c b/src/target/trace.c index aa8fb29..6ec08d6 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -158,7 +158,7 @@ COMMAND_HANDLER(handle_trace_history_command) int trace_register_commands(struct command_context *cmd_ctx) { - command_t *trace_cmd = + struct command *trace_cmd = register_command(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands"); register_command(cmd_ctx, trace_cmd, "history", handle_trace_history_command, diff --git a/src/target/xscale.c b/src/target/xscale.c index 73c1ba1..ca3ea2a 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3577,7 +3577,7 @@ COMMAND_HANDLER(xscale_handle_cp15) static int xscale_register_commands(struct command_context *cmd_ctx) { - command_t *xscale_cmd; + struct command *xscale_cmd; xscale_cmd = register_command(cmd_ctx, NULL, "xscale", NULL, COMMAND_ANY, "xscale specific commands"); commit 98723c4ecdbe06f90c66f3abec27b792c3b38e34 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 13:25:47 2009 -0800 command_context_t -> struct command_context Remove misleading typedef and redundant suffix from struct command_context. diff --git a/src/ecosboard.c b/src/ecosboard.c index 455c93c..38f3252 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -229,7 +229,7 @@ void reboot_port(void) cyg_thread_resume(zylinjtag_reboot_port_thread_handle); } -int configuration_output_handler(struct command_context_s *context, +int configuration_output_handler(struct command_context *context, const char* line) { diag_printf("%s", line); @@ -237,7 +237,7 @@ int configuration_output_handler(struct command_context_s *context, return ERROR_OK; } -int zy1000_configuration_output_handler_log(struct command_context_s *context, +int zy1000_configuration_output_handler_log(struct command_context *context, const char* line) { LOG_USER_N("%s", line); @@ -247,7 +247,7 @@ int zy1000_configuration_output_handler_log(struct command_context_s *context, #ifdef CYGPKG_PROFILE_GPROF -int eCosBoard_handle_eCosBoard_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +int eCosBoard_handle_eCosBoard_profile_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) { command_print(cmd_ctx, "Profiling started"); start_profile(); @@ -258,7 +258,7 @@ int eCosBoard_handle_eCosBoard_profile_command(struct command_context_s *cmd_ctx externC void phi_init_all_network_interfaces(void); -command_context_t *cmd_ctx; +struct command_context *cmd_ctx; static bool webRunning = false; @@ -840,7 +840,7 @@ void startUart(void) cyg_thread_resume(zylinjtag_uart_thread_handle); } -int handle_uart_command(struct command_context_s *cmd_ctx, char *cmd, +int handle_uart_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) { static int current_baud = 38400; @@ -924,7 +924,7 @@ bool logAllToSerial = false; int boolParam(char *var); -command_context_t *setup_command_handler(void); +struct command_context *setup_command_handler(void); static const char *zylin_config_dir="/config/settings"; @@ -936,7 +936,7 @@ static int add_default_dirs(void) return ERROR_OK; } -int ioutil_init(struct command_context_s *cmd_ctx); +int ioutil_init(struct command_context *cmd_ctx); int main(int argc, char *argv[]) { @@ -1068,7 +1068,7 @@ int main(int argc, char *argv[]) add_default_dirs(); /* initialize commandline interface */ - command_context_t * cmd_ctx; + struct command_context * cmd_ctx; cmd_ctx = setup_command_handler(); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); command_context_mode(cmd_ctx, COMMAND_CONFIG); diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index b756e48..4459364 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -231,7 +231,7 @@ struct sam3_reg_list { static struct sam3_chip *all_sam3_chips; static struct sam3_chip * -get_current_sam3(struct command_context_s *cmd_ctx) +get_current_sam3(struct command_context *cmd_ctx) { struct target *t; static struct sam3_chip *p; @@ -2472,7 +2472,7 @@ COMMAND_HANDLER(sam3_handle_slowclk_command) static int sam3_registered; static int -sam3_register_commands(struct command_context_s *cmd_ctx) +sam3_register_commands(struct command_context *cmd_ctx) { command_t *pCmd; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 8f870bc..18cfb98 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -1178,7 +1178,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command) return ERROR_OK; } -static int at91sam7_register_commands(struct command_context_s *cmd_ctx) +static int at91sam7_register_commands(struct command_context *cmd_ctx) { command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 9df254e..ea9f083 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -449,7 +449,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) return ERROR_OK; } -static int avrf_register_commands(struct command_context_s *cmd_ctx) +static int avrf_register_commands(struct command_context *cmd_ctx) { command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); diff --git a/src/flash/cfi.c b/src/flash/cfi.c index dd393de..d49ddf3 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -588,7 +588,7 @@ static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size) return ERROR_OK; } -static int cfi_register_commands(struct command_context_s *cmd_ctx) +static int cfi_register_commands(struct command_context *cmd_ctx) { /*command_t *cfi_cmd = */ register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, "flash bank cfi <base> <size> <chip_width> <bus_width> <targetNum> [jedec_probe/x16_as_x8]"); diff --git a/src/flash/davinci_nand.c b/src/flash/davinci_nand.c index 4cef408..413bcda 100644 --- a/src/flash/davinci_nand.c +++ b/src/flash/davinci_nand.c @@ -78,7 +78,7 @@ static int halted(struct target *target, const char *label) return false; } -static int davinci_register_commands(struct command_context_s *cmd_ctx) +static int davinci_register_commands(struct command_context *cmd_ctx) { return ERROR_OK; } diff --git a/src/flash/ecos.c b/src/flash/ecos.c index da35407..0525fbe 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -30,7 +30,7 @@ static uint32_t ecosflash_get_flash_status(struct flash_bank *bank); static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode); static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout); -static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +static int ecosflash_handle_gpnvm_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc); #endif struct ecosflash_flash_bank @@ -334,7 +334,7 @@ static int ecosflash_probe(struct flash_bank *bank) return ERROR_OK; } -static int ecosflash_register_commands(struct command_context_s *cmd_ctx) +static int ecosflash_register_commands(struct command_context *cmd_ctx) { register_command(cmd_ctx, NULL, "ecosflash", NULL, COMMAND_ANY, NULL); @@ -429,7 +429,7 @@ static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t wai return ERROR_OK; } -static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int ecosflash_handle_gpnvm_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) { return ERROR_OK; } diff --git a/src/flash/faux.c b/src/flash/faux.c index 55e9892..b048fcb 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -87,7 +87,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command) return ERROR_OK; } -static int faux_register_commands(struct command_context_s *cmd_ctx) +static int faux_register_commands(struct command_context *cmd_ctx) { return ERROR_OK; } diff --git a/src/flash/flash.c b/src/flash/flash.c index 96c63d5..32c1f49 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -199,7 +199,7 @@ struct flash_bank *get_flash_bank_by_num(int num) } int flash_command_get_bank_by_num( - struct command_context_s *cmd_ctx, const char *str, struct flash_bank **bank) + struct command_context *cmd_ctx, const char *str, struct flash_bank **bank) { unsigned bank_num; COMMAND_PARSE_NUMBER(uint, str, bank_num); @@ -511,7 +511,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command) return ERROR_OK; } -static int flash_check_sector_parameters(struct command_context_s *cmd_ctx, +static int flash_check_sector_parameters(struct command_context *cmd_ctx, uint32_t first, uint32_t last, uint32_t num_sectors) { if (!(first <= last)) { @@ -1217,7 +1217,7 @@ int default_flash_blank_check(struct flash_bank *bank) return ERROR_OK; } -int flash_init_drivers(struct command_context_s *cmd_ctx) +int flash_init_drivers(struct command_context *cmd_ctx) { register_jim(cmd_ctx, "ocd_flash_banks", jim_flash_banks, "return information about the flash banks"); @@ -1267,7 +1267,7 @@ int flash_init_drivers(struct command_context_s *cmd_ctx) return ERROR_OK; } -int flash_register_commands(struct command_context_s *cmd_ctx) +int flash_register_commands(struct command_context *cmd_ctx) { flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL); diff --git a/src/flash/flash.h b/src/flash/flash.h index 202a5e5..4651fc3 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -97,7 +97,7 @@ struct flash_driver * * @returns ERROR_OK if successful; otherwise, an error code. */ - int (*register_commands)(struct command_context_s *cmd_ctx); + int (*register_commands)(struct command_context *cmd_ctx); /** * Finish the "flash bank" command for @a bank. The @@ -265,9 +265,9 @@ struct flash_bank }; /// Registers the 'flash' subsystem commands -int flash_register_commands(struct command_context_s *cmd_ctx); +int flash_register_commands(struct command_context *cmd_ctx); /// Initializes the 'flash' subsystem drivers -int flash_init_drivers(struct command_context_s *cmd_ctx); +int flash_init_drivers(struct command_context *cmd_ctx); /** * Erases @a length bytes in the @a target flash, starting at @a addr. @@ -323,7 +323,7 @@ struct flash_bank *get_flash_bank_by_num(int num); * @param bank On output, contians a pointer to the bank or NULL. * @returns ERROR_OK on success, or an error indicating the problem. */ -int flash_command_get_bank_by_num(struct command_context_s *cmd_ctx, +int flash_command_get_bank_by_num(struct command_context *cmd_ctx, const char *str, struct flash_bank **bank); /** * Returns the flash bank like get_flash_bank_by_num(), without probing. diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 36ebc0e..f3d7e5b 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -776,7 +776,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) return ERROR_OK; } -static int lpc2000_register_commands(struct command_context_s *cmd_ctx) +static int lpc2000_register_commands(struct command_context *cmd_ctx) { command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", NULL, COMMAND_ANY, NULL); diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index d385a30..4cf2092 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -952,7 +952,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) /** * Register private command handlers. */ -static int lpc2900_register_commands(struct command_context_s *cmd_ctx) +static int lpc2900_register_commands(struct command_context *cmd_ctx) { command_t *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900", NULL, COMMAND_ANY, NULL); diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index 4a15e36..ffa5055 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -873,7 +873,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command) return ERROR_OK; } -static int lpc3180_register_commands(struct command_context_s *cmd_ctx) +static int lpc3180_register_commands(struct command_context *cmd_ctx) { command_t *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers"); diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 698cd16..029178d 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -1265,7 +1265,7 @@ COMMAND_HANDLER(mg_config_cmd) } } -int mflash_init_drivers(struct command_context_s *cmd_ctx) +int mflash_init_drivers(struct command_context *cmd_ctx) { if (mflash_bank) { register_command(cmd_ctx, mflash_cmd, "probe", mg_probe_cmd, COMMAND_EXEC, NULL); @@ -1320,7 +1320,7 @@ COMMAND_HANDLER(mg_bank_cmd) return ERROR_OK; } -int mflash_register_commands(struct command_context_s *cmd_ctx) +int mflash_register_commands(struct command_context *cmd_ctx) { mflash_cmd = register_command(cmd_ctx, NULL, "mflash", NULL, COMMAND_ANY, NULL); register_command(cmd_ctx, mflash_cmd, "bank", mg_bank_cmd, COMMAND_CONFIG, diff --git a/src/flash/mflash.h b/src/flash/mflash.h index a2bd5b3..ed4a2cd 100644 --- a/src/flash/mflash.h +++ b/src/flash/mflash.h @@ -141,8 +141,8 @@ struct mflash_bank struct mg_drv_info *drv_info; }; -int mflash_register_commands(struct command_context_s *cmd_ctx); -int mflash_init_drivers(struct command_context_s *cmd_ctx); +int mflash_register_commands(struct command_context *cmd_ctx); +int mflash_init_drivers(struct command_context *cmd_ctx); #define MG_MFLASH_SECTOR_SIZE (0x200) /* 512Bytes = 2^9 */ #define MG_MFLASH_SECTOR_SIZE_MASK (0x200-1) diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c index 6c69917..45d2a32 100644 --- a/src/flash/mx3_nand.c +++ b/src/flash/mx3_nand.c @@ -315,7 +315,7 @@ static int imx31_nand_ready (struct nand_device *nand, int timeout) return imx31_controller_ready (nand, timeout); } -static int imx31_register_commands (struct command_context_s *cmd_ctx) +static int imx31_register_commands (struct command_context *cmd_ctx) { return ERROR_OK; } diff --git a/src/flash/nand.c b/src/flash/nand.c index 48f6520..4094eff 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -279,7 +279,7 @@ COMMAND_HANDLER(handle_nand_device_command) return ERROR_OK; } -int nand_register_commands(struct command_context_s *cmd_ctx) +int nand_register_commands(struct command_context *cmd_ctx) { nand_cmd = register_command(cmd_ctx, NULL, "nand", NULL, COMMAND_ANY, "NAND specific commands"); @@ -304,7 +304,7 @@ struct nand_device *get_nand_device_by_num(int num) return NULL; } -int nand_command_get_device_by_num(struct command_context_s *cmd_ctx, +int nand_command_get_device_by_num(struct command_context *cmd_ctx, const char *str, struct nand_device **nand) { unsigned num; @@ -1602,7 +1602,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command) return ERROR_OK; } -int nand_init(struct command_context_s *cmd_ctx) +int nand_init(struct command_context *cmd_ctx) { if (!nand_devices) return ERROR_OK; diff --git a/src/flash/nand.h b/src/flash/nand.h index 8096309..afec9a7 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -36,7 +36,7 @@ struct nand_flash_controller { char *name; __NAND_DEVICE_COMMAND((*nand_device_command)); - int (*register_commands)(struct command_context_s *cmd_ctx); + int (*register_commands)(struct command_context *cmd_ctx); int (*init)(struct nand_device *nand); int (*reset)(struct nand_device *nand); int (*command)(struct nand_device *nand, uint8_t command); @@ -226,11 +226,11 @@ int nand_calculate_ecc(struct nand_device *nand, int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code); -int nand_register_commands(struct command_context_s *cmd_ctx); -int nand_init(struct command_context_s *cmd_ctx); +int nand_register_commands(struct command_context *cmd_ctx); +int nand_init(struct command_context *cmd_ctx); /// helper for parsing a nand device command argument string -int nand_command_get_device_by_num(struct command_context_s *cmd_ctx, +int nand_command_get_device_by_num(struct command_context *cmd_ctx, const char *str, struct nand_device **nand); diff --git a/src/flash/orion_nand.c b/src/flash/orion_nand.c index 0d4e1ea..4235b08 100644 --- a/src/flash/orion_nand.c +++ b/src/flash/orion_nand.c @@ -120,7 +120,7 @@ static int orion_nand_controller_ready(struct nand_device *nand, int timeout) return 1; } -static int orion_nand_register_commands(struct command_context_s *cmd_ctx) +static int orion_nand_register_commands(struct command_context *cmd_ctx) { return ERROR_OK; } diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index e19ee95..bb3d69c 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -883,7 +883,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) return ERROR_OK; } -static int pic32mx_register_commands(struct command_context_s *cmd_ctx) +static int pic32mx_register_commands(struct command_context *cmd_ctx) { command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", NULL, COMMAND_ANY, "pic32mx flash specific commands"); diff --git a/src/flash/s3c24xx_nand.c b/src/flash/s3c24xx_nand.c index 5b2d191..75b8700 100644 --- a/src/flash/s3c24xx_nand.c +++ b/src/flash/s3c24xx_nand.c @@ -52,7 +52,7 @@ S3C24XX_DEVICE_COMMAND() return ERROR_OK; } -int s3c24xx_register_commands(struct command_context_s *cmd_ctx) +int s3c24xx_register_commands(struct command_context *cmd_ctx) { return ERROR_OK; } diff --git a/src/flash/s3c24xx_nand.h b/src/flash/s3c24xx_nand.h index 41c95f5..4829c7c 100644 --- a/src/flash/s3c24xx_nand.h +++ b/src/flash/s3c24xx_nand.h @@ -59,7 +59,7 @@ S3C24XX_DEVICE_COMMAND(); return retval; \ } while (0) -int s3c24xx_register_commands(struct command_context_s *cmd_ctx); +int s3c24xx_register_commands(struct command_context *cmd_ctx); int s3c24xx_reset(struct nand_device *nand); diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index efda859..910d047 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -1160,7 +1160,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) return ERROR_OK; } -static int stellaris_register_commands(struct command_context_s *cmd_ctx) +static int stellaris_register_commands(struct command_context *cmd_ctx) { command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", NULL, COMMAND_ANY, "stellaris flash specific commands"); diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index cf842fc..abbf6cb 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -1181,7 +1181,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command) return ERROR_OK; } -static int stm32x_register_commands(struct command_context_s *cmd_ctx) +static int stm32x_register_commands(struct command_context *cmd_ctx) { command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", NULL, COMMAND_ANY, "stm32x flash specific commands"); diff --git a/src/flash/str7x.c b/src/flash/str7x.c index fa23550..8307013 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -671,7 +671,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) return ERROR_OK; } -static int str7x_register_commands(struct command_context_s *cmd_ctx) +static int str7x_register_commands(struct command_context *cmd_ctx) { command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", NULL, COMMAND_ANY, "str7x flash specific commands"); diff --git a/src/flash/str9x.c b/src/flash/str9x.c index b3e8dff..a06bd1e 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -675,7 +675,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command) return ERROR_OK; } -static int str9x_register_commands(struct command_context_s *cmd_ctx) +static int str9x_register_commands(struct command_context *cmd_ctx) { command_t *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", NULL, COMMAND_ANY, "str9x flash commands"); diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 6c42ce3..03a8ea2 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -1163,7 +1163,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) return ERROR_OK; } -static int str9xpec_register_commands(struct command_context_s *cmd_ctx) +static int str9xpec_register_commands(struct command_context *cmd_ctx) { command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", NULL, COMMAND_ANY, "str9xpec flash specific commands"); diff --git a/src/flash/tms470.c b/src/flash/tms470.c index 6e1516f..a5f2f36 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -817,7 +817,7 @@ static int tms470_erase_sector(struct flash_bank *bank, int sector) Implementation of Flash Driver Interfaces ---------------------------------------------------------------------- */ -static int tms470_register_commands(struct command_context_s *cmd_ctx) +static int tms470_register_commands(struct command_context *cmd_ctx) { command_t *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family"); diff --git a/src/hello.c b/src/hello.c index 8a4f701..267cc28 100644 --- a/src/hello.c +++ b/src/hello.c @@ -48,7 +48,7 @@ COMMAND_HANDLER(handle_hello_command) return retval; } -int hello_register_commands(struct command_context_s *cmd_ctx) +int hello_register_commands(struct command_context *cmd_ctx) { struct command_s *cmd = register_command(cmd_ctx, NULL, "hello", &handle_hello_command, COMMAND_ANY, diff --git a/src/helper/command.c b/src/helper/command.c index 3cd11d2..60a4a26 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -47,7 +47,7 @@ int fast_and_dangerous = 0; Jim_Interp *interp = NULL; -static int run_command(command_context_t *context, +static int run_command(struct command_context *context, command_t *c, const char *words[], unsigned num_words); static void tcl_output(void *privData, const char *file, unsigned line, @@ -57,7 +57,7 @@ static void tcl_output(void *privData, const char *file, unsigned line, Jim_AppendString(interp, tclOutput, string, strlen(string)); } -extern command_context_t *global_cmd_ctx; +extern struct command_context *global_cmd_ctx; void script_debug(Jim_Interp *interp, const char *name, unsigned argc, Jim_Obj *const *argv) @@ -80,7 +80,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { /* the private data is stashed in the interp structure */ command_t *c; - command_context_t *context; + struct command_context *context; int retval; int i; int nwords; @@ -226,7 +226,7 @@ static void command_add_child(struct command_s **head, struct command_s *c) cc->next = c; } -command_t* register_command(command_context_t *context, +command_t* register_command(struct command_context *context, command_t *parent, char *name, command_handler_t handler, enum command_mode mode, char *help) { @@ -274,7 +274,7 @@ command_t* register_command(command_context_t *context, return c; } -int unregister_all_commands(command_context_t *context) +int unregister_all_commands(struct command_context *context) { command_t *c, *c2; @@ -306,7 +306,7 @@ int unregister_all_commands(command_context_t *context) return ERROR_OK; } -int unregister_command(command_context_t *context, char *name) +int unregister_command(struct command_context *context, char *name) { command_t *c, *p = NULL, *c2; @@ -358,14 +358,14 @@ int unregister_command(command_context_t *context, char *name) return ERROR_OK; } -void command_output_text(command_context_t *context, const char *data) +void command_output_text(struct command_context *context, const char *data) { if (context && context->output_handler && data) { context->output_handler(context, data); } } -void command_print_sameline(command_context_t *context, const char *format, ...) +void command_print_sameline(struct command_context *context, const char *format, ...) { char *string; @@ -389,7 +389,7 @@ void command_print_sameline(command_context_t *context, const char *format, ...) va_end(ap); } -void command_print(command_context_t *context, const char *format, ...) +void command_print(struct command_context *context, const char *format, ...) { char *string; @@ -436,7 +436,7 @@ char *command_name(struct command_s *c, char delim) return __command_name(c, delim, 0); } -static int run_command(command_context_t *context, +static int run_command(struct command_context *context, command_t *c, const char *words[], unsigned num_words) { int start_word = 0; @@ -475,7 +475,7 @@ static int run_command(command_context_t *context, return retval; } -int command_run_line(command_context_t *context, char *line) +int command_run_line(struct command_context *context, char *line) { /* all the parent commands have been registered with the interpreter * so, can just evaluate the line as a script and check for @@ -545,7 +545,7 @@ int command_run_line(command_context_t *context, char *line) return retval; } -int command_run_linef(command_context_t *context, const char *format, ...) +int command_run_linef(struct command_context *context, const char *format, ...) { int retval = ERROR_FAIL; char *string; @@ -560,23 +560,23 @@ int command_run_linef(command_context_t *context, const char *format, ...) return retval; } -void command_set_output_handler(command_context_t* context, +void command_set_output_handler(struct command_context* context, command_output_handler_t output_handler, void *priv) { context->output_handler = output_handler; context->output_handler_priv = priv; } -command_context_t* copy_command_context(command_context_t* context) +struct command_context* copy_command_context(struct command_context* context) { - command_context_t* copy_context = malloc(sizeof(command_context_t)); + struct command_context* copy_context = malloc(sizeof(struct command_context)); *copy_context = *context; return copy_context; } -int command_done(command_context_t *context) +int command_done(struct command_context *context) { free(context); context = NULL; @@ -764,9 +764,9 @@ COMMAND_HANDLER(handle_fast_command) } -command_context_t* command_init() +struct command_context* command_init() { - command_context_t* context = malloc(sizeof(command_context_t)); + struct command_context* context = malloc(sizeof(struct command_context)); extern const char startup_tcl[]; const char *HostOs; @@ -846,7 +846,7 @@ command_context_t* command_init() return context; } -int command_context_mode(command_context_t *cmd_ctx, enum command_mode mode) +int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode) { if (!cmd_ctx) return ERROR_INVALID_ARGUMENTS; @@ -869,7 +869,7 @@ void process_jim_events(void) #endif } -void register_jim(struct command_context_s *cmd_ctx, const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj *const *argv), const char *help) +void register_jim(struct command_context *cmd_ctx, const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj *const *argv), const char *help) { Jim_CreateCommand(interp, name, cmd, NULL, NULL); diff --git a/src/helper/command.h b/src/helper/command.h index bddb053..169852e 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -51,13 +51,13 @@ enum command_mode COMMAND_ANY, }; -struct command_context_s; +struct command_context; /// The type signature for command context's output handler. -typedef int (*command_output_handler_t)(struct command_context_s *context, +typedef int (*command_output_handler_t)(struct command_context *context, const char* line); -typedef struct command_context_s +struct command_context { enum command_mode mode; struct command_s *commands; @@ -78,7 +78,7 @@ typedef struct command_context_s */ command_output_handler_t output_handler; void *output_handler_priv; -} command_context_t; +}; /** @@ -87,7 +87,7 @@ typedef struct command_context_s * defining all such derivative types using this macro. */ #define __COMMAND_HANDLER(name, extra...) \ - int name(struct command_context_s *cmd_ctx, \ + int name(struct command_context *cmd_ctx, \ const char *args[], unsigned argc, ##extra) /** @@ -151,31 +151,31 @@ typedef struct command_s */ char *command_name(struct command_s *c, char delim); -command_t* register_command(command_context_t *context, +command_t* register_command(struct command_context *context, command_t *parent, char *name, command_handler_t handler, enum command_mode mode, char *help); -int unregister_command(command_context_t *context, char *name); -int unregister_all_commands(command_context_t *context); +int unregister_command(struct command_context *context, char *name); +int unregister_all_commands(struct command_context *context); -void command_set_output_handler(command_context_t* context, +void command_set_output_handler(struct command_context* context, command_output_handler_t output_handler, void *priv); -command_context_t* copy_command_context(command_context_t* context); +struct command_context* copy_command_context(struct command_context* context); -int command_context_mode(command_context_t *context, enum command_mode mode); +int command_context_mode(struct command_context *context, enum command_mode mode); -command_context_t* command_init(void); -int command_done(command_context_t *context); +struct command_context* command_init(void); +int command_done(struct command_context *context); -void command_print(command_context_t *context, const char *format, ...) +void command_print(struct command_context *context, const char *format, ...) __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3))); -void command_print_sameline(command_context_t *context, const char *format, ...) +void command_print_sameline(struct command_context *context, const char *format, ...) __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3))); -int command_run_line(command_context_t *context, char *line); -int command_run_linef(command_context_t *context, const char *format, ...) +int command_run_line(struct command_context *context, char *line); +int command_run_linef(struct command_context *context, const char *format, ...) __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3))); -void command_output_text(command_context_t *context, const char *data); +void command_output_text(struct command_context *context, const char *data); void process_jim_events(void); @@ -190,7 +190,7 @@ extern int fast_and_dangerous; extern Jim_Interp *interp; -void register_jim(command_context_t *context, const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj *const *argv), const char *help); +void register_jim(struct command_context *context, const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj *const *argv), const char *help); long jim_global_long(const char *variable); diff --git a/src/helper/configuration.c b/src/helper/configuration.c index 3c44d6d..1f7240d 100644 --- a/src/helper/configuration.c +++ b/src/helper/configuration.c @@ -103,7 +103,7 @@ FILE *open_file_from_path (char *file, char *mode) } } -int parse_config_file(struct command_context_s *cmd_ctx) +int parse_config_file(struct command_context *cmd_ctx) { int retval; char **cfg; diff --git a/src/helper/configuration.h b/src/helper/configuration.h index 5d60148..9b77a25 100644 --- a/src/helper/configuration.h +++ b/src/helper/configuration.h @@ -25,15 +25,15 @@ #include "command.h" -int parse_cmdline_args(struct command_context_s *cmd_ctx, +int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[]); -int parse_config_file(struct command_context_s *cmd_ctx); +int parse_config_file(struct command_context *cmd_ctx); void add_config_command(const char *cfg); void add_script_search_dir(const char *dir); -int configuration_output_handler(struct command_context_s *cmd_ctx, +int configuration_output_handler(struct command_context *cmd_ctx, const char *line); FILE *open_file_from_path(char *file, char *mode); diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 3a62961..a9474a6 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -645,7 +645,7 @@ static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc, -int ioutil_init(struct command_context_s *cmd_ctx) +int ioutil_init(struct command_context *cmd_ctx) { register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY, "remove file"); diff --git a/src/helper/log.c b/src/helper/log.c index 1724bec..c690654 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -317,7 +317,7 @@ COMMAND_HANDLER(handle_log_output_command) return ERROR_OK; } -int log_register_commands(struct command_context_s *cmd_ctx) +int log_register_commands(struct command_context *cmd_ctx) { start = timeval_ms(); register_command(cmd_ctx, NULL, "log_output", handle_log_output_command, @@ -328,7 +328,7 @@ int log_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -int log_init(struct command_context_s *cmd_ctx) +int log_init(struct command_context *cmd_ctx) { /* set defaults for daemon configuration, ... [truncated message content] |
From: Zach W. <zw...@us...> - 2009-11-13 21:25:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d16968e24f5d9e436ae4e136cd27652c4c948203 (commit) via 96b62996d2d81b09a48bf253bc9e60e637f687bd (commit) via 2f6e56e38320350bb300b363d0b3737fa8d1f3ea (commit) via 0f1163e823c6ca3c2a81fa296157f5dde0635fea (commit) via d0dee7ccafcf87259fadf6c5de43df8583b0e885 (commit) via ac927559c3ce5406adac34b9d4ca4ecb37a48181 (commit) via d64a873db44258470b50f370f2c8af71157952d0 (commit) via dfecfd5fd471708ac15af08b52964e8f8da9f4be (commit) via af949b2531d2a8863d077025db40cbb170d13a63 (commit) via d0c19e0a9d51211953a363026c662d290542fe85 (commit) via 6421c2075c733d18b7fc9daed847c135b98230b7 (commit) via 4952eadd8f04ca3755c30013abc3ea85e35d8654 (commit) via d90063ffc54ea042c0ff37e6cec1e95848bf1e26 (commit) via 2ec440588fa455e4609bae3d7fc146bf53f1bbab (commit) via cdd2d9c2d0dee319ba5d2f419ac78aa6490bb74b (commit) via d727f978897105ceacfed06da0152b4b4dfffc3d (commit) via 42fb6b88764fb39fd07726d7bb447a79c3951aa4 (commit) via 53c05c8b1d5718b2acf5dbe0eb517dd427340041 (commit) via 1e51cf049cfed3bc42a748d848210f8e4b472282 (commit) via e76d085603c36efddd9b38cc7383f86ee399177c (commit) via abd7b404086d3c63b163a5ffa786f3538714b7d9 (commit) via 55edfdf2ab6c5d1d6cd4c1c97a79cbb1d39b1f22 (commit) via 22f6a4cef5b4bf6696a7ea0fa41fafc3da06c9fa (commit) via 18475360b253e52eae7d070421523d5d7636383d (commit) via 1f87cf4e804812c81279cc7bcb0fcb86aa2bf48f (commit) via ea34dc988f63ffa1a9ba9e592a65f2f46e78f82a (commit) via 73ad5cbb1a6d60ee2209ad9faadd19df0295942a (commit) via 151347585a48ef746d8ffbfed7ba9bd621737b0c (commit) via 93459582fd340e4f63efed0fab9abd49a2cb6373 (commit) via 2d5767201b8b748b85d6aceb7dd93965e25bd00b (commit) via 46fc1d57ac9462fd788277609707a379c7a406cb (commit) via c2b5d8a6fa72ce6b0fed1e612d4fe5e4b54ba45a (commit) via 74d09617b927ed7011098d5a65087dee1ef1e87a (commit) via de3fb2f3bce2de5be44223204ce368216ed85b0f (commit) via f4e03e3b902104f5cf8aab1ea3cd5db2bb36890e (commit) via b87f07110a42981aa53bb6f824d29216658dafc4 (commit) via a8141cafdef162d52e128cd2ab51702b9800fda2 (commit) via ccde06a08fbf9c4f57b321dbec0509f73239c2de (commit) via 3b7aee21b50f4bd0014878f29129ac33812faea3 (commit) via 1bd7a78d92e06fcd403c915f0e9d3ecdbcc8305d (commit) via ef36a7fb3b87bddc14ad9c5d98fde1d041a0de2d (commit) via b154972bdbcbda1ae8e05271c0db556fade8dbef (commit) via 1a4ff43a7ce4463e7b37f893ca185b055ec6fa9d (commit) via a87faf5b66fabb03cdf15a54185f15b91da779c2 (commit) via 24df46d0676630c90f04ee49b96533f5fddca6cd (commit) via 99614219ad111c124ea5d5f997bb388cbcf00e32 (commit) via e2001ba2116fe5c0c75f7953b5fbe35da65fa29d (commit) via 63242c6d45570ca32fd569a71b5ecea522f839ea (commit) via 01f9dc18fcce8d5a0e02e56822d580da81570fdc (commit) via 2f7fc2921d5769799f1bd527b49a7a877b4c8fa0 (commit) via 26a99ed740f4071c9eebba10f7f597844812fc13 (commit) via a1971ecacf6450aa57192680fc201928deb46b7d (commit) via 72b421418f315cb54a01ba4d249082f989d5154a (commit) via e7f65c5a116802c4e510fe212b26e9a020de0b3e (commit) via 4bc80e5a65dde09ca795e50e77bcfe77b8dd444f (commit) via 94f5ed90f1832e81803713f4364de586a69247d4 (commit) via 5e43565ab543b1ceff4cc8030434a54ac28dd875 (commit) via e8a6e3b2f4e1b0f3cccfa01c486fbdd952842801 (commit) via 2744a031cb333f4d1c2cd81171cbdafd6c780e1d (commit) via 5415d07139faeb2541127d5a7bcedef833b79de3 (commit) via 248448ee3a5f4f97307f1d5af4ef940529478a34 (commit) via f6dae0cf84de26846a18f3fcaea842ccd898a5c1 (commit) via 405a5df7860bf9c0465fce4ac517083a1f9c4a4b (commit) via e976786d55c367ec5b867baffb055b06bbda6ea0 (commit) via 2dd9c5e1da3a7e9152e7ca45fefc73363b509d5a (commit) via 15e8e4530866454c18c5d91ad9e867f339c2e82b (commit) via 056fcdb540f0ab9a404f3b5de72fd707eb146603 (commit) via c25e00b52810822108b54ac40dffadba62ef48d9 (commit) via 7de3c44320af79e5d666e5a4cb4a669f5ecb8eb5 (commit) via f9e091a2d3841d4b5e2f49f3b4337261974b2f2c (commit) via 67f2f8393742bd88017b54ae0cfd833265bb1517 (commit) via f96d6054e65708e7abdceac673f1a18fec3204b6 (commit) via 6ba48a1b44d34e445af17ae66efb7e168f911a0f (commit) via 785115a6a0a850f24f01fb385757a331eea9f093 (commit) via 1ad4ee2deb5a888cb9f9b825a0e4fbfa68aa1218 (commit) via 5f68f45186c1fe73e1c83bd5847edd6bfaf06b34 (commit) via 16487e70856a72f9cbe174c7d7d2fb6a1f258100 (commit) via b174a0d75ec81fbcd075c8c8d7f915e4a3d76bc3 (commit) via 8e77975b92a75d392727339eccd6cc7898628ebb (commit) via 8012b3963fc49c7edf87f31a93bc0039095f5b59 (commit) via bcb18b2044e9a9b812f8e0d390ed903f74524586 (commit) via f3b3752a9eebae273da6580c182e9d1486e41ed9 (commit) via 3bcd9ad9d017649038be26fad5440e507db2118d (commit) via 55926f576f99a0c67b2836fedf0dc1bfc1260428 (commit) via 0eae94879d85a7a402c890bda66efdeffde6f1c7 (commit) via b1de5eb9a074b362e953e857c42cac9a9b18b2a3 (commit) via 6c965a3da9cd6f5b2cf1b177d38723356c83d923 (commit) via 996613522df32870b23e68d8d63e523908694598 (commit) via 52bc6cad87c2ae0558ec5b3539fecad15b75b008 (commit) via ea49f2e3ff55268faeff6e1603d86025873320ed (commit) via 95bf461c0af385fc6b3abfff610e5510534ef571 (commit) via db08ab8a792a09399d2ffe362f580683ff102707 (commit) via cd4c0598060dc6539604c9cad8cb645aa14b4ab1 (commit) via db2086897a581111bb86a0fb49d72b776a9801a9 (commit) via 38d826cec18902f719439903838ebb612575d05d (commit) via f7cd2aa0ef2939f7d3df5f4a86f5e777a27dbd37 (commit) via f2cbaba3cc4af99db7b4f2682c2e0dd4467655e3 (commit) via 8775a0f6638d966b6ef135b488da6efb954e2573 (commit) via e01a0be57655683c58e9dd5e66ee30fe3049e8d9 (commit) via 45a165a432eae2eb74b97ec5196736a352923a12 (commit) via 53bfd73591037044b391dd9a849e77284a7932d1 (commit) via 43483e5054c78e0fdfaebed5e14c14246af07c97 (commit) via a03c9a8dce92d0df0e995e348edfa1b3ea952f45 (commit) via 6a374afe71ad947970b5d5bb14fa4b4c856ebfc8 (commit) via 3c9afaa6454879a48d684338041250f2a1165c93 (commit) via 54be77bc79ce05cd1ce4320958d8ce9d131aea09 (commit) via d0dfec33b6d6844c3c1b817a464b9f040ce40087 (commit) via 92fc7a6fdecac39ebc890ee3c2ae91f3fd50fdc5 (commit) via 6aa82891b60dc4a332ac548c13fc8d207bf171b0 (commit) via 774d71f2cf7bce27a01424fad360cbadebf20459 (commit) via 3b09560ae8db9685f03b358709fc63d1bb545628 (commit) via 01b10d65bfcc6eb9a3994b20b1342389edda2df0 (commit) via c7b2cad52dbc59b53d6f1734a443d3ad5e826a42 (commit) via 40273967bf535aefb3eaec9367c50e7799b079bb (commit) via 9059f9f28e4d88c9608ef92723bbd493e106ba67 (commit) via ed9c4ef3c41ac21d0a08cb7e07ab68d0c7930138 (commit) via eba5608b5227696e00437543c0226ed04cae12d5 (commit) via 5948e66ee8f2331606c2adce439c5d7ebc77d51f (commit) via c7b96a4dc106fc28808f9503d15803e942b941a0 (commit) via 958ff04b086d60e901bfd9c05cf7b4e3e5af641a (commit) via f7ca04721300da7ddd4031885e98f3138825ccd1 (commit) via 8f4860d13f03c40b28bb32e9cb0f1d650e200ce9 (commit) via 86053523875d18151f3dd0b53bf30e07eec2acf2 (commit) via 4bc46d61cade59a43d158862dfbe738255f00a81 (commit) via 79338ec6c208fc34d2c16d109dea6bf5ae20f860 (commit) via bb6b9988cbd32f5f87e228340172aa1004775df2 (commit) via fc01dd6a13167c33491b9ccc1543d34b2e485c32 (commit) via a043632a529c0b98bb8771c8815e7681e4ed0f12 (commit) via ed1aed8dd9f282fe7a948676453054c15d8ebd4e (commit) via b712a4e8b85f3b351f2af93d0988d9983e57d6fe (commit) via 12f83f0429a84168f8761a575a12c703025dd598 (commit) via a15d4cc75eb7bae55db5f6a156cd15918d574688 (commit) via 632fd663a821047df9a9b965ec1c35d6b034ebba (commit) via fb59ec739a3ae79937020dc2fe5413be0e73e8d3 (commit) via 98d7ed8523f4324b21963d6b15391df91680a658 (commit) via de1781b7fa5aa73ba4c74dcc14e449acb44182ec (commit) via 453a103f48242b2b48031c7d268782df0347f81f (commit) via 4c28cc68edfb6a3ced1e31fae8a91fbbbc2f02cf (commit) via 0139e7d51abfba861ff9d3c8c1bc1b12e79c696a (commit) via 2ded74115d2b1dcea5a1c1a327a0da159cf1b962 (commit) via 1f328f2885f370aa9f79d2ed08515821bc8d856a (commit) via 3be0edbc5e5b121caee3ebdf987f5e9c47d4257e (commit) via a7a8a1c9e2e86902a3a5864cd257e01e0b3f6da6 (commit) via 6ca63ee756ea0772a60760da37867ca982b0b049 (commit) via 3877201581c96a02d0e49b74050272ae77753cf1 (commit) via 246068fd8985b293d7109058f83c57f6c22a4336 (commit) via 1053c32d9ecc95ce946bbbf49cccfe800881f9aa (commit) via 22b220ad7f42ea288b1762692d079ecbde10ba24 (commit) via cf2e402d71fa39dc8138985027b7ab8f4d510e81 (commit) via 8cc8c0544f3f24772d6644df16d5a70d4ffe8b4a (commit) via 2fecae46f62ca98657d650de9fc73d44247971e8 (commit) via 5f6d8ecf8c2cf1427a8677155843081d07ff57c4 (commit) via c07f0600ff3c77a00efaf4bdcd4dc3691f0421f6 (commit) via af3f4a0bbefd796bd40602ae28f66dd373272e6a (commit) via e11c5a3b42a2a39c5b24c9a19ba03f7b16caf3d7 (commit) via 2ddeec9db5a8771c948294b7194778a95295b7a0 (commit) via 4a29f8e21d4932ddf6523ccf23463d8636ad05a9 (commit) via 7c0ba75eae7162147e7cb6e55fa709f014f2abf4 (commit) via ffc77b61ddb4407f6c6dcd6188a07d5c630a2780 (commit) via a3f1c87eb72a8c91c54999e04349253159c1bdfd (commit) via 4bc155398e88c9cc4393e4113496d088b7ff7ab0 (commit) via 9036fdd589b20f7a5f2757a1ad01ca7e47a68fab (commit) via e1c26950c03b09efe42b8a25dd83f1e50e22a507 (commit) via 8bbb279c2820e8d0b3c95e0de0289be933ccea92 (commit) via 5874d5f2ea2ef9bd7d759d47ed868269ba99ab65 (commit) via 363d72a48457e03d2ffdbf9154b8ba3fdb9197d0 (commit) via 9f535f9af7c6b7e8843033049a6da0f6d76d513b (commit) via bee796b5b07a0f83ed0ad2360bad70d8409e1109 (commit) via c20b779b891f9d0fd031880841b269fbe8582579 (commit) via ff3150922b676223ad1acc4bcd127aa9fe03fa31 (commit) via d0809ac060b35a04e7f0bceb96e1868663bd18df (commit) via 42ef503d37b18d907da16d26e99167566d5aabd1 (commit) via 9f212b01be20da43ba534ad33b20419779c89335 (commit) via f59ec2043b840a4534fdd61502de59e2571988d5 (commit) from 99b57b6dccec1059f746121b9b9ddb11313f708b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d16968e24f5d9e436ae4e136cd27652c4c948203 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 12:19:39 2009 -0800 remove rlink structure typedefs Remove useless typedefs from the rlink driver. Improve whitespace. diff --git a/src/jtag/rlink/rlink.c b/src/jtag/rlink/rlink.c index bc35457..9dd8b88 100644 --- a/src/jtag/rlink/rlink.c +++ b/src/jtag/rlink/rlink.c @@ -576,8 +576,7 @@ dtc_run_download( * The dtc reply queue is a singly linked list that describes what to do with the reply packet that comes from the DTC. Only SCAN_IN and SCAN_IO generate these entries. */ -typedef -struct dtc_reply_queue_entry_s { +struct dtc_reply_queue_entry { struct dtc_reply_queue_entry_s *next; jtag_command_t *cmd; /* the command that resulted in this entry */ @@ -588,7 +587,7 @@ struct dtc_reply_queue_entry_s { int length; /* how many bits are processed in this operation? */ enum scan_type type; /* SCAN_IN/SCAN_OUT/SCAN_IO */ } scan; -} dtc_reply_queue_entry_t; +}; /* @@ -598,8 +597,8 @@ struct dtc_reply_queue_entry_s { static struct { - dtc_reply_queue_entry_t *rq_head; - dtc_reply_queue_entry_t *rq_tail; + struct dtc_reply_queue_entry *rq_head; + struct dtc_reply_queue_entry *rq_tail; uint32_t cmd_index; uint32_t reply_index; uint8_t cmd_buffer[USB_EP2BANK_SIZE]; @@ -631,7 +630,7 @@ dtc_queue_init(void) { static inline -dtc_reply_queue_entry_t * +struct dtc_reply_queue_entry * dtc_queue_enqueue_reply( enum scan_type type, uint8_t *buffer, @@ -640,9 +639,9 @@ dtc_queue_enqueue_reply( int length, jtag_command_t *cmd ) { - dtc_reply_queue_entry_t *rq_entry; + struct dtc_reply_queue_entry *rq_entry; - rq_entry = malloc(sizeof(dtc_reply_queue_entry_t)); + rq_entry = malloc(sizeof(struct dtc_reply_queue_entry)); if (rq_entry != NULL) { rq_entry->scan.type = type; rq_entry->scan.buffer = buffer; @@ -672,7 +671,7 @@ dtc_queue_enqueue_reply( static int dtc_queue_run(void) { - dtc_reply_queue_entry_t *rq_p, *rq_next; + struct dtc_reply_queue_entry *rq_p, *rq_next; int retval; int usb_err; int bit_cnt; diff --git a/src/jtag/rlink/rlink.h b/src/jtag/rlink/rlink.h index 6bab26e..b53be5c 100644 --- a/src/jtag/rlink/rlink.h +++ b/src/jtag/rlink/rlink.h @@ -20,13 +20,12 @@ #include "types.h" -typedef -struct rlink_speed_table_s { - uint8_t const *dtc; - uint16_t dtc_size; - uint16_t khz; - uint8_t prescaler; -} rlink_speed_table_t; +struct rlink_speed_table { + uint8_t const *dtc; + uint16_t dtc_size; + uint16_t khz; + uint8_t prescaler; +}; -extern const rlink_speed_table_t rlink_speed_table[]; -extern const size_t rlink_speed_table_size; +extern const struct rlink_speed_table rlink_speed_table[]; +extern const size_t rlink_speed_table_size; diff --git a/src/jtag/rlink/rlink_speed_table.c b/src/jtag/rlink/rlink_speed_table.c index 1f3e973..5c40ab4 100644 --- a/src/jtag/rlink/rlink_speed_table.c +++ b/src/jtag/rlink/rlink_speed_table.c @@ -87,7 +87,7 @@ static const uint8_t dtc_2[] = { 36, 139, 112, 193, 151, 96 }; -const rlink_speed_table_t rlink_speed_table[] = {{ +const struct rlink_speed_table rlink_speed_table[] = {{ dtc_64, sizeof(dtc_64), (ST7_FOSC * 2) / (1000 * 64), 64 }, { dtc_11, sizeof(dtc_11), (ST7_FOSC * 2) / (1000 * 11), 11 commit 96b62996d2d81b09a48bf253bc9e60e637f687bd Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 11:32:28 2009 -0800 flash_bank_t -> struct flash_bank Remove misleading typedef and redundant suffix from struct flash_bank. diff --git a/src/flash/aduc702x.c b/src/flash/aduc702x.c index 76f38b5..c2a1884 100644 --- a/src/flash/aduc702x.c +++ b/src/flash/aduc702x.c @@ -29,7 +29,7 @@ #include "time_support.h" -static int aduc702x_build_sector_list(struct flash_bank_s *bank); +static int aduc702x_build_sector_list(struct flash_bank *bank); static int aduc702x_check_flash_completion(struct target* target, unsigned int timeout_ms); static int aduc702x_set_write_enable(struct target *target, int enable); @@ -64,9 +64,9 @@ FLASH_BANK_COMMAND_HANDLER(aduc702x_flash_bank_command) return ERROR_OK; } -static int aduc702x_build_sector_list(struct flash_bank_s *bank) +static int aduc702x_build_sector_list(struct flash_bank *bank) { - //aduc7026_flash_bank_t *aduc7026_info = bank->driver_priv; + //aduc7026_struct flash_bank *aduc7026_info = bank->driver_priv; int i = 0; uint32_t offset = 0; @@ -86,13 +86,13 @@ static int aduc702x_build_sector_list(struct flash_bank_s *bank) return ERROR_OK; } -static int aduc702x_protect_check(struct flash_bank_s *bank) +static int aduc702x_protect_check(struct flash_bank *bank) { printf("aduc702x_protect_check not implemented yet.\n"); return ERROR_OK; } -static int aduc702x_erase(struct flash_bank_s *bank, int first, int last) +static int aduc702x_erase(struct flash_bank *bank, int first, int last) { //int res; int x; @@ -145,7 +145,7 @@ static int aduc702x_erase(struct flash_bank_s *bank, int first, int last) return ERROR_OK; } -static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last) +static int aduc702x_protect(struct flash_bank *bank, int set, int first, int last) { printf("aduc702x_protect not implemented yet.\n"); return ERROR_FLASH_OPERATION_FAILED; @@ -156,7 +156,7 @@ static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int l * * Caller should not check for other return values specifically */ -static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct aduc702x_flash_bank *aduc702x_info = bank->driver_priv; struct target *target = bank->target; @@ -301,7 +301,7 @@ static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint /* All-JTAG, single-access method. Very slow. Used only if there is no * working area available. */ -static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { uint32_t x; uint8_t b; @@ -342,7 +342,7 @@ static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uin return ERROR_OK; } -int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { int retval; @@ -366,12 +366,12 @@ int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, return retval; } -static int aduc702x_probe(struct flash_bank_s *bank) +static int aduc702x_probe(struct flash_bank *bank) { return ERROR_OK; } -static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int aduc702x_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "aduc702x flash driver info"); return ERROR_OK; diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 3caf96c..b756e48 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -175,7 +175,7 @@ struct sam3_bank_private { // so we can find the chip we belong to struct sam3_chip *pChip; // so we can find the orginal bank pointer - flash_bank_t *pBank; + struct flash_bank *pBank; unsigned bank_number; uint32_t controller_address; uint32_t base_address; @@ -1456,7 +1456,7 @@ static const struct sam3_reg_list sam3_all_regs[] = { static struct sam3_bank_private * -get_sam3_bank_private(flash_bank_t *bank) +get_sam3_bank_private(struct flash_bank *bank) { return (struct sam3_bank_private *)(bank->driver_priv); } @@ -1582,7 +1582,7 @@ sam3_GetInfo(struct sam3_chip *pChip) static int -sam3_erase_check(struct flash_bank_s *bank) +sam3_erase_check(struct flash_bank *bank) { int x; @@ -1606,7 +1606,7 @@ sam3_erase_check(struct flash_bank_s *bank) } static int -sam3_protect_check(struct flash_bank_s *bank) +sam3_protect_check(struct flash_bank *bank) { int r; uint32_t v=0; @@ -1709,7 +1709,7 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate) const struct sam3_chip_details *pDetails; struct sam3_chip *pChip; void *vp; - flash_bank_t *saved_banks[SAM3_MAX_FLASH_BANKS]; + struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS]; unsigned x; const char *cp; @@ -1777,7 +1777,7 @@ sam3_GetDetails(struct sam3_bank_private *pPrivate) static int -_sam3_probe(struct flash_bank_s *bank, int noise) +_sam3_probe(struct flash_bank *bank, int noise) { unsigned x; int r; @@ -1861,13 +1861,13 @@ _sam3_probe(struct flash_bank_s *bank, int noise) } static int -sam3_probe(struct flash_bank_s *bank) +sam3_probe(struct flash_bank *bank) { return _sam3_probe(bank, 1); } static int -sam3_auto_probe(struct flash_bank_s *bank) +sam3_auto_probe(struct flash_bank *bank) { return _sam3_probe(bank, 0); } @@ -1875,7 +1875,7 @@ sam3_auto_probe(struct flash_bank_s *bank) static int -sam3_erase(struct flash_bank_s *bank, int first, int last) +sam3_erase(struct flash_bank *bank, int first, int last) { struct sam3_bank_private *pPrivate; int r; @@ -1907,7 +1907,7 @@ sam3_erase(struct flash_bank_s *bank, int first, int last) } static int -sam3_protect(struct flash_bank_s *bank, int set, int first, int last) +sam3_protect(struct flash_bank *bank, int set, int first, int last) { struct sam3_bank_private *pPrivate; int r; @@ -1936,7 +1936,7 @@ sam3_protect(struct flash_bank_s *bank, int set, int first, int last) static int -sam3_info(flash_bank_t *bank, char *buf, int buf_size) +sam3_info(struct flash_bank *bank, char *buf, int buf_size) { if (bank->target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); @@ -2104,7 +2104,7 @@ sam3_page_write(struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *b static int -sam3_write(struct flash_bank_s *bank, +sam3_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 6c98953..8f870bc 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -52,13 +52,13 @@ #include "at91sam7.h" #include "binarybuffer.h" -static int at91sam7_protect_check(struct flash_bank_s *bank); -static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); +static int at91sam7_protect_check(struct flash_bank *bank); +static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count); static uint32_t at91sam7_get_flash_status(struct target *target, int bank_number); -static void at91sam7_set_flash_mode(struct flash_bank_s *bank, int mode); -static uint32_t at91sam7_wait_status_busy(struct flash_bank_s *bank, uint32_t waitbits, int timeout); -static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen); +static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode); +static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout); +static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen); static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 }; static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 }; @@ -97,7 +97,7 @@ static uint32_t at91sam7_get_flash_status(struct target *target, int bank_number } /* Read clock configuration and set at91sam7_info->mck_freq */ -static void at91sam7_read_clock_info(flash_bank_t *bank) +static void at91sam7_read_clock_info(struct flash_bank *bank) { struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; struct target *target = bank->target; @@ -176,7 +176,7 @@ static void at91sam7_read_clock_info(flash_bank_t *bank) } /* Setup the timimg registers for nvbits or normal flash */ -static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode) +static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode) { uint32_t fmr, fmcn = 0, fws = 0; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; @@ -224,7 +224,7 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode) at91sam7_info->flashmode = mode; } -static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout) +static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout) { uint32_t status; @@ -251,7 +251,7 @@ static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, } /* Send one command to the AT91SAM flash controller */ -static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen) +static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen) { uint32_t fcr; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; @@ -280,9 +280,9 @@ static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16 } /* Read device id register, main clock frequency register and fill in driver info structure */ -static int at91sam7_read_part_info(struct flash_bank_s *bank) +static int at91sam7_read_part_info(struct flash_bank *bank) { - flash_bank_t *t_bank = bank; + struct flash_bank *t_bank = bank; struct at91sam7_flash_bank *at91sam7_info; struct target *target = t_bank->target; @@ -304,7 +304,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) if (at91sam7_info->cidr != 0) { /* flash already configured, update clock and check for protected sectors */ - flash_bank_t *fb = bank; + struct flash_bank *fb = bank; t_bank = fb; while (t_bank) @@ -336,7 +336,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) if (at91sam7_info->flash_autodetection == 0) { /* banks and sectors are already created, based on data from input file */ - flash_bank_t *fb = bank; + struct flash_bank *fb = bank; t_bank = fb; while (t_bank) { @@ -532,7 +532,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) if (bnk > 0) { /* create a new flash bank element */ - flash_bank_t *fb = malloc(sizeof(flash_bank_t)); + struct flash_bank *fb = malloc(sizeof(struct flash_bank)); fb->target = target; fb->driver = bank->driver; fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank)); @@ -595,7 +595,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) return ERROR_OK; } -static int at91sam7_erase_check(struct flash_bank_s *bank) +static int at91sam7_erase_check(struct flash_bank *bank) { struct target *target = bank->target; uint16_t retval; @@ -661,7 +661,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) return ERROR_OK; } -static int at91sam7_protect_check(struct flash_bank_s *bank) +static int at91sam7_protect_check(struct flash_bank *bank) { uint8_t lock_pos, gpnvm_pos; uint32_t status; @@ -713,7 +713,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) { - flash_bank_t *t_bank = bank; + struct flash_bank *t_bank = bank; struct at91sam7_flash_bank *at91sam7_info; struct target *target = t_bank->target; @@ -785,7 +785,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) if (bnk > 0) { /* create a new bank element */ - flash_bank_t *fb = malloc(sizeof(flash_bank_t)); + struct flash_bank *fb = malloc(sizeof(struct flash_bank)); fb->target = target; fb->driver = bank->driver; fb->driver_priv = malloc(sizeof(struct at91sam7_flash_bank)); @@ -827,7 +827,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) return ERROR_OK; } -static int at91sam7_erase(struct flash_bank_s *bank, int first, int last) +static int at91sam7_erase(struct flash_bank *bank, int first, int last) { struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; int sec; @@ -895,7 +895,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last) return ERROR_OK; } -static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) +static int at91sam7_protect(struct flash_bank *bank, int set, int first, int last) { uint32_t cmd; int sector; @@ -945,7 +945,7 @@ static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int l return ERROR_OK; } -static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { int retval; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; @@ -1014,7 +1014,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o return ERROR_OK; } -static int at91sam7_probe(struct flash_bank_s *bank) +static int at91sam7_probe(struct flash_bank *bank) { /* we can't probe on an at91sam7 * if this is an at91sam7, it has the configured flash */ @@ -1033,7 +1033,7 @@ static int at91sam7_probe(struct flash_bank_s *bank) return ERROR_OK; } -static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int at91sam7_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct at91sam7_flash_bank *at91sam7_info = bank->driver_priv; @@ -1100,7 +1100,7 @@ static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size) */ COMMAND_HANDLER(at91sam7_handle_gpnvm_command) { - flash_bank_t *bank; + struct flash_bank *bank; int bit; uint8_t flashcmd; uint32_t status; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index f4a7d72..9df254e 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -198,19 +198,19 @@ FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command) return ERROR_OK; } -static int avrf_erase(struct flash_bank_s *bank, int first, int last) +static int avrf_erase(struct flash_bank *bank, int first, int last) { LOG_INFO("%s", __FUNCTION__); return ERROR_OK; } -static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last) +static int avrf_protect(struct flash_bank *bank, int set, int first, int last) { LOG_INFO("%s", __FUNCTION__); return ERROR_OK; } -static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int avrf_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; struct avr_common *avr = target->arch_info; @@ -261,7 +261,7 @@ static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offse #define EXTRACT_MFG(X) (((X) & 0xffe) >> 1) #define EXTRACT_PART(X) (((X) & 0xffff000) >> 12) #define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28) -static int avrf_probe(struct flash_bank_s *bank) +static int avrf_probe(struct flash_bank *bank) { struct target *target = bank->target; struct avrf_flash_bank *avrf_info = bank->driver_priv; @@ -329,7 +329,7 @@ static int avrf_probe(struct flash_bank_s *bank) } } -static int avrf_auto_probe(struct flash_bank_s *bank) +static int avrf_auto_probe(struct flash_bank *bank) { struct avrf_flash_bank *avrf_info = bank->driver_priv; if (avrf_info->probed) @@ -337,13 +337,13 @@ static int avrf_auto_probe(struct flash_bank_s *bank) return avrf_probe(bank); } -static int avrf_protect_check(struct flash_bank_s *bank) +static int avrf_protect_check(struct flash_bank *bank) { LOG_INFO("%s", __FUNCTION__); return ERROR_OK; } -static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int avrf_info(struct flash_bank *bank, char *buf, int buf_size) { struct target *target = bank->target; struct avr_common *avr = target->arch_info; @@ -394,7 +394,7 @@ static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size) } } -static int avrf_mass_erase(struct flash_bank_s *bank) +static int avrf_mass_erase(struct flash_bank *bank) { struct target *target = bank->target; struct avr_common *avr = target->arch_info; @@ -425,7 +425,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) return ERROR_OK; } - flash_bank_t *bank; + struct flash_bank *bank; int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 6ab84f1..dd393de 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -42,9 +42,9 @@ static struct cfi_unlock_addresses cfi_unlock_addresses[] = }; /* CFI fixups foward declarations */ -static void cfi_fixup_0002_erase_regions(flash_bank_t *flash, void *param); -static void cfi_fixup_0002_unlock_addresses(flash_bank_t *flash, void *param); -static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *flash, void *param); +static void cfi_fixup_0002_erase_regions(struct flash_bank *flash, void *param); +static void cfi_fixup_0002_unlock_addresses(struct flash_bank *flash, void *param); +static void cfi_fixup_atmel_reversed_erase_regions(struct flash_bank *flash, void *param); /* fixup after reading cmdset 0002 primary query table */ static const struct cfi_fixup cfi_0002_fixups[] = { @@ -67,7 +67,7 @@ static const struct cfi_fixup cfi_0001_fixups[] = { {0, 0, NULL, NULL} }; -static void cfi_fixup(flash_bank_t *bank, const struct cfi_fixup *fixups) +static void cfi_fixup(struct flash_bank *bank, const struct cfi_fixup *fixups) { struct cfi_flash_bank *cfi_info = bank->driver_priv; const struct cfi_fixup *f; @@ -82,8 +82,8 @@ static void cfi_fixup(flash_bank_t *bank, const struct cfi_fixup *fixups) } } -/* inline uint32_t flash_address(flash_bank_t *bank, int sector, uint32_t offset) */ -static __inline__ uint32_t flash_address(flash_bank_t *bank, int sector, uint32_t offset) +/* inline uint32_t flash_address(struct flash_bank *bank, int sector, uint32_t offset) */ +static __inline__ uint32_t flash_address(struct flash_bank *bank, int sector, uint32_t offset) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -104,7 +104,7 @@ static __inline__ uint32_t flash_address(flash_bank_t *bank, int sector, uint32_ } -static void cfi_command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) +static void cfi_command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf) { int i; @@ -134,7 +134,7 @@ static void cfi_command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) * flash banks are expected to be made of similar chips * the query result should be the same for all */ -static uint8_t cfi_query_u8(flash_bank_t *bank, int sector, uint32_t offset) +static uint8_t cfi_query_u8(struct flash_bank *bank, int sector, uint32_t offset) { struct target *target = bank->target; uint8_t data[CFI_MAX_BUS_WIDTH]; @@ -151,7 +151,7 @@ static uint8_t cfi_query_u8(flash_bank_t *bank, int sector, uint32_t offset) * in case of a bank made of multiple chips, * the individual values are ORed */ -static uint8_t cfi_get_u8(flash_bank_t *bank, int sector, uint32_t offset) +static uint8_t cfi_get_u8(struct flash_bank *bank, int sector, uint32_t offset) { struct target *target = bank->target; uint8_t data[CFI_MAX_BUS_WIDTH]; @@ -176,7 +176,7 @@ static uint8_t cfi_get_u8(flash_bank_t *bank, int sector, uint32_t offset) } } -static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset) +static uint16_t cfi_query_u16(struct flash_bank *bank, int sector, uint32_t offset) { struct target *target = bank->target; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -198,7 +198,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset) return data[bank->bus_width - 1] | data[(2 * bank->bus_width) - 1] << 8; } -static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) +static uint32_t cfi_query_u32(struct flash_bank *bank, int sector, uint32_t offset) { struct target *target = bank->target; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -221,7 +221,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) data[(3 * bank->bus_width) - 1] << 16 | data[(4 * bank->bus_width) - 1] << 24; } -static void cfi_intel_clear_status_register(flash_bank_t *bank) +static void cfi_intel_clear_status_register(struct flash_bank *bank) { struct target *target = bank->target; uint8_t command[8]; @@ -236,7 +236,7 @@ static void cfi_intel_clear_status_register(flash_bank_t *bank) target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); } -uint8_t cfi_intel_wait_status_busy(flash_bank_t *bank, int timeout) +uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) { uint8_t status; @@ -277,7 +277,7 @@ uint8_t cfi_intel_wait_status_busy(flash_bank_t *bank, int timeout) return status; } -int cfi_spansion_wait_status_busy(flash_bank_t *bank, int timeout) +int cfi_spansion_wait_status_busy(struct flash_bank *bank, int timeout) { uint8_t status, oldstatus; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -312,7 +312,7 @@ int cfi_spansion_wait_status_busy(flash_bank_t *bank, int timeout) return(ERROR_FLASH_BUSY); } -static int cfi_read_intel_pri_ext(flash_bank_t *bank) +static int cfi_read_intel_pri_ext(struct flash_bank *bank) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -378,7 +378,7 @@ static int cfi_read_intel_pri_ext(flash_bank_t *bank) return ERROR_OK; } -static int cfi_read_spansion_pri_ext(flash_bank_t *bank) +static int cfi_read_spansion_pri_ext(struct flash_bank *bank) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -443,7 +443,7 @@ static int cfi_read_spansion_pri_ext(flash_bank_t *bank) return ERROR_OK; } -static int cfi_read_atmel_pri_ext(flash_bank_t *bank) +static int cfi_read_atmel_pri_ext(struct flash_bank *bank) { int retval; struct cfi_atmel_pri_ext atmel_pri_ext; @@ -510,7 +510,7 @@ static int cfi_read_atmel_pri_ext(flash_bank_t *bank) return ERROR_OK; } -static int cfi_read_0002_pri_ext(flash_bank_t *bank) +static int cfi_read_0002_pri_ext(struct flash_bank *bank) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -524,7 +524,7 @@ static int cfi_read_0002_pri_ext(flash_bank_t *bank) } } -static int cfi_spansion_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int cfi_spansion_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -559,7 +559,7 @@ static int cfi_spansion_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int cfi_intel_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -652,7 +652,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) return ERROR_OK; } -static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last) +static int cfi_intel_erase(struct flash_bank *bank, int first, int last) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -696,7 +696,7 @@ static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last) } -static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last) +static int cfi_spansion_erase(struct flash_bank *bank, int first, int last) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -762,7 +762,7 @@ static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last) return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); } -static int cfi_erase(struct flash_bank_s *bank, int first, int last) +static int cfi_erase(struct flash_bank *bank, int first, int last) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -797,7 +797,7 @@ static int cfi_erase(struct flash_bank_s *bank, int first, int last) return ERROR_OK; } -static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int last) +static int cfi_intel_protect(struct flash_bank *bank, int set, int first, int last) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -914,7 +914,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); } -static int cfi_protect(struct flash_bank_s *bank, int set, int first, int last) +static int cfi_protect(struct flash_bank *bank, int set, int first, int last) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -947,7 +947,7 @@ static int cfi_protect(struct flash_bank_s *bank, int set, int first, int last) } /* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */ -static void cfi_add_byte(struct flash_bank_s *bank, uint8_t *word, uint8_t byte) +static void cfi_add_byte(struct flash_bank *bank, uint8_t *word, uint8_t byte) { /* struct target *target = bank->target; */ @@ -993,7 +993,7 @@ static void cfi_fix_code_endian(struct target *target, uint8_t *dest, const uint } } -static uint32_t cfi_command_val(flash_bank_t *bank, uint8_t cmd) +static uint32_t cfi_command_val(struct flash_bank *bank, uint8_t cmd) { struct target *target = bank->target; @@ -1016,7 +1016,7 @@ static uint32_t cfi_command_val(flash_bank_t *bank, uint8_t cmd) } } -static int cfi_intel_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t address, uint32_t count) +static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t address, uint32_t count) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; @@ -1260,7 +1260,7 @@ cleanup: return retval; } -static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t address, uint32_t count) +static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t address, uint32_t count) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext; @@ -1559,7 +1559,7 @@ static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer, return exit_code; } -static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) +static int cfi_intel_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1593,7 +1593,7 @@ static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32 return ERROR_OK; } -static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) +static int cfi_intel_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1686,7 +1686,7 @@ static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint3 return ERROR_OK; } -static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) +static int cfi_spansion_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1732,7 +1732,7 @@ static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uin return ERROR_OK; } -static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) +static int cfi_spansion_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1824,7 +1824,7 @@ static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, ui return ERROR_OK; } -static int cfi_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t address) +static int cfi_write_word(struct flash_bank *bank, uint8_t *word, uint32_t address) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1845,7 +1845,7 @@ static int cfi_write_word(struct flash_bank_s *bank, uint8_t *word, uint32_t add return ERROR_FLASH_OPERATION_FAILED; } -static int cfi_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wordcount, uint32_t address) +static int cfi_write_words(struct flash_bank *bank, uint8_t *word, uint32_t wordcount, uint32_t address) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1866,7 +1866,7 @@ static int cfi_write_words(struct flash_bank_s *bank, uint8_t *word, uint32_t wo return ERROR_FLASH_OPERATION_FAILED; } -int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; @@ -2075,7 +2075,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3 return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word); } -static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *bank, void *param) +static void cfi_fixup_atmel_reversed_erase_regions(struct flash_bank *bank, void *param) { (void) param; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2084,7 +2084,7 @@ static void cfi_fixup_atmel_reversed_erase_regions(flash_bank_t *bank, void *par pri_ext->_reversed_geometry = 1; } -static void cfi_fixup_0002_erase_regions(flash_bank_t *bank, void *param) +static void cfi_fixup_0002_erase_regions(struct flash_bank *bank, void *param) { int i; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2107,7 +2107,7 @@ static void cfi_fixup_0002_erase_regions(flash_bank_t *bank, void *param) } } -static void cfi_fixup_0002_unlock_addresses(flash_bank_t *bank, void *param) +static void cfi_fixup_0002_unlock_addresses(struct flash_bank *bank, void *param) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext; @@ -2118,7 +2118,7 @@ static void cfi_fixup_0002_unlock_addresses(flash_bank_t *bank, void *param) } -static int cfi_query_string(struct flash_bank_s *bank, int address) +static int cfi_query_string(struct flash_bank *bank, int address) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; @@ -2156,7 +2156,7 @@ static int cfi_query_string(struct flash_bank_s *bank, int address) return ERROR_OK; } -static int cfi_probe(struct flash_bank_s *bank) +static int cfi_probe(struct flash_bank *bank) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; @@ -2435,7 +2435,7 @@ static int cfi_probe(struct flash_bank_s *bank) return ERROR_OK; } -static int cfi_auto_probe(struct flash_bank_s *bank) +static int cfi_auto_probe(struct flash_bank *bank) { struct cfi_flash_bank *cfi_info = bank->driver_priv; if (cfi_info->probed) @@ -2444,7 +2444,7 @@ static int cfi_auto_probe(struct flash_bank_s *bank) } -static int cfi_intel_protect_check(struct flash_bank_s *bank) +static int cfi_intel_protect_check(struct flash_bank *bank) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2477,7 +2477,7 @@ static int cfi_intel_protect_check(struct flash_bank_s *bank) return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); } -static int cfi_spansion_protect_check(struct flash_bank_s *bank) +static int cfi_spansion_protect_check(struct flash_bank *bank) { int retval; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2518,7 +2518,7 @@ static int cfi_spansion_protect_check(struct flash_bank_s *bank) return target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command); } -static int cfi_protect_check(struct flash_bank_s *bank) +static int cfi_protect_check(struct flash_bank *bank) { struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -2548,7 +2548,7 @@ static int cfi_protect_check(struct flash_bank_s *bank) return ERROR_OK; } -static int cfi_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int cfi_info(struct flash_bank *bank, char *buf, int buf_size) { int printed; struct cfi_flash_bank *cfi_info = bank->driver_priv; diff --git a/src/flash/cfi.h b/src/flash/cfi.h index deca916..d55fd34 100644 --- a/src/flash/cfi.h +++ b/src/flash/cfi.h @@ -146,7 +146,7 @@ struct cfi_fixup { uint16_t mfr; uint16_t id; - void (*fixup)(flash_bank_t *flash, void *param); + void (*fixup)(struct flash_bank *flash, void *param); void *param; }; diff --git a/src/flash/ecos.c b/src/flash/ecos.c index ad27a45..da35407 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -27,9 +27,9 @@ #if 0 -static uint32_t ecosflash_get_flash_status(flash_bank_t *bank); -static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode); -static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); +static uint32_t ecosflash_get_flash_status(struct flash_bank *bank); +static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode); +static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout); static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); #endif @@ -329,7 +329,7 @@ static int eCosBoard_flash(struct ecosflash_flash_bank *info, void *data, uint32 return ERROR_OK; } -static int ecosflash_probe(struct flash_bank_s *bank) +static int ecosflash_probe(struct flash_bank *bank) { return ERROR_OK; } @@ -342,7 +342,7 @@ static int ecosflash_register_commands(struct command_context_s *cmd_ctx) } #if 0 -static void command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) +static void command(struct flash_bank *bank, uint8_t cmd, uint8_t *cmd_buf) { struct ecosflash_flash_bank *info = bank->driver_priv; int i; @@ -365,7 +365,7 @@ static void command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf) #endif #if 0 -static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address) +static uint32_t ecosflash_address(struct flash_bank *bank, uint32_t address) { uint32_t retval = 0; switch (bank->bus_width) @@ -382,31 +382,31 @@ static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address) } #endif -static int ecosflash_erase(struct flash_bank_s *bank, int first, int last) +static int ecosflash_erase(struct flash_bank *bank, int first, int last) { - struct flash_bank_s *c = bank; + struct flash_bank *c = bank; struct ecosflash_flash_bank *info = bank->driver_priv; return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1)); } -static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last) +static int ecosflash_protect(struct flash_bank *bank, int set, int first, int last) { return ERROR_OK; } -static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int ecosflash_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct ecosflash_flash_bank *info = bank->driver_priv; - struct flash_bank_s *c = bank; + struct flash_bank *c = bank; return eCosBoard_flash(info, buffer, c->base + offset, count); } -static int ecosflash_protect_check(struct flash_bank_s *bank) +static int ecosflash_protect_check(struct flash_bank *bank) { return ERROR_OK; } -static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int ecosflash_info(struct flash_bank *bank, char *buf, int buf_size) { struct ecosflash_flash_bank *info = bank->driver_priv; snprintf(buf, buf_size, "eCos flash driver: %s", info->driverPath); @@ -414,17 +414,17 @@ static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size) } #if 0 -static uint32_t ecosflash_get_flash_status(flash_bank_t *bank) +static uint32_t ecosflash_get_flash_status(struct flash_bank *bank) { return ERROR_OK; } -static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode) +static void ecosflash_set_flash_mode(struct flash_bank *bank,int mode) { } -static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout) +static uint32_t ecosflash_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout) { return ERROR_OK; } diff --git a/src/flash/faux.c b/src/flash/faux.c index 0a52f5f..55e9892 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -92,38 +92,38 @@ static int faux_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -static int faux_erase(struct flash_bank_s *bank, int first, int last) +static int faux_erase(struct flash_bank *bank, int first, int last) { struct faux_flash_bank *info = bank->driver_priv; memset(info->memory + first*sectorSize, 0xff, sectorSize*(last-first + 1)); return ERROR_OK; } -static int faux_protect(struct flash_bank_s *bank, int set, int first, int last) +static int faux_protect(struct flash_bank *bank, int set, int first, int last) { LOG_USER("set protection sector %d to %d to %s", first, last, set?"on":"off"); return ERROR_OK; } -static int faux_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int faux_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct faux_flash_bank *info = bank->driver_priv; memcpy(info->memory + offset, buffer, count); return ERROR_OK; } -static int faux_protect_check(struct flash_bank_s *bank) +static int faux_protect_check(struct flash_bank *bank) { return ERROR_OK; } -static int faux_info(struct flash_bank_s *bank, char *buf, int buf_size) +static int faux_info(struct flash_bank *bank, char *buf, int buf_size) { snprintf(buf, buf_size, "faux flash driver"); return ERROR_OK; } -static int faux_probe(struct flash_bank_s *bank) +static int faux_probe(struct flash_bank *bank) { return ERROR_OK; } diff --git a/src/flash/flash.c b/src/flash/flash.c index 5374532..96c63d5 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -76,11 +76,11 @@ struct flash_driver *flash_drivers[] = { NULL, }; -flash_bank_t *flash_banks; +struct flash_bank *flash_banks; static command_t *flash_cmd; /* wafer thin wrapper for invoking the flash driver */ -static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int flash_driver_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { int retval; @@ -94,7 +94,7 @@ static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32 return retval; } -static int flash_driver_erase(struct flash_bank_s *bank, int first, int last) +static int flash_driver_erase(struct flash_bank *bank, int first, int last) { int retval; @@ -107,7 +107,7 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last) return retval; } -int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last) +int flash_driver_protect(struct flash_bank *bank, int set, int first, int last) { int retval; @@ -122,7 +122,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - flash_bank_t *p; + struct flash_bank *p; if (argc != 1) { Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command"); @@ -153,9 +153,9 @@ static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } -flash_bank_t *get_flash_bank_by_num_noprobe(int num) +struct flash_bank *get_flash_bank_by_num_noprobe(int num) { - flash_bank_t *p; + struct flash_bank *p; int i = 0; for (p = flash_banks; p; p = p->next) @@ -171,7 +171,7 @@ flash_bank_t *get_flash_bank_by_num_noprobe(int num) int flash_get_bank_count(void) { - flash_bank_t *p; + struct flash_bank *p; int i = 0; for (p = flash_banks; p; p = p->next) { @@ -180,9 +180,9 @@ int flash_get_bank_count(void) return i; } -flash_bank_t *get_flash_bank_by_num(int num) +struct flash_bank *get_flash_bank_by_num(int num) { - flash_bank_t *p = get_flash_bank_by_num_noprobe(num); + struct flash_bank *p = get_flash_bank_by_num_noprobe(num); int retval; if (p == NULL) @@ -199,7 +199,7 @@ flash_bank_t *get_flash_bank_by_num(int num) } int flash_command_get_bank_by_num( - struct command_context_s *cmd_ctx, const char *str, flash_bank_t **bank) + struct command_context_s *cmd_ctx, const char *str, struct flash_bank **bank) { unsigned bank_num; COMMAND_PARSE_NUMBER(uint, str, bank_num); @@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_flash_bank_command) if (strcmp(args[0], flash_drivers[i]->name) != 0) continue; - flash_bank_t *p, *c; + struct flash_bank *p, *c; /* register flash specific commands */ if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK) @@ -247,7 +247,7 @@ COMMAND_HANDLER(handle_flash_bank_command) return ERROR_FAIL; } - c = malloc(sizeof(flash_bank_t)); + c = malloc(sizeof(struct flash_bank)); c->target = target; c->driver = flash_drivers[i]; c->driver_priv = NULL; @@ -298,7 +298,7 @@ COMMAND_HANDLER(handle_flash_bank_command) COMMAND_HANDLER(handle_flash_info_command) { - flash_bank_t *p; + struct flash_bank *p; uint32_t i = 0; int j = 0; int retval; @@ -369,7 +369,7 @@ COMMAND_HANDLER(handle_flash_probe_command) unsigned bank_nr; COMMAND_PARSE_NUMBER(uint, args[0], bank_nr); - flash_bank_t *p = get_flash_bank_by_num_noprobe(bank_nr); + struct flash_bank *p = get_flash_bank_by_num_noprobe(bank_nr); if (p) { if ((retval = p->driver->probe(p)) == ERROR_OK) @@ -402,7 +402,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command) return ERROR_COMMAND_SYNTAX_ERROR; } - flash_bank_t *p; + struct flash_bank *p; int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); if (ERROR_OK != retval) return retval; @@ -443,7 +443,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command) COMMAND_HANDLER(handle_flash_erase_address_command) { - flash_bank_t *p; + struct flash_bank *p; int retval; int address; int length; @@ -490,7 +490,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command) if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; - flash_bank_t *p; + struct flash_bank *p; int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); if (ERROR_OK != retval) return retval; @@ -539,7 +539,7 @@ COMMAND_HANDLER(handle_flash_erase_command) uint32_t last; COMMAND_PARSE_NUMBER(u32, args[0], bank_nr); - flash_bank_t *p = get_flash_bank_by_num(bank_nr); + struct flash_bank *p = get_flash_bank_by_num(bank_nr); if (!p) return ERROR_OK; @@ -580,7 +580,7 @@ COMMAND_HANDLER(handle_flash_protect_command) int set; COMMAND_PARSE_NUMBER(u32, args[0], bank_nr); - flash_bank_t *p = get_flash_bank_by_num(bank_nr); + struct flash_bank *p = get_flash_bank_by_num(bank_nr); if (!p) return ERROR_OK; @@ -772,7 +772,7 @@ COMMAND_HANDLER(handle_flash_fill_command) for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { cur_size = MIN((count*wordsize - wrote), sizeof(chunk)); - flash_bank_t *bank; + struct flash_bank *bank; bank = get_flash_bank_by_addr(target, address); if (bank == NULL) { @@ -820,7 +820,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) struct duration bench; duration_start(&bench); - flash_bank_t *p; + struct flash_bank *p; int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); if (ERROR_OK != retval) return retval; @@ -860,7 +860,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) void flash_set_dirty(void) { - flash_bank_t *c; + struct flash_bank *c; int i; /* set all flash to require erasing */ @@ -874,9 +874,9 @@ void flash_set_dirty(void) } /* lookup flash bank by address */ -struct flash_bank_s *get_flash_bank_by_addr(struct target *target, uint32_t addr) +struct flash_bank *get_flash_bank_by_addr(struct target *target, uint32_t addr) { - flash_bank_t *c; + struct flash_bank *c; /* cycle through bank list */ for (c = flash_banks; c; c = c->next) @@ -899,9 +899,9 @@ struct flash_bank_s *get_flash_bank_by_addr(struct target *target, uint32_t addr /* erase given flash region, selects proper bank according to target and address */ static int flash_iterate_address_range(struct target *target, uint32_t addr, uint32_t length, - int (*callback)(struct flash_bank_s *bank, int first, int last)) + int (*callback)(struct flash_bank *bank, int first, int last)) { - flash_bank_t *c; + struct flash_bank *c; int first = -1; int last = -1; int i; @@ -954,7 +954,7 @@ int flash_erase_address_range(struct target *target, uint32_t addr, uint32_t len return flash_iterate_address_range(target, addr, length, &flash_driver_erase); } -static int flash_drive... [truncated message content] |
From: Zach W. <zw...@us...> - 2009-11-13 20:54:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 99b57b6dccec1059f746121b9b9ddb11313f708b (commit) from ebbc762182c943d5967ea106933181a2fb726b1b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 99b57b6dccec1059f746121b9b9ddb11313f708b Author: Zachary T Welch <zw...@su...> Date: Fri Nov 13 11:52:53 2009 -0800 remove accidental artifact Somehow I managed to slip a temporary build file into the tree. Remove it and update the .gitignore file so it doesn't happen again. diff --git a/.gitignore b/.gitignore index 2c1c536..f8a5381 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .libs .deps *.o +*.o.?????? *.a *.lo *.la diff --git a/src/target/avrt.o.RcaTm5 b/src/target/avrt.o.RcaTm5 deleted file mode 100644 index e69de29..0000000 ----------------------------------------------------------------------- Summary of changes: .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) delete mode 100644 src/target/avrt.o.RcaTm5 hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-13 20:03:50
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ebbc762182c943d5967ea106933181a2fb726b1b (commit) via 89870c86e7aafd81a5720fcfd30002d24d26b232 (commit) via f973320cbb98d661bc0e4ba4fa9939ce8bce2b83 (commit) via deede35c270b078ae63713cfc12aa2bbc9eb78a7 (commit) via cc63d6e72b49dd01706c4d768c1f9bb91db2ae1d (commit) via d22270e0ed291d3b08fd03a25181b279ca5e0911 (commit) via a585bdf7269ce5c861c83ee3294ba1f074e9c877 (commit) via 5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87 (commit) via 1df5cc18f51366b823bccdaec4ffa1ee3fac2447 (commit) via 670f999e7a1ec04cda599a5487de068379e36f0e (commit) via 0796dfff89bf00f82a780d7719767bcffe881d67 (commit) via 57c5c5f46304a785092874a7dc0f6abc84794cc3 (commit) via 76868e071306bc83d25b89e57b785fef4637c4c8 (commit) via d02fee197f62331e36e9de110040f0170341c3e8 (commit) via 63a26b421b1731df5826a157ea633b9d2c02aaee (commit) via cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e (commit) via ddb6138ed428f666064d26bb08036de3afe44bc8 (commit) via 3f9fd4e2a6ab7b3ce3819c385c34cf6f4630763c (commit) via 1ae4d93c3c90f176f6b94579ba3fabe1e17d715e (commit) from 5eb638c71e95048b090b8a19640d7d4902c07902 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ebbc762182c943d5967ea106933181a2fb726b1b Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 01:31:34 2009 -0800 add documention for writing built-in commands This documentation update provides an introduction to the command handling facilities provided by command.[ch]. A primer walks the user through the elements of a pointedly pedantic module: src/hello.c. A summary of the API is provided in the OpenOCD Architecture section. diff --git a/doc/manual/helper.txt b/doc/manual/helper.txt index 91bf2d5..7060607 100644 --- a/doc/manual/helper.txt +++ b/doc/manual/helper.txt @@ -31,7 +31,63 @@ This section needs to be expanded to describe OpenOCD's Jim API. /** @page helpercommand OpenOCD Command API -This section needs to be expanded to describe OpenOCD's Command API. +OpenOCD's command API allows modules to register callbacks that are then +available to the scripting services. It provides the mechanism for +these commands to be dispatched to the modlue using a standard +interfaces. It provides macros for defining functions that use and +extend this interface. + +@section helpercmdhandler Command Handlers + +Command handlers are functions with a particular signature, which can +be extended by modules for passing additional parameters to helpers or +another layer of handlers. + +@subsection helpercmdhandlerdef Defining and Calling Command Handlers + +These functions should be defined using the COMMAND_HANDLER macro. +These methods must be defined as static, as their principle entry point +should be the run_command dispatch mechanism. + +Command helper functions that require access to the full set of +parameters should be defined using the COMMAND_HELPER. These must be +declared static by you, as sometimes you might want to share a helper +among several files (e.g. s3c24xx_nand.h). + +Both types of routines must be called using the CALL_COMMAND_HANDLER macro. +Calls using this macro to normal handlers require the name of the command +handler (which can a name or function pointer). Calls to helpers and +derived handlers must pass those extra parameters specified by their +definitions; however, lexical capture is used for the core parameters. +This dirty trick is being used as a stop-gap measure while the API is +migrated to one that passes a pointer to a structure containing the +same ingredients. At that point, this macro will be removed and callers +will be able to use direct invocations. + +Thus, the following macros can be used to define and call command +handlers or helpers: + +- COMMAND_HANDLER - declare or define a command handler. +- COMMAND_HELPER - declare or define a derived command handler or helper. +- CALL_COMMAND_COMMAND - call a command handler/helper. + +@subsection helpercmdhandlerparam Command Handler Parameters + +The following parameters are defined in the scope of all command +handlers and helpers: +- <code>struct command_context_s *cmd_ctx</code> - the command's context +- <code>unsigned argc</code> - the number of command arguments +- <code>const char *args[]</code> - contains the command arguments + +@subsection helpercmdhandlermacros Command Handler Macros + +In addition, the following macro may be used: +- <code>COMMAND_NAME</code> - contains the command name + +@section helpercmdprimer Command Development Primer + +This @ref primercommand provides details about the @c hello module, +showing how the pieces desrcribed on this page fit together. */ diff --git a/doc/manual/main.txt b/doc/manual/main.txt index b9430b6..8e76464 100644 --- a/doc/manual/main.txt +++ b/doc/manual/main.txt @@ -42,11 +42,17 @@ associated with the fundamental technologies used by OpenOCD. - @subpage primertcl - @subpage primerjtag -These documents should bridge any "ancillary" gaps in contributor +The above documents should bridge any "ancillary" gaps in contributor knowledge, without having to learn the complete languages or technology. They should provide enough information for experienced developers to learn how to make "correct" changes when creating patches. +Beyond the fundamentals, the following primers provide introductory +tutorials for OpenOCD's sub-systems. These complement the @ref oocd +pages that provide more high-level perspective on related topics. + +- @subpage primercommand + In all cases, these Primers should use idiomatic conventions that the community has agreed are the "right way of doing things". In this respect, these documents typically assume some familiarity with the diff --git a/doc/manual/primer/commands.txt b/doc/manual/primer/commands.txt new file mode 100644 index 0000000..9efcca2 --- /dev/null +++ b/doc/manual/primer/commands.txt @@ -0,0 +1,99 @@ +/** @page primercommand Command Development Primer + +This page provides a primer for writing commands by introducing @c hello +module. The full source code used in this example can be found in +hello.c, and the @ref primercmdcode section shows how to use it. + +A summary of this information can be found in @ref helpercommand . + +@section primercmdhandler Command Handlers + +Defining new commands and their helpers is easy. The following code +defines a simple command handler that delegates its argument parsing: +@code +COMMAND_HANDLER(handle_hello_command) +{ + const char *sep, *name; + int retval = CALL_COMMAND_HANDLER(handle_hello_args); + if (ERROR_OK == retval) + command_print(cmd_ctx, "Greetings%s%s!", sep, name); + return retval; +} +@endcode + +Here, the @c COMMAND_HANDLER macro establishes the function signature, +see in command.h by the @c __COMMAND_HANDLER macro. + +The COMMAND_HELPER macro function allows defining functions with an +extended version of the base signature. These helper functions can be +called (with the appropriate parameters), the @c CALL_COMMAND_HANDLER +macro to pass any e as parameters to the following helper function: + +The subsequent blocks of code are a normal C function that can do +anything, so only complex commands deserve should use comamnd helper +functions. In this respect, this example uses one to demonstrate how -- +not when -- they should be used. + +@code +static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name) +{ + if (argc > 1) + { + LOG_ERROR("%s: too many arguments", COMMAND_NAME); + return ERROR_COMMAND_SYNTAX_ERROR; + } + if (1 == argc) + { + *sep = ", "; + *name = args[0]; + } + else + *sep = *name = ""; + + return ERROR_OK; +} +@endcode + +Of course, you may also call other macros or functions, but that extends +beyond the scope of this tutorial on writing commands. + +@section primercmdreg Command Registration + +Before this new function can be used, it must be registered somehow. +For a new module, registering should be done in a new function for +the purpose, which must be called from @c openocd.c: +@code +int hello_register_commands(struct command_context_s *cmd_ctx) +{ + struct command_s *cmd = register_command(cmd_ctx, NULL, "hello", + NULL, COMMAND_ANY, "print greetings"); + return cmd ? ERROR_OK : -ENOMEM; +} +@endcode + +That's it! The command should now be registered and avaiable to scripts. + +@section primercmdcode Trying These Example Commands + +The commands may be enabled by editing src/openocd.c and uncommenting +the call to @c hello_register_commands and rebuilding the source tree. + +Once OpenOCD has been built with this example code, the following script +demonstrate the abilities that the @c hello module provides: +@code +hello +hello World +hello {John Doe} +hello John Doe # error: too many arguments +@endcode + +If saved in @c hello.cfg, then running <code>openocd -f hello.cfg</code> +should produce the following output before exiting: +@code +Greetings! +Greetings, World! +Greetings, John Doe! +Error: ocd_hello: too many arguments +@endcode + + */ commit 89870c86e7aafd81a5720fcfd30002d24d26b232 Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 01:20:49 2009 -0800 add src/hello.c to augment new command tutorial The hello module provides the 'hello' command, printing a greetings to the command console. It can grow to serve as pedagogical example of services that OpenOCD developers should use: a runnable style guide. diff --git a/src/Makefile.am b/src/Makefile.am index 6717910..7721f34 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,9 @@ endif openocd_SOURCES = $(MAINFILE) openocd_LDADD = libopenocd.la -libopenocd_la_SOURCES = openocd.c +libopenocd_la_SOURCES = \ + hello.c \ + openocd.c # set the include path found by configure AM_CPPFLAGS = \ diff --git a/src/hello.c b/src/hello.c new file mode 100644 index 0000000..8a4f701 --- /dev/null +++ b/src/hello.c @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2009 Zachary T Welch <zw...@su...> * + * * + * 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. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include "log.h" + +static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name) +{ + if (argc > 1) + { + LOG_ERROR("%s: too many arguments", CMD_NAME); + return ERROR_COMMAND_SYNTAX_ERROR; + } + if (1 == argc) + { + *sep = " "; + *name = args[0]; + } + else + *sep = *name = ""; + + return ERROR_OK; +} +COMMAND_HANDLER(handle_hello_command) +{ + const char *sep, *name; + int retval = CALL_COMMAND_HANDLER(handle_hello_args, &sep, &name); + if (ERROR_OK == retval) + command_print(cmd_ctx, "Greetings%s%s!", sep, name); + return retval; +} + +int hello_register_commands(struct command_context_s *cmd_ctx) +{ + struct command_s *cmd = register_command(cmd_ctx, NULL, "hello", + &handle_hello_command, COMMAND_ANY, + "option"); + return cmd ? ERROR_OK : -ENOMEM; +} diff --git a/src/openocd.c b/src/openocd.c index 2a74a46..d67ebd5 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -177,6 +177,9 @@ COMMAND_HANDLER(handle_init_command) command_context_t *global_cmd_ctx; +/// src/hello.c gives a simple example for writing new command modules +int hello_register_commands(struct command_context_s *cmd_ctx); + /* NB! this fn can be invoked outside this file for non PC hosted builds */ command_context_t *setup_command_handler(void) { @@ -188,6 +191,7 @@ command_context_t *setup_command_handler(void) COMMAND_EXEC, "show OpenOCD version"); /* register subsystem commands */ + hello_register_commands(cmd_ctx); server_register_commands(cmd_ctx); telnet_register_commands(cmd_ctx); gdb_register_commands(cmd_ctx); commit f973320cbb98d661bc0e4ba4fa9939ce8bce2b83 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 23:01:44 2009 -0800 command_handler_t: make cmd an indirect parameter This patch removes 'cmd' from the list of direct parameters, moving that pointer to args[-1] (by way of the new CMD_NAME macro). diff --git a/src/helper/command.c b/src/helper/command.c index 7a42ab2..3cd11d2 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -102,7 +102,8 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) script_debug(interp, c->name, argc, argv); - words = malloc(sizeof(char *) * argc); + words = malloc(sizeof(char *) * (argc + 1)); + words[0] = c->name; for (i = 0; i < argc; i++) { int len; @@ -112,12 +113,12 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) /* hit an end of line comment */ break; } - words[i] = strdup(w); - if (words[i] == NULL) + words[i + 1] = strdup(w); + if (words[i + 1] == NULL) { int j; for (j = 0; j < i; j++) - free(words[j]); + free(words[j + 1]); free(words); return JIM_ERR; } @@ -141,7 +142,8 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) log_add_callback(tcl_output, tclOutput); - retval = run_command(context, c, (const char **)words, nwords); + // turn words[0] into args[-1] with this cast + retval = run_command(context, c, (const char **)words + 1, nwords); log_remove_callback(tcl_output, tclOutput); @@ -150,7 +152,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) Jim_DecrRefCount(interp, tclOutput); for (i = 0; i < nwords; i++) - free(words[i]); + free(words[i + 1]); free(words); int *return_retval = Jim_GetAssocData(interp, "retval"); @@ -447,7 +449,7 @@ static int run_command(command_context_t *context, unsigned argc = num_words - start_word - 1; const char **args = words + start_word + 1; - int retval = c->handler(context, c->name, args, argc); + int retval = c->handler(context, args, argc); if (retval == ERROR_COMMAND_SYNTAX_ERROR) { /* Print help for command */ diff --git a/src/helper/command.h b/src/helper/command.h index fbcc0aa..bddb053 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -88,7 +88,7 @@ typedef struct command_context_s */ #define __COMMAND_HANDLER(name, extra...) \ int name(struct command_context_s *cmd_ctx, \ - const char *cmd, const char *args[], unsigned argc, ##extra) + const char *args[], unsigned argc, ##extra) /** * Use this to macro to call a command helper (or a nested handler). @@ -104,7 +104,7 @@ typedef struct command_context_s * variables in intervening scope(s) by accident. */ #define CALL_COMMAND_HANDLER(name, extra...) \ - name(cmd_ctx, cmd, args, argc, ##extra) + name(cmd_ctx, args, argc, ##extra) /** * Always use this macro to define new command handler functions. @@ -125,7 +125,7 @@ typedef struct command_context_s * Use this macro to access the name of the command being handled, * rather than accessing the variable directly. It may be moved. */ -#define CMD_NAME cmd +#define CMD_NAME args[-1] /// The type signature for commands' handler functions. commit deede35c270b078ae63713cfc12aa2bbc9eb78a7 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 04:37:17 2009 -0800 command_handler_t: make args parameter const This patch prevents command handlers from modifying the strings passed in the 'args' array. diff --git a/src/helper/command.c b/src/helper/command.c index 4ce5085..7a42ab2 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -48,7 +48,7 @@ int fast_and_dangerous = 0; Jim_Interp *interp = NULL; static int run_command(command_context_t *context, - command_t *c, char *words[], unsigned num_words); + command_t *c, const char *words[], unsigned num_words); static void tcl_output(void *privData, const char *file, unsigned line, const char *function, const char *string) @@ -141,7 +141,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) log_add_callback(tcl_output, tclOutput); - retval = run_command(context, c, words, nwords); + retval = run_command(context, c, (const char **)words, nwords); log_remove_callback(tcl_output, tclOutput); @@ -435,7 +435,7 @@ char *command_name(struct command_s *c, char delim) } static int run_command(command_context_t *context, - command_t *c, char *words[], unsigned num_words) + command_t *c, const char *words[], unsigned num_words) { int start_word = 0; if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode))) @@ -445,7 +445,9 @@ static int run_command(command_context_t *context, return ERROR_FAIL; } - int retval = c->handler(context, c->name, words + start_word + 1, num_words - start_word - 1); + unsigned argc = num_words - start_word - 1; + const char **args = words + start_word + 1; + int retval = c->handler(context, c->name, args, argc); if (retval == ERROR_COMMAND_SYNTAX_ERROR) { /* Print help for command */ diff --git a/src/helper/command.h b/src/helper/command.h index 18664d2..fbcc0aa 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -88,7 +88,7 @@ typedef struct command_context_s */ #define __COMMAND_HANDLER(name, extra...) \ int name(struct command_context_s *cmd_ctx, \ - const char *cmd, char **args, unsigned argc, ##extra) + const char *cmd, const char *args[], unsigned argc, ##extra) /** * Use this to macro to call a command helper (or a nested handler). commit cc63d6e72b49dd01706c4d768c1f9bb91db2ae1d Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 00:10:25 2009 -0800 command_handler_t: make cmd parameter const Prevents the command name from being modified in command handlers. Again, this has cascading effects, but the patches are fairly minimal. diff --git a/src/helper/command.h b/src/helper/command.h index 5577315..18664d2 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -88,7 +88,7 @@ typedef struct command_context_s */ #define __COMMAND_HANDLER(name, extra...) \ int name(struct command_context_s *cmd_ctx, \ - char *cmd, char **args, unsigned argc, ##extra) + const char *cmd, char **args, unsigned argc, ##extra) /** * Use this to macro to call a command helper (or a nested handler). commit d22270e0ed291d3b08fd03a25181b279ca5e0911 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 00:02:18 2009 -0800 command_handler_t: make argc unsigned The number of command arguments will always be 0 or more, so use the right type in handlers. This has a cascading effect up through the layers, but the new COMMAND_HANDLER macros prevented total chaos. diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 08c4358..88f57df 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -604,9 +604,6 @@ static int cfi_register_commands(struct command_context_s *cmd_ctx) FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) { cfi_flash_bank_t *cfi_info; - int i; - (void) cmd_ctx; - (void) cmd; if (argc < 6) { @@ -635,7 +632,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) cfi_info->jedec_probe = 0; cfi_info->not_cfi = 0; - for (i = 6; i < argc; i++) + for (unsigned i = 6; i < argc; i++) { if (strcmp(args[i], "x16_as_x8") == 0) { diff --git a/src/flash/nand.c b/src/flash/nand.c index 88d3e42..26eb63a 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -1315,8 +1315,7 @@ COMMAND_HANDLER(handle_nand_write_command) if (argc > 3) { - int i; - for (i = 3; i < argc; i++) + for (unsigned i = 3; i < argc; i++) { if (!strcmp(args[i], "oob_raw")) oob_format |= NAND_OOB_RAW; @@ -1485,8 +1484,7 @@ COMMAND_HANDLER(handle_nand_dump_command) if (argc > 4) { - int i; - for (i = 4; i < argc; i++) + for (unsigned i = 4; i < argc; i++) { if (!strcmp(args[i], "oob_raw")) oob_format |= NAND_OOB_RAW; diff --git a/src/helper/command.h b/src/helper/command.h index 74c6f36..5577315 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -88,7 +88,7 @@ typedef struct command_context_s */ #define __COMMAND_HANDLER(name, extra...) \ int name(struct command_context_s *cmd_ctx, \ - char *cmd, char **args, int argc, ##extra) + char *cmd, char **args, unsigned argc, ##extra) /** * Use this to macro to call a command helper (or a nested handler). diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 1423462..3a62961 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -214,9 +214,9 @@ COMMAND_HANDLER(handle_append_command) config_file = fopen(args[0], "a"); if (config_file != NULL) { - int i; fseek(config_file, 0, SEEK_END); + unsigned i; for (i = 1; i < argc; i++) { if (fwrite(args[i], 1, strlen(args[i]), config_file) != strlen(args[i])) diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 6d23356..39036bc 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -2874,8 +2874,7 @@ COMMAND_HANDLER(ft2232_handle_vid_pid_command) argc -= 1; } - int i; - int retval = ERROR_OK; + unsigned i; for (i = 0; i < argc; i += 2) { COMMAND_PARSE_NUMBER(u16, args[i], ft2232_vid[i >> 1]); @@ -2888,7 +2887,7 @@ COMMAND_HANDLER(ft2232_handle_vid_pid_command) */ ft2232_vid[i >> 1] = ft2232_pid[i >> 1] = 0; - return retval; + return ERROR_OK; } COMMAND_HANDLER(ft2232_handle_latency_command) diff --git a/src/svf/svf.c b/src/svf/svf.c index 76b0670..8f2ee80 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -304,7 +304,7 @@ int svf_add_statemove(tap_state_t state_to) COMMAND_HANDLER(handle_svf_command) { #define SVF_NUM_OF_OPTIONS 1 - int command_num = 0, i; + int command_num = 0; int ret = ERROR_OK; long long time_ago; @@ -316,7 +316,7 @@ COMMAND_HANDLER(handle_svf_command) // parse variant svf_quiet = 0; - for (i = 1; i < argc; i++) + for (unsigned i = 1; i < argc; i++) { if (!strcmp(args[i], "quiet")) { diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 112ec2a..416fe79 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -862,7 +862,6 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) struct arm7_9_common_s *arm7_9 = target_to_arm7_9(target); reg_t *vector_catch; uint32_t vector_catch_value; - int i, j; /* it's uncommon, but some ARM7 chips can support this */ if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC @@ -894,9 +893,10 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) } else { - for (i = 0; i < argc; i++) + for (unsigned i = 0; i < argc; i++) { /* go through list of vectors */ + unsigned j; for (j = 0; arm9tdmi_vectors[j].name; j++) { if (strcmp(args[i], arm9tdmi_vectors[j].name) == 0) @@ -927,7 +927,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) } /* output current settings */ - for (i = 0; arm9tdmi_vectors[i].name; i++) { + for (unsigned i = 0; arm9tdmi_vectors[i].name; i++) { command_print(cmd_ctx, "%s: %s", arm9tdmi_vectors[i].name, (vector_catch_value & arm9tdmi_vectors[i].value) ? "catch" : "don't catch"); commit a585bdf7269ce5c861c83ee3294ba1f074e9c877 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 22:29:36 2009 -0800 add CMD_NAME macro for command handlers By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites. diff --git a/src/flash/flash.c b/src/flash/flash.c index da43e1a..f3f0086 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -728,7 +728,7 @@ COMMAND_HANDLER(handle_flash_fill_command) if (count == 0) return ERROR_OK; - switch (cmd[4]) + switch (CMD_NAME[4]) { case 'w': wordsize = 4; diff --git a/src/helper/command.h b/src/helper/command.h index aec066d..74c6f36 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -121,6 +121,12 @@ typedef struct command_context_s */ #define COMMAND_HELPER(name, extra...) __COMMAND_HANDLER(name, extra) +/** + * Use this macro to access the name of the command being handled, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD_NAME cmd + /// The type signature for commands' handler functions. typedef __COMMAND_HANDLER((*command_handler_t)); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 4da8838..923542f 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -605,7 +605,7 @@ static int default_srst_asserted(int *srst_asserted) COMMAND_HANDLER(handle_interface_list_command) { - if (strcmp(cmd, "interface_list") == 0 && argc > 0) + if (strcmp(CMD_NAME, "interface_list") == 0 && argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; command_print(cmd_ctx, "The following JTAG interfaces are available:"); diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 6a5a4e7..af326bf 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -424,7 +424,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 5576f60..81f5c6a 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -1203,7 +1203,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } @@ -1257,7 +1257,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 6f347d8..77405a8 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -740,7 +740,7 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } diff --git a/src/target/arm966e.c b/src/target/arm966e.c index e61943a..62ccaa8 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -174,7 +174,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 5084231..86469c4 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1902,7 +1902,7 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } diff --git a/src/target/target.c b/src/target/target.c index 21c0526..8cc46ec 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2046,7 +2046,7 @@ COMMAND_HANDLER(handle_wait_halt_command) int retval = parse_uint(args[0], &ms); if (ERROR_OK != retval) { - command_print(cmd_ctx, "usage: %s [seconds]", cmd); + command_print(cmd_ctx, "usage: %s [seconds]", CMD_NAME); return ERROR_COMMAND_SYNTAX_ERROR; } // convert seconds (given) to milliseconds (needed) @@ -2256,7 +2256,7 @@ COMMAND_HANDLER(handle_md_command) return ERROR_COMMAND_SYNTAX_ERROR; unsigned size = 0; - switch (cmd[2]) { + switch (CMD_NAME[2]) { case 'w': size = 4; break; case 'h': size = 2; break; case 'b': size = 1; break; @@ -2333,7 +2333,7 @@ COMMAND_HANDLER(handle_mw_command) target_t *target = get_current_target(cmd_ctx); unsigned wordsize; uint8_t value_buf[4]; - switch (cmd[2]) + switch (CMD_NAME[2]) { case 'w': wordsize = 4; diff --git a/src/target/xscale.c b/src/target/xscale.c index 6f2d6ee..e18d591 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3127,7 +3127,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } @@ -3163,13 +3163,13 @@ COMMAND_HANDLER(xscale_handle_idcache_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } - if (strcmp(cmd, "icache") == 0) + if (strcmp(CMD_NAME, "icache") == 0) icache = 1; - else if (strcmp(cmd, "dcache") == 0) + else if (strcmp(CMD_NAME, "dcache") == 0) dcache = 1; if (argc >= 1) @@ -3302,7 +3302,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } @@ -3429,7 +3429,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } @@ -3499,7 +3499,7 @@ COMMAND_HANDLER(xscale_handle_cp15) if (target->state != TARGET_HALTED) { - command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd); + command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME); return ERROR_OK; } uint32_t reg_no = 0; commit 5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 22:23:07 2009 -0800 use CALL_COMMAND_HANDLER instead of direct calls By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or even removed in inherited signatures, without requiring revisiting all of the various call sites. diff --git a/src/flash/flash.c b/src/flash/flash.c index d3889b9..da43e1a 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -259,7 +259,8 @@ COMMAND_HANDLER(handle_flash_bank_command) c->sectors = NULL; c->next = NULL; - if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK) + retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c); + if (ERROR_OK != retval) { LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base); free(c); diff --git a/src/flash/nand.c b/src/flash/nand.c index 181700d..88d3e42 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -241,7 +241,8 @@ COMMAND_HANDLER(handle_nand_device_command) c->use_raw = 0; c->next = NULL; - if ((retval = nand_flash_controllers[i]->nand_device_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK) + retval = CALL_COMMAND_HANDLER(nand_flash_controllers[i]->nand_device_command, c); + if (ERROR_OK != retval) { LOG_ERROR("'%s' driver rejected nand flash", c->controller->name); free(c); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 653d3a7..4da8838 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -658,7 +658,7 @@ COMMAND_HANDLER(handle_interface_command) * didn't match one of the compiled-in interfaces */ LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]); - handle_interface_list_command(cmd_ctx, cmd, args, argc); + CALL_COMMAND_HANDLER(handle_interface_list_command); return ERROR_JTAG_INVALID_INTERFACE; } diff --git a/src/pld/pld.c b/src/pld/pld.c index c20b936..e8cd075 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -85,7 +85,8 @@ COMMAND_HANDLER(handle_pld_device_command) c->driver = pld_drivers[i]; c->next = NULL; - if (pld_drivers[i]->pld_device_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK) + int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c); + if (ERROR_OK != retval) { LOG_ERROR("'%s' driver rejected pld device", args[0]); free(c); diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index c0c5d77..761ae40 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2271,7 +2271,7 @@ COMMAND_HANDLER(handle_gdb_sync_command) /* daemon configuration command gdb_port */ COMMAND_HANDLER(handle_gdb_port_command) { - return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port); + return CALL_COMMAND_HANDLER(server_port_command, &gdb_port); } COMMAND_HANDLER(handle_gdb_memory_map_command) diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index 3410ca9..c8da5bc 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -172,7 +172,7 @@ int tcl_init(void) COMMAND_HANDLER(handle_tcl_port_command) { - return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port); + return CALL_COMMAND_HANDLER(server_port_command, &tcl_port); } int tcl_register_commands(command_context_t *cmd_ctx) diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index c409ec0..6cb4746 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -608,7 +608,7 @@ int telnet_init(char *banner) /* daemon configuration command telnet_port */ COMMAND_HANDLER(handle_telnet_port_command) { - return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port); + return CALL_COMMAND_HANDLER(server_port_command, &telnet_port); } COMMAND_HANDLER(handle_exit_command) diff --git a/src/target/arm11.c b/src/target/arm11.c index 949c947..5b11f8e 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2029,7 +2029,8 @@ static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name) #define BOOL_WRAPPER(name, print_name) \ COMMAND_HANDLER(arm11_handle_bool_##name) \ { \ - return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \ + return CALL_COMMAND_HANDLER(arm11_handle_bool, \ + &arm11_config_##name, print_name); \ } BOOL_WRAPPER(memwrite_burst, "memory write burst mode") @@ -2186,12 +2187,12 @@ static COMMAND_HELPER(arm11_handle_etm_read_write, bool read) COMMAND_HANDLER(arm11_handle_etmr) { - return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true); + return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, true); } COMMAND_HANDLER(arm11_handle_etmw) { - return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false); + return CALL_COMMAND_HANDLER(arm11_handle_etm_read_write, false); } #define ARM11_HANDLER(x) .x = arm11_##x diff --git a/src/target/etm.c b/src/target/etm.c index df02904..a4ff6c5 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1271,7 +1271,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command) case 0: break; case 4: - handle_etm_tracemode_command_update(cmd_ctx, cmd, args, argc, &tracemode); + CALL_COMMAND_HANDLER(handle_etm_tracemode_command_update, &tracemode); break; default: command_print(cmd_ctx, "usage: configure trace mode " diff --git a/src/target/target.c b/src/target/target.c index 26c20cf..21c0526 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2121,7 +2121,7 @@ COMMAND_HANDLER(handle_halt_command) return ERROR_OK; } - return handle_wait_halt_command(cmd_ctx, cmd, args, argc); + return CALL_COMMAND_HANDLER(handle_wait_halt_command); } COMMAND_HANDLER(handle_soft_reset_halt_command) @@ -2410,7 +2410,7 @@ COMMAND_HANDLER(handle_load_image_command) int i; image_t image; - int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc, + int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; @@ -2701,12 +2701,12 @@ done: COMMAND_HANDLER(handle_verify_image_command) { - return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1); + return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1); } COMMAND_HANDLER(handle_test_image_command) { - return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0); + return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0); } static int handle_bp_command_list(struct command_context_s *cmd_ctx) @@ -4547,7 +4547,7 @@ COMMAND_HANDLER(handle_fast_load_image_command) image_t image; - int retval = parse_load_image_command_args(cmd_ctx, cmd, args, argc, + int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; commit 1df5cc18f51366b823bccdaec4ffa1ee3fac2447 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 01:21:29 2009 -0800 add PLD_DEVICE_COMMAND_HANDLER macro Update virtex module to use abstracted PLD command handling. diff --git a/src/pld/pld.h b/src/pld/pld.h index 3db4bad..22f2c13 100644 --- a/src/pld/pld.h +++ b/src/pld/pld.h @@ -24,14 +24,19 @@ struct pld_device_s; +#define __PLD_DEVICE_COMMAND(name) \ + COMMAND_HELPER(name, struct pld_device_s *pld) + typedef struct pld_driver_s { char *name; + __PLD_DEVICE_COMMAND((*pld_device_command)); int (*register_commands)(struct command_context_s *cmd_ctx); - int (*pld_device_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct pld_device_s *pld_device); int (*load)(struct pld_device_s *pld_device, const char *filename); } pld_driver_t; +#define PLD_DEVICE_COMMAND_HANDLER(name) static __PLD_DEVICE_COMMAND(name) + typedef struct pld_device_s { pld_driver_t *driver; diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index 3c6d61f..7e422fb 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -207,8 +207,7 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command) return ERROR_OK; } -static int virtex2_pld_device_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, struct pld_device_s *pld_device) +PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command) { jtag_tap_t *tap; @@ -227,9 +226,10 @@ static int virtex2_pld_device_command(struct command_context_s *cmd_ctx, } virtex2_info = malloc(sizeof(virtex2_pld_device_t)); - pld_device->driver_priv = virtex2_info; virtex2_info->tap = tap; + pld->driver_priv = virtex2_info; + return ERROR_OK; } commit 670f999e7a1ec04cda599a5487de068379e36f0e Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 00:53:40 2009 -0800 nand: add NAND_DEVICE_COMMAND_HANDLER macro Abstracts the extended NAND command handling to allow the function signature to be controlled by __COMMAND_HANDLER. diff --git a/src/flash/davinci_nand.c b/src/flash/davinci_nand.c index 6ecc60a..b3164ab 100644 --- a/src/flash/davinci_nand.c +++ b/src/flash/davinci_nand.c @@ -629,9 +629,7 @@ static int davinci_read_page_ecc4infix(struct nand_device_s *nand, uint32_t page return ERROR_OK; } -static int davinci_nand_device_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(davinci_nand_device_command) { struct davinci_nand *info; target_t *target; diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index 4b12077..41cc33e 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -29,7 +29,7 @@ static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout); /* nand device lpc3180 <target#> <oscillator_frequency> */ -static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(lpc3180_nand_device_command) { if (argc < 3) { diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c index f6a75ef..a51f8c8 100644 --- a/src/flash/mx3_nand.c +++ b/src/flash/mx3_nand.c @@ -61,9 +61,7 @@ static int imx31_command (struct nand_device_s *nand, uint8_t command); static int imx31_address (struct nand_device_s *nand, uint8_t address); static int imx31_controller_ready (struct nand_device_s *nand, int tout); -static int imx31_nand_device_command (struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) { mx3_nf_controller_t *mx3_nf_info; mx3_nf_info = malloc (sizeof (mx3_nf_controller_t)); diff --git a/src/flash/nand.h b/src/flash/nand.h index d96e288..57076d5 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -29,10 +29,13 @@ struct nand_device_s; +#define __NAND_DEVICE_COMMAND(name) \ + COMMAND_HELPER(name, struct nand_device_s *nand) + typedef struct nand_flash_controller_s { char *name; - int (*nand_device_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *nand); + __NAND_DEVICE_COMMAND((*nand_device_command)); int (*register_commands)(struct command_context_s *cmd_ctx); int (*init)(struct nand_device_s *nand); int (*reset)(struct nand_device_s *nand); @@ -48,6 +51,8 @@ typedef struct nand_flash_controller_s int (*nand_ready)(struct nand_device_s *nand, int timeout); } nand_flash_controller_t; +#define NAND_DEVICE_COMMAND_HANDLER(name) static __NAND_DEVICE_COMMAND(name) + typedef struct nand_block_s { uint32_t offset; diff --git a/src/flash/orion_nand.c b/src/flash/orion_nand.c index 471c562..b112c9e 100644 --- a/src/flash/orion_nand.c +++ b/src/flash/orion_nand.c @@ -125,9 +125,7 @@ static int orion_nand_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } -int orion_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command) { orion_nand_controller_t *hw; uint32_t base; diff --git a/src/flash/s3c2410_nand.c b/src/flash/s3c2410_nand.c index 176a1a4..5badf1a 100644 --- a/src/flash/s3c2410_nand.c +++ b/src/flash/s3c2410_nand.c @@ -30,9 +30,7 @@ #include "s3c24xx_nand.h" -static int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(s3c2410_nand_device_command) { s3c24xx_nand_controller_t *info; CALL_S3C24XX_DEVICE_COMMAND(nand, &info); diff --git a/src/flash/s3c2412_nand.c b/src/flash/s3c2412_nand.c index 7b65f84..958f013 100644 --- a/src/flash/s3c2412_nand.c +++ b/src/flash/s3c2412_nand.c @@ -30,9 +30,7 @@ #include "s3c24xx_nand.h" -static int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(s3c2412_nand_device_command) { s3c24xx_nand_controller_t *info; CALL_S3C24XX_DEVICE_COMMAND(nand, &info); diff --git a/src/flash/s3c2440_nand.c b/src/flash/s3c2440_nand.c index c6d658d..80020f6 100644 --- a/src/flash/s3c2440_nand.c +++ b/src/flash/s3c2440_nand.c @@ -31,9 +31,7 @@ #include "s3c24xx_nand.h" -static int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(s3c2440_nand_device_command) { s3c24xx_nand_controller_t *info; CALL_S3C24XX_DEVICE_COMMAND(nand, &info); diff --git a/src/flash/s3c2443_nand.c b/src/flash/s3c2443_nand.c index 6e92021..af7d9a9 100644 --- a/src/flash/s3c2443_nand.c +++ b/src/flash/s3c2443_nand.c @@ -31,9 +31,7 @@ #include "s3c24xx_nand.h" -static int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +NAND_DEVICE_COMMAND_HANDLER(s3c2443_nand_device_command) { s3c24xx_nand_controller_t *info; CALL_S3C24XX_DEVICE_COMMAND(nand, &info); commit 0796dfff89bf00f82a780d7719767bcffe881d67 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 01:41:30 2009 -0800 use FLASH_BANK_COMMAND_HANDLER macro Defines all flash_bank_command handlers using the new macro. diff --git a/src/flash/aduc702x.c b/src/flash/aduc702x.c index 7d6fa24..0e862e9 100644 --- a/src/flash/aduc702x.c +++ b/src/flash/aduc702x.c @@ -61,7 +61,7 @@ typedef struct /* flash bank aduc702x 0 0 0 0 <target#> * The ADC7019-28 devices all have the same flash layout */ -static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(aduc702x_flash_bank_command) { aduc702x_flash_bank_t *nbank; diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 804a35b..7e6b456 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -1641,12 +1641,7 @@ sam3_protect_check(struct flash_bank_s *bank) return ERROR_OK; } -static int -sam3_flash_bank_command(struct command_context_s *cmd_ctx, - char *cmd, - char **args, - int argc, - struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(sam3_flash_bank_command) { struct sam3_chip *pChip; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 4cd2705..266be06 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -711,7 +711,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) return ERROR_OK; } -static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) { flash_bank_t *t_bank = bank; at91sam7_flash_bank_t *at91sam7_info; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 6badb2d..35d31fb 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -180,7 +180,7 @@ static int avr_jtagprg_writeflashpage(avr_common_t *avr, uint8_t *page_buf, uint return ERROR_OK; } -static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command) { avrf_flash_bank_t *avrf_info; diff --git a/src/flash/cfi.c b/src/flash/cfi.c index b448a30..08c4358 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -601,7 +601,7 @@ static int cfi_register_commands(struct command_context_s *cmd_ctx) /* flash_bank cfi <base> <size> <chip_width> <bus_width> <target#> [options] */ -static int cfi_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) { cfi_flash_bank_t *cfi_info; int i; diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 401fdf2..2c3190a 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -104,7 +104,7 @@ flash_errmsg(int err) /* flash bank ecosflash <base> <size> <chip_width> <bus_width> <target#> <driverPath> */ -static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command) { ecosflash_flash_bank_t *info; diff --git a/src/flash/faux.c b/src/flash/faux.c index 474dee5..b997b87 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -37,7 +37,7 @@ static const int sectorSize = 0x10000; /* flash bank faux <base> <size> <chip_width> <bus_width> <target#> <driverPath> */ -static int faux_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command) { faux_flash_bank_t *info; diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 4d4d9a2..0481355 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -419,7 +419,7 @@ static int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int las /* * flash bank lpc2000 <base> <size> 0 0 <target#> <lpc_variant> <cclk> [calc_checksum] */ -static int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command) { lpc2000_flash_bank_t *lpc2000_info; diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c index 36444fb..3c3e1e4 100644 --- a/src/flash/lpc288x.c +++ b/src/flash/lpc288x.c @@ -165,7 +165,7 @@ static int lpc288x_protect_check(struct flash_bank_s *bank) } /* flash_bank LPC288x 0 0 0 0 <target#> <cclk> */ -static int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command) { lpc288x_flash_bank_t *lpc288x_info; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 945fc9a..953a62a 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -1016,9 +1016,7 @@ static int lpc2900_register_commands(struct command_context_s *cmd_ctx) /// Evaluate flash bank command. -static int lpc2900_flash_bank_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, - struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command) { lpc2900_flash_bank_t *lpc2900_info; diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 51ccc96..63e9282 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -44,7 +44,7 @@ static int ocl_protect_check(struct flash_bank_s *bank) } /* flash_bank ocl 0 0 0 0 <target#> */ -static int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command) { int retval; armv4_5_common_t *armv4_5; diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index aa34aea..1408fe9 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -62,7 +62,7 @@ static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint3 /* flash bank pic32mx <base> <size> 0 0 <target#> */ -static int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command) { pic32mx_flash_bank_t *pic32mx_info; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 22d5bc4..d66b9a8 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -213,7 +213,7 @@ static char * StellarisClassname[5] = /* flash_bank stellaris <base> <size> 0 0 <target#> */ -static int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command) { stellaris_flash_bank_t *stellaris_info; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 95d15a9..41b9008 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -33,7 +33,7 @@ static int stm32x_mass_erase(struct flash_bank_s *bank); /* flash bank stm32x <base> <size> 0 0 <target#> */ -static int stm32x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command) { stm32x_flash_bank_t *stm32x_info; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 028eab6..9738180 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -109,7 +109,7 @@ static int str7x_build_block_list(struct flash_bank_s *bank) /* flash bank str7x <base> <size> 0 0 <target#> <str71_variant> */ -static int str7x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command) { str7x_flash_bank_t *str7x_info; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 665c160..cdee571 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -116,8 +116,7 @@ static int str9x_build_block_list(struct flash_bank_s *bank) /* flash bank str9x <base> <size> 0 0 <target#> */ -static int str9x_flash_bank_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command) { str9x_flash_bank_t *str9x_info; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 3a35ee1..4056ba7 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -235,7 +235,7 @@ static int str9xpec_build_block_list(struct flash_bank_s *bank) /* flash bank str9x <base> <size> 0 0 <target#> */ -static int str9xpec_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command) { str9xpec_flash_controller_t *str9xpec_info; armv4_5_common_t *armv4_5 = NULL; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index 53043cd..d33ccd6 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -1222,7 +1222,7 @@ static int tms470_info(struct flash_bank_s *bank, char *buf, int buf_size) * [options...] */ -static int tms470_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +FLASH_BANK_COMMAND_HANDLER(tms470_flash_bank_command) { bank->driver_priv = malloc(sizeof(tms470_flash_bank_t)); commit 57c5c5f46304a785092874a7dc0f6abc84794cc3 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 01:39:30 2009 -0800 add FLASH_BANK_COMMAND_HANDLER macro The FLASH_BANK_COMMAND_HANDLER provides an extended command handler using the __COMMAND_HANDLER macro, whereby changing that macro is sufficient to update flash handlers with the new signature. It also enforces uniform style and scope when implementing this handler. diff --git a/src/flash/flash.h b/src/flash/flash.h index 7f5875e..7afb132 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -59,6 +59,9 @@ typedef struct flash_sector_s struct flash_bank_s; +#define __FLASH_BANK_COMMAND(name) \ + COMMAND_HELPER(name, struct flash_bank_s *bank) + /** * @brief Provides the implementation-independent structure that defines * all of the callbacks required by OpenOCD flash drivers. @@ -121,8 +124,7 @@ typedef struct flash_driver_s * * @returns ERROR_OK if successful; otherwise, an error code. */ - int (*flash_bank_command)(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, struct flash_bank_s *bank); + __FLASH_BANK_COMMAND((*flash_bank_command)); /** * Bank/sector erase routine (target-specific). When @@ -224,6 +226,8 @@ typedef struct flash_driver_s int (*auto_probe)(struct flash_bank_s *bank); } flash_driver_t; +#define FLASH_BANK_COMMAND_HANDLER(name) static __FLASH_BANK_COMMAND(name) + /** * Provides details of a flash bank, available either on-chip or through * a major interface. commit 76868e071306bc83d25b89e57b785fef4637c4c8 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 05:32:51 2009 -0800 s3c24xx: use COMMAND_HANDLER with command helper Add S3C24XX_DEVICE_COMMAND macros to abstract common command handler conventions. diff --git a/src/flash/s3c2410_nand.c b/src/flash/s3c2410_nand.c index e663507..176a1a4 100644 --- a/src/flash/s3c2410_nand.c +++ b/src/flash/s3c2410_nand.c @@ -35,11 +35,7 @@ static int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char * struct nand_device_s *nand) { s3c24xx_nand_controller_t *info; - - info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, nand); - if (info == NULL) { - return ERROR_NAND_DEVICE_INVALID; - } + CALL_S3C24XX_DEVICE_COMMAND(nand, &info); /* fill in the address fields for the core device */ info->cmd = S3C2410_NFCMD; diff --git a/src/flash/s3c2412_nand.c b/src/flash/s3c2412_nand.c index 5c9d319..7b65f84 100644 --- a/src/flash/s3c2412_nand.c +++ b/src/flash/s3c2412_nand.c @@ -35,11 +35,7 @@ static int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char * struct nand_device_s *nand) { s3c24xx_nand_controller_t *info; - - info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, nand); - if (info == NULL) { - return ERROR_NAND_DEVICE_INVALID; - } + CALL_S3C24XX_DEVICE_COMMAND(nand, &info); /* fill in the address fields for the core device */ info->cmd = S3C2440_NFCMD; diff --git a/src/flash/s3c2440_nand.c b/src/flash/s3c2440_nand.c index fd1fbd0..c6d658d 100644 --- a/src/flash/s3c2440_nand.c +++ b/src/flash/s3c2440_nand.c @@ -36,11 +36,7 @@ static int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char * struct nand_device_s *nand) { s3c24xx_nand_controller_t *info; - - info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, nand); - if (info == NULL) { - return ERROR_NAND_DEVICE_INVALID; - } + CALL_S3C24XX_DEVICE_COMMAND(nand, &info); /* fill in the address fields for the core device */ info->cmd = S3C2440_NFCMD; diff --git a/src/flash/s3c2443_nand.c b/src/flash/s3c2443_nand.c index 82d9b8e..6e92021 100644 --- a/src/flash/s3c2443_nand.c +++ b/src/flash/s3c2443_nand.c @@ -36,11 +36,7 @@ static int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char * struct nand_device_s *nand) { s3c24xx_nand_controller_t *info; - - info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, nand); - if (info == NULL) { - return ERROR_NAND_DEVICE_INVALID; - } + CALL_S3C24XX_DEVICE_COMMAND(nand, &info); /* fill in the address fields for the core device */ info->cmd = S3C2440_NFCMD; diff --git a/src/flash/s3c24xx_nand.c b/src/flash/s3c24xx_nand.c index 59d4d5b..e2bc005 100644 --- a/src/flash/s3c24xx_nand.c +++ b/src/flash/s3c24xx_nand.c @@ -31,17 +31,14 @@ #include "s3c24xx_nand.h" -s3c24xx_nand_controller_t * -s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc, - struct nand_device_s *nand) +S3C24XX_DEVICE_COMMAND() { s3c24xx_nand_controller_t *s3c24xx_info; s3c24xx_info = malloc(sizeof(s3c24xx_nand_controller_t)); if (s3c24xx_info == NULL) { LOG_ERROR("no memory for nand controller\n"); - return NULL; + return -ENOMEM; } nand->controller_priv = s3c24xx_info; @@ -49,10 +46,10 @@ s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, s3c24xx_info->target = get_target(args[1]); if (s3c24xx_info->target == NULL) { LOG_ERROR("target '%s' not defined", args[1]); - return NULL; + return ERROR_COMMAND_SYNTAX_ERROR; } - return s3c24xx_info; + return ERROR_OK; } int s3c24xx_register_commands(struct command_context_s *cmd_ctx) diff --git a/src/flash/s3c24xx_nand.h b/src/flash/s3c24xx_nand.h index ed14295..3f304a9... [truncated message content] |
From: David B. <dbr...@us...> - 2009-11-13 17:46:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 5eb638c71e95048b090b8a19640d7d4902c07902 (commit) from e8e94ab2454566fb9a226693e5c1de2264634a48 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5eb638c71e95048b090b8a19640d7d4902c07902 Author: David Brownell <dbr...@us...> Date: Fri Nov 13 08:45:20 2009 -0800 Cortex-A8: fix indent The "remove (forward) declarations" patch goofed indentation on the "cortexa8_target" struct; fix. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index a8cb37d..667c582 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1572,40 +1572,40 @@ static int cortex_a8_register_commands(struct command_context_s *cmd_ctx) } target_type_t cortexa8_target = { - .name = "cortex_a8", + .name = "cortex_a8", - .poll = &cortex_a8_poll, - .arch_state = &armv7a_arch_state, + .poll = cortex_a8_poll, + .arch_state = armv7a_arch_state, - .target_request_data = NULL, + .target_request_data = NULL, - .halt = &cortex_a8_halt, - .resume = &cortex_a8_resume, - .step = &cortex_a8_step, + .halt = cortex_a8_halt, + .resume = cortex_a8_resume, + .step = cortex_a8_step, - .assert_reset = &cortex_a8_assert_reset, - .deassert_reset = &cortex_a8_deassert_reset, - .soft_reset_halt = NULL, + .assert_reset = cortex_a8_assert_reset, + .deassert_reset = cortex_a8_deassert_reset, + .soft_reset_halt = NULL, - .get_gdb_reg_list = &armv4_5_get_gdb_reg_list, + .get_gdb_reg_list = armv4_5_get_gdb_reg_list, - .read_memory = &cortex_a8_read_memory, - .write_memory = &cortex_a8_write_memory, - .bulk_write_memory = &cortex_a8_bulk_write_memory, - .checksum_memory = &arm7_9_checksum_memory, - .blank_check_memory = &arm7_9_blank_check_memory, + .read_memory = cortex_a8_read_memory, + .write_memory = cortex_a8_write_memory, + .bulk_write_memory = cortex_a8_bulk_write_memory, + .checksum_memory = arm7_9_checksum_memory, + .blank_check_memory = arm7_9_blank_check_memory, - .run_algorithm = &armv4_5_run_algorithm, + .run_algorithm = armv4_5_run_algorithm, - .add_breakpoint = &cortex_a8_add_breakpoint, - .remove_breakpoint = &cortex_a8_remove_breakpoint, - .add_watchpoint = NULL, - .remove_watchpoint = NULL, + .add_breakpoint = cortex_a8_add_breakpoint, + .remove_breakpoint = cortex_a8_remove_breakpoint, + .add_watchpoint = NULL, + .remove_watchpoint = NULL, - .register_commands = &cortex_a8_register_commands, - .target_create = &cortex_a8_target_create, - .init_target = &cortex_a8_init_target, - .examine = &cortex_a8_examine, - .mrc = &cortex_a8_mrc, - .mcr = &cortex_a8_mcr, - }; + .register_commands = cortex_a8_register_commands, + .target_create = cortex_a8_target_create, + .init_target = cortex_a8_init_target, + .examine = cortex_a8_examine, + .mrc = cortex_a8_mrc, + .mcr = cortex_a8_mcr, +}; ----------------------------------------------------------------------- Summary of changes: src/target/cortex_a8.c | 56 ++++++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 28 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-13 07:53:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e8e94ab2454566fb9a226693e5c1de2264634a48 (commit) from d47764ff7176b6e3d97b49e82d4db7fe17c8e552 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e8e94ab2454566fb9a226693e5c1de2264634a48 Author: Zachary T Welch <zw...@su...> Date: Thu Nov 12 21:19:41 2009 -0800 nand: rename device to nand To be more informative (and consistent with flash and pld trees), change 'device' parameter name to 'nand' in NAND source files. This change eliminates confusing 'device->device->' instance from the code, and it simplifies the forthcoming command handler patches. diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index 309890c..f02c880 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -24,12 +24,12 @@ #include "lpc3180_nand_controller.h" #include "nand.h" -static int lpc3180_reset(struct nand_device_s *device); -static int lpc3180_controller_ready(struct nand_device_s *device, int timeout); +static int lpc3180_reset(struct nand_device_s *nand); +static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout); /* nand device lpc3180 <target#> <oscillator_frequency> */ -static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device) +static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *nand) { if (argc < 3) { @@ -49,7 +49,7 @@ static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char * lpc3180_nand_controller_t *lpc3180_info; lpc3180_info = malloc(sizeof(lpc3180_nand_controller_t)); - device->controller_priv = lpc3180_info; + nand->controller_priv = lpc3180_info; lpc3180_info->target = target; lpc3180_info->osc_freq = osc_freq; @@ -144,13 +144,13 @@ static float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info) return cycle; } -static int lpc3180_init(struct nand_device_s *device) +static int lpc3180_init(struct nand_device_s *nand) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; - int bus_width = (device->bus_width) ? (device->bus_width) : 8; - int address_cycles = (device->address_cycles) ? (device->address_cycles) : 3; - int page_size = (device->page_size) ? (device->page_size) : 512; + int bus_width = nand->bus_width ? : 8; + int address_cycles = nand->address_cycles ? : 3; + int page_size = nand->page_size ? : 512; if (target->state != TARGET_HALTED) { @@ -174,7 +174,7 @@ static int lpc3180_init(struct nand_device_s *device) } /* inform calling code about selected bus width */ - device->bus_width = bus_width; + nand->bus_width = bus_width; if ((address_cycles != 3) && (address_cycles != 4)) { @@ -240,7 +240,7 @@ static int lpc3180_init(struct nand_device_s *device) ((trp & 0xf) << 8) | ((treh & 0xf) << 12) | ((trhz & 0x7) << 16) | ((trbwb & 0x1f) << 19) | ((tcea & 0x3) << 24)); - lpc3180_reset(device); + lpc3180_reset(nand); } else if (lpc3180_info->selected_controller == LPC3180_SLC_CONTROLLER) { @@ -268,15 +268,15 @@ static int lpc3180_init(struct nand_device_s *device) ((r_width & 0xf) << 8) | ((r_rdy & 0xf) << 12) | ((w_setup & 0xf) << 16) | ((w_hold & 0xf) << 20) | ((w_width & 0xf) << 24) | ((w_rdy & 0xf) << 28)); - lpc3180_reset(device); + lpc3180_reset(nand); } return ERROR_OK; } -static int lpc3180_reset(struct nand_device_s *device) +static int lpc3180_reset(struct nand_device_s *nand) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -295,7 +295,7 @@ static int lpc3180_reset(struct nand_device_s *device) /* MLC_CMD = 0xff (reset controller and NAND device) */ target_write_u32(target, 0x200b8000, 0xff); - if (!lpc3180_controller_ready(device, 100)) + if (!lpc3180_controller_ready(nand, 100)) { LOG_ERROR("LPC3180 NAND controller timed out after reset"); return ERROR_NAND_OPERATION_TIMEOUT; @@ -306,7 +306,7 @@ static int lpc3180_reset(struct nand_device_s *device) /* SLC_CTRL = 0x6 (ECC_CLEAR, SW_RESET) */ target_write_u32(target, 0x20020010, 0x6); - if (!lpc3180_controller_ready(device, 100)) + if (!lpc3180_controller_ready(nand, 100)) { LOG_ERROR("LPC3180 NAND controller timed out after reset"); return ERROR_NAND_OPERATION_TIMEOUT; @@ -316,9 +316,9 @@ static int lpc3180_reset(struct nand_device_s *device) return ERROR_OK; } -static int lpc3180_command(struct nand_device_s *device, uint8_t command) +static int lpc3180_command(struct nand_device_s *nand, uint8_t command) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -346,9 +346,9 @@ static int lpc3180_command(struct nand_device_s *device, uint8_t command) return ERROR_OK; } -static int lpc3180_address(struct nand_device_s *device, uint8_t address) +static int lpc3180_address(struct nand_device_s *nand, uint8_t address) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -376,9 +376,9 @@ static int lpc3180_address(struct nand_device_s *device, uint8_t address) return ERROR_OK; } -static int lpc3180_write_data(struct nand_device_s *device, uint16_t data) +static int lpc3180_write_data(struct nand_device_s *nand, uint16_t data) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -406,9 +406,9 @@ static int lpc3180_write_data(struct nand_device_s *device, uint16_t data) return ERROR_OK; } -static int lpc3180_read_data(struct nand_device_s *device, void *data) +static int lpc3180_read_data(struct nand_device_s *nand, void *data) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -425,12 +425,12 @@ static int lpc3180_read_data(struct nand_device_s *device, void *data) else if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER) { /* data = MLC_DATA, use sized access */ - if (device->bus_width == 8) + if (nand->bus_width == 8) { uint8_t *data8 = data; target_read_u8(target, 0x200b0000, data8); } - else if (device->bus_width == 16) + else if (nand->bus_width == 16) { uint16_t *data16 = data; target_read_u16(target, 0x200b0000, data16); @@ -448,12 +448,12 @@ static int lpc3180_read_data(struct nand_device_s *device, void *data) /* data = SLC_DATA, must use 32-bit access */ target_read_u32(target, 0x20020000, &data32); - if (device->bus_width == 8) + if (nand->bus_width == 8) { uint8_t *data8 = data; *data8 = data32 & 0xff; } - else if (device->bus_width == 16) + else if (nand->bus_width == 16) { uint16_t *data16 = data; *data16 = data32 & 0xffff; @@ -468,9 +468,9 @@ static int lpc3180_read_data(struct nand_device_s *device, void *data) return ERROR_OK; } -static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +static int lpc3180_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; int retval; uint8_t status; @@ -504,7 +504,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 return ERROR_NAND_OPERATION_NOT_SUPPORTED; } - if (data_size > (uint32_t)device->page_size) + if (data_size > (uint32_t)nand->page_size) { LOG_ERROR("data size exceeds page size"); return ERROR_NAND_OPERATION_NOT_SUPPORTED; @@ -516,7 +516,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 page_buffer = malloc(512); oob_buffer = malloc(6); - if (device->page_size == 512) + if (nand->page_size == 512) { /* MLC_ADDR = 0x0 (one column cycle) */ target_write_u32(target, 0x200b8004, 0x0); @@ -525,7 +525,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 target_write_u32(target, 0x200b8004, page & 0xff); target_write_u32(target, 0x200b8004, (page >> 8) & 0xff); - if (device->address_cycles == 4) + if (nand->address_cycles == 4) target_write_u32(target, 0x200b8004, (page >> 16) & 0xff); } else @@ -542,7 +542,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 /* when using the MLC controller, we have to treat a large page device * as being made out of four quarters, each the size of a small page device */ - num_quarters = (device->page_size == 2048) ? 4 : 1; + num_quarters = (nand->page_size == 2048) ? 4 : 1; for (quarter = 0; quarter < num_quarters; quarter++) { @@ -557,7 +557,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 data += thisrun_data_size; } - memset(oob_buffer, 0xff, (device->page_size == 512) ? 6 : 24); + memset(oob_buffer, 0xff, (nand->page_size == 512) ? 6 : 24); if (oob) { memcpy(page_buffer, oob, thisrun_oob_size); @@ -574,7 +574,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 /* write MLC_ECC_AUTO_ENC_REG to start auto encode */ target_write_u32(target, 0x200b8010, 0x0); - if (!lpc3180_controller_ready(device, 1000)) + if (!lpc3180_controller_ready(nand, 1000)) { LOG_ERROR("timeout while waiting for completion of auto encode cycle"); return ERROR_NAND_OPERATION_FAILED; @@ -584,7 +584,7 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 /* MLC_CMD = auto program command */ target_write_u32(target, 0x200b8000, NAND_CMD_PAGEPROG); - if ((retval = nand_read_status(device, &status)) != ERROR_OK) + if ((retval = nand_read_status(nand, &status)) != ERROR_OK) { LOG_ERROR("couldn't read status"); return ERROR_NAND_OPERATION_FAILED; @@ -601,15 +601,15 @@ static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8 } else if (lpc3180_info->selected_controller == LPC3180_SLC_CONTROLLER) { - return nand_write_page_raw(device, page, data, data_size, oob, oob_size); + return nand_write_page_raw(nand, page, data, data_size, oob, oob_size); } return ERROR_OK; } -static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +static int lpc3180_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -639,13 +639,13 @@ static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_ } #endif - if (data_size > (uint32_t)device->page_size) + if (data_size > (uint32_t)nand->page_size) { LOG_ERROR("data size exceeds page size"); return ERROR_NAND_OPERATION_NOT_SUPPORTED; } - if (device->page_size == 2048) + if (nand->page_size == 2048) { page_buffer = malloc(2048); oob_buffer = malloc(64); @@ -671,7 +671,7 @@ static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_ target_write_u32(target, 0x200b8000, NAND_CMD_READ0); } - if (device->page_size == 512) + if (nand->page_size == 512) { /* small page device */ /* MLC_ADDR = 0x0 (one column cycle) */ @@ -681,7 +681,7 @@ static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_ target_write_u32(target, 0x200b8004, page & 0xff); target_write_u32(target, 0x200b8004, (page >> 8) & 0xff); - if (device->address_cycles == 4) + if (nand->address_cycles == 4) target_write_u32(target, 0x200b8004, (page >> 16) & 0xff); } else @@ -699,12 +699,12 @@ static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_ target_write_u32(target, 0x200b8000, NAND_CMD_READSTART); } - while (page_bytes_done < (uint32_t)device->page_size) + while (page_bytes_done < (uint32_t)nand->page_size) { /* MLC_ECC_AUTO_DEC_REG = dummy */ target_write_u32(target, 0x200b8014, 0xaa55aa55); - if (!lpc3180_controller_ready(device, 1000)) + if (!lpc3180_controller_ready(nand, 1000)) { LOG_ERROR("timeout while waiting for completion of auto decode cycle"); return ERROR_NAND_OPERATION_FAILED; @@ -748,15 +748,15 @@ static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_ } else if (lpc3180_info->selected_controller == LPC3180_SLC_CONTROLLER) { - return nand_read_page_raw(device, page, data, data_size, oob, oob_size); + return nand_read_page_raw(nand, page, data, data_size, oob, oob_size); } return ERROR_OK; } -static int lpc3180_controller_ready(struct nand_device_s *device, int timeout) +static int lpc3180_controller_ready(struct nand_device_s *nand, int timeout) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; uint8_t status = 0x0; @@ -788,9 +788,9 @@ static int lpc3180_controller_ready(struct nand_device_s *device, int timeout) return 0; } -static int lpc3180_nand_ready(struct nand_device_s *device, int timeout) +static int lpc3180_nand_ready(struct nand_device_s *nand, int timeout) { - lpc3180_nand_controller_t *lpc3180_info = device->controller_priv; + lpc3180_nand_controller_t *lpc3180_info = nand->controller_priv; target_t *target = lpc3180_info->target; if (target->state != TARGET_HALTED) @@ -843,14 +843,14 @@ static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char unsigned num; COMMAND_PARSE_NUMBER(uint, args[1], num); - nand_device_t *device = get_nand_device_by_num(num); - if (!device) + nand_device_t *nand = get_nand_device_by_num(num); + if (!nand) { command_print(cmd_ctx, "nand device '#%s' is out of bounds", args[0]); return ERROR_OK; } - lpc3180_info = device->controller_priv; + lpc3180_info = nand->controller_priv; if (argc == 2) { diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c index 62603d9..f6a75ef 100644 --- a/src/flash/mx3_nand.c +++ b/src/flash/mx3_nand.c @@ -49,21 +49,21 @@ unsigned char sign_of_sequental_byte_read; static int test_iomux_settings (target_t * target, uint32_t value, uint32_t mask, const char *text); -static int initialize_nf_controller (struct nand_device_s *device); +static int initialize_nf_controller (struct nand_device_s *nand); static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value); static int get_next_halfword_from_sram_buffer (target_t * target, uint16_t * value); static int poll_for_complete_op (target_t * target, const char *text); -static int validate_target_state (struct nand_device_s *device); -static int do_data_output (struct nand_device_s *device); +static int validate_target_state (struct nand_device_s *nand); +static int do_data_output (struct nand_device_s *nand); -static int imx31_command (struct nand_device_s *device, uint8_t command); -static int imx31_address (struct nand_device_s *device, uint8_t address); -static int imx31_controller_ready (struct nand_device_s *device, int tout); +static int imx31_command (struct nand_device_s *nand, uint8_t command); +static int imx31_address (struct nand_device_s *nand, uint8_t address); +static int imx31_controller_ready (struct nand_device_s *nand, int tout); static int imx31_nand_device_command (struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, - struct nand_device_s *device) + struct nand_device_s *nand) { mx3_nf_controller_t *mx3_nf_info; mx3_nf_info = malloc (sizeof (mx3_nf_controller_t)); @@ -73,7 +73,7 @@ static int imx31_nand_device_command (struct command_context_s *cmd_ctx, return ERROR_FAIL; } - device->controller_priv = mx3_nf_info; + nand->controller_priv = mx3_nf_info; mx3_nf_info->target = get_target (args[1]); if (mx3_nf_info->target == NULL) @@ -123,9 +123,9 @@ static int imx31_nand_device_command (struct command_context_s *cmd_ctx, return ERROR_OK; } -static int imx31_init (struct nand_device_s *device) +static int imx31_init (struct nand_device_s *nand) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; { @@ -133,7 +133,7 @@ static int imx31_init (struct nand_device_s *device) * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state(nand); if (validate_target_result != ERROR_OK) { return validate_target_result; @@ -149,30 +149,30 @@ static int imx31_init (struct nand_device_s *device) { uint32_t pcsr_register_content; target_read_u32 (target, MX3_PCSR, &pcsr_register_content); - if (!device->bus_width) + if (!nand->bus_width) { - device->bus_width = + nand->bus_width = (pcsr_register_content & 0x80000000) ? 16 : 8; } else { pcsr_register_content |= - ((device->bus_width == 16) ? 0x80000000 : 0x00000000); + ((nand->bus_width == 16) ? 0x80000000 : 0x00000000); target_write_u32 (target, MX3_PCSR, pcsr_register_content); } - if (!device->page_size) + if (!nand->page_size) { - device->page_size = + nand->page_size = (pcsr_register_content & 0x40000000) ? 2048 : 512; } else { pcsr_register_content |= - ((device->page_size == 2048) ? 0x40000000 : 0x00000000); + ((nand->page_size == 2048) ? 0x40000000 : 0x00000000); target_write_u32 (target, MX3_PCSR, pcsr_register_content); } - if (mx3_nf_info->flags.one_kb_sram && (device->page_size == 2048)) + if (mx3_nf_info->flags.one_kb_sram && (nand->page_size == 2048)) { LOG_ERROR ("NAND controller have only 1 kb SRAM, so pagesize 2048 is incompatible with it"); @@ -212,7 +212,7 @@ static int imx31_init (struct nand_device_s *device) test_iomux_settings (target, 0x43fac0c4, 0x7f7f7f7f, "d3,d4,d5,d6"); test_iomux |= test_iomux_settings (target, 0x43fac0c8, 0x0000007f, "d7"); - if (device->bus_width == 16) + if (nand->bus_width == 16) { test_iomux |= test_iomux_settings (target, 0x43fac0c8, 0x7f7f7f00, @@ -235,15 +235,15 @@ static int imx31_init (struct nand_device_s *device) } } - initialize_nf_controller (device); + initialize_nf_controller (nand); { int retval; uint16_t nand_status_content; retval = ERROR_OK; - retval |= imx31_command (device, NAND_CMD_STATUS); - retval |= imx31_address (device, 0x00); - retval |= do_data_output (device); + retval |= imx31_command (nand, NAND_CMD_STATUS); + retval |= imx31_address (nand, 0x00); + retval |= do_data_output (nand); if (retval != ERROR_OK) { LOG_ERROR (get_status_register_err_msg); @@ -266,16 +266,16 @@ static int imx31_init (struct nand_device_s *device) return ERROR_OK; } -static int imx31_read_data (struct nand_device_s *device, void *data) +static int imx31_read_data (struct nand_device_s *nand, void *data) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; { /* * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state (nand); if (validate_target_result != ERROR_OK) { return validate_target_result; @@ -287,14 +287,14 @@ static int imx31_read_data (struct nand_device_s *device, void *data) * get data from nand chip */ int try_data_output_from_nand_chip; - try_data_output_from_nand_chip = do_data_output (device); + try_data_output_from_nand_chip = do_data_output (nand); if (try_data_output_from_nand_chip != ERROR_OK) { return try_data_output_from_nand_chip; } } - if (device->bus_width == 16) + if (nand->bus_width == 16) { get_next_halfword_from_sram_buffer (target, data); } @@ -306,15 +306,15 @@ static int imx31_read_data (struct nand_device_s *device, void *data) return ERROR_OK; } -static int imx31_write_data (struct nand_device_s *device, uint16_t data) +static int imx31_write_data (struct nand_device_s *nand, uint16_t data) { LOG_ERROR ("write_data() not implemented"); return ERROR_NAND_OPERATION_FAILED; } -static int imx31_nand_ready (struct nand_device_s *device, int timeout) +static int imx31_nand_ready (struct nand_device_s *nand, int timeout) { - return imx31_controller_ready (device, timeout); + return imx31_controller_ready (nand, timeout); } static int imx31_register_commands (struct command_context_s *cmd_ctx) @@ -322,31 +322,31 @@ static int imx31_register_commands (struct command_context_s *cmd_ctx) return ERROR_OK; } -static int imx31_reset (struct nand_device_s *device) +static int imx31_reset (struct nand_device_s *nand) { /* * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state (nand); if (validate_target_result != ERROR_OK) { return validate_target_result; } - initialize_nf_controller (device); + initialize_nf_controller (nand); return ERROR_OK; } -static int imx31_command (struct nand_device_s *device, uint8_t command) +static int imx31_command (struct nand_device_s *nand, uint8_t command) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; { /* * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state (nand); if (validate_target_result != ERROR_OK) { return validate_target_result; @@ -369,7 +369,7 @@ static int imx31_command (struct nand_device_s *device, uint8_t command) * offset == one half of page size */ in_sram_address = - MX3_NF_MAIN_BUFFER0 + (device->page_size >> 1); + MX3_NF_MAIN_BUFFER0 + (nand->page_size >> 1); default: in_sram_address = MX3_NF_MAIN_BUFFER0; } @@ -411,16 +411,16 @@ static int imx31_command (struct nand_device_s *device, uint8_t command) return ERROR_OK; } -static int imx31_address (struct nand_device_s *device, uint8_t address) +static int imx31_address (struct nand_device_s *nand, uint8_t address) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; { /* * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state (nand); if (validate_target_result != ERROR_OK) { return validate_target_result; @@ -443,10 +443,10 @@ static int imx31_address (struct nand_device_s *device, uint8_t address) return ERROR_OK; } -static int imx31_controller_ready (struct nand_device_s *device, int tout) +static int imx31_controller_ready (struct nand_device_s *nand, int tout) { uint16_t poll_complete_status; - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; { @@ -454,7 +454,7 @@ static int imx31_controller_ready (struct nand_device_s *device, int tout) * validate target state */ int validate_target_result; - validate_target_result = validate_target_state (device); + validate_target_result = validate_target_state (nand); if (validate_target_result != ERROR_OK) { return validate_target_result; @@ -474,11 +474,11 @@ static int imx31_controller_ready (struct nand_device_s *device, int tout) return tout; } -static int imx31_write_page (struct nand_device_s *device, uint32_t page, +static int imx31_write_page (struct nand_device_s *nand, uint32_t page, uint8_t * data, uint32_t data_size, uint8_t * oob, uint32_t oob_size) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; if (data_size % 2) @@ -501,7 +501,7 @@ static int imx31_write_page (struct nand_device_s *device, uint32_t page, * validate target state */ int retval; - retval = validate_target_state (device); + retval = validate_target_state (nand); if (retval != ERROR_OK) { return retval; @@ -509,16 +509,16 @@ static int imx31_write_page (struct nand_device_s *device, uint32_t page, } { int retval = ERROR_OK; - retval |= imx31_command (device, NAND_CMD_SEQIN); - retval |= imx31_address (device, 0x00); - retval |= imx31_address (device, page & 0xff); - retval |= imx31_address (device, (page >> 8) & 0xff); - if (device->address_cycles >= 4) - { - retval |= imx31_address (device, (page >> 16) & 0xff); - if (device->address_cycles >= 5) + retval |= imx31_command(nand, NAND_CMD_SEQIN); + retval |= imx31_address(nand, 0x00); + retval |= imx31_address(nand, page & 0xff); + retval |= imx31_address(nand, (page >> 8) & 0xff); + if (nand->address_cycles >= 4) + { + retval |= imx31_address (nand, (page >> 16) & 0xff); + if (nand->address_cycles >= 5) { - retval |= imx31_address (device, (page >> 24) & 0xff); + retval |= imx31_address (nand, (page >> 24) & 0xff); } } target_write_buffer (target, MX3_NF_MAIN_BUFFER0, data_size, data); @@ -548,7 +548,7 @@ static int imx31_write_page (struct nand_device_s *device, uint32_t page, return poll_result; } } - retval |= imx31_command (device, NAND_CMD_PAGEPROG); + retval |= imx31_command (nand, NAND_CMD_PAGEPROG); if (retval != ERROR_OK) { return retval; @@ -560,9 +560,9 @@ static int imx31_write_page (struct nand_device_s *device, uint32_t page, { uint16_t nand_status_content; retval = ERROR_OK; - retval |= imx31_command (device, NAND_CMD_STATUS); - retval |= imx31_address (device, 0x00); - retval |= do_data_output (device); + retval |= imx31_command(nand, NAND_CMD_STATUS); + retval |= imx31_address(nand, 0x00); + retval |= do_data_output(nand); if (retval != ERROR_OK) { LOG_ERROR (get_status_register_err_msg); @@ -581,11 +581,11 @@ static int imx31_write_page (struct nand_device_s *device, uint32_t page, return ERROR_OK; } -static int imx31_read_page (struct nand_device_s *device, uint32_t page, +static int imx31_read_page (struct nand_device_s *nand, uint32_t page, uint8_t * data, uint32_t data_size, uint8_t * oob, uint32_t oob_size) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; if (data_size % 2) @@ -604,7 +604,7 @@ static int imx31_read_page (struct nand_device_s *device, uint32_t page, * validate target state */ int retval; - retval = validate_target_state (device); + retval = validate_target_state(nand); if (retval != ERROR_OK) { return retval; @@ -612,20 +612,20 @@ static int imx31_read_page (struct nand_device_s *device, uint32_t page, } { int retval = ERROR_OK; - retval |= imx31_command (device, NAND_CMD_READ0); - retval |= imx31_address (device, 0x00); - retval |= imx31_address (device, page & 0xff); - retval |= imx31_address (device, (page >> 8) & 0xff); - if (device->address_cycles >= 4) - { - retval |= imx31_address (device, (page >> 16) & 0xff); - if (device->address_cycles >= 5) + retval |= imx31_command(nand, NAND_CMD_READ0); + retval |= imx31_address(nand, 0x00); + retval |= imx31_address(nand, page & 0xff); + retval |= imx31_address(nand, (page >> 8) & 0xff); + if (nand->address_cycles >= 4) + { + retval |= imx31_address(nand, (page >> 16) & 0xff); + if (nand->address_cycles >= 5) { - retval |= imx31_address (device, (page >> 24) & 0xff); - retval |= imx31_command (device, NAND_CMD_READSTART); + retval |= imx31_address(nand, (page >> 24) & 0xff); + retval |= imx31_command(nand, NAND_CMD_READSTART); } } - retval |= do_data_output (device); + retval |= do_data_output (nand); if (retval != ERROR_OK) { return retval; @@ -658,9 +658,9 @@ static int test_iomux_settings (target_t * target, uint32_t address, return ERROR_OK; } -static int initialize_nf_controller (struct nand_device_s *device) +static int initialize_nf_controller (struct nand_device_s *nand) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; /* * resets NAND flash controller in zero time ? I dont know. @@ -786,9 +786,9 @@ static int poll_for_complete_op (target_t * target, const char *text) return ERROR_OK; } -static int validate_target_state (struct nand_device_s *device) +static int validate_target_state (struct nand_device_s *nand) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; if (target->state != TARGET_HALTED) @@ -808,9 +808,9 @@ static int validate_target_state (struct nand_device_s *device) return ERROR_OK; } -static int do_data_output (struct nand_device_s *device) +static int do_data_output (struct nand_device_s *nand) { - mx3_nf_controller_t *mx3_nf_info = device->controller_priv; + mx3_nf_controller_t *mx3_nf_info = nand->controller_priv; target_t *target = mx3_nf_info->target; switch (mx3_nf_info->fin) { diff --git a/src/flash/nand.c b/src/flash/nand.c index c1be276..4d32d25 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -28,10 +28,10 @@ #include "time_support.h" #include "fileio.h" -static int nand_read_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); -//static int nand_read_plain(struct nand_device_s *device, uint32_t address, uint8_t *data, uint32_t data_size); +static int nand_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); +//static int nand_read_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size); -static int nand_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); +static int nand_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); /* NAND flash controller */ @@ -304,89 +304,89 @@ nand_device_t *get_nand_device_by_num(int num) } int nand_command_get_device_by_num(struct command_context_s *cmd_ctx, - const char *str, nand_device_t **device) + const char *str, nand_device_t **nand) { unsigned num; COMMAND_PARSE_NUMBER(uint, str, num); - *device = get_nand_device_by_num(num); - if (!*device) { + *nand = get_nand_device_by_num(num); + if (!*nand) { command_print(cmd_ctx, "NAND flash device '#%s' is out of bounds", str); return ERROR_INVALID_ARGUMENTS; } return ERROR_OK; } -static int nand_build_bbt(struct nand_device_s *device, int first, int last) +static int nand_build_bbt(struct nand_device_s *nand, int first, int last) { uint32_t page = 0x0; int i; uint8_t oob[6]; - if ((first < 0) || (first >= device->num_blocks)) + if ((first < 0) || (first >= nand->num_blocks)) first = 0; - if ((last >= device->num_blocks) || (last == -1)) - last = device->num_blocks - 1; + if ((last >= nand->num_blocks) || (last == -1)) + last = nand->num_blocks - 1; for (i = first; i < last; i++) { - nand_read_page(device, page, NULL, 0, oob, 6); + nand_read_page(nand, page, NULL, 0, oob, 6); - if (((device->device->options & NAND_BUSWIDTH_16) && ((oob[0] & oob[1]) != 0xff)) - || (((device->page_size == 512) && (oob[5] != 0xff)) || - ((device->page_size == 2048) && (oob[0] != 0xff)))) + if (((nand->device->options & NAND_BUSWIDTH_16) && ((oob[0] & oob[1]) != 0xff)) + || (((nand->page_size == 512) && (oob[5] != 0xff)) || + ((nand->page_size == 2048) && (oob[0] != 0xff)))) { LOG_WARNING("bad block: %i", i); - device->blocks[i].is_bad = 1; + nand->blocks[i].is_bad = 1; } else { - device->blocks[i].is_bad = 0; + nand->blocks[i].is_bad = 0; } - page += (device->erase_size / device->page_size); + page += (nand->erase_size / nand->page_size); } return ERROR_OK; } -int nand_read_status(struct nand_device_s *device, uint8_t *status) +int nand_read_status(struct nand_device_s *nand, uint8_t *status) { - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; /* Send read status command */ - device->controller->command(device, NAND_CMD_STATUS); + nand->controller->command(nand, NAND_CMD_STATUS); alive_sleep(1); /* read status */ - if (device->device->options & NAND_BUSWIDTH_16) + if (nand->device->options & NAND_BUSWIDTH_16) { uint16_t data; - device->controller->read_data(device, &data); + nand->controller->read_data(nand, &data); *status = data & 0xff; } else { - device->controller->read_data(device, status); + nand->controller->read_data(nand, status); } return ERROR_OK; } -static int nand_poll_ready(struct nand_device_s *device, int timeout) +static int nand_poll_ready(struct nand_device_s *nand, int timeout) { uint8_t status; - device->controller->command(device, NAND_CMD_STATUS); + nand->controller->command(nand, NAND_CMD_STATUS); do { - if (device->device->options & NAND_BUSWIDTH_16) { + if (nand->device->options & NAND_BUSWIDTH_16) { uint16_t data; - device->controller->read_data(device, &data); + nand->controller->read_data(nand, &data); status = data & 0xff; } else { - device->controller->read_data(device, &status); + nand->controller->read_data(nand, &status); } if (status & NAND_STATUS_READY) break; @@ -396,7 +396,7 @@ static int nand_poll_ready(struct nand_device_s *device, int timeout) return (status & NAND_STATUS_READY) != 0; } -int nand_probe(struct nand_device_s *device) +int nand_probe(struct nand_device_s *nand) { uint8_t manufacturer_id, device_id; uint8_t id_buff[6]; @@ -404,17 +404,17 @@ int nand_probe(struct nand_device_s *device) int i; /* clear device data */ - device->device = NULL; - device->manufacturer = NULL; + nand->device = NULL; + nand->manufacturer = NULL; /* clear device parameters */ - device->bus_width = 0; - device->address_cycles = 0; - device->page_size = 0; - device->erase_size = 0; + nand->bus_width = 0; + nand->address_cycles = 0; + nand->page_size = 0; + nand->erase_size = 0; /* initialize controller (device parameters are zero, use controller default) */ - if ((retval = device->controller->init(device) != ERROR_OK)) + if ((retval = nand->controller->init(nand) != ERROR_OK)) { switch (retval) { @@ -430,23 +430,23 @@ int nand_probe(struct nand_device_s *device) } } - device->controller->command(device, NAND_CMD_RESET); - device->controller->reset(device); + nand->controller->command(nand, NAND_CMD_RESET); + nand->controller->reset(nand); - device->controller->command(device, NAND_CMD_READID); - device->controller->address(device, 0x0); + nand->controller->command(nand, NAND_CMD_READID); + nand->controller->address(nand, 0x0); - if (device->bus_width == 8) + if (nand->bus_width == 8) { - device->controller->read_data(device, &manufacturer_id); - device->controller->read_data(device, &device_id); + nand->controller->read_data(nand, &manufacturer_id); + nand->controller->read_data(nand, &device_id); } else { uint16_t data_buf; - device->controller->read_data(device, &data_buf); + nand->controller->read_data(nand, &data_buf); manufacturer_id = data_buf & 0xff; - device->controller->read_data(device, &data_buf); + nand->controller->read_data(nand, &data_buf); device_id = data_buf & 0xff; } @@ -454,7 +454,7 @@ int nand_probe(struct nand_device_s *device) { if (nand_flash_ids[i].id == device_id) { - device->device = &nand_flash_ids[i]; + nand->device = &nand_flash_ids[i]; break; } } @@ -463,127 +463,127 @@ int nand_probe(struct nand_device_s *device) { if (nand_manuf_ids[i].id == manufacturer_id) { - device->manufacturer = &nand_manuf_ids[i]; + nand->manufacturer = &nand_manuf_ids[i]; break; } } - if (!device->manufacturer) + if (!nand->manufacturer) { - device->manufacturer = &nand_manuf_ids[0]; - device->manufacturer->id = manufacturer_id; + nand->manufacturer = &nand_manuf_ids[0]; + nand->manufacturer->id = manufacturer_id; } - if (!device->device) + if (!nand->device) { LOG_ERROR("unknown NAND flash device found, manufacturer id: 0x%2.2x device id: 0x%2.2x", manufacturer_id, device_id); return ERROR_NAND_OPERATION_FAILED; } - LOG_DEBUG("found %s (%s)", device->device->name, device->manufacturer->name); + LOG_DEBUG("found %s (%s)", nand->device->name, nand->manufacturer->name); /* initialize device parameters */ /* bus width */ - if (device->device->options & NAND_BUSWIDTH_16) - device->bus_width = 16; + if (nand->device->options & NAND_BUSWIDTH_16) + nand->bus_width = 16; else - device->bus_width = 8; + nand->bus_width = 8; /* Do we need extended device probe information? */ - if (device->device->page_size == 0 || - device->device->erase_size == 0) + if (nand->device->page_size == 0 || + nand->device->erase_size == 0) { - if (device->bus_width == 8) + if (nand->bus_width == 8) { - device->controller->read_data(device, id_buff + 3); - device->controller->read_data(device, id_buff + 4); - device->controller->read_data(device, id_buff + 5); + nand->controller->read_data(nand, id_buff + 3); + nand->controller->read_data(nand, id_buff + 4); + nand->controller->read_data(nand, id_buff + 5); } else { uint16_t data_buf; - device->controller->read_data(device, &data_buf); + nand->controller->read_data(nand, &data_buf); id_buff[3] = data_buf; - device->controller->read_data(device, &data_buf); + nand->controller->read_data(nand, &data_buf); id_buff[4] = data_buf; - device->controller->read_data(device, &data_buf); + nand->controller->read_data(nand, &data_buf); id_buff[5] = data_buf >> 8; } } /* page size */ - if (device->device->page_size == 0) + if (nand->device->page_size == 0) { - device->page_size = 1 << (10 + (id_buff[4] & 3)); + nand->page_size = 1 << (10 + (id_buff[4] & 3)); } - else if (device->device->page_size == 256) + else if (nand->device->page_size == 256) { LOG_ERROR("NAND flashes with 256 byte pagesize are not supported"); return ERROR_NAND_OPERATION_FAILED; } else { - device->page_size = device->device->page_size; + nand->page_size = nand->device->page_size; } /* number of address cycles */ - if (device->page_size <= 512) + if (nand->page_size <= 512) { /* small page devices */ - if (device->device->chip_size <= 32) - device->address_cycles = 3; - else if (device->device->chip_size <= 8*1024) - device->address_cycles = 4; + if (nand->device->chip_size <= 32) + nand->address_cycles = 3; + else if (nand->device->chip_size <= 8*1024) + nand->address_cycles = 4; else { LOG_ERROR("BUG: small page NAND device with more than 8 GiB encountered"); - device->address_cycles = 5; + nand->address_cycles = 5; } } else { /* large page devices */ - if (device->device->chip_size <= 128) - device->address_cycles = 4; - else if (device->device->chip_size <= 32*1024) - device->address_cycles = 5; + if (nand->device->chip_size <= 128) + nand->address_cycles = 4; + else if (nand->device->chip_size <= 32*1024) + nand->address_cycles = 5; else { LOG_ERROR("BUG: large page NAND device with more than 32 GiB encountered"); - device->address_cycles = 6; + nand->address_cycles = 6; } } /* erase size */ - if (device->device->erase_size == 0) + if (nand->device->erase_size == 0) { switch ((id_buff[4] >> 4) & 3) { case 0: - device->erase_size = 64 << 10; + nand->erase_size = 64 << 10; break; case 1: - device->erase_size = 128 << 10; + nand->erase_size = 128 << 10; break; case 2: - device->erase_size = 256 << 10; + nand->erase_size = 256 << 10; break; case 3: - device->erase_size =512 << 10; + nand->erase_size =512 << 10; break; } } else { - device->erase_size = device->device->erase_size; + nand->erase_size = nand->device->erase_size; } /* initialize controller, but leave parameters at the controllers default */ - if ((retval = device->controller->init(device) != ERROR_OK)) + if ((retval = nand->controller->init(nand) != ERROR_OK)) { switch (retval) { @@ -592,7 +592,7 @@ int nand_probe(struct nand_device_s *device) return ERROR_NAND_OPERATION_FAILED; case ERROR_NAND_OPERATION_NOT_SUPPORTED: LOG_ERROR("controller doesn't support requested parameters (buswidth: %i, address cycles: %i, page size: %i)", - device->bus_width, device->address_cycles, device->page_size); + nand->bus_width, nand->address_cycles, nand->page_size); return ERROR_NAND_OPERATION_FAILED; default: LOG_ERROR("BUG: unknown controller initialization failure"); @@ -600,39 +600,39 @@ int nand_probe(struct nand_device_s *device) } } - device->num_blocks = (device->device->chip_size * 1024) / (device->erase_size / 1024); - device->blocks = malloc(sizeof(nand_block_t) * device->num_blocks); + nand->num_blocks = (nand->device->chip_size * 1024) / (nand->erase_size / 1024); + nand->blocks = malloc(sizeof(nand_block_t) * nand->num_blocks); - for (i = 0; i < device->num_blocks; i++) + for (i = 0; i < nand->num_blocks; i++) { - device->blocks[i].size = device->erase_size; - device->blocks[i].offset = i * device->erase_size; - device->blocks[i].is_erased = -1; - device->blocks[i].is_bad = -1; + nand->blocks[i].size = nand->erase_size; + nand->blocks[i].offset = i * nand->erase_size; + nand->blocks[i].is_erased = -1; + nand->blocks[i].is_bad = -1; } return ERROR_OK; } -static int nand_erase(struct nand_device_s *device, int first_block, int last_block) +static int nand_erase(struct nand_device_s *nand, int first_block, int last_block) { int i; uint32_t page; uint8_t status; int retval; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if ((first_block < 0) || (last_block > device->num_blocks)) + if ((first_block < 0) || (last_block > nand->num_blocks)) return ERROR_INVALID_ARGUMENTS; /* make sure we know if a block is bad before erasing it */ for (i = first_block; i <= last_block; i++) { - if (device->blocks[i].is_bad == -1) + if (nand->blocks[i].is_bad == -1) { - nand_build_bbt(device, i, last_block); + nand_build_bbt(nand, i, last_block); break; } } @@ -640,48 +640,48 @@ static int nand_erase(struct nand_device_s *device, int first_block, int last_bl for (i = first_block; i <= last_block; i++) { /* Send erase setup command */ - device->controller->command(device, NAND_CMD_ERASE1); + nand->controller->command(nand, NAND_CMD_ERASE1); - page = i * (device->erase_size / device->page_size); + page = i * (nand->erase_size / nand->page_size); /* Send page address */ - if (device->page_size <= 512) + if (nand->page_size <= 512) { /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 3rd cycle only on devices with more than 32 MiB */ - if (device->address_cycles >= 4) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 4) + nand->controller->address(nand, (page >> 16) & 0xff); /* 4th cycle only on devices with more than 8 GiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 24) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 24) & 0xff); } else { /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 3rd cycle only on devices with more than 128 MiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 16) & 0xff); } /* Send erase confirm command */ - device->controller->command(device, NAND_CMD_ERASE2); + nand->controller->command(nand, NAND_CMD_ERASE2); - retval = device->controller->nand_ready ? - device->controller->nand_ready(device, 1000) : - nand_poll_ready(device, 1000); + retval = nand->controller->nand_ready ? + nand->controller->nand_ready(nand, 1000) : + nand_poll_ready(nand, 1000); if (!retval) { LOG_ERROR("timeout waiting for NAND flash block erase to complete"); return ERROR_NAND_OPERATION_TIMEOUT; } - if ((retval = nand_read_status(device, &status)) != ERROR_OK) + if ((retval = nand_read_status(nand, &status)) != ERROR_OK) { LOG_ERROR("couldn't read status"); return ERROR_NAND_OPERATION_FAILED; @@ -690,43 +690,43 @@ static int nand_erase(struct nand_device_s *device, int first_block, int last_bl if (status & 0x1) { LOG_ERROR("didn't erase %sblock %d; status: 0x%2.2x", - (device->blocks[i].is_bad == 1) + (nand->blocks[i].is_bad == 1) ? "bad " : "", i, status); /* continue; other blocks might still be erasable */ } - device->blocks[i].is_erased = 1; + nand->blocks[i].is_erased = 1; } return ERROR_OK; } #if 0 -static int nand_read_plain(struct nand_device_s *device, uint32_t address, uint8_t *data, uint32_t data_size) +static int nand_read_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size) { uint8_t *page; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if (address % device->page_size) + if (address % nand->page_size) { LOG_ERROR("reads need to be page aligned"); return ERROR_NAND_OPERATION_FAILED; } - page = malloc(device->page_size); + page = malloc(nand->page_size); while (data_size > 0) { - uint32_t thisrun_size = (data_size > device->page_size) ? device->page_size : data_size; + uint32_t thisrun_size = (data_size > nand->page_size) ? nand->page_size : data_size; uint32_t page_address; - page_address = address / device->page_size; + page_address = address / nand->page_size; - nand_read_page(device, page_address, page, device->page_size, NULL, 0); + nand_read_page(nand, page_address, page, nand->page_size, NULL, 0); memcpy(data, page, thisrun_size); @@ -740,32 +740,32 @@ static int nand_read_plain(struct nand_device_s *device, uint32_t address, uint8 return ERROR_OK; } -static int nand_write_plain(struct nand_device_s *device, uint32_t address, uint8_t *data, uint32_t data_size) +static int nand_write_plain(struct nand_device_s *nand, uint32_t address, uint8_t *data, uint32_t data_size) { uint8_t *page; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if (address % device->page_size) + if (address % nand->page_size) { LOG_ERROR("writes need to be page aligned"); return ERROR_NAND_OPERATION_FAILED; } - page = malloc(device->page_size); + page = malloc(nand->page_size); while (data_size > 0) { - uint32_t thisrun_size = (data_size > device->page_size) ? device->page_size : data_size; + uint32_t thisrun_size = (data_size > nand->page_size) ? nand->page_size : data_size; uint32_t page_address; - memset(page, 0xff, device->page_size); + memset(page, 0xff, nand->page_size); memcpy(page, data, thisrun_size); - page_address = address / device->page_size; + page_address = address / nand->page_size; - nand_write_page(device, page_address, page, device->page_size, NULL, 0); + nand_write_page(nand, page_address, page, nand->page_size, NULL, 0); address += thisrun_size; data += thisrun_size; @@ -778,92 +778,92 @@ static int nand_write_plain(struct nand_device_s *device, uint32_t address, uint } #endif -int nand_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +int nand_write_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { uint32_t block; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - block = page / (device->erase_size / device->page_size); - if (device->blocks[block].is_erased == 1) - device->blocks[block].is_erased = 0; + block = page / (nand->erase_size / nand->page_size); + if (nand->blocks[block].is_erased == 1) + nand->blocks[block].is_erased = 0; - if (device->use_raw || device->controller->write_page == NULL) - return nand_write_page_raw(device, page, data, data_size, oob, oob_size); + if (nand->use_raw || nand->controller->write_page == NULL) + return nand_write_page_raw(nand, page, data, data_size, oob, oob_size); else - return device->controller->write_page(device, page, data, data_size, oob, oob_size); + return nand->controller->write_page(nand, page, data, data_size, oob, oob_size); } -static int nand_read_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +static int nand_read_page(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if (device->use_raw || device->controller->read_page == NULL) - return nand_read_page_raw(device, page, data, data_size, oob, oob_size); + if (nand->use_raw || nand->controller->read_page == NULL) + return nand_read_page_raw(nand, page, data, data_size, oob, oob_size); else - return device->controller->read_page(device, page, data, data_size, oob, oob_size); + return nand->controller->read_page(nand, page, data, data_size, oob, oob_size); } -int nand_read_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +int nand_read_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { uint32_t i; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - if (device->page_size <= 512) + if (nand->page_size <= 512) { /* small page device */ if (data) - device->controller->command(device, NAND_CMD_READ0); + nand->controller->command(nand, NAND_CMD_READ0); else - device->controller->command(device, NAND_CMD_READOOB); + nand->controller->command(nand, NAND_CMD_READOOB); /* column (always 0, we start at the beginning of a page/OOB area) */ - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 4th cycle only on devices with more than 32 MiB */ - if (device->address_cycles >= 4) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 4) + nand->controller->address(nand, (page >> 16) & 0xff); /* 5th cycle only on devices with more than 8 GiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 24) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 24) & 0xff); } else { /* large page device */ - device->controller->command(device, NAND_CMD_READ0); + nand->controller->command(nand, NAND_CMD_READ0); /* column (0 when we start at the beginning of a page, * or 2048 for the beginning of OOB area) */ - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); if (data) - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); else - device->controller->address(device, 0x8); + nand->controller->address(nand, 0x8); /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 5th cycle only on devices with more than 128 MiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 16) & 0xff); /* large page devices need a start command */ - device->controller->command(device, NAND_CMD_READSTART); + nand->controller->command(nand, NAND_CMD_READSTART); } - if (device->controller->nand_ready) { - if (!device->controller->nand_ready(device, 100)) + if (nand->controller->nand_ready) { + if (!nand->controller->nand_ready(nand, 100)) return ERROR_NAND_OPERATION_TIMEOUT; } else { alive_sleep(1); @@ -871,21 +871,21 @@ int nand_read_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *dat if (data) { - if (device->controller->read_block_data != NULL) - (device->controller->read_block_data)(device, data, data_size); + if (nand->controller->read_block_data != NULL) + (nand->controller->read_block_data)(nand, data, data_size); else { for (i = 0; i < data_size;) { - if (device->device->options & NAND_BUSWIDTH_16) + if (nand->device->options & NAND_BUSWIDTH_16) { - device->controller->read_data(device, data); + nand->controller->read_data(nand, data); data += 2; i += 2; } else { - device->controller->read_data(device, data); + nand->controller->read_data(nand, data); data += 1; i += 1; } @@ -895,21 +895,21 @@ int nand_read_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *dat if (oob) { - if (device->controller->read_block_data != NULL) - (device->controller->read_block_data)(device, oob, oob_size); + if (nand->controller->read_block_data != NULL) + (nand->controller->read_block_data)(nand, oob, oob_size); else { for (i = 0; i < oob_size;) { - if (device->device->options & NAND_BUSWIDTH_16) + if (nand->device->options & NAND_BUSWIDTH_16) { - device->controller->read_data(device, oob); + nand->controller->read_data(nand, oob); oob += 2; i += 2; } else { - device->controller->read_data(device, oob); + nand->controller->read_data(nand, oob); oob += 1; i += 1; } @@ -920,72 +920,72 @@ int nand_read_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *dat return ERROR_OK; } -int nand_write_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) +int nand_write_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) { uint32_t i; int retval; uint8_t status; - if (!device->device) + if (!nand->device) return ERROR_NAND_DEVICE_NOT_PROBED; - device->controller->command(device, NAND_CMD_SEQIN); + nand->controller->command(nand, NAND_CMD_SEQIN); - if (device->page_size <= 512) + if (nand->page_size <= 512) { /* column (always 0, we start at the beginning of a page/OOB area) */ - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 4th cycle only on devices with more than 32 MiB */ - if (device->address_cycles >= 4) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 4) + nand->controller->address(nand, (page >> 16) & 0xff); /* 5th cycle only on devices with more than 8 GiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 24) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 24) & 0xff); } else { /* column (0 when we start at the beginning of a page, * or 2048 for the beginning of OOB area) */ - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); if (data) - device->controller->address(device, 0x0); + nand->controller->address(nand, 0x0); else - device->controller->address(device, 0x8); + nand->controller->address(nand, 0x8); /* row */ - device->controller->address(device, page & 0xff); - device->controller->address(device, (page >> 8) & 0xff); + nand->controller->address(nand, page & 0xff); + nand->controller->address(nand, (page >> 8) & 0xff); /* 5th cycle only on devices with more than 128 MiB */ - if (device->address_cycles >= 5) - device->controller->address(device, (page >> 16) & 0xff); + if (nand->address_cycles >= 5) + nand->controller->address(nand, (page >> 16) & 0xff); } if (data) { - if (device->controller->write_block_data != NULL) - (device->controller->write_block_data)(device, data, data_size); + if (nand->controller->write_block_data != NULL) + (nand->controller->write_block_data)(nand, data, data_size); else { for (i = 0; i < data_size;) { - if (device->device->options & NAND_BUSWIDTH_16) + if (nand->device->options & NAND_BUSWIDTH_16) { uint16_t data_buf = le_to_h_u16(data); - device->controller->write_data(device, data_buf); + nand->controller->write_data(nand, data_buf); data += 2; i += 2; } else { - device->controller->write_data(device, *data); + nand->controller->write_data(nand, *data); data += 1; i += 1; } @@ -995,22 +995,22 @@ int nand_write_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *da if (oob) { - if (device->controller->write_block_data != NULL) - (device->controller->write_block_data)(device, oob, oob_size); + if (nand->controller->write_block_data != NULL) + (nand->controller->write_block_data)(nand, oob, oob_size); else { for (i = 0; i < oob_size;) { - if (device->device->options & NAND_BUSWIDTH_16) + if (nand->device->options & NAND_BUSWIDTH_16) { uint16_t oob_buf = le_to_h_u1... [truncated message content] |
From: David B. <dbr...@us...> - 2009-11-13 05:25:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d47764ff7176b6e3d97b49e82d4db7fe17c8e552 (commit) from 26849ad60d269b0e8d254882bc75268a393dd2a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d47764ff7176b6e3d97b49e82d4db7fe17c8e552 Author: David Brownell <dbr...@us...> Date: Thu Nov 12 20:24:41 2009 -0800 ETM: start support for ETMv2+ ARM11 and newer cores include updated ETM modules. Recognize their version codes and some key config differences. Sanity checked on an OMAP2, with an ETM11RV r0p1 (ETMv3.1). This still handles only scan chain 6, with at most 128 registers. Newer cores (mostly, Cortex) will need to use the DAP instead. Note that the newer ETM modules don't quite fit the quirky config model of the older ones ... having more port widths is easy, but the modes aren't the same. That still needs to change. Fix a curious bug ... how did the register cache NOT get saved?? Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 8547fda..bb96a2e 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -5295,11 +5295,23 @@ Several of the parameters must reflect the trace port capabilities, which are a function of silicon capabilties (exposed later using @command{etm info}) and of what hardware is connected to that port (such as an external pod, or ETB). -The @var{width} must be either 4, 8, or 16. -The @var{mode} must be @option{normal}, @option{multiplexted}, -or @option{demultiplexted}. +The @var{width} must be either 4, 8, or 16, +except with ETMv3.0 and newer modules which may also +support 1, 2, 24, 32, 48, and 64 bit widths. +(With those versions, @command{etm info} also shows whether +the selected port width and mode are supported.) + +The @var{mode} must be @option{normal}, @option{multiplexed}, +or @option{demultiplexed}. The @var{clocking} must be @option{half} or @option{full}. +@quotation Warning +With ETMv3.0 and newer, the bits set with the @var{mode} and +@var{clocking} parameters both control the mode. +This modified mode does not map to the values supported by +previous ETM modules, so this syntax is subject to change. +@end quotation + @quotation Note You can see the ETM registers using the @command{reg} command. Not all possible registers are present in every ETM. diff --git a/src/target/etm.c b/src/target/etm.c index 990c062..f01f366 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -72,11 +72,15 @@ struct etm_reg_info { * provide definitions for some previously-unused bits. */ -/* basic registers that are always there given the right ETM version */ +/* core registers used to version/configure the ETM */ static const struct etm_reg_info etm_core[] = { - /* NOTE: we "know" ETM_CONFIG is listed first */ + /* NOTE: we "know" the order here ... */ { ETM_CONFIG, 32, RO, 0x10, "ETM_config", }, + { ETM_ID, 32, RO, 0x20, "ETM_id", }, +}; +/* basic registers that are always there given the right ETM version */ +static const struct etm_reg_info etm_basic[] = { /* ETM Trace Registers */ { ETM_CTRL, 32, RW, 0x10, "ETM_ctrl", }, { ETM_TRIG_EVENT, 17, WO, 0x10, "ETM_trig_event", }, @@ -99,7 +103,10 @@ static const struct etm_reg_info etm_core[] = { /* REVISIT exclude VIEWDATA_CTRL2 when it's not there */ { 0x78, 12, WO, 0x20, "ETM_sync_freq", }, - { 0x79, 32, RO, 0x20, "ETM_id", }, + { 0x7a, 22, RO, 0x31, "ETM_config_code_ext", }, + { 0x7b, 32, WO, 0x31, "ETM_ext_input_select", }, + { 0x7c, 32, WO, 0x34, "ETM_trace_start_stop", }, + { 0x7d, 8, WO, 0x34, "ETM_behavior_control", }, }; static const struct etm_reg_info etm_fifofull[] = { @@ -310,10 +317,19 @@ reg_cache_t *etm_build_reg_cache(target_t *target, bcd_vers = 0x20; LOG_WARNING("ETMv2+ support is incomplete"); - /* REVISIT read ID register, distinguish ETMv3.3 etc; + /* REVISIT more registers may exist; they may now be + * readable; more register bits have defined meanings; * don't presume trace start/stop support is present; * and include any context ID comparator registers. */ + etm_reg_add(0x20, jtag_info, reg_cache, arch_info, + etm_core + 1, 1); + etm_get_reg(reg_list + 1); + etm_ctx->id = buf_get_u32( + (void *)&arch_info[1].value, 0, 32); + LOG_DEBUG("ETM ID: %08x", (unsigned) etm_ctx->id); + bcd_vers = 0x10 + (((etm_ctx->id) >> 4) & 0xff); + } else { switch (config >> 28) { case 7: @@ -343,7 +359,7 @@ reg_cache_t *etm_build_reg_cache(target_t *target, LOG_INFO("ETM v%d.%d", bcd_vers >> 4, bcd_vers & 0xf); etm_reg_add(bcd_vers, jtag_info, reg_cache, arch_info, - etm_core + 1, ARRAY_SIZE(etm_core) - 1); + etm_basic, ARRAY_SIZE(etm_basic)); /* address and data comparators; counters; outputs */ etm_reg_add(bcd_vers, jtag_info, reg_cache, arch_info, @@ -391,7 +407,7 @@ reg_cache_t *etm_build_reg_cache(target_t *target, etb->reg_cache = reg_cache->next; } - + etm_ctx->reg_cache = reg_cache; return reg_cache; } @@ -424,9 +440,13 @@ int etm_setup(target_t *target) /* clear the ETM powerdown bit (0) */ etm_ctrl_value &= ~0x1; - /* configure port width (6:4), mode (17:16) and clocking (13) */ - etm_ctrl_value = (etm_ctrl_value & - ~ETM_PORT_WIDTH_MASK & ~ETM_PORT_MODE_MASK & ~ETM_PORT_CLOCK_MASK) + /* configure port width (21,6:4), mode (13,17:16) and + * for older modules clocking (13) + */ + etm_ctrl_value = (etm_ctrl_value + & ~ETM_PORT_WIDTH_MASK + & ~ETM_PORT_MODE_MASK + & ~ETM_PORT_CLOCK_MASK) | etm_ctx->portmode; buf_set_u32(etm_ctrl_reg->value, 0, etm_ctrl_reg->size, etm_ctrl_value); @@ -435,6 +455,10 @@ int etm_setup(target_t *target) if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; + /* REVISIT for ETMv3.0 and later, read ETM_sys_config to + * verify that those width and mode settings are OK ... + */ + if ((retval = etm_ctx->capture_driver->init(etm_ctx)) != ERROR_OK) { LOG_ERROR("ETM capture driver initialization failed"); @@ -1373,10 +1397,23 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, return ERROR_FAIL; } + /* FIXME for ETMv3.0 and above -- and we don't yet know what ETM + * version we'll be using!! -- so we can't know how to validate + * params yet. "etm config" should likely be *AFTER* hookup... + * + * - Many more widths might be supported ... and we can easily + * check whether our setting "took". + * + * - The "clock" and "mode" bits are interpreted differently. + * See ARM IHI 0014O table 2-17 for the old behavior, and + * table 2-18 for the new. With ETB it's best to specify + * "normal full" ... + */ uint8_t port_width; COMMAND_PARSE_NUMBER(u8, args[1], port_width); switch (port_width) { + /* before ETMv3.0 */ case 4: portmode |= ETM_PORT_4BIT; break; @@ -1386,8 +1423,28 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, case 16: portmode |= ETM_PORT_16BIT; break; + /* ETMv3.0 and later*/ + case 24: + portmode |= ETM_PORT_24BIT; + break; + case 32: + portmode |= ETM_PORT_32BIT; + break; + case 48: + portmode |= ETM_PORT_48BIT; + break; + case 64: + portmode |= ETM_PORT_64BIT; + break; + case 1: + portmode |= ETM_PORT_1BIT; + break; + case 2: + portmode |= ETM_PORT_2BIT; + break; default: - command_print(cmd_ctx, "unsupported ETM port width '%s', must be 4, 8 or 16", args[1]); + command_print(cmd_ctx, + "unsupported ETM port width '%s'", args[1]); return ERROR_FAIL; } @@ -1473,6 +1530,7 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, etm_context_t *etm; reg_t *etm_sys_config_reg; int max_port_size; + uint32_t config; target = get_current_target(cmd_ctx); arm = target_to_arm(target); @@ -1511,6 +1569,9 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, command_print(cmd_ctx, "protocol version: %i", (int) (etm->config >> 28) & 0x07); else { + command_print(cmd_ctx, + "coprocessor and memory access %ssupported", + (etm->config & (1 << 26)) ? "" : "not "); command_print(cmd_ctx, "trace start/stop %spresent", (etm->config & (1 << 26)) ? "" : "not "); command_print(cmd_ctx, "number of context comparators: %i", @@ -1523,9 +1584,16 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, return ERROR_OK; etm_get_reg(etm_sys_config_reg); + config = buf_get_u32(etm_sys_config_reg->value, 0, 32); + + LOG_DEBUG("ETM SYS CONFIG %08x", (unsigned) config); - switch (buf_get_u32(etm_sys_config_reg->value, 0, 3)) + max_port_size = config & 0x7; + if (etm->bcd_vers >= 0x30) + max_port_size |= (config >> 6) & 0x08; + switch (max_port_size) { + /* before ETMv3.0 */ case 0: max_port_size = 4; break; @@ -1535,24 +1603,54 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, case 2: max_port_size = 16; break; + /* ETMv3.0 and later*/ + case 3: + max_port_size = 24; + break; + case 4: + max_port_size = 32; + break; + case 5: + max_port_size = 48; + break; + case 6: + max_port_size = 64; + break; + case 8: + max_port_size = 1; + break; + case 9: + max_port_size = 2; + break; default: LOG_ERROR("Illegal max_port_size"); return ERROR_FAIL; } command_print(cmd_ctx, "max. port size: %i", max_port_size); - command_print(cmd_ctx, "half-rate clocking %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 3, 1) == 1) ? "" : "not "); - command_print(cmd_ctx, "full-rate clocking %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 4, 1) == 1) ? "" : "not "); - command_print(cmd_ctx, "normal trace format %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 5, 1) == 1) ? "" : "not "); - command_print(cmd_ctx, "multiplex trace format %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 6, 1) == 1) ? "" : "not "); - command_print(cmd_ctx, "demultiplex trace format %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 7, 1) == 1) ? "" : "not "); + if (etm->bcd_vers < 0x30) { + command_print(cmd_ctx, "half-rate clocking %ssupported", + (config & (1 << 3)) ? "" : "not "); + command_print(cmd_ctx, "full-rate clocking %ssupported", + (config & (1 << 4)) ? "" : "not "); + command_print(cmd_ctx, "normal trace format %ssupported", + (config & (1 << 5)) ? "" : "not "); + command_print(cmd_ctx, "multiplex trace format %ssupported", + (config & (1 << 6)) ? "" : "not "); + command_print(cmd_ctx, "demultiplex trace format %ssupported", + (config & (1 << 7)) ? "" : "not "); + } else { + /* REVISIT show which size and format are selected ... */ + command_print(cmd_ctx, "current port size %ssupported", + (config & (1 << 10)) ? "" : "not "); + command_print(cmd_ctx, "current trace format %ssupported", + (config & (1 << 11)) ? "" : "not "); + } + if (etm->bcd_vers >= 0x21) + command_print(cmd_ctx, "fetch comparisons %ssupported", + (config & (1 << 17)) ? "not " : ""); command_print(cmd_ctx, "FIFO full %ssupported", - (buf_get_u32(etm_sys_config_reg->value, 8, 1) == 1) ? "" : "not "); + (config & (1 << 8)) ? "" : "not "); return ERROR_OK; } diff --git a/src/target/etm.h b/src/target/etm.h index 254db92..ead4585 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -68,6 +68,7 @@ enum /* N task contexts */ ETM_CONTEXTID_COMPARATOR_VALUE = 0x6c, ETM_CONTEXTID_COMPARATOR_MASK = 0x6f, + ETM_ID = 0x79, }; typedef struct etm_reg_s @@ -83,7 +84,13 @@ typedef enum ETM_PORT_4BIT = 0x00, ETM_PORT_8BIT = 0x10, ETM_PORT_16BIT = 0x20, - ETM_PORT_WIDTH_MASK = 0x70, + ETM_PORT_24BIT = 0x30, + ETM_PORT_32BIT = 0x40, + ETM_PORT_48BIT = 0x50, + ETM_PORT_64BIT = 0x60, + ETM_PORT_1BIT = 0x00 | (1 << 21), + ETM_PORT_2BIT = 0x10 | (1 << 21), + ETM_PORT_WIDTH_MASK = 0x70 | (1 << 21), /* Port modes */ ETM_PORT_NORMAL = 0x00000, ETM_PORT_MUXED = 0x10000, @@ -166,6 +173,7 @@ typedef struct etm bool ptr_ok; /* whether last_ptr is valid */ uint8_t bcd_vers; /* e.g. 0x13 == ETMv1.3 */ uint32_t config; /* cache of ETM_CONFIG value */ + uint32_t id; /* cache of ETM_ID value, or 0 */ uint32_t current_pc; /* current program counter */ uint32_t last_branch; /* last branch address output */ uint32_t last_branch_reason; /* type of last branch encountered */ ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 18 ++++++- src/target/etm.c | 142 +++++++++++++++++++++++++++++++++++++++++++++-------- src/target/etm.h | 10 ++++- 3 files changed, 144 insertions(+), 26 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-12 21:50:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 26849ad60d269b0e8d254882bc75268a393dd2a1 (commit) from de735d375b979377e124dc2daf1a5f473de19d81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 26849ad60d269b0e8d254882bc75268a393dd2a1 Author: Liam Redmond <in...@ro...> Date: Thu Nov 12 12:50:41 2009 -0800 WinXP-x64: find right D2XX libraries This trivial patch allows the config script to find the correct FTDI2xx libraries under Windows XP x64 using msys. Signed-off-by: David Brownell <dbr...@us...> diff --git a/configure.in b/configure.in index d7f8d47..fa2a498 100644 --- a/configure.in +++ b/configure.in @@ -736,12 +736,12 @@ if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then # And calculate the LDFLAGS for the machine case "$host_cpu" in - i?86|x86_*) + i?86|x86_32) LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386" LIBS="$LIBS -lftd2xx" f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib ;; - amd64) + amd64|x86_64) LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64" LIBS="$LIBS -lftd2xx" f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib ----------------------------------------------------------------------- Summary of changes: configure.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-12 21:39:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via de735d375b979377e124dc2daf1a5f473de19d81 (commit) from 5723e54fa9875dabe1a183ee59336cebe74d1516 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit de735d375b979377e124dc2daf1a5f473de19d81 Author: Jonas Horberg <jho...@sa...> Date: Thu Nov 12 12:39:37 2009 -0800 parport: add support for the jtag_khz command. Add the khz and speed_div functions to the parport interface driver. Add the parport_toggling_time function that tells the parport driver how long (in nanoseconds) it takes for the hardware to toggle TCK. [dbr...@us...: tweak doc for clarity, mention multimeter, and whitespace fixes] Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 475482d..8547fda 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -1975,6 +1975,42 @@ When using PPDEV to access the parallel port, use the number of the parallel por you may encounter a problem. @end deffn +@deffn Command {parport_toggling_time} [nanoseconds] +Displays how many nanoseconds the hardware needs to toggle TCK; +the parport driver uses this value to obey the +@command{jtag_khz} configuration. +When the optional @var{nanoseconds} parameter is given, +that setting is changed before displaying the current value. + +The default setting should work reasonably well on commodity PC hardware. +However, you may want to calibrate for your specific hardware. +@quotation Tip +To measure the toggling time with a logic analyzer or a digital storage +oscilloscope, follow the procedure below: +@example +> parport_toggling_time 1000 +> jtag_khz 500 +@end example +This sets the maximum JTAG clock speed of the hardware, but +the actual speed probably deviates from the requested 500 kHz. +Now, measure the time between the two closest spaced TCK transitions. +You can use @command{runtest 1000} or something similar to generate a +large set of samples. +Update the setting to match your measurement: +@example +> parport_toggling_time <measured nanoseconds> +@end example +Now the clock speed will be a better match for @command{jtag_khz rate} +commands given in OpenOCD scripts and event handlers. + +You can do something similar with many digital multimeters, but note +that you'll probably need to run the clock continuously for several +seconds before it decides what clock rate to show. Adjust the +toggling time up or down until the measured clock rate is a good +match for the jtag_khz rate you specified; be conservative. +@end quotation +@end deffn + @deffn {Config Command} {parport_write_on_exit} (on|off) This will configure the parallel driver to write a known cable-specific value to the parallel interface on exiting OpenOCD diff --git a/src/jtag/parport.c b/src/jtag/parport.c index fdf7df4..9b20290 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -105,6 +105,8 @@ static cable_t cables[] = static char* parport_cable = NULL; static uint16_t parport_port; static int parport_exit = 0; +static uint32_t parport_toggling_time_ns = 1000; +static int wait_states; /* interface variables */ @@ -152,7 +154,7 @@ static __inline__ void parport_write_data(void) static void parport_write(int tck, int tms, int tdi) { - int i = jtag_get_speed() + 1; + int i = wait_states + 1; if (tck) dataport_value |= cable->TCK_MASK; @@ -204,6 +206,26 @@ static void parport_led(int on) static int parport_speed(int speed) { + wait_states = speed; + return ERROR_OK; +} + +static int parport_khz(int khz, int* jtag_speed) +{ + if (khz == 0) { + LOG_DEBUG("RCLK not supported"); + return ERROR_FAIL; + } + + *jtag_speed = 499999 / (khz * parport_toggling_time_ns); + return ERROR_OK; +} + +static int parport_speed_div(int speed, int* khz) +{ + uint32_t denominator = (speed + 1) * parport_toggling_time_ns; + + *khz = (499999 + denominator) / denominator; return ERROR_OK; } @@ -364,6 +386,8 @@ static int parport_init(void) bitbang_interface = &parport_bitbang; + wait_states = jtag_get_speed(); + return ERROR_OK; } @@ -438,6 +462,32 @@ static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ct return ERROR_OK; } +static int +parport_handle_parport_toggling_time_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) +{ + if (argc == 1) { + uint32_t ns; + int retval = parse_u32(args[0], &ns); + + if (ERROR_OK != retval) + return retval; + + if (ns == 0) { + LOG_ERROR("0 ns is not a valid parport toggling time"); + return ERROR_FAIL; + } + + parport_toggling_time_ns = ns; + wait_states = jtag_get_speed(); + } + + command_print(cmd_ctx, "parport toggling time = %" PRIu32 " ns", + parport_toggling_time_ns); + + return ERROR_OK; +} + static int parport_register_commands(struct command_context_s *cmd_ctx) { register_command(cmd_ctx, NULL, "parport_port", @@ -455,14 +505,20 @@ static int parport_register_commands(struct command_context_s *cmd_ctx) "configure the parallel driver to write " "a known value to the parallel interface"); + register_command(cmd_ctx, NULL, "parport_toggling_time", + parport_handle_parport_toggling_time_command, COMMAND_ANY, + "time <ns> it takes for the hardware to toggle TCK"); + return ERROR_OK; } jtag_interface_t parport_interface = { - .name = "parport", - .register_commands = &parport_register_commands, - .init = &parport_init, - .quit = &parport_quit, - .speed = &parport_speed, - .execute_queue = &bitbang_execute_queue, - }; + .name = "parport", + .register_commands = parport_register_commands, + .init = parport_init, + .quit = parport_quit, + .khz = parport_khz, + .speed_div = parport_speed_div, + .speed = parport_speed, + .execute_queue = bitbang_execute_queue, +}; ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 36 ++++++++++++++++++++++++++ src/jtag/parport.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 100 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-12 19:29:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The annotated tag, v0.3.1 has been created at d0d6c63a7362ea0987f02fced833fe216b051a61 (tag) tagging 371530224ce8b485d3cff59a4d6062d148bdad02 (commit) replaces v0.3.0 tagged by David Brownell on Thu Nov 12 08:28:41 2009 -0800 - Log ----------------------------------------------------------------- The openocd-0.3.1 bugfix release. The v0.3.0 was kind of a brown-paper-bag ... bulk memory writes were broken because an MMU handling bug. David Brownell (3): Start v0.3.1 bugfix branch target: don't swap MMU/no-MMU work areas Version 0.3.1 ----------------------------------------------------------------------- hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-12 19:28:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, v0.3.1 has been updated via 371530224ce8b485d3cff59a4d6062d148bdad02 (commit) from c6ac97cf3b95ad5a9582ad6e6ea159d9d2aa9e1b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 371530224ce8b485d3cff59a4d6062d148bdad02 Author: David Brownell <dbr...@us...> Date: Thu Nov 12 08:27:26 2009 -0800 Version 0.3.1 Remove "-dev" tag Signed-off-by: David Brownell <dbr...@us...> diff --git a/configure.in b/configure.in index 4f5733e..0fb072b 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT([openocd], [0.3.1-dev], +AC_INIT([openocd], [0.3.1], [OpenOCD Mailing List <ope...@li...>]) AC_CONFIG_SRCDIR([src/openocd.c]) ----------------------------------------------------------------------- Summary of changes: configure.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-12 06:58:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 5723e54fa9875dabe1a183ee59336cebe74d1516 (commit) via e740536568f5943748f2159f0ef8baa4ab37dcb9 (commit) via 9855a11eddc38b812203facd7a52a71422b19272 (commit) via 3ae44019018b7fa9adbe7dcf49c2b79e8e11acea (commit) via 4b20ed6b5cf6bc73471dec7d1604a4684d1fc2ca (commit) from 5e1b500b173c7abaf9b78e32d31140c1bd4ba090 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5723e54fa9875dabe1a183ee59336cebe74d1516 Author: David Brownell <dbr...@us...> Date: Wed Nov 11 21:57:44 2009 -0800 ETM: remove old mid-level ETM handle Now that nothing uses the old ETM handle any more, remove it. Add minimal header tweaks, letting non-ARM7 and non-ARM9 cores access ETM facilities. Now ARM11 could support standard ETM (and ETB) access as soon as it derives from "struct arm" ... its scanchain 6 is used access the ETM, just like ARM7 and ARM9. The Cortex parts (both M3 and A8) will need modified access methods (via ETM init parameters), so they use the DAP. Our first A8 target (OMAP3) needs that for both ETM and ETB, but the M3 ETM isn't very useful without SWO trace support (it's painfully stripped down), so that support won't be worth adding for a while. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index c0145d9..a49dab2 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -30,7 +30,7 @@ #define ARM7_9_COMMON_H #include "breakpoints.h" -#include "etm.h" +#include "armv4_5.h" #define ARM7_9_COMMON_MAGIC 0x0a790a79 /**< */ @@ -39,7 +39,7 @@ */ typedef struct arm7_9_common_s { - armv4_5_common_t armv4_5_common; + struct arm armv4_5_common; uint32_t common_magic; arm_jtag_t jtag_info; /**< JTAG information for target */ @@ -69,8 +69,6 @@ typedef struct arm7_9_common_s bool fast_memory_access; bool dcc_downloads; - etm_context_t *etm_ctx; - struct working_area_s *dcc_working_area; int (*examine_debug_reason)(target_t *target); /**< Function for determining why debug state was entered */ diff --git a/src/target/armv4_5.h b/src/target/armv4_5.h index 4d87c08..1eaab12 100644 --- a/src/target/armv4_5.h +++ b/src/target/armv4_5.h @@ -29,6 +29,7 @@ #include "register.h" #include "target.h" #include "log.h" +#include "etm.h" typedef enum armv4_5_mode { diff --git a/src/target/etb.c b/src/target/etb.c index 28ef3ef..3a4e3fe 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -21,7 +21,7 @@ #include "config.h" #endif -#include "arm7_9_common.h" +#include "armv4_5.h" #include "etb.h" diff --git a/src/target/etm.c b/src/target/etm.c index 53d31a1..990c062 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -21,10 +21,9 @@ #include "config.h" #endif -#include "etm.h" +#include "armv4_5.h" #include "etb.h" #include "image.h" -#include "arm7_9_common.h" #include "arm_disassembler.h" diff --git a/src/target/etm.h b/src/target/etm.h index 2335c98..254db92 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -25,7 +25,6 @@ #include "trace.h" #include "arm_jtag.h" -#include "armv4_5.h" struct image_s; @@ -158,7 +157,7 @@ typedef struct etm uint32_t trace_depth; /* number of cycles to be analyzed, 0 if no data available */ etm_portmode_t portmode; /* normal, multiplexed or demultiplexed */ etmv1_tracemode_t tracemode; /* type of info trace contains */ - armv4_5_state_t core_state; /* current core state */ + int /*armv4_5_state_t*/ core_state; /* current core state */ struct image_s *image; /* source for target opcodes */ uint32_t pipe_index; /* current trace cycle */ uint32_t data_index; /* cycle holding next data packet */ diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index eba1865..0c5fc11 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -21,8 +21,8 @@ #include "config.h" #endif +#include "armv4_5.h" #include "etm_dummy.h" -#include "arm7_9_common.h" static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index 4ee84ff..e0048e6 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -21,8 +21,8 @@ #include "config.h" #endif +#include "armv4_5.h" #include "oocd_trace.h" -#include "arm7_9_common.h" /* * This is "proof of concept" code, for prototype hardware: commit e740536568f5943748f2159f0ef8baa4ab37dcb9 Author: David Brownell <dbr...@us...> Date: Wed Nov 11 21:55:19 2009 -0800 ETM: use new toplevel ETM handle Make ETM itself use the new toplevel ETM handle, instead of the to-be-removed lower level one. As of this patch, nothing should be using the old ARM7/ARM9-specific handle. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/etm.c b/src/target/etm.c index 795e056..53d31a1 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -410,8 +410,8 @@ int etm_setup(target_t *target) { int retval; uint32_t etm_ctrl_value; - struct arm7_9_common_s *arm7_9 = target_to_arm7_9(target); - etm_context_t *etm_ctx = arm7_9->etm_ctx; + struct arm *arm = target_to_arm(target); + etm_context_t *etm_ctx = arm->etm; reg_t *etm_ctrl_reg; etm_ctrl_reg = etm_reg_lookup(etm_ctx, ETM_CTRL); @@ -1229,17 +1229,15 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm = target_to_arm(target); struct etm *etm; - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) - { + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - etm = arm7_9->etm_ctx; + etm = arm->etm; if (!etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1355,7 +1353,6 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, { target_t *target; struct arm *arm; - arm7_9_common_t *arm7_9; etm_portmode_t portmode = 0x0; struct etm *etm_ctx; int i; @@ -1370,8 +1367,8 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, return ERROR_FAIL; } - if (arm7_9_get_arch_pointers(target, &arm, &arm7_9) != ERROR_OK) - { + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "target '%s' is '%s'; not an ARM", target->cmd_name, target_get_name(target)); return ERROR_FAIL; @@ -1464,7 +1461,6 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, etm_ctx->portmode = portmode; etm_ctx->core_state = ARMV4_5_STATE_ARM; - arm7_9->etm_ctx = etm_ctx; arm->etm = etm_ctx; return etm_register_user_commands(cmd_ctx); @@ -1474,22 +1470,20 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm; reg_t *etm_sys_config_reg; - int max_port_size; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - etm = arm7_9->etm_ctx; + etm = arm->etm; if (!etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); @@ -1568,25 +1562,24 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm; trace_status_t trace_status; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!arm7_9->etm_ctx) + etm = arm->etm; + if (!etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; } - etm = arm7_9->etm_ctx; /* ETM status */ if (etm->bcd_vers >= 0x11) { @@ -1646,8 +1639,7 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; if (argc < 1) @@ -1657,14 +1649,15 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, } target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1707,8 +1700,7 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, { fileio_t file; target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; uint32_t i; @@ -1719,14 +1711,15 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, } target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1776,8 +1769,7 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, { fileio_t file; target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; uint32_t i; @@ -1788,14 +1780,15 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, } target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1860,19 +1853,19 @@ static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1902,20 +1895,19 @@ static int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; reg_t *etm_ctrl_reg; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - etm_ctx = arm7_9->etm_ctx; + etm_ctx = arm->etm; if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); @@ -1952,20 +1944,20 @@ static int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; reg_t *etm_ctrl_reg; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; @@ -1992,20 +1984,20 @@ static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; etm_context_t *etm_ctx; int retval; target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { command_print(cmd_ctx, "ETM: current target isn't an ARM"); return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm->etm; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); return ERROR_FAIL; commit 9855a11eddc38b812203facd7a52a71422b19272 Author: David Brownell <dbr...@us...> Date: Wed Nov 11 21:52:02 2009 -0800 ETM: update port drivers Make both useful ETM port drivers (etb, etm_dummy) use the new toplevel ETM handle, instead of the to-be-removed lower level one. Do the same for the "oocd-trace" prototype too; and fix its error reporting paths: return failure codes, don't exit(), etc Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/etb.c b/src/target/etb.c index 41312be..28ef3ef 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -353,8 +353,7 @@ static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cm { target_t *target; jtag_tap_t *tap; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; if (argc != 2) { @@ -369,9 +368,10 @@ static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cm return ERROR_FAIL; } - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { - command_print(cmd_ctx, "ETB: current target isn't an ARM7/ARM9 target"); + command_print(cmd_ctx, "ETB: '%s' isn't an ARM", args[0]); return ERROR_FAIL; } @@ -382,11 +382,11 @@ static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cm return ERROR_FAIL; } - if (arm7_9->etm_ctx) + if (arm->etm) { etb_t *etb = malloc(sizeof(etb_t)); - arm7_9->etm_ctx->capture_driver_priv = etb; + arm->etm->capture_driver_priv = etb; etb->tap = tap; etb->cur_scan_chain = 0xffffffff; diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 4b84fd3..eba1865 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -28,8 +28,7 @@ static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; target = get_target(args[0]); @@ -39,15 +38,16 @@ static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, ch return ERROR_FAIL; } - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); + command_print(cmd_ctx, "target '%s' isn't an ARM", args[0]); return ERROR_FAIL; } - if (arm7_9->etm_ctx) + if (arm->etm) { - arm7_9->etm_ctx->capture_driver_priv = NULL; + arm->etm->capture_driver_priv = NULL; } else { diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index f2fdaa3..4ee84ff 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -292,29 +292,28 @@ etm_capture_driver_t oocd_trace_capture_driver = static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; if (argc != 2) { LOG_ERROR("incomplete 'oocd_trace config <target> <tty>' command"); - exit(-1); + return ERROR_FAIL; } target = get_current_target(cmd_ctx); - - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "current target isn't an ARM"); + return ERROR_FAIL; } - if (arm7_9->etm_ctx) + if (arm->etm) { oocd_trace_t *oocd_trace = malloc(sizeof(oocd_trace_t)); - arm7_9->etm_ctx->capture_driver_priv = oocd_trace; - oocd_trace->etm_ctx = arm7_9->etm_ctx; + arm->etm->capture_driver_priv = oocd_trace; + oocd_trace->etm_ctx = arm->etm; /* copy name of TTY device used to communicate with OpenOCD + trace */ oocd_trace->tty = strndup(args[1], 256); @@ -330,32 +329,32 @@ static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, c static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; oocd_trace_t *oocd_trace; uint32_t status; target = get_current_target(cmd_ctx); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "current target isn't an ARM"); + return ERROR_FAIL; } - if (!arm7_9->etm_ctx) + if (!arm->etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } - if (strcmp(arm7_9->etm_ctx->capture_driver->name, "oocd_trace") != 0) + if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) { command_print(cmd_ctx, "current target's ETM capture driver isn't 'oocd_trace'"); - return ERROR_OK; + return ERROR_FAIL; } - oocd_trace = (oocd_trace_t*)arm7_9->etm_ctx->capture_driver_priv; + oocd_trace = (oocd_trace_t*)arm->etm->capture_driver_priv; oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status); @@ -370,33 +369,33 @@ static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, c static int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; - arm7_9_common_t *arm7_9; + struct arm *arm; oocd_trace_t *oocd_trace; size_t bytes_written; uint8_t cmd_array[1]; target = get_current_target(cmd_ctx); - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + arm = target_to_arm(target); + if (!is_arm(arm)) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "current target isn't an ARM"); + return ERROR_FAIL; } - if (!arm7_9->etm_ctx) + if (!arm->etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } - if (strcmp(arm7_9->etm_ctx->capture_driver->name, "oocd_trace") != 0) + if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) { command_print(cmd_ctx, "current target's ETM capture driver isn't 'oocd_trace'"); - return ERROR_OK; + return ERROR_FAIL; } - oocd_trace = (oocd_trace_t*)arm7_9->etm_ctx->capture_driver_priv; + oocd_trace = (oocd_trace_t*)arm->etm->capture_driver_priv; cmd_array[0] = 0xf0; commit 3ae44019018b7fa9adbe7dcf49c2b79e8e11acea Author: David Brownell <dbr...@us...> Date: Wed Nov 11 21:50:10 2009 -0800 ETM: update arm[79]tdmi_examine() Make ARM7 and ARM9 cores use the new toplevel ETM handle to trigger ETM setup, not the to-be-removed lower level one. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index 8b929d4..f58ffe2 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -663,11 +663,12 @@ int arm7tdmi_examine(struct target_s *target) (*cache_p) = t; arm7_9->eice_cache = (*cache_p); - if (arm7_9->etm_ctx) + if (arm7_9->armv4_5_common.etm) { arm_jtag_t *jtag_info = &arm7_9->jtag_info; - (*cache_p)->next = etm_build_reg_cache(target, jtag_info, arm7_9->etm_ctx); - arm7_9->etm_ctx->reg_cache = (*cache_p)->next; + (*cache_p)->next = etm_build_reg_cache(target, + jtag_info, arm7_9->armv4_5_common.etm); + arm7_9->armv4_5_common.etm->reg_cache = (*cache_p)->next; } target_set_examined(target); } @@ -675,7 +676,7 @@ int arm7tdmi_examine(struct target_s *target) return retval; if ((retval = arm7_9_setup(target)) != ERROR_OK) return retval; - if (arm7_9->etm_ctx) + if (arm7_9->armv4_5_common.etm) { if ((retval = etm_setup(target)) != ERROR_OK) return retval; diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 9455c05..58b8efd 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -758,11 +758,12 @@ int arm9tdmi_examine(struct target_s *target) (*cache_p) = t; arm7_9->eice_cache = (*cache_p); - if (arm7_9->etm_ctx) + if (arm7_9->armv4_5_common.etm) { arm_jtag_t *jtag_info = &arm7_9->jtag_info; - (*cache_p)->next = etm_build_reg_cache(target, jtag_info, arm7_9->etm_ctx); - arm7_9->etm_ctx->reg_cache = (*cache_p)->next; + (*cache_p)->next = etm_build_reg_cache(target, + jtag_info, arm7_9->armv4_5_common.etm); + arm7_9->armv4_5_common.etm->reg_cache = (*cache_p)->next; } target_set_examined(target); } @@ -770,7 +771,7 @@ int arm9tdmi_examine(struct target_s *target) return retval; if ((retval = arm7_9_setup(target)) != ERROR_OK) return retval; - if (arm7_9->etm_ctx) + if (arm7_9->armv4_5_common.etm) { if ((retval = etm_setup(target)) != ERROR_OK) return retval; commit 4b20ed6b5cf6bc73471dec7d1604a4684d1fc2ca Author: David Brownell <dbr...@us...> Date: Wed Nov 11 21:49:14 2009 -0800 ARM: start generalized base type Rename "struct armv4_5_common_s" as "struct arm". It needs a bit more work to be properly generic, and to move out of this header, but it's the best start we have on that today. Add and initialize an optional ETM pointer, since that will be the first thing that gets generalized. The intent being: all ARMs should eventually derive from this "struct arm", so they can reuse the current ETM logic. (And later, more.) Currently the ARM cores that *don't* so derive are only ARMv7-M (and thus Cortex-M3) and ARM11. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/armv4_5.h b/src/target/armv4_5.h index d76ce75..4d87c08 100644 --- a/src/target/armv4_5.h +++ b/src/target/armv4_5.h @@ -73,25 +73,51 @@ enum #define ARMV4_5_COMMON_MAGIC 0x0A450A45 -typedef struct armv4_5_common_s +/* NOTE: this is being morphed into a generic toplevel holder for ARMs. */ +#define armv4_5_common_s arm + +/** + * Represents a generic ARM core, with standard application registers. + * + * There are sixteen application registers (including PC, SP, LR) and a PSR. + * Cortex-M series cores do not support as many core states or shadowed + * registers as traditional ARM cores, and only support Thumb2 instructions. + */ +typedef struct arm { int common_magic; reg_cache_t *core_cache; + int /* armv4_5_mode */ core_mode; enum armv4_5_state core_state; + + /** Flag reporting unavailability of the BKPT instruction. */ bool is_armv4; + + /** Handle for the Embedded Trace Module, if one is present. */ + struct etm *etm; + int (*full_context)(struct target_s *target); - int (*read_core_reg)(struct target_s *target, int num, enum armv4_5_mode mode); - int (*write_core_reg)(struct target_s *target, int num, enum armv4_5_mode mode, uint32_t value); + int (*read_core_reg)(struct target_s *target, + int num, enum armv4_5_mode mode); + int (*write_core_reg)(struct target_s *target, + int num, enum armv4_5_mode mode, uint32_t value); void *arch_info; } armv4_5_common_t; -static inline struct armv4_5_common_s * -target_to_armv4_5(struct target_s *target) +#define target_to_armv4_5 target_to_arm + +/** Convert target handle to generic ARM target state handle. */ +static inline struct arm *target_to_arm(struct target_s *target) { return target->arch_info; } +static inline bool is_arm(struct arm *arm) +{ + return arm && arm->common_magic == ARMV4_5_COMMON_MAGIC; +} + typedef struct armv4_5_algorithm_s { int common_magic; diff --git a/src/target/etm.c b/src/target/etm.c index b571809..795e056 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1354,7 +1354,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target; - armv4_5_common_t *armv4_5; + struct arm *arm; arm7_9_common_t *arm7_9; etm_portmode_t portmode = 0x0; struct etm *etm_ctx; @@ -1370,7 +1370,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, return ERROR_FAIL; } - if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + if (arm7_9_get_arch_pointers(target, &arm, &arm7_9) != ERROR_OK) { command_print(cmd_ctx, "target '%s' is '%s'; not an ARM", target->cmd_name, target_get_name(target)); @@ -1461,22 +1461,11 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, etm_ctx->target = target; etm_ctx->trigger_percent = 50; etm_ctx->trace_data = NULL; - etm_ctx->trace_depth = 0; etm_ctx->portmode = portmode; - etm_ctx->tracemode = 0x0; etm_ctx->core_state = ARMV4_5_STATE_ARM; - etm_ctx->image = NULL; - etm_ctx->pipe_index = 0; - etm_ctx->data_index = 0; - etm_ctx->current_pc = 0x0; - etm_ctx->pc_ok = 0; - etm_ctx->last_branch = 0x0; - etm_ctx->last_branch_reason = 0x0; - etm_ctx->last_ptr = 0x0; - etm_ctx->ptr_ok = 0x0; - etm_ctx->last_instruction = 0; arm7_9->etm_ctx = etm_ctx; + arm->etm = etm_ctx; return etm_register_user_commands(cmd_ctx); } ----------------------------------------------------------------------- Summary of changes: src/target/arm7_9_common.h | 6 +-- src/target/arm7tdmi.c | 9 ++-- src/target/arm9tdmi.c | 9 ++-- src/target/armv4_5.h | 37 +++++++++++-- src/target/etb.c | 14 +++--- src/target/etm.c | 128 ++++++++++++++++++------------------------- src/target/etm.h | 3 +- src/target/etm_dummy.c | 14 +++--- src/target/oocd_trace.c | 61 ++++++++++----------- 9 files changed, 143 insertions(+), 138 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-11 23:39:05
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 5e1b500b173c7abaf9b78e32d31140c1bd4ba090 (commit) from 158698e3331b446243b863ab8b58ebee2c56f0cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5e1b500b173c7abaf9b78e32d31140c1bd4ba090 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 23:10:26 2009 -0800 fix 'jtag interface' behavior Without this patch, running "openocd -c 'jtag interface'" segfaults. Now, it returns the string "undefined" when the interface is unset. diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 71efc8b..b86e006 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -422,7 +422,8 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; } - Jim_SetResultString(goi.interp, jtag_interface->name, -1); + const char *name = jtag_interface ? jtag_interface->name : NULL; + Jim_SetResultString(goi.interp, name ? : "undefined", -1); return JIM_OK; case JTAG_CMD_INIT: if (goi.argc != 0) { ----------------------------------------------------------------------- Summary of changes: src/jtag/tcl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |