Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
os.c
1//=======================================================================================================
2// Copyright(c) 2018 Microchip Technology Inc. and its subsidiaries.
3// Subject to your compliance with these terms, you may use Microchip software and any derivatives
4// exclusively with Microchip products. It is your responsibility to comply with third party license
5// terms applicable to your use of third-party software (including open source software) that may
6// accompany Microchip software.
7// THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY,
8// APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND
9// FITNESS FOR A PARTICULAR PURPOSE.
10// IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
11// LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
12// MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
13// ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT
14// EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
15//=======================================================================================================
16
17//=======================================================================================================
18// @file os/os.c
19//
20// @brief contains the init function of the operating system and calls all the other Init functions
21//
22// @version v1.0
23// @date 2019-23-12
24// @author M52409
25//
26//=======================================================================================================
27
28#include "../project_settings.h"
29#include "os/os_scheduler.h"
30#include "os/os.h"
31#include "stdint.h"
32
33#if OS_FEATURE_WATCHDOG_ENABLED == 1
34#include "os_watchdog.h"
35#endif
36
37//#include "os/os_sys_time.h"
38
39//#include "os/os_sys_time.h"
40
41#ifndef OS_TIMER_NUMBER_OF_TIMERS
42#warning OS_TIMER_NUMBER_OF_TIMERS needs to be defined in main/project_setting.h
43#endif
44#ifndef OS_USE_SYSTIME
45#warning OS_USE_SYSTIME needs to be defined in main/project_setting.h
46#endif
47
48#if OS_TIMER_NUMBER_OF_TIMERS > 0
49#include"os/os_timer.h"
50#endif
51
52
53//=======================================================================================================
54// @brief Initializes Scheduler
55// @note call this function in your main routine before calling the RunForever function
56//=======================================================================================================
57void OS_Init(void)
58{
59/* LDRA_EXCLUDE 337 S */
60#if OS_RESETTHINGY == 1
61 if (RCONbits.WDTO)
62 os_resetCause |= 1 << OS_RESETCAUSE_WATCHDOG;
63 RCON = 0;
64#endif
65
66#if OS_FEATURE_WATCHDOG_ENABLED == 1
67 OS_Watchdog_Init();
68#endif
69
70 OS_Scheduler_Init();
71#if OS_TIMER_NUMBER_OF_TIMERS > 0
72 OS_Timer_Init();
73#endif
74}
75