%% Copyright (C) 2013 Czech Technical University in Prague %% %% Authors: %% - Michal Horn %% %% This program is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by %% the Free Software Foundation; either version 2 of the License, or %% (at your option) any later version. %% %% This program is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty of %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %% GNU General Public License for more details. %% %% You should have received a copy of the GNU General Public License %% along with this program. If not, see . %% %% File : sfunction_fraytransmit.tlc %% Abstract: %% TLC file for inlining RPP FlexRay node configuration. %% %% References: %% BlockTypeSetup() : refs/rtw_tlc.pdf p. 277 %% Outputs() : refs/rtw_tlc.pdf p. 281 %implements sfunction_fraytransmit "C" %include "common.tlc" %% Function: BlockTypeSetup ==================================================== %function BlockTypeSetup(block, system) void %% Ensure required header files are included % %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 %==1 .channel = FR_CHANNEL_A, %elseif %==2 .channel = FR_CHANNEL_B, %else .channel = FR_CHANNEL_AB, %endif .cycleCounterFiltering = %, .isTx = TRUE, .maxPayload = %, .msgBufferInterrupt = %, .payloadPreambleIndicatorTr = %, .singleTransmit = %, .slotId = % }, %closefile buffer %if ISEQUAL(::fray_buffer_key_slot, "") %assign ::fray_buffer_key_slot = "%" %else %assign ::fray_buffer_config = "%<::fray_buffer_config> %" %endif %assign ::fray_buffer_count = %<::fray_buffer_count> + 1 %endfunction %% Function: Start ============================================================= %function Start(block, system) Output %if !SLibCodeGenForSim() %if EXISTS(::rpp_fray_config_present) == 0 LibBlockReportError([],"FlexRay config block not present!") %endif %endif %endfunction %% Function: Outputs =========================================================== %function Outputs(block, system) Output %if EXISTS("_RPP_FRAYSTEP_TMP_VARS_") == 0 %assign ::_RPP_FRAYSTEP_TMP_VARS_ = 1 int8_t retVal; %endif %if !SLibCodeGenForSim() %% Get parameters %assign slotId_val = LibBlockParameterValue(slotId, 0) %assign maxPayload_val = LibBlockParameterValue(maxPayload, 0) %% Get IO signals %assign message = LibBlockInputSignal(0, "", "", 0) %assign err_flag = LibBlockOutputSignal(0, "", "", 0) rpp_sci_printf("sending message %#x on slot %d.\n", %, %); retVal = rpp_fr_transmit_lpdu(0, %, &%, %*2); if (retVal == FAILURE) { rpp_sci_printf("Sending a message to slot %#x failed.\n", %); % = TRUE; } %endif %endfunction %% [EOF]