C6678学习——SRIO DIO模式 中断

时间:2024-03-17 22:05:35

接触C6000DSP不久,碰到没有直接例程的我像无头苍蝇一样乱找资料,由于大多数资料是英文的,且专有名词很多,理解起来十分费劲。但后来发现,真的是读书千遍,其义自见。多读几遍,特别是各个文档联系起来,头脑中有概念后,就越读越通顺了。

在此,用第一篇博客记录一下这几天的折腾,也希望可以为遇到同样问题的同学提供一些思路,大神请自动绕道。

废话结束。

需求:DSP作为主机,SRIO的DIO模式到FPGA,需要DSP读/写完成后产生中断。
再废话一句:大多数关于SRIO的中断介绍都是DOORBELL的,不适用于本例,所以越发使人焦躁。

解决问题的思路是通读文档后,参考TI的资料,尤其是要充分使用K1_STK_v1.1中的例程。
再有就是多看TI的论坛,有时中文论坛帮助更大些。
(特别感谢Brighton Feng大神的例程/论坛留言)

首先,要确定这个需求是可以被实现的,因为SRIO例程里并没有,所以千万别误会这个不可实现。SRIO user guide[1] 2.3.9.1.1短短一节,提到:
Using the direct I/O protocol, once the single or multipacket data transfer is complete, the external PE, or the peripheral itself, needs to notify the local processor that the data is available for processing.
怎么做呢?没说。但至少可以放心,理论上一定可以实现。

论坛上各种提问各种看,发现参考文献【2】

C6678学习——SRIO DIO模式 中断

现在确定一件事,就是一定用LSU中断,和DOORBELL完全没关系,且也不是Message相关的中断。我可以把LSU映射为INTDST0,但这是一个general interrupt,无法映射到128个system event中。
此时,还是不知道如何把INTDST0映射到CPUINT里。因为这些知识在不同的文档里,又是英文资料,所以,把这些都联系起来,有一些困难,但就像前面说的,耐心地多读几遍,自然而然,答案就越来越收敛了。

在参考文献【3】中搜索“INTDST0”,找到突破口,这是一个CIC0的事件输入,所以,该中断是一个二级中断,需要先映射到CIC0,然后再进入system event。思路理清,接着就是如何实现了。

参考文献【4】中的2.3节有一段例程,虽然不是介绍SRIO,但也有参考价值,然而,这还是不如STK中的例程来的直观,于是,开始在STK中寻找参考项。发现UART有类似的配置需求。(插一句:pdk_c667x_2_0_9中cslr_uart.h里‘_’需要修改)。例程中有介绍如何把二级中断通过CIC0映射。大功基本告成。

还有几个注意事项:
1.参考文献【1】:Enable for these interrupts is ultimately controlled by the Interrupt Req register bit of the Load/Store command registers. This allows enabling/disabling on a per request basis. For optimum LSU performance, interrupt pacing should not be used on the LSU interrupts.
即 lsuTransfer->intrRequest = 1;
2. 参考文献【2】:Please note, interrupt pacing is enabled by default. Interrupt pacing requires DSP core rewrite INTDSTn_RATE_CNT register after each interrupt service to enable the next interrupt, otherwise, the interrupt will not be trigger again regardless of the internal interrupt status changes. This is the common reason user only sees one SRIO interrupt. If interrupt pacing is not desired for a particular INTDST, it can be disabled using INTDST_RATE_DIS register

再次感谢Brighton Feng大神的例程/论坛留言。没有例程,根本玩不下去……

参考文献:
【1】KeyStone Architecture Serial Rapid IO (SRIO) User Guide
【2】SRIO_Programming_Performance.pdf
https://e2echina.ti.com/question_answer/dsp_arm/c6000_multicore/f/53/t/79822)
【3】Multicore Fixed and Floating-Point Digital Signal Process
【4】KeyStone Architecture Chip Interrupt Controller (CIC)
【5】https://blog.csdn.net/u012402348/article/details/73188018