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_TIME.C
mkersh3 0:e7ca326e76ee 5 * Purpose: Delay and interval wait functions
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_Task.h"
mkersh3 0:e7ca326e76ee 38 #include "rt_Time.h"
mkersh3 0:e7ca326e76ee 39
mkersh3 0:e7ca326e76ee 40 /*----------------------------------------------------------------------------
mkersh3 0:e7ca326e76ee 41 * Global Variables
mkersh3 0:e7ca326e76ee 42 *---------------------------------------------------------------------------*/
mkersh3 0:e7ca326e76ee 43
mkersh3 0:e7ca326e76ee 44 /* Free running system tick counter */
mkersh3 0:e7ca326e76ee 45 U32 os_time;
mkersh3 0:e7ca326e76ee 46
mkersh3 0:e7ca326e76ee 47
mkersh3 0:e7ca326e76ee 48 /*----------------------------------------------------------------------------
mkersh3 0:e7ca326e76ee 49 * Functions
mkersh3 0:e7ca326e76ee 50 *---------------------------------------------------------------------------*/
mkersh3 0:e7ca326e76ee 51
mkersh3 0:e7ca326e76ee 52
mkersh3 0:e7ca326e76ee 53 /*--------------------------- rt_time_get -----------------------------------*/
mkersh3 0:e7ca326e76ee 54
mkersh3 0:e7ca326e76ee 55 U32 rt_time_get (void) {
mkersh3 0:e7ca326e76ee 56 /* Get system time tick */
mkersh3 0:e7ca326e76ee 57 return (os_time);
mkersh3 0:e7ca326e76ee 58 }
mkersh3 0:e7ca326e76ee 59
mkersh3 0:e7ca326e76ee 60
mkersh3 0:e7ca326e76ee 61 /*--------------------------- rt_dly_wait -----------------------------------*/
mkersh3 0:e7ca326e76ee 62
mkersh3 0:e7ca326e76ee 63 void rt_dly_wait (U16 delay_time) {
mkersh3 0:e7ca326e76ee 64 /* Delay task by "delay_time" */
mkersh3 0:e7ca326e76ee 65 rt_block (delay_time, WAIT_DLY);
mkersh3 0:e7ca326e76ee 66 }
mkersh3 0:e7ca326e76ee 67
mkersh3 0:e7ca326e76ee 68
mkersh3 0:e7ca326e76ee 69 /*--------------------------- rt_itv_set ------------------------------------*/
mkersh3 0:e7ca326e76ee 70
mkersh3 0:e7ca326e76ee 71 void rt_itv_set (U16 interval_time) {
mkersh3 0:e7ca326e76ee 72 /* Set interval length and define start of first interval */
mkersh3 0:e7ca326e76ee 73 os_tsk.run->interval_time = interval_time;
mkersh3 0:e7ca326e76ee 74 os_tsk.run->delta_time = interval_time + (U16)os_time;
mkersh3 0:e7ca326e76ee 75 }
mkersh3 0:e7ca326e76ee 76
mkersh3 0:e7ca326e76ee 77
mkersh3 0:e7ca326e76ee 78 /*--------------------------- rt_itv_wait -----------------------------------*/
mkersh3 0:e7ca326e76ee 79
mkersh3 0:e7ca326e76ee 80 void rt_itv_wait (void) {
mkersh3 0:e7ca326e76ee 81 /* Wait for interval end and define start of next one */
mkersh3 0:e7ca326e76ee 82 U16 delta;
mkersh3 0:e7ca326e76ee 83
mkersh3 0:e7ca326e76ee 84 delta = os_tsk.run->delta_time - (U16)os_time;
mkersh3 0:e7ca326e76ee 85 os_tsk.run->delta_time += os_tsk.run->interval_time;
mkersh3 0:e7ca326e76ee 86 if ((delta & 0x8000) == 0) {
mkersh3 0:e7ca326e76ee 87 rt_block (delta, WAIT_ITV);
mkersh3 0:e7ca326e76ee 88 }
mkersh3 0:e7ca326e76ee 89 }
mkersh3 0:e7ca326e76ee 90
mkersh3 0:e7ca326e76ee 91 /*----------------------------------------------------------------------------
mkersh3 0:e7ca326e76ee 92 * end of file
mkersh3 0:e7ca326e76ee 93 *---------------------------------------------------------------------------*/
mkersh3 0:e7ca326e76ee 94