Revision 8a183f9a core/src/aos_debug.c

View differences:

core/src/aos_debug.c
51 51
 * @brief   Actively waits for the serial driver to be empty.
52 52
 */
53 53
static inline void _serialWaitForEmpty(SerialDriver* sdp) {
54
  while (sdPutWouldBlock(sdp)) {
54
  while (!((sdp->usart->SR) & USART_SR_TC)) {
55 55
    continue;
56 56
  }
57 57
  return;
......
68 68
{
69 69
  unsigned int i = 0;
70 70
  while (str[i] != '\0') {
71
    sdPut(sdp, str[i]);
72 71
    _serialWaitForEmpty(sdp);
72
    sdp->usart->DR = str[i];
73 73
    ++i;
74 74
  }
75 75
  return i;
......
84 84
static void _printError(SerialDriver* sdp, const char* reason)
85 85
{
86 86
  if (sdp->state != SD_STOP && sdp->state != SD_READY) {
87
    sd_lld_start(sdp, NULL);
88
    sdp->state = SD_READY;
89
  }
90
  if (sdp->state == SD_READY) {
87
    return;
88
  } else if (sdp->state == SD_READY) {
91 89
    _printString(sdp, "\nSystem halt! error code / function name: ");
92 90
    _printString(sdp, reason);
93 91
    _printString(sdp, "\n");

Also available in: Unified diff