User`s guide

46
* o Embedded Target for TI C6000 DSP User's Guide
*/
#include "TwinDFTs_CCS.h"
#include "TwinDFTs_CCS_private.h"
#include "rtwtypes.h"
#include "rtmodel.h"
#include "rt_sim.h"
#include "c2000_main.h"
#include "DSP281x_Device.h"
#include "DSP281x_Examples.h"
extern RT_MODEL *MODEL(void);
extern void MdlInitializeSizes(void);
extern void MdlInitializeSampleTimes(void);
extern void MdlStart(void);
extern void MdlOutputs(int_T tid);
extern void MdlUpdate(int_T tid);
extern void MdlTerminate(void);
RT_MODEL *S;
volatile int IsrOverrun = 0;
static boolean_T OverrunFlag = 0;
/* Associating rt_OneStep with a real-time clock or interrupt service routine
* is what makes the generated code "real-time". The function rt_OneStep is
* always associated with the base rate of the model. Subrates are managed
* by the base rate from inside the generated code. Enabling/disabling
* interrupts and floating point context switches are target specific. This
* example code indicates where these should take place relative to executing
* the generated code step function. Overrun behavior should be tailored to
* your application needs. This example simply sets an error status in the
* real-time model and returns from rt_OneStep.
*/
void rt_OneStep(void)
{
real_T tnext;
// Check for overrun. Protect OverrunFlag against
// pre-emption
asm(" SETC INTM");
if (OverrunFlag++) {
IsrOverrun = 1;
OverrunFlag--;
asm(" CLRC INTM");
return;
}
asm(" CLRC INTM");
tnext = rt_SimGetNextSampleHit();
rtsiSetSolverStopTime(rtmGetRTWSolverInfo(S), tnext);
MdlOutputs(0);
MdlUpdate(0);
rt_SimUpdateDiscreteTaskSampleHits(rtmGetNumSampleTimes(S),
rtmGetTimingData(S),
rtmGetSampleHitPtr(S),
rtmGetTPtr(S));
OverrunFlag--;
}
//