1 /* -*- Mode: C; tab-width:4 -*- */
2 /* ex: set ts=4 shiftwidth=4 softtabstop=4 cindent: */
4 * Copyright (c) 2003 The Regents of the University of California.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgement:
18 * This product includes software developed by Networked &
19 * Embedded Systems Lab at UCLA
20 * 4. Neither the name of the University nor that of the Laboratory
21 * may be used to endorse or promote products derived from this
22 * software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
27 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS
28 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
31 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
34 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * @brief SOS booting sequence
40 * @author Simon Han (simonhan@ee.ucla.edu)
42 * Platform dependent booting sequence should go to
43 * hardware.c or hardware_*.c of particular platform
46 #include <sos_sched.h>
47 #include <message_queue.h>
48 #include <sos_module_fetcher.h>
57 //#include <version_sync.h>
60 #include <sfi_jumptable.h>
65 * @brief application start
67 * Application will define this function
69 extern void sos_start();
74 * @brief main function
75 * @author Simon Han (simonhan@ee.ucla.edu)
79 * @brief Core event loop
81 int sos_main(uint8_t cond
){
84 DISABLE_GLOBAL_INTERRUPTS();
89 //! initialize memory manager
94 //! initialize message pool
97 //! initialize random number generator
100 //! initialize scheduler
103 //! initialize sensor manager
106 //! initialize the Function Table
109 //! Initialize the monitor
112 //! initialize hardware
119 //! starting memory module
127 //! Initialize the code fetcher
131 ENABLE_GLOBAL_INTERRUPTS();
133 #ifdef SOS_USE_PREEMPTION
135 preemption_status
= ENABLED
;
137 DEBUG("SOS booted\n");
138 //! start application
141 //! enter main sched loop
142 //! should never return from this call