XIAOHUI TAO / Mbed 2 deprecated hw2_protothread
Committer:
taoxh
Date:
Tue Nov 30 23:53:06 2010 +0000
Revision:
0:ee91220d7bea
HW2 PROTOTHREAD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
taoxh 0:ee91220d7bea 1 /*
taoxh 0:ee91220d7bea 2 * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
taoxh 0:ee91220d7bea 3 * All rights reserved.
taoxh 0:ee91220d7bea 4 *
taoxh 0:ee91220d7bea 5 * Redistribution and use in source and binary forms, with or without
taoxh 0:ee91220d7bea 6 * modification, are permitted provided that the following conditions
taoxh 0:ee91220d7bea 7 * are met:
taoxh 0:ee91220d7bea 8 * 1. Redistributions of source code must retain the above copyright
taoxh 0:ee91220d7bea 9 * notice, this list of conditions and the following disclaimer.
taoxh 0:ee91220d7bea 10 * 2. Redistributions in binary form must reproduce the above copyright
taoxh 0:ee91220d7bea 11 * notice, this list of conditions and the following disclaimer in the
taoxh 0:ee91220d7bea 12 * documentation and/or other materials provided with the distribution.
taoxh 0:ee91220d7bea 13 * 3. Neither the name of the Institute nor the names of its contributors
taoxh 0:ee91220d7bea 14 * may be used to endorse or promote products derived from this software
taoxh 0:ee91220d7bea 15 * without specific prior written permission.
taoxh 0:ee91220d7bea 16 *
taoxh 0:ee91220d7bea 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
taoxh 0:ee91220d7bea 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
taoxh 0:ee91220d7bea 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
taoxh 0:ee91220d7bea 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
taoxh 0:ee91220d7bea 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
taoxh 0:ee91220d7bea 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
taoxh 0:ee91220d7bea 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
taoxh 0:ee91220d7bea 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
taoxh 0:ee91220d7bea 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
taoxh 0:ee91220d7bea 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
taoxh 0:ee91220d7bea 27 * SUCH DAMAGE.
taoxh 0:ee91220d7bea 28 *
taoxh 0:ee91220d7bea 29 * This file is part of the protothreads library.
taoxh 0:ee91220d7bea 30 *
taoxh 0:ee91220d7bea 31 * Author: Adam Dunkels <adam@sics.se>
taoxh 0:ee91220d7bea 32 *
taoxh 0:ee91220d7bea 33 * $Id: lc.h,v 1.2 2005/02/24 10:36:59 adam Exp $
taoxh 0:ee91220d7bea 34 */
taoxh 0:ee91220d7bea 35
taoxh 0:ee91220d7bea 36 /**
taoxh 0:ee91220d7bea 37 * \addtogroup pt
taoxh 0:ee91220d7bea 38 * @{
taoxh 0:ee91220d7bea 39 */
taoxh 0:ee91220d7bea 40
taoxh 0:ee91220d7bea 41 /**
taoxh 0:ee91220d7bea 42 * \defgroup lc Local continuations
taoxh 0:ee91220d7bea 43 * @{
taoxh 0:ee91220d7bea 44 *
taoxh 0:ee91220d7bea 45 * Local continuations form the basis for implementing protothreads. A
taoxh 0:ee91220d7bea 46 * local continuation can be <i>set</i> in a specific function to
taoxh 0:ee91220d7bea 47 * capture the state of the function. After a local continuation has
taoxh 0:ee91220d7bea 48 * been set can be <i>resumed</i> in order to restore the state of the
taoxh 0:ee91220d7bea 49 * function at the point where the local continuation was set.
taoxh 0:ee91220d7bea 50 *
taoxh 0:ee91220d7bea 51 *
taoxh 0:ee91220d7bea 52 */
taoxh 0:ee91220d7bea 53
taoxh 0:ee91220d7bea 54 /**
taoxh 0:ee91220d7bea 55 * \file lc.h
taoxh 0:ee91220d7bea 56 * Local continuations
taoxh 0:ee91220d7bea 57 * \author
taoxh 0:ee91220d7bea 58 * Adam Dunkels <adam@sics.se>
taoxh 0:ee91220d7bea 59 *
taoxh 0:ee91220d7bea 60 */
taoxh 0:ee91220d7bea 61
taoxh 0:ee91220d7bea 62 #ifdef DOXYGEN
taoxh 0:ee91220d7bea 63 /**
taoxh 0:ee91220d7bea 64 * Initialize a local continuation.
taoxh 0:ee91220d7bea 65 *
taoxh 0:ee91220d7bea 66 * This operation initializes the local continuation, thereby
taoxh 0:ee91220d7bea 67 * unsetting any previously set continuation state.
taoxh 0:ee91220d7bea 68 *
taoxh 0:ee91220d7bea 69 * \hideinitializer
taoxh 0:ee91220d7bea 70 */
taoxh 0:ee91220d7bea 71 #define LC_INIT(lc)
taoxh 0:ee91220d7bea 72
taoxh 0:ee91220d7bea 73 /**
taoxh 0:ee91220d7bea 74 * Set a local continuation.
taoxh 0:ee91220d7bea 75 *
taoxh 0:ee91220d7bea 76 * The set operation saves the state of the function at the point
taoxh 0:ee91220d7bea 77 * where the operation is executed. As far as the set operation is
taoxh 0:ee91220d7bea 78 * concerned, the state of the function does <b>not</b> include the
taoxh 0:ee91220d7bea 79 * call-stack or local (automatic) variables, but only the program
taoxh 0:ee91220d7bea 80 * counter and such CPU registers that needs to be saved.
taoxh 0:ee91220d7bea 81 *
taoxh 0:ee91220d7bea 82 * \hideinitializer
taoxh 0:ee91220d7bea 83 */
taoxh 0:ee91220d7bea 84 #define LC_SET(lc)
taoxh 0:ee91220d7bea 85
taoxh 0:ee91220d7bea 86 /**
taoxh 0:ee91220d7bea 87 * Resume a local continuation.
taoxh 0:ee91220d7bea 88 *
taoxh 0:ee91220d7bea 89 * The resume operation resumes a previously set local continuation, thus
taoxh 0:ee91220d7bea 90 * restoring the state in which the function was when the local
taoxh 0:ee91220d7bea 91 * continuation was set. If the local continuation has not been
taoxh 0:ee91220d7bea 92 * previously set, the resume operation does nothing.
taoxh 0:ee91220d7bea 93 *
taoxh 0:ee91220d7bea 94 * \hideinitializer
taoxh 0:ee91220d7bea 95 */
taoxh 0:ee91220d7bea 96 #define LC_RESUME(lc)
taoxh 0:ee91220d7bea 97
taoxh 0:ee91220d7bea 98 /**
taoxh 0:ee91220d7bea 99 * Mark the end of local continuation usage.
taoxh 0:ee91220d7bea 100 *
taoxh 0:ee91220d7bea 101 * The end operation signifies that local continuations should not be
taoxh 0:ee91220d7bea 102 * used any more in the function. This operation is not needed for
taoxh 0:ee91220d7bea 103 * most implementations of local continuation, but is required by a
taoxh 0:ee91220d7bea 104 * few implementations.
taoxh 0:ee91220d7bea 105 *
taoxh 0:ee91220d7bea 106 * \hideinitializer
taoxh 0:ee91220d7bea 107 */
taoxh 0:ee91220d7bea 108 #define LC_END(lc)
taoxh 0:ee91220d7bea 109
taoxh 0:ee91220d7bea 110 /**
taoxh 0:ee91220d7bea 111 * \var typedef lc_t;
taoxh 0:ee91220d7bea 112 *
taoxh 0:ee91220d7bea 113 * The local continuation type.
taoxh 0:ee91220d7bea 114 *
taoxh 0:ee91220d7bea 115 * \hideinitializer
taoxh 0:ee91220d7bea 116 */
taoxh 0:ee91220d7bea 117 #endif /* DOXYGEN */
taoxh 0:ee91220d7bea 118
taoxh 0:ee91220d7bea 119 #ifndef __LC_H__
taoxh 0:ee91220d7bea 120 #define __LC_H__
taoxh 0:ee91220d7bea 121
taoxh 0:ee91220d7bea 122
taoxh 0:ee91220d7bea 123 #ifdef LC_INCLUDE
taoxh 0:ee91220d7bea 124 #include LC_INCLUDE
taoxh 0:ee91220d7bea 125 #else
taoxh 0:ee91220d7bea 126 #include "lc-switch.h"
taoxh 0:ee91220d7bea 127 #endif /* LC_INCLUDE */
taoxh 0:ee91220d7bea 128
taoxh 0:ee91220d7bea 129 #endif /* __LC_H__ */
taoxh 0:ee91220d7bea 130
taoxh 0:ee91220d7bea 131 /** @} */
taoxh 0:ee91220d7bea 132 /** @} */