ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

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?

UserRevisionLine numberNew 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.60
DieterGraef 0:f9b6112278fe 7 *----------------------------------------------------------------------------
DieterGraef 0:f9b6112278fe 8 *
DieterGraef 0:f9b6112278fe 9 * Copyright (c) 1999-2009 KEIL, 2009-2015 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_Conf.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 #include "rt_HAL_CM.h"
DieterGraef 0:f9b6112278fe 42
DieterGraef 0:f9b6112278fe 43 /*----------------------------------------------------------------------------
DieterGraef 0:f9b6112278fe 44 * Global Variables
DieterGraef 0:f9b6112278fe 45 *---------------------------------------------------------------------------*/
DieterGraef 0:f9b6112278fe 46
DieterGraef 0:f9b6112278fe 47 struct OS_ROBIN os_robin;
DieterGraef 0:f9b6112278fe 48
DieterGraef 0:f9b6112278fe 49
DieterGraef 0:f9b6112278fe 50 /*----------------------------------------------------------------------------
DieterGraef 0:f9b6112278fe 51 * Global Functions
DieterGraef 0:f9b6112278fe 52 *---------------------------------------------------------------------------*/
DieterGraef 0:f9b6112278fe 53
DieterGraef 0:f9b6112278fe 54 /*--------------------------- rt_init_robin ---------------------------------*/
DieterGraef 0:f9b6112278fe 55
DieterGraef 0:f9b6112278fe 56 __weak void rt_init_robin (void) {
DieterGraef 0:f9b6112278fe 57 /* Initialize Round Robin variables. */
DieterGraef 0:f9b6112278fe 58 os_robin.task = NULL;
DieterGraef 0:f9b6112278fe 59 os_robin.tout = (U16)os_rrobin;
DieterGraef 0:f9b6112278fe 60 }
DieterGraef 0:f9b6112278fe 61
DieterGraef 0:f9b6112278fe 62 /*--------------------------- rt_chk_robin ----------------------------------*/
DieterGraef 0:f9b6112278fe 63
DieterGraef 0:f9b6112278fe 64 __weak void rt_chk_robin (void) {
DieterGraef 0:f9b6112278fe 65 /* Check if Round Robin timeout expired and switch to the next ready task.*/
DieterGraef 0:f9b6112278fe 66 P_TCB p_new;
DieterGraef 0:f9b6112278fe 67
DieterGraef 0:f9b6112278fe 68 if (os_robin.task != os_rdy.p_lnk) {
DieterGraef 0:f9b6112278fe 69 /* New task was suspended, reset Round Robin timeout. */
DieterGraef 0:f9b6112278fe 70 os_robin.task = os_rdy.p_lnk;
DieterGraef 0:f9b6112278fe 71 os_robin.time = (U16)os_time + os_robin.tout - 1;
DieterGraef 0:f9b6112278fe 72 }
DieterGraef 0:f9b6112278fe 73 if (os_robin.time == (U16)os_time) {
DieterGraef 0:f9b6112278fe 74 /* Round Robin timeout has expired, swap Robin tasks. */
DieterGraef 0:f9b6112278fe 75 os_robin.task = NULL;
DieterGraef 0:f9b6112278fe 76 p_new = rt_get_first (&os_rdy);
DieterGraef 0:f9b6112278fe 77 rt_put_prio ((P_XCB)&os_rdy, p_new);
DieterGraef 0:f9b6112278fe 78 }
DieterGraef 0:f9b6112278fe 79 }
DieterGraef 0:f9b6112278fe 80
DieterGraef 0:f9b6112278fe 81 /*----------------------------------------------------------------------------
DieterGraef 0:f9b6112278fe 82 * end of file
DieterGraef 0:f9b6112278fe 83 *---------------------------------------------------------------------------*/
DieterGraef 0:f9b6112278fe 84