/******************************************************************************* * TzCtrl * * Task for receiving commands from embOS-Trace and for recorder diagnostics. * * Stack size and priority is configured in trcKernelPort.h, using: * - TZCTRL_TASK_STACK_SIZE (default 512) * - TZCTRL_TASK_PRIORITY (default 10) ******************************************************************************/ static portTASK_FUNCTION( TzCtrl, pvParameters ) { TracealyzerCommandType msg; int bytes = 0; while (1) { bytes = SEGGER_RTT_Read(TRC_RTT_DOWN_BUFFER_INDEX, (char*)&msg, sizeof(TracealyzerCommandType)); if (bytes != 0) { if (bytes == sizeof(TracealyzerCommandType)) { if (isValidCommand(&msg)) { processCommand(&msg); /* Start or Stop currently... */ } } } else { CheckRecorderStatus(); vTaskDelay((100 * configTICK_RATE_HZ) / 1000); /* 100ms */ } } }
/********************************************************************* * * SEGGER_RTT_GetKey * * Function description * Reads one character from the SEGGER RTT buffer. * Host has previously stored data there. * * Return values * < 0 No character available (buffer empty). * >= 0 Character which has been read. (Possible values: 0 - 255) * * Notes * (1) This function is only specified for accesses to RTT buffer 0. */ int32_t SEGGER_RTT_GetKey(void) { char c; int32_t r; r = SEGGER_RTT_Read(0, &c, 1); if (r == 1) { return (int32_t)c; } return -1; }
/********************************************************************* * * SEGGER_RTT_GetKey * * Function description * Reads one character from the SEGGER RTT buffer. * Host has previously stored data there. * * Return values * < 0 No character available (buffer empty). * >= 0 Character which has been read. (Possible values: 0 - 255) * * Notes * (1) This function is only specified for accesses to RTT buffer 0. */ int SEGGER_RTT_GetKey(void) { char c; int r; r = SEGGER_RTT_Read(0, &c, 1); if (r == 1) { return (int)(unsigned char)c; } return -1; }
/********************************************************************* * * SEGGER_RTT_GetKey * * Function description * Reads one character from the SEGGER RTT buffer. * Host has previously stored data there. * * Return value * < 0 - No character available (buffer empty). * >= 0 - Character which has been read. (Possible values: 0 - 255) * * Notes * (1) This function is only specified for accesses to RTT buffer 0. */ int SEGGER_RTT_GetKey(void) { char c; int r; r = (int)SEGGER_RTT_Read(0u, &c, 1u); if (r == 1) { r = (int)(unsigned char)c; } else { r = -1; } return r; }
// currently only single receive character is implemented uint8_t segger_receive_byte(void){ uint8_t byte = 0; SEGGER_RTT_Read(0, &byte, 1); return byte; }