📄 devapi-api.html
字号:
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - pointer to mutex to initialize</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 mutex pointed to by the
<TT
CLASS="LITERAL"
>mutex</TT
> argument. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN6480"
>cyg_drv_mutex_destroy</A
></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_t *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - 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
<CODE
CLASS="PARAMETER"
>mutex</CODE
> 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="AEN6505"
>cyg_drv_mutex_lock</A
></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_t *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - 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
<CODE
CLASS="PARAMETER"
>mutex</CODE
> 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="AEN6533"
>cyg_drv_mutex_trylock</A
></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_t *mutex )</PRE
></TD
></TR
></TABLE
></P
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - 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
<CODE
CLASS="PARAMETER"
>mutex</CODE
> 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="AEN6563"
>cyg_drv_mutex_unlock</A
></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_t *mutex )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - 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
<CODE
CLASS="PARAMETER"
>mutex</CODE
> 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="AEN6588"
>cyg_drv_mutex_release</A
></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_t *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
<CODE
CLASS="PARAMETER"
>mutex</CODE
> argument. These threads will return
from <CODE
CLASS="FUNCTION"
>cyg_drv_mutex_lock()</CODE
> 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="AEN6615"
>cyg_drv_cond_init</A
></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_t *cond, cyg_drv_mutex_t *mutex )
</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>cond</CODE
> - condition variable to initialize</P
><P
><CODE
CLASS="PARAMETER"
>mutex</CODE
> - 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
<CODE
CLASS="PARAMETER"
>cond</CODE
> argument. The
<CODE
CLASS="PARAMETER"
>mutex</CODE
> 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="AEN6643"
>cyg_drv_cond_destroy</A
></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_t *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>cond</CODE
> - 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
<CODE
CLASS="PARAMETER"
>cond</CODE
> argument. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN6668"
>cyg_drv_cond_wait</A
></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_t *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>cond</CODE
> - 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 <CODE
CLASS="PARAMETER"
>cond</CODE
> argument. The thread must have
locked the associated mutex, supplied in
<CODE
CLASS="FUNCTION"
>cyg_drv_cond_init()</CODE
>, 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="AEN6695"
>cyg_drv_cond_signal</A
></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_t *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>cond</CODE
> - 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 <CODE
CLASS="PARAMETER"
>cond</CODE
>
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 <CODE
CLASS="FUNCTION"
>cyg_drv_cond_broadcast()</CODE
>.
</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN6721"
>cyg_drv_cond_broadcast</A
></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_t *cond )</PRE
></TD
></TR
></TABLE
></DD
><DT
>Arguments:</DT
><DD
><P
><CODE
CLASS="PARAMETER"
>cond</CODE
> - 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
<CODE
CLASS="PARAMETER"
>cond</CODE
> 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="AEN6746"
>cyg_drv_interrupt_create</A
></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
><CODE
CLASS="PARAMETER"
>vector</CODE
> - vector to attach to</P
><P
><CODE
CLASS="PARAMETER"
>priority</CODE
> - queuing priority</P
><P
><CODE
CLASS="PARAMETER"
>data</CODE
> - data pointer</P
><P
><CODE
CLASS="PARAMETER"
>isr</CODE
> - interrupt service routine</P
><P
><CODE
CLASS="PARAMETER"
>dsr</CODE
> - deferred service routine</P
><P
><CODE
CLASS="PARAMETER"
>handle</CODE
> - returned handle</P
><P
><CODE
CLASS="PARAMETER"
>intr</CODE
> - 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
<CODE
CLASS="PARAMETER"
>intr</CODE
> parameter. The interrupt object is
not immediately attached; it must be attached with the
<CODE
CLASS="FUNCTION"
>cyg_interrupt_attach()</CODE
> call. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN6784"
>cyg_drv_interrupt_delete</A
></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
><CODE
CLASS="PARAMETER"
>interrupt</CODE
> - 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 <CODE
CLASS="PARAMETER"
>intr</CODE
> argument to
<CODE
CLASS="FUNCTION"
>cyg_drv_interrupt_create()</CODE
> for
reuse. </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="SECTION"
><H2
CLASS="SECTION"
><A
NAME="AEN6810"
>cyg_drv_interrupt_attach</A
></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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -