⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xcmd.c

📁 gdb for adsp develop
💻 C
📖 第 1 页 / 共 2 页
字号:
      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  5) & 0x01));    /* dw */      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  4) & 0x01));    /* vf */      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  3) & 0x01));    /* rv */      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  2) & 0x01));    /* bo */      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  1) & 0x01));    /* cp */      sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >>  0) & 0x01));    /* cd */      sprintf(&prtbuf[strlen(prtbuf)], "\n");      sprintf(&prtbuf[strlen(prtbuf)], "\n");      }   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   /* Print CHA / CHD / CHC */   sprintf(&prtbuf[0], "  CHA       CHD     CHC: CE CNTL CR LS ML ST LA TF TR NN CV\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   sprintf(&prtbuf[0], "%08lx  ", cha);     /* cha */   sprintf(&prtbuf[strlen(prtbuf)], "%08lx       ", chd);  /* chd */   sprintf(&prtbuf[strlen(prtbuf)], "%2x", ((chc >>  31) & 0x01));    /* ce   */   sprintf(&prtbuf[strlen(prtbuf)], "%5x", ((chc >>  24) & 0xff));    /* cntl */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  16) & 0xff));    /* cr   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  15) & 0x01));    /* ls   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  14) & 0x01));    /* ml   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  13) & 0x01));    /* st   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  12) & 0x01));    /* la   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>  10) & 0x01));    /* tf   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>   2) & 0xff));    /* tr   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>   1) & 0x01));    /* nn   */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >>   0) & 0x01));    /* cv   */   sprintf(&prtbuf[strlen(prtbuf)], "\n");   sprintf(&prtbuf[strlen(prtbuf)], "\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   /* Print RBP */   sprintf(&prtbuf[0], "RBP: BF BE BD BC BB BA B9 B8 B7 B6 B5 B4 B3 B2 B1 B0\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   sprintf(&prtbuf[0], "    %3x", ((rbp >>  15) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>  14) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>  13) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>  12) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>  11) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>  10) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   9) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   8) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   7) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   6) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   5) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   4) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   3) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   2) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   1) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >>   0) & 0x01));   sprintf(&prtbuf[strlen(prtbuf)], "\n");   sprintf(&prtbuf[strlen(prtbuf)], "\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   /* Print TMC / TMR / PC0 / PC1 / PC2 */   sprintf(&prtbuf[0], " TCV TR: OV IN IE   TRV     PC0      PC1      PC2\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   sprintf(&prtbuf[0], "%06lx", (tmc & 0x00ffffff));      /* tcv */   sprintf(&prtbuf[strlen(prtbuf)], "%5x", ((tmr >> 26) & 0x01));  /* ov  */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((tmr >> 25) & 0x01));  /* in  */   sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((tmr >> 24) & 0x01));  /* ie  */   sprintf(&prtbuf[strlen(prtbuf)], "  %06lx", (tmr & 0x00ffffff));    /* trv */   sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc0);                /* pc0 */   sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc1);                /* pc1 */   sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc2);                /* pc2 */   sprintf(&prtbuf[strlen(prtbuf)], "\n");   sprintf(&prtbuf[strlen(prtbuf)], "\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   /* Print MMUC / LRU */   sprintf(&prtbuf[0], "MMU: PS PID LRU\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   sprintf(&prtbuf[0], "     %02x", ((mmuc >>  8) & 0x03));  /* ps  */   sprintf(&prtbuf[strlen(prtbuf)], "  %02x", (mmuc & 0xff));             /* pid */   sprintf(&prtbuf[strlen(prtbuf)], "  %02x", (lru & 0xff));              /* lru */   sprintf(&prtbuf[strlen(prtbuf)], "\n");   sprintf(&prtbuf[strlen(prtbuf)], "\n");   if (io_config.echo_mode == (INT32) TRUE)      fprintf (io_config.echo_file, "%s", &prtbuf[0]);   fprintf (stderr, "%s", &prtbuf[0]);   return (0);   }  /* end xp_cmd() *//*** This command is used to examine the contents of the cache** in the Am29030.  First set 0 is printed, starting with the** tag, followed by a disassembly of four instructions in** the set.  Set 1 for the line follows similarly.**** The data comes in from the READ_ACK message in the following** order:****            tag      (data[0-3]    (set 0)**         instr1      (data[4-7]**         instr1      (data[8-11]**         instr1      (data[12-15]**         instr1      (data[16-19]****            tag      (data[20-23]  (set 1)**         instr1      (data[24-27]**         instr1      (data[28-31]**         instr1      (data[32-35]**         instr1      (data[36-39]*/INT32xc_cmd(token, token_count)   char   *token[];   int     token_count;   {   static INT32  memory_space=I_CACHE;   static ADDR32 cache_line=0;   static INT32  byte_count=(10*sizeof(INST32));   static INT32  count=1;   ADDR32 address;   INT32  i;   int    j;   int    set;   int    index;   int    result;   struct instr_t instr;   INT32  cache_line_start;   INT32  cache_line_end;   INT32	retval;   INT32	bytes_ret;   INT32	host_endian;   BYTE		read_buffer[10*sizeof(INST32)];   char		prtbuf[256];   /* Is it an 'xc' command? */   if (strcmp(token[0], "xc") != 0)      return (EMSYNTAX);   /*   ** Parse parameters   */   if (token_count == 1) {      cache_line = cache_line + count;      }   else   if (token_count == 2) {      result = get_word(token[1], &cache_line_start);      if (result != 0)         return (EMSYNTAX);      if ((cache_line_start < 0) ||          (cache_line_start >255))         return (EMBADADDR);      cache_line = cache_line_start;      }   else   if (token_count == 3) {      /* Get first cache line to be dumped */      result = get_word(token[1], &cache_line_start);      if (result != 0)         return (EMSYNTAX);      if ((cache_line_start < 0) ||          (cache_line_start > 255))         return (EMBADADDR);      /* Get last cache line to be dumped */      result = get_word(token[2], &cache_line_end);      if (result != 0)         return (EMSYNTAX);      if ((cache_line_end < 0) ||          (cache_line_end > 255))         return (EMBADADDR);      if (cache_line_start > cache_line_end)         return (EMBADADDR);      cache_line = cache_line_start;      count = (cache_line_end - cache_line_start) + 1;      }   else   /* Too many args */      return (EMSYNTAX);   i = 0;   while (i < count) {      host_endian = FALSE;      if ((retval = Mini_read_req(memory_space,				  (cache_line + i),				  byte_count/4,				  (INT16) 4, /* size */				  &bytes_ret,				  read_buffer,				  host_endian)) != SUCCESS) {	 return(FAILURE);      };      /* The following is executed if SUCCESSful */      for (set=0; set<2; set++) {         /* Print out formatted address tag and status information */         index = (set * 20);         sprintf(&prtbuf[0], "\n");         sprintf(&prtbuf[strlen(prtbuf)], "Cache line 0x%lx, set %d.\n", (int) (cache_line+i), set);         sprintf(&prtbuf[strlen(prtbuf)], "\n");         if (io_config.echo_mode == (INT32) TRUE)            fprintf (io_config.echo_file, "%s", &prtbuf[0]);         fprintf (stderr, "%s", &prtbuf[0]);         sprintf(&prtbuf[0], "IATAG  V  P US\n");         if (io_config.echo_mode == (INT32) TRUE)            fprintf (io_config.echo_file, "%s", &prtbuf[0]);         fprintf (stderr, "%s", &prtbuf[0]);         sprintf(&prtbuf[0], "%02x%02x%1x  %1x  %1x  %1x\n",                read_buffer[index],                read_buffer[index + 1],                ((read_buffer[index + 2] >> 4) & 0x0f),                ((read_buffer[index + 3] >> 2) & 0x01),                ((read_buffer[index + 3] >> 1) & 0x01),                (read_buffer[index + 3] & 0x01));         sprintf(&prtbuf[strlen(prtbuf)], "\n");   	 if (io_config.echo_mode == (INT32) TRUE)      	   fprintf (io_config.echo_file, "%s", &prtbuf[0]);   	 fprintf (stderr, "%s", &prtbuf[0]);         /* Address = IATAG + line_number + <16 byte adddress> */         address = ((read_buffer[index] << 24) |                    (read_buffer[index + 1] << 16) |                    (read_buffer[index + 2] << 8) |                    ((cache_line+i) << 4));         /* Disassemble four words */         for (j=0; j<4; j=j+1) {            index = (set * 20) + ((j+1) * sizeof(INT32));            instr.op = read_buffer[index];            instr.c = read_buffer[index + 1];            instr.a = read_buffer[index + 2];            instr.b = read_buffer[index + 3];            /* Print address of instruction (in hex) */            address = (address & 0xfffffff0);  /* Clear low four bits */            address = (address | (j << 2));            fprintf(stderr, "%08lx    ", address);	    if (io_config.echo_mode == (INT32) TRUE)               fprintf(io_config.echo_file, "%08lx    ", address);            /* Print instruction (in hex) */	    if (io_config.echo_mode == (INT32) TRUE)               fprintf(io_config.echo_file, "%02x%02x%02x%02x    ", instr.op, instr.c,                   instr.a, instr.b);            fprintf(stderr, "%02x%02x%02x%02x    ", instr.op, instr.c,                   instr.a, instr.b);            /* Disassemble instruction */            dasm_instr(address, &instr);            fprintf(stderr, "\n");	    if (io_config.echo_mode == (INT32) TRUE)               fprintf(io_config.echo_file, "\n");            }  /* end for(j) */         fprintf(stderr, "\n");	 if (io_config.echo_mode == (INT32) TRUE)           fprintf(io_config.echo_file, "\n");         }  /* end for(set) */      i = i + 1;      }  /* end while loop */   return (0);   }  /* end xc_cmd() */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -