Commit 73c51455 authored by Filip Demski's avatar Filip Demski
Browse files

SAMV71: Some thread job implementation

parent 9f0f9c17
......@@ -23,13 +23,28 @@
#include <FreeRTOS.h>
#include <queue.h>
#include "@_LOWER:Partition_Name_@_interface.h"
extern QueueHandle_t @_Thread_Name_@_Global_Queue;
@@IF@@ @_RCM_@ = "CYCLIC_OPERATION"
// SAMV71-TODO: impl
// SAMV71-TODO: impl timer stuff
@@END_IF@@
void @_LOWER:Thread_Name_@_job(void* pvParameters)
{
// SAMV71-TODO: impl
@@IF@@ @_RCM_@ = "CYCLIC_OPERATION"
// SAMV71-TODO: impl timer stuff
@@END_IF@@
for(;;)
{
struct Thread@_CAPITALIZE:Thread_Name_@Request request;
BaseType_t result = xQueueReceive(@_Thread_Name_@_Global_Queue,
&request,
portMAX_DELAY);
if(result == pdTRUE)
{
call_@_LOWER:Thread_Name_@((const char*)request.m_data, request.m_length);
}
}
}
......@@ -21,6 +21,16 @@
#ifndef @_Thread_Name_@_INCLUDED
#define @_Thread_Name_@_INCLUDED
#include <stdint.h>
#include "request_size.h"
struct Thread@_CAPITALIZE:Thread_Name_@Request
{
uint32_t m_length;
uint8_t m_data[@_UPPER:Thread_Name_@_REQUEST_SIZE];
};
void @_LOWER:Thread_Name_@_job(void* pvParameters);
#endif // @_Thread_Name_@_INCLUDED
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Language_@ : Implementation language
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@IF@@ @_Required_@ /= ""
// Required interfaces of function @_Name_@:
@_Required_@
@@END_IF@@
@@-- @@IF@@ @_Language_@ /= SIMULINK @@-- Simulink's glue is generated from DMT
// SAMV71-TODO: #include "@_LOWER:Name_@_vm_if.h"
@@-- @@END_IF@@
@_Protected_PIs_@
void @_LOWER:Name_@_check_queue(BaseType_t* has_pending_msg)
{
*has_pending_msg = pdFALSE;
// SAMV71-TODO: impl
}
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node as defined in the Deployment View
@@-- The content of this file is generated from node.tmplt
@@-- If there is no string defined here, no file will be generated per node,
@@-- (that's an option if the intent is to generate only one file per system)
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_interface.c
@@-- Specify the file name for the complete system (including nodes)
@@-- (no template tag)
@@-- Specify the file name for a thread
@@-- @_Thread_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The up to date list of tags available for this template is available here:
@@-- https://taste.tuxfamily.org/wiki/index.php?title=Kazoo_Templates_Documentation#templates.2Fconcurrency_view.2Fsub.2Fnode.tmplt
@@-- If you are using vim, go over the URL and pres gx in to follow the link
@@-- If you have no internet access you can also use (with vim) Ctrl-W-f or gf in vim to open the text doc:
@@-- $HOME/tool-inst/share/kazoo/doc/templates_concurrency_view_sub_node.ascii
@@-- The up to date list of tags available for this template is available here:
@@-- https://taste.tuxfamily.org/wiki/index.php?title=Kazoo_Templates_Documentation#templates.2Fconcurrency_view.2Fsub.2Fpartition.tmplt
@@-- If you are using vim, go over the URL and pres gx in to follow the link
@@-- If you have no internet access you can also use (with vim) Ctrl-W-f or gf in vim to open the text doc:
@@-- $HOME/tool-inst/share/kazoo/doc/templates_concurrency_view_sub_partition.ascii
/* File generated by kazoo for TASTE - do not edit */
#include <string.h>
#include "@_LOWER:Name_@_interface.h"
@_Threads_@
@_Blocks_@
@@-- 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
@@-- @_Partition_Name_@ : Partition name for parent function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callers
@@-- @_Remote_Interface_Names_@ : |_ caller's interface name
@@-- @_Calling_Threads_@ : Calling threads of the containing block
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void call_protected_@_Parent_Function_@_@_Name_@(void)
@@ELSE@@ @@-- contains param(s)
void call_protected_@_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
char *OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
@@END_IF@@
{
// SAMV71-TODO: impl
}
@@-- 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
@@-- @_Language_@ : The implementation language of the function
@@-- @_Partition_Name_@ : Partition name for parent function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
@@-- @_Remote_Languages_@ : |_ callee's function language
@@-- @_Calling_Threads_@ : Calling threads of the containing block
// Required interface @_Name_@ in function @_Parent_Function_@
@@IF@@ @_Param_Names'Length_@ = 0
@@SET@@ No_Param=True
@@END_IF@@
@@INLINE@@ @@-- Include the relevant header file to call synchronous RIs
@@IF@@ @_Kind_@ = PROTECTED_OPERATION or @_Kind_@ = UNPROTECTED_OPERATION
@@TABLE@@
@@IF@@ @_Remote_Languages_@ = Blackbox_C
// SAMV71-TODO: #include "@_LOWER:Remote_Function_Names_@.h"
@@ELSE@@ @@-- Now a vm_if function is wrapping the DMT-generated one
// SAMV71-TODO: #include "@_LOWER:Remote_Function_Names_@_vm_if.h" // Remote language: @_Remote_Languages_@
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
@@END_INLINE@@
@@IF@@ @_No_Param_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@(void)
@@ELSE@@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
char *OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
{
// SAMV71-TODO: impl
}
@@-- The following tags are available in this template:
@@--
@@-- @_Nodes_@ : Code generated for the nodes
@@-- @_Node_Names_@ : Vector Tag of node names
@@-- @_Node_CPU_@ : |_ Corresponding CPU name (eg x86_linux)
@@-- @_Node_CPU_Classifier_@ : |_ CPU Classifier (ocarina...::x86_linux)
@@-- @_Partition_Names_@ : Vector Tag of partition names
@@-- @_Partition_Node_@ : |_ Corresponding node name
@@-- @_Partition_CPU_@ : |_ Corresponding CPU name
@@-- @_Threads_@ : Code generated for the threads
@@-- @_Thread_Names_@ : List of all threads in the complete system
@@-- @_Target_Packages_@ : List of all target package names in the complete system
@@-- And all the system configuration obtained from the command line:
@@-- Interface_View, Deployment_View, Data_View, Binary_Path, Check_Data_View,
@@-- Output_Dir, Skeletons, Glue, Use_POHIC, Timer_Resolution, Debug_Flag,
@@-- No_Stdlib_Flag, Timer_Resolution, Other_Files (list of aadl files)
@@-- The following tags are available in this template:
@@--
@@-- @_Thread_Name_@ : Thread name
@@-- @_Entry_Port_Name_@ : Name of the PI
@@-- @_RCM_@ : One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
@@-- @_Need_Mutex_@ : True if the PI is shared with others in the protected block
@@-- @_Pro_Block_Name_@ : Name of the protected function
@@-- @_Node_Name_@ : Name of the deployment node
@@-- @_Remote_Threads_@ : Vector tag: output remote thread list
@@-- @_RI_Port_Name_@ : |_ Corresponding local RI name
@@-- @_Remote_PIs_@ : |_ Associated PI Name
@@-- @_Remote_PI_Sorts_@ : |_ Optional param type of the remote thread
@@-- @_Remote_PI_Modules_@ : |_ Asn1 module of the optional param type
@@-- Tags related to the PI that is at the origin of the thread creation:
@@-- @_Name_@, @_Kind_@, @_Parent_Function_@ : shoud be useless here
@@-- @_Param_Names_@, _Types_@, _ASN1_Modules, _Encodings_@, _Directions_@ : param vector tag
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : relevant here
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
void call_@_LOWER:Thread_Name_@ (const char* buf, size_t len)
{
// SAMV71-TODO: impl
}
static BaseType_t thread_@_LOWER:Thread_Name_@_check_queue()
{
// SAMV71-TODO: impl
}
@@-- The following boolean tags are available to decide if the file
@@-- shall be generated or not:
@@-- Filename_Is_Present
@@-- Skeletons
@@-- Glue
@@-- Use_POHIC
@@-- Debug
@@-- No_Stdlib
@@IF@@ @_CPU_Platform_@ = PLATFORM_SAMV71_FREERTOS
TRUE
@@END_IF@@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Language_@ : Implementation language
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
#include <stdint.h>
#include <FreeRTOSConfig.h>
#include <projdefs.h>
#include <portmacro.h>
@@IF@@ @_Protected_PIs_@ /= ""
// Protected provided interfaces of function @_Name_@
@_Protected_PIs_@
// End of the protected provided interfaces of function @_Name_@
@@END_IF@@
@@IF@@ @_Required_@ /= ""
// Required interfaces of function @_Name_@
@_Required_@
// End of the required interfaces of function @_Name_@
@@END_IF@@
void @_LOWER:Name_@_check_queue(BaseType_t* has_pending_msg);
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node as defined in the Deployment View
@@-- The content of this file is generated from node.tmplt
@@-- If there is no string defined here, no file will be generated per node,
@@-- (that's an option if the intent is to generate only one file per system)
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_interface.h
@@-- Specify the file name for the complete system (including nodes)
@@-- (no template tag)
Supports Markdown
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