Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialPortMain.c

    r321 r429  
    11/*
    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
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    76 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2015 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    242241
    243242/*
    244  *  シリアルポートへの文字送信
     243 *  SIOポートへの文字送信
    245244 *
    246  *  p_cellcbで指定されるSIOポートに対して,文字cを送信する.文字を送信
    247  *  レジスタにいれた場合にはtrueを返す.そうでない場合には,送信レジス
    248  *  タが空いたことを通知するコールバック関数を許可し,falseを返す.この
    249  *  関数は,CPUロック状態で呼び出される.
     245 *  p_cellcbで指定されるシリアルポートに対応するSIOポートに対して,文
     246 *  字cを送信する.文字を送信レジスタにいれた場合にはtrueを返す.そう
     247 *  でない場合には,送信レジスタが空いたことを通知するコールバック関数
     248 *  を許可し,falseを返す.この関数は,CPUロック状態で呼び出される.
    250249 */
    251250Inline bool_t
     
    268267{
    269268        bool_t  buffer_full;
    270         ER              ercd, rercd;
     269        ER_BOOL ercd;
     270        ER              rercd;
    271271
    272272        /*
     
    359359 *  シリアルポートからの1文字受信
    360360 */
    361 static bool_t
     361static ER_BOOL
    362362serialPort_readChar(CELLCB *p_cellcb, char *p_c)
    363363{
    364364        bool_t  buffer_empty;
    365         ER              ercd;
     365        ER_BOOL ercd;
    366366
    367367        SVC(loc_cpu(), gen_ercd_sys(p_cellcb));
     
    397397 */
    398398ER_UINT
    399 eSerialPort_read(CELLIDX idx, char *buffer, uint_t length)
     399eSerialPort_read(CELLIDX idx, char *buffer, uint_t length, TMO tmout)
    400400{
    401401        CELLCB  *p_cellcb;
     
    423423        while (reacnt < length) {
    424424                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                        }
    427433                }
    428434                SVC(rercd = serialPort_readChar(p_cellcb, &c), rercd);
     
    519525        if (VAR_receiveFlowControl != '\0') {
    520526                /*
    521                  *  START/STOP を送信する.
     527                 *  START/STOPを送信する.
    522528                 */
    523529                (void) cSIOPort_putChar(VAR_receiveFlowControl);
     
    569575                 */
    570576                VAR_sendStopped = false;
    571                 if (VAR_sendCount > 0U) {
     577                while (VAR_sendCount > 0U) {
    572578                        c = VAR_sendBuffer[VAR_sendReadPointer];
    573579                        if (serialPort_sendChar(p_cellcb, c)) {
     
    580586                                VAR_sendCount--;
    581587                        }
     588                        else {
     589                                break;
     590                        }
    582591                }
    583592        }
Note: See TracChangeset for help on using the changeset viewer.