From 871480933a1c28f8a9fed4c4d34d06c439a7a422 Mon Sep 17 00:00:00 2001 From: Srikant Patnaik Date: Sun, 11 Jan 2015 12:28:04 +0530 Subject: Moved, renamed, and deleted files The original directory structure was scattered and unorganized. Changes are basically to make it look like kernel structure. --- .../src/NMI_OsWrapper/OsConfig/NMI_OSConfig.h | 55 +++ .../src/NMI_OsWrapper/OsKconfig/Kconfig | 116 +++++ .../binary/windows/NMI_OsWrapper_win32.lib | Bin 0 -> 356008 bytes .../src/NMI_OsWrapper/doc/PublicAPI.doxygen | 263 ++++++++++ .../src/NMI_OsWrapper/doc/runDoxygen.bat | 1 + .../src/NMI_OsWrapper/include/NMI_ErrorSupport.h | 84 ++++ .../src/NMI_OsWrapper/include/NMI_Event.h | 124 +++++ .../src/NMI_OsWrapper/include/NMI_FileOps.h | 456 +++++++++++++++++ .../src/NMI_OsWrapper/include/NMI_Log.h | 43 ++ .../src/NMI_OsWrapper/include/NMI_Math.h | 368 ++++++++++++++ .../src/NMI_OsWrapper/include/NMI_Memory.h | 330 +++++++++++++ .../src/NMI_OsWrapper/include/NMI_MsgQueue.h | 134 +++++ .../src/NMI_OsWrapper/include/NMI_OSWrapper.h | 133 +++++ .../src/NMI_OsWrapper/include/NMI_Semaphore.h | 116 +++++ .../src/NMI_OsWrapper/include/NMI_Sleep.h | 45 ++ .../src/NMI_OsWrapper/include/NMI_Socket.h | 95 ++++ .../src/NMI_OsWrapper/include/NMI_StrUtils.h | 415 ++++++++++++++++ .../src/NMI_OsWrapper/include/NMI_Thread.h | 155 ++++++ .../src/NMI_OsWrapper/include/NMI_Time.h | 207 ++++++++ .../src/NMI_OsWrapper/include/NMI_Timer.h | 154 ++++++ .../src/NMI_OsWrapper/include/NMI_platform.h | 207 ++++++++ .../src/NMI_OsWrapper/source/linux/Makefile | 67 +++ .../source/linux/include/NMI_platform.h | 209 ++++++++ .../NMI_OsWrapper/source/linux/source/NMI_Event.c | 112 +++++ .../source/linux/source/NMI_FileOps.c | 539 +++++++++++++++++++++ .../NMI_OsWrapper/source/linux/source/NMI_Math.c | 440 +++++++++++++++++ .../NMI_OsWrapper/source/linux/source/NMI_Memory.c | 72 +++ .../source/linux/source/NMI_MsgQueue.c | 213 ++++++++ .../source/linux/source/NMI_Semaphore.c | 67 +++ .../NMI_OsWrapper/source/linux/source/NMI_Sleep.c | 27 ++ .../NMI_OsWrapper/source/linux/source/NMI_Socket.c | 188 +++++++ .../source/linux/source/NMI_StrUtils.c | 483 ++++++++++++++++++ .../NMI_OsWrapper/source/linux/source/NMI_Thread.c | 52 ++ .../NMI_OsWrapper/source/linux/source/NMI_Time.c | 167 +++++++ .../NMI_OsWrapper/source/linux/source/NMI_Timer.c | 181 +++++++ .../src/NMI_OsWrapper/source/linuxkernel/Makefile | 71 +++ .../source/linuxkernel/include/NMI_platform.h | 184 +++++++ .../source/linuxkernel/source/NMI_Memory.c | 71 +++ .../source/linuxkernel/source/NMI_MsgQueue.c | 234 +++++++++ .../source/linuxkernel/source/NMI_Semaphore.c | 78 +++ .../source/linuxkernel/source/NMI_Sleep.c | 39 ++ .../source/linuxkernel/source/NMI_StrUtils.c | 482 ++++++++++++++++++ .../source/linuxkernel/source/NMI_Thread.c | 38 ++ .../source/linuxkernel/source/NMI_Time.c | 163 +++++++ .../source/linuxkernel/source/NMI_Timer.c | 51 ++ .../source/win32/include/NMI_platform.h | 160 ++++++ 46 files changed, 7889 insertions(+) create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsConfig/NMI_OSConfig.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsKconfig/Kconfig create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/binary/windows/NMI_OsWrapper_win32.lib create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/PublicAPI.doxygen create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/runDoxygen.bat create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_ErrorSupport.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Event.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_FileOps.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Log.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Math.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Memory.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_MsgQueue.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_OSWrapper.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Semaphore.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Sleep.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Socket.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_StrUtils.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Thread.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Time.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Timer.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_platform.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/Makefile create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/include/NMI_platform.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Event.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_FileOps.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Math.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Memory.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_MsgQueue.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Semaphore.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Sleep.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Socket.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_StrUtils.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Thread.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Time.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Timer.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/Makefile create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/include/NMI_platform.h create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Memory.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_MsgQueue.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Semaphore.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Sleep.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_StrUtils.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Thread.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Time.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Timer.c create mode 100755 drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/win32/include/NMI_platform.h (limited to 'drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper') diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsConfig/NMI_OSConfig.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsConfig/NMI_OSConfig.h new file mode 100755 index 00000000..0e723261 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsConfig/NMI_OSConfig.h @@ -0,0 +1,55 @@ +/* + * Automatically generated C config: don't edit + * Tue Aug 10 19:52:12 2010 + */ + +/* OSes supported */ +#define NMI_WIN32 0 +#define NMI_NU 1 +#define NMI_MTK 2 +#define NMI_LINUX 3 +#define NMI_LINUXKERNEL 4 +/* the current OS */ +//#define NMI_PLATFORM NMI_LINUXKERNEL + + +/* Logs options */ +#define NMI_LOGS_NOTHING 0 +#define NMI_LOGS_WARN 1 +#define NMI_LOGS_WARN_INFO 2 +#define NMI_LOGS_WARN_INFO_DBG 3 +#define NMI_LOGS_WARN_INFO_DBG_FN 4 +#define NMI_LOGS_ALL 5 + +#define NMI_LOG_VERBOSITY_LEVEL NMI_LOGS_ALL + +/* OS features supported */ + +#define CONFIG_NMI_THREAD_FEATURE 1 +//#define CONFIG_NMI_THREAD_SUSPEND_CONTROL 1 +//#define CONFIG_NMI_THREAD_STRICT_PRIORITY 1 +#define CONFIG_NMI_SEMAPHORE_FEATURE 1 +//#define CONFIG_NMI_SEMAPHORE_TIMEOUT 1 +#define CONFIG_NMI_SLEEP_FEATURE 1 +#define CONFIG_NMI_SLEEP_HI_RES 1 +#define CONFIG_NMI_TIMER_FEATURE 1 +//#define CONFIG_NMI_TIMER_PERIODIC 1 +#define CONFIG_NMI_MEMORY_FEATURE 1 +//#define CONFIG_NMI_MEMORY_POOLS 1 +//#define CONFIG_NMI_MEMORY_DEBUG 1 +//#define CONFIG_NMI_ASSERTION_SUPPORT 1 +#define CONFIG_NMI_STRING_UTILS 1 +#define CONFIG_NMI_MSG_QUEUE_FEATURE +//#define CONFIG_NMI_MSG_QUEUE_IPC_NAME +//#define CONFIG_NMI_MSG_QUEUE_TIMEOUT +//#define CONFIG_NMI_FILE_OPERATIONS_FEATURE +//#define CONFIG_NMI_FILE_OPERATIONS_STRING_API +//#define CONFIG_NMI_FILE_OPERATIONS_PATH_API +#define CONFIG_NMI_TIME_FEATURE +//#define CONFIG_NMI_EVENT_FEATURE +//#define CONFIG_NMI_EVENT_TIMEOUT +//#define CONFIG_NMI_SOCKET_FEATURE +//#define CONFIG_NMI_MATH_OPERATIONS_FEATURE +//#define CONFIG_NMI_EXTENDED_FILE_OPERATIONS +//#define CONFIG_NMI_EXTENDED_STRING_OPERATIONS +//#define CONFIG_NMI_EXTENDED_TIME_OPERATIONS diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsKconfig/Kconfig b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsKconfig/Kconfig new file mode 100755 index 00000000..9da064d8 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/OsKconfig/Kconfig @@ -0,0 +1,116 @@ + +menu "THREADS" + +config NMI_THREAD_FEATURE + boolean "Enable Using Threads" + +config NMI_THREAD_SUSPEND_CONTROL + boolean "Enable Suspending Thread" + depends on NMI_THREAD_FEATURE + +config NMI_THREAD_STRICT_PRIORITY + boolean "Enable Setting Thread Priority" + depends on NMI_THREAD_FEATURE + +endmenu + +menu "SEMAPHORES" + +config NMI_SEMAPHORE_FEATURE + boolean "Enable Using Semaphores" + +config NMI_SEMAPHORE_TIMEOUT + boolean "Enable Semaphore Timeout" + depends on NMI_SEMAPHORE_FEATURE + +endmenu + +menu "SLEEP" + +config NMI_SLEEP_FEATURE + boolean "Enable Using Sleep" + +config NMI_SLEEP_HI_RES + boolean "Enable High Resolution Sleep" + depends on NMI_SLEEP_FEATURE + +endmenu + +menu "TIMER" + +config NMI_TIMER_FEATURE + boolean "Enable Using Timer" + +config NMI_TIMER_PERIODIC + boolean "Enable periodic Timer support" + depends on NMI_TIMER_FEATURE + +endmenu + +menu "MEMORY" + +config NMI_MEMORY_FEATURE + boolean "Enable dynamic memory management" + +config NMI_MEMORY_POOLS + boolean "Enable memory manager pools" + depends on NMI_MEMORY_FEATURE + +config NMI_MEMORY_DEBUG + boolean "Enable memory debugging and tracing (could be heavy wieght)" + depends on NMI_MEMORY_FEATURE + +endmenu + +menu "ASSERSIONS" + +config NMI_ASSERTION_SUPPORT + boolean "Enable assertions" + +endmenu + +menu "Utilities" + +config NMI_STRING_UTILS + boolean "Enable String standard utilities (usually found in string.h)" + +endmenu + +menu "Message Queue" + +config NMI_MSG_QUEUE_FEATURE + boolean "Enable Message Queues" + +config NMI_MSG_QUEUE_IPC_NAME + boolean "Enable IPC communications via named message queues" + depends on NMI_MSG_QUEUE_FEATURE + +config NMI_MSG_QUEUE_TIMEOUT + boolean "Enable Message Queue timeout" + depends on NMI_MSG_QUEUE_FEATURE + +endmenu + +menu "File operations" + +config NMI_FILE_OPERATIONS_FEATURE + boolean "Enable File operations" + +config NMI_FILE_OPERATIONS_STRING_API + boolean "Enable API to read/write strings to files" + depends on NMI_FILE_OPERATIONS_FEATURE + +endmenu + +menu "Events" + +config NMI_EVENT_FEATURE + boolean "Enable Event objects" + +config NMI_EVENT_TIMEOUT + boolean "Enable Event timeout" + depends on NMI_EVENT_FEATURE + +endmenu + + diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/binary/windows/NMI_OsWrapper_win32.lib b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/binary/windows/NMI_OsWrapper_win32.lib new file mode 100755 index 00000000..f76d5bfd Binary files /dev/null and b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/binary/windows/NMI_OsWrapper_win32.lib differ diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/PublicAPI.doxygen b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/PublicAPI.doxygen new file mode 100755 index 00000000..7f92699e --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/PublicAPI.doxygen @@ -0,0 +1,263 @@ +# Doxyfile 1.5.2 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = NMI_OsWrapper +PROJECT_NUMBER = +OUTPUT_DIRECTORY = +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = "C:/Program Files/Common Files/SYSTEM/MSMAPI/1033/" +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = PublicAPI.log +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = ../include +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = PublicAPI_html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = OsWrapperAPI.tag +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/runDoxygen.bat b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/runDoxygen.bat new file mode 100755 index 00000000..ed03d6b2 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/doc/runDoxygen.bat @@ -0,0 +1 @@ +doxygen PublicAPI.doxygen \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_ErrorSupport.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_ErrorSupport.h new file mode 100755 index 00000000..7924e4e2 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_ErrorSupport.h @@ -0,0 +1,84 @@ +#ifndef __NMI_ERRORSUPPORT_H__ +#define __NMI_ERRORSUPPORT_H__ + +/*! +* @file NMI_ErrorSupport.h +* @brief Error reporting and handling support +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Aug 2010 +* @version 1.0 +*/ + +/* Psitive Numbers to indicate sucess with special status */ +#define NMI_ALREADY_EXSIT +100 /** The requested object already exists */ + +/* Generic success will return 0 */ +#define NMI_SUCCESS 0 /** Generic success */ + +/* Negative numbers to indicate failures */ +#define NMI_FAIL -100 /** Generic Fail */ +#define NMI_BUSY -101 /** Busy with another operation*/ +#define NMI_INVALID_ARGUMENT -102 /** A given argument is invalid*/ +#define NMI_INVALID_STATE -103 /** An API request would violate the Driver state machine (i.e. to start PID while not camped)*/ +#define NMI_BUFFER_OVERFLOW -104 /** In copy operations if the copied data is larger than the allocated buffer*/ +#define NMI_NULL_PTR -105 /** null pointer is passed or used */ +#define NMI_EMPTY -107 +#define NMI_FULL -108 +#define NMI_TIMEOUT -109 +#define NMI_CANCELED -110 /** The required operation have been canceled by the user*/ +#define NMI_INVALID_FILE -112 /** The Loaded file is corruped or having an invalid format */ +#define NMI_NOT_FOUND -113 /** Cant find the file to load */ +#define NMI_NO_MEM -114 +#define NMI_UNSUPPORTED_VERSION -115 +#define NMI_FILE_EOF -116 + + +/* Error type */ +typedef NMI_Sint32 NMI_ErrNo; + +#define NMI_IS_ERR(__status__) (__status__ < NMI_SUCCESS) + +#define NMI_ERRORCHECK(__status__) do{\ + if(NMI_IS_ERR(__status__))\ + {\ + NMI_ERROR("NMI_ERRORCHECK(%d)\n", __status__);\ + goto ERRORHANDLER;\ + }\ +}while(0) + +#define NMI_ERRORREPORT(__status__, __err__) do{\ + NMI_ERROR("NMI_ERRORREPORT(%d)\n", __err__);\ + __status__ = __err__;\ + goto ERRORHANDLER;\ +}while(0) + +#define NMI_NULLCHECK(__status__, __ptr__) do{\ + if(__ptr__ == NMI_NULL)\ + {\ + NMI_ERRORREPORT(__status__, NMI_NULL_PTR);\ + }\ +}while(0) + +#define NMI_CATCH(__status__) \ +ERRORHANDLER :\ +if(NMI_IS_ERR(__status__)) \ + +#ifdef CONFIG_NMI_ASSERTION_SUPPORT + +/** + * @brief prints a diagnostic message and aborts the program + * @param[in] pcExpression The expression that triggered the assertion + * @param[in] pcFileName The name of the current source file. + * @param[in] u32LineNumber The line number in the current source file. + * @warning DO NOT CALL DIRECTLY. USE EQUIVALENT MACRO FUNCTION INSTEAD. + */ +void NMI_assert_INTERNAL(NMI_Char* pcExpression, NMI_Char* pcFileName, NMI_Uint32 u32LineNumber); + +#define NMI_assert(__expression__) (void)(!!(__expression__) || (NMI_assert_INTERNAL((#__expression__), __NMI_FILE__, __NMI_LINE__), 0)) + +#else +#define NMI_assert(__expression__) ((void)0) +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Event.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Event.h new file mode 100755 index 00000000..0d38f5da --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Event.h @@ -0,0 +1,124 @@ +#ifndef __NMI_EVENT_H__ +#define __NMI_EVENT_H__ + +/*! +* @file NMI_Event.h +* @brief Event OS wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Oct 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_EVENT_FEATURE +#error the feature CONFIG_NMI_EVENT_FEATURE must be supported to include this file +#endif + + +/*! +* @struct tstrNMI_TimerAttrs +* @brief Timer API options +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +typedef struct +{ + /* a dummy member to avoid compiler errors*/ + NMI_Uint8 dummy; + + #ifdef CONFIG_NMI_EVENT_TIMEOUT + /*!< + Timeout for use with NMI_EventWait, 0 to return immediately and + NMI_OS_INFINITY to wait forever. default is NMI_OS_INFINITY + */ + NMI_Uint32 u32TimeOut; + #endif + +}tstrNMI_EventAttrs; + +/*! +* @brief Fills the NMI_TimerAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_TimerAttrs +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +static void NMI_EventFillDefault(tstrNMI_EventAttrs* pstrAttrs) +{ + #ifdef CONFIG_NMI_EVENT_TIMEOUT + pstrAttrs->u32TimeOut = NMI_OS_INFINITY; + #endif +} + +/*! +* @brief Creates a new Event +* @details the Event is an object that allows a thread to wait until an external + event occuers, Event objects have 2 states, either TRIGGERED or + UNTRIGGERED +* @param[out] pHandle handle to the newly created event object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_EventAttrs +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventCreate(NMI_EventHandle* pHandle, tstrNMI_EventAttrs* pstrAttrs); + + +/*! +* @brief Destroys a given event +* @details This will destroy a given event freeing any resources used by it + if there are any thread blocked by the NMI_EventWait call the the + behaviour is undefined +* @param[in] pHandle handle to the event object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_EventAttrs +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventDestroy(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs); + +/*! +* @brief Triggers a given event +* @details This function will set the given event into the TRIGGERED state, + if the event is already in TRIGGERED, this function will have no + effect +* @param[in] pHandle handle to the event object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_EventAttrs +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventTrigger(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs); + + +/*! +* @brief waits until a given event is triggered +* @details This function will block the calling thread until the event becomes + in the TRIGGERED state. the call will retun the event into the + UNTRIGGERED state upon completion + if multible threads are waiting on the same event at the same time, + behaviour is undefined +* @param[in] pHandle handle to the event object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_EventAttrs +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventWait(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs); + + + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_FileOps.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_FileOps.h new file mode 100755 index 00000000..42f0c8cd --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_FileOps.h @@ -0,0 +1,456 @@ +#ifndef __NMI_FILEOPS_H__ +#define __NMI_FILEOPS_H__ + +/*! +* @file FileOps.h +* @brief File Operations OS wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 31 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_FILE_OPERATIONS_FEATURE +#error the feature CONFIG_NMI_FILE_OPS_FEATURE must be supported to include this file +#endif + + +typedef enum{ + NMI_FILE_READ_ONLY, + NMI_FILE_READ_WRITE_EXISTING, + NMI_FILE_READ_WRITE_NEW +}tenuNMI_AccessMode; + +typedef enum{ + NMI_SEEK_FROM_START, + NMI_SEEK_FROM_END, + NMI_SEEK_FROM_CURRENT +}tenuNMI_SeekOrigin; + +/*! +* @struct tstrNMI_FileOpsAttrs +* @brief Message Queue API options +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +typedef struct +{ + /*!< access mode of the file, default is READ_WRITE_EXISTING */ + tenuNMI_AccessMode enuAccess; + + /*!< origin for seeking operations, default is NMI_FILE_SEEK_CUR */ + tenuNMI_SeekOrigin enuSeekOrigin; + +}tstrNMI_FileOpsAttrs; + +/*! +* @brief Fills the MsgQueueAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_TimerAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +static void NMI_FileOpsFillDefault(tstrNMI_FileOpsAttrs* pstrAttrs) +{ + pstrAttrs->enuAccess = NMI_FILE_READ_WRITE_EXISTING; + pstrAttrs->enuSeekOrigin = NMI_SEEK_FROM_CURRENT; +} + + +/** +* @brief Opens a file +* @details Opens a file, possibly creating a new file if write enabled and + pstrAttrs->bCreate is set to true +* @param[in,out] pHandle Handle to the opened file +* @param[in] pcPath path to the File +* @param[in] pstrAttrs Optional attributes, NULL for defaults. bCreate will + create the file if does not exit, enuAccess will control access + mode +* @return Error code indicating success/failure +* @note Original Standard Function: + FILE *fopen( const char *filename, const char *mode ); +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_fopen(NMI_FileHandle* pHandle, const NMI_Char* pcPath, + tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Closes a file. + * @param[in] pHandle Handle to the file object + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @note Original Standard Function: int fclose( FILE *stream ); +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 + */ +NMI_ErrNo NMI_fclose(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Reads data from a file. + * @param[in] pHandle Handle to the file object + * @param[out] pu8Buffer Storage location for data + * @param[in] u32Size Number of bytes to be read + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Returns the number of bytes actually read, which may be less + than count if an error occurs or if the end of the file is + encountered before reaching count. + Use the NMI_feof function to distinguish a read error from an + end-of-file condition. + If size or count is 0, NMI_fread returns 0 and the buffer + contents are unchanged. + * @note Original Standard Function: + size_t fread( void *buffer, size_t size, size_t count, FILE *stream ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_fread(NMI_FileHandle* pHandle, NMI_Uint8* pu8Buffer, + NMI_Uint32 u32Size, tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Writes data to a FILE. + * @param[in] pHandle Handle to the file object + * @param[in] pu8Buffer Storage location for data + * @param[in] u32Size Number of bytes to be write + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Returns the number of full items actually written, which may be + less than count if an error occurs + Also, if an error occurs, the file-position indicator cannot be + determined. + * @note Original Standard Function: + size_t fwrite( const void *buffer, size_t size, size_t count, FILE *stream ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_fwrite(NMI_FileHandle* pHandle, NMI_Uint8* pu8Buffer, + NMI_Uint32 u32Size, tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Tests for end-of-file + * @param[in] pHandle Handle to the file object + * @retval NMI_FALSE if the current position is not end of file + * @retval NMI_TRUE after the first read operation that attempts to read past + the end of the file. + * @note Original Standard Function: int feof( FILE *stream ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Bool NMI_feof(NMI_FileHandle* pHandle); + +/** + * @brief Moves the file pointer to a specified location. + * @param[in] pHandle Handle to the file object + * @param[in] s32Offset Number of bytes to move, origin of seeking depends on + pstrAttrs->enuSeekOrigin, if pstrAttrs is NULL then origin is the + current position at the file + * @param[in] pstrAttrs Optional attributes, NULL for default. + enuSeekOrigin defines the origin of seek operations + * @return Error code indicating success/failure + * @note Original Standard Function: + int fseek( FILE *stream, long offset, int origin ); + */ +NMI_ErrNo NMI_fseek(NMI_FileHandle* pHandle, NMI_Sint32 s32Offset, + tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Gets the current position of a file pointer. + * @param[in] pHandle Handle to the file object + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Returns the current file position. Or NMI_FAIL on error. + * @note Original Standard Function: long ftell( FILE *stream ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_ftell(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs); + + +/** + * @brief Flushes the file, writing all data that may be in buffers + * @param[in] pHandle Handle to the file object + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @note Original Standard Function: int fflush( FILE *stream ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fflush(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs); + + + +/** + * @brief Gets the size of the file. + * @param[in] pHandle Handle to the file object + * @param[out] pu32Size returned size of file in question + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @note + * @author remil + * @date 25 Oct 2010 + * @version 2.0 + */ +NMI_ErrNo NMI_FileSize(NMI_FileHandle* pstrFileHandle, NMI_Uint32* pu32Size, + tstrNMI_FileOpsAttrs* pstrAttrs); + + + +#ifdef CONFIG_NMI_EXTENDED_FILE_OPERATIONS +/** + * @brief Returns the character currently pointed by the internal file position + * indicator of the specified stream. + * The internal file position indicator is then advanced by one + * character to point to the next character. + * @param[in] NMI_FileHandle* pHandle + * @return Returns the character currently pointed by the internal file position + * @note Original Standard Function: int getc + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_Sint32 NMI_getc(NMI_FileHandle* pHandle); + + +/** + * @brief pushes the byte specified by c (converted to an unsigned char) + * back onto the input stream pointed to by stream. + * @param[in] NMI_Sint32 c + * @param[in] NMI_FileHandle* pHandle + * @return returns the byte pushed back after conversion. Otherwise it returns EOF. + * @note Original Standard Function: ungetc + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_Sint32 NMI_ungetc(NMI_Sint32 c, + NMI_FileHandle* pHandle); + + + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_freopen(NMI_FileHandle* pHandle, const NMI_Char* pcPath, + tstrNMI_FileOpsAttrs* pstrAttrs); + +/** +* @brief Translates character file open mode to the appropriate Enum Value +* @details +* @param[in] const NMI_Char* cpMode +* @return tenuNMI_AccessMode +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +tenuNMI_AccessMode NMI_resolveFileMode(const NMI_Char* cpMode); + + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_rename(const NMI_Char *old_filename, const NMI_Char *new_filename); + +NMI_ErrNo NMI_setbuf(NMI_FileHandle *pHandle, NMI_Char* buffer); + + +NMI_ErrNo NMI_setvbuf(NMI_FileHandle *pHandle, + NMI_Char* buffer, + NMI_Sint32 mode, + NMI_Uint32 size); + +/* +*Creates a temporary file in binary update mode (wb+). +*The tempfile is removed when the program terminates or the stream is closed. +*On success a pointer to a file stream is returned. On error a null pointer is returned. +*/ +NMI_ErrNo NMI_tmpfile(NMI_FileHandle *pHandle); + + +/* + * Reads a line from the specified stream and stores it into the string pointed to by str. + * It stops when either (n-1) characters are read, + * the newline character is read, or the end-of-file is reached, + * whichever comes first. The newline character is copied to the string. + * A null character is appended to the end of the string. + * On success a pointer to the string is returned. On error a null pointer is returned. + * If the end-of-file occurs before any characters have been read, the string remains unchanged. +*/ + +//NMI_Char* NMI_fgets(NMI_Char* str, NMI_Sint32 n, NMI_FileHandle stream); + + +/** +* @brief Clears the end-of-file and error indicators for the given stream. +* @details As long as the error indicator is set, + all stream operations will return an error until NMI_clearerr is called. +* @param[in] NMI_FileHandle* pHandle +* @return N/A +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +void NMI_clearerr(NMI_FileHandle* pHandle); + + +/** +* @brief Tests the error indicator for the given stream. +* @details If the error indicator is set, then it returns NMI_FAIL. + If the error indicator is not set, then it returns NMI_SUCCESS. +* @param[in] NMI_FileHandle* pHandle +* @return NMI_ErrNo +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ferror(NMI_FileHandle* pHandle); + +/** +* @brief Generates and returns a valid temporary filename which does not exist. +* @details If the argument str is a null pointer, then the function returns + a pointer to a valid filename. + If the argument str is a valid pointer to an array, + then the filename is written to the array and a pointer to the same array + is returned.The filename may be up to L_tmpnam characters long. +* @param[in] NMI_Char* str +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_tmpnam(NMI_Char* str); + + +#endif + + +#ifdef CONFIG_NMI_FILE_OPERATIONS_STRING_API + +/** + * @brief Reads a line. + * @param[in] pHandle Handle to the file object + * @param[out] pcBuffer Storage location for data + * @param[in] u32Maxsize Maximum number of data to be read including NULL terminator + * @return Error code indicating success/failure + * @retval NMI_FILE_EOF If the End-of-File is encountered, no characters + have been read and the contents of buffer remain unchanged + * @retval NMI_FAIL If an error occurs, no characters + have been read and the contents of buffer remain unchanged + * @note Original Standard Function: + char *fgets(char *s,int n,FILE *stream); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fgets(NMI_FileHandle* pHandle, NMI_Char* pcBuffer + , NMI_Uint32 u32Maxsize); + +/** + * @brief Prints formatted data to a stream + * @param[in] pHandle Handle to the file object + * @param[in] pcFormat Format-control string + * @param[in] ... Optional arguments + * @return Error code indicating success/failure + * @note Original Standard Function: + int fprintf( FILE *stream, const char *format, ... ); + */ +NMI_ErrNo NMI_fprintf(NMI_FileHandle* pHandle, const NMI_Char* pcFormat, ...); + +/** + * @brief Writes formatted output using a pointer to a list of arguments + * @param[in] pHandle Handle to the file object + * @param[in] pcFormat Format specification + * @param[in] argptr Pointer to list of arguments + * @return Error code indicating success/failure + * @note riginal Standard Function: + int vfprintf( FILE *stream, const char *format, va_list argptr ); + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_vfprintf(NMI_FileHandle* pHandle, const NMI_Char* pcFormat, + va_list argptr); + +#endif + +#ifdef CONFIG_NMI_FILE_OPERATIONS_PATH_API + +/** + * @brief Renames/Moves a file or directory + * @param[in] pcOldPath the old path + * @param[in] pcNewPath the new path + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @note if there is a file or folder exsiting in the new path, the + * operation fails + * @author syounan + * @date 31 Oct 2010 + * @version 2.0 + */ +NMI_ErrNo NMI_PathMove(NMI_Char* pcOldPath, NMI_Char* pcNewPath, + tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Checks for the path exsitance + * @details Checks for the path exsitance, the path could be either a file or + a directory, to test differentiate between files/directories + send a non-null poiter to the argument pbIsDirectory + * @param[in] pcPath path of the examined file/directory + * @param[out] pbIsDirectory set to NMI_TRUE if the path is directory, optional + and could be NMI_NULL + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return NMI_TRUE if path exsits, NMI_FALSE if does not exist + * @note if there is a file or folder exsiting in the new path, the + * operation fails + * @author syounan + * @date 31 Oct 2010 + * @version 2.0 + */ +NMI_Bool NMI_PathExsits(NMI_Char* pcPath, NMI_Bool* pbIsDirectory, + tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief Deletes the given path + * @details Deletes the given path, wheather it is a file or a directory + * if it is a directory that contains other files and diretories, + * they will be recusively deleted + * @param[in] pcPath path to the File + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @note if the path does not exist, the function returns an error + * @author mabubakr, syounan + * @date 31 Oct 2010 + * @version 2.0 + */ +NMI_ErrNo NMI_PathDelete(NMI_Char* pcPath, tstrNMI_FileOpsAttrs* pstrAttrs); + +/** + * @brief creates a new directory + * @details creates a new directory in the given path, if a file or directory + already exsits in this path the operation fails + * @param[in] pcPath path to be created + * @param[in] pstrAttrs Optional attributes, NULL for default. + * @return Error code indicating success/failure + * @author syounan + * @date 31 Oct 2010 + * @version 2.0 + */ +NMI_ErrNo NMI_DirectoryCreate(NMI_Char* pcPath, tstrNMI_FileOpsAttrs* pstrAttrs); + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Log.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Log.h new file mode 100755 index 00000000..2c149e06 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Log.h @@ -0,0 +1,43 @@ +#ifndef __NMI_LOG_H__ +#define __NMI_LOG_H__ + +/* Errors will always get printed */ +#define NMI_ERROR(...) do { NMI_PRINTF("(ERR)(%s:%d) ",__NMI_FUNCTION__,__NMI_LINE__);\ + NMI_PRINTF(__VA_ARGS__); } while(0) + +/* Wraning only printed if verbosity is 1 or more */ +#if (NMI_LOG_VERBOSITY_LEVEL > 0) +#define NMI_WARN(...) do { NMI_PRINTF("(WRN)");\ + NMI_PRINTF(__VA_ARGS__); } while(0) +#else +#define NMI_WARN(...) (0) +#endif + +/* Info only printed if verbosity is 2 or more */ +#if (NMI_LOG_VERBOSITY_LEVEL > 1) +#define NMI_INFO(...) do { NMI_PRINTF("(INF)");\ + NMI_PRINTF(__VA_ARGS__); } while(0) +#else +#define NMI_INFO(...) (0) +#endif + +/* Debug is only printed if verbosity is 3 or more */ +#if (NMI_LOG_VERBOSITY_LEVEL > 2) +#define NMI_DBG(...) do { NMI_PRINTF("(DBG)(%s:%d) ",__NMI_FUNCTION__,__NMI_LINE__);\ + NMI_PRINTF(__VA_ARGS__); } while(0) + +#else +#define NMI_DBG(...) (0) +#endif + +/* Function In/Out is only printed if verbosity is 4 or more */ +#if (NMI_LOG_VERBOSITY_LEVEL > 3) +#define NMI_FN_IN do { NMI_PRINTF("(FIN) (%s:%d) \n", __NMI_FUNCTION__, __NMI_LINE__); } while(0) +#define NMI_FN_OUT(ret) do { NMI_PRINTF("(FOUT) (%s:%d) %d.\n",__NMI_FUNCTION__,__NMI_LINE__,(ret)); } while(0) +#else +#define NMI_FN_IN (0) +#define NMI_FN_OUT(ret) (0) +#endif + + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Math.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Math.h new file mode 100755 index 00000000..7adcc78b --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Math.h @@ -0,0 +1,368 @@ +#ifndef __NMI_MATH_H__ +#define __NMI_MATH_H__ + +/*! +* @file NMI_Math.h +* @brief Math Operations OS wrapper functionality +* @author remil +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 2 Nov 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_MATH_OPERATIONS_FEATURE +#error the feature CONFIG_NMI_MATH_OPS_FEATURE must be supported to include this file +#endif + + + +/** +* @brief Returns the arc cosine of x in radians. +* @details Returns the arc cosine of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value x must be within the range of -1 to +1 (inclusive). + The returned value is in the range of 0 to pi (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_acos(NMI_Double x); + +/** +* @brief Returns the arc sine of x in radians. +* @details Returns the arc sine of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value x must be within the range of -1 to +1 (inclusive). + The returned value is in the range of 0 to pi (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_asin(NMI_Double x); + +/** +* @brief Returns the arc tangent of x in radians. +* @details Returns the arc tangent of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -p/2 to +p/2 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_atan(NMI_Double x); + +/** +* @brief Returns the arc tangent in radians +* @details Returns the arc tangent in radians of y/x based on the + signs of both values to determine the correct quadrant. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note Both y and x cannot be zero. + The returned value is in the range of -p/2 to +p/2 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_atan2(NMI_Double y, NMI_Double x); + + +/** +* @brief Returns the cosine of a radian angle x. +* @details Returns the cosine of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_cos(NMI_Double x); + + +/** +* @brief Returns the hyperbolic cosine of x. +* @details Returns the hyperbolic cosine of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_cosh(NMI_Double x); + + +/** +* @brief Returns the sine of a radian angle x. +* @details Returns the sine of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sin(NMI_Double x); + + +/** +* @brief Returns the hyperbolic sine of x. +* @details Returns the hyperbolic sine of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sinh(NMI_Double x); +/** +* @brief Returns the tangent of a radian angle x. +* @details Returns the tangent of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_tan(NMI_Double x); + +/** +* @brief Returns the hyperbolic tangent of x. +* @details Returns the hyperbolic tangent of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_tanh(NMI_Double x); + + +/** +* @brief Returns the value of e raised to the xth power. +* @details Returns the value of e raised to the xth power. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_exp(NMI_Double x); + +/** +* @brief The returned value is the mantissa and the integer pointed to by exponent is the exponent. +* @details The returned value is the mantissa and the integer pointed to by exponent is the exponent. + The resultant value is x=mantissa * 2^exponent. +* @param[in] NMI_Double x +* @param[out] NMI_Sint32* exponent +* @return NMI_Double +* @note The mantissa is in the range of .5 (inclusive) to 1 (exclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_frexp(NMI_Double x, NMI_Sint32* exponent); + + + +/** +* @brief Returns x multiplied by 2 raised to the power of exponent. +* @details Returns x multiplied by 2 raised to the power of exponent. + x*2^exponent +* @param[in] NMI_Double x +* @param[out] NMI_Sint32 exponent +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_ldexp(NMI_Double x, NMI_Sint32 exponent); + + +/** +* @brief Returns the natural logarithm (base-e logarithm) of x. +* @details Returns the natural logarithm (base-e logarithm) of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_log(NMI_Double x); + + +/** +* @brief Returns the common logarithm (base-10 logarithm) of x. +* @details Returns the common logarithm (base-10 logarithm) of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_log10(NMI_Double x); + + +/** +* @brief Breaks the floating-point number x into integer and fraction components. +* @details Breaks the floating-point number x into integer and fraction components. + The returned value is the fraction component (part after the decimal), + and sets integer to the integer component. + +* @param[in] NMI_Double x +* @param[out] NMI_Double* dInteger +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_modf(NMI_Double x,NMI_Double* dInteger); + + + +/** +* @brief Returns x raised to the power of y. +* @details Returns x raised to the power of y. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note x cannot be negative if y is a fractional value. + x cannot be zero if y is less than or equal to zero. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_pow(NMI_Double x,NMI_Double y); + + + +/** +* @brief Returns the square root of x. +* @details Returns the square root of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The argument cannot be negative. The returned value is always positive. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sqrt(NMI_Double x); + +/** +* @brief Returns the smallest integer value greater than or equal to x. +* @details Returns the smallest integer value greater than or equal to x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_ceil(NMI_Double x); + +/** +* @brief Returns the absolute value of x +* @details Returns the absolute value of x + (a negative value becomes positive, positive value is unchanged). +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument. + The return value is always positive. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_fabs(NMI_Double x); + +/** +* @brief Returns the largest integer value less than or equal to x. +* @details Returns the largest integer value less than or equal to x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_floor(NMI_Double x); + +/** +* @brief Returns the remainder of x divided by y. +* @details Returns the remainder of x divided by y. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note There is no range limit on the return value. + If y is zero, then either a range error will occur or the function + will return zero (implementation-defined). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_fmod(NMI_Double x,NMI_Double y); + + +/** +* @brief +* @details Returns the absolute value of x. + Note that in two's compliment that the most maximum number cannot be + represented as a positive number. The result in this case is undefined. + The absolute value is returned. +* @param[in] NMI_Sint32 x +* @return NMI_Sint32 +* @note +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_abs(NMI_Sint32 x); + + + + +/** +* @brief +* @details Returns a pseudo-random number in the range of 0 to RAND_MAX. +* @return NMI_Sint32 +* @note +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_rand(); + + +/** +* @brief +* @details This function seeds the random number generator used by the function rand. + Seeding srand with the same seed will cause rand to return the same sequence + of pseudo-random numbers. + If srand is not called, NMI_rand acts as if NMI_srand(1) has been called. + +* @param[in] NMI_Uint32 seed +* @note No value is returned. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +void NMI_srand(NMI_Uint32 seed); + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Memory.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Memory.h new file mode 100755 index 00000000..27ac5e2b --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Memory.h @@ -0,0 +1,330 @@ +#ifndef __NMI_MEMORY_H__ +#define __NMI_MEMORY_H__ + +/*! +* @file NMI_Memory.h +* @brief Memory OS wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 16 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_MEMORY_FEATURE +#error the feature CONFIG_NMI_MEMORY_FEATURE must be supported to include this file +#endif + +/*! +* @struct tstrNMI_MemoryAttrs +* @brief Memory API options +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +typedef struct { + #ifdef CONFIG_NMI_MEMORY_POOLS + /*!< the allocation pool to use for this memory, NULL for system + allocation. Default is NULL + */ + NMI_MemoryPoolHandle* pAllocationPool; + #endif + + /* a dummy member to avoid compiler errors*/ + NMI_Uint8 dummy; +}tstrNMI_MemoryAttrs; + +/*! +* @brief Fills the tstrNMI_MemoryAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa tstrNMI_MemoryAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +static void NMI_MemoryFillDefault(tstrNMI_MemoryAttrs* pstrAttrs) +{ + #ifdef CONFIG_NMI_MEMORY_POOLS + pstrAttrs->pAllocationPool = NMI_NULL; + #endif +} + +/*! +* @brief Allocates a given size of bytes +* @param[in] u32Size size of memory in bytes to be allocated +* @param[in] strAttrs Optional attributes, NULL for default + if not NULL, pAllocationPool should point to the pool to use for + this allocation. if NULL memory will be allocated directly from + the system +* @param[in] pcFileName file name of the calling code for debugging +* @param[in] u32LineNo line number of the calling code for debugging +* @return The new allocated block, NULL if allocation fails +* @note It is recommended to use of of the wrapper macros instead of + calling this function directly +* @sa sttrNMI_MemoryAttrs +* @sa NMI_MALLOC +* @sa NMI_MALLOC_EX +* @sa NMI_NEW +* @sa NMI_NEW_EX +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryAlloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo); + +/*! +* @brief Allocates a given size of bytes and zero filling it +* @param[in] u32Size size of memory in bytes to be allocated +* @param[in] strAttrs Optional attributes, NULL for default + if not NULL, pAllocationPool should point to the pool to use for + this allocation. if NULL memory will be allocated directly from + the system +* @param[in] pcFileName file name of the calling code for debugging +* @param[in] u32LineNo line number of the calling code for debugging +* @return The new allocated block, NULL if allocation fails +* @note It is recommended to use of of the wrapper macros instead of + calling this function directly +* @sa sttrNMI_MemoryAttrs +* @sa NMI_CALLOC +* @sa NMI_CALLOC_EX +* @sa NMI_NEW_0 +* @sa NMI_NEW_0_EX +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryCalloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo); + +/*! +* @brief Reallocates a given block to a new size +* @param[in] pvOldBlock the old memory block, if NULL then this function + behaves as a new allocation function +* @param[in] u32NewSize size of the new memory block in bytes, if zero then + this function behaves as a free function +* @param[in] strAttrs Optional attributes, NULL for default + if pAllocationPool!=NULL and pvOldBlock==NULL, pAllocationPool + should point to the pool to use for this allocation. + if pAllocationPool==NULL and pvOldBlock==NULL memory will be + allocated directly from the system + if and pvOldBlock!=NULL, pAllocationPool will not be inspected + and reallocation is done from the same pool as the original block +* @param[in] pcFileName file name of the calling code for debugging +* @param[in] u32LineNo line number of the calling code for debugging +* @return The new allocated block, possibly same as pvOldBlock +* @note It is recommended to use of of the wrapper macros instead of + calling this function directly +* @sa sttrNMI_MemoryAttrs +* @sa NMI_REALLOC +* @sa NMI_REALLOC_EX +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryRealloc(void* pvOldBlock, NMI_Uint32 u32NewSize, + tstrNMI_MemoryAttrs* strAttrs, NMI_Char* pcFileName, NMI_Uint32 u32LineNo); + +/*! +* @brief Frees given block +* @param[in] pvBlock the memory block to be freed +* @param[in] strAttrs Optional attributes, NULL for default +* @param[in] pcFileName file name of the calling code for debugging +* @param[in] u32LineNo line number of the calling code for debugging +* @note It is recommended to use of of the wrapper macros instead of + calling this function directly +* @sa sttrNMI_MemoryAttrs +* @sa NMI_FREE +* @sa NMI_FREE_EX +* @sa NMI_FREE_SET_NULL +* @sa NMI_FREE_IF_TRUE +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +void NMI_MemoryFree(void* pvBlock, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo); + +/*! +* @brief Creates a new memory pool +* @param[out] pHandle the handle to the new Pool +* @param[in] u32PoolSize The pool size in bytes +* @param[in] strAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa sttrNMI_MemoryAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MemoryNewPool(NMI_MemoryPoolHandle* pHandle, NMI_Uint32 u32PoolSize, + tstrNMI_MemoryAttrs* strAttrs); + +/*! +* @brief Deletes a memory pool, freeing all memory allocated from it as well +* @param[in] pHandle the handle to the deleted Pool +* @param[in] strAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa sttrNMI_MemoryAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MemoryDelPool(NMI_MemoryPoolHandle* pHandle, tstrNMI_MemoryAttrs* strAttrs); + + +#ifdef CONFIG_NMI_MEMORY_DEBUG + + /*! + @brief standrad malloc wrapper with custom attributes + */ + #define NMI_MALLOC_EX(__size__, __attrs__)\ + (NMI_MemoryAlloc(\ + (__size__), __attrs__,\ + (NMI_Char*)__NMI_FILE__, (NMI_Uint32)__NMI_LINE__)) + + /*! + @brief standrad calloc wrapper with custom attributes + */ + #define NMI_CALLOC_EX(__size__, __attrs__)\ + (NMI_MemoryCalloc(\ + (__size__), __attrs__,\ + (NMI_Char*)__NMI_FILE__, (NMI_Uint32)__NMI_LINE__)) + + /*! + @brief standrad realloc wrapper with custom attributes + */ + #define NMI_REALLOC_EX(__ptr__, __new_size__, __attrs__)\ + (NMI_MemoryRealloc(\ + (__ptr__), (__new_size__), __attrs__,\ + (NMI_Char*)__NMI_FILE__, (NMI_Uint32)__NMI_LINE__)) + + /*! + @brief standrad free wrapper with custom attributes + */ + #define NMI_FREE_EX(__ptr__, __attrs__)\ + (NMI_MemoryFree(\ + (__ptr__), __attrs__,\ + (NMI_Char*)__NMI_FILE__, (NMI_Uint32)__NMI_LINE__)) + +#else + + /*! + @brief standrad malloc wrapper with custom attributes + */ + #define NMI_MALLOC_EX(__size__, __attrs__)\ + (NMI_MemoryAlloc(\ + (__size__), __attrs__, NMI_NULL, 0)) + + /*! + @brief standrad calloc wrapper with custom attributes + */ + #define NMI_CALLOC_EX(__size__, __attrs__)\ + (NMI_MemoryCalloc(\ + (__size__), __attrs__, NMI_NULL, 0)) + + /*! + @brief standrad realloc wrapper with custom attributes + */ + #define NMI_REALLOC_EX(__ptr__, __new_size__, __attrs__)\ + (NMI_MemoryRealloc(\ + (__ptr__), (__new_size__), __attrs__, NMI_NULL, 0)) + /*! + @brief standrad free wrapper with custom attributes + */ + #define NMI_FREE_EX(__ptr__, __attrs__)\ + (NMI_MemoryFree(\ + (__ptr__), __attrs__, NMI_NULL, 0)) + +#endif + +/*! +@brief Allocates a block (with custom attributes) of given type and number of +elements +*/ +#define NMI_NEW_EX(__struct_type__, __n_structs__, __attrs__)\ + ((__struct_type__*)NMI_MALLOC_EX(\ + sizeof(__struct_type__) * (NMI_Uint32)(__n_structs__), __attrs__)) + +/*! +@brief Allocates a block (with custom attributes) of given type and number of +elements and Zero-fills it +*/ +#define NMI_NEW_0_EX(__struct_type__, __n_structs__, __attrs__)\ + ((__struct_type__*)NMI_CALLOC_EX(\ + sizeof(__struct_type__) * (NMI_Uint32)(__n_structs__), __attrs__)) + +/*! +@brief Frees a block (with custom attributes), also setting the original pointer +to NULL +*/ +#define NMI_FREE_SET_NULL_EX(__ptr__, __attrs__) do{\ + if(__ptr__ != NMI_NULL){\ + NMI_FREE_EX(__ptr__, __attrs__);\ + __ptr__ = NMI_NULL ;\ + }\ +}while(0) + +/*! +@brief Frees a block (with custom attributes) if the pointer expression evaluates +to true +*/ +#define NMI_FREE_IF_TRUE_EX(__ptr__, __attrs__) do{\ + if (__ptr__ != NMI_NULL){\ + NMI_FREE_EX(__ptr__, __attrs__);\ + }\ +} while(0) + +/*! +@brief standrad malloc wrapper with default attributes +*/ +#define NMI_MALLOC(__size__)\ + NMI_MALLOC_EX(__size__, NMI_NULL) + +/*! +@brief standrad calloc wrapper with default attributes +*/ +#define NMI_CALLOC(__size__)\ + NMI_CALLOC_EX(__size__, NMI_NULL) + +/*! +@brief standrad realloc wrapper with default attributes +*/ +#define NMI_REALLOC(__ptr__, __new_size__)\ + NMI_REALLOC_EX(__ptr__, __new_size__, NMI_NULL) + +/*! +@brief standrad free wrapper with default attributes +*/ +#define NMI_FREE(__ptr__)\ + NMI_FREE_EX(__ptr__, NMI_NULL) + +/*! +@brief Allocates a block (with default attributes) of given type and number of +elements +*/ +#define NMI_NEW(__struct_type__, __n_structs__)\ + NMI_NEW_EX(__struct_type__, __n_structs__, NMI_NULL) + +/*! +@brief Allocates a block (with default attributes) of given type and number of +elements and Zero-fills it +*/ +#define NMI_NEW_0(__struct_type__, __n_structs__)\ + NMI_NEW_O_EX(__struct_type__, __n_structs__, NMI_NULL) + +/*! +@brief Frees a block (with default attributes), also setting the original pointer +to NULL +*/ +#define NMI_FREE_SET_NULL(__ptr__)\ + NMI_FREE_SET_NULL_EX(__ptr__, NMI_NULL) + +/*! +@brief Frees a block (with default attributes) if the pointer expression evaluates +to true +*/ +#define NMI_FREE_IF_TRUE(__ptr__)\ + NMI_FREE_IF_TRUE_EX(__ptr__, NMI_NULL) + + +#endif + diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_MsgQueue.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_MsgQueue.h new file mode 100755 index 00000000..e2d21572 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_MsgQueue.h @@ -0,0 +1,134 @@ +#ifndef __NMI_MSG_QUEUE_H__ +#define __NMI_MSG_QUEUE_H__ + +/*! +* @file NMI_MsgQueue.h +* @brief Message Queue OS wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 30 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_MSG_QUEUE_FEATURE +#error the feature CONFIG_NMI_MSG_QUEUE_FEATURE must be supported to include this file +#endif + +/*! +* @struct tstrNMI_MsgQueueAttrs +* @brief Message Queue API options +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +typedef struct +{ + #ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME + NMI_Char* pcName; + #endif + + #ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT + NMI_Uint32 u32Timeout; + #endif + + /* a dummy member to avoid compiler errors*/ + NMI_Uint8 dummy; + +}tstrNMI_MsgQueueAttrs; + +/*! +* @brief Fills the MsgQueueAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_TimerAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +static void NMI_MsgQueueFillDefault(tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + #ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME + pstrAttrs->pcName = NMI_NULL; + #endif + + #ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT + pstrAttrs->u32Timeout = NMI_OS_INFINITY; + #endif +} +/*! +* @brief Creates a new Message queue +* @details Creates a new Message queue, if the feature + CONFIG_NMI_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName + is not Null, then this message queue can be used for IPC with + any other message queue having the same name in the system +* @param[in,out] pHandle handle to the message queue object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_MsgQueueAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueCreate(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs); + + +/*! +* @brief Sends a message +* @details Sends a message, this API will block unil the message is + actually sent or until it is timedout (as long as the feature + CONFIG_NMI_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout + is not set to NMI_OS_INFINITY), zero timeout is a valid value +* @param[in] pHandle handle to the message queue object +* @param[in] pvSendBuffer pointer to the data to send +* @param[in] u32SendBufferSize the size of the data to send +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_MsgQueueAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueSend(NMI_MsgQueueHandle* pHandle, + const void * pvSendBuffer, NMI_Uint32 u32SendBufferSize, + tstrNMI_MsgQueueAttrs* pstrAttrs); + + +/*! +* @brief Receives a message +* @details Receives a message, this API will block unil a message is + received or until it is timedout (as long as the feature + CONFIG_NMI_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout + is not set to NMI_OS_INFINITY), zero timeout is a valid value +* @param[in] pHandle handle to the message queue object +* @param[out] pvRecvBuffer pointer to a buffer to fill with the received message +* @param[in] u32RecvBufferSize the size of the receive buffer +* @param[out] pu32ReceivedLength the length of received data +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_MsgQueueAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueRecv(NMI_MsgQueueHandle* pHandle, + void * pvRecvBuffer, NMI_Uint32 u32RecvBufferSize, + NMI_Uint32* pu32ReceivedLength, + tstrNMI_MsgQueueAttrs* pstrAttrs); + + +/*! +* @brief Destroys an existing Message queue +* @param[in] pHandle handle to the message queue object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa tstrNMI_MsgQueueAttrs +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueDestroy(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs); + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_OSWrapper.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_OSWrapper.h new file mode 100755 index 00000000..07d755d4 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_OSWrapper.h @@ -0,0 +1,133 @@ +#ifndef __NMI_OSWRAPPER_H__ +#define __NMI_OSWRAPPER_H__ + +/*! +* @file NMI_OSWrapper.h +* @brief Top level OS Wrapper, include this file and it will include all + other files as necessary +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ + +/* OS Wrapper interface version */ +#define NMI_OSW_INTERFACE_VER 2 + +/* Integer Types */ +typedef unsigned char NMI_Uint8; +typedef unsigned short NMI_Uint16; +typedef unsigned int NMI_Uint32; +typedef unsigned long long NMI_Uint64; +typedef signed char NMI_Sint8; +typedef signed short NMI_Sint16; +typedef signed int NMI_Sint32; +typedef signed long long NMI_Sint64; + +/* Floating types */ +typedef float NMI_Float; +typedef double NMI_Double; + +/* Boolean type */ +typedef enum { + NMI_FALSE = 0, + NMI_TRUE = 1 +}NMI_Bool; + +/* Character types */ +typedef char NMI_Char; +typedef NMI_Uint16 NMI_WideChar; + +#define NMI_OS_INFINITY (~((NMI_Uint32)0)) +#define NMI_NULL ((void*)0) + +/* standard min and max macros */ +#define NMI_MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define NMI_MAX(a, b) (((a) > (b)) ? (a) : (b)) + +/* Os Configuration File */ +#include "NMI_OsWrapper/OsConfig/NMI_OSConfig.h" + +/* Platform specific include */ +#if NMI_PLATFORM == NMI_WIN32 +#include "NMI_OsWrapper/source/win32/include/NMI_platform.h" +#elif NMI_PLATFORM == NMI_NU +#include "NMI_OsWrapper/source/nucleus/include/NMI_platform.h" +#elif NMI_PLATFORM == NMI_MTK +#include "NMI_OsWrapper/source/mtk/include/NMI_platform.h" +#elif NMI_PLATFORM == NMI_LINUX +#include "NMI_OsWrapper/source/linux/include/NMI_platform.h" +#elif NMI_PLATFORM == NMI_LINUXKERNEL +#include "NMI_OsWrapper/source/linuxkernel/include/NMI_platform.h" +#else +#error "OS not supported" +#endif + +/* Logging Functions */ +#include "NMI_Log.h" + +/* Error reporting and handling support */ +#include "NMI_ErrorSupport.h" + +/* Thread support */ +#ifdef CONFIG_NMI_THREAD_FEATURE +#include "NMI_Thread.h" +#endif + +/* Semaphore support */ +#ifdef CONFIG_NMI_SEMAPHORE_FEATURE +#include "NMI_Semaphore.h" +#endif + +/* Sleep support */ +#ifdef CONFIG_NMI_SLEEP_FEATURE +#include "NMI_Sleep.h" +#endif + +/* Timer support */ +#ifdef CONFIG_NMI_TIMER_FEATURE +#include "NMI_Timer.h" +#endif + +/* Memory support */ +#ifdef CONFIG_NMI_MEMORY_FEATURE +#include "NMI_Memory.h" +#endif + +/* String Utilities */ +#ifdef CONFIG_NMI_STRING_UTILS +#include "NMI_StrUtils.h" +#endif + +/* Message Queue */ +#ifdef CONFIG_NMI_MSG_QUEUE_FEATURE +#include "NMI_MsgQueue.h" +#endif + +/* File operations */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_FEATURE +#include "NMI_FileOps.h" +#endif + +/* Time operations */ +#ifdef CONFIG_NMI_TIME_FEATURE +#include "NMI_Time.h" +#endif + +/* Event support */ +#ifdef CONFIG_NMI_EVENT_FEATURE +#include "NMI_Event.h" +#endif + +/* Socket operations */ +#ifdef CONFIG_NMI_SOCKET_FEATURE +#include "NMI_Socket.h" +#endif + +/* Math operations */ +#ifdef CONFIG_NMI_MATH_OPERATIONS_FEATURE +#include "NMI_Math.h" +#endif + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Semaphore.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Semaphore.h new file mode 100755 index 00000000..dc65fb84 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Semaphore.h @@ -0,0 +1,116 @@ +#ifndef __NMI_SEMAPHORE_H__ +#define __NMI_SEMAPHORE_H__ + +/*! +* @file NMI_Semaphore.h +* @brief Semaphore OS Wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Aug 2010 +* @version 1.0 +*/ + + +#ifndef CONFIG_NMI_SEMAPHORE_FEATURE +#error the feature NMI_OS_FEATURE_SEMAPHORE must be supported to include this file +#endif + +/*! +* @struct NMI_SemaphoreAttrs +* @brief Semaphore API options +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +typedef struct +{ + /*!< + Initial count when the semaphore is created. default is 1 + */ + NMI_Uint32 u32InitCount; + + #ifdef CONFIG_NMI_SEMAPHORE_TIMEOUT + /*!< + Timeout for use with NMI_SemaphoreAcquire, 0 to return immediately and + NMI_OS_INFINITY to wait forever. default is NMI_OS_INFINITY + */ + NMI_Uint32 u32TimeOut; + #endif + +}tstrNMI_SemaphoreAttrs; + + +/*! +* @brief Fills the NMI_SemaphoreAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_SemaphoreAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +static void NMI_SemaphoreFillDefault(tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + pstrAttrs->u32InitCount = 1; + #ifdef CONFIG_NMI_SEMAPHORE_TIMEOUT + pstrAttrs->u32TimeOut = NMI_OS_INFINITY; + #endif +} +/*! +* @brief Creates a new Semaphore object +* @param[out] pHandle handle to the newly created semaphore +* @param[in] pstrAttrs Optional attributes, NULL for defaults + pstrAttrs->u32InitCount controls the initial count +* @return Error code indicating success/failure +* @sa NMI_SemaphoreAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_SemaphoreCreate(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs); + +/*! +* @brief Destroyes an existing Semaphore, releasing any resources +* @param[in] pHandle handle to the semaphore object +* @param[in] pstrAttrs Optional attributes, NULL for defaults +* @return Error code indicating success/failure +* @sa NMI_SemaphoreAttrs +* @todo need to define behaviour if the semaphore delayed while it is pending +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_SemaphoreDestroy(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs); + +/*! +* @brief Acquire the Semaphore object +* @details This function will block until it can Acquire the given +* semaphore, if the feature NMI_OS_FEATURE_SEMAPHORE_TIMEOUT is +* eanbled a timeout value can be passed in pstrAttrs +* @param[in] pHandle handle to the semaphore object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating success/failure +* @sa NMI_SemaphoreAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_SemaphoreAcquire(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs); + +/*! +* @brief Release the Semaphore object +* @param[in] pHandle handle to the semaphore object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_SemaphoreAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_SemaphoreRelease(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs); + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Sleep.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Sleep.h new file mode 100755 index 00000000..f183ed17 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Sleep.h @@ -0,0 +1,45 @@ +#ifndef __NMI_SLEEP_H__ +#define __NMI_SLEEP_H__ + +/*! +* @file NMI_Sleep.h +* @brief Sleep OS Wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_SLEEP_FEATURE +#error the feature NMI_OS_FEATURE_SLEEP must be supported to include this file +#endif + +/*! +* @brief forces the current thread to sleep until the given time has elapsed +* @param[in] u32TimeMilliSec Time to sleep in Milli seconds +* @sa NMI_SleepMicrosec +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +* @note This function offers a relatively innacurate and low resolution + sleep, for accurate high resolution sleep use u32TimeMicoSec +*/ +void NMI_Sleep(NMI_Uint32 u32TimeMilliSec); + +#ifdef CONFIG_NMI_SLEEP_HI_RES +/*! +* @brief forces the current thread to sleep until the given time has elapsed +* @param[in] u32TimeMicoSec Time to sleep in Micro seconds +* @sa NMI_Sleep +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +* @note This function offers an acurare high resolution sleep, depends on + the feature NMI_OS_FEATURE_SLEEP_HI_RES and may not be supported + on all Operating Systems +*/ +void NMI_SleepMicrosec(NMI_Uint32 u32TimeMicoSec); +#endif + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Socket.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Socket.h new file mode 100755 index 00000000..cd7ff454 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Socket.h @@ -0,0 +1,95 @@ +#ifndef __NMI_SOCKET_H__ +#define __NMI_SOCKET_H__ + +/*! +* @file NMI_Socket.h +* @brief Socket Connection functionality +* @author remil +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 19 Oct 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_SOCKET_FEATURE +#error the feature CONFIG_NMI_SOCKET_FEATURE must be supported to include this file +#endif + + +/*! +* Maximum length of IP address +*/ +#define MAX_IP_LENGTH 16 + +/*============================================================================*/ +/*! +* @struct tpfNMI_TcpReceptionCB +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +typedef void (*tpfNMI_TcpReceptionCB)(NMI_Uint8* pu8Buffer, + NMI_Uint32 u32ReceivedDataLength, + void* vpUserData); +/*============================================================================*/ +/*! +* @struct tstrTcpConnection +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +typedef struct _tstrTcpConnection +{ + NMI_Uint32 u32SocketFd; + NMI_Sint32 s32Port; + NMI_Char cpIPAddress[MAX_IP_LENGTH]; + tpfNMI_TcpReceptionCB fpTcpReceptionCB; + NMI_ThreadHandle strThreadHandle; + tstrNMI_ThreadAttrs strThreadAttrs; + void* vpUserData; + +}tstrTcpConnection; + + +/*============================================================================*/ +/*! +* @brief +* @return +* @note +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +NMI_ErrNo NMI_TcpConnect(tstrTcpConnection* pstrTcpConnection); + +/*============================================================================*/ +/*! +* @brief +* @return +* @note +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +void NMI_TcpDisconnect(tstrTcpConnection* pstrTcpConnection); + +/*============================================================================*/ +/*! +* @brief +* @return +* @note +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +NMI_ErrNo NMI_TcpSend(tstrTcpConnection* pstrTcpConnection, + NMI_Uint8* u8Buf, + NMI_Uint32 u32DataSize); + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_StrUtils.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_StrUtils.h new file mode 100755 index 00000000..ae99958d --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_StrUtils.h @@ -0,0 +1,415 @@ +#ifndef __NMI_STRUTILS_H__ +#define __NMI_STRUTILS_H__ + +/*! +* @file NMI_StrUtils.h +* @brief Basic string utilities +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 16 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_STRING_UTILS +#error the feature CONFIG_NMI_STRING_UTILS must be supported to include this file +#endif + +/*! +* @brief Compares two memory buffers +* @param[in] pvArg1 pointer to the first memory location +* @param[in] pvArg2 pointer to the second memory location +* @param[in] u32Count the size of the memory buffers +* @return 0 if the 2 buffers are equal, 1 if pvArg1 is bigger than pvArg2, + -1 if pvArg1 smaller than pvArg2 +* @note this function repeats the functionality of standard memcmp +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_memcmp(const void* pvArg1, const void* pvArg2, NMI_Uint32 u32Count); + +/*! +* @brief Internal implementation for memory copy +* @param[in] pvTarget the target buffer to which the data is copied into +* @param[in] pvSource pointer to the second memory location +* @param[in] u32Count the size of the data to copy +* @note this function should not be used directly, use NMI_memcpy instead +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void NMI_memcpy_INTERNAL(void* pvTarget, const void* pvSource, NMI_Uint32 u32Count); + +/*! +* @brief Copies the contents of a memory buffer into another +* @param[in] pvTarget the target buffer to which the data is copied into +* @param[in] pvSource pointer to the second memory location +* @param[in] u32Count the size of the data to copy +* @return NMI_SUCCESS if copy is successfully handeled + NMI_FAIL if copy failed +* @note this function repeats the functionality of standard memcpy, + however memcpy is undefined if the two buffers overlap but this + implementation will check for overlap and report error +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +static NMI_ErrNo NMI_memcpy(void* pvTarget, const void* pvSource, NMI_Uint32 u32Count) +{ + if( + (((NMI_Uint8*)pvTarget <= (NMI_Uint8*)pvSource) + && (((NMI_Uint8*)pvTarget+u32Count) > (NMI_Uint8*)pvSource)) + + || (((NMI_Uint8*)pvSource <= (NMI_Uint8*)pvTarget) + && (((NMI_Uint8*)pvSource+u32Count) > (NMI_Uint8*)pvTarget)) + ) + { + /* ovelapped memory, return Error */ + return NMI_FAIL; + } + else + { + NMI_memcpy_INTERNAL(pvTarget, pvSource, u32Count); + return NMI_SUCCESS; + } +} + +/*! +* @brief Sets the contents of a memory buffer with the given value +* @param[in] pvTarget the target buffer which contsnts will be set +* @param[in] u8SetValue the value to be used +* @param[in] u32Count the size of the memory buffer +* @return value of pvTarget +* @note this function repeats the functionality of standard memset +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_memset(void* pvTarget, NMI_Uint8 u8SetValue, NMI_Uint32 u32Count); + +/*! +* @brief Concatenates the contents of 2 strings up to a given count +* @param[in] pcTarget the target string, its null character will be overwritten + and contents of pcSource will be concatentaed to it +* @param[in] pcSource the source string the will be concatentaed +* @param[in] u32Count copying will proceed until a null character in pcSource + is encountered or u32Count of bytes copied +* @return value of pcTarget +* @note this function repeats the functionality of standard strncat +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncat(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count); + +/*! +* @brief copies the contents of source string into the target string +* @param[in] pcTarget the target string buffer +* @param[in] pcSource the source string the will be copied +* @param[in] u32Count copying will proceed until a null character in pcSource + is encountered or u32Count of bytes copied +* @return value of pcTarget +* @note this function repeats the functionality of standard strncpy +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncpy(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count); + +/*! +* @brief Compares two strings +* @details Compares 2 strings reporting which is bigger, NMI_NULL is considered + the smallest string, then a zero length string then all other + strings depending on thier ascii characters order +* @param[in] pcStr1 the first string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] pcStr2 the second string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, + -1 if pcStr1 smaller than pcStr2 +* @note this function repeats the functionality of standard strcmp +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strcmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2); + +/*! +* @brief Compares two strings up to u32Count characters +* @details Compares 2 strings reporting which is bigger, NMI_NULL is considered + the smallest string, then a zero length string then all other + strings depending on thier ascii characters order with small case + converted to uppder case +* @param[in] pcStr1 the first string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] pcStr2 the second string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] u32Count copying will proceed until a null character in pcStr1 or + pcStr2 is encountered or u32Count of bytes copied +* @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, + -1 if pcStr1 smaller than pcStr2 +* @author aabozaeid +* @date 7 Dec 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strncmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count); + +/*! +* @brief Compares two strings ignoring the case of its latin letters +* @details Compares 2 strings reporting which is bigger, NMI_NULL is considered + the smallest string, then a zero length string then all other + strings depending on thier ascii characters order with small case + converted to uppder case +* @param[in] pcStr1 the first string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] pcStr2 the second string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, + -1 if pcStr1 smaller than pcStr2 +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_Sint32 NMI_strcmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2); + +/*! +* @brief Compares two strings ignoring the case of its latin letters up to +* u32Count characters +* @details Compares 2 strings reporting which is bigger, NMI_NULL is considered + the smallest string, then a zero length string then all other + strings depending on thier ascii characters order with small case + converted to uppder case +* @param[in] pcStr1 the first string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] pcStr2 the second string, NMI_NULL is valid and considered smaller + than any other non-NULL string (incliding zero lenght strings) +* @param[in] u32Count copying will proceed until a null character in pcStr1 or + pcStr2 is encountered or u32Count of bytes copied +* @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, + -1 if pcStr1 smaller than pcStr2 +* @author aabozaeid +* @date 7 Dec 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strncmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count); + +/*! +* @brief gets the length of a string +* @param[in] pcStr the string +* @return the length +* @note this function repeats the functionality of standard strlen +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strlen(const NMI_Char* pcStr); + +/*! +* @brief convert string to integer +* @param[in] pcStr the string +* @return the value of string +* @note this function repeats the functionality of the libc atoi +* @author bfahmy +* @date 28 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strtoint(const NMI_Char* pcStr); + +/*! +* @brief print a formatted string into a buffer +* @param[in] pcTarget the buffer where the resulting string is written +* @param[in] u32Size size of the output beffer including the \0 terminating + character +* @param[in] pcFormat format of the string +* @return number of character written or would have been written if the + string were not truncated +* @note this function repeats the functionality of standard snprintf +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_Sint32 NMI_snprintf(NMI_Char* pcTarget, NMI_Uint32 u32Size, + const NMI_Char* pcFormat, ...); + + +#ifdef CONFIG_NMI_EXTENDED_STRING_OPERATIONS + + +/** +* @brief +* @details Searches for the first occurrence of the character c in the first n bytes + of the string pointed to by the argument str. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_memchr(const void *str, NMI_Char c, NMI_Sint32 n); + +/** +* @brief +* @details Searches for the first occurrence of the character c (an unsigned char) + in the string pointed to by the argument str. + The terminating null character is considered to be part of the string. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strchr(const NMI_Char *str, NMI_Char c); + +/** +* @brief +* @details Appends the string pointed to by str2 to the end of the string pointed to by str1. + The terminating null character of str1 is overwritten. + Copying stops once the terminating null character of str2 is copied. If overlapping occurs, the result is undefined. + The argument str1 is returned. +* @param[in] NMI_Char* str1, +* @param[in] NMI_Char* str2, +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcat(NMI_Char *str1, const NMI_Char *str2); + + +/** +* @brief +* @details Copy pcSource to pcTarget +* @param[in] NMI_Char* pcTarget +* @param[in] const NMI_Char* pcSource +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcpy(NMI_Char* pcTarget, const NMI_Char* pcSource); + + + +/** +* @brief +* @details Finds the first sequence of characters in the string str1 that + does not contain any character specified in str2. + Returns the length of this first sequence of characters found that + do not match with str2. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Uint32 +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strcspn(const NMI_Char *str1, const NMI_Char *str2); + + +/** +* @brief +* @details Searches an internal array for the error number errnum and returns a pointer + to an error message string. + Returns a pointer to an error message string. +* @param[in] NMI_Sint32 errnum +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strerror(NMI_Sint32 errnum); + +/** +* @brief +* @details Finds the first occurrence of the entire string str2 + (not including the terminating null character) which appears in the string str1. + Returns a pointer to the first occurrence of str2 in str1. + If no match was found, then a null pointer is returned. + If str2 points to a string of zero length, then the argument str1 is returned. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strstr(const NMI_Char *str1, const NMI_Char *str2); + +/** +* @brief +* @details Searches for the first occurrence of the character c (an unsigned char) + in the string pointed to by the argument str. + The terminating null character is considered to be part of the string. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strchr(const NMI_Char *str, NMI_Char c); + + +/** +* @brief +* @details Parses the C string str interpreting its content as a floating point + number and returns its value as a double. + If endptr is not a null pointer, the function also sets the value pointed + by endptr to point to the first character after the number. +* @param[in] const NMI_Char* str +* @param[in] NMI_Char** endptr +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_StringToDouble(const NMI_Char* str, + NMI_Char** endptr); + + +/** +* @brief Parses the C string str interpreting its content as an unsigned integral + number of the specified base, which is returned as an unsigned long int value. +* @details The function first discards as many whitespace characters as necessary + until the first non-whitespace character is found. + Then, starting from this character, takes as many characters as possible + that are valid following a syntax that depends on the base parameter, + and interprets them as a numerical value. + Finally, a pointer to the first character following the integer + representation in str is stored in the object pointed by endptr. +* @param[in] const NMI_Char *str +* @param[in] NMI_Char **endptr +* @param[in] NMI_Sint32 base +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringToUint32(const NMI_Char *str, + NMI_Char **endptr, + NMI_Sint32 base); + + + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Thread.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Thread.h new file mode 100755 index 00000000..42ff55cd --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Thread.h @@ -0,0 +1,155 @@ +#ifndef __NMI_THREAD_H__ +#define __NMI_THREAD_H__ + +/*! +* @file NMI_Thread.h +* @brief Thread OS Wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_THREAD_FEATURE +#error the feature NMI_OS_FEATURE_THREAD must be supported to include this file +#endif + +typedef void (*tpfNMI_ThreadFunction)(void*); + +typedef enum +{ + #ifdef CONFIG_NMI_THREAD_STRICT_PRIORITY + NMI_OS_THREAD_PIORITY_0 = 0, + NMI_OS_THREAD_PIORITY_1 = 1, + NMI_OS_THREAD_PIORITY_2 = 2, + NMI_OS_THREAD_PIORITY_3 = 3, + NMI_OS_THREAD_PIORITY_4 = 4, + #endif + + NMI_OS_THREAD_PIORITY_HIGH = 0, + NMI_OS_THREAD_PIORITY_NORMAL = 2, + NMI_OS_THREAD_PIORITY_LOW = 4 +}tenuNMI_ThreadPiority; + +/*! +* @struct NMI_ThreadAttrs +* @brief Thread API options +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +typedef struct +{ + /*!< + stack size for use with NMI_ThreadCreate, default is NMI_OS_THREAD_DEFAULT_STACK + */ + NMI_Uint32 u32StackSize; + + /*!< + piority for the thread, if NMI_OS_FEATURE_THREAD_STRICT_PIORITY is defined + this value is strictly observed and can take a larger resolution + */ + tenuNMI_ThreadPiority enuPiority; + + #ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL + /*! + if true the thread will be created suspended + */ + NMI_Bool bStartSuspended; + #endif + +}tstrNMI_ThreadAttrs; + +#define NMI_OS_THREAD_DEFAULT_STACK (10*1024) + +/*! +* @brief Fills the NMI_ThreadAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_ThreadAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ + +static void NMI_ThreadFillDefault(tstrNMI_ThreadAttrs* pstrAttrs) +{ + pstrAttrs->u32StackSize = NMI_OS_THREAD_DEFAULT_STACK; + pstrAttrs->enuPiority = NMI_OS_THREAD_PIORITY_NORMAL; + + #ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL + pstrAttrs->bStartSuspended = NMI_FALSE; + #endif +} + +/*! +* @brief Creates a new thread +* @details if the feature NMI_OS_FEATURE_THREAD_SUSPEND_CONTROL is + defined and tstrNMI_ThreadAttrs.bStartSuspended is set to true + the new thread will be created in suspended state, otherwise + it will start executing immeadiately + if the feature NMI_OS_FEATURE_THREAD_STRICT_PIORITY is defined + piorities are strictly observed, otherwise the underlaying OS + may not observe piorities +* @param[out] pHandle handle to the newly created thread object +* @param[in] pfEntry pointer to the entry point of the new thread +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_ThreadAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ThreadCreate(NMI_ThreadHandle* pHandle, tpfNMI_ThreadFunction pfEntry, + void* pvArg, tstrNMI_ThreadAttrs* pstrAttrs); + +/*! +* @brief Destroys the Thread object +* @details This function is used for clean up and freeing any used resources +* This function will block until the destroyed thread exits cleanely, +* so, the thread code thould handle an exit case before this calling +* this function +* @param[in] pHandle handle to the thread object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_ThreadAttrs +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ThreadDestroy(NMI_ThreadHandle* pHandle, + tstrNMI_ThreadAttrs* pstrAttrs); + +#ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL + +/*! +* @brief Suspends an executing Thread object +* @param[in] pHandle handle to the thread object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_ThreadAttrs +* @note Optional part, NMI_OS_FEATURE_THREAD_SUSPEND_CONTROL must be enabled +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ThreadSuspend(NMI_ThreadHandle* pHandle, + tstrNMI_ThreadAttrs* pstrAttrs); + +/*! +* @brief Resumes a suspened Thread object +* @param[in] pHandle handle to the thread object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_ThreadAttrs +* @note Optional part, NMI_OS_FEATURE_THREAD_SUSPEND_CONTROL must be enabled +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ThreadResume(NMI_ThreadHandle* pHandle, + tstrNMI_ThreadAttrs* pstrAttrs); + +#endif + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Time.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Time.h new file mode 100755 index 00000000..653d9099 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Time.h @@ -0,0 +1,207 @@ +#ifndef __NMI_TIME_H__ +#define __NMI_TIME_H__ + +/*! +* @file NMI_Time.h +* @brief Time retrival functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 2 Sep 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_TIME_FEATURE +#error the feature CONFIG_NMI_TIME_FEATURE must be supported to include this file +#endif + +/*! +* @struct NMI_ThreadAttrs +* @brief Thread API options +* @author syounan +* @date 2 Sep 2010 +* @version 1.0 +*/ +typedef struct +{ + /* a dummy type to prevent compile errors on empty structure*/ + NMI_Uint8 dummy; +}tstrNMI_TimeAttrs; + +typedef struct +{ + /*!< current year */ + NMI_Uint16 u16Year; + /*!< current month */ + NMI_Uint8 u8Month; + /*!< current day */ + NMI_Uint8 u8Day; + + /*!< current hour (in 24H format) */ + NMI_Uint8 u8Hour; + /*!< current minute */ + NMI_Uint8 u8Miute; + /*!< current second */ + NMI_Uint8 u8Second; + +}tstrNMI_TimeCalender; + +/*! +* @brief returns the number of msec elapsed since system start up +* @return number of msec elapsed singe system start up +* @note since this returned value is 32 bit, the caller must handle + wraparounds in values every about 49 of continous operations +* @author syounan +* @date 2 Sep 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_TimeMsec(void); + + + +#ifdef CONFIG_NMI_EXTENDED_TIME_OPERATIONS +/** +* @brief +* @details function returns the implementation's best approximation to the + processor time used by the process since the beginning of an + implementation-dependent time related only to the process invocation. +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_Clock(); + +/** +* @brief +* @details The difftime() function computes the difference between two calendar + times (as returned by NMI_GetTime()): time1 - time0. +* @param[in] NMI_Time time1 +* @param[in] NMI_Time time0 +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_DiffTime(NMI_Time time1, NMI_Time time0); + +/** +* @brief +* @details The gmtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, + expressed as Coordinated Universal Time (UTC). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_GmTime(const NMI_Time* timer); + + +/** +* @brief +* @details The localtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, expressed + as a local time. The function corrects for the timezone and any + seasonal time adjustments. Local timezone information is used as + though localtime() calls tzset(). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_LocalTime(const NMI_Time* timer); + + +/** +* @brief +* @details The mktime() function converts the broken-down time, + expressed as local time, in the structure pointed to by timeptr, + into a time since the Epoch value with the same encoding as that + of the values returned by time(). The original values of the tm_wday + and tm_yday components of the structure are ignored, and the original + values of the other components are not restricted to the ranges described + in the entry. +* @param[in] NMI_tm* timer +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_MkTime(NMI_tm* timer); + + +/** +* @brief +* @details The strftime() function places bytes into the array + pointed to by s as controlled by the string pointed to by format. +* @param[in] NMI_Char* s +* @param[in] NMI_Uint32 maxSize +* @param[in] const NMI_Char* format +* @param[in] const NMI_tm* timptr +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringFormatTime(NMI_Char* s, + NMI_Uint32 maxSize, + const NMI_Char* format, + const NMI_tm* timptr); + + +/** +* @brief The NMI_GetTime() function returns the value of time in seconds since the Epoch. +* @details The tloc argument points to an area where the return value is also stored. + If tloc is a null pointer, no value is stored. +* @param[in] NMI_Time* tloc +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_GetTime(NMI_Time* tloc); + +#endif + +#ifdef CONFIG_NMI_TIME_UTC_SINCE_1970 + +/*! +* @brief returns the number of seconds elapsed since 1970 (in UTC) +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return number of seconds elapsed since 1970 (in UTC) +* @sa tstrNMI_TimeAttrs +* @author syounan +* @date 2 Sep 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_TimeUtcSince1970(tstrNMI_TimeAttrs* pstrAttrs); + +#endif + +#ifdef CONFIG_NMI_TIME_CALENDER + +/*! +* @brief gets the current calender time +* @return number of seconds elapsed since 1970 (in UTC) +* @param[out] ptstrCalender calender structure to be filled with time +* @param[in] pstrAttrs Optional attributes, NULL for default +* @sa NMI_ThreadAttrs +* @author syounan +* @date 2 Sep 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_TimeCalender(tstrNMI_TimeCalender* ptstrCalender, + tstrNMI_TimeAttrs* pstrAttrs); + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Timer.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Timer.h new file mode 100755 index 00000000..ee1978f7 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_Timer.h @@ -0,0 +1,154 @@ +#ifndef __NMI_TIMER_H__ +#define __NMI_TIMER_H__ + +/*! +* @file NMI_Timer.h +* @brief Timer (One Shot and Periodic) OS wrapper functionality +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 16 Aug 2010 +* @version 1.0 +*/ + +#ifndef CONFIG_NMI_TIMER_FEATURE +#error the feature CONFIG_NMI_TIMER_FEATURE must be supported to include this file +#endif + +typedef void (*tpfNMI_TimerFunction)(void*); + +/*! +* @struct tstrNMI_TimerAttrs +* @brief Timer API options +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +typedef struct +{ + /*!< if set to NMI_TRUE the callback function will be called + periodically. */ + #ifdef CONFIG_NMI_TIMER_PERIODIC + NMI_Bool bPeriodicTimer; + #endif + + /* a dummy member to avoid compiler errors*/ + NMI_Uint8 dummy; +}tstrNMI_TimerAttrs; + +/*! +* @brief Fills the NMI_TimerAttrs with default parameters +* @param[out] pstrAttrs structure to be filled +* @sa NMI_TimerAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ + +static void NMI_TimerFillDefault(tstrNMI_TimerAttrs* pstrAttrs) +{ + #ifdef CONFIG_NMI_TIMER_PERIODIC + pstrAttrs->bPeriodicTimer = NMI_FALSE; + #endif +} + + +/*! +* @brief Creates a new timer +* @details Timers are a useful utility to execute some callback function + in the future. + A timer object has 3 states : IDLE, PENDING and EXECUTING + IDLE : initial timer state after creation, no execution for the + callback function is planned + PENDING : a request to execute the callback function is made + using NMI_TimerStart. + EXECUTING : the timer has expired and its callback is now + executing, when execution is done the timer returns to PENDING + if the feature CONFIG_NMI_TIMER_PERIODIC is enabled and + the flag tstrNMI_TimerAttrs.bPeriodicTimer is set. otherwise the + timer will return to IDLE +* @param[out] pHandle handle to the newly created timer object +* @param[in] pfEntry pointer to the callback function to be called when the + timer expires + the underlaying OS may put many restrictions on what can be + called inside a timer's callback, as a general rule no blocking + operations (IO or semaphore Acquision) should be perfomred + It is recommended that the callback will be as short as possible + and only flags other threads to do the actual work + also it should be noted that the underlaying OS maynot give any + guarentees on which contect this callback will execute in +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_TimerAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_TimerCreate(NMI_TimerHandle* pHandle, + tpfNMI_TimerFunction pfCallback, tstrNMI_TimerAttrs* pstrAttrs); + + +/*! +* @brief Destroys a given timer +* @details This will destroy a given timer freeing any resources used by it + if the timer was PENDING Then must be cancelled as well(i.e. + goes to IDLE, same effect as calling NMI_TimerCancel first) + if the timer was EXECUTING then the callback will be allowed to + finish first then all resources are freed +* @param[in] pHandle handle to the timer object +* @param[in] pstrAttrs Optional attributes, NULL for default +* @return Error code indicating sucess/failure +* @sa NMI_TimerAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_TimerDestroy(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs); + +/*! +* @brief Starts a given timer +* @details This function will move the timer to the PENDING state until the + given time expires (in msec) then the callback function will be + executed (timer in EXECUTING state) after execution is dene the + timer either goes to IDLE (if bPeriodicTimer==NMI_FALSE) or + PENDING with same timeout value (if bPeriodicTimer==NMI_TRUE) +* @param[in] pHandle handle to the timer object +* @param[in] u32Timeout timeout value in msec after witch the callback + function will be executed. Timeout value of 0 is not allowed for + periodic timers +* @param[in] pstrAttrs Optional attributes, NULL for default, + set bPeriodicTimer to run this timer as a periodic timer +* @return Error code indicating sucess/failure +* @sa NMI_TimerAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_TimerStart(NMI_TimerHandle* pHandle, NMI_Uint32 u32Timeout, void* pvArg, + tstrNMI_TimerAttrs* pstrAttrs); + + +/*! +* @brief Stops a given timer +* @details This function will move the timer to the IDLE state cancelling + any sheduled callback execution. + if this function is called on a timer already in the IDLE state + it will have no effect. + if this function is called on a timer in EXECUTING state + (callback has already started) it will wait until executing is + done then move the timer to the IDLE state (which is trivial + work if the timer is non periodic) +* @param[in] pHandle handle to the timer object +* @param[in] pstrAttrs Optional attributes, NULL for default, +* @return Error code indicating sucess/failure +* @sa NMI_TimerAttrs +* @author syounan +* @date 16 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_TimerStop(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs); + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_platform.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_platform.h new file mode 100755 index 00000000..f814dd97 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/include/NMI_platform.h @@ -0,0 +1,207 @@ +#ifndef __NMI_platfrom_H__ +#define __NMI_platfrom_H__ + +/*! +* @file NMI_platform.h +* @brief platform specific file, when creating OS wrapper for a + new platform start wih this file +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 10 Aug 2010 +* @version 1.0 +*/ + + +/****************************************************************** + Feature support checks +*******************************************************************/ +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_STRICT_PRIORITY +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SEMAPHORE_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SEMAPHORE_TIMEOUT +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SLEEP_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SLEEP_HI_RES +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIMER_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIMER_PERIODIC +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_POOLS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_DEBUG +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_ASSERTION_SUPPORT +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_STRING_UTILS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_STRING_API +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_PATH_API +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_UTC_SINCE_1970 +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_CALENDER +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_TIMEOUT +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MATH_OPERATIONS_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EXTENDED_FILE_OPERATIONS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EXTENDED_STRING_OPERATIONS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EXTENDED_TIME_OPERATIONS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SOCKET_FEATURE +#error This feature is not supported by this OS +#endif + +/****************************************************************** + OS specific includes +*******************************************************************/ + + +/****************************************************************** + OS specific types +*******************************************************************/ + +/* change into OS specific type */ +typedef void* NMI_ThreadHandle; + +/* change into OS specific type */ +typedef void* NMI_SemaphoreHandle; + +/* change into OS specific type */ +typedef void* NMI_TimerHandle; + +/* change into OS specific type */ +typedef void* NMI_MemoryPoolHandle; + +/* change into OS specific type */ +typedef void* NMI_MsgQueueHandle; + +/* change into OS specific type */ +typedef void* NMI_FileHandle; + +/* change into OS specific type */ +typedef void* NMI_EventHandle; + +/******************************************************************* + others +********************************************************************/ + +/* Generic printf function, map it to the standard printf */ +#define NMI_PRINTF(...) +#define __NMI_FILE__ +#define __NMI_FUNCTION__ +#define __NMI_LINE__ +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/Makefile b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/Makefile new file mode 100755 index 00000000..7482ef0d --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/Makefile @@ -0,0 +1,67 @@ +#ARCH = arm +MAKE = make +#CC = arm-linux-gcc +#AR = arm-linux-ar +ifeq ($(TARGET),PANDA) +CC = arm-eabi-gcc +AR = arm-eabi-ar +else +CC = gcc +AR = ar +endif +RM = rm +MV = mv +ECHO = echo +CFLAGS = -g +ifeq ($(TARGET),PANDA) +CFLAGS += -mabi=aapcs-linux +endif +PROGS = liboswrapper.a +OBJECTS = NMI_Event.o NMI_FileOps.o NMI_Math.o NMI_Memory.o NMI_MsgQueue.o NMI_Semaphore.o NMI_Sleep.o NMI_Socket.o NMI_StrUtils.o NMI_Thread.o NMI_Time.o NMI_Timer.o + + +PWD = $(shell pwd) +ifeq ($(TARGET),PANDA) +OBJDIR = $(PWD)/../../binary/linux/panda +else +OBJDIR = $(PWD)/../../binary/linux/x86 +endif + +INCHDR = -I$(PWD)/../ +INCHDR += -I$(PWD). +INCHDR += -I$(PWD)/../../ +INCHDR += -I$(PWD)/../../../ +INCHDR += -I$(PWD)/include +INCHDR += -I$(PWD)/source +ifeq ($(TARGET),PANDA) +INCHDR += -I/home/npminc/pandaboard/android4.0/system/core/include/ +INCHDR += -I/home/npminc/pandaboard/android4.0/prebuilt/ndk/android-ndk-r4/platforms/android-3/arch-arm/usr/include +endif +INCHDR += -DNMI_PLATFORM=NMI_LINUX + +VPATH = $(OBJDIR) +VPATH += source + + +$(OBJDIR)/%.o : %.c + @$(ECHO) "###########################################" + @$(ECHO) "#### Building" $< + $(CC) $(INCHDR) $(CFLAGS) -c $< -o $@ + +OBJPROG = $(addprefix $(OBJDIR)/, $(PROGS)) + +$(OBJPROG): $(addprefix $(OBJDIR)/, $(OBJECTS)) + @$(ECHO) "###########################################" + @$(ECHO) "#### Linking library" $@ + $(AR) rcs $@ $^ + +all:build +Debug:build +Release:build +cleanDebug:clean +cleanRelease:clean + +clean: + $(RM) -f $(OBJPROG) $(addprefix $(OBJDIR)/, $(OBJECTS)) + +build: $(OBJPROG) diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/include/NMI_platform.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/include/NMI_platform.h new file mode 100755 index 00000000..14883a7c --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/include/NMI_platform.h @@ -0,0 +1,209 @@ +#ifndef __NMI_platfrom_H__ +#define __NMI_platfrom_H__ + +/*! +* @file NMI_platform.h +* @brief platform specific file for Linux port +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 15 Dec 2010 +* @version 1.0 +*/ + + +/****************************************************************** + Feature support checks +*******************************************************************/ + +// CONFIG_NMI_THREAD_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_STRICT_PRIORITY +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_SEMAPHORE_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SEMAPHORE_TIMEOUT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_SLEEP_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SLEEP_HI_RES +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_TIMER_FEATURE is implemented + +// CONFIG_NMI_TIMER_PERIODIC is implemented + +// CONFIG_NMI_MEMORY_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_POOLS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_DEBUG +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_ASSERTION_SUPPORT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_STRING_UTILS is implemented + +// CONFIG_NMI_MSG_QUEUE_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_FILE_OPERATIONS_FEATURE is implemented + +// CONFIG_NMI_FILE_OPERATIONS_STRING_API is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_PATH_API +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_TIME_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_UTC_SINCE_1970 +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_CALENDER +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_TIMEOUT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_MATH_OPERATIONS_FEATURE is implemented + +// CONFIG_NMI_EXTENDED_FILE_OPERATIONS is implemented + +// CONFIG_NMI_EXTENDED_STRING_OPERATIONS is implemented + +// CONFIG_NMI_EXTENDED_TIME_OPERATIONS is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SOCKET_FEATURE +#error This feature is not supported by this OS +#endif + +/****************************************************************** + OS specific includes +*******************************************************************/ +#define _XOPEN_SOURCE 600 + +#include +#include + +#include +#include + +#include +#include +#include + +/****************************************************************** + OS specific types +*******************************************************************/ + +typedef pthread_t NMI_ThreadHandle; + +typedef sem_t NMI_SemaphoreHandle; + +typedef struct{ + + /* the underlaying posix timer stored here */ + timer_t timerObject; + + /* semaphore for protection */ + NMI_SemaphoreHandle hAccessProtection; + + /* the callback is kept here */ + /* shoud be a proper pointer to function type + insted of void*, but the timer callback type is + defined later in its header */ + void* pfCallbackFunction; + + /* the invocation argument is kept here */ + void* pvArgument; + + /* if NMI_TRUE then the system expects a timer callback after a while + if NMI_FALSE then the callback should be ignored */ + NMI_Bool bPendingTimer; + +}NMI_TimerHandle; + +/* change into OS specific type */ +typedef void* NMI_MemoryPoolHandle; + +/* Message Queue type is a structure */ +typedef struct __Message_struct +{ + void* pvBuffer; + NMI_Uint32 u32Length; + struct __Message_struct *pstrNext; +} Message; + +typedef struct __MessageQueue_struct +{ + NMI_SemaphoreHandle hSem; + NMI_Bool bExiting; + NMI_Uint32 u32ReceiversCount; + NMI_SemaphoreHandle strCriticalSection; + Message * pstrMessageList; +} NMI_MsgQueueHandle; + +typedef FILE* NMI_FileHandle; + +/* change into OS specific type */ +typedef void* NMI_EventHandle; + +/*Time represented in 64 bit format*/ +typedef time_t NMI_Time; + +/*Time and date represented in a data structure*/ +typedef struct tm NMI_tm; + +/******************************************************************* + others +********************************************************************/ + +/* Generic printf function */ +#define NMI_PRINTF(...) printf(__VA_ARGS__) +#define __NMI_FILE__ __FILE__ +#define __NMI_FUNCTION__ __FUNCTION__ +#define __NMI_LINE__ __LINE__ +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Event.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Event.c new file mode 100755 index 00000000..29bd2cfa --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Event.c @@ -0,0 +1,112 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_EVENT_FEATURE + + +/*! +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventCreate(NMI_EventHandle* pHandle, tstrNMI_EventAttrs* pstrAttrs) +{ + *pHandle = CreateEvent( + NULL, /* default security attributes */ + FALSE, /* auto reset */ + FALSE, /* initial state is non-signalled (UNTRIGGERED) */ + NULL /* unnamed object */); + + if(*pHandle != NULL) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +/*! +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventDestroy(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs) +{ + if(CloseHandle(*pHandle) != 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +/*! +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventTrigger(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs) +{ + if( SetEvent(*pHandle) != 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +/*! +* @author syounan +* @date 10 Oct 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_EventWait(NMI_EventHandle* pHandle, + tstrNMI_EventAttrs* pstrAttrs) +{ + + DWORD dwMilliseconds = INFINITE; + DWORD dwWaitResult; + NMI_ErrNo s32RetStatus; + + #ifdef CONFIG_NMI_EVENT_TIMEOUT + if((pstrAttrs != NMI_NULL) + && (pstrAttrs->u32TimeOut != NMI_OS_INFINITY)) + { + dwMilliseconds = pstrAttrs->u32TimeOut; + } + #endif + + dwWaitResult = WaitForSingleObject(*pHandle, dwMilliseconds); + + switch(dwWaitResult) + { + case WAIT_OBJECT_0: + s32RetStatus = NMI_SUCCESS; + break; + + case WAIT_TIMEOUT: + s32RetStatus = NMI_TIMEOUT; + break; + + default: + case WAIT_FAILED: + s32RetStatus = NMI_FAIL; + } + + return s32RetStatus; + +} + + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_FileOps.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_FileOps.c new file mode 100755 index 00000000..a9ce643d --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_FileOps.c @@ -0,0 +1,539 @@ + +#define _CRT_SECURE_NO_DEPRECATE + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#include +#include + +#ifdef CONFIG_NMI_FILE_OPERATIONS_FEATURE + +/** +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_fopen(NMI_FileHandle* pHandle, const NMI_Char* pcPath, + tstrNMI_FileOpsAttrs* pstrAttrs) +{ + tstrNMI_FileOpsAttrs strFileDefaultAttrs; + char* mode; + + if(pstrAttrs == NMI_NULL) + { + NMI_FileOpsFillDefault(&strFileDefaultAttrs); + pstrAttrs = &strFileDefaultAttrs; + } + + switch(pstrAttrs->enuAccess) + { + case NMI_FILE_READ_ONLY: + mode = "rb"; + break; + + case NMI_FILE_READ_WRITE_NEW: + mode = "wb+"; + break; + + default: + case NMI_FILE_READ_WRITE_EXISTING: + mode = "rb+"; + break; + } + + *pHandle = fopen(pcPath, mode); + + if(*pHandle != NULL) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } + +} + +/** +* @author syounan +* @date 30 Aug 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_fclose(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + if(fclose(*pHandle) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_fread(NMI_FileHandle* pHandle, NMI_Uint8* pu8Buffer, + NMI_Uint32 u32Size, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + return (NMI_Uint32)fread(pu8Buffer, 1, u32Size, *pHandle); +} + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_fwrite(NMI_FileHandle* pHandle, NMI_Uint8* pu8Buffer, + NMI_Uint32 u32Size, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + return (NMI_Uint32)fwrite(pu8Buffer, 1, u32Size, *pHandle); +} + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Bool NMI_feof(NMI_FileHandle* pHandle) +{ + if(feof(*pHandle) != 0) + { + return NMI_TRUE; + } + else + { + return NMI_FALSE; + } +} + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fseek(NMI_FileHandle* pHandle, NMI_Sint32 s32Offset, + tstrNMI_FileOpsAttrs* pstrAttrs) +{ + tstrNMI_FileOpsAttrs strFileDefaultAttrs; + int mode; + + if(pstrAttrs == NMI_NULL) + { + NMI_FileOpsFillDefault(&strFileDefaultAttrs); + pstrAttrs = &strFileDefaultAttrs; + } + + switch(pstrAttrs->enuSeekOrigin) + { + case NMI_SEEK_FROM_START: + mode = SEEK_SET; + break; + + case NMI_SEEK_FROM_END: + mode = SEEK_END; + break; + + default: + case NMI_SEEK_FROM_CURRENT: + mode = SEEK_CUR; + } + + if(fseek(* pHandle, s32Offset, mode) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_Uint32 NMI_ftell(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + return ftell(*pHandle); +} + + +/** + * @author syounan + * @date 30 Aug 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fflush(NMI_FileHandle* pHandle, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + if(fflush(*pHandle) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/** + * @author mabubakr + * @date 10 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fdelete(const NMI_Char* pcPath, tstrNMI_FileOpsAttrs* pstrAttrs) +{ + if(remove(pcPath) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/** + * @author remil, syounan + * @date 31 Oct 2010 + * @version 2.0 + */ +NMI_ErrNo NMI_FileSize(NMI_FileHandle* pstrFileHandle, NMI_Uint32* pu32Size, + tstrNMI_FileOpsAttrs* pstrAttrs) +{ + struct stat buffer; + if(fstat( (*pstrFileHandle)->_fileno, &buffer) != 0) + { + return NMI_FAIL; + } + else + { + *pu32Size = (NMI_Uint32)buffer.st_size; + return NMI_SUCCESS; + } +} + +#ifdef CONFIG_NMI_EXTENDED_FILE_OPERATIONS + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_Sint32 NMI_getc(NMI_FileHandle* pHandle) +{ + return getc(*pHandle); +} + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_Sint32 NMI_ungetc(NMI_Sint32 c,NMI_FileHandle* pHandle) +{ + return ungetc(c,*pHandle); +} + + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_freopen(NMI_FileHandle* pHandle, const NMI_Char* pcPath, + tstrNMI_FileOpsAttrs* pstrAttrs) +{ + + tstrNMI_FileOpsAttrs strFileDefaultAttrs; + char* mode; + + if(pstrAttrs == NMI_NULL) + { + NMI_FileOpsFillDefault(&strFileDefaultAttrs); + pstrAttrs = &strFileDefaultAttrs; + } + + switch(pstrAttrs->enuAccess) + { + case NMI_FILE_READ_ONLY: + mode = "rb"; + break; + + case NMI_FILE_READ_WRITE_NEW: + mode = "wb"; + break; + + default: + case NMI_FILE_READ_WRITE_EXISTING: + mode = "rb+"; + break; + } + + *pHandle = freopen(pcPath, mode,*pHandle); + + if(*pHandle != NULL) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +/** +* @brief Translates character file open mode to the appropriate Enum Value +* @details +* @param[in] const NMI_Char* cpMode +* @return tenuNMI_AccessMode +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +tenuNMI_AccessMode NMI_resolveFileMode(const NMI_Char* cpMode) +{ + tenuNMI_AccessMode enumAccessMode; + NMI_Char* mode = (NMI_Char*) cpMode; + + while(*mode!= 0) + { + switch(*mode) + { + case 'r': + enumAccessMode = NMI_FILE_READ_ONLY; + break; + + case 'w': + enumAccessMode = NMI_FILE_READ_WRITE_NEW; + break; + + case 'a': + enumAccessMode = NMI_FILE_READ_WRITE_EXISTING; + break; + + case '+': + enumAccessMode= NMI_FILE_READ_WRITE_EXISTING; + } + mode++; + } + + return enumAccessMode; +} + + + +/** + * @author remil + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_rename(const NMI_Char *old_filename, const NMI_Char *new_filename) +{ + if (rename(old_filename,new_filename)== 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +NMI_ErrNo NMI_setbuf(NMI_FileHandle *pHandle, NMI_Char* buffer) +{ + if(pHandle == NMI_NULL || buffer == NMI_NULL) + { + return NMI_FAIL; + }else + { + setbuf (*pHandle,buffer); + return NMI_SUCCESS; + } +} + + +NMI_ErrNo NMI_setvbuf(NMI_FileHandle *pHandle, + NMI_Char* buffer, + NMI_Sint32 mode, + NMI_Uint32 size) +{ + if(pHandle != NMI_NULL && buffer != NMI_NULL) + { + if(setvbuf(*pHandle,buffer,mode,(size_t)size)==0) + { + return NMI_SUCCESS; + } + } + + return NMI_FAIL; + +} + +/* +*Creates a temporary file in binary update mode (wb+). +*The tempfile is removed when the program terminates or the stream is closed. +*On success a pointer to a file stream is returned. On error a null pointer is returned. +*/ +NMI_ErrNo NMI_tmpfile(NMI_FileHandle *pHandle) +{ + *pHandle = tmpfile(); + if(*pHandle == NMI_NULL) + { + return NMI_FAIL; + } + else + { + return NMI_SUCCESS; + } +} + + + +/* + * Reads a line from the specified stream and stores it into the string pointed to by str. + * It stops when either (n-1) characters are read, + * the newline character is read, or the end-of-file is reached, + * whichever comes first. The newline character is copied to the string. + * A null character is appended to the end of the string. + * On success a pointer to the string is returned. On error a null pointer is returned. + * If the end-of-file occurs before any characters have been read, the string remains unchanged. +*/ + +//NMI_Char* NMI_fgets(NMI_Char* str, NMI_Sint32 n, NMI_FileHandle stream) +//{ +// return fgets(str,n,stream); +//} + + +/** +* @brief Clears the end-of-file and error indicators for the given stream. +* @details As long as the error indicator is set, + all stream operations will return an error until NMI_clearerr is called. +* @param[in] NMI_FileHandle* pHandle +* @return N/A +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +void NMI_clearerr(NMI_FileHandle* pHandle) +{ + clearerr(*pHandle); +} + + +/** +* @brief Tests the error indicator for the given stream. +* @details If the error indicator is set, then it returns NMI_FAIL. + If the error indicator is not set, then it returns NMI_SUCCESS. +* @param[in] NMI_FileHandle* pHandle +* @return NMI_ErrNo +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_ErrNo NMI_ferror(NMI_FileHandle* pHandle) +{ + if(ferror(*pHandle)==0) + { + return NMI_SUCCESS; + }else + { + return NMI_FAIL; + } +} + +/** +* @brief Generates and returns a valid temporary filename which does not exist. +* @details If the argument str is a null pointer, then the function returns + a pointer to a valid filename. + If the argument str is a valid pointer to an array, + then the filename is written to the array and a pointer to the same array + is returned.The filename may be up to L_tmpnam characters long. +* @param[in] NMI_Char* str +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_tmpnam(NMI_Char* str) +{ + return tmpnam(str); +} + +#endif + + +#ifdef CONFIG_NMI_FILE_OPERATIONS_STRING_API + +/** + * @author syounan + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fgets(NMI_FileHandle* pHandle, NMI_Char* pcBuffer + , NMI_Uint32 u32Maxsize) +{ + if( fgets(pcBuffer, u32Maxsize, * pHandle) != NMI_NULL) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } + +} + +/** + * @author syounan + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_fprintf(NMI_FileHandle* pHandle, const NMI_Char* pcFormat, ...) +{ + va_list argptr; + va_start(argptr, pcFormat); + if(vfprintf(*pHandle, pcFormat, argptr) > 0) + { + va_end(argptr); + return NMI_SUCCESS; + } + else + { + va_end(argptr); + return NMI_FAIL; + } +} + +/** + * @author syounan + * @date 31 Oct 2010 + * @version 1.0 + */ +NMI_ErrNo NMI_vfprintf(NMI_FileHandle* pHandle, const NMI_Char* pcFormat, + va_list argptr) +{ + if(vfprintf(*pHandle, pcFormat, argptr) > 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Math.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Math.c new file mode 100755 index 00000000..48bfa805 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Math.c @@ -0,0 +1,440 @@ + +#define _CRT_SECURE_NO_DEPRECATE + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_MATH_OPERATIONS_FEATURE + +#include "math.h" + + +/** +* @brief Returns the arc cosine of x in radians. +* @details Returns the arc cosine of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value x must be within the range of -1 to +1 (inclusive). + The returned value is in the range of 0 to pi (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_acos(NMI_Double x) +{ + return acos(x); +} + +/** +* @brief Returns the arc sine of x in radians. +* @details Returns the arc sine of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value x must be within the range of -1 to +1 (inclusive). + The returned value is in the range of 0 to pi (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_asin(NMI_Double x) +{ + return asin(x); +} + + +/** +* @brief Returns the arc tangent of x in radians. +* @details Returns the arc tangent of x in radians. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -p/2 to +p/2 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_atan(NMI_Double x) +{ + return atan(x); +} + +/** +* @brief Returns the arc tangent in radians +* @details Returns the arc tangent in radians of y/x based on the + signs of both values to determine the correct quadrant. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note Both y and x cannot be zero. + The returned value is in the range of -p/2 to +p/2 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_atan2(NMI_Double y, NMI_Double x) +{ + return atan2(y,x); +} + + +/** +* @brief Returns the cosine of a radian angle x. +* @details Returns the cosine of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_cos(NMI_Double x) +{ + return cos(x); +} + + +/** +* @brief Returns the hyperbolic cosine of x. +* @details Returns the hyperbolic cosine of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_cosh(NMI_Double x) +{ + return cosh(x); +} + + +/** +* @brief Returns the sine of a radian angle x. +* @details Returns the sine of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sin(NMI_Double x) +{ + return sin(x); +} + + +/** +* @brief Returns the hyperbolic sine of x. +* @details Returns the hyperbolic sine of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sinh(NMI_Double x) +{ + return sinh(x); +} + +/** +* @brief Returns the tangent of a radian angle x. +* @details Returns the tangent of a radian angle x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_tan(NMI_Double x) +{ + return tan(x); +} + +/** +* @brief Returns the hyperbolic tangent of x. +* @details Returns the hyperbolic tangent of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The value of x has no range. + The returned value is in the range of -1 to +1 (inclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_tanh(NMI_Double x) +{ + return tanh(x); +} + + +/** +* @brief Returns the value of e raised to the xth power. +* @details Returns the value of e raised to the xth power. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_exp(NMI_Double x) +{ + return exp(x); +} + +/** +* @brief The returned value is the mantissa and the integer pointed to by exponent is the exponent. +* @details The returned value is the mantissa and the integer pointed to by exponent is the exponent. + The resultant value is x=mantissa * 2^exponent. +* @param[in] NMI_Double x +* @param[out] NMI_Sint32* exponent +* @return NMI_Double +* @note The mantissa is in the range of .5 (inclusive) to 1 (exclusive). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_frexp(NMI_Double x, NMI_Sint32* exponent) +{ + return frexp(x,exponent); +} + + + +/** +* @brief Returns x multiplied by 2 raised to the power of exponent. +* @details Returns x multiplied by 2 raised to the power of exponent. + x*2^exponent +* @param[in] NMI_Double x +* @param[out] NMI_Sint32 exponent +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_ldexp(NMI_Double x, NMI_Sint32 exponent) +{ + return ldexp(x,exponent); +} + + +/** +* @brief Returns the natural logarithm (base-e logarithm) of x. +* @details Returns the natural logarithm (base-e logarithm) of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_log(NMI_Double x) +{ + return log(x); +} + + + +/** +* @brief Returns the common logarithm (base-10 logarithm) of x. +* @details Returns the common logarithm (base-10 logarithm) of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_log10(NMI_Double x) +{ + return log10(x); +} + + +/** +* @brief Breaks the floating-point number x into integer and fraction components. +* @details Breaks the floating-point number x into integer and fraction components. + The returned value is the fraction component (part after the decimal), + and sets integer to the integer component. + +* @param[in] NMI_Double x +* @param[out] NMI_Double* dInteger +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_modf(NMI_Double x,NMI_Double* dInteger) +{ + return modf(x,dInteger); +} + + + +/** +* @brief Returns x raised to the power of y. +* @details Returns x raised to the power of y. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note x cannot be negative if y is a fractional value. + x cannot be zero if y is less than or equal to zero. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_pow(NMI_Double x,NMI_Double y) +{ + return pow(x,y); +} + + + +/** +* @brief Returns the square root of x. +* @details Returns the square root of x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note The argument cannot be negative. The returned value is always positive. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_sqrt(NMI_Double x) +{ + return sqrt(x); +} + +/** +* @brief Returns the smallest integer value greater than or equal to x. +* @details Returns the smallest integer value greater than or equal to x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_ceil(NMI_Double x) +{ + return ceil(x); +} + + +/** +* @brief Returns the absolute value of x +* @details Returns the absolute value of x + (a negative value becomes positive, positive value is unchanged). +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument. + The return value is always positive. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_fabs(NMI_Double x) +{ + return fabs(x); +} + +/** +* @brief Returns the largest integer value less than or equal to x. +* @details Returns the largest integer value less than or equal to x. +* @param[in] NMI_Double x +* @return NMI_Double +* @note There is no range limit on the argument or return value. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_floor(NMI_Double x) +{ + return floor(x); +} + + +/** +* @brief Returns the remainder of x divided by y. +* @details Returns the remainder of x divided by y. +* @param[in] NMI_Double x +* @param[in] NMI_Double y +* @return NMI_Double +* @note There is no range limit on the return value. + If y is zero, then either a range error will occur or the function + will return zero (implementation-defined). +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_fmod(NMI_Double x,NMI_Double y) +{ + return fmod(x,y); +} + + +/** +* @brief +* @details Returns the absolute value of x. + Note that in two's compliment that the most maximum number cannot be + represented as a positive number. The result in this case is undefined. + The absolute value is returned. +* @param[in] NMI_Sint32 x +* @return NMI_Sint32 +* @note +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_abs(NMI_Sint32 x) +{ + return abs(x); +} + + + + +/** +* @brief +* @details Returns a pseudo-random number in the range of 0 to RAND_MAX. +* @return NMI_Sint32 +* @note +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_rand() +{ + return rand(); +} + + +/** +* @brief +* @details This function seeds the random number generator used by the function rand. + Seeding srand with the same seed will cause rand to return the same sequence + of pseudo-random numbers. + If srand is not called, NMI_rand acts as if NMI_srand(1) has been called. + +* @param[in] NMI_Uint32 seed +* @note No value is returned. +* @author remil +* @date 2 Nov 2010 +* @version 1.0 +*/ +void NMI_srand(NMI_Uint32 seed) +{ + srand(seed); +} + + + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Memory.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Memory.c new file mode 100755 index 00000000..d3b4ecaa --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Memory.c @@ -0,0 +1,72 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_MEMORY_FEATURE + +#include "stdlib.h" + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryAlloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + if(u32Size > 0) + { + return malloc(u32Size); + } + else + { + return NMI_NULL; + } +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryCalloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + return calloc(u32Size, 1); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryRealloc(void* pvOldBlock, NMI_Uint32 u32NewSize, + tstrNMI_MemoryAttrs* strAttrs, NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + if(u32NewSize==0) + { + free(pvOldBlock); + return NMI_NULL; + } + else if(pvOldBlock==NMI_NULL) + { + return malloc(u32NewSize); + } + else + { + return realloc(pvOldBlock, u32NewSize); + } + +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void NMI_MemoryFree(void* pvBlock, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + free(pvBlock); +} + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_MsgQueue.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_MsgQueue.c new file mode 100755 index 00000000..caa814bb --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_MsgQueue.c @@ -0,0 +1,213 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_MSG_QUEUE_FEATURE + + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueCreate(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + tstrNMI_SemaphoreAttrs strSemAttrs; + NMI_SemaphoreFillDefault(&strSemAttrs); + strSemAttrs.u32InitCount = 0; + + if( (NMI_SemaphoreCreate(&pHandle->hSem, &strSemAttrs) == NMI_SUCCESS) + && (NMI_SemaphoreCreate(&pHandle->strCriticalSection, NMI_NULL) == NMI_SUCCESS)) + { + + pHandle->pstrMessageList = NULL; + pHandle->u32ReceiversCount = 0; + pHandle->bExiting = NMI_FALSE; + + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueDestroy(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + + pHandle->bExiting = NMI_TRUE; + + // Release any waiting receiver thread. + while(pHandle->u32ReceiversCount > 0) + { + NMI_SemaphoreRelease(&(pHandle->hSem), NMI_NULL); + pHandle->u32ReceiversCount--; + } + + NMI_SemaphoreDestroy(&pHandle->hSem, NMI_NULL); + NMI_SemaphoreDestroy(&pHandle->strCriticalSection, NMI_NULL); + + while(pHandle->pstrMessageList != NULL) + { + Message * pstrMessge = pHandle->pstrMessageList->pstrNext; + NMI_FREE(pHandle->pstrMessageList); + pHandle->pstrMessageList = pstrMessge; + } + + return NMI_SUCCESS; +} + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueSend(NMI_MsgQueueHandle* pHandle, + const void * pvSendBuffer, NMI_Uint32 u32SendBufferSize, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + + Message * pstrMessage = NULL; + + if( (pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == NULL) ) + { + NMI_ERRORREPORT(s32RetStatus, NMI_INVALID_ARGUMENT); + } + + if(pHandle->bExiting == NMI_TRUE) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + + /* construct a new message */ + pstrMessage = NMI_NEW(Message, 1); + NMI_NULLCHECK(s32RetStatus, pstrMessage); + pstrMessage->u32Length = u32SendBufferSize; + pstrMessage->pstrNext = NULL; + pstrMessage->pvBuffer = NMI_MALLOC(u32SendBufferSize); + NMI_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer); + NMI_memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); + + + /* add it to the message queue */ + if(pHandle->pstrMessageList == NULL) + { + pHandle->pstrMessageList = pstrMessage; + } + else + { + Message * pstrTailMsg = pHandle->pstrMessageList; + while(pstrTailMsg->pstrNext != NULL) + { + pstrTailMsg = pstrTailMsg->pstrNext; + } + pstrTailMsg->pstrNext = pstrMessage; + } + + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + NMI_SemaphoreRelease(&pHandle->hSem, NMI_NULL); + + NMI_CATCH(s32RetStatus) + { + /* error occured, free any allocations */ + if(pstrMessage != NULL) + { + if(pstrMessage->pvBuffer != NULL) + { + NMI_FREE(pstrMessage->pvBuffer); + } + NMI_FREE(pstrMessage); + } + } + + return s32RetStatus; +} + + + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueRecv(NMI_MsgQueueHandle* pHandle, + void * pvRecvBuffer, NMI_Uint32 u32RecvBufferSize, + NMI_Uint32* pu32ReceivedLength, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + + Message * pstrMessage; + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + + if( (pHandle == NULL) || (u32RecvBufferSize == 0) + || (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL) ) + { + NMI_ERRORREPORT(s32RetStatus, NMI_INVALID_ARGUMENT); + } + + if(pHandle->bExiting == NMI_TRUE) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + pHandle->u32ReceiversCount++; + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + s32RetStatus = NMI_SemaphoreAcquire(&(pHandle->hSem), NMI_NULL); + NMI_ERRORCHECK(s32RetStatus); + + if(pHandle->bExiting) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + + pstrMessage = pHandle->pstrMessageList; + if(pstrMessage == NULL) + { + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + /* check buffer size */ + if(u32RecvBufferSize < pstrMessage->u32Length) + { + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + NMI_SemaphoreRelease(&pHandle->hSem, NMI_NULL); + NMI_ERRORREPORT(s32RetStatus, NMI_BUFFER_OVERFLOW); + } + + /* consume the message */ + pHandle->u32ReceiversCount--; + NMI_memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); + *pu32ReceivedLength = pstrMessage->u32Length; + + pHandle->pstrMessageList = pstrMessage->pstrNext; + + NMI_FREE(pstrMessage->pvBuffer); + NMI_FREE(pstrMessage); + + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + NMI_CATCH(s32RetStatus) + { + } + return s32RetStatus; +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Semaphore.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Semaphore.c new file mode 100755 index 00000000..d07bfa0d --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Semaphore.c @@ -0,0 +1,67 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_SEMAPHORE_FEATURE + +NMI_ErrNo NMI_SemaphoreCreate(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + tstrNMI_SemaphoreAttrs strDefaultAttrs; + if(pstrAttrs == NMI_NULL) + { + NMI_SemaphoreFillDefault(&strDefaultAttrs); + pstrAttrs = &strDefaultAttrs; + } + + if(sem_init(pHandle, 0, pstrAttrs->u32InitCount) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +NMI_ErrNo NMI_SemaphoreDestroy(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + if(sem_destroy(pHandle) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + +NMI_ErrNo NMI_SemaphoreAcquire(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + if(sem_wait(pHandle) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +NMI_ErrNo NMI_SemaphoreRelease(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + if(sem_post(pHandle) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Sleep.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Sleep.c new file mode 100755 index 00000000..b55abaaa --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Sleep.c @@ -0,0 +1,27 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_SLEEP_FEATURE + +/* +* @author syounan +* @date 10 Aug 2010 +* @version 1.0 +*/ +void NMI_Sleep(NMI_Uint32 u32TimeMilliSec) +{ + + struct timespec tspec, trem; + tspec.tv_sec = u32TimeMilliSec/1000L; + u32TimeMilliSec %= 1000L; + tspec.tv_nsec = u32TimeMilliSec * 1000000L; + + while(nanosleep(&tspec, &trem) != 0) + { + tspec.tv_sec = trem.tv_sec; + tspec.tv_nsec = trem.tv_nsec; + } +} + + +#endif \ No newline at end of file diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Socket.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Socket.c new file mode 100755 index 00000000..0f76f79a --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Socket.c @@ -0,0 +1,188 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_SOCKET_FEATURE + + + +/*============================================================================= + Includes +==============================================================================*/ + +#ifdef _WIN32 +//#include +//#include +#elif defined unix +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + + + +#ifdef _WIN32 +#pragma comment(lib,"ws2_32.lib") +#endif + +#ifdef _WIN32 +#define SOCKET_ERROR_CODE (WSAGetLastError()) +#elif defined unix +#define SOCKET_ERROR_CODE (errno) +#endif + + +/*============================================================================= + Macros +==============================================================================*/ + +#define BUFSIZE ((NMI_Uint32)1024) + + + + +/*============================================================================= + API Implementation +==============================================================================*/ + +/*============================================================================*/ +/*! +* @struct +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +void tcpReceiverThread(void* args) +{ + NMI_Sint32 s32Status; + NMI_Uint32 u32SocketFd; + NMI_Uint8 buf[BUFSIZE]; + + tstrTcpConnection* pstrTcpConnection = (tstrTcpConnection*)args; + + NMI_NULLCHECK(s32Status,pstrTcpConnection); + + + u32SocketFd = pstrTcpConnection->u32SocketFd; + + while(recv(u32SocketFd,buf,BUFSIZ,0)> 0) + { + if(pstrTcpConnection->fpTcpReceptionCB!= NMI_NULL) + { + pstrTcpConnection->fpTcpReceptionCB(buf, + BUFSIZE, + (void*)pstrTcpConnection); + } + } +ERRORHANDLER: + + closesocket(pstrTcpConnection->u32SocketFd); + return; + +} + + + +/*============================================================================*/ +/*! +* @struct +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +NMI_ErrNo NMI_TcpConnect(tstrTcpConnection* pstrTcpConnection) +{ + struct sockaddr_in server; + struct hostent * hp; + + NMI_Sint32 s32Status; + NMI_Uint32 addr; + + +#ifdef _MSC_VER + WSADATA wsaData; + WSAStartup(MAKEWORD(2,2), &wsaData); +#endif + + + NMI_ThreadFillDefault(&(pstrTcpConnection->strThreadAttrs)); + + pstrTcpConnection->u32SocketFd =(NMI_Uint32) socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); + + if(inet_addr(pstrTcpConnection->cpIPAddress)==INADDR_NONE) + { + hp=gethostbyname(pstrTcpConnection->cpIPAddress); + } + else + { + addr=inet_addr(pstrTcpConnection->cpIPAddress); + hp=gethostbyaddr((char*)&addr,sizeof(addr),AF_INET); + } + + NMI_NULLCHECK(pstrTcpConnection->u32SocketFd,hp); + + server.sin_addr.s_addr=*((unsigned long*)hp->h_addr); + server.sin_family=AF_INET; + server.sin_port=htons(pstrTcpConnection->s32Port); + + s32Status = connect(pstrTcpConnection->u32SocketFd,(struct sockaddr*)&server, sizeof(server)); + NMI_ERRORCHECK(s32Status); + + return NMI_ThreadCreate(&(pstrTcpConnection->strThreadHandle), + tcpReceiverThread, + pstrTcpConnection, + &(pstrTcpConnection->strThreadAttrs)); + +ERRORHANDLER: + return NMI_FAIL; +} + +/*============================================================================*/ +/*! +* @struct +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +NMI_ErrNo NMI_TcpSend(tstrTcpConnection* pstrTcpConnection, + NMI_Uint8* u8Buf, + NMI_Uint32 u32DataSize) +{ + if( send(pstrTcpConnection->u32SocketFd,u8Buf, u32DataSize,0) > 0) + { + return NMI_SUCCESS; + } + return NMI_FAIL; +} +/*============================================================================*/ +/*! +* @struct +* @brief +* @author remil +* @date 19 Oct 2010 +* @version 1.0 +*/ +/*============================================================================*/ +void NMI_TcpDisconnect(tstrTcpConnection* pstrTcpConnection) +{ + closesocket(pstrTcpConnection->u32SocketFd); +} + + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_StrUtils.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_StrUtils.c new file mode 100755 index 00000000..18a14937 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_StrUtils.c @@ -0,0 +1,483 @@ + +#define _CRT_SECURE_NO_DEPRECATE + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_STRING_UTILS + +#include "string.h" + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_memcmp(const void* pvArg1, const void* pvArg2, NMI_Uint32 u32Count) +{ + return memcmp(pvArg1, pvArg2, u32Count); +} + + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void NMI_memcpy_INTERNAL(void* pvTarget, const void* pvSource, NMI_Uint32 u32Count) +{ + memcpy(pvTarget, pvSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_memset(void* pvTarget, NMI_Uint8 u8SetValue, NMI_Uint32 u32Count) +{ + return memset(pvTarget, u8SetValue, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncat(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count) +{ + return strncat(pcTarget, pcSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncpy(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count) +{ + return strncpy(pcTarget, pcSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strcmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + s32Result = strcmp(pcStr1, pcStr2); + if(s32Result < 0) + { + s32Result = -1; + } + else if(s32Result > 0) + { + s32Result = 1; + } + } + + return s32Result; +} + +NMI_Sint32 NMI_strncmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + s32Result = strncmp(pcStr1, pcStr2, u32Count); + if(s32Result < 0) + { + s32Result = -1; + } + else if(s32Result > 0) + { + s32Result = 1; + } + } + + return s32Result; +} + +/* +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_Sint32 NMI_strcmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + NMI_Char cTestedChar1, cTestedChar2; + do + { + cTestedChar1 = *pcStr1; + if((*pcStr1 >= 'a') && (*pcStr1 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar1 -= 32; + } + + cTestedChar2 = *pcStr2; + if((*pcStr2 >= 'a') && (*pcStr2 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar2 -= 32; + } + + pcStr1++; + pcStr2++; + + }while((cTestedChar1 == cTestedChar2) + && (cTestedChar1 != 0) + && (cTestedChar2 != 0)); + + if(cTestedChar1 > cTestedChar2) + { + s32Result = 1; + } + else if(cTestedChar1 < cTestedChar2) + { + s32Result = -1; + } + else + { + s32Result = 0; + } + } + + return s32Result; +} + +/*! +* @author aabozaeid +* @date 8 Dec 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strncmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + NMI_Char cTestedChar1, cTestedChar2; + do + { + cTestedChar1 = *pcStr1; + if((*pcStr1 >= 'a') && (*pcStr1 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar1 -= 32; + } + + cTestedChar2 = *pcStr2; + if((*pcStr2 >= 'a') && (*pcStr2 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar2 -= 32; + } + + pcStr1++; + pcStr2++; + u32Count--; + + }while( (u32Count > 0) + && (cTestedChar1 == cTestedChar2) + && (cTestedChar1 != 0) + && (cTestedChar2 != 0)); + + if(cTestedChar1 > cTestedChar2) + { + s32Result = 1; + } + else if(cTestedChar1 < cTestedChar2) + { + s32Result = -1; + } + else + { + s32Result = 0; + } + } + + return s32Result; + +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strlen(const NMI_Char* pcStr) +{ + return (NMI_Uint32)strlen(pcStr); +} + +/*! +* @author bfahmy +* @date 28 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strtoint(const NMI_Char* pcStr) +{ + return (NMI_Sint32)(atoi(pcStr)); +} + +/* +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_ErrNo NMI_snprintf(NMI_Char* pcTarget, NMI_Uint32 u32Size, + const NMI_Char* pcFormat, ...) +{ + va_list argptr; + va_start(argptr, pcFormat); + if(vsnprintf(pcTarget, u32Size, pcFormat, argptr) < 0) + { + /* if turncation happens windows does not properly terminate strings */ + pcTarget[u32Size - 1] = 0; + } + va_end(argptr); + + /* I find no sane way of detecting errors in windows, so let it all succeed ! */ + return NMI_SUCCESS; +} + +#ifdef CONFIG_NMI_EXTENDED_STRING_OPERATIONS + +/** +* @brief +* @details Searches for the first occurrence of the character c in the first n bytes + of the string pointed to by the argument str. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_memchr(const void *str, NMI_Char c, NMI_Sint32 n) +{ + return (NMI_Char*) memchr(str,c,(size_t)n); +} + +/** +* @brief +* @details Searches for the first occurrence of the character c (an unsigned char) + in the string pointed to by the argument str. + The terminating null character is considered to be part of the string. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strchr(const NMI_Char *str, NMI_Char c) +{ + return strchr(str,c); +} + +/** +* @brief +* @details Appends the string pointed to by str2 to the end of the string pointed to by str1. + The terminating null character of str1 is overwritten. + Copying stops once the terminating null character of str2 is copied. If overlapping occurs, the result is undefined. + The argument str1 is returned. +* @param[in] NMI_Char* str1, +* @param[in] NMI_Char* str2, +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcat(NMI_Char *str1, const NMI_Char *str2) +{ + return strcat(str1, str2); +} + +/** +* @brief +* @details Copy pcSource to pcTarget +* @param[in] NMI_Char* pcTarget +* @param[in] const NMI_Char* pcSource +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcpy(NMI_Char* pcTarget, const NMI_Char* pcSource) +{ + return strncpy(pcTarget, pcSource, strlen(pcSource)); +} + +/** +* @brief +* @details Finds the first sequence of characters in the string str1 that + does not contain any character specified in str2. + Returns the length of this first sequence of characters found that + do not match with str2. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Uint32 +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strcspn(const NMI_Char *str1, const NMI_Char *str2) +{ + return (NMI_Uint32)strcspn(str1, str2); +} + +/** +* @brief +* @details Searches an internal array for the error number errnum and returns a pointer + to an error message string. + Returns a pointer to an error message string. +* @param[in] NMI_Sint32 errnum +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strerror(NMI_Sint32 errnum) +{ + return strerror(errnum); +} + + +/** +* @brief +* @details Finds the first occurrence of the entire string str2 + (not including the terminating null character) which appears in the string str1. + Returns a pointer to the first occurrence of str2 in str1. + If no match was found, then a null pointer is returned. + If str2 points to a string of zero length, then the argument str1 is returned. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strstr(const NMI_Char *str1, const NMI_Char *str2) +{ + return strstr(str1, str2); +} + +/** +* @brief +* @details Parses the C string str interpreting its content as a floating point + number and returns its value as a double. + If endptr is not a null pointer, the function also sets the value pointed + by endptr to point to the first character after the number. +* @param[in] const NMI_Char* str +* @param[in] NMI_Char** endptr +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_StringToDouble(const NMI_Char* str, NMI_Char** endptr) +{ + return strtod (str,endptr); +} + + +/** +* @brief Parses the C string str interpreting its content as an unsigned integral + number of the specified base, which is returned as an unsigned long int value. +* @details The function first discards as many whitespace characters as necessary + until the first non-whitespace character is found. + Then, starting from this character, takes as many characters as possible + that are valid following a syntax that depends on the base parameter, + and interprets them as a numerical value. + Finally, a pointer to the first character following the integer + representation in str is stored in the object pointed by endptr. +* @param[in] const NMI_Char *str +* @param[in] NMI_Char **endptr +* @param[in] NMI_Sint32 base +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringToUint32(const NMI_Char *str, NMI_Char **endptr, NMI_Sint32 base) +{ + return strtoul(str, endptr, base); +} + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Thread.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Thread.c new file mode 100755 index 00000000..0db814b9 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Thread.c @@ -0,0 +1,52 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_THREAD_FEATURE + +NMI_ErrNo NMI_ThreadCreate(NMI_ThreadHandle* pHandle, tpfNMI_ThreadFunction pfEntry, + void* pvArg, tstrNMI_ThreadAttrs* pstrAttrs) +{ + pthread_attr_t attr; + tstrNMI_ThreadAttrs strDefaultAttrs; + NMI_ErrNo s32RetStatus = NMI_FAIL; + + if(pstrAttrs == NMI_NULL) + { + NMI_ThreadFillDefault(&strDefaultAttrs); + pstrAttrs = &strDefaultAttrs; + } + + if(pthread_attr_init(&attr) == 0) + { + /*if(pthread_attr_setstacksize(&attr, pstrAttrs->u32StackSize) != 0) + { + return NMI_FAIL; + }*/ + + if(pthread_create(pHandle, &attr, (void*(*)(void*))pfEntry, pvArg) == 0) + { + s32RetStatus = NMI_SUCCESS; + } + + pthread_attr_destroy(&attr); + } + + return s32RetStatus; +} + +NMI_ErrNo NMI_ThreadDestroy(NMI_ThreadHandle* pHandle, + tstrNMI_ThreadAttrs* pstrAttrs) +{ + if(pthread_join(*pHandle, NULL) == 0) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Time.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Time.c new file mode 100755 index 00000000..2db75643 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Time.c @@ -0,0 +1,167 @@ + +#define _CRT_SECURE_NO_DEPRECATE +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_TIME_FEATURE + + +NMI_Uint32 NMI_TimeMsec(void) +{ + NMI_Uint32 u32Time = 0; + struct timespec current_time; + + if (clock_gettime(CLOCK_REALTIME, ¤t_time) == 0) + { + u32Time = current_time.tv_sec * 1000; + u32Time += current_time.tv_nsec / 1000000; + } + + return u32Time; +} + + +#ifdef CONFIG_NMI_EXTENDED_TIME_OPERATIONS + +/** +* @brief +* @details function returns the implementation's best approximation to the + processor time used by the process since the beginning of an + implementation-dependent time related only to the process invocation. +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_Clock() +{ + return (NMI_Uint32)clock(); +} + + +/** +* @brief +* @details The difftime() function computes the difference between two calendar + times (as returned by NMI_GetTime()): time1 - time0. +* @param[in] NMI_Time time1 +* @param[in] NMI_Time time0 +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_DiffTime(NMI_Time time1, NMI_Time time0) +{ + return difftime(time1,time0); +} + + + +/** +* @brief +* @details The gmtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, + expressed as Coordinated Universal Time (UTC). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_GmTime(const NMI_Time* timer) +{ + return gmtime(timer); +} + + +/** +* @brief +* @details The localtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, expressed + as a local time. The function corrects for the timezone and any + seasonal time adjustments. Local timezone information is used as + though localtime() calls tzset(). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_LocalTime(const NMI_Time* timer) +{ + return localtime(timer); +} + + +/** +* @brief +* @details The mktime() function converts the broken-down time, + expressed as local time, in the structure pointed to by timeptr, + into a time since the Epoch value with the same encoding as that + of the values returned by time(). The original values of the tm_wday + and tm_yday components of the structure are ignored, and the original + values of the other components are not restricted to the ranges described + in the entry. +* @param[in] NMI_tm* timer +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_MkTime(NMI_tm* timer) +{ + return mktime(timer); +} + + +/** +* @brief +* @details The strftime() function places bytes into the array + pointed to by s as controlled by the string pointed to by format. +* @param[in] NMI_Char* s +* @param[in] NMI_Uint32 maxSize +* @param[in] const NMI_Char* format +* @param[in] const NMI_tm* timptr +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringFormatTime(NMI_Char* s, + NMI_Uint32 maxSize, + const NMI_Char* format, + const NMI_tm* timptr) +{ + return (NMI_Uint32)strftime(s, + (size_t) maxSize, + format, + timptr); +} + + +/** +* @brief The NMI_GetTime() function returns the value of time in seconds since the Epoch. +* @details The tloc argument points to an area where the return value is also stored. + If tloc is a null pointer, no value is stored. +* @param[in] NMI_Time* tloc +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_GetTime(NMI_Time* tloc) +{ + return time(tloc); +} + + +#endif + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Timer.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Timer.c new file mode 100755 index 00000000..0d3d136d --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linux/source/NMI_Timer.c @@ -0,0 +1,181 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_TIMER_FEATURE + +#include + +static void TimerCallbackWrapper(union sigval val) +{ + NMI_TimerHandle* pHandle = (NMI_TimerHandle*)val.sival_ptr; + + if(NMI_SemaphoreAcquire(&(pHandle->hAccessProtection), + NMI_NULL) == NMI_SUCCESS) + { + if(pHandle->bPendingTimer == NMI_TRUE) + { + ((tpfNMI_TimerFunction)pHandle->pfCallbackFunction) + (pHandle->pvArgument); + } + NMI_SemaphoreRelease(&(pHandle->hAccessProtection), NMI_NULL); + } +} + +NMI_ErrNo NMI_TimerCreate(NMI_TimerHandle* pHandle, + tpfNMI_TimerFunction pfCallback, tstrNMI_TimerAttrs* pstrAttrs) +{ + + struct sigevent strSigEv; + + strSigEv.sigev_notify = SIGEV_THREAD; + strSigEv.sigev_value.sival_ptr = pHandle; + strSigEv.sigev_notify_function = TimerCallbackWrapper; + strSigEv.sigev_notify_attributes = NULL; + + pHandle->pfCallbackFunction = pfCallback; + pHandle->pvArgument = NMI_NULL; + + if((NMI_SemaphoreCreate(&(pHandle->hAccessProtection), NMI_NULL) == NMI_SUCCESS) + && (timer_create(CLOCK_REALTIME, &strSigEv, &(pHandle->timerObject)) == 0)) + { + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +NMI_ErrNo NMI_TimerDestroy(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_FAIL; + + s32RetStatus = NMI_TimerStop(pHandle, NMI_NULL); + + /* important : I use the AND operator '&' here instead of '&&' on purpose + because I want both functions to be called anyway */ + if( (timer_delete(pHandle->timerObject) == 0) + & (NMI_SemaphoreDestroy(&(pHandle->hAccessProtection), NMI_NULL) + == NMI_SUCCESS)) + { + /* do nothing */ + } + else + { + s32RetStatus = NMI_FAIL; + } + + return s32RetStatus; +} + +static NMI_ErrNo SetupTimer(NMI_TimerHandle* pHandle, NMI_Uint32 u32Timeout, void* pvArg, NMI_Bool bPeriodic) +{ + struct itimerspec strTimeValue; + NMI_ErrNo s32RetStatus = NMI_FAIL; + + strTimeValue.it_value.tv_sec = u32Timeout/1000L; + strTimeValue.it_value.tv_nsec = (u32Timeout % 1000L) * 1000000L; + + if(bPeriodic == NMI_TRUE) + { + /* enable periodic timer */ + strTimeValue.it_interval.tv_sec = strTimeValue.it_value.tv_sec; + strTimeValue.it_interval.tv_nsec = strTimeValue.it_value.tv_nsec; + } + else + { + /* disable periodic timer */ + strTimeValue.it_interval.tv_sec = 0; + strTimeValue.it_interval.tv_nsec = 0; + } + + s32RetStatus = NMI_SemaphoreAcquire(&(pHandle->hAccessProtection), + NMI_NULL); + NMI_ERRORCHECK(s32RetStatus); + + if(u32Timeout != 0) + { + pHandle->pvArgument = pvArg; + pHandle->bPendingTimer = NMI_TRUE; + } + else + { + pHandle->bPendingTimer = NMI_FALSE; + } + if(timer_settime(pHandle->timerObject, + 0, + &strTimeValue, + NMI_NULL) != 0) + { + s32RetStatus = NMI_FAIL; + } + + /* this part does not follow the usual error checking coventions, because : + - I want to release the semaphore even if earlier function returned error + - I don't want to overwrite s32RetStatus in case of an earlier failure + */ + if(NMI_SemaphoreRelease(&(pHandle->hAccessProtection), NMI_NULL) + != NMI_SUCCESS) + { + s32RetStatus = NMI_FAIL; + } + + NMI_CATCH(s32RetStatus) + { + } + + return s32RetStatus; + + +} + +NMI_ErrNo NMI_TimerStart(NMI_TimerHandle* pHandle, NMI_Uint32 u32Timeout, + void* pvArg, tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_Bool bPeriodic = NMI_FALSE; + NMI_ErrNo s32RetStatus; + + #ifdef CONFIG_NMI_TIMER_PERIODIC + if((pstrAttrs != NMI_NULL) + && (pstrAttrs->bPeriodicTimer == NMI_TRUE)) + { + /* enable periodic timer */ + bPeriodic = NMI_TRUE; + } + #endif + + if(u32Timeout == 0) + { + if(bPeriodic == NMI_TRUE) + { + /* a periodic timer with zero timeout does not make any sense, + so we error on that */ + NMI_ERRORREPORT(s32RetStatus, NMI_INVALID_ARGUMENT); + } + else + { + /* in Linux timer API a timeout of zero means 'disable timer' + but in NMI API a timeout of zero means 'run it as soon as + possible' so here we workaround it by waiting just one msec */ + u32Timeout = 1; + } + } + + s32RetStatus = SetupTimer(pHandle, u32Timeout, pvArg, bPeriodic); + + NMI_CATCH(s32RetStatus) + { + } + + return s32RetStatus; +} + + +NMI_ErrNo NMI_TimerStop(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs) +{ + return SetupTimer(pHandle, 0, NMI_NULL, NMI_FALSE); +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/Makefile b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/Makefile new file mode 100755 index 00000000..0fea48cc --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/Makefile @@ -0,0 +1,71 @@ +MAKE = make +RM = rm +MV = mv +ECHO = echo +CP = cp +PWD = $(shell pwd) + + +obj-m := lib.a +lib-y := source/NMI_MsgQueue.o source/NMI_StrUtils.o source/NMI_Memory.o\ + source/NMI_Sleep.o source/NMI_Thread.o source/NMI_Time.o\ + source/NMI_Semaphore.o source/NMI_Timer.o\ + +ccflags-y += -I$(src)/../../../ +ccflags-y += -DNMI_PLATFORM=NMI_LINUXKERNEL +ccflags-y += -Wno-unused-function + + + + + +ifeq ($(TARGET),SIMULATION) +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +OUT_ARCH = x86 +else ifeq ($(TARGET),PANDA) +KERNELDIR ?= $(DEV_TREE)/kernel/omap +MAKE_FLAGS := CROSS_COMPILE=$(DEV_TREE)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- ARCH=arm +OUT_ARCH = ARM-3.0 +else ifeq ($(TARGET),BEAGLE) +KERNELDIR ?= $(DEV_TREE) +OUT_ARCH = ARM-2.6.39 +MAKE_FLAGS := CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm +EXTRA_CFLAGS += -DBEAGLE_BOARD +else ifeq ($(TARGET),NM73131) +KERNELDIR ?= $(DEV_TREE_LPC) +OUT_ARCH = ARM-2.6.28.2 +MAKE_FLAGS := CROSS_COMPILE=arm-linux- ARCH=arm +#EXTRA_CFLAGS += -DNM73131_0_BOARD -DUSE_WIRELESS +EXTRA_CFLAGS += -DNM73131_0_BOARD +else ifeq ($(TARGET),ALLWINNER) +KERNELDIR ?= $(DEV_TREE)/linux-3.0 +MAKE_FLAGS := CROSS_COMPILE=$(DEV_TREE)/buildroot/output/external-toolchain/bin/arm-none-linux-gnueabi- ARCH=arm +OUT_ARCH = ARM-3.0 +else +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +OUT_ARCH = x86 +TARGET=SIMULATION +endif + + + +all: + @$(ECHO) "###########################################" + @$(ECHO) "###### Building NMI OS Wrapper lib #######" + @$(ECHO) "##### TARGET =" $(TARGET) "######" + $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules $(MAKE_FLAGS) + mkdir -p ../../binary/linux/$(OUT_ARCH) + $(MV) $(PWD)/lib.a ../../binary/linux/$(OUT_ARCH)/NMI_OsWrapper.a + + + +clean: + @$(ECHO) "###########################################" + @$(ECHO) "###### Cleaning NMI OS Wrapper lib #######" + @$(ECHO) "##### TARGET =" $(TARGET) "######" + $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean + $(RM) -f $(OBJPROG) + $(RM) -f ../../binary/linux/$(OUT_ARCH)/NMI_OsWrapper.a + + + diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/include/NMI_platform.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/include/NMI_platform.h new file mode 100755 index 00000000..8b6f7d85 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/include/NMI_platform.h @@ -0,0 +1,184 @@ +#ifndef __NMI_platfrom_H__ +#define __NMI_platfrom_H__ + +/*! +* @file NMI_platform.h +* @brief platform specific file for Linux port +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 15 Dec 2010 +* @version 1.0 +*/ + + +/****************************************************************** + Feature support checks +*******************************************************************/ + +// CONFIG_NMI_THREAD_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_SUSPEND_CONTROL +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_STRICT_PRIORITY +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_SEMAPHORE_FEATURE is implemented + +/* remove the following block when implementing its feature +#ifdef CONFIG_NMI_SEMAPHORE_TIMEOUT +#error This feature is not supported by this OS +#endif*/ + +// CONFIG_NMI_SLEEP_FEATURE is implemented + +/* remove the following block when implementing its feature */ +//#ifdef CONFIG_NMI_SLEEP_HI_RES +//#error This feature is not supported by this OS +//#endif + +// CONFIG_NMI_TIMER_FEATURE is implemented + +// CONFIG_NMI_TIMER_PERIODIC is implemented + +// CONFIG_NMI_MEMORY_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_POOLS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_DEBUG +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_ASSERTION_SUPPORT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_STRING_UTILS is implemented + +// CONFIG_NMI_MSG_QUEUE_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +/*#ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT +#error This feature is not supported by this OS +#endif*/ + +// CONFIG_NMI_FILE_OPERATIONS_FEATURE is implemented + +// CONFIG_NMI_FILE_OPERATIONS_STRING_API is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_FILE_OPERATIONS_PATH_API +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_TIME_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_UTC_SINCE_1970 +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_CALENDER +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_FEATURE +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_EVENT_TIMEOUT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_MATH_OPERATIONS_FEATURE is implemented + +// CONFIG_NMI_EXTENDED_FILE_OPERATIONS is implemented + +// CONFIG_NMI_EXTENDED_STRING_OPERATIONS is implemented + +// CONFIG_NMI_EXTENDED_TIME_OPERATIONS is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SOCKET_FEATURE +#error This feature is not supported by this OS +#endif + +/****************************************************************** + OS specific includes +*******************************************************************/ +#define _XOPEN_SOURCE 600 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "linux/string.h" +/****************************************************************** + OS specific types +*******************************************************************/ + +typedef struct task_struct *NMI_ThreadHandle; + +typedef void* NMI_MemoryPoolHandle; +typedef struct semaphore NMI_SemaphoreHandle; + +typedef struct timer_list NMI_TimerHandle ; + + + +/* Message Queue type is a structure */ +typedef struct __Message_struct +{ + void* pvBuffer; + NMI_Uint32 u32Length; + struct __Message_struct *pstrNext; +} Message; + +typedef struct __MessageQueue_struct +{ + NMI_SemaphoreHandle hSem; + NMI_Bool bExiting; + NMI_Uint32 u32ReceiversCount; + NMI_SemaphoreHandle strCriticalSection; + Message * pstrMessageList; +} NMI_MsgQueueHandle; + + + +/*Time represented in 64 bit format*/ +typedef time_t NMI_Time; + + +/******************************************************************* + others +********************************************************************/ + +/* Generic printf function */ +#define NMI_PRINTF(...) printk(__VA_ARGS__) +#define __NMI_FILE__ __FILE__ +#define __NMI_FUNCTION__ __FUNCTION__ +#define __NMI_LINE__ __LINE__ +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Memory.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Memory.c new file mode 100755 index 00000000..d73bdaf4 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Memory.c @@ -0,0 +1,71 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_MEMORY_FEATURE + + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryAlloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + if(u32Size > 0) + { + return kmalloc(u32Size, GFP_ATOMIC); + } + else + { + return NMI_NULL; + } +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryCalloc(NMI_Uint32 u32Size, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + return kcalloc(u32Size, 1,GFP_KERNEL); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_MemoryRealloc(void* pvOldBlock, NMI_Uint32 u32NewSize, + tstrNMI_MemoryAttrs* strAttrs, NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + if(u32NewSize==0) + { + kfree(pvOldBlock); + return NMI_NULL; + } + else if(pvOldBlock==NMI_NULL) + { + return kmalloc(u32NewSize, GFP_KERNEL); + } + else + { + return krealloc(pvOldBlock, u32NewSize, GFP_KERNEL); + } + +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void NMI_MemoryFree(void* pvBlock, tstrNMI_MemoryAttrs* strAttrs, + NMI_Char* pcFileName, NMI_Uint32 u32LineNo) +{ + kfree(pvBlock); +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_MsgQueue.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_MsgQueue.c new file mode 100755 index 00000000..88e4e267 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_MsgQueue.c @@ -0,0 +1,234 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_MSG_QUEUE_FEATURE + + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueCreate(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + tstrNMI_SemaphoreAttrs strSemAttrs; + NMI_SemaphoreFillDefault(&strSemAttrs); + strSemAttrs.u32InitCount = 0; + + if( (NMI_SemaphoreCreate(&pHandle->hSem, &strSemAttrs) == NMI_SUCCESS) + && (NMI_SemaphoreCreate(&pHandle->strCriticalSection, NMI_NULL) == NMI_SUCCESS)) + { + + pHandle->pstrMessageList = NULL; + pHandle->u32ReceiversCount = 0; + pHandle->bExiting = NMI_FALSE; + + return NMI_SUCCESS; + } + else + { + return NMI_FAIL; + } +} + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueDestroy(NMI_MsgQueueHandle* pHandle, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + + pHandle->bExiting = NMI_TRUE; + + // Release any waiting receiver thread. + while(pHandle->u32ReceiversCount > 0) + { + NMI_SemaphoreRelease(&(pHandle->hSem), NMI_NULL); + pHandle->u32ReceiversCount--; + } + + NMI_SemaphoreDestroy(&pHandle->hSem, NMI_NULL); + NMI_SemaphoreDestroy(&pHandle->strCriticalSection, NMI_NULL); + + while(pHandle->pstrMessageList != NULL) + { + Message * pstrMessge = pHandle->pstrMessageList->pstrNext; + NMI_FREE(pHandle->pstrMessageList); + pHandle->pstrMessageList = pstrMessge; + } + + return NMI_SUCCESS; +} + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueSend(NMI_MsgQueueHandle* pHandle, + const void * pvSendBuffer, NMI_Uint32 u32SendBufferSize, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + + Message * pstrMessage = NULL; + + if( (pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == NULL) ) + { + NMI_ERRORREPORT(s32RetStatus, NMI_INVALID_ARGUMENT); + } + + if(pHandle->bExiting == NMI_TRUE) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + + /* construct a new message */ + pstrMessage = NMI_NEW(Message, 1); + NMI_NULLCHECK(s32RetStatus, pstrMessage); + pstrMessage->u32Length = u32SendBufferSize; + pstrMessage->pstrNext = NULL; + pstrMessage->pvBuffer = NMI_MALLOC(u32SendBufferSize); + NMI_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer); + NMI_memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); + + + /* add it to the message queue */ + if(pHandle->pstrMessageList == NULL) + { + pHandle->pstrMessageList = pstrMessage; + } + else + { + Message * pstrTailMsg = pHandle->pstrMessageList; + while(pstrTailMsg->pstrNext != NULL) + { + pstrTailMsg = pstrTailMsg->pstrNext; + } + pstrTailMsg->pstrNext = pstrMessage; + } + + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + NMI_SemaphoreRelease(&pHandle->hSem, NMI_NULL); + + NMI_CATCH(s32RetStatus) + { + /* error occured, free any allocations */ + if(pstrMessage != NULL) + { + if(pstrMessage->pvBuffer != NULL) + { + NMI_FREE(pstrMessage->pvBuffer); + } + NMI_FREE(pstrMessage); + } + } + + return s32RetStatus; +} + + + +/*! +* @author syounan +* @date 1 Sep 2010 +* @note copied from FLO glue implementatuion +* @version 1.0 +*/ +NMI_ErrNo NMI_MsgQueueRecv(NMI_MsgQueueHandle* pHandle, + void * pvRecvBuffer, NMI_Uint32 u32RecvBufferSize, + NMI_Uint32* pu32ReceivedLength, + tstrNMI_MsgQueueAttrs* pstrAttrs) +{ + + Message * pstrMessage; + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + tstrNMI_SemaphoreAttrs strSemAttrs; + + if( (pHandle == NULL) || (u32RecvBufferSize == 0) + || (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL) ) + { + NMI_ERRORREPORT(s32RetStatus, NMI_INVALID_ARGUMENT); + } + + if(pHandle->bExiting == NMI_TRUE) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + pHandle->u32ReceiversCount++; + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + NMI_SemaphoreFillDefault(&strSemAttrs); + #ifdef CONFIG_NMI_MSG_QUEUE_TIMEOUT + if(pstrAttrs != NMI_NULL) + { + strSemAttrs.u32TimeOut = pstrAttrs->u32Timeout; + } + #endif + s32RetStatus = NMI_SemaphoreAcquire(&(pHandle->hSem), &strSemAttrs); + if(s32RetStatus == NMI_TIMEOUT) + { + /* timed out, just exit without consumeing the message */ + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + pHandle->u32ReceiversCount--; + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + } + else + { + /* other non-timeout scenarios */ + NMI_ERRORCHECK(s32RetStatus); + + if(pHandle->bExiting) + { + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + + NMI_SemaphoreAcquire(&pHandle->strCriticalSection, NMI_NULL); + + pstrMessage = pHandle->pstrMessageList; + if(pstrMessage == NULL) + { + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + NMI_ERRORREPORT(s32RetStatus, NMI_FAIL); + } + /* check buffer size */ + if(u32RecvBufferSize < pstrMessage->u32Length) + { + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + NMI_SemaphoreRelease(&pHandle->hSem, NMI_NULL); + NMI_ERRORREPORT(s32RetStatus, NMI_BUFFER_OVERFLOW); + } + + /* consume the message */ + pHandle->u32ReceiversCount--; + NMI_memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); + *pu32ReceivedLength = pstrMessage->u32Length; + + pHandle->pstrMessageList = pstrMessage->pstrNext; + + NMI_FREE(pstrMessage->pvBuffer); + NMI_FREE(pstrMessage); + + NMI_SemaphoreRelease(&pHandle->strCriticalSection, NMI_NULL); + + } + + NMI_CATCH(s32RetStatus) + { + } + + return s32RetStatus; +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Semaphore.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Semaphore.c new file mode 100755 index 00000000..203ff42c --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Semaphore.c @@ -0,0 +1,78 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" +#ifdef CONFIG_NMI_SEMAPHORE_FEATURE + + +NMI_ErrNo NMI_SemaphoreCreate(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + tstrNMI_SemaphoreAttrs strDefaultAttrs; + if(pstrAttrs == NMI_NULL) + { + NMI_SemaphoreFillDefault(&strDefaultAttrs); + pstrAttrs = &strDefaultAttrs; + } + + sema_init(pHandle,pstrAttrs->u32InitCount); + return NMI_SUCCESS; + +} + + +NMI_ErrNo NMI_SemaphoreDestroy(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + /* nothing to be done ! */ + + return NMI_SUCCESS; + +} + + +NMI_ErrNo NMI_SemaphoreAcquire(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + + #ifndef CONFIG_NMI_SEMAPHORE_TIMEOUT + down(pHandle); + + #else + if(pstrAttrs == NMI_NULL) + { + down(pHandle); + } + else + { + + s32RetStatus = down_timeout(pHandle, msecs_to_jiffies(pstrAttrs->u32TimeOut)); + } + #endif + + if(s32RetStatus == 0) + { + return NMI_SUCCESS; + } + else if (s32RetStatus == -ETIME) + { + return NMI_TIMEOUT; + } + else + { + return NMI_FAIL; + } + + return NMI_SUCCESS; + +} + +NMI_ErrNo NMI_SemaphoreRelease(NMI_SemaphoreHandle* pHandle, + tstrNMI_SemaphoreAttrs* pstrAttrs) +{ + + up(pHandle); + return NMI_SUCCESS; + +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Sleep.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Sleep.c new file mode 100755 index 00000000..9d0334d9 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Sleep.c @@ -0,0 +1,39 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_SLEEP_FEATURE + +/* +* @author mdaftedar +* @date 10 Aug 2010 +* @version 1.0 +*/ +void NMI_Sleep(NMI_Uint32 u32TimeMilliSec) +{ + if(u32TimeMilliSec <= 4000000) + { + NMI_Uint32 u32Temp = u32TimeMilliSec * 1000; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) + usleep_range(u32Temp, u32Temp); +#else + udelay(u32Temp); +#endif + } + else + { + msleep(u32TimeMilliSec); + } + +} +#endif + +//#ifdef CONFIG_NMI_SLEEP_HI_RES +void NMI_SleepMicrosec(NMI_Uint32 u32TimeMicoSec) +{ + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) + usleep_range(u32TimeMicoSec,u32TimeMicoSec); + #else + udelay(u32TimeMicoSec); + #endif +} +//#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_StrUtils.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_StrUtils.c new file mode 100755 index 00000000..2e3c206e --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_StrUtils.c @@ -0,0 +1,482 @@ + +#define _CRT_SECURE_NO_DEPRECATE + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_STRING_UTILS + + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_memcmp(const void* pvArg1, const void* pvArg2, NMI_Uint32 u32Count) +{ + return memcmp(pvArg1, pvArg2, u32Count); +} + + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void NMI_memcpy_INTERNAL(void* pvTarget, const void* pvSource, NMI_Uint32 u32Count) +{ + memcpy(pvTarget, pvSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +void* NMI_memset(void* pvTarget, NMI_Uint8 u8SetValue, NMI_Uint32 u32Count) +{ + return memset(pvTarget, u8SetValue, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncat(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count) +{ + return strncat(pcTarget, pcSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strncpy(NMI_Char* pcTarget, const NMI_Char* pcSource, + NMI_Uint32 u32Count) +{ + return strncpy(pcTarget, pcSource, u32Count); +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strcmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + s32Result = strcmp(pcStr1, pcStr2); + if(s32Result < 0) + { + s32Result = -1; + } + else if(s32Result > 0) + { + s32Result = 1; + } + } + + return s32Result; +} + +NMI_Sint32 NMI_strncmp(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + s32Result = strncmp(pcStr1, pcStr2, u32Count); + if(s32Result < 0) + { + s32Result = -1; + } + else if(s32Result > 0) + { + s32Result = 1; + } + } + + return s32Result; +} + +/* +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_Sint32 NMI_strcmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + NMI_Char cTestedChar1, cTestedChar2; + do + { + cTestedChar1 = *pcStr1; + if((*pcStr1 >= 'a') && (*pcStr1 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar1 -= 32; + } + + cTestedChar2 = *pcStr2; + if((*pcStr2 >= 'a') && (*pcStr2 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar2 -= 32; + } + + pcStr1++; + pcStr2++; + + }while((cTestedChar1 == cTestedChar2) + && (cTestedChar1 != 0) + && (cTestedChar2 != 0)); + + if(cTestedChar1 > cTestedChar2) + { + s32Result = 1; + } + else if(cTestedChar1 < cTestedChar2) + { + s32Result = -1; + } + else + { + s32Result = 0; + } + } + + return s32Result; +} + +/*! +* @author aabozaeid +* @date 8 Dec 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strncmp_IgnoreCase(const NMI_Char* pcStr1, const NMI_Char* pcStr2, + NMI_Uint32 u32Count) +{ + NMI_Sint32 s32Result; + + if(pcStr1 == NMI_NULL && pcStr2 == NMI_NULL) + { + s32Result = 0; + } + else if(pcStr1 == NMI_NULL) + { + s32Result = -1; + } + else if(pcStr2 == NMI_NULL) + { + s32Result = 1; + } + else + { + NMI_Char cTestedChar1, cTestedChar2; + do + { + cTestedChar1 = *pcStr1; + if((*pcStr1 >= 'a') && (*pcStr1 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar1 -= 32; + } + + cTestedChar2 = *pcStr2; + if((*pcStr2 >= 'a') && (*pcStr2 <= 'z')) + { + /* turn a lower case character to an upper case one */ + cTestedChar2 -= 32; + } + + pcStr1++; + pcStr2++; + u32Count--; + + }while( (u32Count > 0) + && (cTestedChar1 == cTestedChar2) + && (cTestedChar1 != 0) + && (cTestedChar2 != 0)); + + if(cTestedChar1 > cTestedChar2) + { + s32Result = 1; + } + else if(cTestedChar1 < cTestedChar2) + { + s32Result = -1; + } + else + { + s32Result = 0; + } + } + + return s32Result; + +} + +/*! +* @author syounan +* @date 18 Aug 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strlen(const NMI_Char* pcStr) +{ + return (NMI_Uint32)strlen(pcStr); +} + +/*! +* @author bfahmy +* @date 28 Aug 2010 +* @version 1.0 +*/ +NMI_Sint32 NMI_strtoint(const NMI_Char* pcStr) +{ + return (NMI_Sint32)(simple_strtol(pcStr,NULL,10)); +} + +/* +* @author syounan +* @date 1 Nov 2010 +* @version 2.0 +*/ +NMI_ErrNo NMI_snprintf(NMI_Char* pcTarget, NMI_Uint32 u32Size, + const NMI_Char* pcFormat, ...) +{ + va_list argptr; + va_start(argptr, pcFormat); + if(vsnprintf(pcTarget, u32Size, pcFormat, argptr) < 0) + { + /* if turncation happens windows does not properly terminate strings */ + pcTarget[u32Size - 1] = 0; + } + va_end(argptr); + + /* I find no sane way of detecting errors in windows, so let it all succeed ! */ + return NMI_SUCCESS; +} + +#ifdef CONFIG_NMI_EXTENDED_STRING_OPERATIONS + +/** +* @brief +* @details Searches for the first occurrence of the character c in the first n bytes + of the string pointed to by the argument str. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_memchr(const void *str, NMI_Char c, NMI_Sint32 n) +{ + return (NMI_Char*) memchr(str,c,(size_t)n); +} + +/** +* @brief +* @details Searches for the first occurrence of the character c (an unsigned char) + in the string pointed to by the argument str. + The terminating null character is considered to be part of the string. + Returns a pointer pointing to the first matching character, + or null if no match was found. +* @param[in] +* @return +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strchr(const NMI_Char *str, NMI_Char c) +{ + return strchr(str,c); +} + +/** +* @brief +* @details Appends the string pointed to by str2 to the end of the string pointed to by str1. + The terminating null character of str1 is overwritten. + Copying stops once the terminating null character of str2 is copied. If overlapping occurs, the result is undefined. + The argument str1 is returned. +* @param[in] NMI_Char* str1, +* @param[in] NMI_Char* str2, +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcat(NMI_Char *str1, const NMI_Char *str2) +{ + return strcat(str1, str2); +} + +/** +* @brief +* @details Copy pcSource to pcTarget +* @param[in] NMI_Char* pcTarget +* @param[in] const NMI_Char* pcSource +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strcpy(NMI_Char* pcTarget, const NMI_Char* pcSource) +{ + return strncpy(pcTarget, pcSource, strlen(pcSource)); +} + +/** +* @brief +* @details Finds the first sequence of characters in the string str1 that + does not contain any character specified in str2. + Returns the length of this first sequence of characters found that + do not match with str2. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Uint32 +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_strcspn(const NMI_Char *str1, const NMI_Char *str2) +{ + return (NMI_Uint32)strcspn(str1, str2); +} +#if 0 +/** +* @brief +* @details Searches an internal array for the error number errnum and returns a pointer + to an error message string. + Returns a pointer to an error message string. +* @param[in] NMI_Sint32 errnum +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strerror(NMI_Sint32 errnum) +{ + return strerror(errnum); +} +#endif + +/** +* @brief +* @details Finds the first occurrence of the entire string str2 + (not including the terminating null character) which appears in the string str1. + Returns a pointer to the first occurrence of str2 in str1. + If no match was found, then a null pointer is returned. + If str2 points to a string of zero length, then the argument str1 is returned. +* @param[in] const NMI_Char *str1 +* @param[in] const NMI_Char *str2 +* @return NMI_Char* +* @note +* @author remil +* @date 3 Nov 2010 +* @version 1.0 +*/ +NMI_Char* NMI_strstr(const NMI_Char *str1, const NMI_Char *str2) +{ + return strstr(str1, str2); +} +#if 0 +/** +* @brief +* @details Parses the C string str interpreting its content as a floating point + number and returns its value as a double. + If endptr is not a null pointer, the function also sets the value pointed + by endptr to point to the first character after the number. +* @param[in] const NMI_Char* str +* @param[in] NMI_Char** endptr +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_StringToDouble(const NMI_Char* str, NMI_Char** endptr) +{ + return strtod (str,endptr); +} +#endif + +/** +* @brief Parses the C string str interpreting its content as an unsigned integral + number of the specified base, which is returned as an unsigned long int value. +* @details The function first discards as many whitespace characters as necessary + until the first non-whitespace character is found. + Then, starting from this character, takes as many characters as possible + that are valid following a syntax that depends on the base parameter, + and interprets them as a numerical value. + Finally, a pointer to the first character following the integer + representation in str is stored in the object pointed by endptr. +* @param[in] const NMI_Char *str +* @param[in] NMI_Char **endptr +* @param[in] NMI_Sint32 base +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringToUint32(const NMI_Char *str, NMI_Char **endptr, NMI_Sint32 base) +{ + return simple_strtoul(str, endptr, base); +} + +#endif + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Thread.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Thread.c new file mode 100755 index 00000000..325afbd7 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Thread.c @@ -0,0 +1,38 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_THREAD_FEATURE + + + +NMI_ErrNo NMI_ThreadCreate(NMI_ThreadHandle* pHandle, tpfNMI_ThreadFunction pfEntry, + void* pvArg, tstrNMI_ThreadAttrs* pstrAttrs) +{ + + + *pHandle = kthread_run((int(*)(void *))pfEntry ,pvArg, "NMI_kthread"); + + + if(IS_ERR(*pHandle)) + { + return NMI_FAIL; + } + else + { + return NMI_SUCCESS; + } + +} + +NMI_ErrNo NMI_ThreadDestroy(NMI_ThreadHandle* pHandle, + tstrNMI_ThreadAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + + kthread_stop(*pHandle); + return s32RetStatus; +} + + + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Time.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Time.c new file mode 100755 index 00000000..63dbbdbb --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Time.c @@ -0,0 +1,163 @@ + +#define _CRT_SECURE_NO_DEPRECATE +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_TIME_FEATURE + + +NMI_Uint32 NMI_TimeMsec(void) +{ + NMI_Uint32 u32Time = 0; + struct timespec current_time; + + current_time = current_kernel_time(); + u32Time = current_time.tv_sec * 1000; + u32Time += current_time.tv_nsec / 1000000; + + + return u32Time; +} + + +#ifdef CONFIG_NMI_EXTENDED_TIME_OPERATIONS + +/** +* @brief +* @details function returns the implementation's best approximation to the + processor time used by the process since the beginning of an + implementation-dependent time related only to the process invocation. +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_Clock() +{ + /*printk("Not implemented")*/ +} + + +/** +* @brief +* @details The difftime() function computes the difference between two calendar + times (as returned by NMI_GetTime()): time1 - time0. +* @param[in] NMI_Time time1 +* @param[in] NMI_Time time0 +* @return NMI_Double +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Double NMI_DiffTime(NMI_Time time1, NMI_Time time0) +{ + /*printk("Not implemented")*/ +} + + + +/** +* @brief +* @details The gmtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, + expressed as Coordinated Universal Time (UTC). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_GmTime(const NMI_Time* timer) +{ + /*printk("Not implemented")*/ +} + + +/** +* @brief +* @details The localtime() function converts the time in seconds since + the Epoch pointed to by timer into a broken-down time, expressed + as a local time. The function corrects for the timezone and any + seasonal time adjustments. Local timezone information is used as + though localtime() calls tzset(). +* @param[in] const NMI_Time* timer +* @return NMI_tm* +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_tm* NMI_LocalTime(const NMI_Time* timer) +{ + /*printk("Not implemented")*/ +} + + +/** +* @brief +* @details The mktime() function converts the broken-down time, + expressed as local time, in the structure pointed to by timeptr, + into a time since the Epoch value with the same encoding as that + of the values returned by time(). The original values of the tm_wday + and tm_yday components of the structure are ignored, and the original + values of the other components are not restricted to the ranges described + in the entry. +* @param[in] NMI_tm* timer +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_MkTime(NMI_tm* timer) +{ + /*printk("Not implemented")*/ +} + + +/** +* @brief +* @details The strftime() function places bytes into the array + pointed to by s as controlled by the string pointed to by format. +* @param[in] NMI_Char* s +* @param[in] NMI_Uint32 maxSize +* @param[in] const NMI_Char* format +* @param[in] const NMI_tm* timptr +* @return NMI_Uint32 +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Uint32 NMI_StringFormatTime(NMI_Char* s, + NMI_Uint32 maxSize, + const NMI_Char* format, + const NMI_tm* timptr) +{ + /*printk("Not implemented")*/ +} + + +/** +* @brief The NMI_GetTime() function returns the value of time in seconds since the Epoch. +* @details The tloc argument points to an area where the return value is also stored. + If tloc is a null pointer, no value is stored. +* @param[in] NMI_Time* tloc +* @return NMI_Time +* @note +* @author remil +* @date 11 Nov 2010 +* @version 1.0 +*/ +NMI_Time NMI_GetTime(NMI_Time* tloc) +{ + /*printk("Not implemented")*/ +} + + +#endif +#endif + + diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Timer.c b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Timer.c new file mode 100755 index 00000000..3d36a079 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/linuxkernel/source/NMI_Timer.c @@ -0,0 +1,51 @@ + +#include "NMI_OsWrapper/include/NMI_OSWrapper.h" + +#ifdef CONFIG_NMI_TIMER_FEATURE + + + +NMI_ErrNo NMI_TimerCreate(NMI_TimerHandle* pHandle, + tpfNMI_TimerFunction pfCallback, tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_SUCCESS; + setup_timer(pHandle,(void(*)(unsigned long))pfCallback,0); + + return s32RetStatus; +} + +NMI_ErrNo NMI_TimerDestroy(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_FAIL; + if(pHandle != NULL){ + s32RetStatus = del_timer(pHandle); + pHandle = NULL; + } + + return s32RetStatus; +} + + +NMI_ErrNo NMI_TimerStart(NMI_TimerHandle* pHandle, NMI_Uint32 u32Timeout, + void* pvArg, tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_FAIL; + if(pHandle != NULL){ + pHandle->data = (unsigned long)pvArg; + s32RetStatus = mod_timer(pHandle, (jiffies + msecs_to_jiffies(u32Timeout))); + } + return s32RetStatus; +} + +NMI_ErrNo NMI_TimerStop(NMI_TimerHandle* pHandle, + tstrNMI_TimerAttrs* pstrAttrs) +{ + NMI_ErrNo s32RetStatus = NMI_FAIL; + if(pHandle != NULL) + s32RetStatus = del_timer(pHandle); + + return s32RetStatus; +} + +#endif diff --git a/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/win32/include/NMI_platform.h b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/win32/include/NMI_platform.h new file mode 100755 index 00000000..868d8473 --- /dev/null +++ b/drivers/net/wireless/nmi/Nmc1000_Release6.2/src/NMI_OsWrapper/source/win32/include/NMI_platform.h @@ -0,0 +1,160 @@ +#ifndef __NMI_platfrom_H__ +#define __NMI_platfrom_H__ + +/*! +* @file NMI_platform.h +* @brief top level header for win32 implementation +* @author syounan +* @sa NMI_OSWrapper.h top level OS wrapper file +* @date 18 Aug 2010 +* @version 1.0 +*/ + +/****************************************************************** + Feature support checks +*******************************************************************/ + +// CONFIG_NMI_THREAD_FEATURE is implemented + +// CONFIG_NMI_THREAD_SUSPEND_CONTROL is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_THREAD_STRICT_PRIORITY +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_SEMAPHORE_FEATURE is implemented + +// CONFIG_NMI_SEMAPHORE_TIMEOUT is implemented + +// CONFIG_NMI_SLEEP_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_SLEEP_HI_RES +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_TIMER_FEATURE is implemented + +// CONFIG_NMI_TIMER_PERIODIC is implemented + +// CONFIG_NMI_MEMORY_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_POOLS +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MEMORY_DEBUG +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_ASSERTION_SUPPORT +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_STRING_UTILS is implemented + +// CONFIG_NMI_MSG_QUEUE_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_MSG_QUEUE_IPC_NAME +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_MSG_QUEUE_TIMEOUT is implemented + +// CONFIG_NMI_FILE_OPERATIONS_FEATURE is implemented + +// CONFIG_NMI_FILE_OPERATIONS_STRING_API is implemented + +// CONFIG_NMI_TIME_FEATURE is implemented + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_UTC_SINCE_1970 +#error This feature is not supported by this OS +#endif + +/* remove the following block when implementing its feature */ +#ifdef CONFIG_NMI_TIME_CALENDER +#error This feature is not supported by this OS +#endif + +// CONFIG_NMI_EVENT_FEATURE is implemented + +// CONFIG_NMI_EVENT_TIMEOUT is implemented + +/****************************************************************** + OS specific includes +*******************************************************************/ +#include "stdio.h" +#define _WIN32_WINNT 0x0500 +#include "Windows.h" + +/****************************************************************** + OS specific types +*******************************************************************/ + +/* Thread Handle is a windows HANDLE */ +typedef HANDLE NMI_ThreadHandle; + +/* Semaphore Handle is a windows HANDLE */ +typedef HANDLE NMI_SemaphoreHandle; + +/* Timer Handle is a complex structure */ +typedef struct{ + + /* the underlaying windwos timer stored here */ + HANDLE hTimer; + + /* critical section for protection */ + CRITICAL_SECTION csProtectionCS; + + /* the callback is kept here */ + /* shoud be a proper pointer to function type + insted of void*, but the timer callback type is + defined later in its header */ + void* pfCallbackFunction; + + /* the invocation argument is kept here */ + void* pvArgument; + +}NMI_TimerHandle; + +/* change into OS specific type */ +typedef void* NMI_MemoryPoolHandle; + +/* Message Queue type is a structure */ +typedef struct __Message_struct +{ + LPVOID pvBuffer; + DWORD u32Length; + struct __Message_struct *pstrNext; +} Message; + +typedef struct __MessageQueue_struct +{ + HANDLE hSem; + BOOLEAN bExiting; + DWORD ReceiversCount; + CRITICAL_SECTION strCriticalSection; + Message * pstrMessageList; +} NMI_MsgQueueHandle; + +typedef FILE* NMI_FileHandle; + +/* Event Handle is a windows HANDLE */ +typedef HANDLE NMI_EventHandle; + +/******************************************************************* + others +********************************************************************/ + +/* Generic printf function */ +#define NMI_PRINTF(...) printf(__VA_ARGS__) +#define __NMI_FILE__ __FILE__ +#define __NMI_FUNCTION__ __FUNCTION__ +#define __NMI_LINE__ __LINE__ +#endif -- cgit