gpioinline.h

来自「56f8300E系列dsp的BOOTloader」· C头文件 代码 · 共 491 行 · 第 1/2 页

H
491
字号
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 3), Value); /* Address + (peripheral_enable_reg offset) */
	asm(not.w   Mask);
	asm(and.w   Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 3));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_SETAS_PERIPHERAL()
*
* Description:    A peripheral masters the gpio pin in PER register. 
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_SETAS_PERIPHERAL( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 3), Value); /* Address + (peripheral_enable_reg offset) */
	asm(or.w    Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 3));
}
    
/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_ASSERT_DISABLE()
*
* Description:    Disables an interrupt assert in IAR register. 
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_ASSERT_DISABLE( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 4), Value); /* Address + (interrupt_assert_reg offset) */
	asm(not.w   Mask);
	asm(and.w   Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 4));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_ASSERT_ENABLE()
*
* Description:    Enables an interrupt assert, 
*                 used only in software testing, in IAR register. 
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_ASSERT_ENABLE( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 4), Value); /* Address + (interrupt_assert_reg offset) */
	asm(or.w    Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 4));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_DISABLE()
*
* Description:    Disables edge detection for any 
*                 incoming interrupt in IENR register. 
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_DISABLE( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 5), Value); /* Address + (interrupt_enable_reg offset) */
	asm(not.w   Mask);
	asm(and.w   Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 5));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_ENABLE()
*
* Description:    Enables edge detection for any 
*                 incoming interrupt in IENR register. 
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_ENABLE( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value,  *Addr;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 5), Value); /* Address + (interrupt_enable_reg offset) */
	asm(or.w    Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 5));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_DETECTION_ACTIVE_HIGH()
*
* Description:    The interrupt seen at the PAD is active high.
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_DETECTION_ACTIVE_HIGH( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 6), Value); /* Address + (interrupt_polarity_reg offset) */
	asm(not.w   Mask);
	asm(and.w   Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 6));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_INTERRUPT_DETECTION_ACTIVE_LOW()
*
* Description:    The interrupt seen at the PAD is active low.
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_INTERRUPT_DETECTION_ACTIVE_LOW( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 6), Value); /* Address + (interrupt_polarity_reg offset) */
	asm(or.w    Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 6));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_CLEAR_INTERRUPT_PEND_REGISTER()
*
* Description:    By writing zeros (???) to this register, the IPR is cleared.
*                 
* Returns:        None
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline void gpioIoctlGPIO_CLEAR_INTERRUPT_PEND_REGISTER( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned short Value;

	asm(move.w  x:(arch_gpio + BSP_PERIPH_BASE + 8), Value); /* Address + (interrupt_edge_sens_reg offset) */
	asm(or.w    Mask, Value);
	asm(move.w  Value, x:(arch_gpio + BSP_PERIPH_BASE + 8));
}

/*****************************************************************************
*
* Module:         gpioIoctlGPIO_READ()
*
* Description:    Reads the value of an input pin.
*                 
* Returns:        Value of an input pin; 0 or 1 value
*                 
* Arguments:      arch_gpio -  arch hardware device offset
*                 Mask - pin bit mask
*
* Range Issues:   None
*
* Test Method:    gpio.mcp
*
*****************************************************************************/
inline unsigned short gpioIoctlGPIO_READ( register volatile arch_sPort * arch_gpio, register unsigned short Mask )
{
	register unsigned int Value;
	asm(move.w  X:(arch_gpio + BSP_PERIPH_BASE + 1), Value);
	return (Value & Mask) ? 1 : 0;
}
                        

#ifdef __cplusplus
}
#endif

#endif /* __GPIOINLINE_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?