AN2364 Freescale Semiconductor / Motorola, AN2364 Datasheet - Page 43

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
/* Set the CPU MSR to enable interrupts. EIE activates MSR[EE], MSR[RI] */
/*******************************************************************************
FUNCTION
PURPOSE
INPUTS NOTES
GENERAL NOTES : master_chan integer input is returned as a UINT16 value
*******************************************************************************/
UINT32 tpu_tsm_sip_int_lvl(int int_level) {
UINT32 sip_level = 0x00000000;
}
43
/* Force the clearance of the CISR register */
asm(" mtspr EIE, r3");
};
if(int_level == 0)
if(int_level == 1)
if(int_level == 2)
if(int_level == 3)
if(int_level == 4)
if(int_level == 5)
if(int_level == 6)
if(int_level == 7)
return sip_level;
/* Set interupt enable to master channel CIER = master channel */
tpu_interrupt_enable( tpu, channel);
/* Set the USIU mask to accept a level 2 interrupt */
USIU.SIMASK.R = sipend_int_level;
tpu_tsm_cisr_clr(tpua, cisr_chan);
/* Convert integer input interrupt level
/* to the 32-bit SIPEND encoding.
: tpu_tsm_sip_int_lvl
: Convert interrupt level integer into USIU.SIPEND UINT32 value
: This function has 1 parameter:
level - The interrupt level (0 to 7) as encoded through the
for the TPU CIER and CISR registers.
{ sip_level = 0x40000000; }
{ sip_level = 0x10000000; }
{ sip_level = 0x04000000; }
{ sip_level = 0x01000000; }
{ sip_level = 0x00400000; }
{ sip_level = 0x00100000; }
{ sip_level = 0x00040000; }
{ sip_level = 0x00010000; }
32-bit SIPEND register.
Freescale Semiconductor, Inc.
Using the Table Stepper Motor TPU Function
For More Information On This Product,
Go to: www.freescale.com
/* NOTE: r3 is a moot register */
*/
*/
MOTOROLA

Related parts for AN2364