mirror of
https://github.com/OpenAMP/libmetal.git
synced 2026-09-28 15:53:47 +08:00
lib: system: create a new libmetal API metal_yield
Define metal_yield in sys.h files is more flexible to manage this in libmetal, metal_yield would be managed at the OS level and dispatched to metal_cpu_yield, metal_sleep_usec, or others. Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
e2c504f219
commit
142c40321e
@@ -18,6 +18,7 @@
|
||||
#define __METAL_FREERTOS_SYS__H__
|
||||
|
||||
#include <metal/errno.h>
|
||||
#include <metal/cpu.h>
|
||||
|
||||
#ifdef XLNX_PLATFORM
|
||||
#include <metal/system/freertos/xlnx/sys.h>
|
||||
@@ -33,6 +34,8 @@ extern "C" {
|
||||
#define METAL_MAX_DEVICE_REGIONS 1
|
||||
#endif
|
||||
|
||||
#define metal_yield() metal_cpu_yield()
|
||||
|
||||
/** Structure for FreeRTOS libmetal runtime state. */
|
||||
struct metal_state {
|
||||
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
#ifndef __METAL_FREERTOS_TEMPLATE_SYS__H__
|
||||
#define __METAL_FREERTOS_TEMPLATE_SYS__H__
|
||||
|
||||
#include <metal/cpu.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define metal_yield() metal_cpu_yield()
|
||||
|
||||
#ifdef METAL_INTERNAL
|
||||
|
||||
void sys_irq_enable(unsigned int vector);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#ifndef __METAL_FREERTOS_XLNX_SYS__H__
|
||||
#define __METAL_FREERTOS_XLNX_SYS__H__
|
||||
|
||||
#include <metal/cpu.h>
|
||||
|
||||
#include "xscugic.h"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
@@ -24,6 +26,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define metal_yield() metal_cpu_yield()
|
||||
|
||||
#if defined(SDT) && defined(PLATFORM_ZYNQ)
|
||||
#define XPAR_SCUGIC_0_DIST_BASEADDR XPAR_SCUGIC_DIST_BASEADDR
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <metal/cpu.h>
|
||||
#include <metal/errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
@@ -46,6 +47,8 @@ extern "C" {
|
||||
#define METAL_INVALID_VADDR NULL
|
||||
#define MAX_PAGE_SIZES 32
|
||||
|
||||
#define metal_yield() metal_cpu_yield()
|
||||
|
||||
struct metal_device;
|
||||
|
||||
/** Structure of shared page or hugepage sized data. */
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
#ifndef __METAL_NUTTX_SYS__H__
|
||||
#define __METAL_NUTTX_SYS__H__
|
||||
|
||||
#include <metal/sleep.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define metal_yield() metal_sleep_usec(1000)
|
||||
|
||||
#define METAL_INIT_DEFAULTS \
|
||||
{ \
|
||||
.log_handler = (metal_log_handler)syslog, \
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#ifndef __METAL_ZEPHYR_SYS__H__
|
||||
#define __METAL_ZEPHYR_SYS__H__
|
||||
|
||||
#include <metal/cpu.h>
|
||||
#include <stdlib.h>
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
@@ -23,6 +24,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define metal_yield() metal_cpu_yield()
|
||||
|
||||
#define METAL_INIT_DEFAULTS \
|
||||
{ \
|
||||
.log_handler = metal_zephyr_log_handler, \
|
||||
|
||||
Reference in New Issue
Block a user