[Cryptech-Commits] [sw/stm32] 01/05: Multiple threads and multiple cores, to deal with multiple clients.

git at cryptech.is git at cryptech.is
Tue Aug 23 16:37:05 UTC 2016


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit 77f36214ca4ca3bd7e763d43ca4592624a980e57
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Thu Aug 11 16:13:09 2016 -0400

    Multiple threads and multiple cores, to deal with multiple clients.
---
 projects/hsm/Makefile |  4 +---
 projects/hsm/hsm.c    | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/projects/hsm/Makefile b/projects/hsm/Makefile
index 0ab4bff..87679ca 100644
--- a/projects/hsm/Makefile
+++ b/projects/hsm/Makefile
@@ -26,9 +26,7 @@ BOARD_OBJS = \
 	$(BOARD_DIR)/stm32f4xx_hal_msp.o \
 	$(BOARD_DIR)/stm32f4xx_it_rtos.o
 
-ifndef CRYPTECH_ROOT
-  CRYPTECH_ROOT := $(abspath ../../../..)
-endif
+CFLAGS += -DNUM_RPC_TASK=6
 
 CFLAGS += -I$(LIBHAL_SRC)
 CFLAGS += -I$(LIBCLI_SRC)
diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c
index adce889..d6f778a 100644
--- a/projects/hsm/hsm.c
+++ b/projects/hsm/hsm.c
@@ -228,6 +228,20 @@ static uint8_t *sdram_malloc(size_t size)
     return p;
 }
 
+#if NUM_RPC_TASK > 1
+/* Critical section start/end, currently used just for hal_core_alloc/_free.
+ */
+void hal_critical_section_start(void)
+{
+    __disable_irq();
+}
+
+void hal_critical_section_end(void)
+{
+    __enable_irq();
+}
+#endif
+
 /* The main thread. This does all the setup, and the worker threads handle
  * the rest.
  */
@@ -243,7 +257,7 @@ int main()
 
 #if NUM_RPC_TASK > 1
     if ((uart_mutex = osMutexCreate(osMutex(uart_mutex))) == NULL ||
-        (dispatch_mutex = osMutexCreate(osMutex(dispatch_mutex)) == NULL)
+        (dispatch_mutex = osMutexCreate(osMutex(dispatch_mutex))) == NULL)
 	Error_Handler();
 #endif
     if ((rpc_sem = osSemaphoreCreate(osSemaphore(rpc_sem), 0)) == NULL)



More information about the Commits mailing list