diff --git a/sys/include/suit/transport/coap.h b/sys/include/suit/transport/coap.h index aaf9902072..2608b97420 100644 --- a/sys/include/suit/transport/coap.h +++ b/sys/include/suit/transport/coap.h @@ -26,6 +26,7 @@ #define SUIT_TRANSPORT_COAP_H #include "net/nanocoap.h" +#include "suit/transport/worker.h" #ifdef __cplusplus extern "C" { @@ -33,8 +34,14 @@ extern "C" { /** * @brief Start SUIT CoAP thread + * + * @deprecated This is an alias for @ref suit_worker_run and will be removed + * after after the 2023.01 release. */ -void suit_coap_run(void); +static inline void suit_coap_run(void) +{ + suit_worker_run(); +} /** * @brief SUIT CoAP endpoint entry. @@ -82,10 +89,16 @@ extern const coap_resource_subtree_t coap_resource_subtree_suit; /** * @brief Trigger a SUIT udate * + * @deprecated This is an alias for @ref suit_worker_trigger and will be removed + * after after the 2023.01 release. + * * @param[in] url url pointer containing the full coap url to the manifest * @param[in] len length of the url */ -void suit_coap_trigger(const uint8_t *url, size_t len); +static inline void suit_coap_trigger(const uint8_t *url, size_t len) +{ + suit_worker_trigger((const char *)url, len); +} #endif /* DOXYGEN */ diff --git a/sys/include/suit/transport/worker.h b/sys/include/suit/transport/worker.h new file mode 100644 index 0000000000..2a6ce1dee7 --- /dev/null +++ b/sys/include/suit/transport/worker.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2019 Kaspar Schleiser + * 2019 Inria + * 2019 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup sys_suit + * @defgroup sys_suit_transport_worker SUIT firmware worker thread + * @brief SUIT secure firmware updates worker thread + * + * @{ + * + * @brief SUIT CoAP helper API + * @author Kaspar Schleiser + * @author Francisco Molina + * @author Alexandre Abadie + * + */ + +#ifndef SUIT_TRANSPORT_WORKER_H +#define SUIT_TRANSPORT_WORKER_H + +#include "net/nanocoap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Start SUIT worker thread + */ +void suit_worker_run(void); + +/** + * @brief Trigger a SUIT udate + * + * @param[in] url url pointer containing the full coap url to the manifest + * @param[in] len length of the url + */ +void suit_worker_trigger(const char *url, size_t len); + +#ifdef __cplusplus +} +#endif + +#endif /* SUIT_TRANSPORT_WORKER_H */ +/** @} */ diff --git a/sys/suit/transport/worker.c b/sys/suit/transport/worker.c index aec50fd191..de30afe0f0 100644 --- a/sys/suit/transport/worker.c +++ b/sys/suit/transport/worker.c @@ -170,14 +170,14 @@ static void *_suit_worker_thread(void *arg) return NULL; } -void suit_coap_run(void) +void suit_worker_run(void) { thread_create(_stack, SUIT_WORKER_STACKSIZE, SUIT_COAP_WORKER_PRIO, THREAD_CREATE_STACKTEST, _suit_worker_thread, NULL, "suit worker"); } -void suit_coap_trigger(const uint8_t *url, size_t len) +void suit_worker_trigger(const char *url, size_t len) { memcpy(_url, url, len); _url[len] = '\0';