diff options
Diffstat (limited to 'tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core')
7 files changed, 0 insertions, 495 deletions
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/IOStream.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/IOStream.h deleted file mode 100644 index 6d411b8e4b..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/IOStream.h +++ /dev/null @@ -1,59 +0,0 @@ -/* IOStream.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef IOSTREAM_H_ -#define IOSTREAM_H_ - -#include "rtos.h" - -class IStream -{ -public: - //IStream(); - //virtual ~IStream(); - - //0 for non-blocking (returns immediately), osWaitForever for infinite blocking - virtual int read(uint8_t* buf, size_t* pLength, size_t maxLength, uint32_t timeout=osWaitForever) = 0; - virtual size_t available() = 0; - virtual int waitAvailable(uint32_t timeout=osWaitForever) = 0; //Wait for data to be available - virtual int abortRead() = 0; //Abort current reading (or waiting) operation -}; - -class OStream -{ -public: - //OStream(); - //virtual ~OStream(); - - //0 for non-blocking (returns immediately), osWaitForever for infinite blocking - virtual int write(uint8_t* buf, size_t length, uint32_t timeout=osWaitForever) = 0; - virtual size_t space() = 0; - virtual int waitSpace(uint32_t timeout=osWaitForever) = 0; //Wait for space to be available - virtual int abortWrite() = 0; //Abort current writing (or waiting) operation -}; - -class IOStream : public IStream, public OStream -{ -public: - //IOStream(); - //virtual ~IOStream(); -}; - - -#endif /* IOSTREAM_H_ */ diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/MtxCircBuffer.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/MtxCircBuffer.h deleted file mode 100644 index b011693eb4..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/MtxCircBuffer.h +++ /dev/null @@ -1,95 +0,0 @@ -/* MtxCircBuf.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef MTXCIRCBUFFER_H -#define MTXCIRCBUFFER_H - -#include "rtos.h" - -//Mutex protected circualr buffer -template<typename T, int size> -class MtxCircBuffer -{ -public: - MtxCircBuffer() //: - //mtx() - { - write = 0; - read = 0; - } - - bool isFull() - { - mtx.lock(); - bool r = (((write + 1) % size) == read); - mtx.unlock(); - return r; - } - - bool isEmpty() - { - mtx.lock(); - bool r = (read == write); - mtx.unlock(); - return r; - } - - void queue(T k) - { - mtx.lock(); - buf[write++] = k; - write %= size; - if (isFull()) - { - read++; - read %= size; - } - mtx.unlock(); - } - - uint16_t available() - { - mtx.lock(); - uint16_t a = (write >= read) ? (write - read) : (size - read + write); - mtx.unlock(); - return a; - } - - bool dequeue(T * c) - { - mtx.lock(); - bool empty = (read == write); - if (!empty) - { - *c = buf[read++]; - read %= size; - } - mtx.unlock(); - return (!empty); - } - -private: - volatile uint16_t write; - volatile uint16_t read; - volatile T buf[size]; - Mutex mtx; -}; - -#endif - diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/config.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/config.h deleted file mode 100644 index 508424dc66..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/config.h +++ /dev/null @@ -1,27 +0,0 @@ -/* config.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef CONFIG_H_ -#define CONFIG_H_ - - -//Configuration -#define AT_THREAD_PRIORITY 0 - - -#endif /* CONFIG_H_ */ diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.cpp b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.cpp deleted file mode 100644 index 4314e2342f..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* dbg.cpp */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "dbg.h" - -#include "mbed.h" -#include "rtos.h" - -#include <cstdio> -#include <cstdarg> - -using namespace std; - -static Serial debug_pc(USBTX, USBRX); - -static char debug_newline[3]; - -static void debug_lock(bool set) -{ - static Mutex* mtx = new Mutex(); //Singleton runtime initialisation to avoid static initialisation chaos problems - static bool init = false; - if(set) - { - mtx->lock(); - if(!init) - { - strncpy( debug_newline, "\n", 2 ); - printf("[START]\n"); - fflush(stdout); - init = true; - } - } - else - { - mtx->unlock(); - } -} - -void debug_init() -{ - debug_lock(true); //Force init - debug_lock(false); -} - -void debug_set_newline(const char* newline) -{ - debug_lock(true); - strncpy( debug_newline, newline, 2 ); - debug_newline[2] = '\0'; - debug_lock(false); -} - -void debug_set_speed(int speed) -{ - debug_pc.baud(speed); -} - -void debug(int level, const char* module, int line, const char* fmt, ...) -{ - debug_lock(true); - switch(level) - { - default: - case 1: - printf("[ERROR]"); - break; - case 2: - printf("[WARN]"); - break; - case 3: - printf("[INFO]"); - break; - case 4: - printf("[DBG]"); - break; - } - - printf(" Module %s - Line %d: ", module, line); - - va_list argp; - - va_start(argp, fmt); - vprintf(fmt, argp); - va_end(argp); - - printf(debug_newline); - - fflush(stdout); - - debug_lock(false); - -} - -void debug_error(const char* module, int line, int ret) -{ - debug_lock(true); - printf("[RC] Module %s - Line %d : Error %d\n", module, line, ret); - fflush(stdout); - debug_lock(false); -} - -void debug_exact(const char* fmt, ...) -{ - debug_lock(true); - va_list argp; - - va_start(argp, fmt); - vprintf(fmt, argp); - va_end(argp); - debug_lock(false); -} diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.h deleted file mode 100644 index 2ff24e1b31..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/dbg.h +++ /dev/null @@ -1,79 +0,0 @@ -/* dbg.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef DBG_H_ -#define DBG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -void debug_init(void); -void debug(int level, const char* module, int line, const char* fmt, ...); -void debug_set_newline(const char* newline); -void debug_set_speed(int speed); -void debug_error(const char* module, int line, int ret); -void debug_exact(const char* fmt, ...); - -#define DBG_INIT() do{ debug_init(); }while(0) - -#define DBG_SET_NEWLINE( x ) do{ debug_set_newline(x); }while(0) - -#define DBG_SET_SPEED( x ) do{ debug_set_speed(x); }while(0) - -#if __DEBUG__ > 0 -#ifndef __MODULE__ -#error "__MODULE__ must be defined" -#endif -#endif - -#if __DEBUG__ >= 1 -#define ERR(...) do{ debug(1, __MODULE__, __LINE__, __VA_ARGS__); }while(0) -#else -#define ERR(...) do{ }while(0) -#endif - -#if __DEBUG__ >= 2 -#define WARN(...) do{ debug(2, __MODULE__, __LINE__, __VA_ARGS__); }while(0) -#else -#define WARN(...) do{ }while(0) -#endif - -#if __DEBUG__ >= 3 -#define INFO(...) do{ debug(3, __MODULE__, __LINE__, __VA_ARGS__); }while(0) -#define CHECK(ret) do{ if(ret){ debug_error(__MODULE__, __LINE__, ret); } }while(0) -#else -#define INFO(...) do{ }while(0) -#define CHECK(ret) do{ }while(0) -#endif - -#if __DEBUG__ >= 4 -#define DBG(...) do{ debug(4, __MODULE__, __LINE__, __VA_ARGS__); }while(0) -#define DBGX(...) do{ debug_exact(__VA_ARGS__); }while(0) -#else -#define DBG(...) do{ }while(0) -#define DBGX(...) do{ }while(0) -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* DBG_H_ */ diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/errors.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/errors.h deleted file mode 100644 index 73ca00c1c4..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/errors.h +++ /dev/null @@ -1,47 +0,0 @@ -/* errors.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef ERRORS_H_ -#define ERRORS_H_ - -/** \page Network-related errors */ - -#define OK 0 //No error - -#define NET_FULL 1 //>All available resources are already used -#define NET_EMPTY 2 //>No resource -#define NET_NOTFOUND 3 //>Element cannot be found -#define NET_INVALID 4 //>Invalid -#define NET_CONTEXT 5 //>Called in a wrong context (eg during an interrupt) -#define NET_TIMEOUT 6 //>Timeout -#define NET_UNKNOWN 7 //>Unknown error -#define NET_OVERFLOW 8 //>Overflow -#define NET_PROCESSING 9 //>Command is processing -#define NET_INTERRUPTED 10 //>Current operation has been interrupted -#define NET_MOREINFO 11 //>More info on this error can be retrieved elsewhere (eg in a parameter passed as ptr) -#define NET_ABORT 12 //>Current operation must be aborted -#define NET_DIFF 13 //>Items that should match are different -#define NET_AUTH 14 //>Authentication failed -#define NET_PROTOCOL 15 //>Protocol error -#define NET_OOM 16 //>Out of memory -#define NET_CONN 17 //>Connection error -#define NET_CLOSED 18 //>Connection was closed by remote end -#define NET_TOOSMALL 19 //>Buffer is too small - -#endif /* ERRORS_H_ */ diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/fwk.h b/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/fwk.h deleted file mode 100644 index 4efc281c0e..0000000000 --- a/tmk_core/tool/mbed/mbed-sdk/libraries/net/cellular/CellularModem/core/fwk.h +++ /dev/null @@ -1,61 +0,0 @@ -/* fwk.h */ -/* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef FWK_H_ -#define FWK_H_ - -#include "config.h" - -#include "string.h" -//using namespace std; - -#include "stdint.h" -typedef unsigned int size_t; - -#ifndef __cplusplus -//boolean type compatibility -typedef byte bool; -#define true 1 -#define false 0 -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -#define CR '\x0D' -#define LF '\x0A' -#define GD '\x3E' -#define BRK '\x1A' - -//Custom utility classes -#include "IOStream.h" -//#include "String.h" - -//Error codes -#include "errors.h" - -//Debug -#include "dbg.h" - -//Utility macros -#define MIN(x,y) (((x)<(y))?(x):(y)) -#define MAX(x,y) (((x)>(y))?(x):(y)) - -#endif /* FWK_H_ */ |