busudp.h File Reference

Part of the Modtronix Configurable Buses. This modules uses buffers from the buses module for it's transmit and receive buffers. More...

#include "buses.h"

Defines

#define UDP1_RXBUF_OVERRUN   0x01
#define UDP1_TXBUF_OVERRUN   0x10
#define udp1BusIsGetReady()   busRxBufHasData(BUSID_UDP1)
#define udp1BusRxBufEmpty()   busIsRxBufEmpty(BUSID_UDP1)
#define UDP2_RXBUF_OVERRUN   0x01
#define UDP2_TXBUF_OVERRUN   0x10
#define udp2BusIsGetReady()   busRxBufHasData(BUSID_UDP2)
#define udp2BusRxBufEmpty()   busIsRxBufEmpty(BUSID_UDP2)

Functions

void serPut2Bytes (BYTE b1, BYTE b2)
void serPutByteHex (BYTE c)
void serPutDebugMsgRomStr (BYTE debugCode, BYTE msgCode, ROM char *msgString)
void serPutRomString (ROM char *str)
void serPutRomStringAndNull (ROM char *str)
void serPutString (BYTE *s)
void serPutStringAndNull (BYTE *str)
BYTE udp1BusGetByte (void)
BYTE udp1BusGetStat (void)
void udp1BusPutByte (BYTE c)
BYTE udp2BusGetByte (void)
BYTE udp2BusGetStat (void)
void udpBusInit (void)
void udpBusService (void)


Detailed Description

Part of the Modtronix Configurable Buses. This modules uses buffers from the buses module for it's transmit and receive buffers.

Author:
Modtronix Engineering
Dependencies:
Compiler:
MPLAB C18 v3.21 or higher

Description

This module implements UDP port(s) that can be used for reading and writing data to a remote host.

Configuration

The following defines are used to configure this module, and should be placed in the projdefs.h (or similar) file. For details, see Project Configuration. To configure the module, the required defines should be uncommended, and the rest commented out.
 //*********************************************************************
 //-------------- BusUDP Configuration --------------------
 //*********************************************************************
 //The default UDP port to use for the UDP 1 Port.
 //#define BUS_UDP1_PORT        (54125)
 //
 //The default UDP port to use for the UDP 2 Port.
 //#define BUS_UDP2_PORT        (54126)

Define Documentation

#define UDP1_RXBUF_OVERRUN   0x01

#define UDP1_TXBUF_OVERRUN   0x10

 
#define udp1BusIsGetReady (  )     busRxBufHasData(BUSID_UDP1)

Are there any bytes in the UDP1 Bus receive buffer.

Returns:
1 if true, else 0

 
#define udp1BusRxBufEmpty (  )     busIsRxBufEmpty(BUSID_UDP1)

Are there any bytes in the receive buffer.

Returns:
0 if not empty, 1 if empty

#define UDP2_RXBUF_OVERRUN   0x01

#define UDP2_TXBUF_OVERRUN   0x10

 
#define udp2BusIsGetReady (  )     busRxBufHasData(BUSID_UDP2)

Are there any bytes in the UDP1 Bus receive buffer.

Returns:
1 if true, else 0

 
#define udp2BusRxBufEmpty (  )     busIsRxBufEmpty(BUSID_UDP2)

Are there any bytes in the receive buffer.

Returns:
0 if not empty, 1 if empty


Function Documentation

void serPut2Bytes ( BYTE  b1,
BYTE  b2 
)

Sent the given two bytes via the USART.

Parameters:
b1 The first byte to be sent.
b2 The second byte to be sent.

void serPutByteHex ( BYTE  c  ) 

Send the ASCII hex value of the given byte to the USART. It is added to the transmit buffer, and asynchronously transmitted. For example, if c=11, then "0B" will be sent to the USART

Parameters:
c Byte to write out on the serial port

void serPutDebugMsgRomStr ( BYTE  debugCode,
BYTE  msgCode,
ROM char *  msgString 
)

Sent the given debug message to the USART. The following is sent: [debugCode][msgCode][msgString]

Parameters:
debugCode The Debug Message's "Debug Code". This will be the first byte sent.
msgCode The Debug Message's "Message Code". This will be the second byte sent.
msgString The Debug Message's "Message String", has to be a NULL terminated string. This will be sent after the msgCode.

void serPutRomString ( ROM char *  str  ) 

Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is NOT sent!

Parameters:
str Null terminated string to write out on the serial port

void serPutRomStringAndNull ( ROM char *  str  ) 

Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is ALSO sent!

Parameters:
str Null terminated string to write out on the serial port

void serPutString ( BYTE s  ) 

Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is NOT sent!

Parameters:
s Null terminated string to write out on the serial port

void serPutStringAndNull ( BYTE str  ) 

Transmit a NULL terminated string. It is added to the transmit buffer, and asynchronously transmitted. The NULL is ALSO sent!

Parameters:
str Null terminated string to write out on the serial port

BYTE udp1BusGetByte ( void   ) 

Get the next byte in the RX buffer. Before calling this function, the udp1IsGetReady() function should be called to check if there is any data available.

Returns:
Returns next byte in receive buffer.

BYTE udp1BusGetStat ( void   ) 

Get the current status of the UDP 1 Port

Returns:
The status of this module. Consists out of UDP1_XXX flags

void udp1BusPutByte ( BYTE  c  ) 

Add a byte to the TX buffer.

Parameters:
c Byte to write out on the serial port

BYTE udp2BusGetByte ( void   ) 

Get the next byte in the RX buffer. Before calling this function, the udp1IsGetReady() function should be called to check if there is any data available.

Returns:
Returns next byte in receive buffer.

BYTE udp2BusGetStat ( void   ) 

Get the current status of the UDP 2 Port

Returns:
The status of this module. Consists out of UDP2_XXX flags

void udpBusInit ( void   ) 

Initialize this module

void udpBusService ( void   ) 

Service this module


Generated on Wed Feb 3 12:45:34 2010 for SBC65EC Web Server by  doxygen 1.5.8