1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
<HTML
><HEAD
><TITLE
>rtf_create_rt_handler</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"></HEAD
><BODY
CLASS="REFENTRY"
><H1
><A
NAME="AEN1"
>rtf_create_rt_handler</A
></H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN5"
></A
><H2
>Name</H2
>rtf_create_rt_handler -- install a handler for realtime fifo data</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN8"
></A
><H2
>Synopsis</H2
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SYNOPSIS"
> #include <rtl_fifo.h>
int <TT
CLASS="FUNCTION"
>rtf_create_rt_handler</TT
>(unsigned int <TT
CLASS="PARAMETER"
><I
>fifo</I
></TT
>, int (* <TT
CLASS="PARAMETER"
><I
>handler</I
></TT
>)());</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN13"
></A
><H2
>DESCRIPTION</H2
><P
><TT
CLASS="FUNCTION"
>rtf_create_rt_handler</TT
> installs a handler which is executed when <TT
CLASS="FUNCTION"
>rtf_put</TT
> or <TT
CLASS="FUNCTION"
>rtf_get</TT
>
is called on the specified real-time fifo (RT-FIFO). <TT
CLASS="PARAMETER"
><I
>fifo</I
></TT
> is an RT-FIFO that must have previously been created with a call to <TT
CLASS="FUNCTION"
>rtf_create</TT
>. <TT
CLASS="PARAMETER"
><I
>handler</I
></TT
> is then called whenever that fifo is accessed in RT mode.</P
><P
> Note that the handler is called in the context of the task that uses
<TT
CLASS="FUNCTION"
>rtf_put</TT
> or <TT
CLASS="FUNCTION"
>rtf_get</TT
>. You can use semaphores
to take handler actions asynchronously: use <TT
CLASS="FUNCTION"
>sem_wait(3)</TT
>
in a thread, and post the semaphore from the handler.</P
><P
>The RT-FIFO is a mechanism, implemented as a character device, to communicate between realtime software components (either in threads or handlers),
and between realtime software and ordinary Linux processes. The rtf_* functions are used in RT mode; Linux processes use standard character device access functions, such as <TT
CLASS="FUNCTION"
>read(2)</TT
>, <TT
CLASS="FUNCTION"
>write(2)</TT
> and <TT
CLASS="FUNCTION"
>select(2)</TT
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN30"
></A
><H2
>RETURN VALUE</H2
><P
>On success, 0 is returned. On failure, a negative value is returned as described below.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN33"
></A
><H2
>ERRORS</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>-EINVAL</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>fifo</I
></TT
> is greater than or equal to RTF_NO, or is not a valid RT-FIFO identifier; or <TT
CLASS="PARAMETER"
><I
>handler</I
></TT
> is NULL.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN42"
></A
><H2
>SEE ALSO</H2
><A
HREF="rtf_create.3.html"
TARGET="_top"
>rtf_create(3)</A
>, <A
HREF="rtf_create_handler.3.html"
TARGET="_top"
>rtf_create_handler(3)</A
>, <A
HREF="rtf_destroy.3.html"
TARGET="_top"
>rtf_destroy(3)</A
>, <A
HREF="rtf_get.3.html"
TARGET="_top"
>rtf_get(3)</A
>, <A
HREF="rtf_put.3.html"
TARGET="_top"
>rtf_put(3)</A
><P
>2001 FSMLabs Inc.</P
><P
>All rights reserved.</P
></DIV
></BODY
></HTML
>
|