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