Commit d4653207 authored by Julien's avatar Julien
Browse files

* Ability to handle a thread with a port

   connected to multiple inter-partitions ports
   Make then successive calls to queueing_send or sampling_write
parent afe3a296
...@@ -1330,93 +1330,109 @@ package body Ocarina.Backends.POK_C.Activity is ...@@ -1330,93 +1330,109 @@ package body Ocarina.Backends.POK_C.Activity is
(Get_Port_By_Name (F, Current_Device)) (Get_Port_By_Name (F, Current_Device))
then then
if AIN.First_Node (AIN.Destinations (F)) /= Source_Port := First_Node (Destinations (F));
No_Node
then
Map_Virtual_Bus_Calls
(AIN.Item (AIN.First_Node (AIN.Destinations (F))),
CTN.Declarations (Current_File),
WStatements,
Sending,
Virtual_Bus_Data,
Virtual_Bus_Size,
Current_Device);
end if;
Append_Node_To_List while Source_Port /= No_Node loop
(Make_Defining_Identifier
(Map_Port_Var (F, Current_Device)),
Call_Parameters);
if Virtual_Bus_Data = No_Node then Call_Parameters := New_List (CTN.K_Parameter_List);
if Get_Data_Representation
(Corresponding_Instance (F)) = if AIN.First_Node (AIN.Destinations (F)) /=
Data_Array No_Node
then then
Append_Node_To_List Map_Virtual_Bus_Calls
(Make_Defining_Identifier (AIN.Item
(Map_Port_Data (F, Current_Device)), (AIN.First_Node
Call_Parameters); (AIN.Destinations (F))),
else CTN.Declarations (Current_File),
Append_Node_To_List WStatements,
(Make_Variable_Address Sending,
(Make_Defining_Identifier Virtual_Bus_Data,
(Map_Port_Data (F, Current_Device))), Virtual_Bus_Size,
Call_Parameters); Current_Device);
end if; end if;
else
Append_Node_To_List Append_Node_To_List
(Make_Variable_Address (Virtual_Bus_Data), (Make_Defining_Identifier
(Map_Port_Var
(Item (Source_Port), Current_Device)),
Call_Parameters); Call_Parameters);
end if;
if Virtual_Bus_Size /= No_Node then
N := Copy_Node (Virtual_Bus_Size);
else
if Current_Device = No_Node then
N := Get_Inter_Partition_Port_Size (F);
else
N :=
Get_Inter_Partition_Port_Size
(Get_Port_By_Name (F, Current_Device));
if Is_Using_Virtual_Bus if Virtual_Bus_Data = No_Node then
(Get_Port_By_Name (F, Current_Device)) if Get_Data_Representation
(Corresponding_Instance (F)) =
Data_Array
then then
Add_Include (RH (RH_Protocols)); Append_Node_To_List
(Make_Defining_Identifier
(Map_Port_Data (F, Current_Device)),
Call_Parameters);
else
Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier
(Map_Port_Data (F, Current_Device))),
Call_Parameters);
end if; end if;
else
Append_Node_To_List
(Make_Variable_Address (Virtual_Bus_Data),
Call_Parameters);
end if; end if;
end if;
Append_Node_To_List (N, Call_Parameters);
if Use_ARINC653_API then
Add_Return_Variable_In_Parameters (Call_Parameters);
Called_Function := RE (RE_Write_Sampling_Message);
Type_Used := RE (RE_Sampling_Port_Id_Type);
else
Called_Function := RE (RE_Pok_Port_Sampling_Write);
Type_Used := RE (RE_Uint8_T);
end if;
N := if Virtual_Bus_Size /= No_Node then
CTU.POK_Make_Function_Call_With_Assert N := Copy_Node (Virtual_Bus_Size);
(Called_Function, else
Call_Parameters); if Current_Device = No_Node then
N := Get_Inter_Partition_Port_Size (F);
else
N :=
Get_Inter_Partition_Port_Size
(Get_Port_By_Name (F, Current_Device));
if Is_Using_Virtual_Bus
(Get_Port_By_Name (F, Current_Device))
then
Add_Include (RH (RH_Protocols));
end if;
end if;
end if;
Append_Node_To_List Append_Node_To_List (N, Call_Parameters);
(Make_Extern_Entity_Declaration
(Make_Variable_Declaration
(Defining_Identifier =>
(Make_Defining_Identifier
(Map_Port_Var (F, Current_Device))),
Used_Type => Type_Used)),
CTN.Declarations (Current_File));
Append_Node_To_List (N, WStatements); if Use_ARINC653_API then
Add_Return_Variable_In_Parameters
(Call_Parameters);
Called_Function :=
RE (RE_Write_Sampling_Message);
Type_Used := RE (RE_Sampling_Port_Id_Type);
else
Called_Function :=
RE (RE_Pok_Port_Sampling_Write);
Type_Used := RE (RE_Uint8_T);
end if;
POK_Add_Return_Assertion (WStatements); N :=
CTU.POK_Make_Function_Call_With_Assert
(Called_Function,
Call_Parameters);
Append_Node_To_List
(Make_Extern_Entity_Declaration
(Make_Variable_Declaration
(Defining_Identifier =>
(Make_Defining_Identifier
(Map_Port_Var
(Item (Source_Port),
Current_Device))),
Used_Type => Type_Used)),
CTN.Declarations (Current_File));
Append_Node_To_List (N, WStatements);
POK_Add_Return_Assertion (WStatements);
Source_Port := Next_Node (Source_Port);
end loop;
elsif Get_Connection_Pattern (F) = Intra_Process then elsif Get_Connection_Pattern (F) = Intra_Process then
Append_Node_To_List Append_Node_To_List
(Make_Defining_Identifier (Map_Port_Var (F)), (Make_Defining_Identifier (Map_Port_Var (F)),
...@@ -1490,69 +1506,81 @@ package body Ocarina.Backends.POK_C.Activity is ...@@ -1490,69 +1506,81 @@ package body Ocarina.Backends.POK_C.Activity is
Current_Device); Current_Device);
end if; end if;
Append_Node_To_List Source_Port := AIN.First_Node (AIN.Destinations (F));
(Make_Defining_Identifier (Map_Port_Var (F)),
Call_Parameters); while (Source_Port /= No_Node) loop
Call_Parameters := New_List (CTN.K_Parameter_List);
if Get_Data_Representation
(Corresponding_Instance (F)) =
Data_Array
then
Append_Node_To_List
(Make_Defining_Identifier (Map_Port_Data (F)),
Call_Parameters);
else
Append_Node_To_List Append_Node_To_List
(Make_Variable_Address (Make_Defining_Identifier
(Make_Defining_Identifier (Map_Port_Data (F))), (Map_Port_Var (Item (Source_Port))),
Call_Parameters); Call_Parameters);
end if;
N := CTU.Get_Data_Size (Corresponding_Instance (F)); if Get_Data_Representation
Append_Node_To_List (N, Call_Parameters); (Corresponding_Instance (F)) =
Data_Array
if Get_Timeout_Value (F) /= Null_Time then then
if Use_ARINC653_API then Append_Node_To_List
N := (Make_Defining_Identifier (Map_Port_Data (F)),
Map_Time_To_Millisecond Call_Parameters);
(Get_Timeout_Value (F));
else else
N := Map_Time (Get_Timeout_Value (F)); Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier
(Map_Port_Data (F))),
Call_Parameters);
end if; end if;
else
N := CTU.Make_Literal (CV.New_Int_Value (0, 1, 10));
end if;
Append_Node_To_List (N, Call_Parameters);
if Use_ARINC653_API then N := CTU.Get_Data_Size (Corresponding_Instance (F));
Add_Return_Variable_In_Parameters (Call_Parameters); Append_Node_To_List (N, Call_Parameters);
Called_Function := RE (RE_Send_Queuing_Message); if Get_Timeout_Value (F) /= Null_Time then
Type_Used := RE (RE_Queuing_Port_Id_Type); if Use_ARINC653_API then
else N :=
Called_Function := RE (RE_Pok_Port_Queueing_Send); Map_Time_To_Millisecond
Type_Used := RE (RE_Uint8_T); (Get_Timeout_Value (F));
end if; else
N := Map_Time (Get_Timeout_Value (F));
end if;
else
N := CTU.Make_Literal
(CV.New_Int_Value (0, 1, 10));
end if;
N := Append_Node_To_List (N, Call_Parameters);
POK_Make_Function_Call_With_Assert
(Called_Function,
Call_Parameters);
Append_Node_To_List if Use_ARINC653_API then
(Make_Extern_Entity_Declaration Add_Return_Variable_In_Parameters
(Make_Variable_Declaration (Call_Parameters);
(Defining_Identifier =>
(Make_Defining_Identifier
(Map_Port_Var (F))),
Used_Type => Type_Used)),
CTN.Declarations (Current_File));
Append_Node_To_List (N, WStatements); Called_Function := RE (RE_Send_Queuing_Message);
Type_Used := RE (RE_Queuing_Port_Id_Type);
else
Called_Function := RE
(RE_Pok_Port_Queueing_Send);
Type_Used := RE (RE_Uint8_T);
end if;
POK_Add_Return_Assertion (WStatements); N :=
POK_Make_Function_Call_With_Assert
(Called_Function,
Call_Parameters);
Append_Node_To_List
(Make_Extern_Entity_Declaration
(Make_Variable_Declaration
(Defining_Identifier =>
(Make_Defining_Identifier
(Map_Port_Var
(Item (Source_Port)))),
Used_Type => Type_Used)),
CTN.Declarations (Current_File));
Append_Node_To_List (N, WStatements);
POK_Add_Return_Assertion (WStatements);
Source_Port := Next_Node (Source_Port);
end loop;
elsif Get_Connection_Pattern (F) = Intra_Process elsif Get_Connection_Pattern (F) = Intra_Process
and then not Is_Virtual and then not Is_Virtual
(Get_Port_By_Name (F, Current_Device)) (Get_Port_By_Name (F, Current_Device))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment