FreeCalypso > hg > freecalypso-sw
changeset 977:ce0ded19a769
rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Thu, 10 Dec 2015 04:00:08 +0000 |
parents | ca65f5adf1af |
children | 1ee80bcb0fd0 |
files | rvinterf/etmsync/fscmdtab.c rvinterf/etmsync/memcmd.c rvinterf/etmsync/memops.c rvinterf/include/tm3.h |
diffstat | 4 files changed, 113 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/etmsync/fscmdtab.c Sun Nov 29 05:22:41 2015 +0000 +++ b/rvinterf/etmsync/fscmdtab.c Thu Dec 10 04:00:08 2015 +0000 @@ -19,6 +19,7 @@ extern int cmd_ls(); extern int cmd_memdump(); extern int cmd_mkdir(); +extern int cmd_omemdump(); extern int cmd_preformat(); extern int cmd_readlink(); extern int cmd_set_imeisv(); @@ -50,6 +51,7 @@ {"memdump", 2, 2, cmd_memdump}, {"mkdir", 1, 1, cmd_mkdir}, {"mk-std-dirs", 0, 0, create_std_dirs}, + {"omemdump", 2, 2, cmd_omemdump}, {"preformat", 0, 0, cmd_preformat}, {"readlink", 1, 1, cmd_readlink}, {"set-imeisv", 2, 2, cmd_set_imeisv},
--- a/rvinterf/etmsync/memcmd.c Sun Nov 29 05:22:41 2015 +0000 +++ b/rvinterf/etmsync/memcmd.c Thu Dec 10 04:00:08 2015 +0000 @@ -8,6 +8,7 @@ #include <string.h> #include <strings.h> #include "etm.h" +#include "tm3.h" #include "limits.h" #include "localtypes.h" #include "exitcodes.h" @@ -58,6 +59,27 @@ return(0); } +cmd_omemdump(argc, argv) + char **argv; +{ + u_char databuf[TM3_MEMREAD_MAX]; + u32 memaddr; + int rc, sz, off, l; + + memaddr = strtoul(argv[1], 0, 16); + sz = strtoul(argv[2], 0, 16); + rc = do_memory_read_tm3(memaddr, databuf, sz); + if (rc) + return(rc); + for (off = 0; off < sz; off += 16) { + l = sz - off; + if (l > 16) + l = 16; + memdump_line(memaddr + off, databuf + off, l); + } + return(0); +} + cmd_dieid() { u_char buf[8];
--- a/rvinterf/etmsync/memops.c Sun Nov 29 05:22:41 2015 +0000 +++ b/rvinterf/etmsync/memops.c Thu Dec 10 04:00:08 2015 +0000 @@ -8,6 +8,7 @@ #include <string.h> #include <strings.h> #include "etm.h" +#include "tm3.h" #include "limits.h" #include "localtypes.h" #include "exitcodes.h" @@ -95,6 +96,47 @@ return(0); } +do_memory_read_tm3(memaddr, databuf, nbytes) + u32 memaddr; + u_char *databuf; +{ + u_char cmdpkt[11]; + int rc; + + if (nbytes > TM3_MEMREAD_MAX) { + printf("error: # of bytes to read may not exceed %d\n", + TM3_MEMREAD_MAX); + return(ERROR_USAGE); + } + cmdpkt[1] = MEM_READ; + cmdpkt[2] = memaddr; + cmdpkt[3] = memaddr >> 8; + cmdpkt[4] = memaddr >> 16; + cmdpkt[5] = memaddr >> 24; + cmdpkt[6] = nbytes; + cmdpkt[7] = 0; + cmdpkt[8] = 0; + cmdpkt[9] = 0; + rc = etm_pkt_exch(cmdpkt, 9); + if (rc) + return(rc); + if (rvi_msg[3]) { + printf("TM3 error response to mem read request: 0x%02X\n", + rvi_msg[3]); + return(ERROR_TARGET); + } + if (rvi_msg_len != nbytes + 9) { + printf("error: mem read response has wrong length\n"); + return(ERROR_TARGET); + } + if (rvi_msg[4] != nbytes || rvi_msg[5] || rvi_msg[6] || rvi_msg[7]) { + printf("error: mem read response has wrong length echo\n"); + return(ERROR_TARGET); + } + bcopy(rvi_msg + 8, databuf, nbytes); + return(0); +} + do_dieid_read(databuf) u_char *databuf; {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/include/tm3.h Thu Dec 10 04:00:08 2015 +0000 @@ -0,0 +1,47 @@ +/* + * This header file contains various definitions for talking to the old + * non-enhanced Test Mode firmware component. + */ + +/* CID opcodes */ +enum +{ + TM_INIT = 0x20, + TM_MODE_SET = 0x21, + VERSION_GET = 0x22, + RF_ENABLE = 0x23, + STATS_READ = 0x24, + STATS_CONFIG_WRITE = 0x25, + STATS_CONFIG_READ = 0x26, + RF_PARAM_WRITE = 0x30, + RF_PARAM_READ = 0x31, + RF_TABLE_WRITE = 0x32, + RF_TABLE_READ = 0x33, + RX_PARAM_WRITE = 0x34, + RX_PARAM_READ = 0x35, + TX_PARAM_WRITE = 0x36, + TX_PARAM_READ = 0x37, + TX_TEMPLATE_WRITE = 0x38, + TX_TEMPLATE_READ = 0x39, + MEM_WRITE = 0x40, + MEM_READ = 0x41, + CODEC_WRITE = 0x42, + CODEC_READ = 0x43, + MISC_PARAM_WRITE = 0x44, + MISC_PARAM_READ = 0x45, + MISC_TABLE_WRITE = 0x46, + MISC_TABLE_READ = 0x47, + MISC_ENABLE = 0x48, + SPECIAL_PARAM_WRITE = 0x50, + SPECIAL_PARAM_READ = 0x51, + SPECIAL_TABLE_WRITE = 0x52, + SPECIAL_TABLE_READ = 0x53, + SPECIAL_ENABLE = 0x54, + + TPU_TABLE_WRITE = 0x55, + TPU_TABLE_READ = 0x56, + + TM_FFS = 0x70 +}; + +#define TM3_MEMREAD_MAX 0x7C