|
|
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 d4 ~; 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
|
|