]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/commitdiff
RPP_ prefix added to global variables and can common file
authorMichal Horn <hornmich@fel.cvut.cz>
Fri, 29 Aug 2014 08:30:13 +0000 (10:30 +0200)
committerMichal Horn <hornmich@fel.cvut.cz>
Fri, 29 Aug 2014 08:30:13 +0000 (10:30 +0200)
rpp/blocks/tlc_c/common.tlc
rpp/blocks/tlc_c/rpp_can_common.tlc [moved from rpp/blocks/tlc_c/can_common.tlc with 51% similarity]
rpp/blocks/tlc_c/sfunction_canreceive.tlc
rpp/blocks/tlc_c/sfunction_cansetup.tlc
rpp/blocks/tlc_c/sfunction_cantransmit.tlc
rpp/blocks/tlc_c/sfunction_frayconfig.tlc
rpp/blocks/tlc_c/sfunction_frayreceive.tlc
rpp/blocks/tlc_c/sfunction_fraytransmit.tlc

index 03e0fa3561962c6cc55d2022c67bf944363f0147..e6782928f41f1e82f000194b4e9bb2dfeba1d221 100644 (file)
 
         %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
 
similarity index 51%
rename from rpp/blocks/tlc_c/can_common.tlc
rename to rpp/blocks/tlc_c/rpp_can_common.tlc
index 238293937df66cbd50dcd76a1acc5a8dd94470ce..70df7b3a9d6cc654d691505023ed231ed7523e38 100644 (file)
@@ -8,18 +8,18 @@
 %% 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
 
index 2dc1e65a6e96910628633fd767009482e6fd3e0d..c731745e3d0fa350e7514fb9429d04ff0fa7ebd5 100644 (file)
 %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
index 2117f14f49db80843b5372fd2740bbe4e4f128a7..9f05b3ee880ff751daf708855dca03ee3eb550cd 100644 (file)
        %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
@@ -55,8 +55,8 @@
 %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] = {
                {
@@ -71,7 +71,7 @@
        };
 
        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>           
                {
@@ -89,7 +89,7 @@
        };
 
        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>           
                {
index fc320b2e551fc31ea4836e50948c945ddc49355f..efb30a7282781e09c620853b82f923beabea15de 100644 (file)
@@ -20,7 +20,7 @@
 %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
index 11926bcc10cb478d80b9e71994c2033aeb144464..b31d5cff5dca5975f44689a61cf49ee670fbe681 100644 (file)
        .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 = {
index 9ff1eac6e219eddb7679843ee22b5219329b012b..800768e17c4e062160e007c406abe1d905ccb7e3 100644 (file)
@@ -59,8 +59,8 @@
        .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 ===========================================================
index 55a2e6ff380db20f27bf9ec6d8ea033453ee357c..3ce05084e46cd9e5d20e468c3fb5cbd5e069b063 100644 (file)
   },
   %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