Main Page | Directories | File List | Globals

fifo.c

Go to the documentation of this file.
00001 /*
00002  * kernel_libs/queues/fifo.c
00003  *
00004  * Copyright (c) 2003-2004 Lukasz Dembinski <dembol@nasa.com.pl>
00005  * All Rights Reserved
00006  * 
00007  * Date:        2004/05
00008  * Author:      Lukasz Dembinski
00009  * Info:        fifo.c core file
00010  * Contact:     mailto: <dembol@nasa.com.pl>
00011  *
00012  */
00013 
00014 #include <agnix/agnix.h>
00015 #include <agnix/queues.h>
00016 #include <agnix/list.h>
00017 #include <agnix/console.h>
00018 
00019 #define MOD_NAME        "QUEUES: \t"
00020 
00021 int queue_type_fifo_init(struct queue_type_s *queue_type)
00022 {
00023     return 0;
00024 }
00025 
00026 int queue_type_fifo_remove(struct queue_type_s *queue_type)
00027 {
00028     return 0;
00029 }
00030 
00031 int queue_fifo_init(struct queue_s *queue)
00032 {
00033     return 0;
00034 }
00035 
00036 int queue_fifo_remove(struct queue_s *queue)
00037 {
00038     return 0;
00039 }
00040 
00041 int queue_fifo_enqueue(struct queue_s *queue, struct queue_entry_s *queue_entry)
00042 {
00043     list_add_tail(&queue_entry->queue_entry_list, &queue->queue_list);    
00044 
00045     return 0;
00046 }
00047 
00048 struct queue_entry_s *queue_fifo_dequeue(struct queue_s *queue)
00049 {
00050     struct queue_entry_s *queue_entry;
00051 
00052     if (list_empty(&queue->queue_list))
00053         return NULL;
00054 
00055     queue_entry = list_entry(queue->queue_list.next, struct queue_entry_s, queue_entry_list);
00056 
00057     list_del(queue->queue_list.next);    
00058 
00059     return queue_entry;
00060 }
00061 
00062 int queue_fifo_control(struct queue_s *queue, int op, void *arg)
00063 {
00064     return 0;
00065 }
00066 
00067 struct queue_ops_s queue_fifo_ops = {
00068     .init               = queue_fifo_init,
00069     .remove             = queue_fifo_remove,
00070     .enqueue            = queue_fifo_enqueue,
00071     .dequeue            = queue_fifo_dequeue,
00072     .control            = queue_fifo_control,
00073     .peek               = NULL
00074 };
00075 
00076 struct queue_type_ops_s queue_type_fifo_ops = {
00077     .init               = queue_type_fifo_init,
00078     .remove             = queue_type_fifo_remove,
00079     .queue_ops          = &queue_fifo_ops
00080 };
00081 
00082 struct queue_type_s queue_type_fifo = {
00083     .queue_type         = QUEUE_TYPE_FIFO,
00084     .queue_type_name    = "FIFO",
00085     .queue_type_ops     = &queue_type_fifo_ops,
00086 };
00087 
00088 int queues_fifo_init(void)
00089 {
00090     return register_queue_type(&queue_type_fifo);
00091 }
Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix