tpu_qdec.h

来自「mpc564 时钟中断 时钟中断」· C头文件 代码 · 共 86 行

H
86
字号
/**************************************************************************/
/* FILE NAME: tpu_qdec.h                      COPYRIGHT (c) MOTOROLA 2002 */
/* VERSION: 1.0                                   All Rights Reserved     */
/*                                                                        */
/* DESCRIPTION: This file defines the interface to the TPU QDEC functions */
/* and provides useful #defines.                                          */
/*                                                                        */
/*========================================================================*/
/* HISTORY           ORIGINAL AUTHOR: Jeff Loeliger                       */
/* REV      AUTHOR      DATE       DESCRIPTION OF CHANGE                  */
/* ---   -----------  ---------    ---------------------                  */
/* 1.0   J. Loeliger  11/Aug/02    Initial version of function.           */
/**************************************************************************/
#ifndef _TPU_QDEC_H
#define _TPU_QDEC_H

#include "m_common.h"
#include "m_tpu3.h"

/* Define function number                           */
/* This might change with a custom set of functions */
#define TPU_FUNCTION_QDEC 0x6

/* Define HSR values */
#define TPU_QDEC_INIT 0x3
#define TPU_QDEC_READ_TCR1 0x2

/* Define HSQ values */
#define TPU_QDEC_PRIMARY_CHANNEL 0x0
#define TPU_QDEC_SECONDARY_CHANNEL 0x1

/* Define pin state */
#define TPU_QDEC_PIN_HIGH 0x8000
#define TPU_QDEC_PIN_LOW  0x0000

/* Define parameter RAM locations */
#define TPU_QDEC_EDGE_TIME          0
#define TPU_QDEC_POSITION_COUNT     1
#define TPU_QDEC_TCR1_VALUE         2
#define TPU_QDEC_CHAN_PINSTATE      3
#define TPU_QDEC_CORR_PINSTATE_ADDR 4
#define TPU_QDEC_EDGE_TIME_LSB_ADDR 5

/* TPU QDEC function prototypes */
void tpu_qdec_init(struct TPU3_tag *tpu, UINT8 channel, UINT8 priority, \
                INT16 init_position);
void tpu_qdec_init_trans_count(struct TPU3_tag *tpu, UINT8 channel, \
                UINT8 priority);

INT16 tpu_qdec_position(struct TPU3_tag *tpu, UINT8 channel);

void tpu_qdec_data(struct TPU3_tag *tpu, UINT8 channel, INT16 *tcr1, \
                INT16 *edge, INT16 *primary_pin, INT16 *secondary_pin);

#endif /* ifndef _TPU_QDEC_H  */

/*********************************************************************
 *
 * Copyright:
 *	MOTOROLA, INC. All Rights Reserved.  
 *  You are hereby granted a copyright license to use, modify, and
 *  distribute the SOFTWARE so long as this entire notice is
 *  retained without alteration in any modified and/or redistributed
 *  versions, and that such modified versions are clearly identified
 *  as such. No licenses are granted by implication, estoppel or
 *  otherwise under any patents or trademarks of Motorola, Inc. This 
 *  software is provided on an "AS IS" basis and without warranty.
 *
 *  To the maximum extent permitted by applicable law, MOTOROLA 
 *  DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING 
 *  IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
 *  PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE 
 *  SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY 
 *  ACCOMPANYING WRITTEN MATERIALS.
 * 
 *  To the maximum extent permitted by applicable law, IN NO EVENT
 *  SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING 
 *  WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS 
 *  INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY
 *  LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.   
 * 
 *  Motorola assumes no responsibility for the maintenance and support
 *  of this software
 ********************************************************************/

⌨️ 快捷键说明

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