OPTEE下,CA和TA通訊實現

2021-08-15 02:34:40 字數 1984 閱讀 7357

這裡以optee_examples中的hello_world為例,該例是實現整數加一操作。

1、 ca 需要與 optee os 之間建立乙個 context(initializecontext),以後此 ca 與 tee 環境的所有通訊均基於此 context來實現的;

/* initialize a context connecting us to the tee */

res = teec_initializecontext(null, &ctx);

if (res != teec_success)

errx(1, "teec_initializecontext failed with code 0x%x", res);

2、 ca 會向 optee os 申請與請求的 ta 建立乙個 session(opensession);

/*

* open a session to the "hello world" ta, the ta will print "hello

* world!" in the log when the session is created.

*/res = teec_opensession(&ctx, &sess, &uuid,

teec_login_public, null, null, &err_origin);

if (res != teec_success)

errx(1, "teec_opensession failed with code 0x%x origin 0x%x",

res, err_origin);

3、ca 與 ta 之間的 session 建立完成後,ca 就可以向 ta 傳送 command(invokecommand);

/*

* ta_hello_world_cmd_inc_value is the actual function in the ta to be

* called.

*/printf("invoking ta to increment %d\n", op.params[0].value.a);

res = teec_invokecommand(&sess, ta_hello_world_cmd_inc_value, &op,

&err_origin);

if (res != teec_success)

errx(1, "teec_invokecommand failed with code 0x%x origin 0x%x",

res, err_origin);

printf("ta incremented value to %d\n", op.params[0].value.a);

command 及其引數會通過共享記憶體的方式傳遞,ta 從共享記憶體中獲取到 ca 的請求以及請求引數,

ta 在 tee 環境下執行處理,得到的處理結果重新填充到共享記憶體中,ca 通過共享記憶體就可以獲取到處理結果。

4、獲得處理結果後,如不需要進一步請求,則由 ca 發起關閉 session 的請求(closesession),optee os ** ta 相關資源,

/*

* we're done with the ta, close the session and

* destroy the context.

* * the ta will print "goodbye!" in the log when the

* session is closed.

*/teec_closesession(&sess);

5、 ca 發起銷毀 context 的請求(finalizecontext),完成一次完整互動。

teec_finalizecontext(&ctx);
到這裡

就完成一次操作,optee是遵循gp標準的,這些也是gp標準的介面。

Gazebo和ROS通訊實現發球

ros版本 ros kinetic 作業系統 ubuntu16.04 lts 1.ros的安裝和通訊機制,主要是話題和服務通訊。這裡只需要根據根據ros wiki上的教程實現前20講,就可以實現安裝 包括gazebo ros包 和簡單入門。2.gazebo的一些基礎知識 非必須 這裡可以看一下gaz...

射頻通訊中的CA中的PCC和SCC概念

lte ca裡面涉及兩個概念,乙個pcc,乙個scc pcc primary carrier component 主載波 scc sencondary carrier component 輔載波 pcell ue建立初始連線的小區,一般對應pcc,scell 通過rrc重配置新增的小區,提供額外的頻...

作業系統實驗二 執行緒和管道通訊實驗

實驗內容 設有 元函式 f x,y f x f y 其中 f x f x 1 x x 1 f x 1 x 1 f y f y 1 f y 2 y 2 f y 1 y 1,2 請程式設計建 3 個併發協作程序或執行緒,它們分別完成 f x,y f x f y 執行緒間協作 include includ...