Changeset 69f2a07 in rtems


Ignore:
Timestamp:
Aug 24, 2010, 2:29:55 PM (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
469e71d
Parents:
b15fb6e
Message:

2010-08-24 Sebastian Huber <sebastian.huber@…>

PR 1673/cpukit

  • sapi/src/chainappendnotify.c, sapi/src/chaingetnotify.c, sapi/src/chaingetwait.c, sapi/src/chainprependnotify.c: New files.
  • sapi/Makefile.am: Reflect changes above.
  • sapi/include/rtems/chain.h: Declare rtems_chain_append_with_notification(), rtems_chain_prepend_with_notification(), rtems_chain_get_with_notification(), and rtems_chain_get_with_wait().
  • sapi/inline/rtems/chain.inl: Define rtems_chain_append_with_empty_check(), rtems_chain_prepend_with_empty_check(), and rtems_chain_get_with_empty_check().
Location:
cpukit
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rb15fb6e r69f2a07  
     12010-08-24      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        PR 1673/cpukit
     4        * sapi/src/chainappendnotify.c, sapi/src/chaingetnotify.c,
     5        sapi/src/chaingetwait.c, sapi/src/chainprependnotify.c: New files.
     6        * sapi/Makefile.am: Reflect changes above.
     7        * sapi/include/rtems/chain.h: Declare
     8        rtems_chain_append_with_notification(),
     9        rtems_chain_prepend_with_notification(),
     10        rtems_chain_get_with_notification(), and rtems_chain_get_with_wait().
     11        * sapi/inline/rtems/chain.inl: Define
     12        rtems_chain_append_with_empty_check(),
     13        rtems_chain_prepend_with_empty_check(), and
     14        rtems_chain_get_with_empty_check().
     15
    1162010-08-24      Ralf Corsépius <ralf.corsepius@rtems.org>
    217
  • cpukit/sapi/Makefile.am

    rb15fb6e r69f2a07  
    2828    src/ioinitialize.c src/ioopen.c src/ioread.c src/ioregisterdriver.c \
    2929    src/iounregisterdriver.c src/iowrite.c src/posixapi.c  \
    30     src/rtemsapi.c src/extensiondata.c src/getversionstring.c
     30    src/rtemsapi.c src/extensiondata.c src/getversionstring.c \
     31    src/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \
     32    src/chainprependnotify.c
    3133libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
    3234
  • cpukit/sapi/include/rtems/chain.h

    rb15fb6e r69f2a07  
    11/**
    2  * @file rtems/chain.h
     2 * @file
    33 *
    4  *  This include file contains all the constants and structures associated
    5  *  with the Chain API in RTEMS. The chain is a double linked list that
    6  *  is part of the Super Core. This is the published interface to that
    7  *  code.
     4 * @ingroup ClassicChains
    85 *
     6 * @brief Chain API.
    97 */
    108
    119/*
     10 *  Copyright (c) 2010 embedded brains GmbH.
     11 *
    1212 *  COPYRIGHT (c) 1989-2008.
    1313 *  On-Line Applications Research Corporation (OAR).
     
    2525#include <rtems/system.h>
    2626#include <rtems/score/chain.h>
     27#include <rtems/rtems/event.h>
    2728
    2829#ifdef __cplusplus
     
    3132
    3233/**
    33  * @typedef rtems_chain_node
     34 * @defgroup ClassicChains Chains
    3435 *
    35  * A node that can be manipulated in the chain.
     36 * @ingroup ClassicRTEMS
     37 *
     38 * @brief Chain API.
     39 *
     40 * @{
    3641 */
     42
    3743typedef Chain_Node rtems_chain_node;
    3844
    39 /**
    40  * @typedef rtems_chain_control
    41  *
    42  * The chain's control anchors the chain.
    43  */
    4445typedef Chain_Control rtems_chain_control;
    4546
     
    5657  CHAIN_DEFINE_EMPTY(name)
    5758
     59/** @} */
     60
    5861#include <rtems/chain.inl>
     62
     63/**
     64 * @addtogroup ClassicChains
     65 *
     66 * @{
     67 */
     68
     69/**
     70 * @brief Appends the @a node to the @a chain and sends the @a events to the
     71 * @a task if the @a chain was empty before the append.
     72 *
     73 * @see rtems_chain_append_with_empty_check() and rtems_event_send().
     74 *
     75 * @retval RTEMS_SUCCESSFUL Successful operation.
     76 * @retval RTEMS_INVALID_ID No such task.
     77 */
     78rtems_status_code rtems_chain_append_with_notification(
     79  rtems_chain_control *chain,
     80  rtems_chain_node *node,
     81  rtems_id task,
     82  rtems_event_set events
     83);
     84
     85/**
     86 * @brief Prepends the @a node to the @a chain and sends the @a events to the
     87 * @a task if the @a chain was empty before the prepend.
     88 *
     89 * @see rtems_chain_prepend_with_empty_check() and rtems_event_send().
     90 *
     91 * @retval RTEMS_SUCCESSFUL Successful operation.
     92 * @retval RTEMS_INVALID_ID No such task.
     93 */
     94rtems_status_code rtems_chain_prepend_with_notification(
     95  rtems_chain_control *chain,
     96  rtems_chain_node *node,
     97  rtems_id task,
     98  rtems_event_set events
     99);
     100
     101/**
     102 * @brief Gets the first @a node of the @a chain and sends the @a events to the
     103 * @a task if the @a chain is empty after the get.
     104 *
     105 * @see rtems_chain_get_with_empty_check() and rtems_event_send().
     106 *
     107 * @retval RTEMS_SUCCESSFUL Successful operation.
     108 * @retval RTEMS_INVALID_ID No such task.
     109 */
     110rtems_status_code rtems_chain_get_with_notification(
     111  rtems_chain_control *chain,
     112  rtems_id task,
     113  rtems_event_set events,
     114  rtems_chain_node **node
     115);
     116
     117/**
     118 * @brief Gets the first @a node of the @a chain and sends the @a events to the
     119 * @a task if the @a chain is empty afterwards.
     120 *
     121 * @see rtems_chain_get() and rtems_event_receive().
     122 *
     123 * @retval RTEMS_SUCCESSFUL Successful operation.
     124 * @retval RTEMS_TIMEOUT Timeout.
     125 */
     126rtems_status_code rtems_chain_get_with_wait(
     127  rtems_chain_control *chain,
     128  rtems_event_set events,
     129  rtems_interval timeout,
     130  rtems_chain_node **node
     131);
     132
     133/** @} */
    59134
    60135#ifdef __cplusplus
  • cpukit/sapi/inline/rtems/chain.inl

    rb15fb6e r69f2a07  
    11/**
    2  * @file rtems/chain.inl
    3  *
    4  *  This include file contains all the constants and structures associated
    5  *  with the Chain API in RTEMS. The chain is a double linked list that
    6  *  is part of the Super Core. This is the published interface to that
    7  *  code.
    8  *
    9  *  Iterate the node of a chain can be performed with the following code:
    10  *
    11  *     rtems_chain_control* cc = &object->pending;
    12  *     rtems_chain_node*    cn = cc->first;
    13  *     while (!rtems_chain_is_tail (cc, cn))
    14  *     {
    15  *       cn = cn->next;
    16  *     }
     2 * @file
     3 *
     4 * @ingroup ClassicChains
     5 *
     6 * @brief Chain API.
    177 */
    188 
    199/*
     10 *  Copyright (c) 2010 embedded brains GmbH.
     11 *
    2012 *  COPYRIGHT (c) 1989-2008.
    2113 *  On-Line Applications Research Corporation (OAR).
     
    3628
    3729#include <rtems/score/chain.inl>
     30
     31/**
     32 * @addtogroup ClassicChains
     33 *
     34 * @{
     35 */
    3836
    3937/**
     
    506504}
    507505
     506/**
     507 * @brief Checks if the @a chain is empty and appends the @a node.
     508 *
     509 * Interrupts are disabled to ensure the atomicity of the operation.
     510 *
     511 * @retval true The chain was empty before the append.
     512 * @retval false The chain contained at least one node before the append.
     513 */
     514RTEMS_INLINE_ROUTINE bool rtems_chain_append_with_empty_check(
     515  rtems_chain_control *chain,
     516  rtems_chain_node *node
     517)
     518{
     519  return _Chain_Append_with_empty_check( chain, node );
     520}
     521
     522/**
     523 * @brief Checks if the @a chain is empty and prepends the @a node.
     524 *
     525 * Interrupts are disabled to ensure the atomicity of the operation.
     526 *
     527 * @retval true The chain was empty before the prepend.
     528 * @retval false The chain contained at least one node before the prepend.
     529 */
     530RTEMS_INLINE_ROUTINE bool rtems_chain_prepend_with_empty_check(
     531  rtems_chain_control *chain,
     532  rtems_chain_node *node
     533)
     534{
     535  return _Chain_Prepend_with_empty_check( chain, node );
     536}
     537
     538/**
     539 * @brief Tries to get the first @a node and check if the @a chain is empty
     540 * afterwards.
     541 *
     542 * This function removes the first node from the @a chain and returns a pointer
     543 * to that node in @a node.  If the @a chain is empty, then @c NULL is returned.
     544 *
     545 * Interrupts are disabled to ensure the atomicity of the operation.
     546 *
     547 * @retval true The chain is empty after the node removal.
     548 * @retval false The chain contained at least one node after the node removal.
     549 */
     550RTEMS_INLINE_ROUTINE bool rtems_chain_get_with_empty_check(
     551  rtems_chain_control *chain,
     552  rtems_chain_node **node
     553)
     554{
     555  return _Chain_Get_with_empty_check( chain, node );
     556}
     557
     558/** @} */
     559
    508560#endif
    509561/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.