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