OSDN Git Service

add Cortex-M3 PendSV
[hos/hos-v4a.git] / kernel / source / object / cyc / del_cyc.c
1 /**
2  *  Hyper Operating System V4 Advance
3  *
4  * @file  del_cyc.c
5  * @brief %jp{周期ハンドラの削除}%en{Delete cyclic handler}
6  *
7  * Copyright (C) 1998-2006 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #include "core/core.h"
13 #include "object/cycobj.h"
14
15
16
17 #if _KERNEL_SPT_DEL_CYC
18
19
20 /** %jp{周期ハンドラの削除}%en{Delete cyclic handler}
21  * @param  cycid    %jp{削除対象の周期ハンドラのID番号}%en{ID number of the cyclic handler to be deleted}
22  * @retval E_OK     %jp{正常終了}%en{Normal completion}
23  * @retval E_ID     %jp{不正ID番号(cycidが不正あるいは使用できない)}%en{Invalid ID number(cycid is invalid or unusable)}
24  * @retval E_NOEXS  %jp{オブジェクト未生成(対象周期ハンドラが未登録)}%en{Non-existant object(specified cyclic handler is not registerd)}
25  */
26 ER del_cyc(ID cycid)
27 {
28         _KERNEL_T_CYCCB  *cyccb;
29
30         /* %jp{IDチェック}%en{check ID} */
31 #if _KERNEL_SPT_DEL_CYC_E_ID
32         if ( !_KERNEL_CYC_CHECK_CYCID(cycid) )
33         {
34                 return E_ID;    /* %jp{不正ID番号}%en{Invalid ID number} */
35         }
36 #endif
37
38         _KERNEL_ENTER_SVC();    /* %jp{サービスコールに入る}%en{enter service-call} */
39
40         /* %jp{存在チェック}%en{check object} */
41 #if _KERNEL_SPT_DEL_CYC_E_NOEXS
42         if ( !_KERNEL_CYC_CHECK_EXS(cycid) )
43         {
44                 _KERNEL_LEAVE_SVC();    /* %jp{サービスコールから出る}%en{leave service-call} */
45                 return E_NOEXS;
46         }
47 #endif
48
49         /* %jp{周期ハンドラコントロールブロック取得} */
50         cyccb = _KERNEL_CYC_ID2CYCCB(cycid);
51
52         /* %jp{オブジェクト削除} */
53 #if _KERNEL_CYCCB_ALGORITHM == _KERNEL_CYCCB_ALG_PTRARRAY
54         _KERNEL_SYS_FRE_HEP(cyccb);                                             /* %jp{メモリ開放} */
55         _KERNEL_CYC_ID2CYCCB(cycid) = NULL;
56 #elif _KERNEL_CYCCB_ALGORITHM == _KERNEL_CYCCB_ALG_BLKARRAY
57         _KERNEL_CYC_SET_MAXCYC(cyccb, 0);
58 #endif
59
60         _KERNEL_LEAVE_SVC();            /* %jp{サービスコールから出る}%en{leave service-call} */
61
62         return E_OK;
63 }
64
65
66 #else   /* _KERNEL_SPT_DEL_CYC */
67
68
69 #if _KERNEL_SPT_DEL_CYC_E_NOSPT
70
71 /** %jp{周期ハンドラの削除}%en{Delete cyclic handler}
72  * @param  cycid    %jp{削除対象の周期ハンドラのID番号}%en{ID number of the cyclic handler to be deleted}
73  * @retval E_NOSPT  %jp{未サポート機能}%en{Unsupported function}
74  */
75 ER del_cyc(ID cycid)
76 {
77         return E_NOSPT;
78 }
79
80 #endif
81
82
83 #endif  /* _KERNEL_SPT_DEL_cyc */
84
85
86
87 /* end of file */