Changeset 70527f1 in mainline


Ignore:
Timestamp:
2005-06-03T14:51:05Z (20 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
673104e
Parents:
ac5d02b
Message:

doxygen-style comments
cleanups

Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/proc/scheduler.c

    rac5d02b r70527f1  
    5757volatile int nrdy;
    5858
     59
     60/** Initialize context switching
     61 *
     62 * Initialize context switching and lazy FPU
     63 * context switching.
     64 *
     65 */
    5966void before_thread_runs(void)
    6067{
     
    6471
    6572
     73/** Initialize scheduler
     74 *
     75 * Initialize kernel scheduler.
     76 *
     77 */
    6678void scheduler_init(void)
    6779{
     
    6981}
    7082
    71 /* cpu_priority_high()'d */
     83
     84/** Get thread to be scheduled
     85 *
     86 * Get the optimal thread to be scheduled
     87 * according thread accounting and scheduler
     88 * policy.
     89 *
     90 * @return Thread to be scheduled.
     91 *
     92 */
    7293struct thread *find_best_thread(void)
    7394{
     
    156177}
    157178
    158 /*
    159  * This function prevents low priority threads from starving in rq's.
    160  * When it decides to relink rq's, it reconnects respective pointers
    161  * so that in result threads with 'pri' greater or equal 'start' are
    162  * moved to a higher-priority queue.
     179
     180/** Prevent rq starvation
     181 *
     182 * Prevent low priority threads from starving in rq's.
     183 *
     184 * When the function decides to relink rq's, it reconnects
     185 * respective pointers so that in result threads with 'pri'
     186 * greater or equal 'start' are moved to a higher-priority queue.
     187 *
     188 * @param start Threshold priority.
     189 *
    163190 */
    164191void relink_rq(int start)
     
    193220}
    194221
    195 /*
    196  * The scheduler.
     222
     223/** The scheduler
     224 *
     225 * The thread scheduling procedure.
     226 *
    197227 */
    198228void scheduler(void)
     
    238268}
    239269
     270
     271/** Scheduler stack switch wrapper
     272 *
     273 * Second part of the scheduler() function
     274 * using new stack. Handling the actual context
     275 * switch to a new thread.
     276 *
     277 */
    240278void scheduler_separated_stack(void)
    241279{
     
    366404}
    367405
     406
    368407#ifdef __SMP__
    369 /*
    370  * This is the load balancing thread.
    371  * It supervises thread supplies for the CPU it's wired to.
     408/** Load balancing thread
     409 *
     410 * SMP load balancing thread, supervising thread supplies
     411 * for the CPU it's wired to.
     412 *
     413 * @param arg Generic thread argument (unused).
     414 *
    372415 */
    373416void kcpulb(void *arg)
  • src/proc/task.c

    rac5d02b r70527f1  
    4040link_t tasks_head;
    4141
     42
     43/** Initialize tasks
     44 *
     45 * Initialize kernel tasks support.
     46 *
     47 */
    4248void task_init(void)
    4349{
     
    4753}
    4854
     55
     56/** Create new task
     57 *
     58 * Create new task with no threads.
     59 *
     60 * @param m Task's virtual memory structure.
     61 *
     62 * @return New task's structure on success, NULL on failure.
     63 *
     64 */
    4965task_t *task_create(vm_t *m)
    5066{
  • src/proc/thread.c

    rac5d02b r70527f1  
    5151#include <arch/faddr.h>
    5252
    53 char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
     53char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
    5454
    5555spinlock_t threads_lock;
     
    5959__u32 last_tid = 0;
    6060
    61 /*
    62  * cushion() is provided to ensure that every thread
     61
     62/** Thread wrapper
     63 *
     64 * This wrapper is provided to ensure that every thread
    6365 * makes a call to thread_exit() when its implementing
    6466 * function returns.
    6567 *
    66  * cpu_priority_high()'d
     68 * cpu_priority_high() is assumed.
     69 *
    6770 */
    6871void cushion(void)
     
    8285}
    8386
     87
     88/** Initialize threads
     89 *
     90 * Initialize kernel threads support.
     91 *
     92 */
    8493void thread_init(void)
    8594{
     
    9099}
    91100
     101
     102/** Make thread ready
     103 *
     104 * Switch thread t to the ready state.
     105 *
     106 * @param t Thread to make ready.
     107 *
     108 */
    92109void thread_ready(thread_t *t)
    93110{
     
    109126        spinlock_unlock(&t->lock);
    110127       
    111         /*
     128        /*
    112129         * Append t to respective ready queue on respective processor.
    113130         */
     
    134151}
    135152
     153
     154/** Create new thread
     155 *
     156 * Create a new thread.
     157 *
     158 * @param func  Thread's implementing function.
     159 * @param arg   Thread's implementing function argument.
     160 * @param task  Task to which the thread belongs.
     161 * @param flags Thread flags.
     162 *
     163 * @return New thread's structure on success, NULL on failure.
     164 *
     165 */
    136166thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags)
    137167{
     
    214244}
    215245
     246
     247/** Make thread exiting
     248 *
     249 * End current thread execution and switch it to the exiting
     250 * state. All pending timeouts are executed.
     251 *
     252 */
    216253void thread_exit(void)
    217254{
     
    231268}
    232269
     270
     271/** Thread sleep
     272 *
     273 * Suspend execution of the current thread.
     274 *
     275 * @param sec Number of seconds to sleep.
     276 *
     277 */
    233278void thread_sleep(__u32 sec)
    234279{
    235280        thread_usleep(sec*1000000);
    236281}
    237        
    238 /*
    239  * Suspend execution of current thread for usec microseconds.
    240  */
     282
     283
     284/** Thread usleep
     285 *
     286 * Suspend execution of the current thread.
     287 *
     288 * @param usec Number of microseconds to sleep.
     289 *
     290 */     
    241291void thread_usleep(__u32 usec)
    242292{
     
    248298}
    249299
     300
     301/** Register thread out-of-context invocation
     302 *
     303 * Register a function and its argument to be executed
     304 * on next context switch to the current thread.
     305 *
     306 * @param call_me      Out-of-context function.
     307 * @param call_me_with Out-of-context function argument.
     308 *
     309 */
    250310void thread_register_call_me(void (* call_me)(void *), void *call_me_with)
    251311{
  • src/smp/ipi.c

    rac5d02b r70527f1  
    3232#include <config.h>
    3333
     34
     35/** Broadcast IPI message
     36 *
     37 * Broadcast IPI message to all CPUs.
     38 *
     39 * @param ipi Message to broadcast.
     40 *
     41 */
    3442void ipi_broadcast(int ipi)
    3543{
  • src/time/clock.c

    rac5d02b r70527f1  
    4444#endif
    4545
    46 /*
    47  * Clock is called from an interrupt and is cpu_priority_high()'d.
     46/** Clock routine
     47 *
     48 * Clock routine executed from clock interrupt handler
     49 * (assuming cpu_priority_high()). Runs expired timeouts
     50 * and preemptive scheduling.
     51 *
    4852 */
    4953void clock(void)
  • src/time/delay.c

    rac5d02b r70527f1  
    3333#include <arch.h>
    3434
    35 /*
    36  * Note that the delay loop is calibrated for each and every CPU in the system.
    37  * Therefore it is necessary to cpu_priority_high() before calling the asm_delay_loop().
     35/** Active delay
     36 *
     37 * Delay the execution for the given number
     38 * of microseconds (or slightly more). The delay
     39 * is implemented as CPU calibrated active loop.
     40 *
     41 * @param microseconds Number of usec to sleep.
     42 *
    3843 */
    3944void delay(__u32 microseconds)
    4045{
    4146        pri_t pri;
    42 
     47       
     48        /* The delay loop is calibrated for each and every
     49           CPU in the system. Therefore it is necessary to
     50           cpu_priority_high() before calling the asm_delay_loop(). */
    4351        pri = cpu_priority_high();
    4452        asm_delay_loop(microseconds * CPU->delay_loop_const);
  • src/time/timeout.c

    rac5d02b r70527f1  
    3939#include <arch.h>
    4040
     41
     42/** Initialize timeouts
     43 *
     44 * Initialize kernel timeouts.
     45 *
     46 */
    4147void timeout_init(void)
    4248{
     
    4652
    4753
     54/** Initialize empty timeout list
     55 *
     56 * Initialize the timeout list to be empty.
     57 *
     58 * @param t Timeout list to be initialized.
     59 *
     60 */
    4861void timeout_reinitialize(timeout_t *t)
    4962{
     
    5568}
    5669
     70
     71/** Initialize timeout list
     72 *
     73 * Initialize the timeout list and its spinlock.
     74 *
     75 * @param t Timeout list to be initialized.
     76 *
     77 */
    5778void timeout_initialize(timeout_t *t)
    5879{
     
    6182}
    6283
    63 /*
    64  * This function registers f for execution in about time microseconds.
     84
     85/** Register timeout callback
     86 *
     87 * Insert the timeout handler f (with argument arg)
     88 * to the timeout list and make it execute in
     89 * time microseconds (or slightly more).
     90 *
     91 * @param t    Timeout list.
     92 * @patam time Number of usec in the future to execute
     93 *             the handler.
     94 * @param f    Timeout handler function.
     95 * @param arg  Timeout handler argument.
     96 *
    6597 */
    6698void timeout_register(timeout_t *t, __u64 time, timeout_handler f, void *arg)
     
    122154}
    123155
     156
     157/** Unregister timeout callback
     158 *
     159 * Remove timeout from timeout list.
     160 *
     161 * @param t Timeout to unregister.
     162 *
     163 */
    124164int timeout_unregister(timeout_t *t)
    125165{
Note: See TracChangeset for help on using the changeset viewer.