Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: cpu: create a new libmetal API metal_yield #311

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/system/freertos/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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 {

Expand Down
4 changes: 4 additions & 0 deletions lib/system/freertos/template/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions lib/system/freertos/xlnx/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
#ifndef __METAL_FREERTOS_XLNX_SYS__H__
#define __METAL_FREERTOS_XLNX_SYS__H__

#include <metal/cpu.h>

#include "xscugic.h"
#include "FreeRTOS.h"

#ifdef __cplusplus
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
Expand Down
3 changes: 3 additions & 0 deletions lib/system/linux/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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. */
Expand Down
4 changes: 4 additions & 0 deletions lib/system/nuttx/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down
3 changes: 3 additions & 0 deletions lib/system/zephyr/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
#ifndef __METAL_ZEPHYR_SYS__H__
#define __METAL_ZEPHYR_SYS__H__

#include <metal/cpu.h>
#include <stdlib.h>
#include <zephyr/kernel.h>

#ifdef __cplusplus
extern "C" {
#endif

#define metal_yield() metal_cpu_yield()

#define METAL_INIT_DEFAULTS \
{ \
.log_handler = metal_zephyr_log_handler, \
Expand Down
Loading