使用ti-processor-sdk-linux-rt-am335x-evm-03.03.00.04/example-applications/pru-icss-5.1.0/examples/am335x/PRU_ARMtoPRU_Interrupt测试,该例子代码如下:
void main(void)
{
uint32_t *pDdr = (uint32_t *) &CT_DDR;
uint32_t score;
/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */ CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
/* Wait until receipt of interrupt on host 0 */
while ((__R31 & 0x40000000) == 0) {
}
/* Clear system event in SECR1 */
CT_INTC.SECR1 = 0x1;
/* Clear system event enable in ECR1 */
CT_INTC.ECR1 = 0x1;
/* Point C30 (L3) to 0x3000 offset and C31 (DDR) to 0x0 offset */
PRU0_CTRL.CTPPR1 = 0x00003000;
/* Load value from DDR, decrement, and store it in L3 */
score = pDdr[0];
score–;
CT_L3 = score;
/* Halt PRU core */
__halt();
}
请教下在arm驱动中怎么触发while ((__R31 & 0x40000000) == 0)使得跳出该语句?修改R31寄存器的值?怎么修改?
yongqing wang:
你查一下R31这个寄存器的中断条件
Shine:
回复 yongqing wang:
ARM可以通过写 PRU INTC SRSRx 寄存器,具体请看下面的FAQ说明。
processors.wiki.ti.com/…/PRU-ICSS_FAQPRU INTC的介绍可以参考TRM以及下面的wiki网站。
processors.wiki.ti.com/…/PRU_Interrupt_Controller
LL shutor:
回复 Shine:
你好,Shine Zhang,有C语言写的通过pru控制gpio的例子,能否用pru通过gpio控制蜂鸣器响?