Changeset 8b243f2 in mainline for kernel/generic/src/ipc/ipcrsc.c


Ignore:
Timestamp:
2007-06-17T19:34:36Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd72c3e9
Parents:
4680ef5
Message:

Greatly improve comments in the IPC layer.
Now I think I finally start to understand our IPC internals :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipcrsc.c

    r4680ef5 r8b243f2  
    133133#include <debug.h>
    134134
    135 /** Find call_t * in call table according to callid
    136  *
    137  * TODO: Some speedup (hash table?)
    138  * @return NULL on not found, otherwise pointer to call structure
    139  */
    140 call_t * get_call(unative_t callid)
     135/** Find call_t * in call table according to callid.
     136 *
     137 * @todo Some speedup (hash table?)
     138 *
     139 * @param callid        Userspace hash of the call. Currently it is the call
     140 *                      structure kernel address.
     141 *
     142 * @return              NULL on not found, otherwise pointer to the call
     143 *                      structure.
     144 */
     145call_t *get_call(unative_t callid)
    141146{
    142147        link_t *lst;
     
    145150        spinlock_lock(&TASK->answerbox.lock);
    146151        for (lst = TASK->answerbox.dispatched_calls.next;
    147              lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
     152            lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
    148153                call = list_get_instance(lst, call_t, link);
    149                 if ((unative_t)call == callid) {
     154                if ((unative_t) call == callid) {
    150155                        result = call;
    151156                        break;
     
    156161}
    157162
    158 /** Allocate new phone slot in current TASK structure */
     163/** Allocate new phone slot in the current TASK structure.
     164 *
     165 * @return              New phone handle or -1 if the phone handle limit is
     166 *                      exceeded.
     167 */
    159168int phone_alloc(void)
    160169{
     
    163172        spinlock_lock(&TASK->lock);
    164173       
    165         for (i=0; i < IPC_MAX_PHONES; i++) {
    166                 if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \
     174        for (i = 0; i < IPC_MAX_PHONES; i++) {
     175                if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
    167176                    atomic_get(&TASK->phones[i].active_calls) == 0)
    168177                        TASK->phones[i].state = IPC_PHONE_FREE;
     
    180189}
    181190
     191/** Mark a phone structure free.
     192 *
     193 * @param phone         Phone structure to be marked free.
     194 */
    182195static void phone_deallocp(phone_t *phone)
    183196{
     
    188201}
    189202
    190 /** Free slot from a disconnected phone
    191  *
    192  * All already sent messages will be correctly processed
     203/** Free slot from a disconnected phone.
     204 *
     205 * All already sent messages will be correctly processed.
     206 *
     207 * @param phoneid       Phone handle of the phone to be freed.
    193208 */
    194209void phone_dealloc(int phoneid)
     
    197212}
    198213
    199 /** Connect phone to a given answerbox
    200  *
    201  * @param phoneid The slot that will be connected
     214/** Connect phone to a given answerbox.
     215 *
     216 * @param phoneid       Phone handle to be connected.
     217 * @param box           Answerbox to which to connect the phone handle.
    202218 *
    203219 * The procedure _enforces_ that the user first marks the phone
Note: See TracChangeset for help on using the changeset viewer.