C6678學習——SRIO DIO模式 中斷

接觸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】

參考文獻【2】

現在確定一件事,就是一定用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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章