Skip to content

Commit 09fdfb7

Browse files
authored
Merge pull request #2164 from petterreinholdtsen/2.9-rtapi-ioperm
Added rtapi_ioperm() declaration for hal_speaker
2 parents 052b0b8 + e26c34a commit 09fdfb7

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

docs/man/man3/rtapi_io.3rtapi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ unsigned void rtapi_outb(unsigned char value, unsigned short int port);
3838
.HP
3939
unsigned void rtapi_outw(unsigned short value, unsigned short int port);
4040
.HP
41+
unsigned void rtapi_inl(unsigned int value, unsigned short int port);
42+
.HP
43+
int rtapi_ioperm(unsigned long from, unsigned long num, int turn_on);
44+
.HP
4145
unsigned void rtapi_outl(unsigned int value, unsigned short int port);
4246

4347
.SH DESCRIPTION
@@ -47,7 +51,8 @@ underlying kernel functionality, if available.
4751
In userspace, or in kernels where the underlying functionality is not provided
4852
by a kernel, generally another implementation--possibly with reduced
4953
functionality--is provided. (For example, the userspace implementation for
50-
rtapi_device_register always succeeds)
54+
rtapi_device_register and the kernel space implementation of rtapi_ioperm always
55+
succeeds)
5156
.SH REALTIME CONSIDERATIONS
5257
Call from init/cleanup code and from realtime tasks. These functions will
5358
cause illegal instruction exceptions in userspace components, as well as in

src/hal/drivers/hal_speaker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "config.h" /* environment flags */
6565
#include "rtapi.h" /* RTAPI realtime OS API */
6666
#include "rtapi_app.h" /* RTAPI realtime module decls */
67+
#include "rtapi_io.h"
6768
#include "hal.h" /* HAL public API decls */
6869

6970
/* If FASTIO is defined, uses outb() and inb() from <asm.io>,
@@ -161,7 +162,7 @@ int rtapi_app_main(void)
161162

162163
#if !defined(RTAPI_RTAI)
163164
/* STEP 1.1: get access to port, only needed in uspace builds */
164-
if (ioperm(SPEAKER_PORT, 1, 1) < 0) {
165+
if (rtapi_ioperm(SPEAKER_PORT, 1, 1) < 0) {
165166
rtapi_print_msg(RTAPI_MSG_ERR,
166167
"SPEAKER: ERROR: ioperm() failed\n");
167168
hal_exit(comp_id);

src/rtapi/rtapi_io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@
3232
#define rtapi_outb outb
3333
#define rtapi_outw outw
3434
#define rtapi_outl outl
35+
#define rtapi_ioperm ioperm
3536
#else
3637
#define rtapi_inb(x) (0)
3738
#define rtapi_inw(x) (0)
3839
#define rtapi_inl(x) (0)
3940
#define rtapi_outb(x,y) ((void)0)
4041
#define rtapi_outw(x,y) ((void)0)
4142
#define rtapi_outl(x,y) ((void)0)
43+
#define rtapi_ioperm(x,y,z) ((void)0)
4244
#endif
4345

4446
#endif

0 commit comments

Comments
 (0)