source: asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/rpc/tRPCSharedTaskMain.c@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 6.8 KB
Line 
1/*
2 * TECS Generator
3 * Generator for TOPPERS Embedded Component System
4 *
5 * Copyright (C) 2008-2013 by TOPPERS Project
6 *--
7 * 上記著作権者は,以下の(1)(4)の条件を満たす場合に限り,本ソフトウェ
8 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
9 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
10 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
11 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
12 * スコード中に含まれていること.
13 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
14 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
15 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
16 * の無保証規定を掲載すること.
17 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
18 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
19 * と.
20 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
21 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
22 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
23 * 報告すること.
24 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
25 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
26 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
27 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
28 * 免責すること.
29 *
30 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
31 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
32 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
33 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
34 * の責任を負わない.
35 *
36 * $Id$
37 */
38
39/* #[<PREAMBLE>]#
40 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
41 * tecsmerge によるマージに使用されます
42 *
43 * 属性アクセスマクロ #_CAAM_#
44 * channelNo int16_t VAR_channelNo
45 *
46 * 呼び口関数 #_TCPF_#
47 * call port : cUnmarshalAndCallFunction signature: sTaskBody context: task
48 * void cUnmarshalAndCallFunction_main( subscript );
49 * call port : cServerSideTDR signature: sTDR context: task
50 * ER cServerSideTDR_reset( );
51 * ER cServerSideTDR_sendSOP( bool_t b_client );
52 * ER cServerSideTDR_receiveSOP( bool_t b_client );
53 * ER cServerSideTDR_sendEOP( bool_t b_continue );
54 * ER cServerSideTDR_receiveEOP( bool_t b_continue );
55 * ER cServerSideTDR_putInt8( int8_t in );
56 * ER cServerSideTDR_putInt16( int16_t in );
57 * ER cServerSideTDR_putInt32( int32_t in );
58 * ER cServerSideTDR_putInt64( int64_t in );
59 * ER cServerSideTDR_putInt128( int128_t in );
60 * ER cServerSideTDR_getInt8( int8_t* out );
61 * ER cServerSideTDR_getInt16( int16_t* out );
62 * ER cServerSideTDR_getInt32( int32_t* out );
63 * ER cServerSideTDR_getInt64( int64_t* out );
64 * ER cServerSideTDR_getInt128( int128_t* out );
65 * ER cServerSideTDR_putFloat32( float32_t in );
66 * ER cServerSideTDR_putDouble64( double64_t in );
67 * ER cServerSideTDR_getFloat32( float32_t* out );
68 * ER cServerSideTDR_getDouble64( double64_t* out );
69 * ER cServerSideTDR_putChar( char_t in );
70 * ER cServerSideTDR_putShort( short in );
71 * ER cServerSideTDR_putInt( int_t in );
72 * ER cServerSideTDR_putLong( long_t in );
73 * ER cServerSideTDR_getChar( char_t* out );
74 * ER cServerSideTDR_getShort( short* out );
75 * ER cServerSideTDR_getInt( int_t* out );
76 * ER cServerSideTDR_getLong( long_t* out );
77 * ER cServerSideTDR_putIntptr( const intptr_t ptr );
78 * ER cServerSideTDR_getIntptr( intptr_t* ptr );
79 * require port : signature: sSysLog context: task
80 * ER write( uint_t prio, const SYSLOG* p_syslog );
81 * ER_UINT read( SYSLOG* p_syslog );
82 * ER mask( uint_t logmask, uint_t lowmask );
83 * ER refer( T_SYSLOG_RLOG* pk_rlog );
84 *
85 * #[</PREAMBLE>]# */
86
87#include "tRPCSharedTaskMain_tecsgen.h"
88#include "t_syslog.h"
89
90#ifndef E_OK
91#define E_OK 0 /* success */
92#define E_ID (-18) /* illegal ID */
93#endif
94
95/* 受け口関数 #_TEPF_# */
96/* #[<ENTRY_PORT>]# eMain
97 * entry port: eMain
98 * signature: sTaskBody
99 * context: task
100 * #[</ENTRY_PORT>]# */
101
102/* #[<ENTRY_FUNC>]# eMain_main
103 * name: eMain_main
104 * global_name: tRPCSharedTaskMain_eMain_main
105 * oneway: false
106 * #[</ENTRY_FUNC>]# */
107void
108eMain_main(CELLIDX idx)
109{
110 CELLCB *p_cellcb;
111 if (VALID_IDX(idx)) {
112 p_cellcb = GET_CELLCB(idx);
113 }
114 else {
115 /* エラー処理コードをここに記述します */
116 }
117
118 /* ここに処理本体を記述します #_TEFB_# */
119 syslog( LOG_INFO, "Shared RPC server task started." );
120 while(1){
121 int16_t magic;
122 ER er;
123
124 er = cServerSideTDR_getInt16( &magic );
125 if( er != E_OK ){
126 syslog( LOG_INFO, "err: getInt16 for SOP_MAGIC(%X)", er );
127 continue;
128 }
129 if( magic != RPC_CHANNEL_MAN_SOP_MAGIC ){
130 syslog( LOG_INFO, "illegal SOP magic(%X): retrying", (uint16_t)magic );
131 continue;
132 }
133 er = cServerSideTDR_getInt16( &VAR_channelNo );
134 if( er != E_OK ){
135 syslog( LOG_INFO, "err: getInt16 for channelNo(%X)", er );
136 continue;
137 }
138 if( VAR_channelNo < 0 || VAR_channelNo >= N_CP_cUnmarshalAndCallFunction(p_cellcb) ){
139 syslog( LOG_INFO, "illegal channel number(%X): retrying", (uint16_t)VAR_channelNo );
140 continue;
141 }
142 syslog( LOG_INFO, "Shared Channel: servicing channel No. %d", VAR_channelNo );
143
144 cUnmarshalAndCallFunction_main( VAR_channelNo );
145
146 er = cServerSideTDR_getInt16( &magic );
147 if( er != E_OK ){
148 syslog( LOG_INFO, "err: getInt16 for EOP_MAGIC(%X)", er );
149 continue;
150 }
151 if( magic != RPC_CHANNEL_MAN_EOP_MAGIC ){
152 syslog( LOG_INFO, "illegal EOP magic(%X): retrying", (uint16_t)magic );
153 continue;
154 }
155 }
156}
157
158/* #[<POSTAMBLE>]#
159 * これより下に非受け口関数を書きます
160 * #[</POSTAMBLE>]#*/
Note: See TracBrowser for help on using the repository browser.