亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? probe_com.c

?? 飛思卡爾HCS12的OS移植(ucosII),實現(xiàn)了三個任務(wù),IDE:CODEWARRIOR
?? C
?? 第 1 頁 / 共 5 頁
字號:

/*
*********************************************************************************************************
*                                            ProbeCom_TxStr()
*
* Description : Append a string in the string buffer.
*
* Argument(s) : pstr        Pointer to the string to send.
*
*               dly         Delay time (in milliseconds).  If this value is zero, then
*                           the function will return after queueing in the buffer the portion that fits
*                           immediately.  Otherwise, the function will delay for a certain number of
*                           milliseconds until the entire string has been queued in the buffer.
*
* Return(s)   : DEF_TRUE   if the entire string was queued in the buffer.
*               DEF_FALSE  if the entire string could not be queued in the buffer.
*
* Caller(s)   : Application.
*
* Note(s)     : (1) The string buffer is implemented as a circular buffer.  This function is one of two
*                   points of access for this buffer, the other being in the task or ISR which forms the
*                   tx packets.  Only this function should modify the global current write index
*                   (ProbeCom_StrBufWrIx); only the task or ISR which forms the packets should modify the
*                   global current read index (ProbeCom_StrBufRdIx).
*
*               (2) The global current write index (ProbeCom_StrBufWrIx) is the index of the next location
*                   in the buffer to write.  The global current read index (ProbeCom_StrBufRdIx) is the
*                   index of the next location in the buffer to read.
*
*               (3) The string buffer, an array of PROBE_COM_STR_BUF_SIZE bytes, can only hold
*                   (PROBE_COM_STR_BUF_SIZE - 1) bytes so that the condition
*
*                                        ProbeCom_StrBufWrIx == ProbeCom_StrBufRdIx
*
*                   will be true if and only if the buffer is empty.  Consequently, this function
*                   always leaves an empty space in the buffer.
*
*               (4) If called from an ISR, dly MUST be 0.
*********************************************************************************************************
*/

#if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
CPU_BOOLEAN  ProbeCom_TxStr (CPU_CHAR    *pstr,
                             CPU_INT16U   dly)
{
    CPU_BOOLEAN  ret;
    CPU_INT32U   len;
    CPU_INT16U   wr_ix;
    CPU_INT16U   rd_ix;
    CPU_INT16U   wr_ix_n;

    CPU_INT16U   nbytes_free;
    CPU_INT16U   nbytes_wr;


    if (dly == 0) {
        ret = ProbeCom_OS_Pend(DEF_FALSE);
    } else {
        ret = ProbeCom_OS_Pend(DEF_TRUE);
    }

    if (ret == DEF_FALSE) {
        return (DEF_FALSE);
    }

    len = (CPU_INT32U)Str_Len(pstr);                            /* Determine length of the string (without NULL byte).  */

    while (DEF_TRUE) {
        if (len == 0) {                                         /* If entire str has been placed in buf ...             */
            ProbeCom_OS_Post();
            return (DEF_TRUE);                                  /* ... rtn TRUE to indicate success.                    */
        }

        rd_ix = ProbeCom_StrBufRdIx;
        wr_ix = ProbeCom_StrBufWrIx;

        if (rd_ix > wr_ix) {                                    /* If rd_ix > wr_ix, store str at                       */
            nbytes_free = rd_ix - wr_ix - 1;                    /*           buf interval [wr_ix, rd_ix - 1).           */
        } else {
            if (rd_ix == 0) {                                   /* If rd_ix <= wr_ix && rd_ix == 0, store str at        */
                                                                /*           buf interval [wr_ix, end_ix - 1).          */
                nbytes_free = PROBE_COM_STR_BUF_SIZE - wr_ix - 1;
            } else {                                            /* If rd_ix <= wr_ix && rd_ix != 0, store str at        */
                nbytes_free = PROBE_COM_STR_BUF_SIZE - wr_ix;   /*           buf interval [wr_ix, end_ix).              */
            }
        }

        if (nbytes_free == 0) {                                 /* If the buf is full ...                               */
            if (dly == 0) {                                     /* (a) Rtn if dly = 0.                                  */
                ProbeCom_OS_Post();
                return (DEF_FALSE);
            } else {                                            /* (b) Call OS fnct to dly and continue.                */
                ProbeCom_OS_Dly(dly);
            }
        } else {
            if (nbytes_free > len) {                            /* If str is shorter than free space.                   */
                nbytes_wr = len;
            } else {
                nbytes_wr = nbytes_free;
            }

            wr_ix_n = wr_ix + nbytes_wr;                        /* Assign wr ix after wr.                               */

            if (wr_ix_n == PROBE_COM_STR_BUF_SIZE) {            /* Wrap buf ix around.                                  */
                wr_ix_n = 0;
            }

            Mem_Copy((void     *)&ProbeCom_StrBuf[wr_ix],       /* Copy str to buf.                                     */
                     (void     *) pstr,
                     (CPU_SIZE_T) nbytes_wr);

            ProbeCom_StrBufWrIx  = wr_ix_n;                     /* Assign new global wr ix.                             */
            pstr               += nbytes_wr;                    /* Inc str ptr.                                         */
            len                -= nbytes_wr;                    /* Dec str len.                                         */
        }
    }
}
#endif


/*
*********************************************************************************************************
*                                         ProbeCom_TxTelemetry()
*
* Description : Queue telemetry data in the telemetry buffer.
*
* Argument(s) : id          ID which identifies the type of the data.  (See Notes #1.)
*
*               pdata       Pointer to buffer which holds the telemetry data.
*
*               nbr_octets  Number of data octets held in 'pdata'.
*
*               timestamp   Timestamp identifying generation time of data.
*
* Return(s)   : DEF_TRUE   if the telemetry data was          queued in the buffer.
*               DEF_FALSE  if the telemetry data could not be queued in the buffer.
*
* Caller(s)   : Application.
*
* Note(s)     : (1) This target code will NOT enforce any format on the ID.  In an attempt to
*                   anticipate expansion of this feature & prevent user-generated incompatibilities, the
*                   following format for the 4-byte ID is suggested :
*
*                   (a) Bytes 0-1 (lower 16-bits) should hold a unique global ID for this type of data.
*                       For example, an identifier might be allocated for OS task data or for a sensor
*                       reading.
*
*                       (1) IDs above 38400 should be treated as RESERVED.  These IDs may, in the
*                           future, be specified for special monitoring capabilities.
*
*                       (2) IDs below 38400 should be treated as available for user information.
*
*                   (b) Bytes 2-3 (upper 16-bits) should either be 0 (0x0000) or hold a local ID for
*                       objects of the global ID type.  For example, if the global ID matches the ID
*                       for OS task data, then the local ID may specified the task number, priority or
*                       ID (employed by the OS).
*
*               (2) CPU_CRITICAL_ENTER() & CPU_CRITICAL_EXIT() REQUIRED to prevent pool access from multiple
*                   tasks/contexts.  The task/context which adds telemetry data to the queue is one of
*                   these; the task/ISR which actually transmits that data is another.  If the latter is
*                   a task (NOT an ISR), then these COULD be replaced by a semaphore lock.
*
*               (3) New buffers are unlinked from the FRONT of the free pool before being filled with
*                   telemetry data.  Full buffers are linked to the BACK of the ready pool after being
*                   filled with telemetry data.  Buffers may be linked to the front of the ready pool
*                   upon partial transmission of a large buffer; see 'ProbeCom_CmdTelemetryGet()' Note #4.
*********************************************************************************************************
*/

#if (PROBE_COM_SUPPORT_TELEMETRY == DEF_TRUE)
CPU_BOOLEAN  ProbeCom_TxTelemetry (CPU_INT32U   id,
                                   void        *pdata,
                                   CPU_INT16U   nbr_octets,
                                   CPU_INT32U   timestamp)
{
    PROBE_COM_TELEMETRY_BUF  *pbuf;
#if (CPU_CFG_CRITICAL_METHOD == CPU_CRITICAL_METHOD_STATUS_LOCAL)
    CPU_SR                    cpu_sr;
#endif


    CPU_CRITICAL_ENTER();
    pbuf = ProbeCom_TelemetryFreePoolPtr;
    if (pbuf == (PROBE_COM_TELEMETRY_BUF *)0) {
        CPU_CRITICAL_EXIT();
        return (DEF_FALSE);
    }
    ProbeCom_TelemetryFreePoolPtr = (PROBE_COM_TELEMETRY_BUF *)pbuf->NextBufPtr;
    ProbeCom_TelemetryBufNbrFree--;
    CPU_CRITICAL_EXIT();

    pbuf->ID        = id;
    pbuf->Timestamp = timestamp;
    pbuf->BufLen    = nbr_octets;
    pbuf->BufIx     = 0;

    Mem_Copy((void     *)pbuf->Buf,
             (void     *)pdata,
             (CPU_SIZE_T)nbr_octets);

    CPU_CRITICAL_ENTER();
    if (ProbeCom_TelemetryRdyPoolPtr == (PROBE_COM_TELEMETRY_BUF *)0) {
        pbuf->PrevBufPtr               = (void *)0;
        pbuf->NextBufPtr               = (void *)0;
        ProbeCom_TelemetryRdyPoolPtr = pbuf;
    } else {
        pbuf->PrevBufPtr                         = (void *)ProbeCom_TelemetryRdyPoolPtr;
        pbuf->NextBufPtr                         = (void *)0;
        ProbeCom_TelemetryRdyPoolPtr->NextBufPtr = pbuf;
    }
    ProbeCom_TelemetryBufNbrRdy++;
    CPU_CRITICAL_EXIT();

    return (DEF_TRUE);
}
#endif


/*
*********************************************************************************************************
*********************************************************************************************************
**                                  STATIC STRING-HANDLING FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                            ProbeCom_StrRdy()
*
* Description : Check if a string is ready for transmission.
*
* Argument(s) : none.
*
* Return(s)   : DEF_TRUE   if a  string is in the buffer for transmission.
*               DEF_FALSE  if no string is in the buffer for transmission.
*
* Caller(s)   : ProbeCom_PktModifier().
*
* Note(s)     : (1) See Notes for 'ProbeCom_TxStr()'.
*********************************************************************************************************
*/

#if (PROBE_COM_SUPPORT_STR == DEF_TRUE)
static  CPU_BOOLEAN  ProbeCom_StrRdy (void)
{
    CPU_BOOLEAN  rdy;
    CPU_INT16U   wr_ix;
    CPU_INT16U   rd_ix;


    wr_ix = ProbeCom_StrBufWrIx;
    rd_ix = ProbeCom_StrBufRdIx;

    if (wr_ix == rd_ix) {
        rdy = DEF_FALSE;
    } else {
        rdy = DEF_TRUE;
    }

    return (rdy);
}
#endif


/*
*********************************************************************************************************
*                                         ProbeCom_TelemetryRdy()
*
* Description : Check if telemetry data is ready for transmission.
*
* Argument(s) : none.
*
* Return(s)   : DEF_TRUE   if    telemetry data is queued for transmission.
*               DEF_FALSE  if no telemetry data is queued buffer for transmission.
*
* Caller(s)   : ProbeCom_PktModifier().
*
* Note(s)     : (1) See Notes for 'ProbeCom_TxTelemetry()'.
*********************************************************************************************************
*/

#if (PROBE_COM_SUPPORT_TELEMETRY == DEF_TRUE)
static  CPU_BOOLEAN  ProbeCom_TelemetryRdy (void)
{
    CPU_BOOLEAN  rdy;


    if (ProbeCom_TelemetryRdyPoolPtr != (PROBE_COM_TELEMETRY_BUF *)0) {
        rdy = DEF_FALSE;
    } else {
        rdy = DEF_TRUE;
    }

    return (rdy);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品伦理在线| 久久久不卡网国产精品二区| 亚洲风情在线资源站| 在线观看视频91| 亚洲国产一区二区三区青草影视 | 亚洲黄色免费网站| 日本韩国欧美国产| 丝袜美腿一区二区三区| 欧美成人乱码一区二区三区| 国产精品一品二品| 亚洲六月丁香色婷婷综合久久 | 中文字幕va一区二区三区| 91在线看国产| 日韩成人dvd| 久久久久成人黄色影片| 色综合激情久久| 青青青伊人色综合久久| 国产欧美一区二区精品性| 91香蕉视频mp4| 日本成人在线一区| 国产精品少妇自拍| 欧美精品久久久久久久多人混战| 精品亚洲成a人| 亚洲免费av网站| 日韩欧美中文字幕公布| 不卡一二三区首页| 免费看日韩精品| 中文字幕av一区二区三区高| 欧美精品亚洲二区| 成人av在线一区二区三区| 香蕉久久夜色精品国产使用方法| 久久青草欧美一区二区三区| 欧美在线free| 国产一区二区影院| 亚洲gay无套男同| 国产精品网站在线观看| 欧美一区二区成人| 91精品福利在线| 国产在线视频一区二区三区| 亚洲综合色丁香婷婷六月图片| 久久亚洲免费视频| 欧美精品 日韩| 色狠狠色噜噜噜综合网| 国产一区二区不卡| 日本aⅴ亚洲精品中文乱码| 中文字幕一区在线观看视频| 精品久久99ma| 欧美高清性hdvideosex| 在线观看亚洲一区| 99视频一区二区| 国产成人精品一区二区三区网站观看| 午夜免费久久看| 亚洲欧美另类图片小说| 久久精品一区二区三区不卡| 欧美一个色资源| 欧美男生操女生| 91美女视频网站| av爱爱亚洲一区| 国产高清不卡二三区| 麻豆一区二区在线| 蜜桃av一区二区三区电影| 亚洲小说春色综合另类电影| 中文字幕亚洲欧美在线不卡| 国产亚洲自拍一区| 欧美精品一区在线观看| 日韩精品一区二区三区在线播放| 欧美日韩1234| 欧美一区欧美二区| 欧美精品免费视频| 欧美精品久久99| 日韩欧美精品在线| 欧美精品色综合| 337p亚洲精品色噜噜| 欧美日韩激情一区二区| 欧美熟乱第一页| 欧美精品一二三区| 日韩一区二区三区精品视频| 91精品视频网| 欧美变态tickle挠乳网站| 日韩欧美高清dvd碟片| 欧美不卡一区二区三区| 精品国产91乱码一区二区三区| 精品国精品国产尤物美女| 久久久91精品国产一区二区精品| 久久久电影一区二区三区| 欧美国产1区2区| 亚洲欧洲国产日韩| 亚洲午夜在线观看视频在线| 一区二区三区电影在线播| 偷偷要91色婷婷| 老司机精品视频线观看86| 国产一区二区免费在线| 成人高清视频在线| 在线免费亚洲电影| 777亚洲妇女| 久久久另类综合| 亚洲日本一区二区三区| 亚洲成人av免费| 激情综合网av| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 蜜桃免费网站一区二区三区| 久久99久久久久久久久久久| 国产精品一二三区在线| 91麻豆精品视频| 91精品国产品国语在线不卡| 精品国产凹凸成av人网站| 国产精品久久久久影院色老大| 亚洲综合成人在线| 美女高潮久久久| 99在线精品观看| 欧美一区二区在线看| 亚洲国产成人午夜在线一区| 亚洲午夜激情网页| 国产一区二区三区免费在线观看| 成人av在线资源网| 日韩欧美高清在线| 亚洲美女免费视频| 极品尤物av久久免费看| 97se亚洲国产综合自在线观| 欧美一区欧美二区| 亚洲激情自拍偷拍| 国产乱子伦一区二区三区国色天香| 99国产欧美另类久久久精品| 日韩美女视频一区二区在线观看| 国产精品不卡视频| 国产一区二区三区久久悠悠色av| 在线观看一区二区精品视频| 久久久一区二区三区| 亚洲成人午夜影院| 不卡一区中文字幕| 久久久久久久网| 蜜臀精品一区二区三区在线观看| 99这里只有精品| 久久免费精品国产久精品久久久久| 亚洲一区免费视频| 99麻豆久久久国产精品免费优播| 欧美成人综合网站| 亚洲第一会所有码转帖| 99热这里都是精品| 国产亚洲精品7777| 久久se这里有精品| 5月丁香婷婷综合| 一区二区三区高清在线| av成人免费在线观看| 久久久久国产免费免费 | 亚洲色图都市小说| 国产精一品亚洲二区在线视频| 欧美久久久一区| 性欧美疯狂xxxxbbbb| 在线观看91精品国产入口| 一区免费观看视频| 成人aa视频在线观看| 日本一区二区三区电影| 国产麻豆视频一区| 久久日韩精品一区二区五区| 极品瑜伽女神91| 亚洲精品一区二区三区影院 | 欧美日韩国产美| 一区二区国产视频| 欧美无人高清视频在线观看| 亚洲欧美偷拍三级| 色欲综合视频天天天| 亚洲精品免费电影| 日本韩国一区二区三区视频| 亚洲免费在线视频一区 二区| 99国产精品久久| 亚洲欧美电影一区二区| 一本色道久久综合狠狠躁的推荐 | 日韩欧美亚洲另类制服综合在线| av在线免费不卡| 91丨porny丨国产| 国产在线精品免费av| 本田岬高潮一区二区三区| 97久久超碰国产精品| 日韩高清欧美激情| 久久免费美女视频| 久久影院电视剧免费观看| 亚洲欧洲日韩在线| 欧美人与性动xxxx| 免费人成在线不卡| 精品国产免费久久| 国产一区二区三区免费观看| 国产欧美日韩精品a在线观看| 成人午夜看片网址| 夜夜揉揉日日人人青青一国产精品| 在线观看av不卡| 免费在线看成人av| 久久久久久久久久久久久女国产乱| 成人午夜视频在线| 亚洲一区二区在线免费看| 欧美一卡二卡三卡| 国产成人精品亚洲777人妖| 亚洲视频在线一区观看| 5月丁香婷婷综合| 国产风韵犹存在线视精品| 一区二区三区四区在线播放| 欧美精选午夜久久久乱码6080| 国产一区二区三区国产| 亚洲美女区一区| 亚洲精品在线一区二区|