Forum Discussion
Altera_Forum
Honored Contributor
12 years ago
# define PktSize 640
# define PktCount 460
void SSSSimpleSocketServerTask()
{
unsigned int LPktCount = 0;
unsigned int Count = 0;
unsigned int DataCount = 0;
printf("\n\t\t----Ready to Receive Synchronous Data----\n");
while (1) {
Count = 0;
LPktCount = 0;
edge_capture = 0;
do {
if (edge_capture) {
edge_capture = 0; // Clear Interrupt
IOWR_ALTERA_AVALON_PIO_DATA(TEMP_OUT_BASE, 1); // Send High to Test Pin TEMP_OUT
ImgBuff = IORD_ALTERA_AVALON_PIO_DATA(DATA_BASE); // Read Data from RS422 Port
Count++;
}
if (Count == PktSize) { // check end of packet-data
Count = 0; // Point to Start of packet data
LPktCount++; // Increment packet Count
}
IOWR_ALTERA_AVALON_PIO_DATA(TEMP_OUT_BASE, 0); // Send LOW to Test Pin TEMP_OUT
} while (LPktCount != (PktCount-1));
}
You test every time if edge_capture is set or LPktCount != (PktCount-1) => Busy wait. I'm not use about other tasks, but if your task has highest priority, other tasks (TCP/IP-stack task?) couldn't get CPU time...