Commit 9f0f9c17 authored by Filip Demski's avatar Filip Demski
Browse files

SAMV71: A bit of the thread tasks implementation

parent f8152211
......@@ -11,7 +11,7 @@
#include "dataview-uniq.h"
// struct used to calculate buffer size for drivers
struct GenericLinuxAllParametersStub
struct GenericFreeRtosAllParametersStub
{
union
{
......@@ -46,7 +46,7 @@ struct GenericLinuxAllParametersStub
};
// GENERIC_PARTITION_BUFFER_SIZE should be even number
#define GENERIC_PARTITION_BUFFER_SIZE (((sizeof(struct GenericLinuxAllParametersStub) + 1) / 2) * 2)
#define GENERIC_PARTITION_BUFFER_SIZE (((sizeof(struct GenericFreeRtosAllParametersStub) + 1) / 2) * 2)
@_Threads_@
@@TABLE@@
......
@@-- 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)
@@-- 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
@@-- 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
@_LOWER:Partition_Name_@/thread_@_LOWER:Thread_Name_@.c
@@-- 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
@@-- 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
@@-- 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
@@-- 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_@
#include "thread_@_LOWER:Thread_Name_@.h"
#include <FreeRTOS.h>
#include <queue.h>
extern QueueHandle_t @_Thread_Name_@_Global_Queue;
@@IF@@ @_RCM_@ = "CYCLIC_OPERATION"
// SAMV71-TODO: impl
@@END_IF@@
void @_LOWER:Thread_Name_@_job(void* pvParameters)
{
// 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@@
......@@ -21,6 +21,6 @@
#ifndef @_Thread_Name_@_INCLUDED
#define @_Thread_Name_@_INCLUDED
void prv_@_Thread_Name_@_Task(void* pvParameters);
void @_LOWER:Thread_Name_@_job(void* pvParameters);
#endif // @_Thread_Name_@_INCLUDED
......@@ -188,4 +188,4 @@ void adainit(void)
// there is no adainit generated for library, rather a libraryNameinit()
// but the current vm_if.c code calls adainit by default...
}
@@END_IF@@
\ No newline at end of file
@@END_IF@@
......@@ -57,6 +57,7 @@
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_TICKLESS_IDLE 0
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define configSUPPORT_STATIC_ALLOCATION 1
/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS 0
......
......@@ -7,15 +7,15 @@
#include <assert.h>
#include <stdlib.h>
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include <Broker/Broker.h>
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
#include <Init/Init.h>
#include <Uart/Uart.h>
#include "request_size.h"
@@TABLE@@
#include "thread_@_LOWER:Thread_Names_@.h"
@@END_TABLE@@
......@@ -24,6 +24,12 @@ void vApplicationMallocFailedHook();
void vApplicationStackOverflowHook(TaskHandle_t pxTask, char* pcTaskName);
void vApplicationIdleHook();
void vApplicationTickHook();
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskPCBBuffer,
StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize);
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskPCBBuffer,
StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize);
@@TABLE@@
extern void init_@_LOWER:Bound_Functions_@(void);
......@@ -37,7 +43,15 @@ int main(void)
{
Init_setup_hardware();
// SAMV71-TODO: Transport_initialize();
Broker_initialize();
// SAMV71-TODO: Broker_initialize();
@@TABLE@@
init_@_LOWER:Bound_Functions_@();
@@END_TABLE@@
@@TABLE@@
Initialize_Thread_@_LOWER:Thread_Names_@();
@@END_TABLE@@
vTaskStartScheduler();
......@@ -70,3 +84,27 @@ void vApplicationIdleHook()
void vApplicationTickHook()
{
}
StaticTask_t xIdleTaskTCB = {0};
StackType_t xIdleTaskStack[configMINIMAL_STACK_SIZE] = {0};
void vApplicationGetIdleTaskMemory(StaticTask_t** ppxIdleTaskPCBBuffer,
StackType_t** ppxIdleTaskStackBuffer,
uint32_t* pulIdleTaskStackSize)
{
*ppxIdleTaskPCBBuffer = &xIdleTaskTCB;
*ppxIdleTaskStackBuffer = xIdleTaskStack;
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
}
StaticTask_t xTimerTaskTCB = {0};
StackType_t xTimerTaskStack[configMINIMAL_STACK_SIZE] = {0};
void vApplicationGetTimerTaskMemory(StaticTask_t** ppxTimerTaskPCBBuffer,
StackType_t** ppxTimerTaskStackBuffer,
uint32_t* pulTimerTaskStackSize)
{
*ppxTimerTaskPCBBuffer = &xTimerTaskTCB;
*ppxTimerTaskStackBuffer = xTimerTaskStack;
*pulTimerTaskStackSize = configMINIMAL_STACK_SIZE;
}
......@@ -18,21 +18,21 @@
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
/* __attribute__ ((persistent)) */ QueueHandle_t @_Thread_Name_@_Global_Queue = NULL;
/* __attribute__ ((persistent)) */ static StaticQueue_t prv_@_LOWER:Thread_Name_@_Static_Queue = {0};
/* __attribute__ ((persistent)) */ static uint8_t prv_@_LOWER:Thread_Name_@_Queue_Buffer[@_Queue_Size_@ * sizeof(uint8_t)] = {0};
QueueHandle_t @_Thread_Name_@_Global_Queue = NULL;
static StaticQueue_t prv_@_LOWER:Thread_Name_@_Static_Queue = {0};
static uint8_t prv_@_LOWER:Thread_Name_@_Queue_Buffer[@_Queue_Size_@ * @_UPPER:Thread_Name_@_REQUEST_SIZE] = {0};
/* __attribute__ ((persistent)) */ static StaticTask_t prv_@_LOWER:Thread_Name_@_TCB = {0};
/* __attribute__ ((persistent)) */ static StackType_t prv_@_LOWER:Thread_Name_@_Stack[@_Stack_Size_In_Bytes_@ / sizeof(StackType_t)] = {0};
static StaticTask_t prv_@_LOWER:Thread_Name_@_TCB = {0};
static StackType_t prv_@_LOWER:Thread_Name_@_Stack[@_Stack_Size_In_Bytes_@ / sizeof(StackType_t)] = {0};
static void Initialize_Thread_@_LOWER:Thread_Name_@(void)
{
@_Thread_Name_@_Global_Queue = xQueueCreateStatic(@_Queue_Size_@,
sizeof(uint8_t), // SAMV71-TODO: Request?
@_UPPER:Thread_Name_@_REQUEST_SIZE,
prv_@_LOWER:Thread_Name_@_Queue_Buffer,
&prv_@_LOWER:Thread_Name_@_Static_Queue);
xTaskCreateStatic(prv_@_Thread_Name_@_Task,
xTaskCreateStatic(@_LOWER:Thread_Name_@_job,
"@_Thread_Name_@",
@_Stack_Size_In_Bytes_@ / sizeof(StackType_t),
NULL,
......
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