Beispiel #1
0
void writepip(pipid32 pip) {
        int index = 0;
        int wdCount = 0, numBytes;
        //char genWord[5];
        char *genWord; 
        int wrttime = 0,t=0;
        while(1) {
            index = rand() % 2048;
            /*if(index == 2048) {
                index = 0;
            }
            if(index < 2048) {
                genWord = (char*)(words[index]);
            }*/
            genWord = (char*)(words[index]);
            if((numBytes = pipwrite(pip,(char*)words[index]+0 ,5)) == SYSERR) {
                kprintf("pipewrite failed \n\r");
                return;
                } 
            wdCount = wdCount + 1;
            //index = index + 1;
            //kprintf("clktime : %d, wdcount : %d ,numBytes : %d\n\r",clktime, wdCount,numBytes);
            if (((((t=clktime)) % 5) == 0) && (clktime != wrttime)) {
                wait(printsem);
                kprintf("Number of words generated : %d \n\r",wdCount);
                signal(printsem); 
                wdCount = 0;
                wrttime = t;          
            }
            //kprintf("generated word: %c%c%c%c%c ,index :%d\n\r",genWord[0],genWord[1],genWord[2],genWord[3],genWord[4],index);
        }                
}
Beispiel #2
0
void produce(pipid32 pip) {
  
char input[15] = "1234567890123\0"; 

	int write = 0;

    while(1) {
  	write = pipwrite(pip, input, 10);
    }
}
Beispiel #3
0
void	shellproduce(void) {
		uint32 i,j;
		uint32 seed = 7;
		for(i = 0; i < 2048; i++) {
			for(j = 0; j <5; j++) {
				pstring[i][j] = words[seed][j];
			}
		seed = (seed*81799)%2048;
		}
		for(i = 0;i < 2048;i++) {
			pipwrite(shell_pipid_test, pstring[i], 5, i*5);
			sleepms(100);
			pcount ++;
		}
}