Digital Power Starter Kit 3 Firmware
dsPIC33C Boost Converter Voltage Mode Control Example
apptask_typedef.h
1 /* Microchip Technology Inc. and its subsidiaries. You may use this software
2  * and any derivatives exclusively with Microchip products.
3  *
4  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
5  * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
6  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
7  * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
8  * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
9  *
10  * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
11  * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
12  * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
13  * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
14  * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
15  * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
16  * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
17  *
18  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
19  * TERMS.
20  */
21 
22 /*
23  * File: app_typedef.h
24  * Author: M91406
25  * Comments: Header file providing type declarations of a user task object
26  * Revision history:
27  * 1.0 initial release
28  */
29 
30 // This is a guard condition so that contents of this file are not included
31 // more than once.
32 #ifndef RTOS_APPTASK_TYPE_DEFINITION_HEADER_H
33 #define RTOS_APPTASK_TYPE_DEFINITION_HEADER_H
34 
35 #include <xc.h> // include processor files - each processor file is guarded.
36 #include <stdint.h> // include standard integer data types
37 #include <stdbool.h> // include standard boolean data types
38 
39 /***********************************************************************************
40  * @ingroup application-task-object-properties
41  * @enum APPTASK_CLASS_s
42  * @brief ADD_SHORT_DESCRIPTION
43  * @details
44  * DETAILED_DESCRIPTION
45  ***********************************************************************************/
46 enum APPTASK_CLASS_e {
47 
48  APP_CLASS_NONE = 0,
49  APP_CLASS_LOW_PRIORITY = 1,
50  APP_CLASS_HIGH_PRIORITY = 2
51 
52 };
53 typedef enum APPTASK_CLASS_e APPTASK_CLASS_t;
54 
55 /***********************************************************************************
56  * @ingroup application-task-object-properties
57  * @struct APPTASK_STATUS_s
58  * @extends APPLICATION_TASK_s
59  * @brief ADD_SHORT_DESCRIPTION
60  * @details
61  * ADD_DETAILED_DESCRIPTION
62  **********************************************************************************/
64 
65  volatile bool retval : 1;
66  volatile unsigned : 1;
67  volatile unsigned : 1;
68  volatile unsigned : 1;
69  volatile unsigned : 1;
70  volatile unsigned : 1;
71  volatile unsigned : 1;
72  volatile bool busy : 1;
73 
74  volatile unsigned : 1;
75  volatile unsigned : 1;
76  volatile unsigned : 1;
77  volatile unsigned : 1;
78  volatile unsigned : 1;
79  volatile unsigned : 1;
80  volatile unsigned : 1;
81  volatile bool enabled : 1;
82 
83 };
84 typedef struct APPTASK_STATUS_s APPTASK_STATUS_t;
85 
86 /***********************************************************************************
87  * @ingroup application-task-object-properties
88  * @struct APPTASK_EXECUTION_s
89  * @extends APPLICATION_TASK_s
90  * @brief ADD_SHORT_DESCRIPTION
91  * @details
92  * ADD_DETAILED_DESCRIPTION
93  **********************************************************************************/
95 
96  volatile enum APPTASK_CLASS_e execClass;
97  volatile int32_t Counter;
98  volatile int32_t Period;
99  volatile int32_t Offset;
100 
101 };
103 
104 /***********************************************************************************
105  * @ingroup application-task-object-properties
106  * @struct APPTASK_EXECUTION_s
107  * @extends APPLICATION_TASK_s
108  * @brief ADD_SHORT_DESCRIPTION
109  * @details
110  * ADD_DETAILED_DESCRIPTION
111  **********************************************************************************/
113 
114  volatile uint16_t (*Initialize)(void);
115  volatile uint16_t (*Start)(void);
116  volatile uint16_t (*Execute)(void);
117  volatile uint16_t (*Dispose)(void);
118 
119 };
120 typedef struct APPTASK_TASKLINK_s APPTASK_TASKLINK_t;
121 
122 
123 /***********************************************************************************
124  * @ingroup application-task-object-properties
125  * @struct APPTASK_STATISTICS_s
126  * @extends APPLICATION_TASK_s
127  * @brief ADD_SHORT_DESCRIPTION
128  * @details
129  * ADD_DETAILED_DESCRIPTION
130  **********************************************************************************/
132 
133  volatile uint32_t exec_time;
134  volatile uint32_t avg_time;
135  volatile uint32_t max_time;
136 
137 };
139 
140 /***********************************************************************************
141  * @ingroup application-task-object-properties
142  * @struct APPLICATION_TASK_s
143  * @brief Application task object
144  * @details
145  * The application task object is wrapped around a user task added to the project
146  * as building block and which execution is managed by the task scheduler of the
147  * operating system.
148  **********************************************************************************/
150 
151  volatile struct APPTASK_STATUS_s Status;
152  volatile struct APPTASK_EXECUTION_s Settings;
153  volatile struct APPTASK_TASKLINK_s Functions;
155  volatile uint16_t TaskID;
156 
157 };
158 typedef struct APPLICATION_TASK_s APPLICATION_TASK_t;
159 
160 #endif /* RTOS_APPTASK_TYPE_DEFINITION_HEADER_H */
161 
162 // end of file
volatile struct APPTASK_EXECUTION_s Settings
Execution time settings of the task object.
volatile uint16_t TaskID
Task identifier encoding task execution list and list index (read only)
volatile uint32_t max_time
Maximum execution time of the task object (latched tracking, reset in software)
volatile bool enabled
Bit 15: Control bit enabling the execution of the task execute function.
volatile struct APPTASK_TASKLINK_s Functions
Function pointer to main API user task functions.
volatile uint32_t exec_time
Execution time in CPU ticks of the most recent task execution (read only)
volatile bool retval
Bit 0: Status bit indicating a failed execution of the user task.
volatile struct APPTASK_STATUS_s Status
Status word of the task object.
volatile uint16_t(* Initialize)(void)
Function pointer to INITIALIZATION routine.
volatile uint16_t(* Start)(void)
Function pointer to START routine.
volatile int32_t Period
Task execution period defined in multiples of OS task execution base clock ticks (e....
volatile unsigned
Bit 1: (reserved)
volatile uint16_t(* Dispose)(void)
Function pointer to DISPOSE routine.
volatile int32_t Counter
Execution period counter (read only)
volatile bool busy
Bit 7: Status bit indicating the task is busy.
DESCRIPTION.
enum APPTASK_CLASS_e execClass
Execution class of the task object (low priority, high priority)
volatile struct APPTASK_STATISTICS_s Statistics
Task execution statistics data.
volatile uint16_t(* Execute)(void)
Function pointer to EXECUTE routine.
volatile int32_t Offset
Task execution period offset defined in multiples of OS task execution base clock ticks (e....
volatile uint32_t avg_time
Moving average execution time of the task object (read only)