OpenWSN Firmware
OpenSerial

The component which managing input/output over the serial port. More...

Data Structures

struct  openserial_vars_t
 

Macros

#define SERIAL_OUTPUT_BUFFER_SIZE   256
 Number of bytes of the serial output buffer, in bytes. More...
 
#define SERIAL_INPUT_BUFFER_SIZE   200
 Number of bytes of the serial input buffer, in bytes. More...
 
#define SERFRAME_MOTE2PC_DATA   ((uint8_t)'D')
 
#define SERFRAME_MOTE2PC_STATUS   ((uint8_t)'S')
 
#define SERFRAME_MOTE2PC_INFO   ((uint8_t)'I')
 
#define SERFRAME_MOTE2PC_ERROR   ((uint8_t)'E')
 
#define SERFRAME_MOTE2PC_CRITICAL   ((uint8_t)'C')
 
#define SERFRAME_MOTE2PC_REQUEST   ((uint8_t)'R')
 
#define SERFRAME_PC2MOTE_SETROOT   ((uint8_t)'R')
 
#define SERFRAME_PC2MOTE_SETBRIDGE   ((uint8_t)'B')
 
#define SERFRAME_PC2MOTE_DATA   ((uint8_t)'D')
 
#define SERFRAME_PC2MOTE_TRIGGERTCPINJECT   ((uint8_t)'T')
 
#define SERFRAME_PC2MOTE_TRIGGERUDPINJECT   ((uint8_t)'U')
 
#define SERFRAME_PC2MOTE_TRIGGERICMPv6ECHO   ((uint8_t)'E')
 
#define SERFRAME_PC2MOTE_TRIGGERSERIALECHO   ((uint8_t)'S')
 

Enumerations

enum  { MODE_OFF = 0, MODE_INPUT = 1, MODE_OUTPUT = 2 }
 Modes of the openserial module. More...
 

Functions

void openserial_init (void)
 
owerror_t openserial_printStatus (uint8_t statusElement, uint8_t *buffer, uint8_t length)
 
owerror_t openserial_printInfo (uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2)
 
owerror_t openserial_printError (uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2)
 
owerror_t openserial_printCritical (uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2)
 
owerror_t openserial_printData (uint8_t *buffer, uint8_t length)
 
uint8_t openserial_getNumDataBytes (void)
 
uint8_t openserial_getInputBuffer (uint8_t *bufferToWrite, uint8_t maxNumBytes)
 
void openserial_startInput (void)
 
void openserial_startOutput (void)
 
void openserial_stop (void)
 
bool debugPrint_outBufferIndexes (void)
 Trigger this module to print status information, over serial. More...
 
void openserial_echo (uint8_t *but, uint8_t bufLen)
 
void isr_openserial_rx (void)
 
void isr_openserial_tx (void)
 

Detailed Description

The component which managing input/output over the serial port.

Author
Thomas Watteyne watte.nosp@m.yne@.nosp@m.eecs..nosp@m.berk.nosp@m.eley..nosp@m.edu, August 2010

Macro Definition Documentation

#define SERFRAME_MOTE2PC_CRITICAL   ((uint8_t)'C')
#define SERFRAME_MOTE2PC_DATA   ((uint8_t)'D')
#define SERFRAME_MOTE2PC_ERROR   ((uint8_t)'E')
#define SERFRAME_MOTE2PC_INFO   ((uint8_t)'I')
#define SERFRAME_MOTE2PC_REQUEST   ((uint8_t)'R')
#define SERFRAME_MOTE2PC_STATUS   ((uint8_t)'S')
#define SERFRAME_PC2MOTE_DATA   ((uint8_t)'D')
#define SERFRAME_PC2MOTE_SETBRIDGE   ((uint8_t)'B')
#define SERFRAME_PC2MOTE_SETROOT   ((uint8_t)'R')
#define SERFRAME_PC2MOTE_TRIGGERICMPv6ECHO   ((uint8_t)'E')
#define SERFRAME_PC2MOTE_TRIGGERSERIALECHO   ((uint8_t)'S')
#define SERFRAME_PC2MOTE_TRIGGERTCPINJECT   ((uint8_t)'T')
#define SERFRAME_PC2MOTE_TRIGGERUDPINJECT   ((uint8_t)'U')
#define SERIAL_INPUT_BUFFER_SIZE   200

Number of bytes of the serial input buffer, in bytes.

Warning
Do not pick a number greater than 255, since its filling level is encoded by a single byte in the code.
#define SERIAL_OUTPUT_BUFFER_SIZE   256

Number of bytes of the serial output buffer, in bytes.

Warning
should be exactly 256 so wrap-around on the index does not require the use of a slow modulo operator.

Enumeration Type Documentation

anonymous enum

Modes of the openserial module.

Enumerator
MODE_OFF 

The module is off, no serial activity.

MODE_INPUT 

The serial is listening or receiving bytes.

MODE_OUTPUT 

The serial is transmitting bytes.

Function Documentation

bool debugPrint_outBufferIndexes ( void  )

Trigger this module to print status information, over serial.

debugPrint_* functions are used by the openserial module to continuously print status information about several modules in the OpenWSN stack.

Returns
TRUE if this function printed something, FALSE otherwise.
void isr_openserial_rx ( void  )
void isr_openserial_tx ( void  )
void openserial_echo ( uint8_t *  but,
uint8_t  bufLen 
)
uint8_t openserial_getInputBuffer ( uint8_t *  bufferToWrite,
uint8_t  maxNumBytes 
)
uint8_t openserial_getNumDataBytes ( void  )
void openserial_init ( void  )
owerror_t openserial_printCritical ( uint8_t  calling_component,
uint8_t  error_code,
errorparameter_t  arg1,
errorparameter_t  arg2 
)
owerror_t openserial_printData ( uint8_t *  buffer,
uint8_t  length 
)
owerror_t openserial_printError ( uint8_t  calling_component,
uint8_t  error_code,
errorparameter_t  arg1,
errorparameter_t  arg2 
)
owerror_t openserial_printInfo ( uint8_t  calling_component,
uint8_t  error_code,
errorparameter_t  arg1,
errorparameter_t  arg2 
)
owerror_t openserial_printStatus ( uint8_t  statusElement,
uint8_t *  buffer,
uint8_t  length 
)
void openserial_startInput ( void  )
void openserial_startOutput ( void  )
void openserial_stop ( void  )