/***************************************************************************** * hermes_cor_reset * * * * This is the first step in initializing the card's firmware and hardware: * * write HERMES_PCI_COR_MASK to the Configuration Option Register * *****************************************************************************/ int hermes_cor_reset (hermes_t *hw) { int k; u16_t reg; /* Assert the reset until the card notice */ hermes_write_reg (hw, HERMES_PCI_COR, HERMES_PCI_COR_MASK); milli_delay (HERMES_PCI_COR_ONT); /* Give time for the card to recover from this hard effort */ hermes_write_reg (hw, HERMES_PCI_COR, 0x0000); milli_delay (HERMES_PCI_COR_OFFT); /* The card is ready when it's no longer busy */ k = HERMES_PCI_COR_BUSYT; reg = hermes_read_reg (hw, HERMES_CMD); while (k && (reg & HERMES_CMD_BUSY)) { k--; milli_delay (1); reg = hermes_read_reg (hw, HERMES_CMD); } /* Did we timeout ? */ if (reg & HERMES_CMD_BUSY) { printf ("Busy timeout after resetting the COR\n"); return -1; } return (0); }
// ---------------------------------------------------------------------------- // TestB: 一个极简的"进程" void TestB() { int i = 0x1000; while (1) { disp_color_str("B.", BRIGHT | MAKE_COLOR(BLACK, RED)); milli_delay(10); } }
/*======================================================================* TestB *======================================================================*/ void TestB() { while(1){ printf("B"); milli_delay(200); } }
/*======================================================================* TestC *----------------------------------------------------------------------* * 作用:进程C的主函数 *======================================================================*/ PUBLIC void TestC() { while (1) { milli_delay(10); } }
/*======================================================================* TestC *======================================================================*/ void TestC() { int i = 0; while(1){ milli_delay(10); } }
void TestD() { while(1) { printk("D:%d",getpid() ); milli_delay(100); } }
void TestD() { while(1) { disp_str("D"); milli_delay(100); } }
/*======================================================================* TestB *======================================================================*/ void TestC() { /* assert(0); */ while(1){ printf("C"); milli_delay(200); } }
/*======================================================================* TestB *======================================================================*/ void TestC() { int i = 0x2000; while(1){ printf("C"); milli_delay(200); } }
/*======================================================================* TestB *======================================================================*/ void TestB() { int i = 0x1000; while(1){ printf("B"); milli_delay(200); } }
/*======================================================================* TestA *======================================================================*/ void TestA() { int i = 0; while (1) { printf("<Ticks:%x>", get_ticks()); milli_delay(200); } }
/*======================================================================* TestA *======================================================================*/ void TestA() { int i = 0; while (1) { /* disp_str("A."); */ milli_delay(10); } }
/*======================================================================* TestB *======================================================================*/ void TestC() { int i = 0x2000; while(1){ /* disp_str("C."); */ milli_delay(10); } }
/*======================================================================* TestB *======================================================================*/ void TestB() { int i = 0x1000; while(1){ /* disp_str("B."); */ milli_delay(10); } }
/*======================================================================* TestA *======================================================================*/ void TestA() { int i = 0; while (1) { to_clear = 1; milli_delay(200000); } }
void init_p() { while(1) { printk("init=%d.",getpid()); milli_delay(100); } }
void ChildProc() { while(1) { printk("S:%d",getpid() ); milli_delay(10); } }
void TestC() { while(1) { //printf("c"); milli_delay(1000); } }
/*======================================================================* the process delay 23333 *======================================================================*/ void TestA() { int i = 0; while (1) { change(); milli_delay(23333); } }
void TestC() { // int i = 0; while(1){ disp_str("C"); // waitpid(current->pid); milli_delay(100); } }
void TestB() { while(1) { printk("B:%d",getpid() ); milli_delay(100); /*exit();*/ } }
void TestC() { while(1) { printk("C:%d",getpid() ); milli_delay(100); /*fork();*/ /*exit();*/ } }
void TestE() { int i=0; while (1) { printf("E"); milli_delay(1000); } }
/* ** Name: void el2_probe(dpeth_t *dep); ** Function: Probe for the presence of an EtherLink II card. ** Initialize memory addressing if card detected. */ int el2_probe(dpeth_t * dep) { int iobase, membase; int thin; /* Thin ethernet or AUI? */ thin = (dep->de_linmem & 1) ? ECNTR_AUI : ECNTR_THIN; /* Location registers should have 1 bit set */ if (!(iobase = inb_el2(dep, EL2_IOBASE))) return FALSE; if (!((membase = inb_el2(dep, EL2_MEMBASE)) & 0xF0)) return FALSE; if ((iobase & (iobase - 1)) || (membase & (membase - 1))) return FALSE; /* Resets board */ outb_el2(dep, EL2_CNTR, ECNTR_RESET | thin); milli_delay(1); outb_el2(dep, EL2_CNTR, thin); milli_delay(5); /* Map the address PROM to lower I/O address range */ outb_el2(dep, EL2_CNTR, ECNTR_SAPROM | thin); if (inb_el2(dep, EL2_EA0) != 0x02 || /* Etherlink II Station address */ inb_el2(dep, EL2_EA1) != 0x60 || /* MUST be 02:60:8c:xx:xx:xx */ inb_el2(dep, EL2_EA2) != 0x8C) return FALSE; /* No Etherlink board at this address */ /* Map the 8390 back to lower I/O address range */ outb_el2(dep, EL2_CNTR, thin); /* Setup shared memory addressing for 3c503 */ dep->de_linmem = ((membase & 0xC0) ? EL2_BASE_0D8000 : EL2_BASE_0C8000) + ((membase & 0xA0) ? (EL2_BASE_0CC000 - EL2_BASE_0C8000) : 0x0000); /* Shared memory starts at 0x2000 (8kb window) */ dep->de_offset_page = (EL2_SM_START_PG * DP_PAGESIZE); dep->de_linmem -= dep->de_offset_page; dep->de_ramsize = (EL2_SM_STOP_PG - EL2_SM_START_PG) * DP_PAGESIZE; /* Board initialization and stop functions */ dep->de_initf = el2_init; dep->de_stopf = el2_stop; return TRUE; }
void TestA() { while(1) { //printf("%d",get_ticks()); //int fd = open( "/dev_ttydf",O_CREAT ); //printk(" fd: %d\n", fd ); milli_delay(1000); } }
void TestA() { while(1) { //syscall sys_get_ticks // disp_int(get_ticks()); disp_str("A"); // printf("sunkang A:%s",get_ticks()); milli_delay(100); } }
void TestA() { int ret; /*printk("-----------------------------------------\n");*/ int fd = open("/",0,0); if(fd < 0) { printk("open error. fd = %d.", fd); } close(fd); struct m_inode *inode; fd = open("/sunkang",0,O_CREAT); if(fd < 0) { printk("open error. fd = %d.", fd); } else { inode = current->filp[fd]->f_inode; printk("sunkang inode num = %d",inode->i_num); close(fd); } if((fd = open("/sunkang/kamus",I_REGULAR,O_CREAT)) < 0) { } else { inode = current->filp[fd]->f_inode; printk("kamus inode num = %d mode = %x.",inode->i_num, inode->i_mode); } printk("---------------------------------------\n"); char buf[] = "wo shi sunkang"; sys_write(fd,buf, sizeof(buf)); ret = close(fd); printk("close ret = %d.",ret); if((fd = open("/sunkang/kamus",I_REGULAR,0)) < 0) { printk("opern error."); } char abc[15] = {0}; sys_read(fd,abc,sizeof(abc)); printk("abc = %s\n",abc); close(fd); printk("[kangsun@sunkang-develop prettyos]$ "); while(1) { printk("A"); milli_delay(100); } }
int Main() { int i = 0; while(i < 100){ printf("C"); milli_delay(500); i++; } printf("\f"); _exit(0); }
/* ** Name: void ne_reset(dpeth_t * dep); ** Function: Resets the board and checks if reset cycle completes */ static int ne_reset(dpeth_t * dep) { int count = 0; /* Reset the ethernet card */ outb_ne(dep, NE_RESET, inb_ne(dep, NE_RESET)); do { if (++count > 10) return FALSE; /* 20 mSecs. timeout */ milli_delay(2); } while ((inb_ne(dep, DP_ISR) & ISR_RST) == 0); return TRUE; }
void TestB() { // int i = 0; while(1) { disp_str("B"); // printf("%d %s %c\t",i,"sunkang",'k'); // i++; // assert(i ==1); // panic("no error\n"); // TestA(); milli_delay(100); exit(); } }