Change in osmo-ccid-firmware[master]: UART_debug now uses the async library with tx ring

Kévin Redon gerrit-no-reply at lists.osmocom.org
Tue Apr 16 23:29:22 UTC 2019


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/13678


Change subject: UART_debug now uses the async library with tx ring
......................................................................

UART_debug now uses the async library with tx ring

Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/stdio_start.c
4 files changed, 12 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/78/13678/1

diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index 7ac5662..327a1a0 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -76,7 +76,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)) {
 		gpio_toggle_pin_level(USER_LED); // toggle LED to show we received something
 		int c = getchar();
 		if (c < 0)
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/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);
 }

-- 
To view, visit https://gerrit.osmocom.org/13678
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cf689a8d3dc292201f1e2ce6c013aa1686ad6bc
Gerrit-Change-Number: 13678
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190416/68a7c19f/attachment.html>


More information about the gerrit-log mailing list