588cfe64e288a4aa61b0b32ccdf9a37acb685fb3
2 /*
3 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 /*
37 * ======== main.c ========
38 */
40 #include <xdc/std.h>
41 #include <xdc/cfg/global.h>
42 #include <xdc/runtime/Log.h>
43 #include <xdc/runtime/System.h>
44 #include <ti/sysbios/BIOS.h>
45 #include <ti/ipc/Ipc.h>
47 #include "components/clk.h" /* PFP testing */
48 #include "pfp/pfp.h"
49 #include "pfp_app.h" /* contains all PFP ID's */
51 extern void BOARD_initPerfCounters();
52 extern uint32_t readTime32(void);
54 /*
55 * ======== main ========
56 */
57 Int main()
58 {
59 Int status;
60 Int k;
61 UInt32 tsStart, tsEnd, delta;
63 Log_info0("Enter main()");
65 #if 0 // debug: check ARM SYS/BIOS timestamp provider
66 BOARD_initPerfCounters();
67 #endif
69 /* Setup Profile Points (PFP) */
70 Log_info0("enter PFP Setup");
71 pfpCreate();
72 pfpCalibrate(1000, 1);
73 for (k = 0; k <= PFP_ID_LAST; k++)
74 {
75 pfpEnable(k); /* Enable profile point #k */
76 }
77 for (k = 1; k <= PFP_ID_LAST; k++)
78 {
79 pfpSetAlpha(k, PFP_DEF_ALPHA); /* Set default exp. avg. time const. */
80 }
81 #if 0 // debug: dummy load
82 for (k = 0; k < 1000; k++)
83 {
84 tsStart=readTime32();
85 pfpBegin(PFP_ID_MAIN,0);
86 clkWorkDelay(CLK_WORKCNT_PER_MS); /* This should take about 750,000 cycles to execute, or 750e3/600e6=1.25 msec. */
87 pfpEnd(PFP_ID_MAIN,0);
88 tsEnd=readTime32();
89 }
90 delta = tsEnd-tsStart;
91 #endif
93 // Initialize IPC
94 status = Ipc_start();
95 if (status < 0)
96 {
97 System_abort("Ipc_start failed\n");
98 }
100 BIOS_start(); /* does not return */
101 return(0);
102 }