2SYSBIOS HWI 342 static void ad 7606busyhwiUArg adaddr
2、SYSBIOS 多线程编程 Ø HWI (硬件中断): 342 static void ad 7606_busy_hwi(UArg ad_addr) {. . . }. . . 378 static void ad 7606_irq_setup(ad 7606 *ad) { 379 Hwi_Params hwi. Params; 380 Hwi_Handle my. Hwi; 381 Error_Block eb; 382 383 Error_init(&eb); 384 Hwi_Params_init(&hwi. Params); 385 hwi. Params. arg = (unsigned int)ad; 386 hwi. Params. enable. Int = FALSE; 387 hwi. Params. event. Id = ad->event_id; 388 hwi. Params. priority = 4; 389 my. Hwi = Hwi_create(ad->irq_event, ad 7606_busy_hwi, &hwi. Params, &eb); 390 if (my. Hwi == NULL) 391 LOG_FATAL("failed to create hwi"); 392 393 /* enable both interrupts */ 394 Hwi_enable. Interrupt(ad->irq_event); 395 } 官网: www. tronlong. com 论坛: www. 51 dsp. net
Ø Task(用�任�) : 17 Void message_loop_fun(UArg arg 0, UArg arg 1) {. . . }. . . 84 Error_Block eb; 85 Task_Params task. Params; 86 Error_init(&eb); 87 88 Task_Params_init(&task. Params); 89 task. Params. instance->name = "message_loop_fun"; 90 task. Params. arg 0 = (UArg)argc; 91 task. Params. arg 1 = (UArg)argv; 92 task. Params. stack. Size = 0 x 1000; 93 Task_create(message_loop_fun, &task. Params, &eb); /* 启� message �程 */ 94 95 if (Error_check(&eb)) 96 LOG_FATAL("failed to create application startup thread"); 官网: www. tronlong. com 论坛: www. 51 dsp. net
Ø Clock(定�器) : 151 152 153 154 155 156 157 /* configure Sys. Bios to use the lower half of Timer 1 */ var Timer = xdc. use. Module('ti. sysbios. timer 64. Timer'); var Clock = xdc. use. Module('ti. sysbios. knl. Clock'); Timer. timer. Settings[1]. master = true; Timer. default. Half = Timer. Half_LOWER; Clock. timer. Id = 1; Clock. tick. Period = 5; //5 us 435 static void ad 7606_on_ticked(UArg ad_ptr) {. . . }. . . 448 int period = 1000000 / TICK_PERIOD / rate; 449 450 if (! ad->is_running) { /* 第一次启� */ 451 Error_Block eb; 452 Error_init(&eb); 453 454 Clock_Params params; 455 Clock_Params_init(¶ms); 456 params. period = period; 457 params. arg = (unsigned int)ad; 458 params. start. Flag = TRUE; 459 ad->clock = Clock_create(ad 7606_on_ticked, period, ¶ms, &eb); 460 if (ad->clock == NULL) 461 LOG_FATAL("failed to create clock"); 462 463 Clock_start(ad->clock); 464 } 465 else { 466 Clock_stop(ad->clock); 467 Clock_set. Period(ad->clock, period); 468 Clock_start(ad->clock); 469 } 官网: www. tronlong. com 论坛: www. 51 dsp. net
3、Linux QT 编程 Ø 编写 QT project 文件进行 程的编译 : qmake project. pro(根据编写的 project 文件生成 Makefile) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 QWT_INSTALL_DIR = /home/tenny/develop/deployment/qwt-arm-6. 1. 0 TARGET = ad 7606 TEMPLATE = app VPATH OBJECTS_DIR MOC_DIR += app ipc qt = tmp CONFIG += debug SOURCES += main. cpp mainwindow. cpp HEADERS += mainwindow. h INCLUDEPATH += app ipc qt $$QWT_INSTALL_DIR/include LIBS += -L$$QWT_INSTALL_DIR/lib -lqwt 官网: www. tronlong. com 论坛: www. 51 dsp. net
Ø 多线程下在 作线程中更新 UI 的方式 class Work. Thread : public QThread { Q_OBJECT public: Work. Thread(); signals: void send. Msg(QString); //定�一个信号 protected: void run(); }; namespace Ui { class Main. Window; } class Main. Window : public QMain. Window { Q_OBJECT public: explicit Main. Window(QWidget *parent = 0); ~Main. Window(); private slots: void show. Msg(Qstring str); //定�一个槽函数 private: Ui: : Main. Window *ui; }; void Main. Window: : show. Msg(Qstring str) {. . . } QObeject: : connect( thread_obj, SIGNAL(send. Msg(Qstring)), window_obj, SLOT(show. Msg(Qstring))); emit send. Msg(Qstring(“msg sended to slot”)); 官网: www. tronlong. com 论坛: www. 51 dsp. net
1. 例程编译与运行 I 编译 ad 7606/makfile ad 7606/dsp/makefile ad 7606/host/ad 7606. pro 《OMAPL 138基于SYSLINK的双核AD采集处理例程. pdf》 II 运行 《OMAPL 138基于SYSLINK的双核AD采集处理例程. pdf》 基于 Sys. Link 的双核通信教程-AD 7606 例程运行效果. mp 4 官网: www. tronlong. com 论坛: www. 51 dsp. net
Ø 流程视图 官网: www. tronlong. com 论坛: www. 51 dsp. net
3. 通信设计 组件: • Message. Q 进行消息传递 • Ring. IO 进行 AD 数据传输 Message MSG_CMD_START 开始�行 AD 采�和采�数据的�� MSG_CMD_STOP 停止 AD 采�和采�数据的�� MSG_CMD_ENABLE_FFT 需要�采�数据�行 FFT 运算 cmd MSG_CMD_DISABLE_FF T 不需要采�数据�行 FFT 运算 MSG_CMD_FFT_DATA 可以从 Ring. Buffer �取已��行 FFT 运算的数据 MSG_CMD_RAW_DATA 可以从 Ring. Buffer �取未� FFT 运算的数据 支持 1 k, 2 k, 4 k, 8 k, 16 k, 32 k, 64 k, 128 k 的采�率 (只在 MSG_CMD_START 有 rate 2^x * 1024 , 0< x < 8 效) 34 trigger typedef struct _Message { 23 typedef enum { (只在 MSG_CMD_START 有效) 与 rate 的�相等 每采�到 trigger 个数据�行一次数据�理 35 Message. Q_Msg. Header parent; 36 uint 32_t cmd; 37 uint 32_t rate; 38 uint 32_t trigger; 39 } Message; 24 MSG_CMD_START, 25 MSG_CMD_STOP, 26 27 MSG_CMD_ENABLE_FFT, 28 MSG_CMD_DISABLE_FFT, 29 官网: 30 MSG_CMD_FFT_DATA, 31 MSG_CMD_RAW_DATA www. tronlong. com 论坛: 32 } Msg. Cmd; www. 51 dsp. net
4. 代码分析 官网: www. tronlong. com 论坛: www. 51 dsp. net
- Slides: 14