AUTOSAR学习之RTE - 可运行实体Runnable

本文深入探讨了AUTOSAR组件中的Runnable实体,包括其作为代码段的单一入口点和关联数据。Runnable实体在C或C++中通过全局函数实现,详细解析了签名、入口点原型,强调了实例句柄和角色参数的重要性。
摘要由CSDN通过智能技术生成

本文介绍RTE的运行体(runnable)。

An AUTOSAR component defines one or more "runnable entities". A runnable entity is a piece of code with a single entry point and an associate set of data. A softwarecomponent description provides definitions for each runnable entity within the softwarecomponent.

For components implemented using C or C++ the entry point of a runnable entity is implemented by a function with global scope defined within a software-component's source code. The following sections consider the function signature and prototype.

组件内部可以定义一组运行体。每个运行体内部有一个入口和与之关联的数据。

例如:

 

构件运行体为:

 

/* Model step function */

void Runnable_Component1 ( void )

{
    /* local block i/o variables */
    real_T rtb_BufferInput_InsertedFor_Dat;
    {
        uint8_T rtb_BufferInput_InsertedFor_Eve;                         
        /* SignalConversion: '<Root>/BufferInput_InsertedFor_DataIN_at_outport_0' incorporates:         
        * Inport: '<Root>/DataIN'        
        */        
        rtb_BufferInput_InsertedFor_Dat = Rte_IRead_Runnable_Component1_DataINPort_Data();
        /* SignalConversion: '<Root>/BufferInput_InsertedFor_Event_at_outport_0' incorporates:
      * Inport: '<Root>/Event'
        */
        Rte_Read_EventPort_Event ( &rtb_BufferInput_InsertedFor_Eve );
        /* Outputs for enable SubSystem: '<Root>/Runable1' incorporates:
        * EnablePort: '<S1>/Enable'
        */
        if ( rtb_BufferInput_InsertedFor_Eve > 0 )
            {
                /* S-Function (sfun_autosar_clientop): '<S1>/BSW_ADD' incorporates:
                 * Constant: '<Root>/1'
                 */
                Rte_Call_AddPort_Add ( rtb_BufferInput_InsertedFor_Dat, Component1_P._Value, &Component1_B.BSW_ADD );                           
            }       
        /* end of Outputs for SubSystem: '<Root>/Runable1' */
        /* SignalConversion: '<Root>/BufferOutput_InsertedFor_DataOUT_at_inport_0' */
        Rte_Write_DataOutPort_Data ( Component1_B.BSW_ADD );
    }
}

使用一个xml描述这个运行体(可以看作是定义阶段所扫描生成的),结构如下:

<RU
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值