cpu_cla_shared.h
Go to the documentation of this file.
1 //#############################################################################
2 // FILE: cpu_cla_shared.h
3 // TITLE: header file for shared data and types between CPU and CLA.
4 //
5 // Group: C2000
6 // Target Family: F2837x/F2838x/F28004x
7 //
8 //#############################################################################
9 // $TI Release: C2000-FCL $
10 // $Release Date: Feb 2017 $
11 // $Copyright: Copyright (C) 2013-2017 Texas Instruments Incorporated -
12 // http://www.ti.com/ ALL RIGHTS RESERVED $
13 //#############################################################################
14 
15 #ifndef CPU_CLA_SHARED_H
16 #define CPU_CLA_SHARED_H
17 
18 //
19 // includes
20 //
21 
22 #include "f28x_bmsk.h"
23 
24 #include "qep_defs.h"
25 #include "fcl_pi.h"
26 #include "RAMP_GEN_CLA.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 //
33 // defines
34 //
35 
36 #if 0
37 
38 #define SETGPIO18_HIGH asm(" PUSH DP"); \
39  asm(" MOVW DP,#0x1fc") ; \
40  asm(" OR @0x1,#0x0004 "); \
41  asm(" POP DP");
42 
43 #define SETGPIO18_LOW asm(" PUSH DP"); \
44  asm(" MOVW DP,#0x1fc") ; \
45  asm(" AND @0x1,#0xfffb "); \
46  asm(" POP DP");
47 
48 #else
49 #define SETGPIO18_HIGH
50 #define SETGPIO18_LOW
51 
52 #endif
53 
54 //
55 // typedefs
56 //
57 
58 //
59 // Define the structure of the QEP (Quadrature Encoder) Driver Object
60 // this is same as QEP stucture
61 //
62 typedef struct motPars {
70 } cmplxPars_t;
71 
72 //
73 // globals
74 //
75 
76 //
77 // Task 1 (C) Variables
78 //
79 extern QEP qep1;
80 extern ENC_Status_e lsw;
81 
82 //
83 // Task 2 (C) Variables
84 //
86 
87 //
88 // Task 3 (C) Variables
89 //
90 extern cmplxPars_t Q_cla;
91 extern cmplxPars_t D_cpu;
92 
93 extern float32_t pangle;
94 extern float32_t speedWe;
95 
96 extern RAMP_GEN_CLA rg1;
97 
98 //
99 // MACROS
100 //
101 
102 //
103 // Speed optimized PI MACRO
104 //
105 #define FCL_PI_MACRO(v) \
106 { \
107  v.out += (v.err * v.Kerr) + v.carryOver; \
108  v.out = (v.out > v.Umax) ? v.Umax : v.out; \
109  v.out = (v.out < v.Umin) ? v.Umin : v.out; \
110 }
111 
112 #define CLAMP_MACRO(v) \
113 { \
114  v.out = (v.out > v.Umax) ? v.Umax : v.out; \
115  v.out = (v.out < v.Umin) ? v.Umin : v.out; \
116 }
117 
118 
119 #ifdef __cplusplus
120 }
121 #endif // extern "C"
122 
123 #endif // end of CPU_CLA_SHARED_H definition
float32_t
float float32_t
Definition: sfra_f32.h:42
rg1
RAMP_GEN_CLA rg1
lsw
ENC_Status_e lsw
FCL_PIController_t
Definition: fcl_pi.h:22
QEP
Definition: qep_defs.h:27
fcl_pi.h
motPars::cosWTs
float32_t cosWTs
Definition: cpu_cla_shared.h:63
motPars
Definition: cpu_cla_shared.h:62
cmplxPars_t
struct motPars cmplxPars_t
motPars::idErr
float32_t idErr
Definition: cpu_cla_shared.h:67
Q_cla
cmplxPars_t Q_cla
qep_defs.h
motPars::expVal
float32_t expVal
Definition: cpu_cla_shared.h:65
ENC_Status_e
ENC_Status_e
Definition: encoder.h:86
speedWe
float32_t speedWe
motPars::iqErr
float32_t iqErr
Definition: cpu_cla_shared.h:68
motPars::kDirect
float32_t kDirect
Definition: cpu_cla_shared.h:66
qep1
QEP qep1
pi_iq
FCL_PIController_t pi_iq
f28x_bmsk.h
D_cpu
cmplxPars_t D_cpu
pangle
float32_t pangle
motPars::sinWTs
float32_t sinWTs
Definition: cpu_cla_shared.h:64
motPars::carryOver
float32_t carryOver
Definition: cpu_cla_shared.h:69

Copyright 2023, Texas Instruments Incorporated