Skip to content

Commit 741db4f

Browse files
committed
Make uVisor API Documentation Great Again
1 parent c780311 commit 741db4f

29 files changed

+352
-85
lines changed

api/inc/benchmark.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@
2020
#include "api/inc/uvisor_exports.h"
2121
#include <stdint.h>
2222

23+
/** @cond UVISOR_INTERNAL */
24+
/** @defgroup benchmark Benchmark
25+
* @{
26+
*/
27+
2328
UVISOR_EXTERN void uvisor_benchmark_configure(void);
2429
UVISOR_EXTERN void uvisor_benchmark_start(void);
2530
UVISOR_EXTERN uint32_t uvisor_benchmark_stop(void);
2631

32+
/** @} */
33+
/** @endcond */
34+
2735
#endif /* __UVISOR_API_BENCHMARK_H__ */

api/inc/box_config.h

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424

2525
UVISOR_EXTERN const uint32_t __uvisor_mode;
2626

27+
/** @defgroup box_config Box configuration
28+
*
29+
* @brief Creating and configuring secure boxes
30+
* @{
31+
*/
32+
2733
#define UVISOR_DISABLED 0
2834
#define UVISOR_PERMISSIVE 1
2935
#define UVISOR_ENABLED 2
@@ -54,14 +60,15 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
5460
\
5561
extern const __attribute__((section(".keep.uvisor.cfgtbl_ptr_first"), aligned(4))) void * const main_cfg_ptr = &main_cfg;
5662

57-
/* Creates a global page heap with at least `minimum_number_of_pages` each of size `page_size` in bytes.
63+
/** Creates a global page heap with at least `minimum_number_of_pages` each of size `page_size` in bytes.
5864
* The total page heap size is at least `minimum_number_of_pages * page_size`. */
5965
#define UVISOR_SET_PAGE_HEAP(page_size, minimum_number_of_pages) \
6066
const uint32_t __uvisor_page_size = (page_size); \
6167
uint8_t __attribute__((section(".keep.uvisor.page_heap"))) \
6268
main_page_heap_reserved[ (page_size) * (minimum_number_of_pages) ]
6369

6470

71+
/** @cond UVISOR_INTERNAL */
6572
/* this macro selects an overloaded macro (variable number of arguments) */
6673
#define __UVISOR_BOX_MACRO(_1, _2, _3, _4, NAME, ...) NAME
6774

@@ -121,13 +128,15 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
121128
#define UVISOR_BOX_CONFIG(...) \
122129
UVISOR_BOX_CONFIG_ACL(__VA_ARGS__)
123130

124-
/* Use this macro before box defintion (for example, UVISOR_BOX_CONFIG) to
131+
/** @endcond */
132+
133+
/** Use this macro before box defintion (for example, `UVISOR_BOX_CONFIG`) to
125134
* define the name of your box. If you don't want a name, use this macro with
126-
* box_namespace as NULL. */
135+
* box_namespace as `NULL`. */
127136
#define UVISOR_BOX_NAMESPACE(box_namespace) \
128137
static const char *const __uvisor_box_namespace = box_namespace
129138

130-
/* Use this macro before UVISOR_BOX_CONFIG to define the function the main
139+
/** Use this macro before `UVISOR_BOX_CONFIG` to define the function the main
131140
* thread of your box will use for its body. If you don't want a main thread,
132141
* too bad: you have to have one. */
133142
#define UVISOR_BOX_MAIN(function, priority, stack_size) \
@@ -139,20 +148,30 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
139148

140149
#define uvisor_ctx (*__uvisor_ps)
141150

142-
/* Return the numeric box ID of the current box. */
151+
/** @} */
152+
153+
/** @defgroup box_info Box Information
154+
*
155+
* @brief Accessing information about own box and other boxes
156+
* @{
157+
*/
158+
159+
/** @brief Return the numeric box ID of the current box. */
143160
UVISOR_EXTERN int uvisor_box_id_self(void);
144161

145-
/* Return the numeric box ID of the box that is calling through the most recent
146-
* secure gateway. Return -1 if there is no secure gateway calling box. */
162+
/** @brief Return the numeric box ID of the box that is calling through the most recent
163+
* secure gateway. @return -1 if there is no secure gateway calling box. */
147164
UVISOR_EXTERN int uvisor_box_id_caller(void);
148165

149-
/* Copy the box namespace of the specified box ID to the memory provided by
166+
/** Copy the box namespace of the specified box ID to the memory provided by
150167
* box_namespace. The box_namespace's length must be at least
151-
* MAX_BOX_NAMESPACE_LENGTH bytes. Return how many bytes were copied into
152-
* box_namespace. Return UVISOR_ERROR_INVALID_BOX_ID if the provided box ID is
153-
* invalid. Return UVISOR_ERROR_BUFFER_TOO_SMALL if the provided box_namespace
154-
* is too small to hold MAX_BOX_NAMESPACE_LENGTH bytes. Return
155-
* UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS if the box is anonymous. */
168+
* `UVISOR_MAX_BOX_NAMESPACE_LENGTH` bytes. Return how many bytes were copied into
169+
* box_namespace. Return `UVISOR_ERROR_INVALID_BOX_ID` if the provided box ID is
170+
* invalid. Return `UVISOR_ERROR_BUFFER_TOO_SMALL` if the provided box_namespace
171+
* is too small to hold `MAX_BOX_NAMESPACE_LENGTH` bytes. Return
172+
* `UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS` if the box is anonymous. */
156173
UVISOR_EXTERN int uvisor_box_namespace(int box_id, char *box_namespace, size_t length);
157174

175+
/** @} */
176+
158177
#endif /* __UVISOR_API_BOX_CONFIG_H__ */

api/inc/cmsis_nvic_virtual.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@
1919

2020
#include "api/inc/interrupts.h"
2121

22-
#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
23-
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
24-
#define NVIC_EnableIRQ vIRQ_EnableIRQ
25-
#define NVIC_DisableIRQ vIRQ_DisableIRQ
26-
#define NVIC_GetPendingIRQ vIRQ_GetPendingIRQ
27-
#define NVIC_SetPendingIRQ vIRQ_SetPendingIRQ
28-
#define NVIC_ClearPendingIRQ vIRQ_ClearPendingIRQ
29-
#define NVIC_GetActive __NVIC_GetActive
30-
#define NVIC_SetPriority vIRQ_SetPriority
31-
#define NVIC_GetPriority vIRQ_GetPriority
22+
/** @addtogroup interrupt
23+
* @{
24+
*/
25+
26+
#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping /**< @showinitializer */
27+
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping /**< @showinitializer */
28+
#define NVIC_EnableIRQ vIRQ_EnableIRQ /**< @showinitializer */
29+
#define NVIC_DisableIRQ vIRQ_DisableIRQ /**< @showinitializer */
30+
#define NVIC_GetPendingIRQ vIRQ_GetPendingIRQ /**< @showinitializer */
31+
#define NVIC_SetPendingIRQ vIRQ_SetPendingIRQ /**< @showinitializer */
32+
#define NVIC_ClearPendingIRQ vIRQ_ClearPendingIRQ /**< @showinitializer */
33+
#define NVIC_GetActive __NVIC_GetActive /**< @showinitializer */
34+
#define NVIC_SetPriority vIRQ_SetPriority /**< @showinitializer */
35+
#define NVIC_GetPriority vIRQ_GetPriority /**< @showinitializer */
36+
37+
/** @} */
3238

3339
#endif /* __UVISOR_API_NVIC_VIRTUAL_H__ */

api/inc/cmsis_vectab_virtual.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919

2020
#include "api/inc/interrupts.h"
2121

22-
#define NVIC_SetVector vIRQ_SetVector
23-
#define NVIC_GetVector vIRQ_GetVector
22+
/** @addtogroup interrupt
23+
* @{
24+
*/
25+
26+
#define NVIC_SetVector vIRQ_SetVector /**< @showinitializer */
27+
#define NVIC_GetVector vIRQ_GetVector /**< @showinitializer */
28+
29+
/** @} */
2430

2531
#endif /* __UVISOR_API_VECTAB_VIRTUAL_H__ */

api/inc/context_exports.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
#ifndef __UVISOR_CONTEX_EXPORTS_H__
1818
#define __UVISOR_CONTEX_EXPORTS_H__
1919

20+
/** @cond UVISOR_INTERNAL */
21+
2022
/** Maximum number of nested context switches.
2123
*
2224
* The same state stack is kept for all kinds of context switches that are bound
2325
* to a function, for which uVisor keeps an internal state. */
2426
#define UVISOR_CONTEXT_MAX_DEPTH 16
2527

28+
/** @endcond */
29+
2630
#endif /* __UVISOR_CONTEX_EXPORTS_H__ */

api/inc/debug.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
#include "api/inc/debug_exports.h"
2121
#include "api/inc/uvisor_exports.h"
2222

23+
/** @defgroup debug Debug Box
24+
* @{
25+
*/
26+
2327
UVISOR_EXTERN void uvisor_debug_init(const TUvisorDebugDriver * const driver);
2428

29+
/** @} */
30+
2531
#endif /* __UVISOR_API_DEBUG_H__ */

api/inc/debug_exports.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@
1919

2020
#include <stdint.h>
2121

22-
/* Debug box driver -- Version 0
22+
/** @addtogroup debug
23+
* @{
24+
*/
25+
26+
/** @brief Debug box driver -- Version 0
2327
* A constant instance of this struct must be instantiated by the unprivileged
2428
* code to setup a debug box.*/
2529
typedef struct TUvisorDebugDriver {
2630
uint32_t (*get_version)(void);
2731
void (*halt_error)(int);
2832
} TUvisorDebugDriver;
2933

30-
/* Number of handlers in the debug box driver */
34+
/** @brief Number of handlers in the debug box driver */
3135
#define DEBUG_BOX_HANDLERS_NUMBER (sizeof(TUvisorDebugDriver) / sizeof(void *))
3236

37+
/** @} */
38+
3339
#endif /* __UVISOR_API_DEBUG_EXPORTS_H__ */

api/inc/disabled.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "api/inc/uvisor_exports.h"
2121
#include <stdint.h>
2222

23+
/** @cond UVISOR_INTERNAL */
24+
2325
UVISOR_EXTERN void uvisor_disabled_switch_in(const uint32_t *dst_box_cfgtbl_ptr);
2426
UVISOR_EXTERN void uvisor_disabled_switch_out(void);
2527

@@ -28,4 +30,6 @@ UVISOR_EXTERN void uvisor_disabled_switch_out(void);
2830
UVISOR_EXTERN void uvisor_disabled_set_vector(uint32_t irqn, uint32_t vector);
2931
UVISOR_EXTERN uint32_t uvisor_disabled_get_vector(uint32_t irqn);
3032

33+
/** @endcond */
34+
3135
#endif /* __UVISOR_API_DISABLED_H__ */

api/inc/error.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
#include "api/inc/halt_exports.h"
2121
#include "api/inc/uvisor_exports.h"
2222

23+
/** @defgroup error Error
24+
* @{
25+
*/
26+
2327
UVISOR_EXTERN void uvisor_error(THaltUserError reason);
2428

29+
/** @} */
30+
2531
#endif /* __UVISOR_API_ERROR_H__ */

api/inc/export_table_exports.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include "rt_OsEventObserver.h"
2121
#include <stdint.h>
2222

23+
/** @cond UVISOR_INTERNAL */
24+
/** @addtogroup box_config
25+
* @{
26+
*/
27+
2328
/* If this magic doesn't match what you get in a TUvisorExportTable, then you
2429
* didn't find a TUvisorExportTable and all bets are off as to what will be
2530
* contained in what you found. */
@@ -44,4 +49,7 @@ typedef struct {
4449
uint32_t size;
4550
} TUvisorExportTable;
4651

52+
/** @} */
53+
/** @endcond */
54+
4755
#endif

0 commit comments

Comments
 (0)