3. data_queue 的实现 1. 初始化数据队列 伪代码:给 struct rt_data_queue 的成员赋值:evt_notify...
3、接下来分析下音频发送及接收具体实现: a、发送部分是通过消息队列,相关代码在audio.c中实现(rt_data_queue_push、rt_data_queue_peak、rt_data_queue_pop),主要流程见下图: b、接收部分是通过pipe实现的(具体到代码在audio_pipe.c中),pipe由audio.c中创建,类型为循环覆盖(RT_PIPE_FLAG_FORCE_WR),接收的...
队列类 登录后复制rt_wqueue_wait rt_data_queue_push rt_data_queue_pop 延时 登录后复制rt_thread_sleep rt_thread_delay rt_thread_delay_until rt_thread_mdelay 注:源码中摘录,并无理论考证,更无实际验证 所有被禁止在中断中调用的函数都有个相似的特征 —— 它可能是阻塞的,导致中断无法短时间内返回;...
tx_dma = (structrt_serial_tx_dma*)rt_malloc(sizeof(structrt_serial_tx_dma));RT_ASSERT(tx_dma != RT_NULL); tx_dma->activated = RT_FALSE;rt_data_queue_init(&(tx_dma->data_queue),8,4, RT_NULL); serial->serial_tx = tx_dma; dev->open_flag |= RT_DEVICE_FLAG_DMA_TX;/* ...
("create memory pool for repaly failed"); return -RT_ENOMEM; } /* init queue for audio replay */ rt_data_queue_init(&replay->queue, CFG_AUDIO_REPLAY_QUEUE_COUNT, 0, RT_NULL); /* init mutex lock for audio replay */ rt_mutex_init(&replay->lock, "replay", RT_IPC_FLAG_PRIO);...
等待执行完后取消rt_err_trt_workqueue_cancel_work_sync(structrt_workqueue *queue,structrt_work *work);复制 直接取消递交工作项:rt_err_trt_work_cancel(structrt_work*work); 工作完成不在使用时可以销毁:rt_err_trt_workqueue_destroy(structrt_workqueue*queue);...
thread1_recv_msgqueue 11函数功能 : 线程1入口函数,用于接收消息 12输入参数 : parameter:入口参数 13返回值 : 无 14备注 : 无 15***/ 16void thread1_recv_msgqueue(void *parameter) 17{ 18 u8 key; 19 char buf[64]; 20 21 while(1) 22 { 23 key = key_scan(0); 24 25 if(key== KEY...
57 pMsgData->next = NULL; 58 59 //插入消息 60 pthread_mutex_lock(&queueAccess); 61 if (pStMsgQuequeEnd) 62 { 63 pStMsgQuequeEnd->next = pMsgData; 64 } 65 pStMsgQuequeEnd = pMsgData; 66 67 if (!pStMsgQuequeBegin) 68 {
=RT_NULL);object=(struct rt_object*)RT_KERNEL_MALLOC(information->object_size);if(object==RT_NULL){/* no memory can be allocated */returnRT_NULL;}/* clean memory data of object */rt_memset(object,0x0,information->object_size);/* initialize object's parameters *//* set object type...
消息队列(Message Queue)是一种应用间的通信方式,消息发送后可以立即返回,由消息系统来确保消息的可靠传递。 消息发布者只管把消息发布到 MQ 中而不用管谁来取,消息使用者只管从 MQ 中取消息而不管是谁发布的。这样发布者和使用者都不用知道对方的存在。