Dieter Graef / Mbed 2 deprecated DISCO-F746NG_USB_Host

Dependencies:   USBHost_DISCO-F746NG mbed

Committer:
DieterGraef
Date:
Fri Jun 17 09:01:37 2016 +0000
Revision:
2:ca1b5b911ba8
Parent:
0:af2040964256
Demo program now uses USB Stick on high speed and HID on fast speed interface. Move your mouse!

Who changed what in which revision?

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