Subversion Repositories HelenOS

Rev

Rev 2103 | Rev 2106 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2103 Rev 2105
Line 34... Line 34...
34
 
34
 
35
#ifndef KERN_TASK_H_
35
#ifndef KERN_TASK_H_
36
#define KERN_TASK_H_
36
#define KERN_TASK_H_
37
 
37
 
38
#include <cpu.h>
38
#include <cpu.h>
-
 
39
#include <ipc/ipc.h>
39
#include <synch/spinlock.h>
40
#include <synch/spinlock.h>
40
#include <synch/mutex.h>
41
#include <synch/mutex.h>
41
#include <synch/rwlock.h>
42
#include <synch/rwlock.h>
42
#include <synch/futex.h>
43
#include <synch/futex.h>
43
#include <adt/btree.h>
44
#include <adt/btree.h>
Line 49... Line 50...
49
#include <arch/fpu_context.h>
50
#include <arch/fpu_context.h>
50
#include <arch/cpu.h>
51
#include <arch/cpu.h>
51
#include <mm/tlb.h>
52
#include <mm/tlb.h>
52
#include <proc/scheduler.h>
53
#include <proc/scheduler.h>
53
 
54
 
54
#define IPC_MAX_PHONES  16
-
 
55
 
-
 
56
struct answerbox;
-
 
57
struct task;
-
 
58
struct thread;
55
struct thread;
59
 
56
 
60
typedef enum {
-
 
61
    IPC_PHONE_FREE = 0,     /**< Phone is free and can be allocated */
-
 
62
    IPC_PHONE_CONNECTING,   /**< Phone is connecting somewhere */
-
 
63
    IPC_PHONE_CONNECTED,    /**< Phone is connected */
-
 
64
    IPC_PHONE_HUNGUP,   /**< Phone is hung up, waiting for answers to come */
-
 
65
    IPC_PHONE_SLAMMED       /**< Phone was hungup from server */
-
 
66
} ipc_phone_state_t;
-
 
67
 
-
 
68
/** Structure identifying phone (in TASK structure) */
-
 
69
typedef struct {
-
 
70
    SPINLOCK_DECLARE(lock);
-
 
71
    link_t link;
-
 
72
    struct answerbox *callee;
-
 
73
    ipc_phone_state_t state;
-
 
74
    atomic_t active_calls;
-
 
75
} phone_t;
-
 
76
 
-
 
77
typedef struct answerbox {
-
 
78
    SPINLOCK_DECLARE(lock);
-
 
79
 
-
 
80
    struct task *task;
-
 
81
 
-
 
82
    waitq_t wq;
-
 
83
 
-
 
84
    link_t connected_phones;    /**< Phones connected to this answerbox */
-
 
85
    link_t calls;           /**< Received calls */
-
 
86
    link_t dispatched_calls;    /* Should be hash table in the future */
-
 
87
 
-
 
88
    link_t answers;         /**< Answered calls */
-
 
89
 
-
 
90
    SPINLOCK_DECLARE(irq_lock);
-
 
91
    link_t irq_notifs;          /**< Notifications from IRQ handlers */
-
 
92
    link_t irq_head;        /**< IRQs with notifications to this answerbox. */
-
 
93
} answerbox_t;
-
 
94
 
-
 
95
/** Task structure. */
57
/** Task structure. */
96
typedef struct task {
58
typedef struct task {
97
    /** Task lock.
59
    /** Task lock.
98
     *
60
     *
99
     * Must be acquired before threads_lock and thread lock of any of its threads.
61
     * Must be acquired before threads_lock and thread lock of any of its threads.