Go to the source code of this file.
Functions | |
| int | cmd_cache (int argc, char **argv) |
| int | cmd_cacheflush (int argc, char **argv) |
| mycmd_init (cacheflush, cmd_cacheflush,"cacheflush addr size","flush dache and invalid icache") | |
| mycmd_init (cache, cmd_cache,"cache op addr size","flush dache ") | |
| myconfig_init ("dcache.waybit", config_dcache_waybit, CONFIG_I,"dcache waybit") | |
| myconfig_init ("dcache.ways", config_dcache_ways, CONFIG_I,"dcache ways") | |
| myconfig_init ("dcache.size", config_dcache_size, CONFIG_I,"dcache size") | |
| myconfig_init ("icache.waybit", config_icache_waybit, CONFIG_I,"icache waybit") | |
| myconfig_init ("icache.ways", config_icache_ways, CONFIG_I,"icache ways") | |
| myconfig_init ("icache.size", config_icache_size, CONFIG_I,"icache size") | |
Variables | |
| static int | config_dcache_size = 0x4000 |
| static int | config_dcache_waybit = 12 |
| static int | config_dcache_ways = 4 |
| static int | config_icache_size = 0x4000 |
| static int | config_icache_waybit = 12 |
| static int | config_icache_ways = 4 |
| int cmd_cache | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 104 of file cache.c.
References end(), fMIPS32_ExecuteDebugModule(), and tgt_compile.
00105 { 00106 unsigned int start; 00107 unsigned int end; 00108 unsigned int size; 00109 unsigned int cacheinst; 00110 int op; 00111 unsigned int codebuf[] = tgt_compile( 00112 ".set mips32;\n" 00113 "1:mtc0 ra,c0_desave;\n" 00114 "bal 2f;\n" 00115 "nop;\n" 00116 ".space 20;\n" 00117 "2:\n" 00118 "sw v0,(ra);\n" 00119 "sw v1,4(ra);\n" 00120 "lw v0,8(ra);\n" /*start address*/ 00121 "lw v1,12(ra);\n" /*end address*/ 00122 "3:cache 0,(v0);\n" 00123 "addu v0,32;\n" 00124 "bne v0,v1,3b;\n" 00125 "nop;\n" 00126 "lw v1,4(ra);\n" 00127 "lw v0,(ra);\n" 00128 "mfc0 ra,c0_desave;\n" 00129 "b 1b;\n" 00130 "nop;\n"); 00131 00132 if(argc < 4) return -1; 00133 00134 op = strtoul(argv[1],0,0); 00135 start = strtoul(argv[2],0,0); 00136 size = strtoul(argv[3],0,0); 00137 00138 codebuf[12] |= (op<<16); 00139 codebuf[5] = start; 00140 codebuf[6] = (start + size + 31) & ~31; 00141 00142 printf("start = %x\n",start); 00143 fMIPS32_ExecuteDebugModule(codebuf,sizeof(codebuf),1); 00144 00145 return 0; 00146 }
| int cmd_cacheflush | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 17 of file cache.c.
References config_dcache_size, config_dcache_waybit, config_dcache_ways, config_icache_size, config_icache_waybit, config_icache_ways, fMIPS32_ExecuteDebugModule(), and tgt_compile.
00018 { 00019 unsigned int start; 00020 unsigned int size; 00021 int i; 00022 start = strtoul(argv[1],0,0); 00023 size = strtoul(argv[2],0,0); 00024 00025 00026 if(size < config_icache_size) 00027 { 00028 unsigned int codebuf[] = tgt_compile( 00029 ".set mips32;\n" 00030 "1:mtc0 ra,c0_desave;\n" 00031 "bal 2f;\n" 00032 "nop;\n" 00033 ".space 20;\n" 00034 "2:\n" 00035 "sw v0,(ra);\n" 00036 "sw v1,4(ra);\n" 00037 "lw v0,8(ra);\n" /*start address*/ 00038 "lw v1,12(ra);\n" /*end address*/ 00039 "3:cache 0x15,(v0);\n" 00040 "cache 0x10,(v0);\n" 00041 "addu v0,32;\n" 00042 "bne v0,v1,3b;\n" 00043 "nop;\n" 00044 "lw v1,4(ra);\n" 00045 "lw v0,(ra);\n" 00046 "mfc0 ra,c0_desave;\n" 00047 "b 1b;\n" 00048 "nop;\n"); 00049 00050 codebuf[5] = start; 00051 codebuf[6] = (start + size + 31) & ~ 31; 00052 fMIPS32_ExecuteDebugModule(codebuf,sizeof(codebuf),1); 00053 } 00054 else 00055 { 00056 unsigned int cacheinst; 00057 unsigned int codebuf[] = tgt_compile( 00058 ".set mips32;\n" 00059 "1:mtc0 ra,c0_desave;\n" 00060 "bal 2f;\n" 00061 "nop;\n" 00062 ".space 20;\n" 00063 "2:\n" 00064 "sw v0,(ra);\n" 00065 "sw v1,4(ra);\n" 00066 "lw v0,8(ra);\n" /*start address*/ 00067 "lw v1,12(ra);\n" /*end address*/ 00068 "3:cache 0,(v0);\n" 00069 "addu v0,32;\n" 00070 "bne v0,v1,3b;\n" 00071 "nop;\n" 00072 "lw v1,4(ra);\n" 00073 "lw v0,(ra);\n" 00074 "mfc0 ra,c0_desave;\n" 00075 "b 1b;\n" 00076 "nop;\n"); 00077 00078 cacheinst = codebuf[12]; 00079 00080 00081 for(i=0;i<config_dcache_ways;i++) 00082 { 00083 codebuf[12] = cacheinst|(1<<16); 00084 codebuf[5] = 0x80000000 + (i<<config_dcache_waybit); 00085 codebuf[6] = 0x80000000 + config_dcache_size/config_dcache_ways + (i<<config_dcache_waybit); 00086 fMIPS32_ExecuteDebugModule(codebuf,sizeof(codebuf),1); 00087 } 00088 00089 00090 for(i=0;i<config_icache_ways;i++) 00091 { 00092 codebuf[12] = cacheinst|(0<<16); 00093 codebuf[5] = 0x80000000 + (i<<config_icache_waybit); 00094 codebuf[6] = 0x80000000 + config_icache_size/config_dcache_ways + (i<<config_dcache_waybit); 00095 fMIPS32_ExecuteDebugModule(codebuf,sizeof(codebuf),1); 00096 } 00097 00098 00099 } 00100 00101 return 0; 00102 }
| mycmd_init | ( | cacheflush | , | |
| cmd_cacheflush | , | |||
| "cacheflush addr size" | , | |||
| "flush dache and invalid icache" | ||||
| ) |
| mycmd_init | ( | cache | , | |
| cmd_cache | , | |||
| "cache op addr size" | , | |||
| "flush dache " | ||||
| ) |
| myconfig_init | ( | "dcache.waybit" | , | |
| config_dcache_waybit | , | |||
| CONFIG_I | , | |||
| "dcache waybit" | ||||
| ) |
| myconfig_init | ( | "dcache.ways" | , | |
| config_dcache_ways | , | |||
| CONFIG_I | , | |||
| "dcache ways" | ||||
| ) |
| myconfig_init | ( | "dcache.size" | , | |
| config_dcache_size | , | |||
| CONFIG_I | , | |||
| "dcache size" | ||||
| ) |
| myconfig_init | ( | "icache.waybit" | , | |
| config_icache_waybit | , | |||
| CONFIG_I | , | |||
| "icache waybit" | ||||
| ) |
| myconfig_init | ( | "icache.ways" | , | |
| config_icache_ways | , | |||
| CONFIG_I | , | |||
| "icache ways" | ||||
| ) |
| myconfig_init | ( | "icache.size" | , | |
| config_icache_size | , | |||
| CONFIG_I | , | |||
| "icache size" | ||||
| ) |
int config_dcache_size = 0x4000 [static] |
int config_dcache_waybit = 12 [static] |
int config_dcache_ways = 4 [static] |
int config_icache_size = 0x4000 [static] |
int config_icache_waybit = 12 [static] |
int config_icache_ways = 4 [static] |
1.5.6