-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_code
508 lines (432 loc) · 15.7 KB
/
main_code
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
/*
* File: stills_R_Wsdfdsgfsdhfghggfh.c
*
.
*
* C source code generated on : Wed Aug 17 00:57:55 2016
*/
#include "stills_R_Wsdfdsgfsdhfghggfh.h"
#include "stills_R_Wsdfdsgfsdhfghggfh_private.h"
RTDX_CreateInputChannel(inputimage); /* Channel inputimage for block <Root>/From RTDX */
RTDX_CreateOutputChannel(outputimage); /* Channel outputimage for block <Root>/To RTDX */
/* Block signals (auto storage) */
#pragma DATA_ALIGN(stills_R_Wsdfdsgfsdhfghggfh_B, 8)
BlockIO_stills_R_Wsdfdsgfsdhfgh stills_R_Wsdfdsgfsdhfghggfh_B;
/* Real-time model */
RT_MODEL_stills_R_Wsdfdsgfsdhfg stills_R_Wsdfdsgfsdhfghggfh_M_;
RT_MODEL_stills_R_Wsdfdsgfsdhfg *stills_R_Wsdfdsgfsdhfghggfh_M =
&stills_R_Wsdfdsgfsdhfghggfh_M_;
/* Model step function */
void stills_R_Wsdfdsgfsdhfghggfh_step(void)
{
/* local block i/o variables */
real_T rtb_Add;
real_T rtb_Add_k[3];
real_T rtb_Sum1;
real_T rtb_MathFunction3;
real_T rtb_Sum2;
{
real_T uDiv;
real_T uDivRound;
/* S-Function Block: <Root>/From RTDX (rtdx_src) */
RTDX_read( &inputimage, (void*) stills_R_Wsdfdsgfsdhfghggfh_B.FromRTDX, 3*
sizeof(real_T));
/* Math: '<S2>/Math Function' incorporates:
* Constant: '<Root>/Constant5'
* Constant: '<S2>/Constant'
*/
if (stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value == 0.0) {
rtb_Sum1 = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value;
} else if (stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value <= floor
(stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value)) {
rtb_Sum1 = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value - floor
(stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value /
stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value;
} else {
uDiv = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value /
stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value;
uDivRound = floor(fabs(uDiv) + 0.5);
if (uDiv < 0.0) {
uDivRound = -uDivRound;
}
if (fabs(uDiv - uDivRound) <= DBL_EPSILON * fabs(uDiv)) {
rtb_Sum1 = 0.0;
} else {
rtb_Sum1 = (uDiv - floor(uDiv)) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant_Value;
}
}
/* S-Function (sdspsubmtrx): '<S2>/Submatrix' incorporates:
* Constant: '<Root>/Constant1'
*/
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[0] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[1];
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[1] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[4];
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[2] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[7];
/* MultiPortSwitch: '<S2>/Index Vector' incorporates:
* Bias: '<S2>/Bias'
*/
switch ((int32_T)(rtb_Sum1 + stills_R_Wsdfdsgfsdhfghggfh_P.Bias_Bias)) {
case 1:
rtb_Sum1 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[0];
break;
case 2:
rtb_Sum1 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[1];
break;
default:
rtb_Sum1 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix[2];
break;
}
/* Rounding: '<S2>/Rounding Function1' incorporates:
* Bias: '<S2>/Bias1'
* Constant: '<Root>/Constant5'
* Fcn: '<S2>/Fcn'
* Rounding: '<S2>/Rounding Function'
*/
rtb_Sum2 = ceil(floor(log(stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value)) +
stills_R_Wsdfdsgfsdhfghggfh_P.Bias1_Bias);
/* Math: '<S2>/Math Function1' incorporates:
* Constant: '<S2>/Constant1'
*/
if ((stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value_h < 0.0) && (rtb_Sum2 >
floor(rtb_Sum2))) {
rtb_Sum2 = -pow(-stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value_h, rtb_Sum2);
} else {
rtb_Sum2 = pow(stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value_h, rtb_Sum2);
}
/* Math: '<S2>/Math Function2' incorporates:
* Constant: '<Root>/Constant5'
*/
if (rtb_Sum2 == 0.0) {
rtb_MathFunction3 = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value;
} else if (rtb_Sum2 <= floor(rtb_Sum2)) {
rtb_MathFunction3 = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value - floor
(stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value / rtb_Sum2) * rtb_Sum2;
} else {
uDiv = stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value / rtb_Sum2;
uDivRound = floor(fabs(uDiv) + 0.5);
if (uDiv < 0.0) {
uDivRound = -uDivRound;
}
if (fabs(uDiv - uDivRound) <= DBL_EPSILON * fabs(uDiv)) {
rtb_MathFunction3 = 0.0;
} else {
rtb_MathFunction3 = (uDiv - floor(uDiv)) * rtb_Sum2;
}
}
/* Sum: '<S2>/Add' */
rtb_Add = rtb_Sum2 + rtb_MathFunction3;
/* Sum: '<S2>/Sum' incorporates:
* Constant: '<Root>/Constant2'
* Constant: '<Root>/Constant3'
* Constant: '<Root>/Constant4'
* Constant: '<S2>/Constant2'
* Product: '<S2>/Product1'
*/
rtb_MathFunction3 = stills_R_Wsdfdsgfsdhfghggfh_P.Constant2_Value *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant2_Value_f +
stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value;
/* Math: '<S2>/Math Function3' incorporates:
* Constant: '<S2>/Constant3'
*/
if (!(stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g == 0.0)) {
if (stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g <= floor
(stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g)) {
rtb_MathFunction3 -= floor(rtb_MathFunction3 /
stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g;
} else {
uDiv = rtb_MathFunction3 /
stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g;
uDivRound = floor(fabs(uDiv) + 0.5);
if (uDiv < 0.0) {
uDivRound = -uDivRound;
}
if (fabs(uDiv - uDivRound) <= DBL_EPSILON * fabs(uDiv)) {
rtb_MathFunction3 = 0.0;
} else {
rtb_MathFunction3 = (uDiv - floor(uDiv)) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant3_Value_g;
}
}
}
/* Sum: '<S2>/Sum1' incorporates:
* Product: '<S2>/Product'
*/
rtb_Sum1 += rtb_Add * rtb_MathFunction3;
/* Math: '<S2>/Math Function4' incorporates:
* Constant: '<S2>/Constant4'
*/
if (stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n == 0.0) {
rtb_Sum2 = rtb_Sum1;
} else if (stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n <= floor
(stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n)) {
rtb_Sum2 = rtb_Sum1 - floor(rtb_Sum1 /
stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n;
} else {
uDiv = rtb_Sum1 / stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n;
uDivRound = floor(fabs(uDiv) + 0.5);
if (uDiv < 0.0) {
uDivRound = -uDivRound;
}
if (fabs(uDiv - uDivRound) <= DBL_EPSILON * fabs(uDiv)) {
rtb_Sum2 = 0.0;
} else {
rtb_Sum2 = (uDiv - floor(uDiv)) *
stills_R_Wsdfdsgfsdhfghggfh_P.Constant4_Value_n;
}
}
/* S-Function (sdspsubmtrx): '<S2>/Submatrix1' incorporates:
* Constant: '<Root>/Constant1'
*/
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[0] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[1];
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[1] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[4];
stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[2] =
stills_R_Wsdfdsgfsdhfghggfh_P.Constant1_Value[7];
/* MultiPortSwitch: '<S2>/Index Vector1' incorporates:
* Bias: '<S2>/Bias2'
*/
switch ((int32_T)(rtb_Sum2 + stills_R_Wsdfdsgfsdhfghggfh_P.Bias2_Bias)) {
case 1:
rtb_Sum2 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[0];
break;
case 2:
rtb_Sum2 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[1];
break;
default:
rtb_Sum2 = stills_R_Wsdfdsgfsdhfghggfh_B.Submatrix1[2];
break;
}
/* Rounding: '<S2>/Rounding Function3' incorporates:
* Bias: '<S2>/Bias3'
* Fcn: '<S2>/Fcn1'
* Rounding: '<S2>/Rounding Function2'
*/
rtb_Add = ceil(floor(log(rtb_Sum1)) +
stills_R_Wsdfdsgfsdhfghggfh_P.Bias3_Bias);
/* Math: '<S2>/Math Function5' incorporates:
* Constant: '<S2>/Constant5'
*/
if ((stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value_m < 0.0) && (rtb_Add >
floor(rtb_Add))) {
rtb_Add = -pow(-stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value_m, rtb_Add);
} else {
rtb_Add = pow(stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value_m, rtb_Add);
}
/* Math: '<S2>/Math Function6' */
if (rtb_Add == 0.0) {
uDiv = rtb_Sum1;
} else if (rtb_Add <= floor(rtb_Add)) {
uDiv = rtb_Sum1 - floor(rtb_Sum1 / rtb_Add) * rtb_Add;
} else {
uDiv = rtb_Sum1 / rtb_Add;
uDivRound = floor(fabs(uDiv) + 0.5);
if (uDiv < 0.0) {
uDivRound = -uDivRound;
}
if (fabs(uDiv - uDivRound) <= DBL_EPSILON * fabs(uDiv)) {
uDiv = 0.0;
} else {
uDiv = (uDiv - floor(uDiv)) * rtb_Add;
}
}
/* Sum: '<S2>/Sum2' incorporates:
* Product: '<S2>/Product3'
* Sum: '<S2>/Add1'
*/
rtb_Sum2 += (rtb_Add + uDiv) * rtb_MathFunction3;
/* Sum: '<Root>/Add' incorporates:
* Constant: '<Root>/Constant5'
*/
rtb_Add_k[0] = stills_R_Wsdfdsgfsdhfghggfh_B.FromRTDX[0] +
stills_R_Wsdfdsgfsdhfghggfh_P.Constant5_Value;
rtb_Add_k[1] = stills_R_Wsdfdsgfsdhfghggfh_B.FromRTDX[1] + rtb_Sum1;
rtb_Add_k[2] = stills_R_Wsdfdsgfsdhfghggfh_B.FromRTDX[2] + rtb_Sum2;
/* S-Function Block: <Root>/To RTDX (rtdx_snk) */
if (RTDX_isOutputEnabled( &outputimage )) {
while (RTDX_writing != NULL) {
} /* waiting for rtdx write to complete */
RTDX_write( &outputimage, (void*) rtb_Add_k, 3*sizeof(real_T));
}
}
}
/* Model initialize function */
void stills_R_Wsdfdsgfsdhfghggfh_initialize(boolean_T firstTime)
{
(void)firstTime;
/* Registration code */
/* initialize error status */
rtmSetErrorStatus(stills_R_Wsdfdsgfsdhfghggfh_M, (const char_T *)0);
/* block I/O */
{
int_T i;
void *pVoidBlockIORegion;
pVoidBlockIORegion = (void *)(&stills_R_Wsdfdsgfsdhfghggfh_B.FromRTDX[0]);
for (i = 0; i < 9; i++) {
((real_T*)pVoidBlockIORegion)[i] = 0.0;
}
}
/* From RTDX (rtdx_src) */
{
RTDX_enableInput(&inputimage);
}
RTDX_enableOutput(&outputimage); /* To RTDX (rtdx_snk) */
}
/* Model terminate function */
void stills_R_Wsdfdsgfsdhfghggfh_terminate(void)
{
RTDX_disableInput(&inputimage); /*: <Root>/From RTDX (rtdx_src) */
RTDX_disableOutput(&outputimage); /*To RTDX (rtdx_snk) */
}
/* File trailer for Real-Time Workshop generated code.
*
* [EOF]
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* File: stills_R_Wsdfdsgfsdhfghggfh_data.c
*
* C source code generated on : Wed Aug 17 00:57:55 2016
*/
#include "stills_R_Wsdfdsgfsdhfghggfh.h"
#include "stills_R_Wsdfdsgfsdhfghggfh_private.h"
/* Block parameters (auto storage) */
#pragma DATA_ALIGN(stills_R_Wsdfdsgfsdhfghggfh_P, 8)
Parameters_stills_R_Wsdfdsgfsdh stills_R_Wsdfdsgfsdhfghggfh_P = {
0.0, /* FromRTDX_IC : '<Root>/From RTDX'
*/
2.0, /* Constant5_Value : '<Root>/Constant5'
*/
3.0, /* Constant_Value : '<S2>/Constant'
*/
1.0, /* Bias_Bias : '<S2>/Bias'
*/
/* Constant1_Value : '<Root>/Constant1'
*/
{ 1.0, 1.0, 4.0, 2.0, 2.0, 5.0, 3.0, 3.0, 6.0 },
2.0, /* Constant1_Value_h : '<S2>/Constant1'
*/
1.0, /* Bias1_Bias : '<S2>/Bias1'
*/
2.0, /* Constant2_Value : '<Root>/Constant2'
*/
2.0, /* Constant3_Value : '<Root>/Constant3'
*/
10.0, /* Constant2_Value_f : '<S2>/Constant2'
*/
2.0, /* Constant4_Value : '<Root>/Constant4'
*/
113.0, /* Constant3_Value_g : '<S2>/Constant3'
*/
3.0, /* Constant4_Value_n : '<S2>/Constant4'
*/
1.0, /* Bias2_Bias : '<S2>/Bias2'
*/
2.0, /* Constant5_Value_m : '<S2>/Constant5'
*/
1.0 /* Bias3_Bias : '<S2>/Bias3'
*/
};
/* File trailer for Real-Time Workshop generated code.
*
* [EOF]
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* File: stills_R_Wsdfdsgfsdhfghggfh_main.c
*
* C source code generated on : Wed Aug 17 00:57:55 2016
*/
#include "stills_R_Wsdfdsgfsdhfghggfh_main.h"
#include "stills_R_Wsdfdsgfsdhfghggfh.h"
#include "stills_R_Wsdfdsgfsdhfghggfh_private.h"
#include "stills_R_Wsdfdsgfsdhfghggfhcfg.h"
#include "rtwtypes.h"
#include "MW_c6xxx_csl.h"
#include "c6000_main.h"
#include <stdlib.h>
#include <stdio.h>
#define DSK_CPLD_BASE 0x60000000
#define DSK_USER_REG 0
/* Function: exitprocessing ----------------------------------
*
* Abstract:
* Perform various tasks at program exit.
*/
void exitprocessing()
{
disable_interrupts();
SYS_exit(-1);
}
void tBaseRateTSK_fcn(void)
{
volatile boolean_T noErr;
TSK_prolog( TSK_self() );
noErr =
rtmGetErrorStatus(stills_R_Wsdfdsgfsdhfghggfh_M) == NULL;
while (noErr ) {
/* Wait for the next timer interrupt */
SEM_pend(&rtClockSEM, SYS_FOREVER);
stills_R_Wsdfdsgfsdhfghggfh_step();
noErr =
rtmGetErrorStatus(stills_R_Wsdfdsgfsdhfghggfh_M) == NULL;
} /* while */
SEM_post(&stopSEM);
}
void main(void)
{
setupCache();
LOG_printf(&LOG_MW1, "**starting the model**");
/* Drop out of main() and enter DSP/BIOS Kernel */
}
//
// TSK prolog/epilog functions.
//
void TSK_prolog(TSK_Handle hTask)
{
#ifdef ENET_SOCKET_CALLS
fdOpenSession( hTask );
#endif
}
void TSK_epilog(TSK_Handle hTask)
{
#ifdef ENET_SOCKET_CALLS
fdCloseSession( hTask );
#endif
}
//
// This task is run at the highest priority. It is used to
// initialize the model and also to monitor stopping conditions.
// OS executes this task immidiately after falling out of main().
//
void initTerminateTSK_fcn(void)
{
stills_R_Wsdfdsgfsdhfghggfh_initialize(1);
enable_interrupts();
configureTimers();
/* Wait for a stopping condition. */
SEM_pend(&stopSEM, SYS_FOREVER);
/* We have acquired the STOP semaphore. Perform model termination. */
/* Suspend syncronous tasks */
{
TSK_epilog( &tBaseRateTSK );
TSK_setpri( &tBaseRateTSK, -1 );
}
LOG_printf(&LOG_MW1, "**stopping the model**");
/* Disable rt_OneStep() here */
/* Terminate model */
stills_R_Wsdfdsgfsdhfghggfh_terminate();
targetTerminate();
}
/* File trailer for Real-Time Workshop generated code.
*
* [EOF]
*/