📄 updated_tpu_nitc.c
字号:
void tpu_nitc_init_parameter_mode(struct TPU3_tag *tpu, UINT8 channel, \
UINT8 priority, UINT8 detect_edge, INT16 max_count, \
UINT8 single_continuous_operation, \
UINT8 parameter_address, UINT8 nolink_link, UINT8 start_link_channel, \
UINT8 link_channel_count, UINT8 nointerrupt_interrupt)
{
/* disable channel so channel can be configured safely */
tpu_disable( tpu, channel);
/* select NITC function for channel */
tpu_func( tpu, channel, TPU_FUNCTION_NITC);
/* Initialize parameter RAM */
/* 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]);
}
/******************************************************************************/
/*****************************************************************************/
/* Motorola reserves the right to make changes without further notice to any */
/* product herein to improve reliability, function, or design. Motorola does */
/* not assume any liability arising out of the application or use of any */
/* product, circuit, or software described herein; neither does it convey */
/* any license under its patent rights nor the rights of others. Motorola */
/* products are not designed, intended, or authorized for use as components */
/* in systems intended for surgical implant into the body, or other */
/* applications intended to support life, or for any other application in */
/* which the failure of the Motorola product could create a situation where */
/* personal injury or death may occur. Should Buyer purchase or use Motorola */
/* products for any such intended or unauthorized application, Buyer shall */
/* indemnify and hold Motorola and its officers, employees, subsidiaries, */
/* affiliates, and distributors harmless against all claims costs, damages, */
/* and expenses, and reasonable attorney fees arising out of, directly or */
/* indirectly, any claim of personal injury or death associated with such */
/* unintended or unauthorized use, even if such claim alleges that Motorola */
/* was negligent regarding the design or manufacture of the part. Motorola */
/* and the Motorola logo* are registered trademarks of Motorola Inc. */
/* Motorola is an Equal Opportunity/Affirmative Action Employer. */
/*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -