*** stock_iot-lab_M3/openwsn/openserial.h Thu Apr 24 11:01:37 2014 --- riot-openwsn-wip/openwsn/openserial.h Thu Apr 24 16:55:54 2014 *************** *** 10,16 **** #include "openwsn.h" /** ! \addtogroup cross-layers \{ \addtogroup OpenSerial \{ --- 10,16 ---- #include "openwsn.h" /** ! \addtogroup drivers \{ \addtogroup OpenSerial \{ *************** *** 60,90 **** //=========================== typedef ========================================= //=========================== prototypes ====================================== ! void openserial_init(); ! error_t openserial_printStatus(uint8_t statusElement, uint8_t* buffer, uint16_t length); ! error_t openserial_printInfo(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2); ! error_t openserial_printError(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2); ! error_t openserial_printCritical(uint8_t calling_component, uint8_t error_code, errorparameter_t arg1, errorparameter_t arg2); ! error_t openserial_printData(uint8_t* buffer, uint8_t length); ! uint8_t openserial_getNumDataBytes(); uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes); ! void openserial_startInput(); ! void openserial_startOutput(); ! void openserial_stop(); ! bool debugPrint_outBufferIndexes(); void openserial_echo(uint8_t* but, uint8_t bufLen); // interrupt handlers ! void isr_openserial_rx(); ! void isr_openserial_tx(); /** \} --- 60,113 ---- //=========================== typedef ========================================= + //=========================== module variables ================================ + + typedef struct { + // admin + uint8_t mode; + uint8_t debugPrintCounter; + // input + uint8_t reqFrame[1+1+2+1]; // flag (1B), command (2B), CRC (2B), flag (1B) + uint8_t reqFrameIdx; + uint8_t lastRxByte; + bool busyReceiving; + bool inputEscaping; + uint16_t inputCrc; + uint8_t inputBufFill; + uint8_t inputBuf[SERIAL_INPUT_BUFFER_SIZE]; + // output + bool outputBufFilled; + uint16_t outputCrc; + uint8_t outputBufIdxW; + uint8_t outputBufIdxR; + uint8_t outputBuf[SERIAL_OUTPUT_BUFFER_SIZE]; + } openserial_vars_t; + //=========================== prototypes ====================================== ! 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); void openserial_echo(uint8_t* but, uint8_t bufLen); // interrupt handlers ! void isr_openserial_rx(void); ! void isr_openserial_tx(void); /** \}