示例#1
0
void fifoWrite(FifoBuf* ths, char* c, unsigned char len)
{
  unsigned char i;
  for (i=0;i<len;i++)
    {
      fifoPush(ths,c[len]);
    }
#if 0
  while(len)  // Tail recursion
    {
      if (ths->tail>ths->head)  // The good data is between tail and head
        {
          unsigned char tillEnd = min(FIFO_BUF_SIZE-ths->tail,len);
          memcpy(buf+ths->tail,c,tillEnd);
          len-=tillEnd;
          c += tillEnd;
          ths->tail+=tillEnd;
          if (ths->tail>=FIFO_BUF_SIZE) ths->tail -= FIFO_BUF_SIZE;
         }
      else if (ths->tail < ths->head)  // The good data is from head to end, and 0 to tail.
        {
          unsigned char tillEnd = min(,len);
        }
      else
        {
        }
    }
#endif
}
示例#2
0
static void getChars(void *user)
{
    Uns8 c;

    while(1) {
        double d = DEFAULT_RX_DELAY;

        //
        // keep getting chars till we fill the fifo
        //
        bhmWaitDelay(d);
        while (!Rx.full) {
            Int32 bytes = readInput(&c, 1);
            if (bytes > 0) {
                //
                // We have got a char, so insert to buffer
                //
                fifoPush(&Rx, c);
                eval_interrupts();
            }
            bhmWaitDelay(d);
        }
        if (!Rx.empty) {
            eval_interrupts();
        }
    }
}
示例#3
0
void core2(void){
	// Initialisation(s)
	communicationInit();
	fifoInit(FIFO_Head_broadcastOutput_en__1, 32*sizeof(char), NULL, 0);
	cache_wbInv(FIFO_Head_broadcastOutput_en__1, 32*sizeof(char));

	// Begin the execution loop 
	while(1){
		busy_barrier();
		cache_inv(FIFO_Head_broadcastOutput_en__1, 32*sizeof(char));
		fifoPop(init_out__runningTotal__5, FIFO_Head_broadcastOutput_en__1, 32*sizeof(char), NULL, 0);
		cache_wbInv(accumulateMatrices_0_init_ru__0, 32*sizeof(char));
		sendStart(7); // Core2 > Core7: accumulateMatrices_0_init_ru__0 
		sendEnd(); // Core2 > Core7: accumulateMatrices_0_init_ru__0 
		receiveStart(); // Core5 > Core2: accumulateMatrices_2_init_ru__0 
		receiveEnd(5); // Core5 > Core2: accumulateMatrices_2_init_ru__0 
		cache_inv(accumulateMatrices_2_init_ru__0, 32*sizeof(char));
		receiveStart(); // Core7 > Core2: explode_generateMatrices_sta__0 
		receiveEnd(7); // Core7 > Core2: explode_generateMatrices_sta__0 
		cache_inv(explode_generateMatrices_sta__0, 32*sizeof(char));
		add(8/*rows*/,8/*columns*/,init_out__runningTotal__0,startArray_16__inputArray__0,output__input_16__0); // accumulateMatrices_2
		cache_inv(init_out__runningTotal__0, 8*sizeof(long));
		cache_inv(startArray_16__inputArray__0, 8*sizeof(long));
		cache_wbInv(accumulateMatrices_2__implod__0, 32*sizeof(char));
		sendStart(7); // Core2 > Core7: accumulateMatrices_2__implod__0 
		sendEnd(); // Core2 > Core7: accumulateMatrices_2__implod__0 
		receiveStart(); // Core7 > Core2: broadcastOutput__broadcastOu__3 
		receiveEnd(7); // Core7 > Core2: broadcastOutput__broadcastOu__3 
		cache_inv(broadcastOutput__broadcastOu__3, 32*sizeof(char));
		fifoPush(output1_24__end_in__0, FIFO_Head_broadcastOutput_en__3, 32*sizeof(char), NULL, 0);
		cache_wbInv(FIFO_Head_broadcastOutput_en__3, 32*sizeof(char));
		cache_inv(output1_24__end_in__0, 8*sizeof(long));
	}
}
示例#4
0
void main()
{
	int i=0;
	char mymac[6]={0x74,0xf7,0x26,0x00,0x00,0x01};
	unsigned char data[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x04,0x74,0xf7,0x26,0x00,0x00,0x01,0x65,0x00,0x00,0x0a,0x05,0x00,0x01,0x02,0x03,0x05,0x06,0x07,0x08,0x09};

	bowler4_header bh;
	for (i=0; i<sizeof(bowler4_header); i++) bh.bytes[i]=0;
	bh.fields.version=0x04;
	bh.fields.affect=setPriority(5,setState(setAsync(bh.fields.affect)));
	bh.fields.payloadLength=10;
	bh.fields.payloadType=0;


	set_mac_address(mymac,&bh);
	calculate_checksum(&bh);
	printf("Verify?\t%d\n",verify_checksum(&bh));
	printf("Verify?\t%d\n",verify_checksum(&bh));
printf("%X\n",check_mac_address(mymac,&bh) );
	printHeader(bh);


	V4MicroParser_state parser;
	parser.state=align;
	parser.macaddr=&mymac;
	fifoInit(&parser.fifo);
	fifoPrint(&parser.fifo);

	for (i=0; i<sizeof(data); i++){
 		fifoPush(&parser.fifo,data[i]);
		int delta=parser.fifo.inPointer;
		printf("Pushing:\t%i\n",i);
		/*fifoPrint(&parser.fifo);*/
		runParserSM(&parser);
		if (parser.fifo.inPointer!=delta) {printf("\nNew Contents of FIFO:");fifoPrint(&parser.fifo);}

		printf("===================\n");
		

	}
		/* fifoPull(&fifo,15); */
		/* fifoPrint(&fifo); */
}
示例#5
0
static void
insertPacket(TSMStreamLace * lace, const AVPacket * packet, double timeStamp)
{
    fifoPush(lace->streams[packet->stream_index], packet, timeStamp);
}
示例#6
0
void fifoPushStr(FifoBuf* ths, char* s)
  {
    while(*s!=0) { fifoPush(ths,*s); s++;}
  }
示例#7
0
void core7(void){
	// Initialisation(s)
	communicationInit();
	fifoInit(FIFO_Head_generateMatrices_e__0, 4*sizeof(char), NULL, 0);
	cache_wbInv(FIFO_Head_generateMatrices_e__0, 4*sizeof(char));

	// Begin the execution loop 
	while(1){
		busy_barrier();
		receiveStart(); // Core2 > Core7: accumulateMatrices_0_init_ru__0 
		receiveEnd(2); // Core2 > Core7: accumulateMatrices_0_init_ru__0 
		cache_inv(accumulateMatrices_0_init_ru__0, 32*sizeof(char));
		cache_inv(FIFO_Head_generateMatrices_e__0, 4*sizeof(char));
		fifoPop(init_out__countIn__0, FIFO_Head_generateMatrices_e__0, 4*sizeof(char), NULL, 0);
		cache_wbInv(generateMatrices_init_countI__0, 4*sizeof(char));
		sendStart(0); // Core7 > Core0: generateMatrices_init_countI__0 
		sendEnd(); // Core7 > Core0: generateMatrices_init_countI__0 
		receiveStart(); // Core0 > Core7: generateMatrices__explode_ge__0 
		receiveEnd(0); // Core0 > Core7: generateMatrices__explode_ge__0 
		cache_inv(generateMatrices__explode_ge__0, 256*sizeof(char));
		// Fork explode_generateMatrices_startArray
		{
			cache_wb(startArray__inputArray__0, 64*sizeof(long));
			memcpy((void*)(startArray_8__inputArray__0+0),(void*)( startArray__inputArray__0+8), 8*sizeof(long));
			memcpy((void*)(startArray_16__inputArray__0+0),(void*)( startArray__inputArray__0+16), 8*sizeof(long));
			memcpy((void*)(startArray_24__inputArray__0+0),(void*)( startArray__inputArray__0+24), 8*sizeof(long));
			memcpy((void*)(startArray_40__inputArray__0+0),(void*)( startArray__inputArray__0+40), 8*sizeof(long));
			memcpy((void*)(startArray_48__inputArray__0+0),(void*)( startArray__inputArray__0+48), 8*sizeof(long));
			memcpy((void*)(startArray_56__inputArray__0+0),(void*)( startArray__inputArray__0+56), 8*sizeof(long));
		}
		cache_wb(((char*)startArray__inputArray__0) + 0, 32);
		cache_wb(((char*)startArray__inputArray__0) + 128, 32);
		cache_inv(startArray__inputArray__0, 64*sizeof(long));
		cache_wbInv(explode_generateMatrices_sta__7, 32*sizeof(char));
		sendStart(3); // Core7 > Core3: explode_generateMatrices_sta__7 
		sendEnd(); // Core7 > Core3: explode_generateMatrices_sta__7 
		cache_wbInv(explode_generateMatrices_sta__3, 32*sizeof(char));
		sendStart(6); // Core7 > Core6: explode_generateMatrices_sta__3 
		sendEnd(); // Core7 > Core6: explode_generateMatrices_sta__3 
		cache_wbInv(explode_generateMatrices_sta__6, 32*sizeof(char));
		sendStart(0); // Core7 > Core0: explode_generateMatrices_sta__6 
		sendEnd(); // Core7 > Core0: explode_generateMatrices_sta__6 
		cache_wbInv(explode_generateMatrices_sta__1, 32*sizeof(char));
		sendStart(4); // Core7 > Core4: explode_generateMatrices_sta__1 
		sendEnd(); // Core7 > Core4: explode_generateMatrices_sta__1 
		cache_wbInv(explode_generateMatrices_sta__4, 32*sizeof(char));
		sendStart(1); // Core7 > Core1: explode_generateMatrices_sta__4 
		sendEnd(); // Core7 > Core1: explode_generateMatrices_sta__4 
		cache_wbInv(explode_generateMatrices_sta__0, 32*sizeof(char));
		sendStart(2); // Core7 > Core2: explode_generateMatrices_sta__0 
		sendEnd(); // Core7 > Core2: explode_generateMatrices_sta__0 
		cache_wbInv(explode_generateMatrices_sta__5, 32*sizeof(char));
		sendStart(5); // Core7 > Core5: explode_generateMatrices_sta__5 
		sendEnd(); // Core7 > Core5: explode_generateMatrices_sta__5 
		add(8/*rows*/,8/*columns*/,init_out__runningTotal__5,startArray_0__inputArray__0,output__input_0__0); // accumulateMatrices_0
		cache_inv(init_out__runningTotal__5, 8*sizeof(long));
		cache_inv(startArray_0__inputArray__0, 8*sizeof(long));
		receiveStart(); // Core5 > Core7: accumulateMatrices_1__implod__0 
		receiveEnd(5); // Core5 > Core7: accumulateMatrices_1__implod__0 
		cache_inv(accumulateMatrices_1__implod__0, 32*sizeof(char));
		receiveStart(); // Core2 > Core7: accumulateMatrices_2__implod__0 
		receiveEnd(2); // Core2 > Core7: accumulateMatrices_2__implod__0 
		cache_inv(accumulateMatrices_2__implod__0, 32*sizeof(char));
		receiveStart(); // Core1 > Core7: accumulateMatrices_3__implod__0 
		receiveEnd(1); // Core1 > Core7: accumulateMatrices_3__implod__0 
		cache_inv(accumulateMatrices_3__implod__0, 32*sizeof(char));
		receiveStart(); // Core4 > Core7: accumulateMatrices_4__implod__0 
		receiveEnd(4); // Core4 > Core7: accumulateMatrices_4__implod__0 
		cache_inv(accumulateMatrices_4__implod__0, 32*sizeof(char));
		receiveStart(); // Core0 > Core7: accumulateMatrices_5__implod__0 
		receiveEnd(0); // Core0 > Core7: accumulateMatrices_5__implod__0 
		cache_inv(accumulateMatrices_5__implod__0, 32*sizeof(char));
		receiveStart(); // Core6 > Core7: accumulateMatrices_6__implod__0 
		receiveEnd(6); // Core6 > Core7: accumulateMatrices_6__implod__0 
		cache_inv(accumulateMatrices_6__implod__0, 32*sizeof(char));
		receiveStart(); // Core3 > Core7: accumulateMatrices_7__implod__0 
		receiveEnd(3); // Core3 > Core7: accumulateMatrices_7__implod__0 
		cache_inv(accumulateMatrices_7__implod__0, 32*sizeof(char));
		// Join implode_broadcastOutput_input
		{
			cache_wb(output__input_0__0, 8*sizeof(long));
			memcpy((void*)(output__input__0+8),(void*)( output__input_8__0+0), 8*sizeof(long));
			memcpy((void*)(output__input__0+16),(void*)( output__input_16__0+0), 8*sizeof(long));
			memcpy((void*)(output__input__0+24),(void*)( output__input_24__0+0), 8*sizeof(long));
			cache_wb(output__input_32__0, 8*sizeof(long));
			memcpy((void*)(output__input__0+40),(void*)( output__input_40__0+0), 8*sizeof(long));
			memcpy((void*)(output__input__0+48),(void*)( output__input_48__0+0), 8*sizeof(long));
			memcpy((void*)(output__input__0+56),(void*)( output__input_56__0+0), 8*sizeof(long));
		}
		cache_wb(((char*)output__input_0__0) + 0, 32);
		cache_inv(output__input_0__0, 8*sizeof(long));
		cache_inv(output__input_8__0, 8*sizeof(long));
		cache_inv(output__input_16__0, 8*sizeof(long));
		cache_inv(output__input_24__0, 8*sizeof(long));
		cache_wb(((char*)output__input_32__0) + 0, 32);
		cache_inv(output__input_32__0, 8*sizeof(long));
		cache_inv(output__input_40__0, 8*sizeof(long));
		cache_inv(output__input_48__0, 8*sizeof(long));
		cache_inv(output__input_56__0, 8*sizeof(long));
		// Broadcast broadcastOutput
		{
			cache_wb(output__input__0, 64*sizeof(long));
			memcpy((void*)(output1_8__end_in__0+0),(void*)( output__input__0+0), 8*sizeof(long));
			memcpy((void*)(output1_40__end_in__0+0),(void*)( output__input__0+8), 8*sizeof(long));
			memcpy((void*)(output1_32__end_in__0+0),(void*)( output__input__0+16), 8*sizeof(long));
			memcpy((void*)(output1_16__end_in__0+0),(void*)( output__input__0+24), 8*sizeof(long));
			memcpy((void*)(output1_0__end_in__0+0),(void*)( output__input__0+32), 8*sizeof(long));
			memcpy((void*)(output1_24__end_in__0+0),(void*)( output__input__0+40), 8*sizeof(long));
			memcpy((void*)(output1_48__end_in__0+0),(void*)( output__input__0+48), 8*sizeof(long));
			memcpy((void*)(output1_56__end_in__0+0),(void*)( output__input__0+56), 8*sizeof(long));
		}
		cache_wb(((char*)output__input__0) + 0, 256);
		cache_inv(output__input__0, 64*sizeof(long));
		cache_wbInv(broadcastOutput__broadcastOu__0, 32*sizeof(char));
		sendStart(1); // Core7 > Core1: broadcastOutput__broadcastOu__0 
		sendEnd(); // Core7 > Core1: broadcastOutput__broadcastOu__0 
		cache_wbInv(broadcastOutput__broadcastOu__3, 32*sizeof(char));
		sendStart(2); // Core7 > Core2: broadcastOutput__broadcastOu__3 
		sendEnd(); // Core7 > Core2: broadcastOutput__broadcastOu__3 
		cache_wbInv(broadcastOutput__broadcastOu__7, 32*sizeof(char));
		sendStart(5); // Core7 > Core5: broadcastOutput__broadcastOu__7 
		sendEnd(); // Core7 > Core5: broadcastOutput__broadcastOu__7 
		cache_wbInv(broadcastOutput__broadcastOu__5, 32*sizeof(char));
		sendStart(6); // Core7 > Core6: broadcastOutput__broadcastOu__5 
		sendEnd(); // Core7 > Core6: broadcastOutput__broadcastOu__5 
		cache_wbInv(broadcastOutput__broadcastOu__1, 32*sizeof(char));
		sendStart(3); // Core7 > Core3: broadcastOutput__broadcastOu__1 
		sendEnd(); // Core7 > Core3: broadcastOutput__broadcastOu__1 
		cache_wbInv(broadcastOutput__broadcastOu__4, 32*sizeof(char));
		sendStart(4); // Core7 > Core4: broadcastOutput__broadcastOu__4 
		sendEnd(); // Core7 > Core4: broadcastOutput__broadcastOu__4 
		cache_wbInv(broadcastOutput__displayMatr__0, 256*sizeof(char));
		sendStart(0); // Core7 > Core0: broadcastOutput__displayMatr__0 
		sendEnd(); // Core7 > Core0: broadcastOutput__displayMatr__0 
		fifoPush(output1_56__end_in__0, FIFO_Head_broadcastOutput_en__0, 32*sizeof(char), NULL, 0);
		cache_wbInv(FIFO_Head_broadcastOutput_en__0, 32*sizeof(char));
		cache_inv(output1_56__end_in__0, 8*sizeof(long));
		fifoPush(output1_8__end_in__0, FIFO_Head_broadcastOutput_en__6, 32*sizeof(char), NULL, 0);
		cache_wbInv(FIFO_Head_broadcastOutput_en__6, 32*sizeof(char));
		cache_inv(output1_8__end_in__0, 8*sizeof(long));
	}
}