void DrawScreen() { printf("%s", clrscn); printf_at(1, 10, "***************************************************************"); printf_at(2, 10, "*** ConvergeNet Technologies - Odyssey 2000 Demonstration ***"); printf_at(3, 10, "*** I - init s - scan for disks 0-9 Trace (+/-) X - exit ***"); printf_at(4, 10, "***************************************************************\r\n"); }
void task_0(void) { unsigned key = 0; unsigned i,s; U16 j; // Module Select Bits unsigned cMsDelay=1; unsigned idx; TRACE_ENTRY(task_0); // start on a fresh line printf("\n\r"); DrawScreen(); /* Task0 forever loop */ while(1) { //cMsDelay=1; switch (key = getch()) { // The first set of commands are general purpose commands // for all projects case 'X': /* X - cause address exception and return to boot code */ printf("Exit with exception\r\n\r\n"); unsigned long *d = ( unsigned long * ) 0x1; *d = 0xFFFF0000; break; case ' ': /* SPACEBAR - redraw the screen */ DrawScreen(); break; case 0x08: /* BACKSPACE */ case 0x09: /* TAB */ case 0x1B: /* ESC */ printf(" \n\r"); //printf(" /008"); break; case 0x0D: /* ENTER */ case 0x0A: /* or the real ENTER */ printf("\n\r"); break; #if defined(HSCSI_DEBUG) && defined(_DEBUG) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': // Set the Global TraceLevel index to the number specified idx = key - 0x30; debug_set: printf("\n\rTraceLevel[%d] = %d", index[idx], TraceLevel[index[idx]]); break; case '!': idx = 10; goto debug_set; case '@': idx = 11; goto debug_set; case '#': idx = 12; goto debug_set; case '+': // Increment the Global TraceLevel TraceLevel[index[idx]]++; printf("\n\rTraceLevel[%d] = %d", index[idx], TraceLevel[index[idx]]); break; case '-': // Increment the Global TraceLevel TraceLevel[index[idx]]--; printf("\n\rTraceLevel[%d] = %d", index[idx], TraceLevel[index[idx]]); break; case 'a': // Set the Global TraceLevel for all 15 to max for (idx = 0; idx < 15; idx++) { TraceLevel[index[idx]] = TRACE_ALL_LVL; printf("\n\rTraceLevel[%d] = %d", index[idx], TraceLevel[index[idx]]); } break; case 'm': // Set the Global TraceLevel for all 15 to min for (idx = 0; idx < 15; idx++) { TraceLevel[index[idx]] = TRACE_L2; printf("\n\rTraceLevel[%d] = %d", index[idx], TraceLevel[index[idx]]); } break; #endif // Oos specific command extensions case 'i': TRACE_STRING(TRACE_L2, "\n\rOs:Initialize called\n\r"); Os::Initialize(); break; case 'n': printf_at(7,0,"Interrupt counters\r\n"); for (i=Interrupt::tyFirst; i < Interrupt::tyLast; i++) { printf("%04x", (int)Interrupt::aN[i]); printf(" "); } break; case 'b': printf_at(7,0,"Base registers\r\n"); Print_Dump((unsigned long*)GT_CPU_CONFIG_REG, 64); break; case 'd': printf_at(7,0,"I2O registers\r\n"); Print_Dump((unsigned long*)(GT_I2O_BASE), 32); break; case 'D': printf_at(7,0,"DMA registers\r\n"); Print_Dump((unsigned long*)(GT_DMA_CH0_COUNT_REG), 32); break; case 'p': printf_at(7,0,"PCI registers\r\n"); Print_Dump((unsigned long*)(GT_PCI_COMMAND_REG), 64); break; case 'u': printf_at(7,0,"PCI internal registers\r\n"); for (i=0x80000000; i < 0x80000120; i+= 4) { if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); *(unsigned long*)(GT_PCI_CONFIG_ADDR_REG) = BYTE_SWAP32(i); printf("%08x", BYTE_SWAP32(*(unsigned long*)(GT_PCI_CONFIG_DATA_REG))); } break; case 'U': printf_at(7,0,"ISP1040/PCI internal registers\r\n"); for (i=0x80004000; i < 0x80004100; i+= 4) { // slot 6 = 80003000 if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); *(unsigned long*)(GT_PCI_CONFIG_ADDR_REG) = BYTE_SWAP32(i); // printf("%08x", BYTE_SWAP32(*(unsigned long*)(GT_PCI_CONFIG_DATA_REG))); printf("%04x%04x", (*(unsigned long*)(GT_PCI_CONFIG_DATA_REG)&0xffff), (*(unsigned long*)(GT_PCI_CONFIG_DATA_REG)>>16)); } break; // FCP specific command extensions case 't': extern void S_Test_Unit_Ready(U32 drive_no); S_Test_Unit_Ready(0); break; case 'y': // spare break; #if !defined(NIC_TEST_BUILD) case 'h': void S_Read_Test(U32 drive_no); S_Read_Test(0); // drive 0 break; case 'j': void S_Sts_Read_Test(U32 drive_no); S_Sts_Read_Test(TestVdn); // Virtual Device break; case 's': { // defined in the DriveMonitor extern void S_Scan_For_Drives(Message *pMsg); S_Scan_For_Drives(NULL); s=1; // keep track of start/stop } break; case 'S': s=s^0x0001; extern void S_Stop_Drive(U32 drive_no, unsigned s); S_Stop_Drive(0,s); break; #endif case 'r': printf_at(7,0,"ISP 1 PCI registers\r\n"); for (i=0x80004800; i < 0x80004840; i+= 4) { if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); *(unsigned long*)(GT_PCI_CONFIG_ADDR_REG) = BYTE_SWAP32(i); printf("%08x", *(unsigned long*)(GT_PCI_CONFIG_DATA_REG)); } break; case 'R': printf_at(7,0,"ISP 2 PCI registers\r\n"); for (i=0x80003000; i < 0x80003040; i+= 4) { if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); *(unsigned long*)(GT_PCI_CONFIG_ADDR_REG) = BYTE_SWAP32(i); printf("%08x", *(unsigned long*)(GT_PCI_CONFIG_DATA_REG)); } break; case 'z': printf_at(7,0,"ISP 1 registers\r\n"); for (i=0; i < 0x100; i+= 2) { if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); printf("%04x", BYTE_SWAP16(*((U16*)((UNSIGNED)(ISP_memory_base_address | 0xA0000000) + i)))); } break; case 'Z': printf_at(7,0,"ISP 2 registers\r\n"); for (i=0; i < 0x100; i+= 2) { if (i % 0x10 == 0) { printf("\n\r"); printf("%04x", i & 0xFF); } printf(" "); printf("%04x", BYTE_SWAP16(*((U16*)((UNSIGNED)(ISP_memory_base_address2 | 0xA0000000) + i)))); } break; case 'H': printf_at(7,0,"ISP 3 registers\r\n"); for (i=0;i<0x100;i+=2) { if (i%0x10==0) { printf("\n\r"); printf("%04x",i&0xff); } printf(" "); printf("%04x",BYTE_SWAP16(*((U16*)((UNSIGNED)(ISP_memory_base_address3 | 0xa0000000)+i)))); } break; case 'f': U16 *ispcs = (U16 *)((ISP_memory_base_address3 | K1BASE)+HSCSI_CONFIG_1); U16 *isphccr = (U16 *)((ISP_memory_base_address3 | K1BASE)+HSCSI_HCCR); // Clear RISC interrupt (FCP_Mailbox_Wait_Ready_Intr) if needed *isphccr=BYTE_SWAP16((UNSIGNED)HCCRPAUSERISC); // Pause RISC printf_at(7,0,"HSCSI PBIU/RISC registers\r\n"); j = BYTE_SWAP16(*ispcs)&0x00f7; *ispcs=BYTE_SWAP16(j); // Set ISP Control/Status register for (i=0x00; i<0x100; i+=2) { if (!(i % 0x10)) { printf("\n\r"); printf("%04x",i&0xff); } printf(" "); printf("%04x", BYTE_SWAP16(*((U16*)((UNSIGNED)(ISP_memory_base_address3 | K1BASE)+i)))); } printf("\r\n"); *isphccr=BYTE_SWAP16((UNSIGNED)HCCRRLSRISC); // Unpause RISC break; case 'F': U16 *ispcs2=(U16*)((ISP_memory_base_address3 | K1BASE)+HSCSI_CONFIG_1); U16 *isphccr2=(U16*)((ISP_memory_base_address3|K1BASE)+HSCSI_HCCR); U16 *sxp=(U16*)((ISP_memory_base_address3|K1BASE)+0xa4); *isphccr2=BYTE_SWAP16((UNSIGNED)HCCRPAUSERISC); // Pause RISC printf_at(7,0,"HSCSI PBIU/SXP registers\r\n"); j = BYTE_SWAP16(*ispcs2)|0x0008; // SXP select *ispcs2=BYTE_SWAP16(j); // ISP Config 1 register // *sxp = BYTE_SWAP16(0x0c00); // SXP override for (i=0x00;i<0x100; i+=2) { if (!(i % 0x10)) { printf("\n\r"); printf("%04x",i&0xff); } printf(" "); printf("%04x",BYTE_SWAP16(*((U16*)((UNSIGNED)(ISP_memory_base_address3 | K1BASE)+i)))); } printf("\r\n"); j = j&0x00f7; // SXP select bit off *ispcs2=BYTE_SWAP16(j); *isphccr2=BYTE_SWAP16((UNSIGNED)HCCRRLSRISC); // Unpause RISC break; case 'x': // x - cause address exception // and return to boot code unsigned long *g = ( unsigned long * ) 0x1; *g = 0xFFFF0000; break; case 'q': // scan all PCI slots for devices // print only the devices found printf("PCI Devices:\n\r"); for (i = 0; i < 31; i++) { U32 reg; reg = GetPciReg(0, i, 0, 0); if (reg == 0xffffffff) continue; printf("S:%02d = %08x\n\r", i, reg); } break; default: printf("%c", key); break; } /* switch (key = Get_Char()) */ NU_Sleep(cMsDelay); cMsDelay=5; } /* while(1) */ }
void dbg_screen_2() { int total = 0; for(int index = 0;index<0xFF;index++) { if(handlers[index].fire_tick == 0) { continue; } else { total++; } } printf_at(0,1,"Timers: %d",total); selecting_max = total - 1; printf_at_cc(0,2,0xF0," ID |%-50sNAME|NEXT ms|REP ms","",0,0); unsigned int index = 0; unsigned int current_time = timer_getHi(); char *unit = "ms"; unsigned int print_index = 0; uint32_t sel = 0; for(index = 0;index<0xFF;index++) { if(handlers[index].fire_tick == 0) { continue; } else { sel++; int rep_in = handlers[index].fire_tick - current_time; if(rep_in > 1000) { unit = "s"; rep_in = rep_in / 1000; } else { unit = "ms"; } if(is_selecting) { if(index == selecting_index) { printf_at_cc(0,3 + print_index++,0xF0,"[%02x]:%-54s|%8d%2s|%7dms",index,handlers[index].name,rep_in,unit,handlers[index].repeat_rate); continue; } } printf_at(0,3 + print_index++,"[%02x]:%-54s|%8d%2s|%7dms",index,handlers[index].name,rep_in,unit,handlers[index].repeat_rate); } } //Handle commands if(is_selecting) { switch(last_command) { case 'x': handlers[selecting_index].repeat_rate = 0; break; case '+': handlers[selecting_index].repeat_rate++; break; case '-': handlers[selecting_index].repeat_rate--; break; default: break; } } redraw_screen = 1; }