1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
16 * This file only be use with the Os_Cfg.c file and os_config_macros.h
\r
22 #if (OS_SC3 == STD_ON) || (OS_SC4 == STD_ON)
\r
23 #if (OS_STATUS_STANDARD == STD_ON )
\r
24 #error req OS327 not fullfilled
\r
29 // COUNTER, RESOURCE, TSAK, must be at least 1
\r
31 #define OS_VALIDATE(_a,_b) if((_a)!=(_b) ) { \
\r
38 void Os_CfgValidate(void ) {
\r
39 OS_VALIDATE(OS_COUNTER_CNT,ARRAY_SIZE(counter_list));
\r
40 #if (RESOURCE_CNT!=0)
\r
41 OS_VALIDATE(OS_RESOURCE_CNT,ARRAY_SIZE(resource_list));
\r
43 OS_VALIDATE(OS_TASK_CNT ,ARRAY_SIZE(rom_pcb_list));
\r
44 #if (RESOURCE_CNT!=0)
\r
45 OS_VALIDATE(OS_ALARM_CNT,ARRAY_SIZE(alarm_list));
\r
47 #if (OS_SCHTBL_CNT!=0)
\r
48 OS_VALIDATE(OS_SCHTBL_CNT, ARRAY_SIZE(sched_list));
\r
52 os_error_t os_error;
\r
54 //-------------------------------------------------------------------
\r
58 * Accessor functions for os_config.c
\r
63 trusted_func_t oil_trusted_func_list[SERVICE_CNT];
\r
67 /*-----------------------------------------------------------------*/
\r
68 #if ( OS_SC3 == STD_ON) || ( OS_SC4==STD_ON)
\r
69 int Os_CfgGetApplCnt(void) {
\r
70 return APPLICATION_CNT;
\r
73 OsRomApplicationType *Os_CfgGetApplObj( ApplicationType application_id ) {
\r
74 return &rom_app_list[application_id];
\r
78 /*-----------------------------------------------------------------*/
\r
79 int Os_CfgGetTaskCnt(void) {
\r
82 /*-----------------------------------------------------------------*/
\r
84 OsResourceType *Os_CfgGetResource( ResourceType resource ) {
\r
85 return &resource_list[resource];
\r
88 int Os_CfgGetResourceCnt() {
\r
89 return OS_RESOURCE_CNT;
\r
92 /*-----------------------------------------------------------------*/
\r
94 OsCounterType *Os_CfgGetCounter(CounterType count_id) {
\r
95 return &counter_list[count_id];
\r
98 uint32 Os_CfgGetCounterCnt(void ) {
\r
99 return OS_COUNTER_CNT;
\r
100 // return sizeof(counter_list)/sizeof(OsCounterType);
\r
102 /*-----------------------------------------------------------------*/
\r
104 uint32 Os_CfgGetSchedCnt( void ) {
\r
105 return OS_SCHTBL_CNT;
\r
108 OsSchTblType *Os_CfgGetSched( ScheduleTableType sched_id ) {
\r
109 #if (OS_SCHTBL_CNT!=0)
\r
110 if(sched_id < OS_SCHTBL_CNT) {
\r
111 return &sched_list[sched_id];
\r
120 /*-----------------------------------------------------------------*/
\r
122 uint32 Os_CfgGetAlarmCnt(void) {
\r
123 return OS_ALARM_CNT;
\r
126 OsAlarmType *Os_CfgGetAlarmObj( AlarmType alarm_id ) {
\r
127 #if (OS_ALARM_CNT!=0)
\r
128 if( alarm_id < OS_ALARM_CNT) {
\r
129 return &alarm_list[alarm_id];
\r
138 StatusType Os_CfgGetAlarmBase(AlarmType alarm_id, AlarmBaseRefType info) {
\r
140 StatusType rv = E_OK;
\r
142 if( alarm_id >= Os_CfgGetAlarmCnt() ) {
\r
145 #if (OS_ALARM_CNT!=0)
\r
146 *info = alarm_list[alarm_id].counter->alarm_base;
\r
152 /*-----------------------------------------------------------------*/
\r
155 OsMessageType *Os_CfgGetMessage(MessageType message_id) {
\r
156 #if (OS_MESSAGE_CNT!=0)
\r
157 return &message_list[message_id];
\r
163 uint32 Os_CfgGetMessageCnt(void ) {
\r
164 return OS_MESSAGE_CNT;
\r
168 /*-----------------------------------------------------------------*/
\r
170 #if ( OS_SC3 == STD_ON) || ( OS_SC4 == STD_ON)
\r
171 uint32 Os_CfgGetServiceCnt( void ) {
\r
172 return SERVICE_CNT;
\r
177 /*-----------------------------------------------------------------*/
\r
179 void Os_CfgGetInterruptStackInfo( OsStackType *stack ) {
\r
180 stack->top = os_interrupt_stack;
\r
181 stack->size = sizeof(os_interrupt_stack);
\r