/*
 * File: Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct.h
 *
 * Real-Time Workshop code generated for Simulink model Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct.
 *
 * Model version                        : 1.809
 * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
 * Real-Time Workshop file generated on : Tue Apr 13 23:03:43 2010
 * TLC version                          : 7.3 (Jan 18 2009)
 * C source code generated on           : Tue Apr 13 23:03:44 2010
 *--------------------------------------------------------------
 *   Embedded Coder for Microchip dsPIC family.                 |
 *   Generate .c and .h files from your Matlab/simulink model   |
 *   and compile the diagram to .hex and .coff file that can be |
 *   downloaded directly into the microcontroller               |
 *                                                              |
 * Licence Accorded to Ing. Robert Grepl, Ph.D.                 |
 *                     Technical University Brno                |
 *                                                              |
 *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
 *   Version 3.1                               26-Nov-2009      |
 *   For Matlab 7.8             R2009a                          |
 *--------------------------------------------------------------
 */

#ifndef RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_h_
#define RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_h_
#ifndef Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_COMMON_INCLUDES_
# define Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_COMMON_INCLUDES_
#include <string.h>
#include "rtwtypes.h"
#include "rt_ABS.h"
#include "rt_SATURATE.h"
#endif                                 /* Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_COMMON_INCLUDES_ */

#include "Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_types.h"

/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
# define rtmGetErrorStatus(rtm)        ((void*) 0)
#endif

#ifndef rtmSetErrorStatus
# define rtmSetErrorStatus(rtm, val)   ((void) 0)
#endif

#ifndef rtmStepTask
# define rtmStepTask(rtm, idx)         ((rtm)->Timing.TaskCounters.TID[(idx)] == 0)
#endif

#ifndef rtmGetStopRequested
# define rtmGetStopRequested(rtm)      ((void*) 0)
#endif

#ifndef rtmTaskCounter
# define rtmTaskCounter(rtm, idx)      ((rtm)->Timing.TaskCounters.TID[(idx)])
#endif

#define Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_M Vejlupek_CAR4_dsPIC33_ACU44__M

/* Block signals (auto storage) */
typedef struct {
  uint32_T CFunctionCallecanFunctionsc[4];/* '<S10>/C Function Call [ecanFunctions.c]' */
  int16_T RateTransition1;             /* '<Root>/Rate Transition1' */
  int16_T RateTransition2;             /* '<Root>/Rate Transition2' */
  uint16_T RateTransition12;           /* '<Root>/Rate Transition12' */
  uint16_T RateTransition13;           /* '<Root>/Rate Transition13' */
  uint16_T RateTransition6;            /* '<Root>/Rate Transition6' */
  uint16_T RateTransition7;            /* '<Root>/Rate Transition7' */
  uint16_T current_o1;                 /* '<S8>/current' */
  uint16_T current_o2;                 /* '<S8>/current' */
  uint16_T Saturation;                 /* '<Root>/Saturation' */
  uint16_T Saturation1;                /* '<Root>/Saturation1' */
  uint16_T AngleCountby1roll1000QEI500mode;/* '<S8>/Angle => Count by 1 roll = 1000 QEI 500 mode x2 without index chx' */
  uint16_T AngleCountby1roll1000QEI500mo_d;/* '<S8>/Angle => Count by 1 roll = 1000 QEI 500 mode x2 without index chx1' */
  uint16_T DifferentFrequencyCorrectionM1;/* '<S7>/Different Frequency Correction M1' */
  uint16_T DifferentFrequencyCorrectionM2;/* '<S7>/Different Frequency Correction M2' */
  uint16_T y[8];                       /* '<S11>/myMux' */
  boolean_T RateTransition3;           /* '<Root>/Rate Transition3' */
  boolean_T Compare;                   /* '<S20>/Compare' */
  boolean_T Compare_d;                 /* '<S21>/Compare' */
  boolean_T LogicalOperator1;          /* '<S12>/Logical Operator1' */
  boolean_T LogicalOperator2;          /* '<S12>/Logical Operator2' */
  boolean_T DataTypeConversion11;      /* '<S6>/Data Type Conversion11' */
} BlockIO_Vejlupek_CAR4_dsPIC33_A;

/* Block states (auto storage) for system '<Root>' */
typedef struct {
  int32_T clockTickCounter;            /* '<S6>/Pulse Generator4' */
  int_T EnabledSubsystem_MODE;         /* '<Root>/Enabled Subsystem' */
  int_T CfunctionCall_MODE;            /* '<S11>/C-function Call' */
  int16_T RateTransition1_Buffer0;     /* '<Root>/Rate Transition1' */
  int16_T RateTransition2_Buffer0;     /* '<Root>/Rate Transition2' */
  int16_T Motor_Momentum;              /* '<Root>/Int16: Motor Momentum' */
  int16_T Steering_Rear;               /* '<Root>/Int16: Steering Rear' */
  uint16_T RateTransition12_Buffer0;   /* '<Root>/Rate Transition12' */
  uint16_T RateTransition13_Buffer0;   /* '<Root>/Rate Transition13' */
  uint16_T RateTransition6_Buffer0;    /* '<Root>/Rate Transition6' */
  uint16_T RateTransition7_Buffer0;    /* '<Root>/Rate Transition7' */
  uint16_T Buttons;                    /* '<Root>/Uint16: Buttons' */
  boolean_T RateTransition3_Buffer0;   /* '<Root>/Rate Transition3' */
  boolean_T DISABLE;                   /* '<Root>/Boolean: DISABLE' */
} D_Work_Vejlupek_CAR4_dsPIC33_AC;

/* Constant parameters (auto storage) */
typedef struct {
  /* Expression: parameters
   * '<S3>/Constant'
   */
  uint16_T Constant_Value_b[53];
} ConstParam_Vejlupek_CAR4_dsPIC3;

/* Real-time Model Data Structure */
struct RT_MODEL_Vejlupek_CAR4_dsPIC33_ {
  /*
   * Timing:
   * The following substructure contains information regarding
   * the timing information for the model.
   */
  struct {
    struct {
      uint8_T TID[3];
    } TaskCounters;

    struct {
      boolean_T TID1_2;
    } RateInteraction;
  } Timing;
};

/* Block signals (auto storage) */
extern BlockIO_Vejlupek_CAR4_dsPIC33_A Vejlupek_CAR4_dsPIC33_ACU44_S_B;

/* Block states (auto storage) */
extern D_Work_Vejlupek_CAR4_dsPIC33_AC Vejlupek_CAR4_dsPIC33_ACU_DWork;

/* Constant parameters (auto storage) */
extern const ConstParam_Vejlupek_CAR4_dsPIC3 Vejlupek_CAR4_dsPIC33_AC_ConstP;

/*
 * Exported States
 *
 * Note: Exported states are block states with an exported global
 * storage class designation.  RTW declares the memory for these states
 * and exports their symbols.
 *
 */
extern uint16_T Current_M3;            /* '<Root>/Uint16: Current M3' */
extern uint16_T Current_M4;            /* '<Root>/Uint16: Current M4' */
extern uint16_T ct_turnsE1;            /* '<Root>/Uint16: Encoder 1' */
extern uint16_T ct_turnsE2;            /* '<Root>/Uint16: Encoder 2' */

/* External function called from main */
extern void
  Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_SetEventsForThisBaseStep
  (boolean_T *eventFlags);

/* Model entry point functions */
extern void
  Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_SetEventsForThisBaseStep
  (boolean_T *eventFlags);
extern void Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_initialize(boolean_T
  firstTime);
extern void Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_step(int_T tid);

/* Real-time Model object */
extern RT_MODEL_Vejlupek_CAR4_dsPIC33_ *Vejlupek_CAR4_dsPIC33_ACU44__M;

/*-
 * The generated code includes comments that allow you to trace directly
 * back to the appropriate location in the model.  The basic format
 * is <system>/block_name, where system is the system number (uniquely
 * assigned by Simulink) and block_name is the name of the block.
 *
 * Use the MATLAB hilite_system command to trace the generated code back
 * to the model.  For example,
 *
 * hilite_system('<S3>')    - opens system 3
 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
 *
 * Here is the system hierarchy for this model
 *
 * '<Root>' : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct
 * '<S1>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Change Momentum // Steering
 * '<S2>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Change Steering // Momentum
 * '<S3>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Configure ECAN 1
 * '<S4>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem
 * '<S5>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Hex 400 Slave QEI and Current1
 * '<S6>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/LED Indicator Port A8 1Hz
 * '<S7>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Motor Drive Control
 * '<S8>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/QEI Ts = 1e-2 Current Ts = 5e-3
 * '<S9>'   : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3
 * '<S10>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3
 * '<S11>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message
 * '<S12>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Subsystem
 * '<S13>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/dbl-click to open Graphical interface
 * '<S14>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Int16 Motor Momentum
 * '<S15>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Int16 Steering Rear
 * '<S16>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Uint16 Buttons
 * '<S17>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Int16 Motor Momentum/Shift up 1
 * '<S18>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Int16 Steering Rear/Shift up 1
 * '<S19>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Enabled Subsystem/Receiver Uint16 Buttons/Shift up 1
 * '<S20>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Motor Drive Control/Compare To Zero
 * '<S21>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Motor Drive Control/Compare To Zero1
 * '<S22>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 Current 1
 * '<S23>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 Current 2
 * '<S24>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 QEI 1
 * '<S25>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 QEI 2
 * '<S26>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Triggering
 * '<S27>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 Current 1/Get Higher 4 bites
 * '<S28>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 Current 2/Get Higher 4 bites
 * '<S29>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 QEI 1/Get Higher 4 bites
 * '<S30>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Rear Unit Control Data: Steering, Motor momentum, Buttons, DISABLE Ts = 5e-3/Transmiter Unit16 QEI 2/Get Higher 4 bites
 * '<S31>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Compare To Zero
 * '<S32>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64
 * '<S33>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Extract Bits
 * '<S34>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Extract Bits1
 * '<S35>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Extract Bits2
 * '<S36>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits
 * '<S37>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits1
 * '<S38>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits2
 * '<S39>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits3
 * '<S40>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits4
 * '<S41>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits5
 * '<S42>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits6
 * '<S43>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Receive ECAN1 Message Ts = 5e-3/Decompose uint64/Extract Bits7
 * '<S44>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/C-function Call
 * '<S45>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/Extract Bits
 * '<S46>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/Extract Bits1
 * '<S47>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/myMux
 * '<S48>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/uint8 combiner1
 * '<S49>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/uint8 combiner2
 * '<S50>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/uint8 combiner1/Shift Arithmetic
 * '<S51>'  : Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct/Send ECAN1 Message/uint8 combiner2/Shift Arithmetic
 */
#endif                                 /* RTW_HEADER_Vejlupek_CAR4_dsPIC33_ACU44_SlaveBoard_direct_h_ */

/* File trailer for Real-Time Workshop generated code.
 *
 * [EOF]
 */
