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 /* Copyright (c) 2012 mbed.org */
mkersh3 0:e7ca326e76ee 2 #ifndef THREAD_H
mkersh3 0:e7ca326e76ee 3 #define THREAD_H
mkersh3 0:e7ca326e76ee 4
mkersh3 0:e7ca326e76ee 5 #include <stdint.h>
mkersh3 0:e7ca326e76ee 6 #include "cmsis_os.h"
mkersh3 0:e7ca326e76ee 7
mkersh3 0:e7ca326e76ee 8 namespace rtos {
mkersh3 0:e7ca326e76ee 9
mkersh3 0:e7ca326e76ee 10 /*! The Thread class allow defining, creating, and controlling thread functions in the system. */
mkersh3 0:e7ca326e76ee 11 class Thread {
mkersh3 0:e7ca326e76ee 12 public:
mkersh3 0:e7ca326e76ee 13 /*! Create a new thread, and start it executing the specified function.
mkersh3 0:e7ca326e76ee 14 \param task function to be executed by this thread.
mkersh3 0:e7ca326e76ee 15 \param argument pointer that is passed to the thread function as start argument. (default: NULL).
mkersh3 0:e7ca326e76ee 16 \param priority initial priority of the thread function. (default: osPriorityNormal).
mkersh3 0:e7ca326e76ee 17 \param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
mkersh3 0:e7ca326e76ee 18 \param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
mkersh3 0:e7ca326e76ee 19 */
mkersh3 0:e7ca326e76ee 20 Thread(void (*task)(void const *argument), void *argument=NULL,
mkersh3 0:e7ca326e76ee 21 osPriority priority=osPriorityNormal,
mkersh3 0:e7ca326e76ee 22 uint32_t stack_size=DEFAULT_STACK_SIZE,
mkersh3 0:e7ca326e76ee 23 unsigned char *stack_pointer=NULL);
mkersh3 0:e7ca326e76ee 24
mkersh3 0:e7ca326e76ee 25 /*! Terminate execution of a thread and remove it from Active Threads
mkersh3 0:e7ca326e76ee 26 \return status code that indicates the execution status of the function.
mkersh3 0:e7ca326e76ee 27 */
mkersh3 0:e7ca326e76ee 28 osStatus terminate();
mkersh3 0:e7ca326e76ee 29
mkersh3 0:e7ca326e76ee 30 /*! Set priority of an active thread
mkersh3 0:e7ca326e76ee 31 \param priority new priority value for the thread function.
mkersh3 0:e7ca326e76ee 32 \return status code that indicates the execution status of the function.
mkersh3 0:e7ca326e76ee 33 */
mkersh3 0:e7ca326e76ee 34 osStatus set_priority(osPriority priority);
mkersh3 0:e7ca326e76ee 35
mkersh3 0:e7ca326e76ee 36 /*! Get priority of an active thread
mkersh3 0:e7ca326e76ee 37 \ return current priority value of the thread function.
mkersh3 0:e7ca326e76ee 38 */
mkersh3 0:e7ca326e76ee 39 osPriority get_priority();
mkersh3 0:e7ca326e76ee 40
mkersh3 0:e7ca326e76ee 41 /*! Set the specified Signal Flags of an active thread.
mkersh3 0:e7ca326e76ee 42 \param signals specifies the signal flags of the thread that should be set.
mkersh3 0:e7ca326e76ee 43 \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
mkersh3 0:e7ca326e76ee 44 */
mkersh3 0:e7ca326e76ee 45 int32_t signal_set(int32_t signals);
mkersh3 0:e7ca326e76ee 46
mkersh3 0:e7ca326e76ee 47 /*! Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
mkersh3 0:e7ca326e76ee 48 \param signals wait until all specified signal flags set or 0 for any single signal flag.
mkersh3 0:e7ca326e76ee 49 \param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
mkersh3 0:e7ca326e76ee 50 \return event flag information or error code.
mkersh3 0:e7ca326e76ee 51 */
mkersh3 0:e7ca326e76ee 52 static osEvent signal_wait(int32_t signals, uint32_t millisec=osWaitForever);
mkersh3 0:e7ca326e76ee 53
mkersh3 0:e7ca326e76ee 54
mkersh3 0:e7ca326e76ee 55 /*! Wait for a specified time period in millisec:
mkersh3 0:e7ca326e76ee 56 \param millisec time delay value
mkersh3 0:e7ca326e76ee 57 \return status code that indicates the execution status of the function.
mkersh3 0:e7ca326e76ee 58 */
mkersh3 0:e7ca326e76ee 59 static osStatus wait(uint32_t millisec);
mkersh3 0:e7ca326e76ee 60
mkersh3 0:e7ca326e76ee 61 /*! Pass control to next thread that is in state READY.
mkersh3 0:e7ca326e76ee 62 \return status code that indicates the execution status of the function.
mkersh3 0:e7ca326e76ee 63 */
mkersh3 0:e7ca326e76ee 64 static osStatus yield();
mkersh3 0:e7ca326e76ee 65
mkersh3 0:e7ca326e76ee 66 /*! Get the thread id of the current running thread.
mkersh3 0:e7ca326e76ee 67 \return thread ID for reference by other functions or NULL in case of error.
mkersh3 0:e7ca326e76ee 68 */
mkersh3 0:e7ca326e76ee 69 static osThreadId gettid();
mkersh3 0:e7ca326e76ee 70
mkersh3 0:e7ca326e76ee 71 private:
mkersh3 0:e7ca326e76ee 72 osThreadId _tid;
mkersh3 0:e7ca326e76ee 73 osThreadDef_t _thread_def;
mkersh3 0:e7ca326e76ee 74 };
mkersh3 0:e7ca326e76ee 75
mkersh3 0:e7ca326e76ee 76 }
mkersh3 0:e7ca326e76ee 77 #endif