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

📄 sercli.c

📁 TDK 6521 SOC 芯片 DEMO程序
💻 C
字号:
/***************************************************************************
 * This code and information is provided "as is" without warranty of any   *
 * kind, either expressed or implied, including but not limited to the     *
 * implied warranties of merchantability and/or fitness for a particular   *
 * purpose.                                                                *
 *                                                                         *
 * Copyright (C) 2005 Teridian SemiConductor, Corporation.                 *
 * All Rights Reserved.                                                    *
 ***************************************************************************/
//**************************************************************************
//  DESCRIPTION: 71M65xx POWER METER - SERIAL DEBUG Routines.
// 
//  AUTHOR:  MTF
//
//  HISTORY: See end of file
//**************************************************************************
// File: SERCLI.C
//               
#include "options.h"

#if SERIAL0_CLI || SERIAL1_CLI
#include "main.h"
#include "sercli.h"
#include "ser0cli.h"
#include "ser1cli.h"

/*** Public variables declared within this module ***/
enum SERIAL_PORT xdata port;
enum eMPU_DIV xdata mpu_speed;

//===========================================================================//
//  Clock Generator Circuit API
//
bool MPU_Clk_Select (enum SERIAL_PORT port, enum eMPU_DIV speed)
{
    bool Ok;

    mpu_speed = speed;

    #if SERIAL0_CLI
    if (SERIAL_0 == port)
        Ok  = MPU_Clk_Select0 (speed);
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
        Ok = MPU_Clk_Select1 (speed);
    #endif
    return (Ok);
}

//  Serial UART API
//
void Serial_Tx (enum SERIAL_PORT port, uint8x_t *buffer, uint16_t len)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       Serial0_Tx (buffer, len);
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       Serial1_Tx (buffer, len);
    #endif
}

#if EXTRAS
#pragma save
#pragma OPTIMIZE (6)
uint16_t Serial_TxLen (enum SERIAL_PORT port)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       return (Serial0_TxLen ());
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       return (Serial1_TxLen ());
    #endif
}
#pragma restore
#endif

#if EXTRAS
uint16_t Serial_CTx (enum SERIAL_PORT port, uint8x_t *buffer, uint16_t txlen)
{                                       // Here we assume (head = tail) => FULL.
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       return (Serial0_CTx (buffer, txlen));
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       return (Serial1_CTx (buffer, txlen));
    #endif
}
#endif

#if EXTRAS
void Serial_Rx (enum SERIAL_PORT port, uint8x_t *buffer, uint16_t len)
{                                       // Here we assume (head = tail) => EMPTY.
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       Serial0_Rx (buffer, len);
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       Serial1_Rx (buffer, len);
    #endif
}
#endif

#if EXTRAS
#pragma save
uint16_t Serial_RxLen (enum SERIAL_PORT port)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       return (Serial0_RxLen ());
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       return (Serial1_RxLen ());
    #endif
}
#pragma restore
#endif

uint16_t Serial_CRx (enum SERIAL_PORT port, uint8x_t *buffer, uint16_t rxlen)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       return (Serial0_CRx (buffer, rxlen));
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       return (Serial1_CRx (buffer, rxlen));
    #endif
    return (0);
}

#if ROM
void Serial_RxFlowOff (enum SERIAL_PORT port)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       Serial0_RxFlowOff ();
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       Serial1_RxFlowOff ();
    #endif
}

void Serial_RxFlowOn  (enum SERIAL_PORT port)
{
    #if SERIAL0_CLI
    if (SERIAL_0 == port)
       Serial0_RxFlowOn ();
    #endif
    #if SERIAL1_CLI
    if (SERIAL_1 == port)
       Serial1_RxFlowOn ();
    #endif
}
#endif

/***************************************************************************
 * $Log: sercli.c,v $
 * Revision 1.20  2006/09/09 01:08:46  gmikef
 * *** empty log message ***
 *
 * Revision 1.19  2006/06/23 20:46:05  tvander
 * Removed wait-for-io; it slowed response in brownout mode, and caused
 * hangs. The cure was definitely worse than the disease: a few clobbered characters after certain commands.
 *
 * Revision 1.18  2006/06/15 19:56:04  tvander
 * Fixed misc. serial errors.
 *
 * Revision 1.17  2006/04/28 22:24:05  tvander
 * Reverse ported defects fixed when these files were ported to the 3.05 code.
 *
 * Revision 1.16  2006/03/06 03:29:33  Michael T. Fischer
 * More 6530 prep.
 *
 * Revision 1.15  2006/02/08 03:43:17  tvander
 * Made "import" the default power measurement mode, rather than net-metering
 *
 * Revision 1.14  2006/01/16 20:11:21  tvander
 * Clean Keil build, all versions
 *
 * Revision 1.13  2006/01/10 03:56:10  gmikef
 * Added PDATA support for CE Outputs.
 *
 * Revision 1.11  2005/11/15 05:13:13  gmikef
 * Added Serial_RxFlowOn/Off publics.
 *
 * Revision 1.10  2005/11/02 03:08:43  gmikef
 * Xon/Xoff flow control working.
 *
 * Revision 1.9  2005/10/06 20:59:04  tvander
 * Moved battery mode logic to a separate file, batmode.c in main.
 * 6510 code doesn't need it.
 * It has nothing to do with the CLI as such.
 *
 * Revision 1.8  2005/09/22 23:44:55  tvander
 * Clean build all models and unit tests, updated copyright to be fore Teridian
 *
 * Revision 1.7  2005/09/12 07:47:28  tvander
 * Power measurement is stable, with no creep.
 * VARh measurement is stable, with no creep.
 * Pulse sources work.
 * Full access to MPU variables.
 * Rolled date.
 * Clock software works.
 *
 * Revision 1.6  2005/09/11 00:33:57  tvander
 * Clean compiles
 *
 * Revision 1.5  2005/09/08 00:31:40  tvander
 * Fixed: Lost data due to overwrite of Ithrshld, xfer busy never runs,
 * unavailable second phase, cosmetic issues with status.  Updated
 * date.
 *
 * Revision 1.4  2005/09/02 01:49:03  gmikef
 * Fixed CLI RTR command.
 *
 * Revision 1.3  2005/09/01 04:21:53  gmikef
 * *** empty log message ***
 *
 * Revision 1.2  2005/08/31 05:53:47  gmikef
 * First version w/ LAPIE interface.
 *
 * Revision 1.1  2005/08/28 02:27:21  gmikef
 * *** empty log message ***
 *
 *

 *  2005 August 20; First Version. gmikef 
 *
 * Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved.    *
 * this program is fully protected by the United States copyright          *
 * laws and is the property of Teridian Semiconductor Corporation.         *
 ***************************************************************************/
#endif

⌨️ 快捷键说明

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