]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
added kernel module also
authorDavid Lide <a0216552@gtudci01.(none)>
Wed, 25 Jan 2012 21:45:28 +0000 (16:45 -0500)
committerDavid Lide <a0216552@gtudci01.(none)>
Wed, 25 Jan 2012 21:45:28 +0000 (16:45 -0500)
ti/runtime/netapi/tools/module/Makefile [new file with mode: 0644]
ti/runtime/netapi/tools/module/Module.symvers [new file with mode: 0644]
ti/runtime/netapi/tools/module/modules.order [new file with mode: 0644]
ti/runtime/netapi/tools/module/netapimod.c [new file with mode: 0644]
ti/runtime/netapi/tools/module/netapimod.ko [new file with mode: 0644]
ti/runtime/netapi/tools/module/netapimod.mod.c [new file with mode: 0644]
ti/runtime/netapi/tools/module/netapimod.mod.o [new file with mode: 0644]
ti/runtime/netapi/tools/module/netapimod.o [new file with mode: 0644]

diff --git a/ti/runtime/netapi/tools/module/Makefile b/ti/runtime/netapi/tools/module/Makefile
new file mode 100644 (file)
index 0000000..25d6080
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# File Name: Makefile
+#
+# Description: Makefile to build kernel netapi utility module.
+#
+# Copyright (C) 2011 Texas Instruments, Incorporated
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation version 2.
+#
+# This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+# whether express or implied; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+
+obj-m += netapimod.o
+
+all:
+       make -C ../linux-appleton -I../linux-appleton/include M=`pwd` modules
diff --git a/ti/runtime/netapi/tools/module/Module.symvers b/ti/runtime/netapi/tools/module/Module.symvers
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ti/runtime/netapi/tools/module/modules.order b/ti/runtime/netapi/tools/module/modules.order
new file mode 100644 (file)
index 0000000..5fea729
--- /dev/null
@@ -0,0 +1 @@
+kernel//home/a0216552/appleton2/mymodules/netapimod.ko
diff --git a/ti/runtime/netapi/tools/module/netapimod.c b/ti/runtime/netapi/tools/module/netapimod.c
new file mode 100644 (file)
index 0000000..5b14eb5
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * File name: netapi_mod.c
+ *
+ * Description: NETAPI utility module.
+ *
+ * Copyright (C) 2011 Texas Instruments, Incorporated
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+
+#include <linux/version.h>
+#include <linux/unistd.h>
+#include <asm/unistd.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/timer.h>
+#include <linux/string.h>
+#include <linux/if.h>
+
+#include <asm/irq.h>
+#include <linux/clk.h>
+
+#include <asm/mach/map.h>
+
+#include <mach/vmalloc.h>
+#include <mach/common.h>
+#include <mach/time.h>
+#include <mach/cputype.h>
+#include <mach/psc.h>
+#include <mach/cp_intc.h>
+#include <mach/irqs.h>
+#include <mach/gpio.h>
+#include <mach/hardware.h>
+#include <mach/cp_intd.h>
+#include <mach/tci6614.h>
+
+
+
+#define NETAPIMOD_DEBUG 
+
+#ifdef NETAPIMOD_DEBUG
+#  define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
+#else
+#  define DPRINTK(fmt, args...)
+#endif
+
+
+/* Master Control Block for Voice Ni network module */
+static struct
+{
+
+} netapi_mcb;
+
+//extern long davinci_ck_get_arm_rate(void);
+static void MPU_Enable_userModeAccess(void)
+{
+       unsigned int reg_addr,i,count,defRegVal;
+        void __iomem * temp_reg;
+       defRegVal = 0x3FFFFFF;
+       reg_addr = 0x2368208;
+       count = 5;      
+       
+       for(i=1;i<=count;i++)
+       {
+          temp_reg= ioremap(reg_addr, 4);
+           __raw_writel(defRegVal, temp_reg) ;
+         iounmap(temp_reg);
+           //*((unsigned int*)(reg_addr)) =  defRegVal;
+               reg_addr = reg_addr + 0x10;
+       }
+       
+       reg_addr = 0x2370208;
+       count = 16;     
+       
+       for(i=1;i<=count;i++)
+       {
+          temp_reg= ioremap(reg_addr, 4);
+           __raw_writel(defRegVal,temp_reg) ;
+         iounmap(temp_reg);
+          // *((unsigned int*)(reg_addr)) =  defRegVal;
+               reg_addr = reg_addr + 0x10;
+    }
+       
+       
+       reg_addr = 0x2378208;
+       count = 1;      
+       
+       for(i=1;i<=count;i++)
+       {
+        temp_reg= ioremap(reg_addr, 4);
+           __raw_writel(defRegVal, temp_reg) ;
+         iounmap(temp_reg);
+
+//         *((unsigned int*)(reg_addr)) =  defRegVal;
+               reg_addr = reg_addr + 0x10;
+    }
+}
+
+/*********************************************************************************
+* FUNCTION: netapi_init_proc
+*
+**********************************************************************************
+*
+* DESCRIPTION: Forms output for /proc/netapi file
+*********************************************************************************/
+static int netapi_init_proc(char *buf, char **start, off_t offset,
+                   int count, int *eof, void *data)
+{
+   unsigned long  val;
+   int len=0;
+   struct clk *clk = clk_get((struct device *) NULL,"clk_arm");    
+  
+   //enable user access to qmss h/w
+  MPU_Enable_userModeAccess(); 
+
+   //pmcr <- single clock, reset, enable
+   val = 0x4|0x1;
+   asm volatile("mcr p15, 0, %0, c9, c12, 0" : : "r"(val));
+
+   //userenr <- enable user space access [this won't work from user space obviously!]
+   val = 1;
+   asm volatile("mcr p15, 0, %0, c9, c14, 0" : : "r"(val));
+
+   //start things 
+   val = 0x80000000;
+   asm volatile("mcr p15, 0, %0, c9, c12, 1" ::  "r"(val));
+
+    len += sprintf(buf + len, "netapi  proc entry\n");
+    len += sprintf(buf + len, "===========================\n");
+    len += sprintf(buf + len, "enabled PMU for user space\n");
+    asm volatile("mrc p15, 0, %0, c9, c13, 0" :  "=r"(val));
+    len += sprintf(buf + len,"current ccnt = %d\n", val);
+    len += sprintf(buf + len,"arm cpu freq = %d \n", clk? (int) clk_get_rate(clk): -1);
+    //len += sprintf(buf + len,"arm cpu freq = %d %d\n", davinci_ck_get_arm_rate(),clk? (int) clk_get_rate(clk): -1);
+    *eof = 1;
+    
+    return len;
+}
+
+
+/*********************************************************************************
+* FUNCTION: netapi_stats_proc
+*
+**********************************************************************************
+*
+* DESCRIPTION: Forms output for /proc/netapi_stats file
+*********************************************************************************/
+static int netapi_stats_proc(char *buf, char **start, off_t offset,
+                   int count, int *eof, void *data)
+{
+    
+    int len = 0;
+    len += sprintf(buf + len, "NETAPI Stats:\n");
+    len += sprintf(buf + len, "=============================================\n");
+    len += sprintf(buf + len, "...coming...\n");
+    *eof = 1;
+    return len;
+}
+
+
+/*********************************************************************************
+* FUNCTION: netapimod_init_module
+*
+* DESCRIPTION:Initialization routine for netapi kernel device
+*********************************************************************************/
+static int __init netapimod_init_module(void)
+{
+    int ret;
+    void * priv = NULL; 
+    
+     DPRINTK("netapimod_init_module: init\n");
+
+    create_proc_read_entry("netapi", 0, NULL, netapi_init_proc, (void *)priv);
+//    create_proc_read_entry("netapi_stats", 0, NULL, netapi_stats_proc, (void *)priv);
+       DPRINTK("NETAPI  module loaded \n");
+    return 0;
+}
+
+/*********************************************************************************
+ * FUNCTION: netapimod_cleanup_module
+ *
+ * DESCRIPTION:
+ *********************************************************************************/
+static void __exit netapimod_cleanup_module(void)
+{
+    /* need to remove proc entries, etc */
+    DPRINTK("netapi module unloaded\n");
+    return;
+}
+
+module_init(netapimod_init_module);
+module_exit(netapimod_cleanup_module);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Texas Instruments Incorporated");
+MODULE_DESCRIPTION("TI voice NETAPI core module.");
+MODULE_SUPPORTED_DEVICE("Texas Instruments netapi");
+
+
diff --git a/ti/runtime/netapi/tools/module/netapimod.ko b/ti/runtime/netapi/tools/module/netapimod.ko
new file mode 100644 (file)
index 0000000..7a69bdb
Binary files /dev/null and b/ti/runtime/netapi/tools/module/netapimod.ko differ
diff --git a/ti/runtime/netapi/tools/module/netapimod.mod.c b/ti/runtime/netapi/tools/module/netapimod.mod.c
new file mode 100644 (file)
index 0000000..550d92a
--- /dev/null
@@ -0,0 +1,36 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+ .arch = MODULE_ARCH_INIT,
+};
+
+static const struct modversion_info ____versions[]
+__used
+__attribute__((section("__versions"))) = {
+       { 0x6b79149b, "module_layout" },
+       { 0xef64e10e, "clk_get_rate" },
+       { 0x3c2c5af5, "sprintf" },
+       { 0xa24d2473, "davinci_iounmap" },
+       { 0x9ad0d04a, "davinci_ioremap" },
+       { 0x8abb4dcb, "clk_get" },
+       { 0xe914e41e, "strcpy" },
+       { 0xa099afe, "create_proc_entry" },
+       { 0xefd6cf06, "__aeabi_unwind_cpp_pr0" },
+       { 0x27e1a049, "printk" },
+};
+
+static const char __module_depends[]
+__used
+__attribute__((section(".modinfo"))) =
+"depends=";
+
diff --git a/ti/runtime/netapi/tools/module/netapimod.mod.o b/ti/runtime/netapi/tools/module/netapimod.mod.o
new file mode 100644 (file)
index 0000000..2a6e0ed
Binary files /dev/null and b/ti/runtime/netapi/tools/module/netapimod.mod.o differ
diff --git a/ti/runtime/netapi/tools/module/netapimod.o b/ti/runtime/netapi/tools/module/netapimod.o
new file mode 100644 (file)
index 0000000..81bbf6c
Binary files /dev/null and b/ti/runtime/netapi/tools/module/netapimod.o differ