Lines Matching +full:- +full:c
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
38 /* *INDENT-OFF* */
40 extern "C" {
42 /* *INDENT-ON* */
44 /* Used to hide the implementation of the co-routine control block. The
46 * the macro implementation of the co-routine functionality. */
49 /* Defines the prototype to which co-routine functions must conform. */
58 …UBaseType_t uxPriority; /**< The priority of the co-routine in relation to other co-routines.…
59 …Index; /**< Used to distinguish between co-routines when multiple co-routines use the same…
60 uint16_t uxState; /**< Used internally by the co-routine implementation. */
61 } CRCB_t; /* Co-routine control block. Note must be identical in size down …
65 * @code{c}
73 * Create a new co-routine and add it to the list of co-routines that are
76 * @param pxCoRoutineCode Pointer to the co-routine function. Co-routine
77 * functions require special syntax - see the co-routine section of the WEB
80 * @param uxPriority The priority with respect to other co-routines at which
81 * the co-routine will run.
83 * @param uxIndex Used to distinguish between different co-routines that
84 * execute the same function. See the example below and the co-routine section
87 * @return pdPASS if the co-routine was successfully created and added to a ready
91 * @code{c}
92 * // Co-routine to be created.
95 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
100 * // Must start every co-routine with a call to crSTART();
105 * // This co-routine just delays for a fixed period, then toggles
106 * // an LED. Two co-routines are created using this function, so
107 * // the uxIndex parameter is used to tell the co-routine which
114 * // Must end every co-routine with a call to crEND();
118 * // Function that creates two co-routines.
124 * // Create two co-routines at priority 0. The first is given index 0
143 * @code{c}
147 * Run a co-routine.
149 * vCoRoutineSchedule() executes the highest priority co-routine that is able
150 * to run. The co-routine will execute until it either blocks, yields or is
151 * preempted by a task. Co-routines execute cooperatively so one
152 * co-routine cannot be preempted by another, but can be preempted by a task.
154 * If an application comprises of both tasks and co-routines then
159 * @code{c}
160 * // This idle task hook will schedule a co-routine each time it is called.
161 * // The rest of the idle task will execute between co-routine calls.
185 * @code{c}
189 * This macro MUST always be called at the start of a co-routine function.
192 * @code{c}
193 * // Co-routine to be created.
196 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
199 * // Must start every co-routine with a call to crSTART();
204 * // Co-routine functionality goes here.
207 * // Must end every co-routine with a call to crEND();
215 switch( ( ( CRCB_t * ) ( pxCRCB ) )->uxState ) { \
220 * @code{c}
224 * This macro MUST always be called at the end of a co-routine function.
227 * @code{c}
228 * // Co-routine to be created.
231 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
234 * // Must start every co-routine with a call to crSTART();
239 * // Co-routine functionality goes here.
242 * // Must end every co-routine with a call to crEND();
252 * These macros are intended for internal use by the co-routine implementation
256 ( ( CRCB_t * ) ( xHandle ) )->uxState = ( __LINE__ * 2 ); return; \
259 ( ( CRCB_t * ) ( xHandle ) )->uxState = ( ( __LINE__ * 2 ) + 1 ); return; \
264 * @code{c}
268 * Delay a co-routine for a fixed period of time.
270 * crDELAY can only be called from the co-routine function itself - not
271 * from within a function called by the co-routine function. This is because
272 * co-routines do not maintain their own stack.
274 * @param xHandle The handle of the co-routine to delay. This is the xHandle
275 * parameter of the co-routine function.
277 * @param xTickToDelay The number of ticks that the co-routine should delay
283 * @code{c}
284 * // Co-routine to be created.
287 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
292 * // Must start every co-routine with a call to crSTART();
303 * // Must end every co-routine with a call to crEND();
320 * @code{c}
330 * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
333 * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
336 * crQUEUE_SEND can only be called from the co-routine function itself - not
337 * from within a function called by the co-routine function. This is because
338 * co-routines do not maintain their own stack.
340 * See the co-routine section of the WEB documentation for information on
341 * passing data between tasks and co-routines and between ISR's and
342 * co-routines.
344 * @param xHandle The handle of the calling co-routine. This is the xHandle
345 * parameter of the co-routine function.
356 * @param xTickToDelay The number of ticks that the co-routine should block
368 * @code{c}
369 * // Co-routine function that blocks for a fixed period then posts a number onto
373 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
377 * // Co-routines must begin with a call to crSTART().
397 * // Co-routines must end with a call to crEND().
421 * @code{c}
431 * The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
434 * crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
437 * crQUEUE_RECEIVE can only be called from the co-routine function itself - not
438 * from within a function called by the co-routine function. This is because
439 * co-routines do not maintain their own stack.
441 * See the co-routine section of the WEB documentation for information on
442 * passing data between tasks and co-routines and between ISR's and
443 * co-routines.
445 * @param xHandle The handle of the calling co-routine. This is the xHandle
446 * parameter of the co-routine function.
456 * @param xTickToDelay The number of ticks that the co-routine should block
468 * @code{c}
469 * // A co-routine receives the number of an LED to flash from a queue. It
473 …* // Variables in co-routines must be declared static if they must maintain value across a blockin…
477 * // All co-routines must start with a call to crSTART().
487 * // We received the LED to flash - flash it!
515 * @code{c}
524 * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
528 * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
533 * that is being used from within a co-routine.
535 * See the co-routine section of the WEB documentation for information on
536 * passing data between tasks and co-routines and between ISR's and
537 * co-routines.
551 * @return pdTRUE if a co-routine was woken by posting onto the queue. This is
556 * @code{c}
557 * // A co-routine that blocks on a queue waiting for characters to be received.
563 * // All co-routines must start with a call to crSTART().
579 * // All co-routines must end with a call to crEND().
584 * // a co-routine.
597 * // the first time around the loop. If the post causes a co-routine
599 * // In this manner we can ensure that if more than one co-routine is
615 * @code{c}
624 * co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
628 * pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
633 * from a queue that is being used from within a co-routine (a co-routine
636 * See the co-routine section of the WEB documentation for information on
637 * passing data between tasks and co-routines and between ISR's and
638 * co-routines.
647 * @param pxCoRoutineWoken A co-routine may be blocked waiting for space to become
649 * co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise
656 * @code{c}
657 * // A co-routine that posts a character to a queue then blocks for a fixed
661 * // cChar holds its value while this co-routine is blocked and must therefore
666 * // All co-routines must start with a call to crSTART().
699 * // All co-routines must end with a call to crEND().
712 * // xCRWokenByPost will automatically be set to pdTRUE if a co-routine
713 * // is woken by the post - ensuring that only a single co-routine is
729 * This function is intended for internal use by the co-routine macros only.
730 * The macro nature of the co-routine implementation requires that the
734 * Removes the current co-routine from its ready list and places it in the
744 * Removes the highest priority co-routine from the event list and places it in
749 /* *INDENT-OFF* */
753 /* *INDENT-ON* */