[sca] Replace odd out-param with return-by-value
Signed-off-by: Miguel Young de la Sota <mcyoung@google.com>
diff --git a/sw/device/sca/aes_serial.c b/sw/device/sca/aes_serial.c
index e8f5985..9b1714a 100644
--- a/sw/device/sca/aes_serial.c
+++ b/sw/device/sca/aes_serial.c
@@ -194,15 +194,12 @@
* UART.
*/
int main(void) {
- const dif_uart_t *uart1;
-
sca_init(kScaTriggerSourceAes, kScaPeripheralAes);
- sca_get_uart(&uart1);
LOG_INFO("Running AES serial");
LOG_INFO("Initializing simple serial interface to capture board.");
- simple_serial_init(uart1);
+ simple_serial_init(sca_get_uart());
simple_serial_register_handler('k', aes_serial_set_key);
simple_serial_register_handler('p', aes_serial_single_encrypt);
simple_serial_register_handler('b', aes_serial_batch_encrypt);
diff --git a/sw/device/sca/lib/sca.c b/sw/device/sca/lib/sca.c
index ee23a9c..55e8d47 100644
--- a/sw/device/sca/lib/sca.c
+++ b/sw/device/sca/lib/sca.c
@@ -232,11 +232,11 @@
sca_disable_peripherals(~enable);
}
-void sca_get_uart(const dif_uart_t **uart_out) {
+const dif_uart_t *sca_get_uart(void) {
#if !OT_IS_ENGLISH_BREAKFAST
- *uart_out = &uart1;
+ return &uart1;
#else
- *uart_out = &uart0;
+ return &uart0;
#endif
}
diff --git a/sw/device/sca/lib/sca.h b/sw/device/sca/lib/sca.h
index 9296324..d66f2fb 100644
--- a/sw/device/sca/lib/sca.h
+++ b/sw/device/sca/lib/sca.h
@@ -112,9 +112,9 @@
/**
* Returns a handle to the intialized UART device.
*
- * @param[out] uart_out Handle to the initialized UART device.
+ * @return Handle to the initialized UART device.
*/
-void sca_get_uart(const dif_uart_t **uart_out);
+const dif_uart_t *sca_get_uart(void);
/**
* Sets capture trigger high.
diff --git a/sw/device/sca/sha3_serial.c b/sw/device/sca/sha3_serial.c
index c556377..b349b52 100644
--- a/sw/device/sca/sha3_serial.c
+++ b/sw/device/sca/sha3_serial.c
@@ -476,15 +476,12 @@
* UART.
*/
int main(void) {
- const dif_uart_t *uart1;
-
sca_init(kScaTriggerSourceKmac, kScaPeripheralKmac);
LOG_INFO("Running sha3_serial");
LOG_INFO("Initializing simple serial interface to capture board.");
- sca_get_uart(&uart1);
- simple_serial_init(uart1);
+ simple_serial_init(sca_get_uart());
simple_serial_register_handler('k', sha3_serial_set_key);
simple_serial_register_handler('p', sha3_serial_single_absorb);