mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
g: tweak usart queuing for stream signing
Guarded by CONFIG_STREAM_SIGNING Comes at 10K cost in SRAM Used by nm50 Signed-off-by: mschilder@google.com BRANCH=cr50 BUG=none TEST=sign nm50 target dump_state 115200 output w/o overruns Change-Id: I4db2dec4de8afbeba68d1bc72f43a91fc134ff85 Reviewed-on: https://chromium-review.googlesource.com/823264 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
aceec6e4b8
commit
0059070b22
@@ -16,6 +16,19 @@
|
||||
defined(SECTION_IS_RO)))
|
||||
#define QUEUE_SIZE 64
|
||||
|
||||
#ifdef CONFIG_STREAM_SIGNATURE
|
||||
/*
|
||||
* When signing over streaming data, up the relevant queue sizes.
|
||||
*/
|
||||
#define QUEUE_SIZE_SIG_IN 1024
|
||||
#define QUEUE_SIZE_USB_IN 8192
|
||||
#define QUEUE_SIZE_UART_IN 1024
|
||||
#else
|
||||
#define QUEUE_SIZE_SIG_IN QUEUE_SIZE
|
||||
#define QUEUE_SIZE_USB_IN QUEUE_SIZE
|
||||
#define QUEUE_SIZE_UART_IN QUEUE_SIZE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_STREAM_USART1
|
||||
struct usb_stream_config const ap_usb;
|
||||
@@ -34,9 +47,11 @@ struct usart_config const ap_uart;
|
||||
*/
|
||||
struct signer_config const sig;
|
||||
static struct queue const ap_uart_output =
|
||||
QUEUE_DIRECT(QUEUE_SIZE, uint8_t, ap_uart.producer, sig.consumer);
|
||||
QUEUE_DIRECT(QUEUE_SIZE_SIG_IN, uint8_t, ap_uart.producer,
|
||||
sig.consumer);
|
||||
static struct queue const sig_to_usb =
|
||||
QUEUE_DIRECT(QUEUE_SIZE, uint8_t, sig.producer, ap_usb.consumer);
|
||||
QUEUE_DIRECT(QUEUE_SIZE_USB_IN, uint8_t, sig.producer,
|
||||
ap_usb.consumer);
|
||||
|
||||
SIGNER_CONFIG(sig, stream_uart, sig_to_usb, ap_uart_output);
|
||||
|
||||
@@ -46,7 +61,8 @@ static struct queue const ap_uart_output =
|
||||
#endif
|
||||
|
||||
static struct queue const ap_usb_to_uart =
|
||||
QUEUE_DIRECT(QUEUE_SIZE, uint8_t, ap_usb.producer, ap_uart.consumer);
|
||||
QUEUE_DIRECT(QUEUE_SIZE_UART_IN, uint8_t, ap_usb.producer,
|
||||
ap_uart.consumer);
|
||||
|
||||
/*
|
||||
* AP UART data is sent to the ap_uart_output queue, and received from
|
||||
|
||||
@@ -7,10 +7,22 @@
|
||||
#include "producer.h"
|
||||
#include "registers.h"
|
||||
#include "task.h"
|
||||
#include "board.h"
|
||||
|
||||
#ifndef __CROS_FORWARD_UART_H
|
||||
#define __CROS_FORWARD_UART_H
|
||||
|
||||
#ifdef CONFIG_STREAM_SIGNATURE
|
||||
/*
|
||||
* When configured for signing over streaming data, call the consumer handler
|
||||
* directly to help avoid incoming uart overruns.
|
||||
* Note this will run under interrupt handler so consumer beware.
|
||||
*/
|
||||
#define CONFIGURE_INTERRUPTS__rx_int(NAME) send_data_to_usb(&NAME)
|
||||
#else
|
||||
#define CONFIGURE_INTERRUPTS__rx_int(NAME) hook_call_deferred(NAME.deferred, 0)
|
||||
#endif
|
||||
|
||||
struct usart_config {
|
||||
int uart;
|
||||
|
||||
@@ -43,7 +55,7 @@ extern struct producer_ops const uart_producer_ops;
|
||||
GR_UART_ISTATECLR(NAME.uart) = \
|
||||
GC_UART_ISTATECLR_RX_MASK; \
|
||||
/* Read input FIFO until empty */ \
|
||||
hook_call_deferred(NAME.deferred, 0); \
|
||||
CONFIGURE_INTERRUPTS__rx_int(NAME); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user