Ethernet test for ECE 4180 and others to find your IP address and do a simple HTTP GET request over port 80.

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Committer:
mkersh3
Date:
Thu Apr 04 05:26:09 2013 +0000
Revision:
0:e7ca326e76ee
Ethernet Test for ECE4180 and others to find their IP Address and do a simple HTTP GET request over port 80.

Who changed what in which revision?

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