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

📄 lib_at91sam9260_h.html

📁 ATMEL AT91SAM9260的中段控制程序!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font>  <a href="#AT91F_AIC_Trig">AT91F_AIC_Trig</a> (
	<a href="AT91SAM9260_h.html#AT91PS_AIC">AT91PS_AIC</a> pAic,     <font color=#B22222>// \arg pointer to the <a href="AT91SAM9260_AIC.html#AIC">AIC</a> registers</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> irq_id) <font color=#B22222>// \arg interrupt number</font>
{
	pAic-><a href="AT91SAM9260_AIC.html#AIC_ISCR">AIC_ISCR</a> = (0x1 << irq_id) ;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_AIC_IsActive">AT91F_AIC_IsActive</a></b></font>
<font color=#B22222>//* \brief Test <font color=#0000FF>if</font> an IT is active</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font>  <a href="#AT91F_AIC_IsActive">AT91F_AIC_IsActive</a> (
	<a href="AT91SAM9260_h.html#AT91PS_AIC">AT91PS_AIC</a> pAic,     <font color=#B22222>// \arg pointer to the <a href="AT91SAM9260_AIC.html#AIC">AIC</a> registers</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> irq_id) <font color=#B22222>// \arg Interrupt Number</font>
{
	<font color=#0000FF>return</font> (pAic-><a href="AT91SAM9260_AIC.html#AIC_ISR">AIC_ISR</a> & (0x1 << irq_id));
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_AIC_IsPending">AT91F_AIC_IsPending</a></b></font>
<font color=#B22222>//* \brief Test <font color=#0000FF>if</font> an IT is pending</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font>  <a href="#AT91F_AIC_IsPending">AT91F_AIC_IsPending</a> (
	<a href="AT91SAM9260_h.html#AT91PS_AIC">AT91PS_AIC</a> pAic,     <font color=#B22222>// \arg pointer to the <a href="AT91SAM9260_AIC.html#AIC">AIC</a> registers</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> irq_id) <font color=#B22222>// \arg Interrupt Number</font>
{
	<font color=#0000FF>return</font> (pAic-><a href="AT91SAM9260_AIC.html#AIC_IPR">AIC_IPR</a> & (0x1 << irq_id));
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_AIC_Open">AT91F_AIC_Open</a></b></font>
<font color=#B22222>//* \brief Set exception vectors and <a href="AT91SAM9260_AIC.html#AIC">AIC</a> registers to <font color=#0000FF>default</font> values</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_AIC_Open">AT91F_AIC_Open</a>(
	<a href="AT91SAM9260_h.html#AT91PS_AIC">AT91PS_AIC</a> pAic,        <font color=#B22222>// \arg pointer to the <a href="AT91SAM9260_AIC.html#AIC">AIC</a> registers</font>
	<font color=#0000FF>void</font> (*IrqHandler) (),  <font color=#B22222>// \arg Default IRQ vector exception</font>
	<font color=#0000FF>void</font> (*FiqHandler) (),  <font color=#B22222>// \arg Default FIQ vector exception</font>
	<font color=#0000FF>void</font> (*DefaultHandler)  (), <font color=#B22222>// \arg Default Handler set in ISR</font>
	<font color=#0000FF>void</font> (*SpuriousHandler) (), <font color=#B22222>// \arg Default Spurious Handler</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> protectMode)   <font color=#B22222>// \arg Debug Control Register</font>
{
	<font color=#0000FF>int</font> i;

	<font color=#B22222>// Disable all interrupts and set IVR to the <font color=#0000FF>default</font> handler</font>
	<font color=#0000FF>for</font> (i = 0; i < 32; ++i) {
		<a href="#AT91F_AIC_DisableIt">AT91F_AIC_DisableIt</a>(pAic, i);
		<a href="#AT91F_AIC_ConfigureIt">AT91F_AIC_ConfigureIt</a>(pAic, i, <a href="AT91SAM9260_h.html#AT91C_AIC_PRIOR_LOWEST">AT91C_AIC_PRIOR_LOWEST</a>, <a href="AT91SAM9260_h.html#AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE">AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE</a>, DefaultHandler);
	}

	<font color=#B22222>// Set the IRQ exception vector</font>
	<a href="#AT91F_AIC_SetExceptionVector">AT91F_AIC_SetExceptionVector</a>((<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> *) 0x18, IrqHandler);
	<font color=#B22222>// Set the Fast Interrupt exception vector</font>
	<a href="#AT91F_AIC_SetExceptionVector">AT91F_AIC_SetExceptionVector</a>((<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> *) 0x1C, FiqHandler);

	pAic-><a href="AT91SAM9260_AIC.html#AIC_SPU">AIC_SPU</a> = (<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font>) SpuriousHandler;
	pAic-><a href="AT91SAM9260_AIC.html#AIC_DCR">AIC_DCR</a> = protectMode;
}
/* *****************************************************************************
                SOFTWARE API FOR <a href="AT91SAM9260_PIO.html#PIO">PIO</a>
   ***************************************************************************** */
<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgPeriph">AT91F_PIO_CfgPeriph</a></b></font>
<font color=#B22222>//* \brief Enable pins to be drived by peripheral</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgPeriph">AT91F_PIO_CfgPeriph</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> periphAEnable,  <font color=#B22222>// \arg PERIPH A to enable</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> periphBEnable)  <font color=#B22222>// \arg PERIPH B to enable</font>

{
	pPio-><a href="AT91SAM9260_PIO.html#PIO_ASR">PIO_ASR</a> = periphAEnable;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_BSR">PIO_BSR</a> = periphBEnable;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_PDR">PIO_PDR</a> = (periphAEnable | periphBEnable); <font color=#B22222>// Set in Periph mode</font>
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgOutput">AT91F_PIO_CfgOutput</a></b></font>
<font color=#B22222>//* \brief Enable <a href="AT91SAM9260_PIO.html#PIO">PIO</a> in output mode</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgOutput">AT91F_PIO_CfgOutput</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> pioEnable)      <font color=#B22222>// \arg <a href="AT91SAM9260_PIO.html#PIO">PIO</a> to be enabled</font>
{
	pPio-><a href="AT91SAM9260_PIO.html#PIO_PER">PIO_PER</a> = pioEnable; <font color=#B22222>// Set in <a href="AT91SAM9260_PIO.html#PIO">PIO</a> mode</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_OER">PIO_OER</a> = pioEnable; <font color=#B22222>// Configure in Output</font>
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgInput">AT91F_PIO_CfgInput</a></b></font>
<font color=#B22222>//* \brief Enable <a href="AT91SAM9260_PIO.html#PIO">PIO</a> in input mode</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgInput">AT91F_PIO_CfgInput</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> inputEnable)      <font color=#B22222>// \arg <a href="AT91SAM9260_PIO.html#PIO">PIO</a> to be enabled</font>
{
	<font color=#B22222>// Disable output</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_ODR">PIO_ODR</a>  = inputEnable;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_PER">PIO_PER</a>  = inputEnable;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgOpendrain">AT91F_PIO_CfgOpendrain</a></b></font>
<font color=#B22222>//* \brief Configure <a href="AT91SAM9260_PIO.html#PIO">PIO</a> in open drain</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgOpendrain">AT91F_PIO_CfgOpendrain</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> multiDrvEnable) <font color=#B22222>// \arg pio to be configured in open drain</font>
{
	<font color=#B22222>// Configure the multi-drive option</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_MDDR">PIO_MDDR</a> = ~multiDrvEnable;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_MDER">PIO_MDER</a> = multiDrvEnable;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgPullup">AT91F_PIO_CfgPullup</a></b></font>
<font color=#B22222>//* \brief Enable pullup on <a href="AT91SAM9260_PIO.html#PIO">PIO</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgPullup">AT91F_PIO_CfgPullup</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> pullupEnable)   <font color=#B22222>// \arg enable pullup on <a href="AT91SAM9260_PIO.html#PIO">PIO</a></font>
{
		<font color=#B22222>// Connect or not Pullup</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_PPUDR">PIO_PPUDR</a> = ~pullupEnable;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_PPUER">PIO_PPUER</a> = pullupEnable;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgDirectDrive">AT91F_PIO_CfgDirectDrive</a></b></font>
<font color=#B22222>//* \brief Enable direct drive on <a href="AT91SAM9260_PIO.html#PIO">PIO</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgDirectDrive">AT91F_PIO_CfgDirectDrive</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> directDrive)    <font color=#B22222>// \arg <a href="AT91SAM9260_PIO.html#PIO">PIO</a> to be configured with direct drive</font>

{
	<font color=#B22222>// Configure the Direct Drive</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_OWDR">PIO_OWDR</a>  = ~directDrive;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_OWER">PIO_OWER</a>  = directDrive;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_CfgInputFilter">AT91F_PIO_CfgInputFilter</a></b></font>
<font color=#B22222>//* \brief Enable input filter on input <a href="AT91SAM9260_PIO.html#PIO">PIO</a></font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>void</font> <a href="#AT91F_PIO_CfgInputFilter">AT91F_PIO_CfgInputFilter</a>(
	<a href="AT91SAM9260_h.html#AT91PS_PIO">AT91PS_PIO</a> pPio,             <font color=#B22222>// \arg pointer to a <a href="AT91SAM9260_PIO.html#PIO">PIO</a> controller</font>
	<font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> inputFilter)    <font color=#B22222>// \arg <a href="AT91SAM9260_PIO.html#PIO">PIO</a> to be configured with input filter</font>

{
	<font color=#B22222>// Configure the Direct Drive</font>
	pPio-><a href="AT91SAM9260_PIO.html#PIO_IFDR">PIO_IFDR</a>  = ~inputFilter;
	pPio-><a href="AT91SAM9260_PIO.html#PIO_IFER">PIO_IFER</a>  = inputFilter;
}

<font color=#B22222>//*----------------------------------------------------------------------------</font>
<font color=#B22222>//* \fn    <b><a name="AT91F_PIO_GetInput">AT91F_PIO_GetInput</a></b></font>
<font color=#B22222>//* \brief Return <a href="AT91SAM9260_PIO.html#PIO">PIO</a> input value</font>
<font color=#B22222>//*----------------------------------------------------------------------------</font>
__inline <font color=#0000FF>unsigned</font> <font color=#0000FF>int</font> <a href="#AT91F_PIO_GetInput">AT91F_PIO_GetInput</a>( <font color=#B22222>// \<font color=#0000FF>return</font> <a href="AT91SAM9260_PIO.html#PIO">PIO</a> input</

⌨️ 快捷键说明

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