void __mg_os_time_delay (int ms) { #ifndef __NOUNIX__ /* use select instead of usleep */ struct timeval timeout; timeout.tv_sec=0; timeout.tv_usec=ms*1000; while (select (0, NULL, NULL, NULL, &timeout) < 0); #elif defined (__UCOSII__) OSTimeDly (OS_TICKS_PER_SEC * ms / 1000); #elif defined (__VXWORKS__) taskDelay (sysClkRateGet() * ms / 1000); #elif defined (__PSOS__) || defined (__ECOS__) struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = ms * 1000000; nanosleep (&ts, NULL); #elif defined (WIN32) void __stdcall Sleep (DWORD dwMilliSeconds); Sleep (ms); #elif defined (__THREADX__) tx_thread_sleep (ms/10); #elif defined (__NUCLEUS__) NU_Sleep (ms/10); #elif defined (__OSE__) delay(ms); #endif }
void IOPMaster(UNSIGNED argc, VOID *argv) { STATUS status; int ch = 0; int i; unsigned long pci_id; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; printf("\n\r"); printf("Executing the System Code....\n\r"); /* Initilaize the Hardware */ #ifdef INCLUDE_ODYSSEY if ((status = Init_Hardware()) != NU_SUCCESS) printf("Error in init %d\r\n", status); #else init_galileo(); #endif INCLUDE_ODYSSEY /* Spawn the rest of the tasks and initialize */ Init_System(&System_Memory); /* Lower the Priority of this task */ NU_Change_Priority( (NU_TASK *)&IOPMaster_Task, 250 ); /* Now this task will be active with lowest priority and can be used to * any cleanup required */ for(;;){ NU_Sleep(500); Cleanup_System(); /* rlw: can we implement erc91 functionality here? */ } }
int __gc_cleanup(void *ptr, unsigned int delay) { GCQueueItem *i = fwlib->malloc(sizeof *i); if(!i) return -1; i->next = 0; i->body = ptr; i->delay = delay; /* wait for cleanup thread will done */ while(gc_queue.busy) NU_Sleep(40); gc_queue.busy = 1; if(gc_queue.first) { gc_queue.last->next = i; gc_queue.last = i; } else { gc_queue.first = gc_queue.last = i; } gc_queue.busy = 0; /* Resume garbage collector thread */ NU_Resume_Task(&gc_tsk); return 0; }
void test_1(UNSIGNED argc, VOID *argv) { STATUS status; int ch; int i=0, j, k; time_t ltime; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; while(1) { GetTime(<ime); if ( ltime.month > 12 || ltime.day > 7) { printf("Error: Out of range\n\r"); continue; } if ( ltime.hour > 12 ) printf("\033[15;07H%s %s %02d %02d:%02d:%02d PM 19%02d\r", Day[ltime.day], Month[ltime.month], ltime.date, ltime.hour-12, ltime.minutes, ltime.seconds, ltime.year); else printf("\033[15;07H%s %s %02d %02d:%02d:%02d AM 19%02d\r", Day[ltime.day], Month[ltime.month], ltime.date, ltime.hour, ltime.minutes, ltime.seconds, ltime.year); NU_Sleep(1); } }
void test_1(UNSIGNED argc, VOID *argv) { STATUS status; int ch; unsigned char lbuf[2048]; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; for(;;){ if ( ttyE_poll() == 0) { ch = ttyE_in(); switch(ch){ case 'R': get_message(); break; } } NU_Sleep(10); #if 0 status = nflash_read_page(lbuf, 0); #endif } }
void get_message() { char lbuf[20]; int i, ch; lbuf[0] = 'R'; i = 1; while(i < 20) { if ( ttyE_poll() == 0) { ch = ttyE_in(); lbuf[i] = ch; i++; } if ( ch == '\n') { break; } } lbuf[9] = 0; if ( strcmp(lbuf, "Reboot###") == 0) { printf("Rebooting the System, Please Wait\n"); NU_Sleep(200); DISABLE_INT; __reboot(); } printf("Done\n"); }
STATUS HSCSI_Mailbox_Wait_Ready_Intr(PHSCSI_INSTANCE_DATA Id) { UNSIGNED wait_count; HSCSI_TRACE_ENTRY(HSCSI_Mailbox_Wait_Ready_Intr); // Wait for ISP to clear host interrupt to RISC. // Don't wait forever. wait_count = 10000; while(Read_ISP1040(Id, HSCSI_HCCR) & HCCRH2RINTR) { NU_Sleep(1); // wait for ISP to clear host interrupt to RISC if (wait_count-- == 0) { // We cannot send a mailbox command to the ISP. HSCSI_Log_Error(HSCSI_ERROR_TYPE_FATAL, "HSCSI_Mailbox_Wait_Ready_Intr", "Cannot send mailbox command to ISP", 0, (UNSIGNED)Id); return HSCSI_ERROR_MAILBOX_TIMEOUT; } } return NU_SUCCESS; } // HSCSI_Mailbox_Wait_Ready_Intr
static void gc_thread(unsigned long a, void *b) { while (1) { /* wait for operations on queue */ while(gc_queue.busy) NU_Sleep(40); /* block queue */ gc_queue.busy = 1; /* getting first item */ GCQueueItem *i = gc_queue.first; /* if we have it... */ if(i) { /* ... set the next item as first */ gc_queue.first = i->next; /* if it`s last item, so ... */ if(!gc_queue.first) gc_queue.last = 0; } else { gc_queue.last = 0; } /* unblock queue */ gc_queue.busy = 0; if(i) { NU_Sleep(i->delay); fwlib->free(i->body); fwlib->free(i); /* we go to the next item */ continue; } else NU_Suspend_Task(&gc_tsk); } }
void test_3(UNSIGNED argc, VOID *argv) { STATUS status; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; while(1) { NU_Sleep(100); if ( dev_ptr != NU_NULL) printf("\r Tx count %d Rx count %d", tx_count, rx_count); } }
void test_0(UNSIGNED argc, VOID *argv) { STATUS status; int ch; int i=0, j, k; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; print_help(); for(;;){ if ( ttyA_poll() == 0) { ch = ttyA_in(); switch(ch){ case 's': case 'S': stime.year = 99; stime.month = 8; stime.date = 27; stime.day = 6; stime.hour = 16; stime.minutes = 10; stime.seconds = 5; stime.timezone = 0x01020304; stime.dstflag = 0x05060708; SetTime(&stime); break; case 'g': case 'G': GetTime(>ime); printf("Year %d, Month %d, Date %d, Day %d\n\r", gtime.year, gtime.month, gtime.date, gtime.day); printf("Hour %d, Minutes %d, Seconds %d\n\r", gtime.hour, gtime.minutes, gtime.seconds); printf("Timezone %08X, DstFlag %08X\n\r", gtime.timezone, gtime.dstflag); break; case ' ': print_help(); break; default: printf("%c", ch); break; } } NU_Sleep(10); } }
void create_board_list(int type) { pcislot_t *slotp; char ch; int i, j; for(i=0; i < board_list_count; i++) board_list[i].op_type = 0; board_list_count = 0; for(i=0; i < MAX_PCI_SLOTS; i++) { slotp = &pcislot[i]; if ( slotp->pci_id ) { if ( i == get_slotno()) continue; board_list[board_list_count].slot_no = i; if ( board_list_count > 8) board_list[board_list_count].key_in = 'A' +(board_list_count-9); else board_list[board_list_count].key_in = '1' + board_list_count; board_list_count++; } } j =1; for(i=0; i < board_list_count; i++) { printf("%c - %s", board_list[i].key_in, pcislot[board_list[i].slot_no].slotname); if ( (j % 4) == 0) printf("\n\r"); else printf(", "); j++; } printf("\n\r"); while(1) { if ( ttyA_poll() == 0) { ch = ttyA_in(); if ( (ch == '\r') || (ch == '\n')) { printf("\n\r"); return; } printf("%c", ch); for(i = 0; i < board_list_count; i++) { if ( board_list[i].key_in == ch) board_list[i].op_type = type; } } NU_Sleep(10); } }
__arm int mutex_lock(Mutex *mtx) { if(!mtx) return -1; if(!mtx->task) return -2; /* ы, локанули и ещё раз чтоль? о_О*/ if(mtx->is_locked) return -3; unsigned int status = 0; //status = NU_Suspend_Task(mtx->task); mtx->is_locked = 1; while(mtx->is_locked) { if(!mtx->is_locked) break; NU_Sleep(5); } return status; }
STATUS DdmTestSample::TestProc(Message *pMsgReq) { Tracef("DdmTestSample::TestProc()\n"); TestMsgRun* pMsg = (TestMsgRun*) pMsgReq; char *pArgs; int iBufSize, numTicks; TestMsgRun* pMsgReply; pMsg->GetStruct(pArgs, iBufSize); args = (args_t *)pArgs; numTicks = args->numTicks; Tracef("Number of ticks requested: %d\n", numTicks); char *pBuf = new char[80]; sprintf(pBuf, "This is a test routine.\n\rWatch me tick!!\n\r"); pMsgReply = new TestMsgRun(pMsg); pMsgReply->SetWriteBuffer(pBuf, strlen(pBuf) + 1); Reply(pMsgReply, OK, false); for (int tick=0; tick < numTicks; tick++) { sprintf(pBuf, "Tick %d\n\r", tick); pMsgReply = new TestMsgRun(pMsg); pMsgReply->SetWriteBuffer(pBuf, strlen(pBuf) + 1); Reply(pMsgReply, OK, false); NU_Sleep(100); } delete[] pBuf; Reply(pMsg, OK); return OK; }
void StartTask(UNSIGNED , VOID *) { unsigned key = 0; unsigned i; unsigned cMsDelay=1; #ifdef _DEBUG TraceLevel[TRACE_OOS]=0; TraceLevel[TRACE_DDM_MGR]=0; TraceLevel[TRACE_DDM]=0; TraceLevel[TRACE_HEAP]=0; TraceLevel[TRACE_VIRTUAL_MGR]=0; TraceLevel[TRACE_TRANSPORT]=0; #endif DrawScreen(); struct CabSlot {U32 iCabinet; TySlot iSlot;} *pCabSlot = (CabSlot*)Os::GetBootData("DdmManager"); printf("Slot %s initializing...", St_Slot(pCabSlot->iSlot)); Os::Initialize(); printf("done\n"); /* Task0 forever loop */ while(1) { if (true) { cMsDelay=1; switch (key = getchar()) { case ' ': /* SPACEBAR - redraw the screen */ DrawScreen(); break; case '!': printf("Heap test\n"); char *pChar=new (tSMALL) char[128]; pChar[128]='\000'; pChar[-1]='\000'; pChar=new (tSMALL) char[128]; break; case 'r': case 'R': printf("Sgl test started\n"); TestDdm::StartSgl(); break; case 's': case 'S': printf("Stress test started\n"); TestDdm::StartStress(); break; case 'c': case 'C': printf("cTransfer=%d\n", cTransfer); printf("SendRemote=%d DmaTransfer=%d DmaGo=%d DmaInt=%d SendFixup=%d Post=%d Int=%d Done=%d\n", gTimeSendRemote, gTimeDmaTransfer, gTimeDmaGo, gTimeDmaInt, gTimeSendFixup, gTimePost, gTimeInt, gTimeDone); break; case 'i': case 'I': Oos::Initialize(); break; case 'n': case 'N': PrintAt(7,0,"Interrupt counters\n"); for (i=Interrupt::tyFirst; i < Interrupt::tyLast; i++) { printf("%x ", (int)Interrupt::aN[i]); } break; case 'v': // Memory test printf("total memory %08lx free memeory %08lx\n", OsHeap::heapSmall.cbAllocTotal, OsHeap::heapSmall.CbFree()); for (int cb=0; cb <= 0x10000; cb++) { void *p=new char[cb]; if (p == NULL) printf("Failed to allocate %d bytes\n", cb); else delete p; } printf("total memory %08lx free memeory %08lx\n", OsHeap::heapSmall.cbAllocTotal, OsHeap::heapSmall.CbFree()); break; unsigned char aData[256]; unsigned char aDest[256]; case 'q': printf("bzero test\n"); for (int i=0; i < 16; i++) { printf("offset %d\n", i); for (int cb=0; cb < 128; cb++) { for (int ib=0; ib < sizeof(aData); ib++) aData[ib]=0xFF; bzero(&aData[i+16], cb); // Test for (int ib=0; ib < i+16; ib++) if (aData[ib] != (unsigned char)0xFF) Fault(i, cb); for (int ib=i+16; ib < i+16+cb; ib++) if (aData[ib] != 0) Fault(i, cb); for (int ib=i+16+cb; ib < sizeof(aData); ib++) if (aData[ib] != (unsigned char)0xFF) Fault(i, cb); } } printf("bzero test done\n"); printf("bcopy test\n"); for (int i1=0; i1 < 16; i1++) { for (int i2=0; i2 < 16; i2++) { printf("offset %d - %d\n", i1, i2); for (int cb=0; cb < 128; cb++) { for (int ib=0; ib < sizeof(aData); ib++) { aData[ib]=ib; aDest[ib]=0xFF; } if (i1 == 5 && i2 == 1 && cb == 12) printf("12!"); bcopy(&aData[i1+16], &aDest[i2+16], cb); // Test for (int ib=0; ib < i2+16; ib++) if (aDest[ib] != (unsigned char)0xFF) Fault(i2, cb); int iTest=i1+16; for (int ib=i2+16; ib < i2+16+cb; ib++) if (aDest[ib] != iTest++) Fault(i2, cb); for (int ib=i2+16+cb; ib < sizeof(aDest); ib++) if (aDest[ib] != (unsigned char)0xFF) Fault(i2, cb); } } } printf("bcopy test done\n"); break; case 'a': case 'A': PrintAt(7,0,"All GT64120 registers\n"); printf("Base registers\n"); Print_Dump((unsigned long*)GT_CPU_CONFIG_REG, 72); printf("SDRAM registers\n"); Print_Dump((unsigned long*)(GT_DRAM_RAS0_LO_REG), 32); printf("DMA registers\n"); Print_Dump((unsigned long*)(GT_DMA_CH0_COUNT_REG), 32); printf("PCI registers\n"); Print_Dump((unsigned long*)(GT_PCI_COMMAND_REG), 64); printf("I2O registers\n"); Print_Dump((unsigned long*)(GT_I2O_BASE), 32); break; case 'b': case 'B': PrintAt(7,0,"Base registers\n"); Print_Dump((unsigned long*)GT_CPU_CONFIG_REG, 64); break; case '0': PrintAt(7,0,"I2O registers\n"); Print_Dump((unsigned long*)(GT_I2O_BASE), 32); break; case '2': PrintAt(7,0,"I2O registers, HBC0\n"); Print_Dump((unsigned long*)0xa2000000, 32); break; case '3': PrintAt(7,0,"I2O registers, HBC1\n"); Print_Dump((unsigned long*)0xa3000000, 32); break; case 'd': case 'D': PrintAt(7,0,"DMA registers\n"); Print_Dump((unsigned long*)(GT_DMA_CH0_COUNT_REG), 32); break; case 'p': case 'P': PrintAt(7,0,"PCI registers\n"); Print_Dump((unsigned long*)(GT_PCI_COMMAND_REG), 64); break; case 'u': case 'U': PrintAt(7,0,"PCI internal registers\n"); for (i=0x80000000; i < 0x80000120; i+= 4) { if (i % 0x10 == 0) { printf("\n%2x", (i & 0xFF)); } *(unsigned long*)(GT_PCI_CONFIG_ADDR_REG) = GTREG(i); printf(" %lx", GTREG(*(unsigned long*)(GT_PCI_CONFIG_DATA_REG))); } break; case 't': case 'T': { char *p=(char*)0xa331c000; int cb=8192; int iStart=-1; printf("PCI test to %08lx[%d]\n", p, cb); char aCh[8192]; for (int i=0; i < sizeof(aCh); i++) aCh[i]=i; printf("byte move:"); for (int i=0; i < sizeof(aCh); i++) p[i]=aCh[i]; for (int i=0; i < sizeof(aCh); i++) if (p[i] != aCh[i]) { if (iStart == -1) iStart=i; } else if (iStart != -1) { printf("bad data from %08lx to %08lx\n", p+iStart, p+i); iStart=-1; } printf("...done\nshort move:"); for (int i=0; i < sizeof(aCh)/sizeof(short); i++) ((short*)p)[i]=((short*)&aCh[0])[i]; for (int i=0; i < sizeof(aCh)/sizeof(short); i++) if (((short*)p)[i] != ((short*)&aCh[0])[i]) { if (iStart == -1) iStart=i; } else if (iStart != -1) { printf("bad data from %08lx to %08lx\n", p+iStart*sizeof(short), p+i*sizeof(short)); iStart=-1; } printf("...done\nlong move:"); for (int i=0; i < sizeof(aCh)/sizeof(long); i++) ((long*)p)[i]=((long*)&aCh[0])[i]; for (int i=0; i < sizeof(aCh)/sizeof(long); i++) if (((long*)p)[i] != ((long*)&aCh[0])[i]) { if (iStart == -1) iStart=i; } else if (iStart != -1) { printf("bad data from %08lx to %08lx\n", p+iStart*sizeof(long), p+i*sizeof(long)); iStart=-1; } printf("...done\nI64 move:"); printf("I64 move:"); for (int loop=0; loop < 1024; loop++) { for (int i=0; i < sizeof(aCh)/sizeof(I64); i++) ((I64*)p)[i]=((I64*)&aCh[0])[i]; for (int i=0; i < sizeof(aCh)/sizeof(I64); i++) if (((I64*)p)[i] != ((I64*)&aCh[0])[i]) { if (iStart == -1) iStart=i; } else if (iStart != -1) { printf("bad data from %08lx to %08lx\n", p+iStart*sizeof(I64), p+i*sizeof(I64)); iStart=-1; } } printf("...done\n"); } break; case 'x': /* ! - cause address exception and return to boot code */ case 'X': /* ! - cause address exception and return to boot code */ printf(clrscn); printf("Exit with exception\n\n"); unsigned long *d = ( unsigned long * ) 0x1; *d = 0xFFFF0000; break; case 0x08: /* BACKSPACE */ case 0x09: /* TAB */ case 0x0D: /* ENTER */ case 0x1B: /* ESC */ printf(" \007"); break; default: // printf("%c", key); break; } /* switch (key = Get_Char()) */ } /* if (Char_Present()) */ NU_Sleep(cMsDelay); cMsDelay=1; } /* while(1) */ }
VOS_UINT32 VOS_TaskDelay( VOS_UINT32 ulMillSecs ) { NU_Sleep( ulMillSecs/10 + 1); return(VOS_OK); }
void IOPMaster(UNSIGNED argc, VOID *argv) { STATUS status; int ch = 0; int i; unsigned long pci_id; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; printf("\n\r"); printf("Executing the System Code....\n\r"); /* Initilaize the Hardware */ #ifdef INCLUDE_ODYSSEY #if 0 if ((status = Init_Hardware()) != NU_SUCCESS) printf("Error in init %d\r\n", status); gt_init(); gt_initdma(0); gt_initdma(1); board_type = memmaps.aBoardType[getSlotNumber()]; init_buf(get_slotno()); #else init_galileo(); /* enable the Switches */ *((U8 *)(0xBC0F8000)) = 0; a_id = b_id = c_id = d_id = e_id = f_id = h_id = 0; /* Init the E bridge */ printf("Initializing the Bridge E...."); pci_id = get_pci_id(0, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_G_NUM, PCI_E_NUM, PCI_E_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); e_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the F bridge */ printf("Initializing the Bridge F...."); pci_id = get_pci_id(0, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_G_NUM, PCI_F_NUM, PCI_F_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); f_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the H bridge */ printf("Initializing the Bridge H...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_H_NUM, PCI_H_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); h_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the C bridge */ printf("Initializing the Bridge C...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_C_NUM, PCI_C_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); c_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the D bridge */ printf("Initializing the Bridge D...."); pci_id = get_pci_id(PCI_F_NUM, BRIDGE_21154_ID, 2); if ( pci_id ) { bridge_init(pci_id, PCI_F_NUM, PCI_D_NUM, PCI_D_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); d_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the A bridge */ printf("Initializing the Bridge A...."); pci_id = get_pci_id(PCI_H_NUM, BRIDGE_21154_ID, 0); if ( pci_id ) { bridge_init(pci_id, PCI_H_NUM, PCI_A_NUM, PCI_A_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); a_id = pci_id; } else { printf("Fail\n\r"); goto done; } /* Init the B bridge */ printf("Initializing the Bridge B...."); pci_id = get_pci_id(PCI_H_NUM, BRIDGE_21154_ID, 1); if ( pci_id ) { bridge_init(pci_id, PCI_H_NUM, PCI_B_NUM, PCI_B_SUB, 0xFFFFFFFF, 0); printf("OK\n\r"); b_id = pci_id; } else { printf("Fail\n\r"); goto done; } #endif #else init_galileo(); #endif INCLUDE_ODYSSEY done: /* Spawn the rest of the tasks and initialize */ Init_System(&System_Memory); /* Lower the Priority of this task */ NU_Change_Priority( (NU_TASK *)&IOPMaster_Task, 250 ); /* Now this task will be active with lowest priority and can be used to * any cleanup required */ for(;;){ NU_Sleep(500); Cleanup_System(); /* rlw: can we implement erc91 functionality here? */ } }
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 test_0(UNSIGNED argc, VOID *argv) { STATUS status; int ch; int i=0, j, k; U32 padr; U32 *ptr; int bus_num = 0; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; configured = 1; print_help(); for(;;){ if ( ttyA_poll() == 0) { ch = ttyA_in(); switch(ch){ case 'i': case 'I': printf("Galileo PCI Configuration Registers\n\r"); pciconf_print(0x80000000); break; case 'g': case 'G': printf("Devices Found on the PCI Bus G\n\r"); probe_pci_devs(0); break; case 'e': case 'E': printf("Devices Found on the PCI Bus E\n\r"); probe_pci_devs(PCI_E_NUM); break; case 'f': case 'F': printf("Devices Found on the PCI Bus F\n\r"); probe_pci_devs(PCI_F_NUM); break; case 'h': case 'H': printf("Devices Found on the PCI Bus H\n\r"); probe_pci_devs(PCI_H_NUM); break; case 'a': case 'A': printf("Devices Found on the PCI Bus A\n\r"); probe_pci_devs(PCI_A_NUM); break; case 'b': case 'B': printf("Devices Found on the PCI Bus B\n\r"); probe_pci_devs(PCI_B_NUM); break; case 'c': case 'C': printf("Devices Found on the PCI Bus C\n\r"); probe_pci_devs(PCI_C_NUM); break; case 'd': case 'D': printf("Devices Found on the PCI Bus D\n\r"); probe_pci_devs(PCI_D_NUM); break; case 'w': case 'W': while (1) { if ( ttyA_poll() == 0) { ch = ttyA_in(); break; } printf("Devices Found on the PCI Bus G\n\r"); probe_pci_devs(0); printf("Devices Found on the PCI Bus E\n\r"); probe_pci_devs(PCI_E_NUM); printf("Devices Found on the PCI Bus F\n\r"); probe_pci_devs(PCI_F_NUM); printf("Devices Found on the PCI Bus H\n\r"); probe_pci_devs(PCI_H_NUM); } break; case ' ': print_help(); break; default: printf("%c", ch); break; } } NU_Sleep(10); } }
void test_0(UNSIGNED argc, VOID *argv) { STATUS status; int ch; int i=0, j, k; U32 padr; U32 *ptr; int bus_num = 0; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; printf("Ready###\n"); print_help(); for(;;){ if ( ttyA_poll() == 0) { ch = ttyA_in(); switch(ch){ case 'i': status = nflash_init(); if ( status != OK) printf("Error in init - 528 \n\r"); else printf("Init OK - 528 \n\r"); break; case 'I': status = nflash_init_noecc(); if ( status != OK) printf("Error in init 512 \n\r"); else printf("Init OK - 512 \n\r"); break; case 'g': case 'G': nflash_get_id(0); break; case 'e': case 'E': if ( nflash_erase_block(0) == OK) printf("Erase OK\n\r"); else printf("Erase Fail\n\r"); break; case 'r': for(j=0; j < 16; j++) { status = nflash_read_page(lbuf, j); printf("\n\rPage %d :", j); for(i=0; i < PAGE_SIZE; i++) { if (lbuf[i] != 0xFF) { printf("Not Blank", j); break; } } printf("STUTUS %d\n\r", status); mem_print((U32)lbuf, PAGE_SIZE); } break; case 'R': for(j=0; j < 16; j++) { nflash_read_noecc(lbuf, j * PAGE_SIZE, PAGE_SIZE); printf("\n\rPage %d :", j); for(i=0; i < PAGE_SIZE; i++) { if (lbuf[i] != 0xFF) { printf("Not Blank", j); break; } } printf("\n\r"); mem_print((U32)lbuf, PAGE_SIZE); } break; case 'p': printf("Programming..."); for(j=0; j < 16; j++) { for(i=0; i < PAGE_SIZE; i++) { lbuf[i] = j + 2; if ( (i % 128) == 0) lbuf[i] |= 0x80; } if ( (status = nflash_write_page(lbuf, j)) != OK) printf("Err, Page %d status %d\n\r", j, status); } printf("Done\n\r"); break; case 'P': for(j=0; j < 16; j++) { for(i=0; i < PAGE_SIZE; i++) lbuf[i] = j + 2; if ( nflash_program_noecc(lbuf, j * PAGE_SIZE, PAGE_SIZE) != OK) printf("Program Error, Page %d\n\r", j); } break; case 'x': case 'X': { U32 *mptr = (U32 *)0xA0000001; *mptr = 1; } break; case 'u': case 'U': { int i; for(i=0; i < 10; i++) { while(!(RUART(0)->rlsr & ST_LSR_TX_EMPTY)) ; RUART(0)->holding = 'A'; } } break; case 'a': case 'A': *((U8 *)(0xBC088000)) = 0; break; case ' ': print_help(); break; default: printf("%c", ch); break; } } NU_Sleep(10); } }
void test_0(UNSIGNED argc, VOID *argv) { STATUS status; int ch; int i=0, j, k; U32 padr; U32 *ptr; int bus_num = 0; /* Access argc and argv just to avoid compilation warnings. */ status = (STATUS) argc + (STATUS) argv; print_help(); for(;;){ if ( ttyA_poll() == 0) { ch = ttyA_in(); switch(ch){ case 'i': case 'I': /* Initialize Memory */ MEM_Init(); /* Initialize the dev structure */ init_devptr(); /* Initialize the device */ DEV_Init_Devices(device, 1); dev_ptr = DEV_Get_Dev_By_Name("de0"); break; case 'p': case 'P': printf("Devices Found on the PCI Bus 0\n\r"); probe_pci_devs(0); break; #ifdef INCLUDE_ODYSSEY case 'l': case 'L': printf("Devices Found on the Local Bus \n\r"); probe_pci_devs(PCI_E_BUSNUM); break; case 'x': case 'X': if ( dev_ptr != NU_NULL) { DEC21143_XDATA *dec_data; DEC21143_DESCRIPTOR *desc; dec_data = (DEC21143_XDATA *) dev_ptr->user_defined_1; desc = dec_data->DEC21143_First_TX_Descriptor; printf("\n\r"); while(desc) { desc = (DEC21143_DESCRIPTOR *)((U32)(desc) | 0xA0000000); printf("Control :%08X, ", desc->control_count); printf("Status :%08X, ", desc->status); printf("Buffer :%08X\n\r", desc->buffer); desc = desc->next_descriptor; } } else { printf("Device not Initialized\n\r"); } break; #endif case 'T': case 't': if ( dev_ptr != NU_NULL) { send_flag ^= 1; } else { printf("Device not Initialized\n\r"); } break; case 'e': case 'E': if ( dev_ptr != NU_NULL) { DEC21143_Printcounters (dev_ptr); } else { printf("Device not Initialized\n\r"); } break; case 'c': case 'C': print_flag ^= 1; break; case 'd': case 'D': print_data_flag ^= 1; break; case 'r': case 'R': tx_count = 0; rx_count = 0; break; case '+': if ( dev_ptr != NU_NULL) { maddr[5] = multi_add_byte; Ether_Add_Multi(dev_ptr, maddr); multi_add_byte++; DEC21143_Ioctl(dev_ptr, DEV_ADDMULTI, d_req); } else { printf("Device not Initialized\n\r"); } break; case '-': if ( dev_ptr != NU_NULL) { maddr[5] = multi_del_byte; if (Ether_Del_Multi(dev_ptr, maddr) == NU_SUCCESS) multi_del_byte++; DEC21143_Ioctl(dev_ptr, DEV_DELMULTI, d_req); } else { printf("Device not Initialized\n\r"); } break; case ' ': print_help(); break; default: printf("%c", ch); break; } } NU_Sleep(10); } }
static void a_sleep (void) { NU_Sleep(2); }