From 88874bdfff8fe904b865cdea38989d9b278a6678 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Mon, 28 Nov 2022 23:16:53 +0100 Subject: [PATCH] Added rtapi_ioperm() declaration for hal_speaker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following compiler warning: hal/drivers/hal_speaker.c: In function ‘rtapi_app_main’: hal/drivers/hal_speaker.c:164:9: warning: implicit declaration of function ‘ioperm’ [-Wimplicit-function-declaration] 164 | if (ioperm(SPEAKER_PORT, 1, 1) < 0) { | ^~~~~~ --- docs/man/man3/rtapi_io.3rtapi | 5 ++++- src/hal/drivers/hal_speaker.c | 3 ++- src/rtapi/rtapi_io.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/man/man3/rtapi_io.3rtapi b/docs/man/man3/rtapi_io.3rtapi index 7305a6fd947..26b3abf4f74 100644 --- a/docs/man/man3/rtapi_io.3rtapi +++ b/docs/man/man3/rtapi_io.3rtapi @@ -39,6 +39,8 @@ unsigned void rtapi_inb(unsigned char value, unsigned short int port); unsigned void rtapi_inw(unsigned short value, unsigned short int port); .HP unsigned void rtapi_inl(unsigned int value, unsigned short int port); +.HP +int rtapi_ioperm(unsigned long from, unsigned long num, int turn_on); .SH DESCRIPTION In kernel space, each rtapi_xxx or RTAPI_XXX identifier is mapped to the @@ -47,7 +49,8 @@ underlying kernel functionality, if available. In userspace, or in kernels where the underlying functionality is not provided by a kernel, generally another implementation--possibly with reduced functionality--is provided. (For example, the userspace implementation for -rtapi_device_register always succeeds) +rtapi_device_register and the kernel space implementation of rtapi_ioperm always +succeeds) .SH REALTIME CONSIDERATIONS Call from init/cleanup code and from realtime tasks. These functions will cause illegal instruction exceptions in userspace components, as well as in diff --git a/src/hal/drivers/hal_speaker.c b/src/hal/drivers/hal_speaker.c index 5d7a08825af..4f8c6509f17 100644 --- a/src/hal/drivers/hal_speaker.c +++ b/src/hal/drivers/hal_speaker.c @@ -64,6 +64,7 @@ #include "config.h" /* environment flags */ #include "rtapi.h" /* RTAPI realtime OS API */ #include "rtapi_app.h" /* RTAPI realtime module decls */ +#include "rtapi_io.h" #include "hal.h" /* HAL public API decls */ /* If FASTIO is defined, uses outb() and inb() from , @@ -161,7 +162,7 @@ int rtapi_app_main(void) #if !defined(RTAPI_RTAI) /* STEP 1.1: get access to port, only needed in uspace builds */ - if (ioperm(SPEAKER_PORT, 1, 1) < 0) { + if (rtapi_ioperm(SPEAKER_PORT, 1, 1) < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "SPEAKER: ERROR: ioperm() failed\n"); hal_exit(comp_id); diff --git a/src/rtapi/rtapi_io.h b/src/rtapi/rtapi_io.h index 3db46a25934..8874d65e2e4 100644 --- a/src/rtapi/rtapi_io.h +++ b/src/rtapi/rtapi_io.h @@ -32,6 +32,7 @@ #define rtapi_outb outb #define rtapi_outw outw #define rtapi_outl outl +#define rtapi_ioperm ioperm #else #define rtapi_inb(x) (0) #define rtapi_inw(x) (0) @@ -39,6 +40,7 @@ #define rtapi_outb(x,y) ((void)0) #define rtapi_outw(x,y) ((void)0) #define rtapi_outl(x,y) ((void)0) +#define rtapi_ioperm(x,y,z) ((void)0) #endif #endif