Permalink
Browse files

[component:templates][component:os][enhancement] Fixes IOC. Tested an…

…d working

with posix and ppc mpc5643l targets.
  • Loading branch information...
KamelHacene committed Aug 8, 2016
1 parent 3d6a88e commit 26476a9a5a8494d2b2dd4ef91853b3954f788b9a
@@ -60,6 +60,14 @@ if OS::NUMBER_OF_CORES > 1 then
end if
# IOC
if ioc_queued_count > 0 then
let APIUSED += APIMAP["ioc_queued"]
end if
if ioc_unqueued_count > 0 then
let APIUSED += APIMAP["ioc_unqueued"]
end if
if OS::SYSTEM_CALL then
!PROJECT %/tpl_dispatch_table.c
%
@@ -104,7 +104,6 @@ end if
if [ioc_reordered length] != 0 then
%
#include "tpl_ioc.h"
#include "ioc_types.h"
%
end if
@@ -1071,8 +1070,7 @@ end foreach
#define OS_START_SEC_CONST_UNSPECIFIED
#include "tpl_memmap.h"
%
%CONSTP2CONST(tpl_ioc_queued_mo, OS_CONST, OS_CONST) tpl_ioc_queued_table[% !ioc_queued_count %] =
CONSTP2CONST(tpl_ioc_queued_mo, OS_CONST, OS_CONST) tpl_ioc_queued_table[% !ioc_queued_count %] =
{
%
foreach ioc in ioc_queued_list do
@@ -1084,10 +1082,15 @@ end foreach
%
};
#define OS_STOP_SEC_CONST_UNSPECIFIED
#include "tpl_memmap.h"
%
end if
if [ioc_unqueued_list length] != 0 then
%CONSTP2CONST(tpl_ioc_unqueued_mo, OS_CONST, OS_CONST) tpl_ioc_unqueued_table[% !ioc_unqueued_count %] =
%#define OS_START_SEC_CONST_UNSPECIFIED
#include "tpl_memmap.h"
CONSTP2CONST(tpl_ioc_unqueued_mo, OS_CONST, OS_CONST) tpl_ioc_unqueued_table[% !ioc_unqueued_count %] =
{
%
foreach ioc in ioc_unqueued_list do
@@ -25,10 +25,6 @@
*/
#include "tpl_ioc_api_config.h"
#include "tpl_app_config.h"
#include "tpl_os_internal_types.h"
#include "tpl_ioc.h"
#define API_START_SEC_CODE
#include "tpl_memmap.h"
@@ -44,10 +40,10 @@ foreach ioc in ioc_reordered do
*/
%
if ioc::SEMANTICS == "QUEUED" then
%FUNC(Std_ReturnType, OS_CODE) IocSend% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%FUNC(StatusType, OS_CODE) IocSend% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
elsif ioc::SEMANTICS == "LAST_IS_BEST" then
%FUNC(Std_ReturnType, OS_CODE) IocWrite% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%FUNC(StatusType, OS_CODE) IocWrite% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
end if
let iteration2 := 0
@@ -66,7 +62,7 @@ foreach ioc in ioc_reordered do
)
{
VAR(tpl_ioc_message, AUTOMATIC) message[% !iteration2 %];
VAR(Std_ReturnType, AUTOMATIC) result;
VAR(StatusType, AUTOMATIC) result;
%
let iteration3 := 0
@@ -84,23 +80,23 @@ foreach ioc in ioc_reordered do
let iteration3 := iteration3 + 1
end foreach
if ioc::SEMANTICS == "QUEUED" then
% result = IOC_Send(% !iteration1 %, message);
% result = IOCSend(% !iteration1 %, message);
%
else
% result = IOC_Write(% !iteration1 %, message);
%
% result = IOCWrite(% !iteration1 %, message);
%
end if
%
%
return result;
}
%
if ioc::SEMANTICS == "QUEUED" then
%FUNC(Std_ReturnType, OS_CODE) IocReceive% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%FUNC(StatusType, OS_CODE) IocReceive% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
elsif ioc::SEMANTICS == "LAST_IS_BEST" then
%FUNC(Std_ReturnType, OS_CODE) IocRead% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%FUNC(StatusType, OS_CODE) IocRead% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
end if
let iteration2 := 0
@@ -115,7 +111,7 @@ foreach ioc in ioc_reordered do
)
{
VAR(tpl_ioc_message, AUTOMATIC) message[% !iteration2 %];
VAR(Std_ReturnType, AUTOMATIC) result;
VAR(StatusType, AUTOMATIC) result;
%
let iteration3 := 0
@@ -127,28 +123,28 @@ foreach ioc in ioc_reordered do
let iteration3 := iteration3 + 1
end foreach
if ioc::SEMANTICS == "QUEUED" then
%
result = IOC_Receive(% !iteration1 %, message);
%
result = IOCReceive(% !iteration1 %, message);
%
else
%
result = IOC_Read(% !iteration1 %, message);
%
%
result = IOCRead(% !iteration1 %, message);
%
end if
%
%
return result;
}%
if ioc::SEMANTICS == "QUEUED" then
%
FUNC(Std_ReturnType, OS_CODE) IocEmptyQueue_% !ioc::NAME %(void)
FUNC(StatusType, OS_CODE) IocEmptyQueue_% !ioc::NAME %(void)
{
VAR(Std_ReturnType, AUTOMATIC) result;
result = IOC_EmptyQueue(% !iteration1 %);
VAR(StatusType, AUTOMATIC) result;
result = IOCEmptyQueue(% !iteration1 %);
return result;
return result;
}
%
end if
@@ -158,6 +154,6 @@ end foreach
%
#define API_STOP_SEC_CODE
#include "tpl_memmap.h"
#include "tpl_memmap.h"
/* End of file tpl_ioc_api_config.c */
@@ -25,10 +25,8 @@
*/
#include "tpl_app_config.h"
#include "tpl_os_internal_types.h"
#include "tpl_ioc.h"
#include "ioc_types.h"
#include "tpl_os.h"
#define API_START_SEC_CODE
#include "tpl_memmap.h"
@@ -43,10 +41,10 @@ foreach ioc in ioc_reordered do
*/
%
if ioc::SEMANTICS == "QUEUED" then
%extern FUNC(Std_ReturnType, OS_CODE) IocSend% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%extern FUNC(StatusType, OS_CODE) IocSend% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
elsif ioc::SEMANTICS == "LAST_IS_BEST" then
%extern FUNC(Std_ReturnType, OS_CODE) IocWrite% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%extern FUNC(StatusType, OS_CODE) IocWrite% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
end if
let iteration1 := 0
@@ -80,10 +78,10 @@ foreach ioc in ioc_reordered do
end if
if ioc::SEMANTICS == "QUEUED" then
%extern FUNC(Std_ReturnType, OS_CODE) IocReceive% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%extern FUNC(StatusType, OS_CODE) IocReceive% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
elsif ioc::SEMANTICS == "LAST_IS_BEST" then
%extern FUNC(Std_ReturnType, OS_CODE) IocRead% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%extern FUNC(StatusType, OS_CODE) IocRead% if [ioc::DATATYPENAME length] > 1 then %Group% end if %_% !ioc::NAME%(
%
end if
let iteration2 := 0
@@ -99,14 +97,15 @@ foreach ioc in ioc_reordered do
%
if ioc::SEMANTICS == "QUEUED" then
%extern FUNC(Std_ReturnType, OS_CODE) IocEmptyQueue_% !ioc::NAME %(void);
%extern FUNC(StatusType, OS_CODE) IocEmptyQueue_% !ioc::NAME %(void);
%
end if
end foreach
%
#define API_STOP_SEC_CODE
#include "tpl_memmap.h"
#include "tpl_memmap.h"
/* End of file tpl_ioc_api_config.h */
@@ -1,4 +1,5 @@
#include "api_STM.oil"
#include "api_ioc.oil"
CPU api {
/*
@@ -1,14 +1,80 @@
CPU api_ioc {
/* ioc services */
APICONFIG ioc {
ID_PREFIX = IOC;
FILE = "tpl_ioc_kernel";
ENTRY IOCSend { API = IOC_Send; KERNEL = tpl_ioc_send_queued_service; };
ENTRY IOCReceive { API = IOC_Receive; KERNEL = tpl_ioc_receive_queued_service; };
ENTRY IOCEmptyQueue { API = IOC_EmptyQueue; KERNEL = tpl_ioc_empty_queue_service; };
ENTRY IOCSend { API = IOC_Write; KERNEL = tpl_ioc_send_unqueued_service; };
ENTRY IOCWrite { API = IOC_Read; KERNEL = tpl_ioc_receive_unqueued_service; };
ENTRY IOCInitUnqueued { API = IOCW_InitUnqueued; KERNEL = tpl_ioc_init_unqueued; };
/*
* IOC QUEUED
*/
APICONFIG ioc_queued {
ID_PREFIX = OS;
HEADER = "tpl_ioc_queued_kernel";
HEADER = "tpl_ioc_queue";
FILE = "tpl_ioc_queued_kernel";
FILE = "tpl_ioc_queue";
DIRECTORY = "ioc";
SYSCALL IOCSend {
KERNEL = tpl_ioc_send_queued_service;
LOCK_KERNEL = TRUE;
RETURN_TYPE = StatusType
: "E_OK: No error (Standard & Extended)\n"
"E_OS_ID: <alarm_id> is invalid (Extended)"; /* TODO */
ARGUMENT ioc_id { KIND = VAR; TYPE = tpl_ioc_id; }
: "The identifier of the ioc" ;
ARGUMENT ioc_data { KIND = P2CONST; TYPE = tpl_ioc_message; }
: "The data of the ioc" ;
};
SYSCALL IOCReceive {
KERNEL = tpl_ioc_receive_queued_service;
LOCK_KERNEL = TRUE;
RETURN_TYPE = StatusType
: "E_OK: No error (Standard & Extended)\n"
"E_OS_ID: <alarm_id> is invalid (Extended)"; /* TODO */
ARGUMENT ioc_id { KIND = VAR; TYPE = tpl_ioc_id; }
: "The identifier of the ioc" ;
ARGUMENT ioc_data { KIND = P2CONST; TYPE = tpl_ioc_message; }
: "The data of the ioc" ;
};
SYSCALL IOCEmptyQueue {
KERNEL = tpl_ioc_empty_queue_service;
LOCK_KERNEL = TRUE;
RETURN_TYPE = StatusType
: "E_OK: No error (Standard & Extended)\n"
"E_OS_ID: <alarm_id> is invalid (Extended)"; /* TODO */
ARGUMENT ioc_id { KIND = VAR; TYPE = tpl_ioc_id; }
: "The identifier of the ioc" ;
};
};
/*
* IOC UNQUEUED
*/
APICONFIG ioc_unqueued {
ID_PREFIX = OS;
HEADER = "tpl_ioc_unqueued_kernel";
FILE = "tpl_ioc_unqueued_kernel";
DIRECTORY = "ioc";
SYSCALL IOCWrite {
KERNEL = tpl_ioc_send_unqueued_service;
LOCK_KERNEL = TRUE;
RETURN_TYPE = StatusType
: "E_OK: No error (Standard & Extended)\n"
"E_OS_ID: <alarm_id> is invalid (Extended)"; /* TODO */
ARGUMENT ioc_id { KIND = VAR; TYPE = tpl_ioc_id; }
: "The identifier of the ioc" ;
ARGUMENT ioc_data { KIND = P2CONST; TYPE = tpl_ioc_message; }
: "The data of the ioc" ;
};
SYSCALL IOCRead {
KERNEL = tpl_ioc_receive_unqueued_service;
LOCK_KERNEL = TRUE;
RETURN_TYPE = StatusType
: "E_OK: No error (Standard & Extended)\n"
"E_OS_ID: <alarm_id> is invalid (Extended)"; /* TODO */
ARGUMENT ioc_id { KIND = VAR; TYPE = tpl_ioc_id; }
: "The identifier of the ioc" ;
ARGUMENT ioc_data { KIND = P2CONST; TYPE = tpl_ioc_message; }
: "The data of the ioc" ;
};
};
};
@@ -1419,23 +1419,25 @@ write to PROJECT."/tpl_app_config.h":
template tpl_app_config_h in code
end write
!PROJECT %/tpl_ioc_api_config.c
!PROJECT %/tpl_app_define.h
%
write to PROJECT."/tpl_ioc_api_config.c":
template tpl_ioc_api_config_c in code
write to PROJECT."/tpl_app_define.h":
template tpl_app_define_h in code
end write
!PROJECT %/tpl_ioc_api_config.h
if [ioc_reordered length] != 0 then
!PROJECT %/tpl_ioc_api_config.c
%
write to PROJECT."/tpl_ioc_api_config.h":
template tpl_ioc_api_config_h in code
end write
write to PROJECT."/tpl_ioc_api_config.c":
template tpl_ioc_api_config_c in code
end write
!PROJECT %/tpl_app_define.h
!PROJECT %/tpl_ioc_api_config.h
%
write to PROJECT."/tpl_app_define.h":
template tpl_app_define_h in code
end write
write to PROJECT."/tpl_ioc_api_config.h":
template tpl_ioc_api_config_h in code
end write
end if
if OS::MEMMAP then
if exists OS::MEMMAP_S::COMPILER then
View
@@ -1,21 +0,0 @@
#
# Trampoline OS
#
# Trampoline is copyright (c) IRCCyN 2005+
# Trampoline est protege par la loi sur la propriete intellectuelle
#
# This software is distributed under the Lesser GNU Public Licence
#
# $Date$
# $Rev$
# $Author$
# $URL$
#
#kernel COM files
SOURCES += tpl_ioc_kernel.c
SOURCES += tpl_ioc_queue.c
ifeq ($(strip $(WITH_SYSTEM_CALL)),false)
SOURCES += tpl_ioc_message_management.c
endif
Oops, something went wrong.

0 comments on commit 26476a9

Please sign in to comment.