Changeset 429 for EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialPortMain.c
- Timestamp:
- Jul 3, 2020, 7:19:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialPortMain.c
r321 r429 1 1 /* 2 * TOPPERS/ASP Kernel 3 * Toyohashi Open Platform for Embedded Real-Time Systems/ 4 * Advanced Standard Profile Kernel 2 * TOPPERS Software 3 * Toyohashi Open Platform for Embedded Real-Time Systems 5 4 * 6 5 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 6 * Toyohashi Univ. of Technology, JAPAN 8 * Copyright (C) 2006-201 5by Embedded and Real-Time Systems Laboratory7 * Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory 9 8 * Graduate School of Information Science, Nagoya Univ., JAPAN 10 9 * … … 242 241 243 242 /* 244 * シリアルポートへの文字送信243 * SIOポートへの文字送信 245 244 * 246 * p_cellcbで指定される SIOポートに対して,文字cを送信する.文字を送信247 * レジスタにいれた場合にはtrueを返す.そうでない場合には,送信レジス248 * タが空いたことを通知するコールバック関数を許可し,falseを返す.この249 * 関数は,CPUロック状態で呼び出される.245 * p_cellcbで指定されるシリアルポートに対応するSIOポートに対して,文 246 * 字cを送信する.文字を送信レジスタにいれた場合にはtrueを返す.そう 247 * でない場合には,送信レジスタが空いたことを通知するコールバック関数 248 * を許可し,falseを返す.この関数は,CPUロック状態で呼び出される. 250 249 */ 251 250 Inline bool_t … … 268 267 { 269 268 bool_t buffer_full; 270 ER ercd, rercd; 269 ER_BOOL ercd; 270 ER rercd; 271 271 272 272 /* … … 359 359 * シリアルポートからの1文字受信 360 360 */ 361 static bool_t361 static ER_BOOL 362 362 serialPort_readChar(CELLCB *p_cellcb, char *p_c) 363 363 { 364 364 bool_t buffer_empty; 365 ER 365 ER_BOOL ercd; 366 366 367 367 SVC(loc_cpu(), gen_ercd_sys(p_cellcb)); … … 397 397 */ 398 398 ER_UINT 399 eSerialPort_read(CELLIDX idx, char *buffer, uint_t length )399 eSerialPort_read(CELLIDX idx, char *buffer, uint_t length, TMO tmout) 400 400 { 401 401 CELLCB *p_cellcb; … … 423 423 while (reacnt < length) { 424 424 if (buffer_empty) { 425 SVC(rercd = cReceiveSemaphore_wait(), 426 gen_ercd_wait(rercd, p_cellcb)); 425 rercd = cReceiveSemaphore_waitTimeout(tmout); 426 if (rercd == E_TMOUT) 427 return E_TMOUT; 428 if (rercd < 0) { 429 gen_ercd_wait(rercd, p_cellcb); 430 ercd = rercd; 431 goto error_exit; 432 } 427 433 } 428 434 SVC(rercd = serialPort_readChar(p_cellcb, &c), rercd); … … 519 525 if (VAR_receiveFlowControl != '\0') { 520 526 /* 521 * START/STOP 527 * START/STOPを送信する. 522 528 */ 523 529 (void) cSIOPort_putChar(VAR_receiveFlowControl); … … 569 575 */ 570 576 VAR_sendStopped = false; 571 if(VAR_sendCount > 0U) {577 while (VAR_sendCount > 0U) { 572 578 c = VAR_sendBuffer[VAR_sendReadPointer]; 573 579 if (serialPort_sendChar(p_cellcb, c)) { … … 580 586 VAR_sendCount--; 581 587 } 588 else { 589 break; 590 } 582 591 } 583 592 }
Note:
See TracChangeset
for help on using the changeset viewer.