UART_debug now uses the async library with tx ring
Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index 6fa25cf..454cd2f 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -81,7 +81,7 @@
unsigned int i = 0;
/* yield CPU after maximum of 10 received characters */
- while (usart_async_is_rx_not_empty(&UART_debug) && (i < 10)) {
+ while (usart_async_rings_is_rx_not_empty(&UART_debug) && (i < 10)) {
int c = getchar();
if (c < 0)
return;
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 8a50925..0b6b190 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -33,7 +33,7 @@
#define SIM6_BUFFER_SIZE 16
/*! The buffer size for USART */
-#define UART_DEBUG_BUFFER_SIZE 32
+#define UART_DEBUG_BUFFER_SIZE 256
struct usart_async_descriptor SIM0;
struct usart_async_descriptor SIM1;
@@ -51,9 +51,10 @@
static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE];
static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE];
-struct usart_async_descriptor UART_debug;
+struct usart_async_rings_descriptor UART_debug;
-static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE];
+static uint8_t UART_DEBUG_buffer_rx[UART_DEBUG_BUFFER_SIZE];
+static uint8_t UART_DEBUG_buffer_tx[UART_DEBUG_BUFFER_SIZE];
/**
* \brief USART Clock initialization function
@@ -349,7 +350,7 @@
void UART_debug_init(void)
{
UART_debug_CLOCK_init();
- usart_async_init(&UART_debug, SERCOM7, UART_DEBUG_buffer, UART_DEBUG_BUFFER_SIZE, (void *)NULL);
+ usart_async_rings_init(&UART_debug, SERCOM7, UART_DEBUG_buffer_rx, UART_DEBUG_BUFFER_SIZE, UART_DEBUG_buffer_tx, UART_DEBUG_BUFFER_SIZE, (void *)NULL);
UART_debug_PORT_init();
}
diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h
index 9d009b9..6c4f3a1 100644
--- a/sysmoOCTSIM/driver_init.h
+++ b/sysmoOCTSIM/driver_init.h
@@ -21,15 +21,9 @@
#include <hal_io.h>
#include <hal_sleep.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-#include <hal_usart_async.h>
-
#include <hal_usart_sync.h>
+#include <hal_usart_async.h>
+#include <hal_usart_async_rings.h>
#include "hal_usb_device.h"
@@ -40,7 +34,7 @@
extern struct usart_async_descriptor SIM4;
extern struct usart_async_descriptor SIM5;
extern struct usart_async_descriptor SIM6;
-extern struct usart_async_descriptor UART_debug;
+extern struct usart_async_rings_descriptor UART_debug;
void SIM0_PORT_init(void);
void SIM0_CLOCK_init(void);
diff --git a/sysmoOCTSIM/manual_test.c b/sysmoOCTSIM/manual_test.c
index 526414a..d6852bc 100644
--- a/sysmoOCTSIM/manual_test.c
+++ b/sysmoOCTSIM/manual_test.c
@@ -203,7 +203,7 @@
int c;
do {
- } while (!usart_async_is_rx_not_empty(&UART_debug));
+ } while (!usart_async_rings_is_rx_not_empty(&UART_debug));
c = getchar();
if (c < 0)
diff --git a/sysmoOCTSIM/stdio_start.c b/sysmoOCTSIM/stdio_start.c
index e2fb0c2..8a15c88 100644
--- a/sysmoOCTSIM/stdio_start.c
+++ b/sysmoOCTSIM/stdio_start.c
@@ -9,13 +9,13 @@
#include "atmel_start.h"
#include "stdio_start.h"
-static void UART_debug_rx_cb(const struct usart_async_descriptor *const io_descr)
+static void UART_debug_rx_cb(const struct usart_async_rings_descriptor *const io_descr)
{
}
void stdio_redirect_init(void)
{
- usart_async_register_callback(&UART_debug, USART_ASYNC_RXC_CB, UART_debug_rx_cb); // if no callback function is registered receive won't work, even if the callback does nothing
- usart_async_enable(&UART_debug);
+ usart_async_rings_register_callback(&UART_debug, USART_ASYNC_RXC_CB, UART_debug_rx_cb); // if no callback function is registered receive won't work, even if the callback does nothing
+ usart_async_rings_enable(&UART_debug);
stdio_io_init(&UART_debug.io);
}