1 /*\r
2 * Copyright (c) 2011, Texas Instruments Incorporated\r
3 * All rights reserved.\r
4 *\r
5 * Redistribution and use in source and binary forms, with or without\r
6 * modification, are permitted provided that the following conditions\r
7 * are met:\r
8 *\r
9 * * Redistributions of source code must retain the above copyright\r
10 * notice, this list of conditions and the following disclaimer.\r
11 *\r
12 * * Redistributions in binary form must reproduce the above copyright\r
13 * notice, this list of conditions and the following disclaimer in the\r
14 * documentation and/or other materials provided with the distribution.\r
15 *\r
16 * * Neither the name of Texas Instruments Incorporated nor the names of\r
17 * its contributors may be used to endorse or promote products derived\r
18 * from this software without specific prior written permission.\r
19 *\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\r
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31 */\r
32 \r
33 #include <xdc/std.h>\r
34 #include <xdc/cfg/global.h>\r
35 #include <xdc/runtime/System.h>\r
36 #include <xdc/runtime/Diags.h>\r
37 #include <xdc/runtime/Error.h>\r
38 \r
39 #include <ti/ipc/MultiProc.h>\r
40 #include <ti/sysbios/BIOS.h>\r
41 #include <ti/sysbios/knl/Task.h>\r
42 #include <ti/ipc/rpmsg/_RPMessage.h>\r
43 #include <ti/ipc/remoteproc/Resource.h>\r
44 \r
45 #include <ti/grcm/RcmTypes.h>\r
46 #include <ti/grcm/RcmServer.h>\r
47 #include <ti/framework/dce/dce_priv.h>\r
48 \r
49 #include <stdio.h>\r
50 #include <string.h>\r
51 #include <stdlib.h>\r
52 \r
53 // Include the custom resource table for memory configuration.\r
54 #if (defined VAYU_ES10)\r
55 #include "custom_rsc_table_vayu_dsp.h"\r
56 #elif (defined OMAP5432_ES20)\r
57 #include "custom_rsc_table_omap5_dsp.h"\r
58 #endif\r
59 \r
60 extern uint32_t dce_debug;\r
61 \r
62 /* Legacy function to allow Linux side rpmsg sample tests to work: */\r
63 extern void start_ping_tasks();\r
64 \r
65 static unsigned int SyslinkMemUtils_VirtToPhys(Ptr Addr)\r
66 {\r
67 unsigned int pa;\r
68 \r
69 if( !Addr || Resource_virtToPhys((unsigned int) Addr, &pa)) {\r
70 return (0);\r
71 }\r
72 return (pa);\r
73 }\r
74 \r
75 void *MEMUTILS_getPhysicalAddr(Ptr vaddr)\r
76 {\r
77 unsigned int paddr = SyslinkMemUtils_VirtToPhys(vaddr);\r
78 \r
79 DEBUG("virtual addr:%x\tphysical addr:%x", vaddr, paddr);\r
80 return ((void *)paddr);\r
81 }\r
82 \r
83 void tools_ShowVersion()\r
84 {\r
85 System_printf("\n\n **** DSPMM VERSION INFO **** \n\nCompile DATE %s TIME %s \n", __DATE__, __TIME__);\r
86 \r
87 System_printf("\n** DSPMM VERSION INFO END ** \n");\r
88 \r
89 System_printf("Trace Buffer PA 0x%x Trace Level %d\\r
90 \nTrace Usage: level:[0-4: 0-no trace, 1-err, 2-debug, 3-info, 4-CE,FC,IPC traces] \n\n",\r
91 MEMUTILS_getPhysicalAddr((Ptr)(TRACEBUFADDR)), dce_debug);\r
92 }\r
93 \r
94 int main(int argc, char * *argv)\r
95 {\r
96 extern void start_load_task(void);\r
97 UInt16 hostId;\r
98 \r
99 /* Set up interprocessor notifications */\r
100 System_printf("%s starting..\n", MultiProc_getName(MultiProc_self()));\r
101 \r
102 hostId = MultiProc_getId("HOST");\r
103 RPMessage_init(hostId);\r
104 \r
105 /* Some background ping testing tasks, used by rpmsg samples: */\r
106 start_ping_tasks();\r
107 \r
108 /* CPU load reporting in the trace. */\r
109 // start_load_task();\r
110 \r
111 /* Dump Tools version */\r
112 tools_ShowVersion();\r
113 \r
114 BIOS_start();\r
115 \r
116 return (0);\r
117 }\r
118 \r