うおーるぼっとをWiiリモコンでコントロールする新しいプログラムです。 以前のものより、Wiiリモコンが早く繋がる様になりました。 It is a program which controls A with the Wii remote. ※ A Bluetooth dongle and a Wii remote control are needed.
Dependencies: USBHost mbed FATFileSystem mbed-rtos
USBHost/mbed-rtos/rtx/rt_Robin.c@0:fccb789424fc, 2013-06-10 (annotated)
- Committer:
- jksoft
- Date:
- Mon Jun 10 16:01:50 2013 +0000
- Revision:
- 0:fccb789424fc
1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:fccb789424fc | 1 | /*---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 2 | * RL-ARM - RTX |
jksoft | 0:fccb789424fc | 3 | *---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 4 | * Name: RT_ROBIN.C |
jksoft | 0:fccb789424fc | 5 | * Purpose: Round Robin Task switching |
jksoft | 0:fccb789424fc | 6 | * Rev.: V4.60 |
jksoft | 0:fccb789424fc | 7 | *---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 8 | * |
jksoft | 0:fccb789424fc | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH |
jksoft | 0:fccb789424fc | 10 | * All rights reserved. |
jksoft | 0:fccb789424fc | 11 | * Redistribution and use in source and binary forms, with or without |
jksoft | 0:fccb789424fc | 12 | * modification, are permitted provided that the following conditions are met: |
jksoft | 0:fccb789424fc | 13 | * - Redistributions of source code must retain the above copyright |
jksoft | 0:fccb789424fc | 14 | * notice, this list of conditions and the following disclaimer. |
jksoft | 0:fccb789424fc | 15 | * - Redistributions in binary form must reproduce the above copyright |
jksoft | 0:fccb789424fc | 16 | * notice, this list of conditions and the following disclaimer in the |
jksoft | 0:fccb789424fc | 17 | * documentation and/or other materials provided with the distribution. |
jksoft | 0:fccb789424fc | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
jksoft | 0:fccb789424fc | 19 | * to endorse or promote products derived from this software without |
jksoft | 0:fccb789424fc | 20 | * specific prior written permission. |
jksoft | 0:fccb789424fc | 21 | * |
jksoft | 0:fccb789424fc | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
jksoft | 0:fccb789424fc | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
jksoft | 0:fccb789424fc | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
jksoft | 0:fccb789424fc | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
jksoft | 0:fccb789424fc | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
jksoft | 0:fccb789424fc | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
jksoft | 0:fccb789424fc | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
jksoft | 0:fccb789424fc | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
jksoft | 0:fccb789424fc | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
jksoft | 0:fccb789424fc | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
jksoft | 0:fccb789424fc | 32 | * POSSIBILITY OF SUCH DAMAGE. |
jksoft | 0:fccb789424fc | 33 | *---------------------------------------------------------------------------*/ |
jksoft | 0:fccb789424fc | 34 | |
jksoft | 0:fccb789424fc | 35 | #include "rt_TypeDef.h" |
jksoft | 0:fccb789424fc | 36 | #include "RTX_Config.h" |
jksoft | 0:fccb789424fc | 37 | #include "rt_List.h" |
jksoft | 0:fccb789424fc | 38 | #include "rt_Task.h" |
jksoft | 0:fccb789424fc | 39 | #include "rt_Time.h" |
jksoft | 0:fccb789424fc | 40 | #include "rt_Robin.h" |
jksoft | 0:fccb789424fc | 41 | #include "rt_HAL_CM.h" |
jksoft | 0:fccb789424fc | 42 | |
jksoft | 0:fccb789424fc | 43 | /*---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 44 | * Global Variables |
jksoft | 0:fccb789424fc | 45 | *---------------------------------------------------------------------------*/ |
jksoft | 0:fccb789424fc | 46 | |
jksoft | 0:fccb789424fc | 47 | struct OS_ROBIN os_robin; |
jksoft | 0:fccb789424fc | 48 | |
jksoft | 0:fccb789424fc | 49 | |
jksoft | 0:fccb789424fc | 50 | /*---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 51 | * Global Functions |
jksoft | 0:fccb789424fc | 52 | *---------------------------------------------------------------------------*/ |
jksoft | 0:fccb789424fc | 53 | |
jksoft | 0:fccb789424fc | 54 | /*--------------------------- rt_init_robin ---------------------------------*/ |
jksoft | 0:fccb789424fc | 55 | |
jksoft | 0:fccb789424fc | 56 | __weak void rt_init_robin (void) { |
jksoft | 0:fccb789424fc | 57 | /* Initialize Round Robin variables. */ |
jksoft | 0:fccb789424fc | 58 | os_robin.task = NULL; |
jksoft | 0:fccb789424fc | 59 | os_robin.tout = (U16)os_rrobin; |
jksoft | 0:fccb789424fc | 60 | } |
jksoft | 0:fccb789424fc | 61 | |
jksoft | 0:fccb789424fc | 62 | /*--------------------------- rt_chk_robin ----------------------------------*/ |
jksoft | 0:fccb789424fc | 63 | |
jksoft | 0:fccb789424fc | 64 | __weak void rt_chk_robin (void) { |
jksoft | 0:fccb789424fc | 65 | /* Check if Round Robin timeout expired and switch to the next ready task.*/ |
jksoft | 0:fccb789424fc | 66 | P_TCB p_new; |
jksoft | 0:fccb789424fc | 67 | |
jksoft | 0:fccb789424fc | 68 | if (os_robin.task != os_rdy.p_lnk) { |
jksoft | 0:fccb789424fc | 69 | /* New task was suspended, reset Round Robin timeout. */ |
jksoft | 0:fccb789424fc | 70 | os_robin.task = os_rdy.p_lnk; |
jksoft | 0:fccb789424fc | 71 | os_robin.time = (U16)os_time + os_robin.tout - 1; |
jksoft | 0:fccb789424fc | 72 | } |
jksoft | 0:fccb789424fc | 73 | if (os_robin.time == (U16)os_time) { |
jksoft | 0:fccb789424fc | 74 | /* Round Robin timeout has expired, swap Robin tasks. */ |
jksoft | 0:fccb789424fc | 75 | os_robin.task = NULL; |
jksoft | 0:fccb789424fc | 76 | p_new = rt_get_first (&os_rdy); |
jksoft | 0:fccb789424fc | 77 | rt_put_prio ((P_XCB)&os_rdy, p_new); |
jksoft | 0:fccb789424fc | 78 | } |
jksoft | 0:fccb789424fc | 79 | } |
jksoft | 0:fccb789424fc | 80 | |
jksoft | 0:fccb789424fc | 81 | /*---------------------------------------------------------------------------- |
jksoft | 0:fccb789424fc | 82 | * end of file |
jksoft | 0:fccb789424fc | 83 | *---------------------------------------------------------------------------*/ |
jksoft | 0:fccb789424fc | 84 |