NoRTOS.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!*****************************************************************************
33  * @file NoRTOS.h
34  *
35  * @brief NoRTOS framework module
36  *
37  * The NoRTOS header file should be included in an application as follows:
38  * @code
39  * #include <NoRTOS.h>
40  * @endcode
41  *
42  * # Overview #
43  *
44  * The NoRTOS framework module controls various aspects of the application's
45  * behavior with respect to the TI Driver interfaces that are used by the
46  * application.
47  *
48  * Some TI Drivers make use of an internal Clock module that offers timing
49  * services to the drivers, based on a Clock "tick" which operates at a
50  * frequency based on a configured period. This period can be configured
51  * per application requirements through the NoRTOS module, although the
52  * default setting might be required by certain TI Drivers that assume a
53  * certain Clock tick frequency.
54  *
55  * Some TI Drivers make use of an internal Swi (Software interrupt) module
56  * that offers a scheduling paradigm that lies between an application's
57  * 'main' thread and hardware interrupts. The internal Swi implementation
58  * utilizes a software-triggered-only hardware interrupt for achieving this
59  * mid-level scheduling paradigm. This hardware interrupt can be configured
60  * per application requirements through the NoRTOS module, although the
61  * default setting is likely what should be used.
62  *
63  * Some TI Drivers will "suspend" the application's operation until a certain
64  * event occurs. When an application is running in the NoRTOS framework
65  * there are no other "threads" to run when the 'main' thread becomes
66  * suspended, which in essence implies that the application has entered an
67  * 'idle' mode. An 'idle callback' function is called when this 'idle' mode
68  * has been entered. This callback function can be configured per the
69  * application requirements through the NoRTOS module, although the default
70  * setting is likely what should be used.
71  *
72  * # Usage #
73  *
74  * The NoRTOS module contains the following APIs:
75  * - NoRTOS_getConfig(): Retrieve the current NoRTOS configuration values.
76  * - NoRTOS_setConfig(): Set NoRTOS configuration values.
77  * - NoRTOS_start(): Enable NoRTOS system operation (required).
78  *
79  * ### NoRTOS Framework Configuration #
80  *
81  * The NoRTOS framework utilizes a few settings that the application should
82  * be able to control so as to accommodate the unique needs of the
83  * application or the system upon which the application runs. It is expected
84  * that the default values of these settings will suffice for the majority of
85  * applications using the NoRTOS framework. These default values should be
86  * of no concern to most applications since the aspects they control are
87  * internal to the TI Drivers' operation, but system requirements or other
88  * code that is being integrated with the application could require different
89  * values. The NoRTOS configuration functions offer this capability to the
90  * application. Please refer to the documentation for the NoRTOS_Config
91  * structure for details on each configuration element.
92  *
93  * ### Starting the NoRTOS framework operation #
94  *
95  * Realtime systems often require precise timing when enabling certain
96  * aspects of the system. If some part of the system is enabled too early
97  * then other parts of the system may not operate correctly. Certain system
98  * elements need to be setup and initialized before other elements will
99  * operate correctly.
100  *
101  * The NoRTOS_start() API allows the application to control when the system
102  * as a whole should be "started". NoRTOS_start() *must* be called for
103  * the system to start, and should be called after all TI Driver and
104  * peripheral initialization has been performed.
105  *
106  * ### Example usage #
107  *
108  * @code
109  * #include <NoRTOS.h>
110 
111  * int main(int argc, char *argv[])
112  * {
113  * NoRTOS_Config cfg;
114  *
115  * // Get current values of all configuration settings
116  * NoRTOS_getConfig(&cfg);
117  *
118  * // Change config settings we want to change while leaving other
119  * // settings at their default values ...
120  *
121  * // Change system "tick" frequency to 10,000 Hz
122  * cfg.clockTickPeriod = 100;
123  *
124  * // Change interrupt used for Swi scheduling to 11 (SVCall)
125  * cfg.swiIntNum = 11;
126  *
127  * // Affect the changes
128  * NoRTOS_setConfig(&cfg);
129  *
130  * `perform board and driver initialization`;
131  *
132  * // Start NoRTOS
133  * NoRTOS_start();
134  *
135  * // Call mainThread function
136  * mainThread(NULL);
137  * }
138  * @endcode
139  *
140  *******************************************************************************
141  */
142 
156 typedef struct _NoRTOS_Config {
158  void (*idleCallback)(void);
159 
161  uint32_t clockTickPeriod;
162 
166 } NoRTOS_Config;
167 
175 
183 
184 /*
185  * @brief Function to call for enabling NoRTOS system operation
186  */
187 void NoRTOS_start();
void NoRTOS_start()
uint32_t clockTickPeriod
Definition: NoRTOS.h:161
void NoRTOS_getConfig(NoRTOS_Config *cfg)
Function to retrieve current NoRTOS configuration values.
void(* idleCallback)(void)
Definition: NoRTOS.h:158
int swiIntNum
Definition: NoRTOS.h:165
void NoRTOS_setConfig(NoRTOS_Config *cfg)
Function to set or modify NoRTOS configuration values.
NoRTOS framework global configuration.
Definition: NoRTOS.h:156
struct _NoRTOS_Config NoRTOS_Config
NoRTOS framework global configuration.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale