PIC24 Support Libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Functions
ESOS_UART_Service

Files

file  esos_comm.h
 
file  esos_pic24_rs232.c
 

Data Structures

struct  ESOS_COMM_BUFF_DSC
 

Macros

#define GET_ESOS_COMM_IN_DATA_LEN()
 
#define IS_ESOS_COMM_GOT_EXACTLY_DATA_BYTES(x)
 
#define IS_ESOS_COMM_GOT_AT_LEAST_DATA_BYTES(x)
 
#define FLUSH_ESOS_COMM_IN_DATA()
 
#define IS_ESOS_COMM_GOT_IN_DATA()
 
#define PEEK_ESOS_COMM_IN_DATA(x)
 
#define PEEK_ESOS_COMM_IN_LATEST_DATA()
 
#define IS_ESOS_COMM_READY_OUT_DATA()
 
#define ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM()
 
#define ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM()
 
#define ESOS_TASK_SIGNAL_BUSY_IN_COMM()
 
#define ESOS_TASK_SIGNAL_BUSY_OUT_COMM()
 
#define ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM()
 
#define ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM()
 
#define ESOS_TASK_RELEASE_IN_COMM()
 
#define ESOS_TASK_RELEASE_OUT_COMM()
 
#define ESOS_TASK_WAIT_ON_GET_UINT8(u8_in)
 
#define ESOS_TASK_WAIT_ON_GET_U8BUFFER(pau8_in, u8_size)
 
#define ESOS_TASK_WAIT_ON_GET_UINT16(u16_in)
 
#define ESOS_TASK_WAIT_ON_GET_UINT32(u32_in)
 
#define ESOS_TASK_WAIT_ON_GET_STRING(pau8_in)
 
#define ESOS_TASK_WAIT_ON_SEND_UINT8(u8_out)
 
#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_HEX_STRING(u8_out)
 
#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_DEC_STRING(u8_out)
 
#define ESOS_TASK_WAIT_ON_SEND_UINT32_AS_HEX_STRING(u32_out)
 
#define ESOS_TASK_WAIT_ON_SEND_STRING(psz_out)
 
#define ESOS_TASK_WAIT_ON_SEND_U8BUFFER(pau8_out, u8_size)
 

Functions

uint8_t esos_GetCommSystemVersion (void)
 
uint8_t esos_GetCommSystemMaxOutDataLen (void)
 
uint8_t esos_GetCommSystemMaxInDataLen (void)
 
void __esos_configUART1 (uint32_t u32_baudRate)
 

Detailed Description

Macro Definition Documentation

#define ESOS_TASK_RELEASE_IN_COMM ( )

Signals to other requesting tasks that the ESOS "in" stream is being released or made available again by the current task.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM()
ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM()
Deprecated:
Use ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM instead.

Definition at line 281 of file esos_comm.h.

#define ESOS_TASK_RELEASE_OUT_COMM ( )

Signals to other requesting tasks that the ESOS "out" stream is being released or made available again by the current task.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM()
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM()
Deprecated:
Use ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM instead.

Definition at line 291 of file esos_comm.h.

#define ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM ( )

Signals to other requesting tasks that the current task is making the ESOS "in" stream available again.

See Also
ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM()

Definition at line 262 of file esos_comm.h.

#define ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM ( )

Signals to other requesting tasks that the current task is making the ESOS "out" stream available again.

See Also
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM()

Definition at line 270 of file esos_comm.h.

#define ESOS_TASK_SIGNAL_BUSY_IN_COMM ( )

Signals to other requesting tasks that the ESOS "in" stream is being used by the current task. ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM now signals for us when the "in" stream is available.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM()
ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM()
Deprecated:
Discontinue use of this function. It is subject to removal at any point.

Definition at line 240 of file esos_comm.h.

#define ESOS_TASK_SIGNAL_BUSY_OUT_COMM ( )

Signals to other requesting tasks that the ESOS "out" stream is being used by the current task. ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM now signals for us when the "out" stream is available.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM()
ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM()
Deprecated:
Discontinue use of this function. It is subject to removal at any point.

Definition at line 252 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM ( )

Cause the current task to wait (block) until the ESOS "in" stream is available for use.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM()

Definition at line 216 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM ( )

Causes the current task to wait (block) until the ESOS "out" stream is available for use. Code will resume once the stream is available for our use. This routine marks the "in" stream in use by the current task.

See Also
ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM()

Definition at line 227 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_GET_STRING (   pau8_in)

Create, spawn and wait on a child task to get a string from the ESOS "in" communications buffer. The incoming string must be zero-terminated (useful when reading from other streaming data devices), or terminated with a newline/return character (useful when reading from terminals/keyboards/etc.) Results are written into the array whose address is passed in

Note
This call assumes that the data array target is large enough to hold the incoming string, which is limited to a length equal to the buffer used internally for the ESOS communications "in" buffer
This call will block the current task until the data is read
This macro does not evaluate to anything. Data is returned in the argument variable because of the way ESOS tasks, child tasks, and macros are used.
Parameters
pau8_inpointer to array in which bytes should be returned
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 380 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_GET_U8BUFFER (   pau8_in,
  u8_size 
)

Create, spawn and wait on a child task to get an array of bytes (uint8s) from the ESOS "in" communications buffer Results are written into the array whose address is passed in

Note
This call will block the current task until the data is read
This macro does not evaluate to anything. Data is returned in the argument variable because of the way ESOS tasks, child tasks, and macros are used.
Parameters
pau8_inpointer to array in which bytes should be returned
u8_sizenumber of bytes to read from "in" stream
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 325 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_GET_UINT16 (   u16_in)

Create, spawn and wait on a child task to get a double-byte value (uint16) from the ESOS "in" communications buffer Results are written into the variable which is passed in

Note
This call will block the current task until the 16-bit data is read
This macro does not evaluate to anything. Data is returned in the argument variable because of the way ESOS tasks, child tasks, and macros are used.
Parameters
u16_invariable in which data should be returned
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 341 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_GET_UINT32 (   u32_in)

Create, spawn and wait on a child task to get a quad-byte value (uint32) from the ESOS "in" communications buffer Results are written into the variable which is passed in

Note
This call will block the current task until the 32-bit data is read
This macro does not evaluate to anything. Data is returned in the argument variable because of the way ESOS tasks, child tasks, and macros are used.
Parameters
u32_invariable in which data should be returned
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 357 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_GET_UINT8 (   u8_in)

Create, spawn and wait on a child task to get a byte (uint8) from the ESOS "in" communications buffer Results are written into the variable which is passed in

Note
This call will block the current task until the 8-bit data is read
This macro does not evaluate to anything. Data is returned in the argument variable because of the way ESOS tasks, child tasks, and macros are used.
Parameters
u8_invariable in which data should be returned
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 308 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_STRING (   psz_out)

Create, spawn and wait on a child task to put a zero-terminated string to the ESOS "out" communications buffer.

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
psz_outpointer to the zero-terminated string
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 438 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_U8BUFFER (   pau8_out,
  u8_size 
)

Create, spawn and wait on a child task to put an array of bytes (uint8s) to the ESOS "out" communications buffer

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
pau8_outpointer to beginning of array of bytes to send to "out" stream
u8_sizenumber of bytes to send
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 450 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_UINT32_AS_HEX_STRING (   u32_out)

Create, spawn and wait on a child task to put a 32-bit value (uint32) to the ESOS "out" communications buffer as a human-readable hexadecimal string. Results will look like "0x0123BEEF"

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
u32_outdata to write to "out" stream
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 427 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_UINT8 (   u8_out)

Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
u8_outdata to write to "out" stream
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 391 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_DEC_STRING (   u8_out)

Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer as a human-readable decimal string. Results will look like "253"

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
u8_outdata to write to "out" stream
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 416 of file esos_comm.h.

#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_HEX_STRING (   u8_out)

Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer as a human-readable hexadecimal string. Results will look like "0x4C"

Note
This call will block the current task until the data is absorbed by the ESOS communications subsystem
Parameters
u8_outdata to write to "out" stream
See Also
ESOS_TASK_SPAWN_AND_WAIT

Definition at line 403 of file esos_comm.h.

#define FLUSH_ESOS_COMM_IN_DATA ( )

Flushes the "in" communications buffer. All unread data in the "in" communications buffer will be lost.

Note
Use this function only if you want to reset the "in" communications buffer back to its empty state.

Definition at line 147 of file esos_comm.h.

#define GET_ESOS_COMM_IN_DATA_LEN ( )

Evaluates to the number of bytes in the ESOS "in" communications buffer

Return values
Nnumber of bytes current contained in the "in" buffer

Definition at line 112 of file esos_comm.h.

#define IS_ESOS_COMM_GOT_AT_LEAST_DATA_BYTES (   x)

Evaluates to the booelan to determine if "in" communications buffer has at least x bytes

Parameters
xnumber of bytes to check for
Return values
TRUEif "in" buffer has x bytes or more
FALSEotherwise

Definition at line 136 of file esos_comm.h.

#define IS_ESOS_COMM_GOT_EXACTLY_DATA_BYTES (   x)

Evaluates to the booelan to determine if "in" communications buffer has exactly x bytes

Parameters
xnumber of bytes to check for
Return values
TRUEif "in" buffer has exactly x bytes
FALSEotherwise

Definition at line 124 of file esos_comm.h.

#define IS_ESOS_COMM_GOT_IN_DATA ( )

Evaluates to the booelan to determine if "in" communications buffer any readable bytes

Return values
TRUEif "in" buffer has some data to read
FALSEotherwise

Definition at line 158 of file esos_comm.h.

#define IS_ESOS_COMM_READY_OUT_DATA ( )

Evaluates to boolean to that determines whether the "out" system can accept anymore data

Return values
TRUEif "out" communication system buffer has room for 1+ bytes
FALSEotherwise

Definition at line 207 of file esos_comm.h.

#define PEEK_ESOS_COMM_IN_DATA (   x)

Evaluates to a "peek" of the x-th data byte in the "in" communications buffer

Note
This macro does NOT move the "in" buffer pointers. The data is still by the communcations subsystem GET_xxx routines. This macro simply does a peek or look-ahead into the buffer.
Use sparingly. This macro may be deprecated at some point.
ESOS communication systems built upon interrupts (most of them) will make this macro unsafe since the macro could be interrupted.
Parameters
xbyte in FIFO to "peek"
Return values
datapeeked data byte

Definition at line 178 of file esos_comm.h.

#define PEEK_ESOS_COMM_IN_LATEST_DATA ( )

Evaluates to a "peek" of the most recent data byte written to the "in" communications buffer

Note
This macro does NOT move the "in" buffer pointers. The data is still by the communcations subsystem GET_xxx routines. This macro simply does a peek or look-ahead into the buffer.
Use sparingly. This macro may be deprecated at some point.
ESOS communication systems built upon interrupts (most of them) will make this macro unsafe since the macro could be interrupted.
Return values
datapeeked data byte

Definition at line 196 of file esos_comm.h.

Function Documentation

void __esos_configUART1 ( uint32_t  u32_baudRate)

Configure the UART. Settings chosen:

  • TX is on RP11
  • RX is on RP10
  • Format is 8 data bits, no parity, 1 stop bit
  • CTS, RTS, and BCLK not used
Parameters
u32_baudRateThe baud rate to use.

Definition at line 104 of file esos_pic24_rs232.c.

uint8_t esos_GetCommSystemMaxInDataLen ( void  )

Returns the size of the ESOS communication systems "in" buffers

Return values
uint8_tNumber of bytes

Definition at line 190 of file esos_pic24_rs232.c.

uint8_t esos_GetCommSystemMaxOutDataLen ( void  )

Returns the size of the ESOS communication systems "out" buffers

Return values
uint8_tNumber of bytes

Definition at line 218 of file esos_pic24_rs232.c.

uint8_t esos_GetCommSystemVersion ( void  )

Returns the version number of the ESOS communication systems

Return values
verNumVersion number. Exact value and meaning depends on hardware