%% Ensure required header files are included
%<RppCommonBlockTypeSetup(block, system)>
+ %assign ::rpp_fray_config_present = 1
+
+%endfunction
+
+%function BlockInstanceSetup(block, system) void
+
+ %openfile buffer
+ static const Fr_TMS570LS_ClusterConfigType fray_cluster_cfg = {
+ .gColdStartAttempts = %<LibBlockParameterValue(gColdStartAttempts, 0)>,
+ .gListenNoise = %<LibBlockParameterValue(gListenNoise, 0)>,
+ .gMacroPerCycle = %<LibBlockParameterValue(gMacroPerCycle, 0)>,
+ .gMaxWithoutClockCorrectionFatal = %<LibBlockParameterValue(gMaxWithoutClockCorrectionFatal, 0)>,
+ .gMaxWithoutClockCorrectionPassive = %<LibBlockParameterValue(gMaxWithoutClockCorrectionPassive, 0)>,
+ .gNetworkManagementVectorLength = %<LibBlockParameterValue(gNetworkManagementVectorLength, 0)>,
+ .gNumberOfMinislots = %<LibBlockParameterValue(gNumberOfMinislots, 0)>,
+ .gNumberOfStaticSlots = %<LibBlockParameterValue(gNumberOfStaticSlots, 0)>,
+ .gOffsetCorrectionStart = %<LibBlockParameterValue(gOffsetCorrectionStart, 0)>,
+ .gPayloadLengthStatic = %<LibBlockParameterValue(gPayloadLengthStatic, 0)>,
+ .gSyncNodeMax = %<LibBlockParameterValue(gSyncNodeMax, 0)>,
+ .gdActionPointOffset = %<LibBlockParameterValue(gdActionPointOffset, 0)>,
+ .gdCASRxLowMax = %<LibBlockParameterValue(gdCASRxLowMax, 0)>,
+ .gdDynamicSlotIdlePhase = %<LibBlockParameterValue(gdDynamicSlotIdlePhase, 0)>,
+ .gdMinislot = %<LibBlockParameterValue(gdMinislot, 0)>,
+ .gdMinislotActionPointOffset = %<LibBlockParameterValue(gdMinislotActionPointOffset, 0)>,
+ .gdNIT = %<LibBlockParameterValue(gdNIT, 0)>,
+ .gdSampleClockPeriod = %<LibBlockParameterValue(gdSampleClockPeriod, 0)>,
+ .gdStaticSlot = %<LibBlockParameterValue(gdStaticSlot, 0)>,
+ .gdTSSTransmitter = %<LibBlockParameterValue(gdTSSTransmitter, 0)>,
+ .gdWakeupSymbolRxIdle = %<LibBlockParameterValue(gdWakeupSymbolRxIdle, 0)>,
+ .gdWakeupSymbolRxLow = %<LibBlockParameterValue(gdWakeupSymbolRxLow, 0)>,
+ .gdWakeupSymbolRxWindow = %<LibBlockParameterValue(gdWakeupSymbolRxWindow, 0)>,
+ .gdWakeupSymbolTxIdle = %<LibBlockParameterValue(gdWakeupSymbolTxIdle, 0)>,
+ .gdWakeupSymbolTxLow = %<LibBlockParameterValue(gdWakeupSymbolTxLow, 0)>,
+ };
+
+ static const Fr_TMS570LS_NodeConfigType fray_node_cfg = {
+ .pAllowHaltDueToClock = %<LibBlockParameterValue(pAllowHaltDueToClock, 0)>,
+ .pAllowPassiveToActive = %<LibBlockParameterValue(pAllowPassiveToActive, 0)>,
+ %if %<LibBlockParameterValue(pChannels, 0)>==1
+ .pChannels = FR_CHANNEL_A,
+ %elseif %<LibBlockParameterValue(pChannels, 0)>==2
+ .pChannels = FR_CHANNEL_B,
+ %else
+ .pChannels = FR_CHANNEL_AB,
+ %endif
+ .pClusterDriftDamping = %<LibBlockParameterValue(pClusterDriftDamping, 0)>,
+ .pDelayCompensationA = %<LibBlockParameterValue(pDelayCompensationA, 0)>,
+ .pDelayCompensationB = %<LibBlockParameterValue(pDelayCompensationB, 0)>,
+ .pExternOffsetCorrection = %<LibBlockParameterValue(pExternOffsetCorrection, 0)>,
+ .pExternRateCorrection = %<LibBlockParameterValue(pExternRateCorrection, 0)>,
+ .pKeySlotUsedForStartup = %<LibBlockParameterValue(pKeySlotUsedForStartup, 0)>,
+ .pKeySlotUsedForSync = %<LibBlockParameterValue(pKeySlotUsedForSync, 0)>,
+ .pLatestTx = %<LibBlockParameterValue(pLatestTx, 0)>,
+ .pMacroInitialOffsetA = %<LibBlockParameterValue(pMacroInitialOffsetA, 0)>,
+ .pMacroInitialOffsetB = %<LibBlockParameterValue(pMacroInitialOffsetB, 0)>,
+ .pMicroInitialOffsetA = %<LibBlockParameterValue(pMicroInitialOffsetA, 0)>,
+ .pMicroInitialOffsetB = %<LibBlockParameterValue(pMicroInitialOffsetB, 0)>,
+ .pMicroPerCycle = %<LibBlockParameterValue(pMicroPerCycle, 0)>,
+ .pRateCorrectionOut = %<LibBlockParameterValue(pRateCorrectionOut, 0)>,
+ .pOffsetCorrectionOut = %<LibBlockParameterValue(pOffsetCorrectionOut, 0)>,
+ .pSamplesPerMicrotick = %<LibBlockParameterValue(pSamplesPerMicrotick, 0)>,
+ .pSingleSlotEnabled = %<LibBlockParameterValue(pSingleSlotEnabled, 0)>,
+ %if %<LibBlockParameterValue(pWakeupChannel, 0)>==1
+ .pWakeupChannel = FR_CHANNEL_A,
+ %else
+ .pWakeupChannel = FR_CHANNEL_B,
+ %endif
+ .pWakeupPattern = %<LibBlockParameterValue(pWakeupPattern, 0)>,
+ .pdAcceptedStartupRange = %<LibBlockParameterValue(pdAcceptedStartupRange, 0)>,
+ .pdListenTimeout = %<LibBlockParameterValue(pdListenTimeout, 0)>,
+ .pdMaxDrift = %<LibBlockParameterValue(pdMaxDrift, 0)>,
+ .pDecodingCorrection = %<LibBlockParameterValue(pDecodingCorrection, 0)>,
+ };
+
+ #define FRAY_STATIC_BUFFER_COUNT %<::fray_buffer_count>
+ static const Fr_TMS570LS_BufferConfigType fray_static_buffers_cfg[FRAY_STATIC_BUFFER_COUNT] = {
+ %<::fray_buffer_config>
+ };
+
+ static const Fr_TMS570LS_MsgRAMConfig fray_msg_ram_cfg = {
+ .syncFramePayloadMultiplexEnabled = %<LibBlockParameterValue(syncFramePayloadMultiplexEnabled, 0)>,
+ %if %<LibBlockParameterValue(secureBuffers, 0)>==1
+ .secureBuffers = FR_SB_RECONFIG_ENABLED,
+ %elseif %<LibBlockParameterValue(secureBuffers, 0)>==2
+ .secureBuffers = FR_SB_STAT_REC_DISABLED_STAT_TR_DISABLED,
+ %elseif %<LibBlockParameterValue(secureBuffers, 0)>==3
+ .secureBuffers = FR_SB_ALL_REC_DISABLED,
+ %else
+ .secureBuffers = FR_SB_ALL_REC_DISABLED_STAT_TR_DISABLED,
+ %endif
+ .statSegmentBufferCount = FRAY_STATIC_BUFFER_COUNT,
+ .dynSegmentBufferCount = 0,
+ .fifoBufferCount = 0
+ };
+
+ static const Fr_ConfigType flexray_cfg = {
+ .clusterConfiguration = &fray_cluster_cfg,
+ .nodeConfiguration = &fray_node_cfg,
+ .msgRAMConfig = &fray_msg_ram_cfg,
+ .staticBufferConfigs = fray_static_buffers_cfg,
+ .dynamicBufferConfigs = NULL,
+ .fifoBufferConfigs = NULL,
+ };
+
+ %closefile buffer
+ %<LibSetSourceFileSection(LibGetModelDotCFile(), "Declarations", buffer)>
%endfunction
%function Start(block, system) Output
%if !SLibCodeGenForSim()
- %% Pick global configuration parameters
- %assign gColdStartAttempts_val = LibBlockParameterValue(gColdStartAttempts, 0)
- %assign gListenNoise_val = LibBlockParameterValue(gListenNoise, 0)
- %assign gMacroPerCycle_val = LibBlockParameterValue(gMacroPerCycle, 0)
- %assign gMaxWithoutClockCorrectionFatal_val = LibBlockParameterValue(gMaxWithoutClockCorrectionFatal, 0)
- %assign gMaxWithoutClockCorrectionPassive_val = LibBlockParameterValue(gMaxWithoutClockCorrectionPassive, 0)
- %assign gNetworkManagementVectorLength_val = LibBlockParameterValue(gNetworkManagementVectorLength, 0)
- %assign gNumberOfMinislots_val = LibBlockParameterValue(gNumberOfMinislots, 0)
- %assign gNumberOfStaticSlots_val = LibBlockParameterValue(gNumberOfStaticSlots, 0)
- %assign gOffsetCorrectionStart_val = LibBlockParameterValue(gOffsetCorrectionStart, 0)
- %assign gPayloadLengthStatic_val = LibBlockParameterValue(gPayloadLengthStatic, 0)
- %assign gSyncNodeMax_val = LibBlockParameterValue(gSyncNodeMax, 0)
- %assign gdActionPointOffset_val = LibBlockParameterValue(gdActionPointOffset, 0)
- %assign gdCASRxLowMax_val = LibBlockParameterValue(gdCASRxLowMax, 0)
- %assign gdDynamicSlotIdlePhase_val = LibBlockParameterValue(gdDynamicSlotIdlePhase, 0)
- %assign gdMinislot_val = LibBlockParameterValue(gdMinislot, 0)
- %assign gdMinislotActionPointOffset_val = LibBlockParameterValue(gdMinislotActionPointOffset, 0)
- %assign gdNIT_val = LibBlockParameterValue(gdNIT, 0)
- %assign gdSampleClockPeriod_val = LibBlockParameterValue(gdSampleClockPeriod, 0)
- %assign gdStaticSlot_val = LibBlockParameterValue(gdStaticSlot, 0)
- %assign gdTSSTransmitter_val = LibBlockParameterValue(gdTSSTransmitter, 0)
- %assign gdWakeupSymbolRxIdle_val = LibBlockParameterValue(gdWakeupSymbolRxIdle, 0)
- %assign gdWakeupSymbolRxLow_val = LibBlockParameterValue(gdWakeupSymbolRxLow, 0)
- %assign gdWakeupSymbolRxWindow_val = LibBlockParameterValue(gdWakeupSymbolRxWindow, 0)
- %assign gdWakeupSymbolTxIdle_val = LibBlockParameterValue(gdWakeupSymbolTxIdle, 0)
- %assign gdWakeupSymbolTxLow_val = LibBlockParameterValue(gdWakeupSymbolTxLow, 0)
-
- %% Pick node configuration parameters
- %assign pAllowHaltDueToClock_val = LibBlockParameterValue(pAllowHaltDueToClock, 0)
- %assign pAllowPassiveToActive_val = LibBlockParameterValue(pAllowPassiveToActive, 0)
- %assign pChannels_val = LibBlockParameterValue(pChannels, 0)
- %assign pClusterDriftDamping_val = LibBlockParameterValue(pClusterDriftDamping, 0)
- %assign pDelayCompensationA_val = LibBlockParameterValue(pDelayCompensationA, 0)
- %assign pDelayCompensationB_val = LibBlockParameterValue(pDelayCompensationB, 0)
- %assign pExternOffsetCorrection_val = LibBlockParameterValue(pExternOffsetCorrection, 0)
- %assign pExternRateCorrection_val = LibBlockParameterValue(pExternRateCorrection, 0)
- %assign pKeySlotUsedForStartup_val = LibBlockParameterValue(pKeySlotUsedForStartup, 0)
- %assign pKeySlotUsedForSync_val = LibBlockParameterValue(pKeySlotUsedForSync, 0)
- %assign pLatestTx_val = LibBlockParameterValue(pLatestTx, 0)
- %assign pMacroInitialOffsetA_val = LibBlockParameterValue(pMacroInitialOffsetA, 0)
- %assign pMacroInitialOffsetB_val = LibBlockParameterValue(pMacroInitialOffsetB, 0)
- %assign pMicroInitialOffsetA_val = LibBlockParameterValue(pMicroInitialOffsetA, 0)
- %assign pMicroInitialOffsetB_val = LibBlockParameterValue(pMicroInitialOffsetB, 0)
- %assign pMicroPerCycle_val = LibBlockParameterValue(pMicroPerCycle, 0)
- %assign pRateCorrectionOut_val = LibBlockParameterValue(pRateCorrectionOut, 0)
- %assign pOffsetCorrectionOut_val = LibBlockParameterValue(pOffsetCorrectionOut, 0)
- %assign pSamplesPerMicrotick_val = LibBlockParameterValue(pSamplesPerMicrotick, 0)
- %assign pSingleSlotEnabled_val = LibBlockParameterValue(pSingleSlotEnabled, 0)
- %assign pWakeupChannel_val = LibBlockParameterValue(pWakeupChannel, 0)
- %assign pWakeupPattern_val = LibBlockParameterValue(pWakeupPattern, 0)
- %assign pdAcceptedStartupRange_val = LibBlockParameterValue(pdAcceptedStartupRange, 0)
- %assign pdListenTimeout_val = LibBlockParameterValue(pdListenTimeout, 0)
- %assign pdMaxDrift_val = LibBlockParameterValue(pdMaxDrift, 0)
- %assign pDecodingCorrection_val = LibBlockParameterValue(pDecodingCorrection, 0)
- %assign syncFramePayloadMultiplexEnabled_val = LibBlockParameterValue(syncFramePayloadMultiplexEnabled, 0)
- %assign secureBuffers_val = LibBlockParameterValue(secureBuffers, 0)
%% Error flag
%assign err_flag = LibBlockOutputSignal(0, "", "", 0)
- %% Declare temporal variables
- %if EXISTS("_RPP_FRAYCONFIG_TMP_VARS_") == 0
- %assign ::_RPP_FRAYCONFIG_TMP_VARS_ = 1
- #define MAX_ST_BUF_CFG 62
- Fr_TMS570LS_ClusterConfigType cluster_cfg;
- Fr_TMS570LS_NodeConfigType node_cfg;
- Fr_TMS570LS_BufferConfigType static_buffers_cfg[MAX_ST_BUF_CFG];
- Fr_TMS570LS_MsgRAMConfig msg_ram_cfg;
- Fr_ConfigType flexray_cfg;
- uint8_t static_buffers_cnt = 0;
- %endif
- %if EXISTS("_RPP_FRAY_TMP_VARS_") == 0
- %assign ::_RPP_FRAY_TMP_VARS_ = 1
- int8_t retVal;
- uint32_t error;
+ %% Declare temporal variables
+ %if EXISTS("_RPP_FRAYCONFIG_TMP_VARS_") == 0
+ %assign ::_RPP_FRAYCONFIG_TMP_VARS_ = 1
%endif
+ int8_t retVal;
+ uint32_t error;
-
- cluster_cfg.gColdStartAttempts = %<gColdStartAttempts_val>;
- cluster_cfg.gListenNoise = %<gListenNoise_val>;
- cluster_cfg.gMacroPerCycle = %<gMacroPerCycle_val>;
- cluster_cfg.gMaxWithoutClockCorrectionFatal = %<gMaxWithoutClockCorrectionFatal_val>;
- cluster_cfg.gMaxWithoutClockCorrectionPassive = %<gMaxWithoutClockCorrectionPassive_val>;
- cluster_cfg.gNetworkManagementVectorLength = %<gNetworkManagementVectorLength_val>;
- cluster_cfg.gNumberOfMinislots = %<gNumberOfMinislots_val>;
- cluster_cfg.gNumberOfStaticSlots = %<gNumberOfStaticSlots_val>;
- cluster_cfg.gOffsetCorrectionStart = %<gOffsetCorrectionStart_val>;
- cluster_cfg.gPayloadLengthStatic = %<gPayloadLengthStatic_val>;
- cluster_cfg.gSyncNodeMax = %<gSyncNodeMax_val>;
- cluster_cfg.gdActionPointOffset = %<gdActionPointOffset_val>;
- cluster_cfg.gdCASRxLowMax = %<gdCASRxLowMax_val>;
- cluster_cfg.gdDynamicSlotIdlePhase = %<gdDynamicSlotIdlePhase_val>;
- cluster_cfg.gdMinislot = %<gdMinislot_val>;
- cluster_cfg.gdMinislotActionPointOffset = %<gdMinislotActionPointOffset_val>;
- cluster_cfg.gdNIT = %<gdNIT_val>;
- cluster_cfg.gdSampleClockPeriod = %<gdSampleClockPeriod_val>;
- cluster_cfg.gdStaticSlot = %<gdStaticSlot_val>;
- cluster_cfg.gdTSSTransmitter = %<gdTSSTransmitter_val>;
- cluster_cfg.gdWakeupSymbolRxIdle = %<gdWakeupSymbolRxIdle_val>;
- cluster_cfg.gdWakeupSymbolRxLow = %<gdWakeupSymbolRxLow_val>;
- cluster_cfg.gdWakeupSymbolRxWindow = %<gdWakeupSymbolRxWindow_val>;
- cluster_cfg.gdWakeupSymbolTxIdle = %<gdWakeupSymbolTxIdle_val>;
- cluster_cfg.gdWakeupSymbolTxLow = %<gdWakeupSymbolTxLow_val>;
-
- node_cfg.pAllowHaltDueToClock = %<pAllowHaltDueToClock_val>;
- node_cfg.pAllowPassiveToActive = %<pAllowPassiveToActive_val>;
- %if %<pChannels_val>==1
- node_cfg.pChannels = FR_CHANNEL_A;
- %elseif %<pChannels_val>==2
- node_cfg.pChannels = FR_CHANNEL_B;
- %else
- node_cfg.pChannels = FR_CHANNEL_AB;
- %endif
- node_cfg.pClusterDriftDamping = %<pClusterDriftDamping_val>;
- node_cfg.pDelayCompensationA = %<pDelayCompensationA_val>;
- node_cfg.pDelayCompensationB = %<pDelayCompensationB_val>;
- node_cfg.pExternOffsetCorrection = %<pExternOffsetCorrection_val>;
- node_cfg.pExternRateCorrection = %<pExternRateCorrection_val>;
- node_cfg.pKeySlotUsedForStartup = %<pKeySlotUsedForStartup_val>;
- node_cfg.pKeySlotUsedForSync = %<pKeySlotUsedForSync_val>;
- node_cfg.pLatestTx = %<pLatestTx_val>;
- node_cfg.pMacroInitialOffsetA = %<pMacroInitialOffsetA_val>;
- node_cfg.pMacroInitialOffsetB = %<pMacroInitialOffsetB_val>;
- node_cfg.pMicroInitialOffsetA = %<pMicroInitialOffsetA_val>;
- node_cfg.pMicroInitialOffsetB = %<pMicroInitialOffsetB_val>;
- node_cfg.pMicroPerCycle = %<pMicroPerCycle_val>;
- node_cfg.pRateCorrectionOut = %<pRateCorrectionOut_val>;
- node_cfg.pOffsetCorrectionOut = %<pOffsetCorrectionOut_val>;
- node_cfg.pSamplesPerMicrotick = %<pSamplesPerMicrotick_val>;
- node_cfg.pSingleSlotEnabled = %<pSingleSlotEnabled_val>;
- %if %<pWakeupChannel_val>==1
- node_cfg.pWakeupChannel = FR_CHANNEL_A;
- %else
- node_cfg.pWakeupChannel = FR_CHANNEL_B;
- %endif
- node_cfg.pWakeupPattern = %<pWakeupPattern_val>;
- node_cfg.pdAcceptedStartupRange = %<pdAcceptedStartupRange_val>;
- node_cfg.pdListenTimeout = %<pdListenTimeout_val>;
- node_cfg.pdMaxDrift = %<pdMaxDrift_val>;
- node_cfg.pDecodingCorrection = %<pDecodingCorrection_val>;
- msg_ram_cfg.syncFramePayloadMultiplexEnabled = %<syncFramePayloadMultiplexEnabled_val>;
- %if %<secureBuffers_val>==1
- msg_ram_cfg.secureBuffers = FR_SB_RECONFIG_ENABLED;
- %elseif %<secureBuffers_val>==2
- msg_ram_cfg.secureBuffers = FR_SB_STAT_REC_DISABLED_STAT_TR_DISABLED;
- %elseif %<secureBuffers_val>==3
- msg_ram_cfg.secureBuffers = FR_SB_ALL_REC_DISABLED;
- %else
- msg_ram_cfg.secureBuffers = FR_SB_ALL_REC_DISABLED_STAT_TR_DISABLED;
- %endif
- msg_ram_cfg.statSegmentBufferCount = static_buffers_cnt;
- msg_ram_cfg.dynSegmentBufferCount = 0;
- msg_ram_cfg.fifoBufferCount = 0;
- flexray_cfg.clusterConfiguration = &cluster_cfg;
- flexray_cfg.nodeConfiguration = &node_cfg;
- flexray_cfg.msgRAMConfig = &msg_ram_cfg;
- flexray_cfg.staticBufferConfigs = static_buffers_cfg;
- flexray_cfg.dynamicBufferConfigs = NULL;
- flexray_cfg.fifoBufferConfigs = NULL;
-
- retVal = rpp_fr_init_driver((const Fr_ConfigType*)&flexray_cfg, &error);
+ retVal = rpp_fr_init_driver(&flexray_cfg, &error);
if (retVal == FAILURE) {
- rpp_sci_printf("FlexRay driver init error.\n");
+ rpp_sci_printf("FlexRay driver init error.\n");
%<err_flag> = TRUE;
}
else {
%include "common.tlc"
+%assign ::fray_buffer_config = ""
+%assign ::fray_buffer_count = 0
%% Function: BlockTypeSetup ====================================================
%function BlockTypeSetup(block, system) void
%endfunction
-
-%% Function: Start =============================================================
-%function Start(block, system) Output
-
- %if !SLibCodeGenForSim()
- %assign channel_val = LibBlockParameterValue(channel, 0)
- %assign cycleCounterFiltering_val = LibBlockParameterValue(cycleCounterFiltering, 0)
- %assign maxPayload_val = LibBlockParameterValue(maxPayload, 0)
- %assign msgBufferInterrupt_val = LibBlockParameterValue(msgBufferInterrupt, 0)
- %assign payloadPreambleIndicatorTr_val = LibBlockParameterValue(payloadPreambleIndicatorTr, 0)
- %assign singleTransmit_val = LibBlockParameterValue(singleTransmit, 0)
- %assign slotId_val = LibBlockParameterValue(slotId, 0)
-
- %% Declare temporal variables
- %if EXISTS("_RPP_FRAYCONFIG_TMP_VARS_") == 0
- %assign ::_RPP_FRAYCONFIG_TMP_VARS_ = 1
- #define MAX_ST_BUF_CFG 62
- Fr_TMS570LS_ClusterConfigType cluster_cfg;
- Fr_TMS570LS_NodeConfigType node_cfg;
- Fr_TMS570LS_BufferConfigType static_buffers_cfg[MAX_ST_BUF_CFG];
- Fr_TMS570LS_MsgRAMConfig msg_ram_cfg;
- Fr_ConfigType flexray_cfg;
- uint8_t static_buffers_cnt = 0;
- %endif
- %if %<channel_val>==1
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_A;
- %elseif %<channel_val>==2
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_B;
- %else
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_AB;
- %endif
- static_buffers_cfg[static_buffers_cnt].cycleCounterFiltering = %<cycleCounterFiltering_val>;
- static_buffers_cfg[static_buffers_cnt].isTx = FALSE;
- static_buffers_cfg[static_buffers_cnt].maxPayload = %<maxPayload_val>;
- static_buffers_cfg[static_buffers_cnt].msgBufferInterrupt = %<msgBufferInterrupt_val>;
- static_buffers_cfg[static_buffers_cnt].payloadPreambleIndicatorTr = %<payloadPreambleIndicatorTr_val>;
- static_buffers_cfg[static_buffers_cnt].singleTransmit = %<singleTransmit_val>;
- static_buffers_cfg[static_buffers_cnt].slotId = %<slotId_val>;
- static_buffers_cnt++;
- rpp_sci_printf("RX buffer %d added.\n", static_buffers_cnt);
- %endif
+%function BlockInstanceSetup(block, system) void
+ %assign channel_val = LibBlockParameterValue(channel, 0)
+ %assign cycleCounterFiltering_val = LibBlockParameterValue(cycleCounterFiltering, 0)
+ %assign maxPayload_val = LibBlockParameterValue(maxPayload, 0)
+ %assign msgBufferInterrupt_val = LibBlockParameterValue(msgBufferInterrupt, 0)
+ %assign payloadPreambleIndicatorTr_val = LibBlockParameterValue(payloadPreambleIndicatorTr, 0)
+ %assign singleTransmit_val = LibBlockParameterValue(singleTransmit, 0)
+ %assign slotId_val = LibBlockParameterValue(slotId, 0)
+
+ %openfile buffer
+ {
+ %if %<channel_val>==1
+ .channel = FR_CHANNEL_A,
+ %elseif %<channel_val>==2
+ .channel = FR_CHANNEL_B,
+ %else
+ .channel = FR_CHANNEL_AB,
+ %endif
+ .cycleCounterFiltering = %<cycleCounterFiltering_val>,
+ .isTx = FALSE,
+ .maxPayload = %<maxPayload_val>,
+ .msgBufferInterrupt = %<msgBufferInterrupt_val>,
+ .payloadPreambleIndicatorTr = %<payloadPreambleIndicatorTr_val>,
+ .singleTransmit = %<singleTransmit_val>,
+ .slotId = %<slotId_val>
+ },
+ %closefile buffer
+ %assign ::fray_buffer_config = "%<::fray_buffer_config> %<buffer>"
+ %assign ::fray_buffer_count = %<::fray_buffer_count> + 1
%endfunction
%% Function: Outputs ===========================================================
%assign length = LibBlockOutputSignal(2, "", "", 0)
%assign trigger = LibBlockOutputSignal(3, "", "", 0)
- uint8_t rec_msg[16];
- uint8_t rec_length;
- Fr_RxLPduStatusType rec_status;
+ %if EXISTS("_RPP_FRAYSTEP_RX_VARS_") == 0
+ %assign ::_RPP_FRAYSTEP_RX_VARS_ = 1
+ uint8_t rec_msg[16];
+ uint8_t rec_length;
+ Fr_RxLPduStatusType rec_status;
+ %endif
retVal = rpp_fr_receive_lpdu(0, %<slotId_val>, rec_msg, &rec_status, &rec_length);
if (retVal == FAILURE) {
%endfunction
+%function BlockInstanceSetup(block, system) void
+ %assign channel_val = LibBlockParameterValue(channel, 0)
+ %assign cycleCounterFiltering_val = LibBlockParameterValue(cycleCounterFiltering, 0)
+ %assign maxPayload_val = LibBlockParameterValue(maxPayload, 0)
+ %assign msgBufferInterrupt_val = LibBlockParameterValue(msgBufferInterrupt, 0)
+ %assign payloadPreambleIndicatorTr_val = LibBlockParameterValue(payloadPreambleIndicatorTr, 0)
+ %assign singleTransmit_val = LibBlockParameterValue(singleTransmit, 0)
+ %assign slotId_val = LibBlockParameterValue(slotId, 0)
+
+ %openfile buffer
+ {
+ %if %<channel_val>==1
+ .channel = FR_CHANNEL_A,
+ %elseif %<channel_val>==2
+ .channel = FR_CHANNEL_B,
+ %else
+ .channel = FR_CHANNEL_AB,
+ %endif
+ .cycleCounterFiltering = %<cycleCounterFiltering_val>,
+ .isTx = TRUE,
+ .maxPayload = %<maxPayload_val>,
+ .msgBufferInterrupt = %<msgBufferInterrupt_val>,
+ .payloadPreambleIndicatorTr = %<payloadPreambleIndicatorTr_val>,
+ .singleTransmit = %<singleTransmit_val>,
+ .slotId = %<slotId_val>
+ },
+ %closefile buffer
+ %assign ::fray_buffer_config = "%<::fray_buffer_config> %<buffer>"
+ %assign ::fray_buffer_count = %<::fray_buffer_count> + 1
+%endfunction
+
%% Function: Start =============================================================
%function Start(block, system) Output
%if !SLibCodeGenForSim()
- %assign channel_val = LibBlockParameterValue(channel, 0)
- %assign cycleCounterFiltering_val = LibBlockParameterValue(cycleCounterFiltering, 0)
- %assign maxPayload_val = LibBlockParameterValue(maxPayload, 0)
- %assign msgBufferInterrupt_val = LibBlockParameterValue(msgBufferInterrupt, 0)
- %assign payloadPreambleIndicatorTr_val = LibBlockParameterValue(payloadPreambleIndicatorTr, 0)
- %assign singleTransmit_val = LibBlockParameterValue(singleTransmit, 0)
- %assign slotId_val = LibBlockParameterValue(slotId, 0)
- %% Declare temporal variables
- %if EXISTS("_RPP_FRAYCONFIG_TMP_VARS_") == 0
- %assign ::_RPP_FRAYCONFIG_TMP_VARS_ = 1
- #define MAX_ST_BUF_CFG 62
- Fr_TMS570LS_ClusterConfigType cluster_cfg;
- Fr_TMS570LS_NodeConfigType node_cfg;
- Fr_TMS570LS_BufferConfigType static_buffers_cfg[MAX_ST_BUF_CFG];
- Fr_TMS570LS_MsgRAMConfig msg_ram_cfg;
- Fr_ConfigType flexray_cfg;
- uint8_t static_buffers_cnt = 0;
- %endif
- %if EXISTS("_RPP_FRAY_TMP_VARS_") == 0
- %assign ::_RPP_FRAY_TMP_VARS_ = 1
- int8_t retVal;
- uint32_t error;
- %endif
- %if %<channel_val>==1
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_A;
- %elseif %<channel_val>==2
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_B;
- %else
- static_buffers_cfg[static_buffers_cnt].channel = FR_CHANNEL_AB;
- %endif
- static_buffers_cfg[static_buffers_cnt].cycleCounterFiltering = %<cycleCounterFiltering_val>;
- static_buffers_cfg[static_buffers_cnt].isTx = TRUE;
- static_buffers_cfg[static_buffers_cnt].maxPayload = %<maxPayload_val>;
- static_buffers_cfg[static_buffers_cnt].msgBufferInterrupt = %<msgBufferInterrupt_val>;
- static_buffers_cfg[static_buffers_cnt].payloadPreambleIndicatorTr = %<payloadPreambleIndicatorTr_val>;
- static_buffers_cfg[static_buffers_cnt].singleTransmit = %<singleTransmit_val>;
- static_buffers_cfg[static_buffers_cnt].slotId = %<slotId_val>;
- static_buffers_cnt++;
- rpp_sci_printf("Tx buffer %d added.\n", static_buffers_cnt);
+ %if EXISTS(::rpp_fray_config_present) == 0
+ LibBlockReportError([],"FlexRay config block not present!")
+ %endif
%endif
%endfunction