AN2364 Freescale Semiconductor / Motorola, AN2364 Datasheet - Page 42

no-image

AN2364

Manufacturer Part Number
AN2364
Description
Using the Table Stepper Motor TPU Function (TSM) with the MPC500 Family
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
tpu_tsm_ex1.c
void Ext_Isr()
{
}
/*******************************************************************************
FUNCTION
PURPOSE
INPUTS NOTES
GENERAL NOTES : Channel must be a TSM master channel. Level must be in the
*******************************************************************************/
void tpu_tsm_int_config(struct TPU3_tag *tpu, UINT8 channel, UINT8 level) {
42
/* Check that the level of interrupt matches the TPU, TSM .*/
UINT16 mas_chan_cisr;
/* Force the clearance of the CISR register */
/* Force the clearance of the CISR register */
UINT16 cisr_chan;
UINT32 sipend_int_level;
asm (" mtspr EID, r0 ");
cisr_chan = tpu_tsm_mas_chan_cier(channel);
sipend_int_level = tpu_tsm_sip_int_lvl(level);
/* Clear current interrupt requests
tpu_tsm_cisr_clr(tpua, cisr_chan);
/* Configure the TPU Interrupt Configuration Register (TICR)
/*
tpu_tsm_int_lev( tpu, level);
/* Shut down CPU MSR interrupts */
mas_chan_cisr = tpu_tsm_mas_chan_cier(mas_channel);
flag = (tpu_tsm_int_chk(tpua, mas_chan_cisr));
tpu_tsm_cisr_clr(tpua, mas_chan_cisr);
CIRL=2, ILBS=0 for a level 2 interrupt.
: tpu_tsm_int_config
: Interrupt activities when TSM interrupt request occurs.
: This function has 2 parameters:
*tpu - This is a pointer to the TPU3 module to use. It is of
channel - This is the number of the master channel
level - The interrupt level (0 to 7).
range of 0 to 31. The activities listed here are for purposes
of example and to use all of the functions once.
type TPU3_tag which is defined in m_tpu3.h
Freescale Semiconductor, Inc.
Using the Table Stepper Motor TPU Function
For More Information On This Product,
/*
MSR[EE] = 0; MSR[RI] = 1 */
Go to: www.freescale.com
*/
*/
*/
MOTOROLA

Related parts for AN2364