📄 devapi-api.html
字号:
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Initialize the mutex pointed to by the
<TT
CLASS="LITERAL"
>mutex</TT
> argument. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11649">cyg_drv_mutex_destroy</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_mutex_destroy( cyg_drv_mutex *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> - pointer to mutex to destroy</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Destroy the mutex pointed to by the
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument. The mutex should be unlocked
and there should be no threads waiting to lock it when this call
in made.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11674">cyg_drv_mutex_lock</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>cyg_bool cyg_drv_mutex_lock( cyg_drv_mutex *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> - pointer to mutex to lock</P
></DD
><DT
>Result:</DT
><DD
><P
><TT
CLASS="LITERAL"
>TRUE</TT
> it the thread has claimed the
lock, <TT
CLASS="LITERAL"
>FALSE</TT
> otherwise.</P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Attempt to lock the mutex pointed to by the
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument. If the mutex is already
locked by another thread then this thread will wait until that
thread is finished. If the result from this function is
<TT
CLASS="LITERAL"
>FALSE</TT
> then the thread was broken out of its
wait by some other thread. In this case the mutex will not have
been locked. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11702">cyg_drv_mutex_trylock</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>cyg_bool cyg_drv_mutex_trylock( cyg_drv_mutex *mutex )</PRE
></TD
></TR
></TABLE
></P
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> - pointer to mutex to lock</P
></DD
><DT
>Result:</DT
><DD
><P
><TT
CLASS="LITERAL"
>TRUE</TT
> if the mutex has been locked,
<TT
CLASS="LITERAL"
>FALSE</TT
> otherwise. </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Attempt to lock the mutex pointed to by the
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument without waiting. If the
mutex is already locked by some other thread then this function
returns <TT
CLASS="LITERAL"
>FALSE</TT
>. If the function can lock the
mutex without waiting, then <TT
CLASS="LITERAL"
>TRUE</TT
> is
returned. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11732">cyg_drv_mutex_unlock</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_mutex_unlock( cyg_drv_mutex *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> - pointer to mutex to unlock</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Unlock the mutex pointed to by the
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument. If there are any threads
waiting to claim the lock, one of them is woken up to try and
claim it. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11757">cyg_drv_mutex_release</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_mutex_release( cyg_drv_mutex *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="LITERAL"
>mutex</TT
> - pointer to mutex to release</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Release all threads waiting on the mutex pointed to by the
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument. These threads will return
from <TT
CLASS="FUNCTION"
>cyg_drv_mutex_lock()</TT
> with a
<TT
CLASS="LITERAL"
>FALSE</TT
> result and will not have claimed the
mutex. This function has no effect on any thread that may have
the mutex claimed. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11784">cyg_drv_cond_init</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> void cyg_drv_cond_init( cyg_drv_cond *cond, cyg_drv_mutex *mutex )
</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> - condition variable to initialize</P
><P
><TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> - mutex to associate with this condition variable</P
></DD
><DT
>Result:</DT
><DD
><P
>None</P
></DD
><DT
>Level:</DT
><DD
><P
>Thread </P
></DD
><DT
>Description:</DT
><DD
><P
>Initialize the condition variable pointed to by the
<TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> argument. The
<TT
CLASS="PARAMETER"
><I
>mutex</I
></TT
> argument must point to a mutex with
which this condition variable is associated. A thread may only
wait on this condition variable when it has already locked the
associated mutex. Waiting will cause the mutex to be unlocked,
and when the thread is reawakened, it will automatically claim
the mutex before continuing. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11812">cyg_drv_cond_destroy</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> void cyg_drv_cond_destroy( cyg_drv_cond *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> - condition variable to destroy</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Destroy the condition variable pointed to by the
<TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> argument. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11837">cyg_drv_cond_wait</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_cond_wait( cyg_drv_cond *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> - condition variable to wait on</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Wait for a signal on the condition variable pointed to by
the <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> argument. The thread must have
locked the associated mutex, supplied in
<TT
CLASS="FUNCTION"
>cyg_drv_cond_init()</TT
>, before waiting on this
condition variable. While the thread waits, the mutex will be
unlocked, and will be re-locked before this function returns. It
is possible for threads waiting on a condition variable to
occasionally wake up spuriously. For this reason it is necessary
to use this function in a loop that re-tests the condition each
time it returns. Note that this function performs an implicit
scheduler unlock/relock sequence, so that it may be used within
an explicit
<TT
CLASS="LITERAL"
>cyg_drv_dsr_lock()...cyg_drv_dsr_unlock()</TT
>
structure.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11864">cyg_drv_cond_signal</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_cond_signal( cyg_drv_cond *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> - condition variable to signal</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>DSR</P
></DD
><DT
>Description:</DT
><DD
><P
>Signal the condition variable pointed to by the <TT
CLASS="PARAMETER"
><I
>cond</I
></TT
>
argument. If there are any threads waiting on this variable at
least one of them will be awakened. Note that in some
configurations there may not be any difference between this
function and <TT
CLASS="FUNCTION"
>cyg_drv_cond_broadcast()</TT
>.
</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11890">cyg_drv_cond_broadcast</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_cond_broadcast( cyg_drv_cond *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> - condition variable to broadcast to</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>DSR</P
></DD
><DT
>Description:</DT
><DD
><P
>Signal the condition variable pointed to by the
<TT
CLASS="PARAMETER"
><I
>cond</I
></TT
> argument. If there are any threads
waiting on this variable they will all be awakened. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11915">cyg_drv_interrupt_create</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_interrupt_create( cyg_vector_t vector,
cyg_priority_t priority,
cyg_addrword_t data,
cyg_ISR_t *isr,
cyg_DSR_t *dsr,
cyg_handle_t *handle,
cyg_interrupt *intr
)</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>vector</I
></TT
> - vector to attach to</P
><P
><TT
CLASS="PARAMETER"
><I
>priority</I
></TT
> - queuing priority</P
><P
><TT
CLASS="PARAMETER"
><I
>data</I
></TT
> - data pointer</P
><P
><TT
CLASS="PARAMETER"
><I
>isr</I
></TT
> - interrupt service routine</P
><P
><TT
CLASS="PARAMETER"
><I
>dsr</I
></TT
> - deferred service routine</P
><P
><TT
CLASS="PARAMETER"
><I
>handle</I
></TT
> - returned handle</P
><P
><TT
CLASS="PARAMETER"
><I
>intr</I
></TT
> - put interrupt object here</P
></DD
><DT
>Result:</DT
><DD
><P
>None</P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Create an interrupt object and returns a handle to it. The
object contains information about which interrupt vector to use
and the ISR and DSR that will be called after the interrupt
object is attached to the vector. The interrupt object will be
allocated in the memory passed in the
<TT
CLASS="PARAMETER"
><I
>intr</I
></TT
> parameter. The interrupt object is
not immediately attached; it must be attached with the
<TT
CLASS="FUNCTION"
>cyg_interrupt_attach()</TT
> call. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11953">cyg_drv_interrupt_delete</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> void cyg_drv_interrupt_delete( cyg_handle_t interrupt )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>interrupt</I
></TT
> - interrupt to delete</P
></DD
><DT
>Result:</DT
><DD
><P
>None </P
></DD
><DT
>Level:</DT
><DD
><P
>Thread</P
></DD
><DT
>Description:</DT
><DD
><P
>Detach the interrupt from the vector and free the memory
passed in the <TT
CLASS="PARAMETER"
><I
>intr</I
></TT
> argument to
<TT
CLASS="FUNCTION"
>cyg_drv_interrupt_create()</TT
> for
reuse. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN11979">cyg_drv_interrupt_attach</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Function:</DT
><DD
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>void cyg_drv_interrupt_attach( cyg_handle_t interrupt )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><TT
CLASS="PARAMETER"
><I
>interrupt</I
></TT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -