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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
% V, M, \5 M1 Q# G% [% ^" \# }8 O

, ?! A  @# w+ _2 T" t3 ]8 h( M( ], J0 M- Q  W: k/ S

7 n& b" k+ g  \一、打开主核创建的heapBuf7 t# }$ l- L+ L1 U7 |

- o. z& x7 \( o( y0 c* \
  • /* 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);0 T: v" a/ x' v0 W1 v
( M; ?  ^9 v, i
为什么要打开主核创建的heapBuf,因为从核创建的messageQ也应该在这个heap中统一调度管理。( `& b2 M1 e1 j  c0 y, S

: t7 C! j) ?9 m. u5 {0 X
& c  z' N! i0 Q0 q1 @$ t* a% o二、创建messageQ(slave)! \$ x2 ]; {  N# i0 k5 H

: {6 o8 C4 d# L* @
  • /* 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" );
  • }
    0 Y$ b5 T9 r% b9 X
* \  r- e- _1 f( e7 ~' T$ q
* G7 L+ ?2 I5 k3 @+ e5 `
三、打开主核messageQ(master)
% O% ]1 q1 s8 u9 N  V6 w4 J; s& ?7 d
4 ~; s& ~; O2 q' y: t; 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);
    ' C6 }# O$ X4 n# K4 ^5 L8 D& L

1 q/ I5 c- W# H& d- G' T
' ]' i3 \1 X1 o1 u& [! W. n* A

# ]* g# Z- f: r, \2 ^% Z5 w. j% l3 l) V1 M
四、接收主核的messageQ(master)' B  H4 d1 Y* [  x6 r

2 }( L' s" k# y0 ^4 [: Y9 i主核在收到FPGA的数据之后,会分配给各个核进行处理。这里接收的msg就是将要处理的内容+ R% s1 z% U$ C1 T5 L* C, t
2 j4 Y) }7 ]. w0 B- x
  • status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
  • if (status < 0)
  • {
  •         System_abort("This should not happen since timeout is forever\n");
  • }( |8 B' n+ G" W: Z! x6 c& y

- M0 q$ r+ V2 Z: Z, |; }* P0 ^+ M2 y4 X5 I5 @: k+ e& ~6 t
$ A. d" w# m" H

' M/ @4 s4 _' l/ D2 d2 `  h" c$ R五、从核处理函数
' _1 z+ F! }" @& b

9 G6 L. x' U! x" c对于数据进行处理,涉及到sharememory的问题。这个问题后续再讨论。# T* L6 j# R4 n& D' H9 [  N" G

% M  r$ V0 `6 _: b3 A; l六、发送messageQ(master)8 F" O$ [% y: j) z' }4 u3 W1 [8 W& x. ^

( V$ J. U% r) f1 T. q% _
  • status = MessageQ_put(remoteQueueId, msg);
  • if (status < 0)
  • {
  •         System_abort("MessageQ_put had a failure/error\n");
  • }3 l- T8 q. H5 k- e* T

6 a2 F- n! G: x1 f* K: F) V3 Z
) }4 c4 D* C* Y1 W! ]3 ^: _5 U
  q- g  w" v# U8 {. d

+ [% x% C0 d% x, J2 V- u; [: `, ^! e
4 z4 Z0 W- Y) D, @! J
7 y! V2 T& N& ]3 Q* Q# W. D
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

EDA365公众号

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

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

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

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

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