%% Authors:
%% - Michal Horn <hornmich@fel.cvut.cz>
%%
-%% This document contains proprietary information belonging to Czech
-%% Technical University in Prague. Passing on and copying of this
-%% document, and communication of its contents is not permitted
-%% without prior written authorization.
+%% Permission is hereby granted, free of charge, to any person
+%% obtaining a copy of this software and associated documentation
+%% files (the "Software"), to deal in the Software without
+%% restriction, including without limitation the rights to use,
+%% copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the
+%% Software is furnished to do so, subject to the following
+%% conditions:
+
+%% The above copyright notice and this permission notice shall be
+%% included in all copies or substantial portions of the Software.
+
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+%% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+%% OTHER DEALINGS IN THE SOFTWARE.
%%
%% File : sfunction_fraytransmit.tlc
%% Abstract:
%% Ensure required header files are included
%<RppCommonBlockTypeSetup(block, system)>
+ %<LibAddToCommonIncludes("rpp/rpp.h")>
%endfunction
%assign payloadPreambleIndicatorTr_val = LibBlockParameterValue(payloadPreambleIndicatorTr, 0)
%assign singleTransmit_val = LibBlockParameterValue(singleTransmit, 0)
%assign slotId_val = LibBlockParameterValue(slotId, 0)
+ %assign bufferId_val = LibBlockParameterValue(bufferId, 0)
+
+ %if EXISTS(::rpp_fr_bufferId_%<bufferId_val>_flg) == 1
+ %<LibBlockReportError(block, "Buffer ID is already used by another FlexRay block.")>
+ %endif
+ %assign ::rpp_fr_bufferId_%<bufferId_val>_flg = 1
%openfile buffer
{
+ // Buffer %<bufferId_val>
%if channel_val == 1U
.channel = FR_CHANNEL_A,
%elseif channel_val == 2U
},
%closefile buffer
- %if ISEQUAL(::fray_buffer_key_slot, "")
- %assign ::fray_buffer_key_slot = "%<buffer>"
+ %if ISEQUAL(::rpp_fray_buffer_key_slot, "")
+ %assign ::rpp_fray_buffer_key_slot = "%<buffer>"
%else
- %assign ::fray_buffer_config = "%<::fray_buffer_config> %<buffer>"
+ %assign ::rpp_fray_buffer_config = "%<::rpp_fray_buffer_config> %<buffer>"
%endif
- %assign ::fray_buffer_count = %<::fray_buffer_count> + 1
+ %assign ::rpp_fray_buffer_count = %<::rpp_fray_buffer_count> + 1
%endfunction
%% Get parameters
%assign slotId_val = LibBlockParameterValue(slotId, 0)
%assign maxPayload_val = LibBlockParameterValue(maxPayload, 0)
+ %assign bufferId_val = LibBlockParameterValue(bufferId, 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", %<message>, %<slotId_val>);
+ rpp_sci_printf("sending message %#x on slot %d from buffer %d.\n", %<message>, %<slotId_val>, %<bufferId_val>);
- retVal = rpp_fr_transmit_lpdu(0, %<slotId_val>, &%<message>, %<maxPayload_val>*2);
+ retVal = rpp_fr_transmit_lpdu(0, %<bufferId_val>, &%<message>, %<maxPayload_val>*2);
if (retVal == FAILURE) {
- rpp_sci_printf("Sending a message to slot %#x failed.\n", %<slotId_val>);
+ rpp_sci_printf("Sending a message from buffer %#x failed.\n", %<bufferId_val>);
%<err_flag> = TRUE;
}
%endif