old mode 100755 (executable)
new mode 100644 (file)
similarity index 79%
rename from ti/runtime/netapi/src/netapi_util.h
rename to ti/runtime/netapi/netapi_util.h
index b0bae82..56fb49b
new mode 100644 (file)
similarity index 79%
rename from ti/runtime/netapi/src/netapi_util.h
rename to ti/runtime/netapi/netapi_util.h
index b0bae82..56fb49b
-/******************************************************\r
- * File: netapi_util.h\r
- * Purpose: misc utilites\r
- **************************************************************\r
- * FILE: netapi_util.h\r
- * \r
- * DESCRIPTION: netapi utility header file for user space transport\r
- * library\r
- * \r
- * REVISION HISTORY: rev 0.0.1 \r
- *\r
- * Copyright (c) Texas Instruments Incorporated 2010-2011\r
- * \r
- * Redistribution and use in source and binary forms, with or without \r
- * modification, are permitted provided that the following conditions \r
- * are met:\r
- *\r
- * Redistributions of source code must retain the above copyright \r
- * notice, this list of conditions and the following disclaimer.\r
- *\r
- * Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the \r
- * documentation and/or other materials provided with the \r
- * distribution.\r
- *\r
- * Neither the name of Texas Instruments Incorporated nor the names of\r
- * its contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
- *****************************************************/\r
-#ifndef __NETAPI_UTIL__H\r
-#define __NETAPI_UTIL__H\r
-\r
-/* timing */\r
-static inline unsigned long netapi_timing_start(void)\r
-{\r
- volatile int vval;\r
- //read clock\r
- asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(vval));\r
- return vval;\r
-}\r
-#define netapi_timing_stop netapi_timing_start\r
-\r
-//netapi kernel module access routines\r
-int netapi_utilModInit(void);\r
-void netapi_utilModClose(void);\r
-unsigned long netapi_utilGetPhysOfBufferArea(void);\r
-unsigned long netap_utilGetSizeofBufferArea(void);\r
-int netapi_utilCacheWbInv(void *ptr, size_t size);\r
-unsigned long netapi_utilGetVaOfBufferArea(unsigned int offset, unsigned int size);\r
-\r
-//for benchmarking\r
-void Osal_cache_op_measure_reset(void); \r
-unsigned int Osal_cache_op_measure(int * p_n) ;\r
-#endif\r
+/******************************************************
+ * File: netapi_util.h
+ * Purpose: misc utilites
+ **************************************************************
+ * FILE: netapi_util.h
+ *
+ * DESCRIPTION: netapi utility header file for user space transport
+ * library
+ *
+ * REVISION HISTORY: rev 0.0.1
+ *
+ * Copyright (c) Texas Instruments Incorporated 2010-2011
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ *****************************************************/
+#ifndef __NETAPI_UTIL__H
+#define __NETAPI_UTIL__H
+
+#include <stdint.h>
+
+/* virtual address of the [only] memory pool */
+extern uint8_t *netapi_VM_mem_start;
+extern uint8_t *netapi_VM_mem_end;
+
+/* Physical address of the [only] memory pool */
+extern uint8_t *netapi_VM_mem_start_phy;
+extern uint8_t *netapi_VM_mem_end_phy;
+
+/* timing */
+static inline unsigned long netapi_timing_start(void)
+{
+ volatile int vval;
+ //read clock
+ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(vval));
+ return vval;
+}
+#define netapi_timing_stop netapi_timing_start
+
+//netapi kernel module access routines
+int netapi_utilModInit(void);
+void netapi_utilModClose(void);
+unsigned long netapi_utilGetPhysOfBufferArea(void);
+unsigned long netap_utilGetSizeofBufferArea(void);
+int netapi_utilCacheWbInv(void *ptr, size_t size);
+unsigned long netapi_utilGetVaOfBufferArea(unsigned int offset, unsigned int size);
+
+//for benchmarking
+void Osal_cache_op_measure_reset(void);
+unsigned int Osal_cache_op_measure(int * p_n) ;
+
+//utility to convert virt2phy, phy2virt
+static inline void* _Osal_qmssVirtToPhy (void *ptr)
+{
+ return (void *)(netapi_VM_mem_start_phy + ((uint8_t*)ptr - netapi_VM_mem_start));
+}
+
+static inline void * _Osal_qmssPhyToVirt (void *ptr)
+{
+ if (!ptr) return (void *) 0;
+ //todo, see if out of range of mem_start_phy and size!! (like mmu would do)
+ return (void *)(netapi_VM_mem_start + ((uint8_t*)ptr - netapi_VM_mem_start_phy));
+}
+#endif