An example of importing Embedded Coder code into the mbed IDE. Currently doesn't connect IO to PWM, ADC, and Encoder, instead provides random inputs and measures execution time.
Dependencies: mbed-dsp mbed Nucleo_pmsmfoc
rtwtypes.h@2:bbc155b0b886, 2014-11-25 (annotated)
- Committer:
- paulcox
- Date:
- Tue Nov 25 07:52:02 2014 +0000
- Revision:
- 2:bbc155b0b886
- Parent:
- 0:70d27fec6d71
adding doc?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
paulcox | 0:70d27fec6d71 | 1 | /* |
paulcox | 0:70d27fec6d71 | 2 | * File: rtwtypes.h |
paulcox | 0:70d27fec6d71 | 3 | * |
paulcox | 0:70d27fec6d71 | 4 | * Code generated for Simulink model 'rtwdemo_pmsmfoc'. |
paulcox | 0:70d27fec6d71 | 5 | * |
paulcox | 0:70d27fec6d71 | 6 | * Model version : 1.2949 |
paulcox | 0:70d27fec6d71 | 7 | * Simulink Coder version : 8.7 (R2014b) 11-Aug-2014 |
paulcox | 0:70d27fec6d71 | 8 | * C/C++ source code generated on : Sat Oct 11 00:06:05 2014 |
paulcox | 0:70d27fec6d71 | 9 | * |
paulcox | 0:70d27fec6d71 | 10 | * Target selection: ert.tlc |
paulcox | 0:70d27fec6d71 | 11 | * Embedded hardware selection: Generic->32-bit Embedded Processor |
paulcox | 0:70d27fec6d71 | 12 | * Code generation objective: Execution efficiency |
paulcox | 0:70d27fec6d71 | 13 | * Validation result: Not run |
paulcox | 0:70d27fec6d71 | 14 | */ |
paulcox | 0:70d27fec6d71 | 15 | |
paulcox | 0:70d27fec6d71 | 16 | #ifndef __RTWTYPES_H__ |
paulcox | 0:70d27fec6d71 | 17 | #define __RTWTYPES_H__ |
paulcox | 0:70d27fec6d71 | 18 | |
paulcox | 0:70d27fec6d71 | 19 | /* Logical type definitions */ |
paulcox | 0:70d27fec6d71 | 20 | #if (!defined(__cplusplus)) |
paulcox | 0:70d27fec6d71 | 21 | # ifndef false |
paulcox | 0:70d27fec6d71 | 22 | # define false (0U) |
paulcox | 0:70d27fec6d71 | 23 | # endif |
paulcox | 0:70d27fec6d71 | 24 | |
paulcox | 0:70d27fec6d71 | 25 | # ifndef true |
paulcox | 0:70d27fec6d71 | 26 | # define true (1U) |
paulcox | 0:70d27fec6d71 | 27 | # endif |
paulcox | 0:70d27fec6d71 | 28 | #endif |
paulcox | 0:70d27fec6d71 | 29 | |
paulcox | 0:70d27fec6d71 | 30 | #define __TMWTYPES__ |
paulcox | 0:70d27fec6d71 | 31 | |
paulcox | 0:70d27fec6d71 | 32 | /*=======================================================================* |
paulcox | 0:70d27fec6d71 | 33 | * Target hardware information |
paulcox | 0:70d27fec6d71 | 34 | * Device type: Generic->32-bit Embedded Processor |
paulcox | 0:70d27fec6d71 | 35 | * Number of bits: char: 8 short: 16 int: 32 |
paulcox | 0:70d27fec6d71 | 36 | * long: 32 |
paulcox | 0:70d27fec6d71 | 37 | * native word size: 32 |
paulcox | 0:70d27fec6d71 | 38 | * Byte ordering: Unspecified |
paulcox | 0:70d27fec6d71 | 39 | * Signed integer division rounds to: Undefined |
paulcox | 0:70d27fec6d71 | 40 | * Shift right on a signed integer as arithmetic shift: on |
paulcox | 0:70d27fec6d71 | 41 | *=======================================================================*/ |
paulcox | 0:70d27fec6d71 | 42 | #ifdef PORTABLE_WORDSIZES /* PORTABLE_WORDSIZES defined */ |
paulcox | 0:70d27fec6d71 | 43 | |
paulcox | 0:70d27fec6d71 | 44 | /*=======================================================================* |
paulcox | 0:70d27fec6d71 | 45 | * Host information |
paulcox | 0:70d27fec6d71 | 46 | * Number of bits: char: 8 short: 16 int: 32 |
paulcox | 0:70d27fec6d71 | 47 | * long: 32 |
paulcox | 0:70d27fec6d71 | 48 | * long long: 64 |
paulcox | 0:70d27fec6d71 | 49 | * native word size: 32 |
paulcox | 0:70d27fec6d71 | 50 | *=======================================================================*/ |
paulcox | 0:70d27fec6d71 | 51 | |
paulcox | 0:70d27fec6d71 | 52 | /*=======================================================================* |
paulcox | 0:70d27fec6d71 | 53 | * Fixed width word size data types: * |
paulcox | 0:70d27fec6d71 | 54 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 55 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 56 | * real32_T, real64_T - 32 and 64 bit floating point numbers * |
paulcox | 0:70d27fec6d71 | 57 | *=======================================================================*/ |
paulcox | 0:70d27fec6d71 | 58 | typedef signed char int8_T; |
paulcox | 0:70d27fec6d71 | 59 | typedef unsigned char uint8_T; |
paulcox | 0:70d27fec6d71 | 60 | typedef short int16_T; |
paulcox | 0:70d27fec6d71 | 61 | typedef unsigned short uint16_T; |
paulcox | 0:70d27fec6d71 | 62 | typedef int int32_T; |
paulcox | 0:70d27fec6d71 | 63 | typedef unsigned int uint32_T; |
paulcox | 0:70d27fec6d71 | 64 | typedef float real32_T; |
paulcox | 0:70d27fec6d71 | 65 | typedef double real64_T; |
paulcox | 0:70d27fec6d71 | 66 | |
paulcox | 0:70d27fec6d71 | 67 | /*===========================================================================* |
paulcox | 0:70d27fec6d71 | 68 | * Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, * |
paulcox | 0:70d27fec6d71 | 69 | * ulong_T, char_T , ulonglong_T and byte_T. * |
paulcox | 0:70d27fec6d71 | 70 | *===========================================================================*/ |
paulcox | 0:70d27fec6d71 | 71 | typedef double real_T; |
paulcox | 0:70d27fec6d71 | 72 | typedef double time_T; |
paulcox | 0:70d27fec6d71 | 73 | typedef unsigned char boolean_T; |
paulcox | 0:70d27fec6d71 | 74 | typedef int int_T; |
paulcox | 0:70d27fec6d71 | 75 | typedef unsigned int uint_T; |
paulcox | 0:70d27fec6d71 | 76 | typedef unsigned int ulong_T; |
paulcox | 0:70d27fec6d71 | 77 | typedef char char_T; |
paulcox | 0:70d27fec6d71 | 78 | typedef unsigned char uchar_T; |
paulcox | 0:70d27fec6d71 | 79 | typedef char_T byte_T; |
paulcox | 0:70d27fec6d71 | 80 | |
paulcox | 0:70d27fec6d71 | 81 | #else /* PORTABLE_WORDSIZES not defined */ |
paulcox | 0:70d27fec6d71 | 82 | |
paulcox | 0:70d27fec6d71 | 83 | /*=======================================================================* |
paulcox | 0:70d27fec6d71 | 84 | * Fixed width word size data types: * |
paulcox | 0:70d27fec6d71 | 85 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 86 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 87 | * real32_T, real64_T - 32 and 64 bit floating point numbers * |
paulcox | 0:70d27fec6d71 | 88 | *=======================================================================*/ |
paulcox | 0:70d27fec6d71 | 89 | typedef signed char int8_T; |
paulcox | 0:70d27fec6d71 | 90 | typedef unsigned char uint8_T; |
paulcox | 0:70d27fec6d71 | 91 | typedef short int16_T; |
paulcox | 0:70d27fec6d71 | 92 | typedef unsigned short uint16_T; |
paulcox | 0:70d27fec6d71 | 93 | typedef int int32_T; |
paulcox | 0:70d27fec6d71 | 94 | typedef unsigned int uint32_T; |
paulcox | 0:70d27fec6d71 | 95 | typedef float real32_T; |
paulcox | 0:70d27fec6d71 | 96 | typedef double real64_T; |
paulcox | 0:70d27fec6d71 | 97 | |
paulcox | 0:70d27fec6d71 | 98 | /*===========================================================================* |
paulcox | 0:70d27fec6d71 | 99 | * Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, * |
paulcox | 0:70d27fec6d71 | 100 | * ulong_T, char_T and byte_T. * |
paulcox | 0:70d27fec6d71 | 101 | *===========================================================================*/ |
paulcox | 0:70d27fec6d71 | 102 | typedef double real_T; |
paulcox | 0:70d27fec6d71 | 103 | typedef double time_T; |
paulcox | 0:70d27fec6d71 | 104 | typedef unsigned char boolean_T; |
paulcox | 0:70d27fec6d71 | 105 | typedef int int_T; |
paulcox | 0:70d27fec6d71 | 106 | typedef unsigned int uint_T; |
paulcox | 0:70d27fec6d71 | 107 | typedef unsigned long ulong_T; |
paulcox | 0:70d27fec6d71 | 108 | typedef char char_T; |
paulcox | 0:70d27fec6d71 | 109 | typedef unsigned char uchar_T; |
paulcox | 0:70d27fec6d71 | 110 | typedef char_T byte_T; |
paulcox | 0:70d27fec6d71 | 111 | |
paulcox | 0:70d27fec6d71 | 112 | #endif /* PORTABLE_WORDSIZES */ |
paulcox | 0:70d27fec6d71 | 113 | |
paulcox | 0:70d27fec6d71 | 114 | /*===========================================================================* |
paulcox | 0:70d27fec6d71 | 115 | * Complex number type definitions * |
paulcox | 0:70d27fec6d71 | 116 | *===========================================================================*/ |
paulcox | 0:70d27fec6d71 | 117 | #define CREAL_T |
paulcox | 0:70d27fec6d71 | 118 | |
paulcox | 0:70d27fec6d71 | 119 | typedef struct { |
paulcox | 0:70d27fec6d71 | 120 | real32_T re; |
paulcox | 0:70d27fec6d71 | 121 | real32_T im; |
paulcox | 0:70d27fec6d71 | 122 | } creal32_T; |
paulcox | 0:70d27fec6d71 | 123 | |
paulcox | 0:70d27fec6d71 | 124 | typedef struct { |
paulcox | 0:70d27fec6d71 | 125 | real64_T re; |
paulcox | 0:70d27fec6d71 | 126 | real64_T im; |
paulcox | 0:70d27fec6d71 | 127 | } creal64_T; |
paulcox | 0:70d27fec6d71 | 128 | |
paulcox | 0:70d27fec6d71 | 129 | typedef struct { |
paulcox | 0:70d27fec6d71 | 130 | real_T re; |
paulcox | 0:70d27fec6d71 | 131 | real_T im; |
paulcox | 0:70d27fec6d71 | 132 | } creal_T; |
paulcox | 0:70d27fec6d71 | 133 | |
paulcox | 0:70d27fec6d71 | 134 | #define CINT8_T |
paulcox | 0:70d27fec6d71 | 135 | |
paulcox | 0:70d27fec6d71 | 136 | typedef struct { |
paulcox | 0:70d27fec6d71 | 137 | int8_T re; |
paulcox | 0:70d27fec6d71 | 138 | int8_T im; |
paulcox | 0:70d27fec6d71 | 139 | } cint8_T; |
paulcox | 0:70d27fec6d71 | 140 | |
paulcox | 0:70d27fec6d71 | 141 | #define CUINT8_T |
paulcox | 0:70d27fec6d71 | 142 | |
paulcox | 0:70d27fec6d71 | 143 | typedef struct { |
paulcox | 0:70d27fec6d71 | 144 | uint8_T re; |
paulcox | 0:70d27fec6d71 | 145 | uint8_T im; |
paulcox | 0:70d27fec6d71 | 146 | } cuint8_T; |
paulcox | 0:70d27fec6d71 | 147 | |
paulcox | 0:70d27fec6d71 | 148 | #define CINT16_T |
paulcox | 0:70d27fec6d71 | 149 | |
paulcox | 0:70d27fec6d71 | 150 | typedef struct { |
paulcox | 0:70d27fec6d71 | 151 | int16_T re; |
paulcox | 0:70d27fec6d71 | 152 | int16_T im; |
paulcox | 0:70d27fec6d71 | 153 | } cint16_T; |
paulcox | 0:70d27fec6d71 | 154 | |
paulcox | 0:70d27fec6d71 | 155 | #define CUINT16_T |
paulcox | 0:70d27fec6d71 | 156 | |
paulcox | 0:70d27fec6d71 | 157 | typedef struct { |
paulcox | 0:70d27fec6d71 | 158 | uint16_T re; |
paulcox | 0:70d27fec6d71 | 159 | uint16_T im; |
paulcox | 0:70d27fec6d71 | 160 | } cuint16_T; |
paulcox | 0:70d27fec6d71 | 161 | |
paulcox | 0:70d27fec6d71 | 162 | #define CINT32_T |
paulcox | 0:70d27fec6d71 | 163 | |
paulcox | 0:70d27fec6d71 | 164 | typedef struct { |
paulcox | 0:70d27fec6d71 | 165 | int32_T re; |
paulcox | 0:70d27fec6d71 | 166 | int32_T im; |
paulcox | 0:70d27fec6d71 | 167 | } cint32_T; |
paulcox | 0:70d27fec6d71 | 168 | |
paulcox | 0:70d27fec6d71 | 169 | #define CUINT32_T |
paulcox | 0:70d27fec6d71 | 170 | |
paulcox | 0:70d27fec6d71 | 171 | typedef struct { |
paulcox | 0:70d27fec6d71 | 172 | uint32_T re; |
paulcox | 0:70d27fec6d71 | 173 | uint32_T im; |
paulcox | 0:70d27fec6d71 | 174 | } cuint32_T; |
paulcox | 0:70d27fec6d71 | 175 | |
paulcox | 0:70d27fec6d71 | 176 | /*=======================================================================* |
paulcox | 0:70d27fec6d71 | 177 | * Min and Max: * |
paulcox | 0:70d27fec6d71 | 178 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 179 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * |
paulcox | 0:70d27fec6d71 | 180 | *=======================================================================*/ |
paulcox | 0:70d27fec6d71 | 181 | #define MAX_int8_T ((int8_T)(127)) |
paulcox | 0:70d27fec6d71 | 182 | #define MIN_int8_T ((int8_T)(-128)) |
paulcox | 0:70d27fec6d71 | 183 | #define MAX_uint8_T ((uint8_T)(255U)) |
paulcox | 0:70d27fec6d71 | 184 | #define MIN_uint8_T ((uint8_T)(0U)) |
paulcox | 0:70d27fec6d71 | 185 | #define MAX_int16_T ((int16_T)(32767)) |
paulcox | 0:70d27fec6d71 | 186 | #define MIN_int16_T ((int16_T)(-32768)) |
paulcox | 0:70d27fec6d71 | 187 | #define MAX_uint16_T ((uint16_T)(65535U)) |
paulcox | 0:70d27fec6d71 | 188 | #define MIN_uint16_T ((uint16_T)(0U)) |
paulcox | 0:70d27fec6d71 | 189 | #define MAX_int32_T ((int32_T)(2147483647)) |
paulcox | 0:70d27fec6d71 | 190 | #define MIN_int32_T ((int32_T)(-2147483647-1)) |
paulcox | 0:70d27fec6d71 | 191 | #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) |
paulcox | 0:70d27fec6d71 | 192 | #define MIN_uint32_T ((uint32_T)(0U)) |
paulcox | 0:70d27fec6d71 | 193 | |
paulcox | 0:70d27fec6d71 | 194 | /* Block D-Work pointer type */ |
paulcox | 0:70d27fec6d71 | 195 | typedef void * pointer_T; |
paulcox | 0:70d27fec6d71 | 196 | |
paulcox | 0:70d27fec6d71 | 197 | /* Simulink specific types */ |
paulcox | 0:70d27fec6d71 | 198 | #ifndef __ZERO_CROSSING_TYPES__ |
paulcox | 0:70d27fec6d71 | 199 | #define __ZERO_CROSSING_TYPES__ |
paulcox | 0:70d27fec6d71 | 200 | |
paulcox | 0:70d27fec6d71 | 201 | /* Trigger directions: falling, either, and rising */ |
paulcox | 0:70d27fec6d71 | 202 | typedef enum { |
paulcox | 0:70d27fec6d71 | 203 | FALLING_ZERO_CROSSING = -1, |
paulcox | 0:70d27fec6d71 | 204 | ANY_ZERO_CROSSING = 0, |
paulcox | 0:70d27fec6d71 | 205 | RISING_ZERO_CROSSING = 1 |
paulcox | 0:70d27fec6d71 | 206 | } ZCDirection; |
paulcox | 0:70d27fec6d71 | 207 | |
paulcox | 0:70d27fec6d71 | 208 | /* Previous state of a trigger signal */ |
paulcox | 0:70d27fec6d71 | 209 | typedef uint8_T ZCSigState; |
paulcox | 0:70d27fec6d71 | 210 | |
paulcox | 0:70d27fec6d71 | 211 | /* Initial value of a trigger zero crossing signal */ |
paulcox | 0:70d27fec6d71 | 212 | #define UNINITIALIZED_ZCSIG 0x03U |
paulcox | 0:70d27fec6d71 | 213 | #define NEG_ZCSIG 0x02U |
paulcox | 0:70d27fec6d71 | 214 | #define POS_ZCSIG 0x01U |
paulcox | 0:70d27fec6d71 | 215 | #define ZERO_ZCSIG 0x00U |
paulcox | 0:70d27fec6d71 | 216 | |
paulcox | 0:70d27fec6d71 | 217 | /* Current state of a trigger signal */ |
paulcox | 0:70d27fec6d71 | 218 | typedef enum { |
paulcox | 0:70d27fec6d71 | 219 | FALLING_ZCEVENT = -1, |
paulcox | 0:70d27fec6d71 | 220 | NO_ZCEVENT = 0, |
paulcox | 0:70d27fec6d71 | 221 | RISING_ZCEVENT = 1 |
paulcox | 0:70d27fec6d71 | 222 | } ZCEventType; |
paulcox | 0:70d27fec6d71 | 223 | |
paulcox | 0:70d27fec6d71 | 224 | #endif /* __ZERO_CROSSING_TYPES__ */ |
paulcox | 0:70d27fec6d71 | 225 | #endif /* __RTWTYPES_H__ */ |
paulcox | 0:70d27fec6d71 | 226 | |
paulcox | 0:70d27fec6d71 | 227 | /* |
paulcox | 0:70d27fec6d71 | 228 | * File trailer for generated code. |
paulcox | 0:70d27fec6d71 | 229 | * |
paulcox | 0:70d27fec6d71 | 230 | * [EOF] |
paulcox | 0:70d27fec6d71 | 231 | */ |