[172] | 1 | /*
|
---|
| 2 | * TOPPERS ATK2
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
| 4 | * Automotive Kernel Version 2
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2012-2015 by Center for Embedded Computing Systems
|
---|
| 7 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 8 | * Copyright (C) 2012-2015 by FUJI SOFT INCORPORATED, JAPAN
|
---|
| 9 | * Copyright (C) 2012-2013 by Spansion LLC, USA
|
---|
| 10 | * Copyright (C) 2012-2015 by NEC Communication Systems, Ltd., JAPAN
|
---|
| 11 | * Copyright (C) 2012-2015 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
|
---|
| 12 | * Copyright (C) 2012-2014 by Renesas Electronics Corporation, JAPAN
|
---|
| 13 | * Copyright (C) 2012-2015 by Sunny Giken Inc., JAPAN
|
---|
| 14 | * Copyright (C) 2012-2015 by TOSHIBA CORPORATION, JAPAN
|
---|
| 15 | * Copyright (C) 2012-2015 by Witz Corporation
|
---|
| 16 | * Copyright (C) 2014-2015 by AISIN COMCRUISE Co., Ltd., JAPAN
|
---|
| 17 | * Copyright (C) 2014-2015 by eSOL Co.,Ltd., JAPAN
|
---|
| 18 | * Copyright (C) 2014-2015 by SCSK Corporation, JAPAN
|
---|
| 19 | * Copyright (C) 2015 by SUZUKI MOTOR CORPORATION
|
---|
| 20 | *
|
---|
| 21 | * ä¸è¨èä½æ¨©è
|
---|
| 22 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 23 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
| 24 | * å¤ã»åé
|
---|
| 25 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 26 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 27 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 28 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 29 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 30 | * ç¨ã§ããå½¢ã§åé
|
---|
| 31 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 32 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 33 | * è
|
---|
| 34 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 35 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 36 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 37 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 38 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 39 | * ã¨ï¼
|
---|
| 40 | * (a) åé
|
---|
| 41 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 42 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 43 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 44 | * (b) åé
|
---|
| 45 | å¸ã®å½¢æ
|
---|
| 46 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 47 | * å ±åãããã¨ï¼
|
---|
| 48 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 49 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 50 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 51 | 責ãããã¨ï¼
|
---|
| 52 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
| 53 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 54 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
| 55 | * å
|
---|
| 56 | 責ãããã¨ï¼
|
---|
| 57 | *
|
---|
| 58 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼AUTOSARï¼AUTomotive Open System ARchitectureï¼ä»
|
---|
| 59 | * æ§ã«åºã¥ãã¦ããï¼ä¸è¨ã®è¨±è«¾ã¯ï¼AUTOSARã®ç¥ç財ç£æ¨©ã許諾ãããã®ã§
|
---|
| 60 | * ã¯ãªãï¼AUTOSARã¯ï¼AUTOSARä»æ§ã«åºã¥ããã½ããã¦ã§ã¢ãåç¨ç®çã§å©
|
---|
| 61 | * ç¨ããè
|
---|
| 62 | ã«å¯¾ãã¦ï¼AUTOSARãã¼ããã¼ã«ãªããã¨ãæ±ãã¦ããï¼
|
---|
| 63 | *
|
---|
| 64 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 65 | ã
|
---|
| 66 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
| 67 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
| 68 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
| 69 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
| 70 | *
|
---|
| 71 | * $Id: ioc_manage.c 453 2015-12-10 08:31:20Z nces-hibino $
|
---|
| 72 | */
|
---|
| 73 |
|
---|
| 74 | /*
|
---|
| 75 | * IOCã¢ã¸ã¥ã¼ã«
|
---|
| 76 | */
|
---|
| 77 | #include "ioc_impl.h"
|
---|
| 78 | #include "check.h"
|
---|
| 79 |
|
---|
| 80 | /*
|
---|
| 81 | * ãã¬ã¼ã¹ãã°ãã¯ãã®ããã©ã«ãå®ç¾©
|
---|
| 82 | */
|
---|
| 83 | #ifndef LOG_IOCSEND_ENTER
|
---|
| 84 | #define LOG_IOCSEND_ENTER(senderid)
|
---|
| 85 | #endif /* LOG_IOCSEND_ENTER */
|
---|
| 86 |
|
---|
| 87 | #ifndef LOG_IOCSEND_LEAVE
|
---|
| 88 | #define LOG_IOCSEND_LEAVE(ercd)
|
---|
| 89 | #endif /* LOG_IOCSEND_LEAVE */
|
---|
| 90 |
|
---|
| 91 | #ifndef LOG_IOCWRITE_ENTER
|
---|
| 92 | #define LOG_IOCWRITE_ENTER(senderid)
|
---|
| 93 | #endif /* LOG_IOCWRITE_ENTER */
|
---|
| 94 |
|
---|
| 95 | #ifndef LOG_IOCWRITE_LEAVE
|
---|
| 96 | #define LOG_IOCWRITE_LEAVE(ercd)
|
---|
| 97 | #endif /* LOG_IOCWRITE_LEAVE */
|
---|
| 98 |
|
---|
| 99 | #ifndef LOG_IOCRECEIVE_ENTER
|
---|
| 100 | #define LOG_IOCRECEIVE_ENTER(iocid)
|
---|
| 101 | #endif /* LOG_IOCRECEIVE_ENTER */
|
---|
| 102 |
|
---|
| 103 | #ifndef LOG_IOCRECEIVE_LEAVE
|
---|
| 104 | #define LOG_IOCRECEIVE_LEAVE(ercd)
|
---|
| 105 | #endif /* LOG_IOCRECEIVE_LEAVE */
|
---|
| 106 |
|
---|
| 107 | #ifndef LOG_IOCREAD_ENTER
|
---|
| 108 | #define LOG_IOCREAD_ENTER(iocid)
|
---|
| 109 | #endif /* LOG_IOCREAD_ENTER */
|
---|
| 110 |
|
---|
| 111 | #ifndef LOG_IOCREAD_LEAVE
|
---|
| 112 | #define LOG_IOCREAD_LEAVE(ercd)
|
---|
| 113 | #endif /* LOG_IOCREAD_LEAVE */
|
---|
| 114 |
|
---|
| 115 | #ifndef LOG_IOCEMPTYQUEUE_ENTER
|
---|
| 116 | #define LOG_IOCEMPTYQUEUE_ENTER(iocid)
|
---|
| 117 | #endif /* LOG_IOCEMPTYQUEUE_ENTER */
|
---|
| 118 |
|
---|
| 119 | #ifndef LOG_IOCEMPTUQUEUE_LEAVE
|
---|
| 120 | #define LOG_IOCEMPTUQUEUE_LEAVE(ercd)
|
---|
| 121 | #endif /* LOG_IOCEMPTUQUEUE_LEAVE */
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | /* å
|
---|
| 125 | é¨é¢æ°ã®ãããã¿ã¤ãå®£è¨ */
|
---|
| 126 | LOCAL_INLINE void ioc_memcpy(void *p_dst, const void *p_src, uint32 sz);
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | * åæåé¢æ°
|
---|
| 131 | */
|
---|
| 132 | void
|
---|
| 133 | ioc_initialize(void)
|
---|
| 134 | {
|
---|
| 135 | IocType i;
|
---|
| 136 | IOCCB *p_ioccb;
|
---|
| 137 | const IOCINIB *p_iocinib;
|
---|
| 138 |
|
---|
| 139 | /* ãã¥ã¼ã®åæå */
|
---|
| 140 | for (i = 0U; i < tnum_queueioc; i++) {
|
---|
| 141 | p_ioccb = &ioccb_table[i];
|
---|
| 142 | p_ioccb->quecnt = 0U;
|
---|
| 143 | p_ioccb->head = 0U;
|
---|
| 144 | p_ioccb->tail = 0U;
|
---|
| 145 | p_ioccb->lostflg = FALSE;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | /* åIOCã®ãããã¡åæå */
|
---|
| 149 | for (i = 0U; i < tnum_ioc; i++) {
|
---|
| 150 | if (ioc_inival_table[i] != NULL) {
|
---|
| 151 | p_iocinib = &iocinib_table[i];
|
---|
| 152 | ioc_memcpy((void *) (p_iocinib->p_iocmb), ioc_inival_table[i], p_iocinib->datasz);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 |
|
---|
| 159 | LOCAL_INLINE void
|
---|
| 160 | ioc_memcpy(void *p_dst, const void *p_src, uint32 sz)
|
---|
| 161 | {
|
---|
| 162 | uint8 *p_tmp_dst = (uint8 *) p_dst;
|
---|
| 163 | const uint8 *p_tmp_src = (const uint8 *) p_src;
|
---|
| 164 | CounterType i;
|
---|
| 165 |
|
---|
| 166 | for (i = 0U; i < sz; i++) {
|
---|
| 167 | p_tmp_dst[i] = p_tmp_src[i];
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 |
|
---|
| 172 | Std_ReturnType
|
---|
| 173 | ioc_send_generic(IocType IocWrapperId, const void *in)
|
---|
| 174 | {
|
---|
| 175 | const IOCWRPINIB *p_iocwrpinib;
|
---|
| 176 | const IOCINIB *p_iocinib;
|
---|
| 177 | IOCCB *p_ioccb;
|
---|
| 178 | Std_ReturnType ercd = IOC_E_OK;
|
---|
| 179 |
|
---|
| 180 | p_iocwrpinib = get_iocwrpinib(IocWrapperId);
|
---|
| 181 | p_iocinib = get_iocinib(IOCID(p_iocwrpinib));
|
---|
| 182 | p_ioccb = get_ioccb(IOCID(p_iocwrpinib));
|
---|
| 183 |
|
---|
| 184 | LOG_IOCSEND_ENTER(p_iocwrpinib->senderid);
|
---|
| 185 |
|
---|
| 186 | CHECK_IOC_CALLEVEL_DISABLEDINT(CALLEVEL_IOCSEND);
|
---|
| 187 | CHECK_IOC_ACCESS(p_iocwrpinib->p_sndosapcb == p_runosap);
|
---|
| 188 | CHECK_IOC_MEM_READ((const MemoryStartAddressType) in, p_iocinib->datasz, p_iocinib->alignsz);
|
---|
| 189 |
|
---|
| 190 | x_nested_lock_os_int();
|
---|
| 191 |
|
---|
| 192 | S_D_CHECK_IOC_LIMIT(p_ioccb->quecnt < p_iocinib->maxque);
|
---|
| 193 | ioc_memcpy((void *) ((uint32) p_iocinib->p_iocmb + ((p_iocinib->datasz) * (p_ioccb->tail))), in, p_iocinib->datasz);
|
---|
| 194 | p_ioccb->quecnt++;
|
---|
| 195 | p_ioccb->tail++;
|
---|
| 196 | if (p_ioccb->tail >= p_iocinib->maxque) {
|
---|
| 197 | p_ioccb->tail = 0U;
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | d_exit_no_errorhook:
|
---|
| 201 | x_nested_unlock_os_int();
|
---|
| 202 | exit_no_errorhook:
|
---|
| 203 | LOG_IOCSEND_LEAVE(ercd);
|
---|
| 204 | return(ercd);
|
---|
| 205 |
|
---|
| 206 | #ifdef CFG_USE_ERRORHOOK
|
---|
| 207 | d_exit_errorhook:
|
---|
| 208 | goto errorhook_start;
|
---|
| 209 |
|
---|
| 210 | exit_errorhook:
|
---|
| 211 | x_nested_lock_os_int();
|
---|
| 212 | errorhook_start:
|
---|
| 213 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
| 214 | _errorhook_par1.iocid = IOCID(p_iocwrpinib);
|
---|
| 215 | _errorhook_par2.senderid = p_iocwrpinib->senderid;
|
---|
| 216 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
| 217 | if (p_iocinib->groupflg != FALSE) {
|
---|
| 218 | call_errorhook(ercd, IOCServiceId_IOC_SendGroup);
|
---|
| 219 | }
|
---|
| 220 | else {
|
---|
| 221 | call_errorhook(ercd, IOCServiceId_IOC_Send);
|
---|
| 222 | }
|
---|
| 223 | x_nested_unlock_os_int();
|
---|
| 224 | goto exit_no_errorhook;
|
---|
| 225 | #endif /* CFG_USE_ERRORHOOK */
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 |
|
---|
| 229 | Std_ReturnType
|
---|
| 230 | ioc_write_generic(IocType IocWrapperId, const void *in)
|
---|
| 231 | {
|
---|
| 232 | const IOCWRPINIB *p_iocwrpinib;
|
---|
| 233 | const IOCINIB *p_iocinib;
|
---|
| 234 | Std_ReturnType ercd = IOC_E_OK;
|
---|
| 235 |
|
---|
| 236 | p_iocwrpinib = get_iocwrpinib(IocWrapperId);
|
---|
| 237 | p_iocinib = get_iocinib(IOCID(p_iocwrpinib));
|
---|
| 238 |
|
---|
| 239 | LOG_IOCWRITE_ENTER(p_iocwrpinib->senderid);
|
---|
| 240 |
|
---|
| 241 | CHECK_IOC_CALLEVEL_DISABLEDINT(CALLEVEL_IOCWRITE);
|
---|
| 242 | CHECK_IOC_ACCESS(p_iocwrpinib->p_sndosapcb == p_runosap);
|
---|
| 243 | CHECK_IOC_MEM_READ((const MemoryStartAddressType) in, p_iocinib->datasz, p_iocinib->alignsz);
|
---|
| 244 |
|
---|
| 245 | x_nested_lock_os_int();
|
---|
| 246 |
|
---|
| 247 | ioc_memcpy((void *) (p_iocinib->p_iocmb), in, p_iocinib->datasz);
|
---|
| 248 |
|
---|
| 249 | d_exit_no_errorhook:
|
---|
| 250 | x_nested_unlock_os_int();
|
---|
| 251 | exit_no_errorhook:
|
---|
| 252 | LOG_IOCWRITE_LEAVE(ercd);
|
---|
| 253 | return(ercd);
|
---|
| 254 |
|
---|
| 255 | #ifdef CFG_USE_ERRORHOOK
|
---|
| 256 | d_exit_errorhook:
|
---|
| 257 | goto errorhook_start;
|
---|
| 258 |
|
---|
| 259 | exit_errorhook:
|
---|
| 260 | x_nested_lock_os_int();
|
---|
| 261 | errorhook_start:
|
---|
| 262 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
| 263 | _errorhook_par1.iocid = IOCID(p_iocwrpinib);
|
---|
| 264 | _errorhook_par2.senderid = p_iocwrpinib->senderid;
|
---|
| 265 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
| 266 | if (p_iocinib->groupflg != FALSE) {
|
---|
| 267 | call_errorhook(ercd, IOCServiceId_IOC_WriteGroup);
|
---|
| 268 | }
|
---|
| 269 | else {
|
---|
| 270 | call_errorhook(ercd, IOCServiceId_IOC_Write);
|
---|
| 271 | }
|
---|
| 272 | x_nested_unlock_os_int();
|
---|
| 273 | goto exit_no_errorhook;
|
---|
| 274 | #endif /* CFG_USE_ERRORHOOK */
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 |
|
---|
| 278 | Std_ReturnType
|
---|
| 279 | ioc_receive_generic(IocType IocId, void *out)
|
---|
| 280 | {
|
---|
| 281 | const IOCINIB *p_iocinib;
|
---|
| 282 | IOCCB *p_ioccb;
|
---|
| 283 | Std_ReturnType ercd = IOC_E_OK;
|
---|
| 284 |
|
---|
| 285 | LOG_IOCRECEIVE_ENTER(IocId);
|
---|
| 286 |
|
---|
| 287 | p_iocinib = get_iocinib(IocId);
|
---|
| 288 | p_ioccb = get_ioccb(IocId);
|
---|
| 289 |
|
---|
| 290 | CHECK_IOC_CALLEVEL_DISABLEDINT(CALLEVEL_IOCRECEIVE);
|
---|
| 291 | CHECK_IOC_ACCESS(p_iocinib->p_rcvosapcb == p_runosap);
|
---|
| 292 | CHECK_IOC_MEM_WRITE(out, p_iocinib->datasz, p_iocinib->alignsz);
|
---|
| 293 |
|
---|
| 294 | x_nested_lock_os_int();
|
---|
| 295 |
|
---|
| 296 | S_D_CHECK_IOC_NO_DATA(p_ioccb->quecnt > 0U);
|
---|
| 297 | ioc_memcpy(out, (void *) ((uint32) p_iocinib->p_iocmb + ((p_iocinib->datasz) * (p_ioccb->head))), p_iocinib->datasz);
|
---|
| 298 |
|
---|
| 299 | p_ioccb->quecnt--;
|
---|
| 300 | p_ioccb->head++;
|
---|
| 301 | if (p_ioccb->head >= p_iocinib->maxque) {
|
---|
| 302 | p_ioccb->head = 0U;
|
---|
| 303 | }
|
---|
| 304 |
|
---|
| 305 | S_D_CHECK_IOC_LOST(p_ioccb->lostflg == FALSE);
|
---|
| 306 |
|
---|
| 307 | d_exit_no_errorhook:
|
---|
| 308 | x_nested_unlock_os_int();
|
---|
| 309 | exit_no_errorhook:
|
---|
| 310 | LOG_IOCRECEIVE_LEAVE(ercd);
|
---|
| 311 | return(ercd);
|
---|
| 312 |
|
---|
| 313 | #ifdef CFG_USE_ERRORHOOK
|
---|
| 314 | d_exit_errorhook:
|
---|
| 315 | goto errorhook_start;
|
---|
| 316 |
|
---|
| 317 | exit_errorhook:
|
---|
| 318 | x_nested_lock_os_int();
|
---|
| 319 | errorhook_start:
|
---|
| 320 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
| 321 | _errorhook_par1.iocid = IocId;
|
---|
| 322 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
| 323 | if (p_iocinib->groupflg != FALSE) {
|
---|
| 324 | call_errorhook(ercd, IOCServiceId_IOC_ReceiveGroup);
|
---|
| 325 | }
|
---|
| 326 | else {
|
---|
| 327 | call_errorhook(ercd, IOCServiceId_IOC_Receive);
|
---|
| 328 | }
|
---|
| 329 | x_nested_unlock_os_int();
|
---|
| 330 | goto exit_no_errorhook;
|
---|
| 331 | #endif /* CFG_USE_ERRORHOOK */
|
---|
| 332 | }
|
---|
| 333 |
|
---|
| 334 |
|
---|
| 335 | Std_ReturnType
|
---|
| 336 | ioc_read_generic(IocType IocId, void *out)
|
---|
| 337 | {
|
---|
| 338 | const IOCINIB *p_iocinib;
|
---|
| 339 | Std_ReturnType ercd = IOC_E_OK;
|
---|
| 340 |
|
---|
| 341 | LOG_IOCREAD_ENTER(IocId);
|
---|
| 342 |
|
---|
| 343 | p_iocinib = get_iocinib(IocId);
|
---|
| 344 |
|
---|
| 345 | CHECK_IOC_CALLEVEL_DISABLEDINT(CALLEVEL_IOCREAD);
|
---|
| 346 | CHECK_IOC_ACCESS(p_iocinib->p_rcvosapcb == p_runosap);
|
---|
| 347 | CHECK_IOC_MEM_WRITE(out, p_iocinib->datasz, p_iocinib->alignsz);
|
---|
| 348 |
|
---|
| 349 | x_nested_lock_os_int();
|
---|
| 350 |
|
---|
| 351 | ioc_memcpy(out, (void *) (p_iocinib->p_iocmb), p_iocinib->datasz);
|
---|
| 352 |
|
---|
| 353 | d_exit_no_errorhook:
|
---|
| 354 | x_nested_unlock_os_int();
|
---|
| 355 | exit_no_errorhook:
|
---|
| 356 | LOG_IOCREAD_LEAVE(ercd);
|
---|
| 357 | return(ercd);
|
---|
| 358 |
|
---|
| 359 | #ifdef CFG_USE_ERRORHOOK
|
---|
| 360 | d_exit_errorhook:
|
---|
| 361 | goto errorhook_start;
|
---|
| 362 |
|
---|
| 363 | exit_errorhook:
|
---|
| 364 | x_nested_lock_os_int();
|
---|
| 365 | errorhook_start:
|
---|
| 366 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
| 367 | _errorhook_par1.iocid = IocId;
|
---|
| 368 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
| 369 | if (p_iocinib->groupflg != FALSE) {
|
---|
| 370 | call_errorhook(ercd, IOCServiceId_IOC_ReadGroup);
|
---|
| 371 | }
|
---|
| 372 | else {
|
---|
| 373 | call_errorhook(ercd, IOCServiceId_IOC_Read);
|
---|
| 374 | }
|
---|
| 375 | x_nested_unlock_os_int();
|
---|
| 376 | goto exit_no_errorhook;
|
---|
| 377 | #endif /* CFG_USE_ERRORHOOK */
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 |
|
---|
| 381 | Std_ReturnType
|
---|
| 382 | ioc_empty_queue_generic(IocType IocId)
|
---|
| 383 | {
|
---|
| 384 | IOCCB *p_ioccb;
|
---|
| 385 | const IOCINIB *p_iocinib;
|
---|
| 386 | Std_ReturnType ercd = IOC_E_OK;
|
---|
| 387 |
|
---|
| 388 | p_ioccb = get_ioccb(IocId);
|
---|
| 389 | p_iocinib = get_iocinib(IocId);
|
---|
| 390 |
|
---|
| 391 | CHECK_IOC_CALLEVEL_DISABLEDINT(CALLEVEL_IOCEMPTYQUEUE);
|
---|
| 392 | CHECK_IOC_ACCESS(p_iocinib->p_rcvosapcb == p_runosap);
|
---|
| 393 |
|
---|
| 394 | x_nested_lock_os_int();
|
---|
| 395 |
|
---|
| 396 | p_ioccb->quecnt = 0U;
|
---|
| 397 | p_ioccb->head = 0U;
|
---|
| 398 | p_ioccb->tail = 0U;
|
---|
| 399 | p_ioccb->lostflg = FALSE;
|
---|
| 400 |
|
---|
| 401 | d_exit_no_errorhook:
|
---|
| 402 | x_nested_unlock_os_int();
|
---|
| 403 | exit_no_errorhook:
|
---|
| 404 | LOG_IOCREAD_LEAVE(ercd);
|
---|
| 405 | return(ercd);
|
---|
| 406 |
|
---|
| 407 | #ifdef CFG_USE_ERRORHOOK
|
---|
| 408 | d_exit_errorhook:
|
---|
| 409 | goto errorhook_start;
|
---|
| 410 |
|
---|
| 411 | exit_errorhook:
|
---|
| 412 | x_nested_lock_os_int();
|
---|
| 413 | errorhook_start:
|
---|
| 414 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
| 415 | _errorhook_par1.iocid = IocId;
|
---|
| 416 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
| 417 | call_errorhook(ercd, IOCServiceId_IOC_EmptyQueue);
|
---|
| 418 | x_nested_unlock_os_int();
|
---|
| 419 | goto exit_no_errorhook;
|
---|
| 420 | #endif /* CFG_USE_ERRORHOOK */
|
---|
| 421 | }
|
---|