⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttystate.c

📁 完整的EVRC压缩解压缩算法源码,附带一个简单的例子程序。
💻 C
📖 第 1 页 / 共 2 页
字号:
/*                                                                   */
/* Permission is granted to 3GPP2 Technical Specifications Group C   */
/* participants to copy any portion of this document for legitimate  */
/* purposes of 3GPP2 Technical Specifications Group C. Copying for   */
/* monetary gain or other non-3GPP2 Technical Specifications Group C */
/* purposes is prohibited.                                           */
/*                                                                   */
/*-------------------------------------------------------------------*/
/*                                                                   */
/* Grant of license Motorola Inc. grants a free, irrevocable license */
/* to 3GPP2 and its organizational partners to incorporate Motorola- */
/* supplied text or other copyrightable material contained in the    */
/* contribution and any modifications thereof in the creation of     */ 
/* 3GPP2 publications, to copyright and sell in organizational       */
/* partners name any organizational partners standards publications  */
/* even though it may include portions of the contribution; and at   */
/* the organizational partners sole discretion to permit others      */
/* to reproduce in whole or in part such contributions or the        */
/* resulting organizational partners standards publication. Motorola */
/* is also willing to grant licenses under such Motorola copyrights  */
/* to third parties on reasonable, non-discriminatory terms and      */
/* conditions, as appropriate.                                       */
/*                                                                   */
/* Notice:                                                           */
/* This document has been prepared by Motorola Inc. to assist the    */
/* 3GPP2 standards committee. This document is offered to the        */
/* committee as a basis for discussion and should not be considered  */
/* as a binding proposal on Motorola Inc.  or any other company.     */
/* Specifically, Motorola Inc. reserves the right to modify, amend,  */
/* or withdraw the statement contained herein. Permission is granted */
/* to 3GPP2 and its organizational partners to copy any portion of   */
/* this document for the legitimate purposes of the 3GPP2.  Copying  */
/* this document for monetary gain or other non-3GPP2 purpose is     */
/* prohibited.  Motorola Inc. may hold one or more patents of        */
/* copyrights that cover information contained in this contribution, */
/* and agrees that a license under those rights will be made         */
/* available on reasonable and non-discriminatory terms and          */
/* conditions, subject to receiving a reciprocal license in return.  */
/* Nothing contained herein shall be construed as conferring by      */
/* implication, estoppel, or otherwise any license or right under    */
/* any patent, whether or not the use of information herein          */
/* necessarily employs an invention of any existing or later issued  */
/* patent, or copyright.                                             */
/*                                                                   */
/* Notice                                                            */
/* Permission is granted to 3GPP2 participants to copy any portion of*/
/* this contribution for the legitimate purpose of the 3GPP2.        */
/* Copying this contribution for monetary gain or other non-3GPP2    */
/* purpose is prohibited.                                            */
/*                                                                   */
/*-------------------------------------------------------------------*/

/*********************************************************************
*   get_tty_state()
*
**********************************************************************/
#include <stdio.h>
#include "typedef.h"
#include "tty.h"
#include "basic_op.h"


#define ONSET_BITS          2

void get_tty_state(
    Word16   *ttyState,              /* (i/o): TTY State                   */
    Word16   first_tty_char_flag,    /* (i): first char detected flag      */
    Word16   tty_bit_hist[],         /* (i): TTY bit history buffer        */
    Word16   tty_bit_len_hist[]      /* (i): TTY bit length history buffer */
)
{
    Word16   j;
    Word16   index;
    Word16   temp;



                                                                
    if( sub(tty_bit_len_hist[TTY_BIT_HIST_LEN-1],MIN_BIT_LEN) > 0 )
    {
        index = TTY_BIT_HIST_LEN-1;                             
    }
    else
    {
        index = STOP_BIT_IDX;                                   
    }

                                                                
    if( sub(tty_bit_hist[index],LOGIC_1) == 0
        && sub(tty_bit_hist[index-1],LOGIC_0) == 0 )
    {
        *ttyState = TTY_ONSET;                              
    }

    temp = index;                                           
    for( j=temp ; j >= START_BIT_IDX  ; j-- )
    {
                                                            
        if( sub(tty_bit_hist[j],LOGIC_0) == 0 )
        {
            temp = j;
        }
        else
        {
                                                            
            if( sub(tty_bit_hist[j],LOGIC_1) != 0 )
            {
                break;
            }
        }
    }

    /* Zero the bad dit counter */

    if( sub(temp,MEM_BIT_IDX) == 0 || sub(tty_bit_hist[temp],LOGIC_0) != 0 )
    {
        tty_bit_len_hist[MEM_BIT_IDX] = 0;
    }

    if( sub(tty_bit_hist[temp],LOGIC_0) != 0 )
    {
        for( j=0 ; j < TTY_BIT_HIST_LEN ; j++ )
        {
            tty_bit_hist[j] = UNKNOWN;
        }
    }

                                                            
    if( sub(temp,sub(index,ONSET_BITS-1)) > 0 )
    {
        *ttyState = NON_TTY_MODE;                       


        return;
    }
    else
    {
                                                           
        if( sub(temp,START_BIT_IDX) <= 0  )
        {
            *ttyState = NON_TTY_MODE;                       


            return;
        }
                                                            
        if( sub(first_tty_char_flag,1) == 0 )
        {
            *ttyState = TTY_ONSET;                              
        }
    }

                                                            
    if( sub(tty_bit_hist[TTY_BIT_HIST_LEN-1],UNKNOWN) == 0 )
    {
        *ttyState = NON_TTY_MODE;                           


        return;
    }



    return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -