%endif
%endif
- %if EXISTS("::fray_buffer_config") == 0
- %assign ::fray_buffer_config = ""
+ %if EXISTS("::rpp_fray_buffer_config") == 0
+ %assign ::rpp_fray_buffer_config = ""
%endif
- %if EXISTS("::fray_buffer_count") == 0
- %assign ::fray_buffer_count = 0
+ %if EXISTS("::rpp_fray_buffer_count") == 0
+ %assign ::rpp_fray_buffer_count = 0
%endif
- %if EXISTS("::fray_buffer_key_slot") == 0
- %assign ::fray_buffer_key_slot = ""
+ %if EXISTS("::rpp_fray_buffer_key_slot") == 0
+ %assign ::rpp_fray_buffer_key_slot = ""
%endif
%endfunction
%% document, and communication of its contents is not permitted
%% without prior written authorization.
%%
-%% File : can_common.tlc
+%% File : rpp_can_common.tlc
%% Abstract:
%% TLC file with common functions and variables for sfunction_canreceive, sfunction_cansetup and sfunction_cantransmit
%%
%% References:
-%% Function: FindFreeMailboxNumber =============================================
-%function FindFreeMailboxNumber(end, module)
+%% Function: RPP_FindFreeMailboxNumber =========================================
+%function RPP_FindFreeMailboxNumber(end, module)
%foreach mn = %<end>
%assign index = %<mn>+1
- %if EXISTS("::can%<module>_mailbox_assigned%<index>_flag") == 0
+ %if EXISTS("::rpp_can%<module>_mailbox_assigned%<index>_flag") == 0
%return %<mn>
%break
%endif
%return -1
%endfunction
-%% Function: MailboxNumberDuplicite ============================================
-%function MailboxNumberDuplicite(module, mailbox_number, mailbox_auto)
+%% Function: RPP_MailboxNumberDuplicite ========================================
+%function RPP_MailboxNumberDuplicite(module, mailbox_number, mailbox_auto)
%if %<mailbox_auto> == 0U
- %if EXISTS("::can%<module>_mailbox_number%<mailbox_number>") == 0
- %assign ::can%<module>_mailbox_number%<mailbox_number> = 1
+ %if EXISTS("::rpp_can%<module>_mailbox_number%<mailbox_number>") == 0
+ %assign ::rpp_can%<module>_mailbox_number%<mailbox_number> = 1
%else
%return 1
%endif
%endfunction
-%% Function: AssertDirectionSpecificator =======================================
-%function AssertDirectionSpecificator(direction_sp) void
+%% Function: RPP_AssertDirectionSpecificator ===================================
+%function RPP_AssertDirectionSpecificator(direction_sp) void
%if !ISEQUAL(direction_sp, "t") && !ISEQUAL(direction_sp, "r")
%<LibBlockReportFatalError(block, "Illegal direction specificator: " + direction_sp)>
%endif
%endfunction
-%% Function: CreateNewBuffer ===================================================
-%function CreateNewBuffer(module, mailbox_num, message_type, message_id, mask, direction_sp) void
- %<AssertDirectionSpecificator(direction_sp)>
+%% Function: RPP_CreateNewBuffer ===============================================
+%function RPP_CreateNewBuffer(module, mailbox_num, message_type, message_id, mask, direction_sp) void
+ %<RPP_AssertDirectionSpecificator(direction_sp)>
%if ISEQUAL(direction_sp, "t")
- %createrecord ::tx_buffer_%<::can_tx_cnt> {type message_type; controller module; msg_obj mailbox_num; name "%<LibGetBlockName(block)>" }
+ %createrecord ::tx_buffer_%<::rpp_can_tx_cnt> {type message_type; controller module; msg_obj mailbox_num; name "%<LibGetBlockName(block)>" }
%else
- %createrecord ::rx_buffer_%<::can_rx_cnt> {type message_type; controller module; msg_obj mailbox_num; name "%<LibGetBlockName(block)>"; id message_id; msk mask }
+ %createrecord ::rx_buffer_%<::rpp_can_rx_cnt> {type message_type; controller module; msg_obj mailbox_num; name "%<LibGetBlockName(block)>"; id message_id; msk mask }
%endif
%endfunction
-%% Function: PlaceAutomaticMailboxNumber =======================================
-%function PlaceAutomaticMailboxNumber(max_mailbox_number, module, message_type, message_id, mask, direction_sp) void
- %<AssertDirectionSpecificator(direction_sp)>
+%% Function: RPP_PlaceAutomaticMailboxNumber ===================================
+%function RPP_PlaceAutomaticMailboxNumber(max_mailbox_number, module, message_type, message_id, mask, direction_sp) void
+ %<RPP_AssertDirectionSpecificator(direction_sp)>
%% Find first free mailbox number
%assign mailbox_number = FindFreeMailboxNumber(max_mailbox_number, module)
%assign mailbox_number = mailbox_number+1
%% Mark the mailbox number as used and assign a record about buffer to it
- %assign ::can%<module>_mailbox_assigned%<mailbox_number>_flag = 1
- %createrecord ::can%<module>_mailbox_assigned%<mailbox_number> { direction "%<direction_sp>"; buffer ::can_%<direction_sp>x_cnt }
+ %assign ::rpp_can%<module>_mailbox_assigned%<mailbox_number>_flag = 1
+ %createrecord ::rpp_can%<module>_mailbox_assigned%<mailbox_number> { direction "%<direction_sp>"; buffer ::rpp_can_%<direction_sp>x_cnt }
- %<CreateNewBuffer(module, mailbox_number, message_type, message_id, mask, direction_sp)>
+ %<RPP_CreateNewBuffer(module, mailbox_number, message_type, message_id, mask, direction_sp)>
%endfunction
-%% Function: PlaceManualMailboxNumber ==========================================
-%function PlaceManualMailboxNumber(max_mailbox_number, mailbox_num, module, message_type, message_id, mask, direction_sp) void
- %<AssertDirectionSpecificator(direction_sp)>
+%% Function: RPP_PlaceManualMailboxNumber ======================================
+%function RPP_PlaceManualMailboxNumber(max_mailbox_number, mailbox_num, module, message_type, message_id, mask, direction_sp) void
+ %<RPP_AssertDirectionSpecificator(direction_sp)>
%% Check whether the mailbox number is already used
- %if EXISTS(::can%<module>_mailbox_assigned%<mailbox_num>_flag) == 0
- %assign ::can%<module>_mailbox_assigned%<mailbox_num>_flag = 1
- %createrecord ::can%<module>_mailbox_assigned%<mailbox_num> { direction "%<direction_sp>"; buffer ::can_%<direction_sp>x_cnt }
+ %if EXISTS(::rpp_can%<module>_mailbox_assigned%<mailbox_num>_flag) == 0
+ %assign ::rpp_can%<module>_mailbox_assigned%<mailbox_num>_flag = 1
+ %createrecord ::rpp_can%<module>_mailbox_assigned%<mailbox_num> { direction "%<direction_sp>"; buffer ::rpp_can_%<direction_sp>x_cnt }
%else
%% The mailbox number is already used by the automaticaly placed buffer.
%% The case that it is used by another manualy placed buffer is handeled by the duplication check.
%assign mailbox_number = %<mailbox_number>+1
%% Mark the mailbox number as used
- %assign ::can%<module>_mailbox_assigned%<mailbox_number>_flag = 1
+ %assign ::rpp_can%<module>_mailbox_assigned%<mailbox_number>_flag = 1
%% Move record with buffer information to the new slot with free mailbox number id
- %copyrecord ::can%<module>_mailbox_assigned%<mailbox_number> ::can%<module>_mailbox_assigned%<mailbox_num>
+ %copyrecord ::rpp_can%<module>_mailbox_assigned%<mailbox_number> ::rpp_can%<module>_mailbox_assigned%<mailbox_num>
%% Create new record with buffer information in the required slot
- %createrecord ::can%<module>_mailbox_assigned%<mailbox_num> {direction "%<direction_sp>"; buffer ::can_%<direction_sp>x_cnt}
+ %createrecord ::rpp_can%<module>_mailbox_assigned%<mailbox_num> {direction "%<direction_sp>"; buffer ::rpp_can_%<direction_sp>x_cnt}
%% Fix mailbox number in the old buffer record
- %copyrecord tmp_ma ::can%<module>_mailbox_assigned%<mailbox_number>
+ %copyrecord tmp_ma ::rpp_can%<module>_mailbox_assigned%<mailbox_number>
%copyrecord tmp_buf ::%<tmp_ma.direction>x_buffer_%<tmp_ma.buffer>
%if ISEQUAL(tmp_ma.direction, "t")
%createrecord tmp_result {type tmp_buf.type; controller tmp_buf.controller; msg_obj mailbox_number; name "%<tmp_buf.name>" }
%endif
%endif
- %<CreateNewBuffer(module, mailbox_num, message_type, message_id, mask, direction_sp)>
+ %<RPP_CreateNewBuffer(module, mailbox_num, message_type, message_id, mask, direction_sp)>
%endfunction
%implements sfunction_canreceive "C"
%include "common.tlc"
-%include "can_common.tlc"
+%include "rpp_can_common.tlc"
%% Function: BlockTypeSetup ====================================================
%function BlockTypeSetup(block, system) void
%% Ensure required header files are included
%<RppCommonBlockTypeSetup(block, system)>
- %if EXISTS("::can_rx_hw_obj_cnt") == 0
- %assign ::can_rx_hw_obj_cnt = 0
+ %if EXISTS("::rpp_can_rx_hw_obj_cnt") == 0
+ %assign ::rpp_can_rx_hw_obj_cnt = 0
%endif
- %if EXISTS("::can_rx_cnt") == 0
- %assign ::can_rx_cnt = 0
+ %if EXISTS("::rpp_can_rx_cnt") == 0
+ %assign ::rpp_can_rx_cnt = 0
%endif
%endfunction
%assign mask = message_mask_val
%endif
- %if MailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
+ %if RPP_MailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
%<LibBlockReportError(block, "Duplicit mailbox number found!")>
%endif
%if %<mailbox_auto_val>==1
%% Place new buffer for automaticaly numbered mailbox.
- %<PlaceAutomaticMailboxNumber(31, module_id_val, message_type_val, message_id_val, mask, "r")>
+ %<RPP_PlaceAutomaticMailboxNumber(31, module_id_val, message_type_val, message_id_val, mask, "r")>
%else
%% Place new buffer for manualy numbered mailbox, replace the automaticaly numbered one, if needed.
- %<PlaceManualMailboxNumber(30, mailbox_id_val, module_id_val, message_type_val, message_id_val, mask, "r")>
+ %<RPP_PlaceManualMailboxNumber(30, mailbox_id_val, module_id_val, message_type_val, message_id_val, mask, "r")>
%endif
- %assign ::can_rx_cnt = %<::can_rx_cnt> + 1
+ %assign ::rpp_can_rx_cnt = %<::rpp_can_rx_cnt> + 1
%endfunction
{
struct rpp_can_pdu pdu;
- if (rpp_can_read(%<::can_rx_hw_obj_cnt>, &pdu) == FAILURE) {
- rpp_sci_printf("CAN%d (hw_obj: %d): Receiving a message failed.\n", %<module_id_val>, %<::can_rx_hw_obj_cnt>);
+ if (rpp_can_read(%<::rpp_can_rx_hw_obj_cnt>, &pdu) == FAILURE) {
+ rpp_sci_printf("CAN%d (hw_obj: %d): Receiving a message failed.\n", %<module_id_val>, %<::rpp_can_rx_hw_obj_cnt>);
}
else {
- %%rpp_sci_printf("CAN%d (hw_obj: %d): Message id 0x%X received at mailbox %d. Data: ", %<module_id_val>, %<::can_rx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
+ %%rpp_sci_printf("CAN%d (hw_obj: %d): Message id 0x%X received at mailbox %d. Data: ", %<module_id_val>, %<::rpp_can_rx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
%if %<data_type_val>==4
// CAN_MESSAGE
%<message>.Length = pdu.dlc;
%<LibBlockExecuteFcnCall(block, callIdx)>\
%endforeach
}
- %assign ::can_rx_hw_obj_cnt = %<::can_rx_hw_obj_cnt> + 1
+ %assign ::rpp_can_rx_hw_obj_cnt = %<::rpp_can_rx_hw_obj_cnt> + 1
}
%endif
%endfunction
%assign ::rpp_can_config_present = 1
%%assign rppCONFIG_INCLUDE_CAN = 1
- %if EXISTS("::can_tx_hw_obj_cnt") == 0
- %assign ::can_tx_hw_obj_cnt = 0
+ %if EXISTS("::rpp_can_tx_hw_obj_cnt") == 0
+ %assign ::rpp_can_tx_hw_obj_cnt = 0
%endif
- %if EXISTS("::can_rx_hw_obj_cnt") == 0
- %assign ::can_rx_hw_obj_cnt = 0
+ %if EXISTS("::rpp_can_rx_hw_obj_cnt") == 0
+ %assign ::rpp_can_rx_hw_obj_cnt = 0
%endif
- %if EXISTS("::can_rx_cnt") == 0
- %assign ::can_rx_cnt = 0
+ %if EXISTS("::rpp_can_rx_cnt") == 0
+ %assign ::rpp_can_rx_cnt = 0
%endif
- %if EXISTS("::can_tx_cnt") == 0
- %assign ::can_tx_cnt = 0
+ %if EXISTS("::rpp_can_tx_cnt") == 0
+ %assign ::rpp_can_tx_cnt = 0
%endif
%endfunction
%function Start(block, system) Output
%openfile buffer
- #define CAN_TX_COUNT %<::can_tx_cnt>
- #define CAN_RX_COUNT %<::can_rx_cnt>
+ #define CAN_TX_COUNT %<::rpp_can_tx_cnt>
+ #define CAN_RX_COUNT %<::rpp_can_rx_cnt>
struct rpp_can_ctrl_config can_ctrl_cfg[3] = {
{
};
struct rpp_can_tx_config tx_config[CAN_TX_COUNT] = {
- %foreach id = %<::can_tx_cnt>
+ %foreach id = %<::rpp_can_tx_cnt>
%copyrecord tmp_buffer ::tx_buffer_%<id>
// %<tmp_buffer.name>
{
};
struct rpp_can_rx_config rx_config[CAN_RX_COUNT] = {
- %foreach id = %<::can_rx_cnt>
+ %foreach id = %<::rpp_can_rx_cnt>
%copyrecord tmp_buffer ::rx_buffer_%<id>
// %<tmp_buffer.name>
{
%implements sfunction_cantransmit "C"
%include "common.tlc"
-%include "can_common.tlc"
+%include "rpp_can_common.tlc"
%% Function: BlockTypeSetup ====================================================
%function BlockTypeSetup(block, system) void
%% Ensure required header files are included
%<RppCommonBlockTypeSetup(block, system)>
- %if EXISTS("::can_tx_hw_obj_cnt") == 0
- %assign ::can_tx_hw_obj_cnt = 0
+ %if EXISTS("::rpp_can_tx_hw_obj_cnt") == 0
+ %assign ::rpp_can_tx_hw_obj_cnt = 0
%endif
- %if EXISTS("::can_tx_cnt") == 0
- %assign ::can_tx_cnt = 0
+ %if EXISTS("::rpp_can_tx_cnt") == 0
+ %assign ::rpp_can_tx_cnt = 0
%endif
%endfunction
%assign message_id_val = LibBlockParameterValue(message_id, 0)
%assign mailbox_auto_val = LibBlockParameterValue(mailbox_auto, 0)
- %if MailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
+ %if RPP_MailboxNumberDuplicite(module_id_val, mailbox_id_val, mailbox_auto_val) == 1
%<LibBlockReportError(block, "Duplicit mailbox number found!")>
%endif
%if %<mailbox_auto_val>==1
%% Place new buffer for automaticaly numbered mailbox.
- %<PlaceAutomaticMailboxNumber(31, module_id_val, message_type_val, 0, 0, "t")>
+ %<RPP_PlaceAutomaticMailboxNumber(31, module_id_val, message_type_val, 0, 0, "t")>
%else
%% Place new buffer for manualy numbered mailbox, replace the automaticaly numbered one, if needed.
- %<PlaceManualMailboxNumber(30, mailbox_id_val, module_id_val, message_type_val, 0, 0, "t")>
+ %<RPP_PlaceManualMailboxNumber(30, mailbox_id_val, module_id_val, message_type_val, 0, 0, "t")>
%endif
- %assign ::can_tx_cnt = %<::can_tx_cnt> + 1
+ %assign ::rpp_can_tx_cnt = %<::rpp_can_tx_cnt> + 1
%endfunction
pdu.id=%<message_id_val>;
- %%rpp_sci_printf("CAN%d (hw_obj: %d): Sending message id 0x%X from mailbox %d. Data: ", %<module_id_val>, %<::can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
+ %%rpp_sci_printf("CAN%d (hw_obj: %d): Sending message id 0x%X from mailbox %d. Data: ", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
%%for (i = 0; i < pdu.dlc; i++ ) {
%% rpp_sci_printf("%X ", pdu.data[i]);
%%}
%%rpp_sci_printf("\n");
- if (rpp_can_write(%<::can_tx_hw_obj_cnt>, &pdu) == FAILURE) {
- rpp_sci_printf("CAN%d (hw_obj: %d): Sending a message id 0x%X from mailbox %d failed.\n", %<module_id_val>, %<::can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
+ if (rpp_can_write(%<::rpp_can_tx_hw_obj_cnt>, &pdu) == FAILURE) {
+ rpp_sci_printf("CAN%d (hw_obj: %d): Sending a message id 0x%X from mailbox %d failed.\n", %<module_id_val>, %<::rpp_can_tx_hw_obj_cnt>, pdu.id, %<mailbox_id_val>);
}
- %assign ::can_tx_hw_obj_cnt = %<::can_tx_hw_obj_cnt> + 1
+ %assign ::rpp_can_tx_hw_obj_cnt = %<::rpp_can_tx_hw_obj_cnt> + 1
}
%endif
%endfunction
.pDecodingCorrection = %<LibBlockParameterValue(pDecodingCorrection, 0)>,
};
- #define FRAY_STATIC_BUFFER_COUNT %<::fray_buffer_count>
+ #define FRAY_STATIC_BUFFER_COUNT %<::rpp_fray_buffer_count>
static const Fr_TMS570LS_BufferConfigType fray_static_buffers_cfg[FRAY_STATIC_BUFFER_COUNT] = {
- %<::fray_buffer_key_slot>
- %<::fray_buffer_config>
+ %<::rpp_fray_buffer_key_slot>
+ %<::rpp_fray_buffer_config>
};
static const Fr_TMS570LS_MsgRAMConfig fray_msg_ram_cfg = {
.slotId = %<slotId_val>
},
%closefile buffer
- %assign ::fray_buffer_config = "%<::fray_buffer_config> %<buffer>"
- %assign ::fray_buffer_count = %<::fray_buffer_count> + 1
+ %assign ::rpp_fray_buffer_config = "%<::rpp_fray_buffer_config> %<buffer>"
+ %assign ::rpp_fray_buffer_count = %<::rpp_fray_buffer_count> + 1
%endfunction
%% Function: Outputs ===========================================================
},
%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