portability: cmsis: Move cmsis wrapper types to public header
This enables the cmsis wrapper types to be declared statically and then passed along to CMSIS-RTOSv2 APIs, enabling static allocation of RTOS control blocks in the subsequent commits. Signed-off-by: Utsav Munendra <utsavm@meta.com>
This commit is contained in:
parent
6d490e9cf0
commit
13ef44200e
11 changed files with 77 additions and 58 deletions
66
include/zephyr/portability/cmsis_types.h
Normal file
66
include/zephyr/portability/cmsis_types.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_CMSIS_TYPES_H_
|
||||
#define ZEPHYR_INCLUDE_CMSIS_TYPES_H_
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_os2.h>
|
||||
|
||||
struct cv2_thread {
|
||||
sys_dnode_t node;
|
||||
struct k_thread z_thread;
|
||||
struct k_poll_signal poll_signal;
|
||||
struct k_poll_event poll_event;
|
||||
uint32_t signal_results;
|
||||
char name[16];
|
||||
uint32_t attr_bits;
|
||||
struct k_sem join_guard;
|
||||
char has_joined;
|
||||
};
|
||||
|
||||
struct cv2_timer {
|
||||
struct k_timer z_timer;
|
||||
osTimerType_t type;
|
||||
uint32_t status;
|
||||
char name[16];
|
||||
void (*callback_function)(void *argument);
|
||||
void *arg;
|
||||
};
|
||||
|
||||
struct cv2_mutex {
|
||||
struct k_mutex z_mutex;
|
||||
char name[16];
|
||||
uint32_t state;
|
||||
};
|
||||
|
||||
struct cv2_sem {
|
||||
struct k_sem z_semaphore;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_mslab {
|
||||
struct k_mem_slab z_mslab;
|
||||
void *pool;
|
||||
char is_dynamic_allocation;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_msgq {
|
||||
struct k_msgq z_msgq;
|
||||
void *pool;
|
||||
char is_dynamic_allocation;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_event_flags {
|
||||
struct k_poll_signal poll_signal;
|
||||
struct k_poll_event poll_event;
|
||||
uint32_t signal_results;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
K_MEM_SLAB_DEFINE(cv2_event_flags_slab, sizeof(struct cv2_event_flags),
|
||||
CONFIG_CMSIS_V2_EVT_FLAGS_MAX_COUNT, 4);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <cmsis_os2.h>
|
||||
#include <zephyr/portability/cmsis_os2.h>
|
||||
|
||||
extern uint32_t sys_clock_tick_get_32(void);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
K_MEM_SLAB_DEFINE(cv2_semaphore_slab, sizeof(struct cv2_sem), CONFIG_CMSIS_V2_SEMAPHORE_MAX_COUNT,
|
||||
4);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <string.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
#include <zephyr/debug/stack.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
static const osThreadAttr_t init_thread_attrs = {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel_structs.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
#define DONT_CARE (0)
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <string.h>
|
||||
#include "wrapper.h"
|
||||
|
||||
#define ACTIVE 1
|
||||
#define NOT_ACTIVE 0
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
#define __WRAPPER_H__
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <cmsis_os2.h>
|
||||
#include <zephyr/portability/cmsis_types.h>
|
||||
#include <zephyr/portability/cmsis_os2.h>
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
|
@ -17,59 +18,6 @@
|
|||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
struct cv2_thread {
|
||||
sys_dnode_t node;
|
||||
struct k_thread z_thread;
|
||||
struct k_poll_signal poll_signal;
|
||||
struct k_poll_event poll_event;
|
||||
uint32_t signal_results;
|
||||
char name[16];
|
||||
uint32_t attr_bits;
|
||||
struct k_sem join_guard;
|
||||
char has_joined;
|
||||
};
|
||||
|
||||
struct cv2_timer {
|
||||
struct k_timer z_timer;
|
||||
osTimerType_t type;
|
||||
uint32_t status;
|
||||
char name[16];
|
||||
void (*callback_function)(void *argument);
|
||||
void *arg;
|
||||
};
|
||||
|
||||
struct cv2_mutex {
|
||||
struct k_mutex z_mutex;
|
||||
char name[16];
|
||||
uint32_t state;
|
||||
};
|
||||
|
||||
struct cv2_sem {
|
||||
struct k_sem z_semaphore;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_mslab {
|
||||
struct k_mem_slab z_mslab;
|
||||
void *pool;
|
||||
char is_dynamic_allocation;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_msgq {
|
||||
struct k_msgq z_msgq;
|
||||
void *pool;
|
||||
char is_dynamic_allocation;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct cv2_event_flags {
|
||||
struct k_poll_signal poll_signal;
|
||||
struct k_poll_event poll_event;
|
||||
uint32_t signal_results;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
extern osThreadId_t get_cmsis_thread_id(k_tid_t tid);
|
||||
extern void *is_cmsis_rtos_v2_thread(void *thread_id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue