| 1 |
/* do not edit automatically generated by mc from RTco. */ |
| 2 |
/* RTco.def provides minimal access to thread primitives. |
| 3 |
|
| 4 |
Copyright (C) 2019-2025 Free Software Foundation, Inc. |
| 5 |
Contributed by Gaius Mulley <[email protected]>. |
| 6 |
|
| 7 |
This file is part of GNU Modula-2. |
| 8 |
|
| 9 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 3, or (at your option) |
| 12 |
any later version. |
| 13 |
|
| 14 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
General Public License for more details. |
| 18 |
|
| 19 |
Under Section 7 of GPL version 3, you are granted additional |
| 20 |
permissions described in the GCC Runtime Library Exception, version |
| 21 |
3.1, as published by the Free Software Foundation. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License and |
| 24 |
a copy of the GCC Runtime Library Exception along with this program; |
| 25 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 26 |
<http://www.gnu.org/licenses/>. */ |
| 27 |
|
| 28 |
|
| 29 |
#if !defined (_RTco_H) |
| 30 |
# define _RTco_H |
| 31 |
|
| 32 |
#include "config.h" |
| 33 |
#include "system.h" |
| 34 |
# ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
# endif |
| 37 |
#include <stdbool.h> |
| 38 |
# if !defined (PROC_D) |
| 39 |
# define PROC_D |
| 40 |
typedef void (*PROC_t) (void); |
| 41 |
typedef struct { PROC_t proc; } PROC; |
| 42 |
# endif |
| 43 |
|
| 44 |
# include "GSYSTEM.h" |
| 45 |
# include "GRTentity.h" |
| 46 |
|
| 47 |
# if defined (_RTco_C) |
| 48 |
# define EXTERN |
| 49 |
# else |
| 50 |
# define EXTERN extern |
| 51 |
# endif |
| 52 |
|
| 53 |
|
| 54 |
/* |
| 55 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 56 |
|
| 57 |
EXTERN int RTco_init (void); |
| 58 |
|
| 59 |
/* |
| 60 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 61 |
|
| 62 |
EXTERN int RTco_initThread (PROC p, unsigned int stackSize, unsigned int interruptLevel); |
| 63 |
|
| 64 |
/* |
| 65 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 66 |
|
| 67 |
EXTERN int RTco_initSemaphore (unsigned int value); |
| 68 |
|
| 69 |
/* |
| 70 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 71 |
|
| 72 |
EXTERN void RTco_wait (int semaphore); |
| 73 |
|
| 74 |
/* |
| 75 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 76 |
|
| 77 |
EXTERN void RTco_signal (int semaphore); |
| 78 |
|
| 79 |
/* |
| 80 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 81 |
|
| 82 |
EXTERN void RTco_transfer (int *p1, int p2); |
| 83 |
|
| 84 |
/* |
| 85 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 86 |
|
| 87 |
EXTERN void RTco_waitThread (int tid); |
| 88 |
|
| 89 |
/* |
| 90 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 91 |
|
| 92 |
EXTERN void RTco_signalThread (int tid); |
| 93 |
|
| 94 |
/* |
| 95 |
init initializes the module and allows the application to lazily invoke threads. */ |
| 96 |
|
| 97 |
EXTERN int RTco_currentThread (void); |
| 98 |
|
| 99 |
/* |
| 100 |
currentInterruptLevel returns the interrupt level of the current thread. */ |
| 101 |
|
| 102 |
EXTERN unsigned int RTco_currentInterruptLevel (void); |
| 103 |
EXTERN unsigned int RTco_turnInterrupts (unsigned int newLevel); |
| 104 |
|
| 105 |
/* |
| 106 |
select access to the select system call which will be thread safe. |
| 107 |
This is typically called from the idle process to wait for an interrupt. |
| 108 |
*/ |
| 109 |
|
| 110 |
EXTERN int RTco_select (int p1, void * p2, void * p3, void * p4, void * p5); |
| 111 |
# ifdef __cplusplus |
| 112 |
} |
| 113 |
# endif |
| 114 |
|
| 115 |
# undef EXTERN |
| 116 |
#endif |