MOD54415 Compiler error -
Posted: Mon Jan 21, 2013 11:13 am
Hi all - I need a little help - again - I'm getting "undefined reference to 'GetDataSize()' " compiler message for my code for the line of code below in red - not sure why. the #include statements and code was copied right from the UDPSendRecieve example file, I just modified the while(1) loop. Here's the troublesome code.
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <ucos.h>
#include <udp.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <sim.h>
#include <pins.h>
#include <ucosmcfc.h>
#include <pinconstant.h>
volatile WORD ADResult[8]; // Register holding the numeric value of the converted data from the ADC
extern "C" {
void UserMain(void * pd);
}
void AsciiToIp(); // Function converts ASCII characters to associated IP address.
PBYTE GetDataBuffer(); // Function makes a pointer to the data buffer
WORD GetDataSize(); // Function gets the size of the buffer
void ReadAD(void);
void InitSingleEndAD(); // Setup the A/D converter to be ready to run
void StartAD(); // Start A/D conversion set.
bool ADDone(); // Return true if the conversion is complete
WORD GetADResult(int ch); // Return the AD Result
void SetupGPIO(void); // GPIO setup routine
void PollGPIO(void); // Polls GPIO pins to get state
const BYTE PinNum[8] = { 15, 16, 18, 23, 17, 19, 20, 24 }; // J2 Pins for LEDs
const BYTE J1_PinNum[7] = { 5, 6, 7, 9, 10, 13, 31 }; // GPIO pins on J1
const BYTE J2_PinNum[17] = { 21, 22, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 44, 47, 48 }; // GPIO pins on J2
const int PORT_IO[24] = {/* INSERT PORT ASSIGNMENT ELEMENTS HERE*/};
DWORD UdpTestStk[USER_TASK_STK_SIZE]; // Allocate task stack for UDP listen task
void UdpReaderMain(void * pd)
{
int port = (int)pd; // cast void * param as int port number
// Create a FIFO for the UDP packet and initialize it
OS_FIFO fifo;
OSFifoInit(&fifo);
// Register to listen for UDP packets on port number 'port'
RegisterUDPFifo(port, &fifo);
while (1)
{
// Construct a UDP packet object using the previously
// declared FIFO. The UDP constructor will only return
// when a packet has been received. The second parameter
// is a timeout value (timeticks). A value of 0 will
// wait forever. The TICKS_PER_SECOND definition can
// be used for code readability.
UDPPacket upkt(&fifo, 0 * TICKS_PER_SECOND);
// Did we get a valid packet, or just time out? If so, put it into data[k]
if (upkt.Validate())
{
PBYTE data_pointer = GetDataBuffer(); // points "data_pointer" to the (address) start of the data buffer
WORD buff_size = GetDataSize(); // Stores the size of the Data Buffer in "buff_size"
for (int i = 0; i < buff_size; i++)
{
unsigned int data_byte = *data_pointer; // Dereferences the data pointer to get data it's pointing towards
data = data_byte; // Data is stored in array location
i++; // increment
data_pointer++; // Next data location
}
}
}
}
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <ucos.h>
#include <udp.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <sim.h>
#include <pins.h>
#include <ucosmcfc.h>
#include <pinconstant.h>
volatile WORD ADResult[8]; // Register holding the numeric value of the converted data from the ADC
extern "C" {
void UserMain(void * pd);
}
void AsciiToIp(); // Function converts ASCII characters to associated IP address.
PBYTE GetDataBuffer(); // Function makes a pointer to the data buffer
WORD GetDataSize(); // Function gets the size of the buffer
void ReadAD(void);
void InitSingleEndAD(); // Setup the A/D converter to be ready to run
void StartAD(); // Start A/D conversion set.
bool ADDone(); // Return true if the conversion is complete
WORD GetADResult(int ch); // Return the AD Result
void SetupGPIO(void); // GPIO setup routine
void PollGPIO(void); // Polls GPIO pins to get state
const BYTE PinNum[8] = { 15, 16, 18, 23, 17, 19, 20, 24 }; // J2 Pins for LEDs
const BYTE J1_PinNum[7] = { 5, 6, 7, 9, 10, 13, 31 }; // GPIO pins on J1
const BYTE J2_PinNum[17] = { 21, 22, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 44, 47, 48 }; // GPIO pins on J2
const int PORT_IO[24] = {/* INSERT PORT ASSIGNMENT ELEMENTS HERE*/};
DWORD UdpTestStk[USER_TASK_STK_SIZE]; // Allocate task stack for UDP listen task
void UdpReaderMain(void * pd)
{
int port = (int)pd; // cast void * param as int port number
// Create a FIFO for the UDP packet and initialize it
OS_FIFO fifo;
OSFifoInit(&fifo);
// Register to listen for UDP packets on port number 'port'
RegisterUDPFifo(port, &fifo);
while (1)
{
// Construct a UDP packet object using the previously
// declared FIFO. The UDP constructor will only return
// when a packet has been received. The second parameter
// is a timeout value (timeticks). A value of 0 will
// wait forever. The TICKS_PER_SECOND definition can
// be used for code readability.
UDPPacket upkt(&fifo, 0 * TICKS_PER_SECOND);
// Did we get a valid packet, or just time out? If so, put it into data[k]
if (upkt.Validate())
{
PBYTE data_pointer = GetDataBuffer(); // points "data_pointer" to the (address) start of the data buffer
WORD buff_size = GetDataSize(); // Stores the size of the Data Buffer in "buff_size"
for (int i = 0; i < buff_size; i++)
{
unsigned int data_byte = *data_pointer; // Dereferences the data pointer to get data it's pointing towards
data = data_byte; // Data is stored in array location
i++; // increment
data_pointer++; // Next data location
}
}
}
}