本文介绍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