
NRF: receive, ntp, Data to Sd-card working
Dependencies: F7_Ethernet mbed BSP_DISCO_F746NG Test_Mainboard SDFileSystem RF24
TARGET_ARM7/rt_Robin.c@4:5ecb71f149bf, 2021-06-20 (annotated)
- Committer:
- lowlowry
- Date:
- Sun Jun 20 13:48:06 2021 +0000
- Revision:
- 4:5ecb71f149bf
- Parent:
- 0:d984976f1f1c
NRF: receive, ntp, Data to Sd-card working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leo44 | 0:d984976f1f1c | 1 | /*---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 2 | * RL-ARM - RTX |
leo44 | 0:d984976f1f1c | 3 | *---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 4 | * Name: RT_ROBIN.C |
leo44 | 0:d984976f1f1c | 5 | * Purpose: Round Robin Task switching |
leo44 | 0:d984976f1f1c | 6 | * Rev.: V4.60 |
leo44 | 0:d984976f1f1c | 7 | *---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 8 | * |
leo44 | 0:d984976f1f1c | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH |
leo44 | 0:d984976f1f1c | 10 | * All rights reserved. |
leo44 | 0:d984976f1f1c | 11 | * Redistribution and use in source and binary forms, with or without |
leo44 | 0:d984976f1f1c | 12 | * modification, are permitted provided that the following conditions are met: |
leo44 | 0:d984976f1f1c | 13 | * - Redistributions of source code must retain the above copyright |
leo44 | 0:d984976f1f1c | 14 | * notice, this list of conditions and the following disclaimer. |
leo44 | 0:d984976f1f1c | 15 | * - Redistributions in binary form must reproduce the above copyright |
leo44 | 0:d984976f1f1c | 16 | * notice, this list of conditions and the following disclaimer in the |
leo44 | 0:d984976f1f1c | 17 | * documentation and/or other materials provided with the distribution. |
leo44 | 0:d984976f1f1c | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
leo44 | 0:d984976f1f1c | 19 | * to endorse or promote products derived from this software without |
leo44 | 0:d984976f1f1c | 20 | * specific prior written permission. |
leo44 | 0:d984976f1f1c | 21 | * |
leo44 | 0:d984976f1f1c | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
leo44 | 0:d984976f1f1c | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
leo44 | 0:d984976f1f1c | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
leo44 | 0:d984976f1f1c | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
leo44 | 0:d984976f1f1c | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
leo44 | 0:d984976f1f1c | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
leo44 | 0:d984976f1f1c | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
leo44 | 0:d984976f1f1c | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
leo44 | 0:d984976f1f1c | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
leo44 | 0:d984976f1f1c | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
leo44 | 0:d984976f1f1c | 32 | * POSSIBILITY OF SUCH DAMAGE. |
leo44 | 0:d984976f1f1c | 33 | *---------------------------------------------------------------------------*/ |
leo44 | 0:d984976f1f1c | 34 | |
leo44 | 0:d984976f1f1c | 35 | #include "rt_TypeDef.h" |
leo44 | 0:d984976f1f1c | 36 | #include "RTX_Conf.h" |
leo44 | 0:d984976f1f1c | 37 | #include "rt_List.h" |
leo44 | 0:d984976f1f1c | 38 | #include "rt_Task.h" |
leo44 | 0:d984976f1f1c | 39 | #include "rt_Time.h" |
leo44 | 0:d984976f1f1c | 40 | #include "rt_Robin.h" |
leo44 | 0:d984976f1f1c | 41 | #include "rt_HAL_CM.h" |
leo44 | 0:d984976f1f1c | 42 | |
leo44 | 0:d984976f1f1c | 43 | /*---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 44 | * Global Variables |
leo44 | 0:d984976f1f1c | 45 | *---------------------------------------------------------------------------*/ |
leo44 | 0:d984976f1f1c | 46 | |
leo44 | 0:d984976f1f1c | 47 | struct OS_ROBIN os_robin; |
leo44 | 0:d984976f1f1c | 48 | |
leo44 | 0:d984976f1f1c | 49 | |
leo44 | 0:d984976f1f1c | 50 | /*---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 51 | * Global Functions |
leo44 | 0:d984976f1f1c | 52 | *---------------------------------------------------------------------------*/ |
leo44 | 0:d984976f1f1c | 53 | |
leo44 | 0:d984976f1f1c | 54 | /*--------------------------- rt_init_robin ---------------------------------*/ |
leo44 | 0:d984976f1f1c | 55 | |
leo44 | 0:d984976f1f1c | 56 | __weak void rt_init_robin (void) { |
leo44 | 0:d984976f1f1c | 57 | /* Initialize Round Robin variables. */ |
leo44 | 0:d984976f1f1c | 58 | os_robin.task = NULL; |
leo44 | 0:d984976f1f1c | 59 | os_robin.tout = (U16)os_rrobin; |
leo44 | 0:d984976f1f1c | 60 | } |
leo44 | 0:d984976f1f1c | 61 | |
leo44 | 0:d984976f1f1c | 62 | /*--------------------------- rt_chk_robin ----------------------------------*/ |
leo44 | 0:d984976f1f1c | 63 | |
leo44 | 0:d984976f1f1c | 64 | __weak void rt_chk_robin (void) { |
leo44 | 0:d984976f1f1c | 65 | /* Check if Round Robin timeout expired and switch to the next ready task.*/ |
leo44 | 0:d984976f1f1c | 66 | P_TCB p_new; |
leo44 | 0:d984976f1f1c | 67 | |
leo44 | 0:d984976f1f1c | 68 | if (os_robin.task != os_rdy.p_lnk) { |
leo44 | 0:d984976f1f1c | 69 | /* New task was suspended, reset Round Robin timeout. */ |
leo44 | 0:d984976f1f1c | 70 | os_robin.task = os_rdy.p_lnk; |
leo44 | 0:d984976f1f1c | 71 | os_robin.time = (U16)os_time + os_robin.tout - 1; |
leo44 | 0:d984976f1f1c | 72 | } |
leo44 | 0:d984976f1f1c | 73 | if (os_robin.time == (U16)os_time) { |
leo44 | 0:d984976f1f1c | 74 | /* Round Robin timeout has expired, swap Robin tasks. */ |
leo44 | 0:d984976f1f1c | 75 | os_robin.task = NULL; |
leo44 | 0:d984976f1f1c | 76 | p_new = rt_get_first (&os_rdy); |
leo44 | 0:d984976f1f1c | 77 | rt_put_prio ((P_XCB)&os_rdy, p_new); |
leo44 | 0:d984976f1f1c | 78 | } |
leo44 | 0:d984976f1f1c | 79 | } |
leo44 | 0:d984976f1f1c | 80 | |
leo44 | 0:d984976f1f1c | 81 | /*---------------------------------------------------------------------------- |
leo44 | 0:d984976f1f1c | 82 | * end of file |
leo44 | 0:d984976f1f1c | 83 | *---------------------------------------------------------------------------*/ |
leo44 | 0:d984976f1f1c | 84 |