tpu_tsm.h

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

H
150
字号
/**************************************************************************/
/* FILE NAME: tpu_tsm.h                       COPYRIGHT (c) MOTOROLA 2002 */
/* VERSION:  0.1                                  All Rights Reserved     */
/*                                                                        */
//* DESCRIPTION:                                                          */
/* This file defines all of the registers and bit fields on the TPU3      */
/* Table Stepper Motor (TSM) function.                                    */
/*========================================================================*/
/* AUTHOR: Glenn Jackson                                                  */
/* COMPILER: Diab Data        VERSION: 4.3g                               */
/*                                                                        */
/* HISTORY                                                                */
/* REV      AUTHOR      DATE       DESCRIPTION OF CHANGE                  */
/* ---   -----------  ---------    ---------------------                  */
/* 0.1   G. Jackson   30/Jul/02    Initial version of file for            */
/*                                   Spanish Oak.                         */
/**************************************************************************/

#include "m_tpu3.h"

#ifdef  __cplusplus
extern "C" {
#endif

/*************************************************************/
/*            Definition of terms and initial settings       */
/*************************************************************/

/* Define the maximum parameter table size */
/*#define TABLE_X 3       Table x value        */
/*#define TABLE_Y 8       Table y value        */

/* Define HSQ values */
#define TPU_TSM_LOCAL_ACC_TBL 0x0
#define TPU_TSM_SPLIT_ACC_TBL 0x1
#define TPU_TSM_ROTATE_ONCE 0x0
#define TPU_TSM_ROTATE_TWICE 0x2

/* Define HSR values */
#define TPU_TSM_NO_HOST 0x0
#define TPU_TSM_INIT_LO 0x1
#define TPU_TSM_INIT_HI 0x2
#define TPU_TSM_HSR_MOV 0x3

/* Define pin state */
#define TPU_TSM_PIN_HIGH 0x8000
#define TPU_TSM_PIN_LOW  0x0000

/* Define test result values */
#define TPU_TSM_TRUE  1
#define TPU_TSM_FALSE 0

/* Define parameter RAM locations */
#define TPU_TSM_DESIRED_POSITION   0
#define TPU_TSM_CURRENT_POSITION   1
#define TPU_TSM_TABLE              2
#define TPU_TSM_TABLE_SIZE         2
#define TPU_TSM_TABLE_INDEX        2
#define TPU_TSM_SLEW_PERIOD        3
#define TPU_TSM_S                  3
#define TPU_TSM_START_PERIOD       4
#define TPU_TSM_A                  4
#define TPU_TSM_PIN_SEQUENCE       5

/* Define interrupt levels   */
/* Define the USIU.SIPEND level encodings */
/*
#define TSM_INT_LEVEL0 0x40000000
#define TSM_INT_LEVEL1 0x10000000
#define TSM_INT_LEVEL2 0x04000000
#define TSM_INT_LEVEL3 0x01000000
#define TSM_INT_LEVEL4 0x00400000
#define TSM_INT_LEVEL5 0x00100000
#define TSM_INT_LEVEL6 0x00040000
#define TSM_INT_LEVEL7 0x00010000
*/

/* Define TPU.CISR interrupt channel encodings   */
/*
#define TSM_CISR_INT_CHANNEL0  0x0001
#define TSM_CISR_INT_CHANNEL1  0x0002
#define TSM_CISR_INT_CHANNEL2  0x0004
#define TSM_CISR_INT_CHANNEL3  0x0008
#define TSM_CISR_INT_CHANNEL4  0x0010
#define TSM_CISR_INT_CHANNEL5  0x0020
#define TSM_CISR_INT_CHANNEL6  0x0040
#define TSM_CISR_INT_CHANNEL7  0x0080
#define TSM_CISR_INT_CHANNEL8  0x0100
#define TSM_CISR_INT_CHANNEL9  0x0200
#define TSM_CISR_INT_CHANNEL10 0x0400
#define TSM_CISR_INT_CHANNEL11 0x0800
#define TSM_CISR_INT_CHANNEL12 0x1000
#define TSM_CISR_INT_CHANNEL13 0x2000
#define TSM_CISR_INT_CHANNEL14 0x4000
#define TSM_CISR_INT_CHANNEL15 0x8000
*/
/* Prototype of functions */

void tpu_tsm_init(struct TPU3_tag *tpu, UINT8 channel, UINT8 priority, 
                  INT16 start_position, UINT16 table_size_index, 
                  UINT16 slew_period, UINT16 start_period, 
                  UINT16 pin_sequence, UINT8 number_channels, 
                  UINT16 *table, UINT8 table_size);
void tpu_tsm_mov(struct TPU3_tag *tpu, UINT8 channel, UINT16 position);
UINT16 tpu_tsm_rd_dp(struct TPU3_tag *tpu, UINT8 channel);
UINT16 tpu_tsm_rd_cp(struct TPU3_tag *tpu, UINT8 channel);

UINT16 tpu_tsm_mas_chan_cier(int master_chan);

void tpu_tsm_int_lev(struct TPU3_tag *tpu, UINT8 level);
int tpu_tsm_int_chk(struct TPU3_tag *tpu, UINT16 channel);
void tpu_tsm_cisr_clr(struct TPU3_tag *tpu, UINT16 CISR_level);

#ifdef  __cplusplus
}
#endif


/*********************************************************************
 *
 * 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 + -
显示快捷键?