systemswstubs/examplecommonisc/IscDriver/inc/IscQueue.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Header file for Iscqueue
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef DISCQUEUE_H
       
    21 #define DISCQUEUE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <kernel.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // FUNCTION PROTOTYPES
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  Generic FIFO-type class
       
    40 *
       
    41 *  @lib IscDriver.LIB
       
    42 *  @since 2.8
       
    43 */
       
    44 class DIscQueue
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47         
       
    48         DIscQueue();
       
    49         
       
    50         /**
       
    51         * C++ default constructor.
       
    52         */
       
    53         IMPORT_C DIscQueue( TUint32** aQueue, TUint16 Size );
       
    54 
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         IMPORT_C virtual ~DIscQueue();
       
    59 
       
    60         /**
       
    61         * Function to add element to queue
       
    62 		* @since 2.8
       
    63         * @param TAny* pointer to frame
       
    64         * @return TInt KErrNone / KErrNoMemory
       
    65         */
       
    66         IMPORT_C TInt Add( TAny* );
       
    67 
       
    68         /**
       
    69         * Removes first element from the queue
       
    70 		* @since 2.8
       
    71         * @return TAny* pointer to frame
       
    72         */
       
    73         IMPORT_C TAny* RemoveFirst();
       
    74 
       
    75         /**
       
    76         * Fetches first element from the queue
       
    77 		* @since 2.8
       
    78         * @return TAny* pointer to frame
       
    79         */
       
    80         IMPORT_C TAny* GetFirst();
       
    81 
       
    82         /**
       
    83         * Deletes first element from the queue
       
    84 		* @since 2.8
       
    85         * @return void 
       
    86         */
       
    87         IMPORT_C void DeleteFirst(); 
       
    88 
       
    89         /**
       
    90         * Checks if queue is empty
       
    91 		* @since 2.8
       
    92         * @return TBool ETrue if empty, otherwise EFalse
       
    93         */
       
    94         IMPORT_C TBool Empty();
       
    95 
       
    96         /**
       
    97         * Gets length of next frame in queue
       
    98 		* @since 2.8
       
    99         * @return TUint16 
       
   100         */
       
   101         IMPORT_C TUint16 NextBufferLength();
       
   102 
       
   103         /**
       
   104         * Inline function to tell the amount of elements in queue
       
   105 		* @since 2.8
       
   106         * @return TUint16 amount of elements in queue
       
   107         */
       
   108         inline TUint16 Count() const { return iCount; };
       
   109 
       
   110         /**
       
   111         * Inline function to tell the size of queue
       
   112 		* @since 2.8
       
   113         * @return TUint16 size of queue 
       
   114         */
       
   115         inline TUint16 SizeOf() const { return iSize; };
       
   116 
       
   117     protected:
       
   118 
       
   119         /**
       
   120         * Function to disable interrupts
       
   121 		* @since 2.8
       
   122         * @return TInt KErrNone if succesful
       
   123         */
       
   124         TInt DisableIrqs();
       
   125 
       
   126         /**
       
   127         * Function to restore interrupts
       
   128 		* @since 2.8
       
   129         * @param TInt aLevel level where interrupts should be restored
       
   130         * @return void 
       
   131         */
       
   132         void RestoreIrqs( TInt aLevel );
       
   133     
       
   134         volatile TUint16 iHead;
       
   135         volatile TUint16 iTail;
       
   136         volatile TUint16 iCount;
       
   137         TUint16          iSize;
       
   138         TUint32**        iQueue;
       
   139    
       
   140     };
       
   141 
       
   142 #endif      // DISCQUEUE_H
       
   143             
       
   144 // End of File