Commit 4231eded authored by Maxime Perrotin's avatar Maxime Perrotin

Add skeleton templates for blackbox devices

parent ae75a800
......@@ -410,6 +410,7 @@ package body TASTE.Backend.Code_Generators is
Param_Names : Vector_Tag;
Param_Types : Vector_Tag;
Param_Directions : Vector_Tag;
Param_Encodings : Vector_Tag;
begin
Result.Header := +Assoc ("Name", TI.Name)
& Assoc ("Kind", TI.RCM'Img)
......@@ -419,10 +420,12 @@ package body TASTE.Backend.Code_Generators is
Param_Names := Param_Names & Each.Name;
Param_Types := Param_Types & Each.Sort;
Param_Directions := Param_Directions & Each.Direction'Img;
Param_Encodings := Param_Encodings & Each.Encoding'Img;
end loop;
Result.Header := Result.Header
& Assoc ("Param_Names", Param_Names)
& Assoc ("Param_Types", Param_Types)
& Assoc ("Param_Encodings", Param_Encodings)
& Assoc ("Param_Directions", Param_Directions);
return Result;
end Interface_Template;
......
......@@ -12,7 +12,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
void *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
......
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@_LOWER:Name_@.c
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : List of Context Parameter names
@@-- @_CP_Types_@ : List of Context Parameter types
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
@@INCLUDE@@ ../c-body/function.tmplt
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_EXIST:Param_Names_@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
char *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@INLINE( /*\n * )(\n * )(\n */\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_@_LOWER:Param_Names_@ type: @_Param_Types_@ ; encoding: @_Param_Encodings_@
@@ELSE@@
OUT_@_LOWER:Param_Names_@ type: @_Param_Types_@ ; encoding: @_Param_Encodings_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@()
@@END_IF@@
{
// Write your code here
}
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "Blackbox_C" and not @_Filename_Is_Present_@
TRUE
@@END_IF@@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@_LOWER:Name_@.h
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : List of Context Parameter names
@@-- @_CP_Types_@ : List of Context Parameter types
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
@@INCLUDE@@ ../c-header/function.tmplt
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_Direction_@ = "PI"
extern void @_LOWER:Parent_Function_@_@_LOWER:Name_@(
@@ELSE@@
extern void @_LOWER:Parent_Function_@_RI_@_LOWER:Name_@(
@@END_IF@@
@@INLINE(, )@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_Param_Names_@, size_t IN_@_Param_Names_@_len
@@ELSE@@
char *OUT_@_Param_Names_@, size_t *OUT_@_Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
);
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
Makefile
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The function name
@@-- @_ASN1_Files_@ : List of all ASN.1 files
@@-- @_ASN1_Modules_@ : List of all ASN.1 modules
@@-- @_Is_Type_@ : Flag set to True for function type
@@-- @_Instance_Of_@ : Name of function type if instance
all: compile-linux
clean:
rm -rf obj
compile-linux:
mkdir -p obj && cd obj && gcc -c ../src/*.c
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "Blackbox_C"
TRUE
@@END_IF@@
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