Beispiel #1
0
DMP_INLINE(void) can_RoundRobin(CAN_Bus *can)
{
	CANFrame temp;
		
	if (QueueEmpty(can->xmit))
		return;
	
	io_DisableINT();
	if (!(io_In32(can->ioHandle, can->REQ) & (0x01L << (can->round*2))))
	{
		PopBufQueue(can->xmit, (void*)&temp);
		
		io_Out32(can->ioHandle, can->TX[can->round].TYPE , (unsigned long)temp.type | ((unsigned long)temp.length << 4));
		io_Out32(can->ioHandle, can->TX[can->round].IDR  , temp.identifier);
		io_Out32(can->ioHandle, can->TX[can->round].DATAL, temp.Data.dword[0]);
		io_Out32(can->ioHandle, can->TX[can->round].DATAH, temp.Data.dword[1]);
		
		io_Out32(can->ioHandle, can->REQ, io_In32(can->ioHandle, can->REQ) | (0x01UL << (can->round*2)));
		
		can->round++;
		if (can->round == 3)
			can->round = 0;
	}
	io_RestoreINT();
}
Beispiel #2
0
DMPAPI(unsigned int) PopQueue(Queue *queue)
{
	unsigned char ch;
	
	if (PopBufQueue(queue, (void *)&ch) == false)
		return 0xffff;
	
	return (unsigned int)ch;
}
Beispiel #3
0
DMP_INLINE(void) can_RoundRobin(CAN_Bus *can)
{
	
	if (QueueEmpty(can->xmit)) return;
	
	io_DisableINT();
	{
		if (!(io_In32(can->handle, can->REQ) & (0x01L << (round*2))))
		{
			PopBufQueue(can->xmit, (void*)&can->tx_temp);
			
			io_Out32(can->handle, can->TX[round].TYPE , (unsigned long)can->tx_temp.type);
			io_Out32(can->handle, can->TX[round].IDR  , can->tx_temp.id);
			io_Out32(can->handle, can->TX[round].DATAL, can->tx_temp.ldata);
			io_Out32(can->handle, can->TX[round].DATAH, can->tx_temp.hdata);
			
			io_Out32(can->handle, can->REQ, io_In32(can->handle, can->REQ) | (0x01L << (round*2)));
			
			round++;
			if (round == 3) round = 0;
		}
	}
	io_RestoreINT();
}