找回密码
 注册
关于网站域名变更的通知
查看: 379|回复: 1
打印 上一主题 下一主题

DSP-6678 --- SRIO通信(3)再来认识一下slave_main

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2019-10-15 15:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x

  B, v8 b, D* b4 G$ b. Y( A0 L
9 S2 J3 e# C3 {0 g3 l2 z% {( v2 X/ K+ E) L
+ f1 l/ ]: c; `5 t9 U
一、打开主核创建的heapBuf/ _/ a  I: D8 t5 B8 e0 }# Z
0 B5 |# {* z) l7 J* F2 N$ B4 q
  • /* Open the heap created by the other processor. Loop until opened. */
  • do {
  •         status = HeapBufMP_open(HEAP_NAME, &heapHandle);
  •         if (status < 0) {
  •                 Task_sleep(1);
  •         }
  • } while (status < 0);
    % b: n7 S" R1 ~$ L) t1 l

. I" _3 n$ n0 P5 u- ?为什么要打开主核创建的heapBuf,因为从核创建的messageQ也应该在这个heap中统一调度管理。" R+ ?( C2 k. v. J( X

  K4 O9 n7 P* z4 P$ e8 D1 }- F  W# G/ u$ ^5 e% A) ^
二、创建messageQ(slave)' s- o2 Y) ]; S9 |% X. N

4 r2 E8 `- \/ l5 c# V
  • /* Register this heap with MessageQ */
  • MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);
  • /* Create the local message queue */
  • messageQ = MessageQ_create(localQueueName, NULL);
  • if (messageQ == NULL)
  • {
  •     System_abort("MessageQ_create failed\n" );
  • }6 i% m0 P9 Z5 G6 b- G% G  X; z

+ P: {7 C* q& m3 M
, e, {$ O+ ~! ^( R7 s- G 三、打开主核messageQ(master)( ^" Q% q# u% r" W

3 Z% C6 ~0 }' v# O
  • /* Open the remote message queue. Spin until it is ready. */
  • do
  • {
  •         status = MessageQ_open(masterQueueName, &remoteQueueId);
  •         if (status < 0)
  •         {
  •             Task_sleep(1);
  •         }
  • } while (status < 0);5 h0 l5 P/ U) G8 m& w1 z4 Y
2 ]6 |8 B/ _8 y2 X! ]

2 e6 |1 g) |3 [; ]* i2 Z. b9 j! y6 Q

% y6 v9 {3 @! D/ R1 N# t! v3 _+ L/ E2 O. f
四、接收主核的messageQ(master)9 u3 D4 P. X) W' l; J% l

- N$ c- P1 g! q- o5 e主核在收到FPGA的数据之后,会分配给各个核进行处理。这里接收的msg就是将要处理的内容$ f( m: }7 {; }7 Z/ ]. G

7 T! _- T8 q" ^2 `' y- V3 i9 |- `7 g
  • status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
  • if (status < 0)
  • {
  •         System_abort("This should not happen since timeout is forever\n");
  • }
    " E$ `4 ~/ E. S8 F7 B

' R! k7 f6 ?+ ?1 M! w
7 I+ i3 E9 l8 L. F4 X2 D+ P
/ v2 f. B# A# d- `1 F

, d8 c' ~" ]+ @5 {; q: p8 V9 z五、从核处理函数
! g* u. Z9 b! A: W  w, H" T9 z8 f
& E; u, I+ ?( s5 L, F5 w3 l& Q! O6 ?
对于数据进行处理,涉及到sharememory的问题。这个问题后续再讨论。
5 E. w+ ?- b+ Z8 N
, T  a, {& q) `* f, ?: k! R六、发送messageQ(master)
+ b" l5 ?. k9 s

0 f, h* G8 z. F1 C' i, u
  • status = MessageQ_put(remoteQueueId, msg);
  • if (status < 0)
  • {
  •         System_abort("MessageQ_put had a failure/error\n");
  • }- |0 k3 R3 a$ W1 n

2 E8 N3 ?; S9 ^% s* P* W

4 e. Y- f0 h# @% Y  b& x0 ~( P8 p9 ~4 y
0 c7 Y4 O$ x* y

  j6 F9 U( H, S: N
2 W" S  ~  G% u; Z- `4 ]7 V3 H" \  A( n8 U/ ]7 ?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-11-25 01:23 , Processed in 0.171875 second(s), 25 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表