Post Page Advertisement [Top]

Below is the list of RTE API functions


  1. Rte_Ports
  2. Rte_NPorts
  3. Rte_Port
  4. Rte_Write
  5. Rte_Send
  6. Rte_Switch
  7. Rte_Invalidate
  8. Rte_Feedback
  9. Rte_SwitchAck
  10. Rte_Read
  11. Rte_DRead
  12. Rte_Receive
  13. Rte_Call
  14. Rte_Result
  15. Rte_Pim
  16. Rte_CData
  17. Rte_Prm
  18. Rte_IRead
  19. Rte_IWrite
  20. Rte_IWriteRef
  21. Rte_IInvalidate
  22. Rte_IStatus
  23. Rte_IrvIRead
  24. Rte_IrvIWrite
  25. Rte_IrvIWriteRef
  26. Rte_IrvRead
  27. Rte_IrvWrite
  28. Rte_Enter
  29. Rte_Exit
  30. Rte_Mode
  31. EnhancedRte_Mode
  32. Rte_Trigger
  33. Rte_IrTrigger
  34. Rte_IFeedback
  35. Rte_IsUpdated
  36. Rte_PBCon
1. Rte_Ports: Provides an array of the ports of a given interface type and a given provide/require usage

Syntax: Rte_Ports_<i>_<R/P>
Where here <i> is the port interface type and ‘P’ or ‘R’ are literals to indicate provide or require ports respectively


Eg: You have a component which has two receive ports with type temperature_sens


typedef struct {
int temperature_value;
int error_factor; 
}temperature_sens;

Port A  ->  position A temperature sensor
Port B ->  position B temperature sensor 

RTE_API: Rte_Ports_temperature_sens_R(self)

A hypothetical example code:

void tempsens_runnable()
{
int posA_temp;
int posA_temp_err;
int PosB_temp;
int posB_temp_err;

ptr = Rte_Ports_temperature_sens_R(self);
posA_temp = *ptr++; // assuming that A is the first port 
posA_temp_err = *ptr++;
posB_temp = *ptr++;
posB_temp_err = *ptr;
}

Note: For any port to be accessed in this way, the particular port(s) property  "indirectAPI" should be set to TRUE(port properties will be covered in a separate article)

2.Rte_NportsProvide the number of ports of a given interface type and provide /
require usage that can be accessed through the indirect API. 

It is similar to the Rte_Ports API discussed above, but it will return only the count of the ports of the particular type and send/receive type. Considering the same example as above
Rte_NPorts_temperature_sens_R(self) will return a value of 2.

3.Rte_portProvide access to the port data structure for a single port of a particular
software component instance

Syntax:Rte_PortHandle_<i>_<R/P>

Eg: Going back to the first example you could have noticed that I used pointer operation and this is not allowed in application SW. This was because that example was only hypothetical and it is incomplete without using the Rte_PortHandle_ API. Combining this API we will have a full implementation on how to access individual ports  (indirectly - I will explain on this later - for now don't focus on it)

void tempsens_runnable()
{
int posA_temp;
int posA_temp_err;
int PosB_temp;
int posB_temp_err;

Rte_PortHandle_temperature_sens  port_ary = Rte_Ports_temperature_sens_R(self);
posA_temp = port_ary[0].temperature_value; // assuming that A is the first port 
posA_temp_err = port_ary[0]..error_factor;
posB_temp = port_ary[1].temperature_value;
posB_temp_err = port_ary[1].temperature_value;
}

4.Rte_Write:  Initiates transmission of data of a send port.

Syntax: Std_ReturnType Rte_Write_<port>_<o>(Rte_Instance <inst>,<data>)
Where <p> is the port name and <o> the VariableDataPrototype(data type of element inside a port) within the sender-receiver interface

Eg:  
Port -> cruisecontrol{
                   velocity
                    brake
                    distance
                      ......
                     }

VariableDataPrototype -> velocity; 

ret_val = Rte_Write_cruisecontrol_velocity (self,80);
if(ret_val == RTE_E_OK)
{
printf("data passed to communication service succesfully");
}

5.Rte_Send: It is similar to Rte_write, the difference is that this API is used to transmit data to a queue type data

ret_val = Rte_Write_infotainment_addsong2queue (self,80);

6.Rte_SwitchInitiate a mode switch. The Rte_Switch API call is used for ‘explicit’
sending of a mode switch notification. Application SW can create and maintain certain modes so that certain features are available and running at only certain conditions thereby reducing runtime , battery consumption, etc.. Using this API application SW-Cs can cause mode switch

Syntax: Std_ReturnType Rte_Switch_<port>_<item>( Rte_Instance <inst>, <data>) 

Eg:

if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
     {
         printf("mode switch passed successfully to communication service");
       }
}

7.Rte_InvalidateInvalidate a data element for an “explicit” sender-receiver transmission.
Changes the value of the specified element of the port to invalid values. The invalid values will be specified in the port configuration

Syntax: Std_ReturnType Rte_Invalidate_<p>_<o>(Rte_Instance <inst>)
Where <p> is the port name and <o> the VariableDataPrototype within the sender-receiver interface categorizing the port.

eg:

while(com_initialization == pending)
{
Rte_Invalidate_canvalues_airpressure(self);
}

8.Rte_Feedback: Provides a mechanism for the Rte explicit sender communication(Rte_write, Rte_Send..) to get feedback that data has reached the intended destination. The Rte_Write, Rte_Send, etc.. will have only return values indicating that the data has been passed on to the communication services, whether it has reached the intended place is not known by return value, rather we have to use thsi function

Syntax:Std_ReturnType  Rte_Write_<p>_<o>(Rte_Instance <instance>)

Eg: Rte_Write_cruisecontrol_velocity(self, 23);
if (Rte_Feedback_pa_cruisecontrol_velocity(self) == RTE_E_TRANSMIT_ACK)
{
/* Transmit okay */
}

9. Rte_SwitchAck: Similar to Rte_Feedback, difference is this function is used to get acknowledgement for Rte_Switch request

Syntax:Std_ReturnType Rte_SwitchAck_<p>_<o>(Rte_Instance <instance>)

Eg:

if(vehicle speed ==0 && engine speed < 900 rpm)
{
ret_val = Rte_Switch_EngStateGoverner_EngineModes( Rte_Instance_EngStateGoverner , Idling ) ;
if (ret_val==RTE_E_OK)
     {
         printf("mode switched successfully ");
       }
}

10Rte_ReadPerforms an “explicit” read on a sender-receiver communication data
element

Syntax: Std_ReturnType Rte_Read_<p>_<o>(Rte_Instance <instance>,OUT <data>)
Where <p> is the port name and <o> the VariableDataPrototype

Eg:

Port -> cruisecontrol{
                   velocity
                    brake
                    distance
                      ......
                     }


ret_val = Rte_Read_cruisecontrol_brake (self,brake);

if(ret_val == RTE_E_OK)
{
printf("data read succesfully");
}

To be continued ....

No comments:

Post a Comment

Bottom Ad [Post Page]