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

📄 updated_tpu_nitc.c

📁 mpc564 时钟中断 时钟中断
💻 C
📖 第 1 页 / 共 2 页
字号:
	/* setup channel as input, tcr capture, and edge detect			*/
    	tpu->PARM.R[channel][TPU_NITC_CHANNEL_CONTROL] = \
	((detect_edge << 2) | (0x3));

    	tpu->PARM.R[channel][TPU_NITC_CHANNEL_ATTRIBUTES] = \
	((start_link_channel << 12) | (link_channel_count << 8) \
	| (parameter_address));

   	tpu->PARM.R[channel][TPU_NITC_MAX_COUNT] = max_count;
	
	/* Configure channel for single or continuous operation                 */
    	/* Configure channel for no linking or linking                          */
    	tpu_hsq(tpu, channel, ((nolink_link << 1) | single_continuous_operation));

	/* If nointerrupt_interupt flag is set enable interrupts			*/
	if(nointerrupt_interrupt) {
		tpu_interrupt_enable(tpu, channel);
	}
        
    	/* Initialize channel */
    	tpu_hsr(tpu, channel, TPU_NITC_INIT_PARAMETER);


    	/* Enable channel by assigning a priority. 					*/
    	tpu_enable(tpu, channel, priority);
}




/*******************************************************************************
FUNCTION      : 			tpu_nitc_write_max_count 
PURPOSE       : 			To allow update of parameter max_count

INPUTS NOTES  : This function has 3 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

               

			max_count - This defines the maximum number of transitions to 					be detected.  When max_count transitions have been 					detected either an interrupt may be generated, and 					or a message sent to other channels via a link 						mechanism.

			

RETURNS NOTES : 	none
WARNING       : 	none


*******************************************************************************/
void tpu_nitc_write_max_count(struct TPU3_tag *tpu, UINT8 channel, \
INT16 max_count)

{

	tpu->PARM.R[channel][TPU_NITC_MAX_COUNT] = max_count; 
}



/*******************************************************************************
FUNCTION      : 			tpu_nitc_write_trans_count 
PURPOSE       : 			To allow update of parameter trans_count

INPUTS NOTES  : This function has 3 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

			trans_count - This is the current count of transisitons that have been detected. 


			

RETURNS NOTES : 	none
WARNING       : 	The trans_count parameter should be written to a value less than the max_count parameter.


*******************************************************************************/
void tpu_nitc_write_trans_count(struct TPU3_tag *tpu, UINT8 channel, \
INT16 trans_count)

{
	tpu->PARM.R[channel][TPU_NITC_TRANS_COUNT] = trans_count; 
}




/*******************************************************************************
FUNCTION      : 			tpu_nitc_read_final_trans_time 
PURPOSE       : 			To allow reading of parameter:
					TPU_NITC_FINAL_TRANS_TIME 

INPUTS NOTES  : This function has 2 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

			 

RETURNS NOTES : 	Returns final transition time or the value pointed to by the parameter address corresponding to the last transition.


WARNING       : 	none

*******************************************************************************/

INT16 tpu_nitc_read_final_trans_time(struct TPU3_tag *tpu, UINT8 channel)

    
{
	return (tpu->PARM.R[channel][TPU_NITC_FINAL_TRANS_TIME]);
}

/*******************************************************************************
FUNCTION      : 			tpu_nitc_read_last_trans_time 
PURPOSE       : 			To allow reading of parameter:
					TPU_NITC_LAST_TRANS_TIME 

INPUTS NOTES  : This function has 2 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

			 

RETURNS NOTES : 	Returns last transition time or last value point to by the parameter address corresponding to the last transition.


WARNING       : 	none

*******************************************************************************/

INT16 tpu_nitc_read_last_trans_time(struct TPU3_tag *tpu, UINT8 channel)

    
{
	return (tpu->PARM.R[channel][TPU_NITC_LAST_TRANS_TIME]);
}



/*******************************************************************************
FUNCTION      : 			tpu_nitc_read_max_count 
PURPOSE       : 			To allow reading of parameter:
					TPU_NITC_MAX_COUNT 

INPUTS NOTES  : This function has 2 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

RETURNS NOTES : 	Returns the max_count value 


WARNING       : 	none


*******************************************************************************/
INT16 tpu_nitc_read_max_count(struct TPU3_tag *tpu, UINT8 channel)

    
{
	return (tpu->PARM.R[channel][TPU_NITC_MAX_COUNT]);
}

/*******************************************************************************
FUNCTION      : 			tpu_nitc_read_trans_count 
PURPOSE       : 			To allow reading of parameter:
					TPU_NITC_TRANS_COUNT 

INPUTS NOTES  : This function has 2 parameters:

       		*tpu - 	This is a pointer to the TPU3 module to use. It is 					of type TPU3_tag which is defined in m_tpu3.h

                 	channel - 	This is the channel number of the channel that 						will perform the nitc function.

RETURNS NOTES : 	Returns the trans_count value 


WARNING       : 	none


*******************************************************************************/
INT16 tpu_nitc_read_trans_count(struct TPU3_tag *tpu, UINT8 channel)

    
{
	return (tpu->PARM.R[channel][TPU_NITC_TRANS_COUNT]);
}


/******************************************************************************/







/*********************************************************************
 *
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -