Move all functions to .h as inline functions
authoraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 4 Jun 2004 12:54:29 +0000 (12:54 +0000)
committeraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 4 Jun 2004 12:54:29 +0000 (12:54 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@15 38d2e660-2303-0410-9eaa-f027e97ec537

mware/fifobuf.c [deleted file]

diff --git a/mware/fifobuf.c b/mware/fifobuf.c
deleted file mode 100755 (executable)
index e20b1e5..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*!
- * \file
- * <!--
- * Copyright (C) 2003,2004 Develer S.r.l. (http://www.develer.com/)
- * Copyright (C) 2001 Bernardo Innocenti <bernie@develer.com>
- * This file is part of DevLib - See devlib/README for information.
- * -->
- *
- * \version $Id$
- *
- * \author Bernardo Innocenti <bernie@develer.com>
- *
- * \brief FIFO buffer handling routines
- */
-
-/*
- * $Log$
- * Revision 1.2  2004/06/03 11:27:09  bernie
- * Add dual-license information.
- *
- * Revision 1.1  2004/05/23 15:43:16  bernie
- * Import mware modules.
- *
- */
-
-#include "fifobuf.h"
-#include "compiler.h"
-#include <drv/kdebug.h>
-
-void fifo_init(volatile FIFOBuffer *fb, unsigned char *buf, size_t size)
-{
-       fb->head = fb->tail = fb->begin = buf;
-       fb->end = buf + size - 1;
-}
-
-
-/*!
- * Pop a character from the fifo buffer.
- *
- * \note Calling \c fifo_push() on a full buffer is undefined.
- *       The caller must make sure the buffer has at least
- *       one free slot before calling this function.
- *
- * \note It is safe to call fifo_pop() and fifo_push() from
- *       concurrent contexts.
- */
-void fifo_push(volatile FIFOBuffer *fb, unsigned char c)
-{
-#pragma interrupt called
-       /* Write at tail position */
-       *(fb->tail) = c;
-
-       if (fb->tail == fb->end)
-               /* wrap tail around */
-               fb->tail = fb->begin;
-       else
-               /* Move tail forward */
-               fb->tail++;
-}
-
-/*!
- * Pop a character from the fifo buffer.
- *
- * \note Calling \c fifo_pop() on an empty buffer is undefined.
- *       The caller must make sure the buffer contains at least
- *       one character before calling this function.
- *
- * \note It is safe to call fifo_pop() and fifo_push() from
- *       concurrent contexts.
- */
-unsigned char fifo_pop(volatile FIFOBuffer *fb)
-{
-#pragma interrupt called
-       if (fb->head == fb->end)
-       {
-               /* wrap head around */
-               fb->head = fb->begin;
-               return *(fb->end);
-       }
-       else
-               /* move head forward */
-               return *(fb->head++);
-}
-
-
-#if 0
-
-/* untested */
-void fifo_pushblock(volatile FIFOBuffer *fb, unsigned char *block, size_t len)
-{
-       size_t freelen;
-
-       /* Se c'e' spazio da tail alla fine del buffer */
-       if (fb->tail >= fb->head)
-       {
-               freelen = fb->end - fb->tail + 1;
-
-               /* C'e' abbastanza spazio per scrivere tutto il blocco? */
-               if (freelen < len)
-               {
-                       /* Scrivi quello che entra fino alla fine del buffer */
-                       memcpy(fb->tail, block, freelen);
-                       block += freelen;
-                       len -= freelen;
-                       fb->tail = fb->begin;
-               }
-               else
-               {
-                       /* Scrivi tutto il blocco */
-                       memcpy(fb->tail, block, len);
-                       fb->tail += len;
-                       return;
-               }
-       }
-
-       for(;;)
-       {
-               while (!(freelen = fb->head - fb->tail - 1))
-                       Delay(FIFO_POLLDELAY);
-
-               /* C'e' abbastanza spazio per scrivere tutto il blocco? */
-               if (freelen < len)
-               {
-                       /* Scrivi quello che entra fino alla fine del buffer */
-                       memcpy(fb->tail, block, freelen);
-                       block += freelen;
-                       len -= freelen;
-                       fb->tail += freelen;
-               }
-               else
-               {
-                       /* Scrivi tutto il blocco */
-                       memcpy(fb->tail, block, len);
-                       fb->tail += len;
-                       return;
-               }
-       }
-}
-
-#endif /* UNUSED */