-
Notifications
You must be signed in to change notification settings - Fork 1
/
device.h
137 lines (109 loc) · 4.3 KB
/
device.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* =====================================================================*/
/* Program: template.h */
/* */
/* Project: Template-Project */
/* */
/* Description: Template Description */
/* */
/* Last Edited: 2018-11-06 */
/* */
/* Author: Falk Kyburz */
/* */
/* ==================================================================== */
/* (c) 2018 by Interstaatliche Hochschule für Technik Buchs NTB */
/* ==================================================================== */
#ifndef DEVICE_H
#define DEVICE_H
/* ==================================================================== */
/* ========================== include files =========================== */
/* ==================================================================== */
#include <stdint.h>
#include "ringbuffer.h"
#include "defines.h"
#include "DSP2803x_Cla_typedefs.h"// DSP2803x CLA Type definitions
#include "DSP2803x_Device.h" // DSP2803x Headerfile Include File
// Functions that will be run from RAM need to be assigned to
// a different section. This section will then be mapped to a load and
// run address using the linker cmd file.
#pragma CODE_SECTION(InitFlash, "ramfuncs");
#define Device_cal (void (*)(void))0x3D7C80
/* ==================================================================== */
/* ============================ constants ============================= */
/* ==================================================================== */
/* #define and enum statements go here */
#define CLARAM0_ENABLE 1
#define CLARAM1_ENABLE 1
/* ==================================================================== */
/* ========================== public data ============================= */
/* ==================================================================== */
/* Definition of public (external) data types go here */
/* ==================================================================== */
/* ======================= public functions =========================== */
/* ==================================================================== */
//microprocessor public functions
extern int32_t device_init(void);
extern void updateDutyEPwm(uint16_t duty);
/* ==================================================================== */
/* =================== public inline functions ======================== */
/* ==================================================================== */
/* Enable gate drivers for Phase U */
extern inline int32_t device_driverEnableVLS(void)
{
GpioDataRegs.GPADAT.bit.GPIO11 = 0;
return 0;
}
extern inline int32_t device_driverEnableVHS(void)
{
GpioDataRegs.GPBDAT.bit.GPIO43 = 0;
return 0;
}
/* Enable gate drivers for Phase V */
extern inline int32_t device_driverEnableULS(void)
{
GpioDataRegs.GPADAT.bit.GPIO4 = 0;
return 0;
}
extern inline int32_t device_driverEnableUHS(void)
{
GpioDataRegs.GPADAT.bit.GPIO5 = 0;
return 0;
}
/* Enable gate drivers for Phase U */
extern inline int32_t device_driverDisableVLS(void)
{
GpioDataRegs.GPADAT.bit.GPIO11 = 1;
return 0;
}
extern inline int32_t device_driverDisableVHS(void)
{
GpioDataRegs.GPBDAT.bit.GPIO43 = 1;
return 0;
}
/* Enable gate drivers for Phase V */
extern inline int32_t device_driverDisableULS(void)
{
GpioDataRegs.GPADAT.bit.GPIO4 = 1;
return 0;
}
extern inline int32_t device_driverDisableUHS(void)
{
GpioDataRegs.GPADAT.bit.GPIO5 = 1;
return 0;
}
extern inline int32_t device_setALLDriverDisable(void)
{
device_driverDisableULS();
device_driverDisableVLS();
device_driverDisableUHS();
device_driverDisableVHS();
return 0;
}
extern inline int32_t device_setALLDriverEnable(void)
{
device_driverEnableULS();
device_driverEnableVLS();
device_driverEnableUHS();
device_driverEnableVHS();
return 0;
}
#endif // DEVICE_H