| 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 **********************************************************************************/
63 struct APPTASK_STATUS_s {
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 **********************************************************************************/
94 struct APPTASK_EXECUTION_s {
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 };
102 typedef struct APPTASK_EXECUTION_s APPTASK_EXECUTION_t;
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 **********************************************************************************/
112 struct APPTASK_TASKLINK_s {
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 **********************************************************************************/
131 struct APPTASK_STATISTICS_s {
132
133 volatile uint32_t exec_time;
134 volatile uint32_t avg_time;
135 volatile uint32_t max_time;
136
137 };
138 typedef struct APPTASK_STATISTICS_s APPTASK_STATISTICS_t;
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 **********************************************************************************/
149 struct APPLICATION_TASK_s {
150
151 volatile struct APPTASK_STATUS_s Status;
152 volatile struct APPTASK_EXECUTION_s Settings;
153 volatile struct APPTASK_TASKLINK_s Functions;
154 volatile struct APPTASK_STATISTICS_s Statistics;
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
APPLICATION_TASK_s::Settings
volatile struct APPTASK_EXECUTION_s Settings
Execution time settings of the task object.
Definition: apptask_typedef.h:152
APPLICATION_TASK_s::TaskID
volatile uint16_t TaskID
Task identifier encoding task execution list and list index (read only)
Definition: apptask_typedef.h:155
APPTASK_STATISTICS_s::max_time
volatile uint32_t max_time
Maximum execution time of the task object (latched tracking, reset in software)
Definition: apptask_typedef.h:135
APPTASK_STATUS_s::enabled
volatile bool enabled
Bit 15: Control bit enabling the execution of the task execute function.
Definition: apptask_typedef.h:81
APPLICATION_TASK_s::Functions
volatile struct APPTASK_TASKLINK_s Functions
Function pointer to main API user task functions.
Definition: apptask_typedef.h:153
APPTASK_STATISTICS_s::exec_time
volatile uint32_t exec_time
Execution time in CPU ticks of the most recent task execution (read only)
Definition: apptask_typedef.h:133
APPTASK_STATUS_s::retval
volatile bool retval
Bit 0: Status bit indicating a failed execution of the user task.
Definition: apptask_typedef.h:65
APPLICATION_TASK_s::Status
volatile struct APPTASK_STATUS_s Status
Status word of the task object.
Definition: apptask_typedef.h:151
APPTASK_TASKLINK_s::Initialize
volatile uint16_t(* Initialize)(void)
Function pointer to INITIALIZATION routine.
Definition: apptask_typedef.h:114
APPTASK_TASKLINK_s
DESCRIPTION.
Definition: apptask_typedef.h:112
APPTASK_TASKLINK_s::Start
volatile uint16_t(* Start)(void)
Function pointer to START routine.
Definition: apptask_typedef.h:115
APPTASK_EXECUTION_s::Period
volatile int32_t Period
Task execution period defined in multiples of OS task execution base clock ticks (e....
Definition: apptask_typedef.h:98
APPTASK_STATUS_s::unsigned
volatile unsigned
Bit 1: (reserved)
Definition: apptask_typedef.h:66
APPLICATION_TASK_s
DESCRIPTION.
Definition: apptask_typedef.h:149
APPTASK_EXECUTION_s
DESCRIPTION.
Definition: apptask_typedef.h:94
APPTASK_TASKLINK_s::Dispose
volatile uint16_t(* Dispose)(void)
Function pointer to DISPOSE routine.
Definition: apptask_typedef.h:117
APPTASK_EXECUTION_s::Counter
volatile int32_t Counter
Execution period counter (read only)
Definition: apptask_typedef.h:97
APPTASK_STATUS_s::busy
volatile bool busy
Bit 7: Status bit indicating the task is busy.
Definition: apptask_typedef.h:72
APPTASK_STATISTICS_s
DESCRIPTION.
Definition: apptask_typedef.h:131
APPTASK_STATUS_s
DESCRIPTION.
Definition: apptask_typedef.h:63
APPTASK_EXECUTION_s::execClass
enum APPTASK_CLASS_e execClass
Execution class of the task object (low priority, high priority)
Definition: apptask_typedef.h:96
APPLICATION_TASK_s::Statistics
volatile struct APPTASK_STATISTICS_s Statistics
Task execution statistics data.
Definition: apptask_typedef.h:154
APPTASK_TASKLINK_s::Execute
volatile uint16_t(* Execute)(void)
Function pointer to EXECUTE routine.
Definition: apptask_typedef.h:116
APPTASK_EXECUTION_s::Offset
volatile int32_t Offset
Task execution period offset defined in multiples of OS task execution base clock ticks (e....
Definition: apptask_typedef.h:99
APPTASK_STATISTICS_s::avg_time
volatile uint32_t avg_time
Moving average execution time of the task object (read only)
Definition: apptask_typedef.h:134