Changeset 659 for trunk/user/ksh/ksh.c
- Timestamp:
- Oct 10, 2020, 3:58:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/ksh/ksh.c
r657 r659 50 50 #include <sys/mman.h> 51 51 #include <fcntl.h> 52 53 #define CMD_MAX_SIZE (256) // max number of characters in one command 54 #define LOG_DEPTH (32) // max number of registered commands 55 #define MAX_ARGS (32) // max number of arguments in a command 56 #define PATH_MAX_SIZE (256) // max number of characters in a pathname 52 #include <shared_syscalls.h> 53 54 #define CMD_MAX_SIZE (256) // max number of characters in one command 55 #define LOG_DEPTH (32) // max number of registered commands 56 #define MAX_ARGS (32) // max number of arguments in a command 57 #define PATH_MAX_SIZE (256) // max number of characters in a pathname 57 58 58 59 #define DEBUG_MAIN 0 … … 414 415 " display mapper path page nbytes\n" 415 416 " display fat min nslots\n" 416 " display fat cxy 0\n" ); 417 " display fat cxy 0\n" 418 " display socket pid fdid\n" ); 417 419 } 418 420 //////////////////////////////////// … … 594 596 } 595 597 } 598 /////////////////////////////////////////// 599 else if( strcmp( argv[1] , "socket" ) == 0 ) 600 { 601 if( argc != 4 ) 602 { 603 printf(" usage: display socket pid fdid\n"); 604 } 605 else 606 { 607 unsigned int pid = atoi(argv[2]); 608 unsigned int fdid = atoi(argv[3]); 609 610 if( display_socket( pid , fdid ) ) 611 { 612 printf(" error: cannot found socket[%x,%d]\n", pid, fdid ); 613 } 614 } 615 } 616 //// 596 617 else 597 618 { … … 939 960 unsigned int x_size; 940 961 unsigned int y_size; 941 unsigned int ncores;942 962 unsigned int x; 943 963 unsigned int y; … … 955 975 { 956 976 // get platform config 957 get_config( &x_size , &y_size , &ncores ); 977 hard_config_t config; 978 get_config( &config ); 979 x_size = config.x_size; 980 y_size = config.y_size; 958 981 959 982 // scan all clusters … … 1224 1247 char cmd[CMD_MAX_SIZE]; // buffer for one command 1225 1248 1226 1227 1228 // 1. first direct command 1229 if( sem_wait( &semaphore ) ) 1230 { 1231 printf("\n[ksh error] cannot found semafore\n" ); 1232 exit( 1 ); 1233 } 1234 else 1235 { 1236 strcpy( cmd , "load bin/user/transpose.elf" ); 1237 printf("[ksh] %s\n", cmd ); 1238 execute( cmd ); 1239 } 1240 // 1241 1242 1243 1244 /* 2. second direct command 1245 if( sem_wait( &semaphore ) ) 1246 { 1247 printf("\n[ksh error] cannot found semafore\n" ); 1248 exit( 1 ); 1249 } 1250 else 1251 { 1252 strcpy( cmd , "cat home/p_fft_dqt_16384_1_2" ); 1253 printf("[ksh] %s\n", cmd ); 1254 execute( cmd ); 1255 } 1249 /* direct command to help debug 1250 1251 int pid = getpid(); 1252 1253 if( pid == 3 ) 1254 { 1255 if( sem_wait( &semaphore ) ) 1256 { 1257 printf("\n[ksh %d] error : cannot found semafore\n" ); 1258 exit( 1 ); 1259 } 1260 else 1261 { 1262 strcpy( cmd , "load bin/user/tcp_server.elf" ); 1263 printf("[ksh] %s\n", cmd ); 1264 execute( cmd ); 1265 } 1266 } 1267 else if( getpid() == 4 ) 1268 { 1269 if( sem_wait( &semaphore ) ) 1270 { 1271 printf("\n[ksh %d] error : cannot found semafore\n" ); 1272 exit( 1 ); 1273 } 1274 else 1275 { 1276 strcpy( cmd , "load bin/user/tcp_client.elf" ); 1277 printf("[ksh] %s\n", cmd ); 1278 execute( cmd ); 1279 } 1280 } 1281 1256 1282 */ 1257 1283 … … 1294 1320 1295 1321 #if DEBUG_INTER 1296 unsigned int pid = getpid();1297 1322 snprintf( string , 128 , "[ksh] %s : request a new command", __FUNCTION__ ); 1298 1323 display_string( string ); … … 1327 1352 snprintf( string , 128 , "[ksh] %s : get command <%s>", __FUNCTION__, cmd ); 1328 1353 display_string( string ); 1329 display_vmm( 0 , 2 );1330 1354 #endif 1331 1355 // register command in log_entries[] array
Note: See TracChangeset
for help on using the changeset viewer.