clear SBSS section
[libogc.git] / libogc / lwp_messages.inl
blobdb023fa99ed408782231ab4a5ca866397c651b01
1 #ifndef __MESSAGE_INL__
2 #define __MESSAGE_INL__
4 static __inline__ void __lwpmq_set_notify(mq_cntrl *mqueue,mq_notifyhandler handler,void *arg)
6         mqueue->notify_handler = handler;
7         mqueue->notify_arg = arg;
10 static __inline__ u32 __lwpmq_is_priority(mq_attr *attr)
12         return (attr->mode==LWP_MQ_PRIORITY);
15 static __inline__ mq_buffercntrl* __lwpmq_allocate_msg(mq_cntrl *mqueue)
17         return (mq_buffercntrl*)__lwp_queue_get(&mqueue->inactive_msgs);
20 static __inline__ void __lwpmq_free_msg(mq_cntrl *mqueue,mq_buffercntrl *msg)
22         __lwp_queue_append(&mqueue->inactive_msgs,&msg->node);
25 static __inline__ void __lwpmq_msg_append(mq_cntrl *mqueue,mq_buffercntrl *msg)
27 #ifdef _LWPMQ_DEBUG
28         printf("__lwpmq_msq_append(%p,%p,%p)\n",mqueue,&mqueue->inactive_msgs,msg);
29 #endif
30         __lwp_queue_append(&mqueue->pending_msgs,&msg->node);
33 static __inline__ void __lwpmq_msg_prepend(mq_cntrl *mqueue,mq_buffercntrl *msg)
35 #ifdef _LWPMQ_DEBUG
36         printf("__lwpmq_msq_prepend(%p,%p,%p)\n",mqueue,&mqueue->inactive_msgs,msg);
37 #endif
38         __lwp_queue_prepend(&mqueue->pending_msgs,&msg->node);
41 static __inline__ u32 __lwpmq_send(mq_cntrl *mqueue,u32 id,void *buffer,u32 size,u32 wait,u32 timeout)
43         return __lwpmq_submit(mqueue,id,buffer,size,LWP_MQ_SEND_REQUEST,wait,timeout);
46 static __inline__ u32 __lwpmq_urgent(mq_cntrl *mqueue,void *buffer,u32 size,u32 id,u32 wait,u32 timeout)
48         return __lwpmq_submit(mqueue,id,buffer,size,LWP_MQ_SEND_URGENT,wait,timeout);
51 static __inline__ mq_buffercntrl* __lwpmq_get_pendingmsg(mq_cntrl *mqueue)
53         return (mq_buffercntrl*)__lwp_queue_getI(&mqueue->pending_msgs);
56 static __inline__ void __lwpmq_buffer_copy(void *dest,const void *src,u32 size)
58         if(size==sizeof(u32)) *(u32*)dest = *(u32*)src;
59         else memcpy(dest,src,size);
62 #endif