1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: rdt_ReceiveBuffer.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #include "stdafx.h" 17 18 #ifndef NN_LIBRARIES_RDT_CTR_RDT_RECEIVE_BUFFER_H_ 19 #define NN_LIBRARIES_RDT_CTR_RDT_RECEIVE_BUFFER_H_ 20 21 #include "rdt_RingBuffer.h" 22 23 24 namespace nn { namespace rdt { namespace CTR { 25 26 /* Please see man pages for details 27 28 29 30 */ 31 class ReceiveBuffer{ 32 public: 33 /* Please see man pages for details 34 35 */ 36 ReceiveBuffer(void); 37 38 /* Please see man pages for details 39 40 */ 41 ~ReceiveBuffer(void); 42 43 /* Please see man pages for details 44 45 46 */ 47 void Initialize(void *pBuf, u16 bufSize); 48 49 /* Please see man pages for details 50 51 */ 52 void Finalize(void); 53 54 /* Please see man pages for details 55 56 57 58 59 */ 60 void SetInitialSequenceNumber(u32 num); 61 62 /* Please see man pages for details 63 64 65 */ 66 void Pop(size_t n); 67 68 /* Please see man pages for details 69 70 71 72 */ 73 bool Push(const void *pBuf, size_t len); 74 75 /* Please see man pages for details 76 77 78 79 80 */ 81 size_t Read(void *pBuf, size_t len); 82 83 /* Please see man pages for details 84 85 86 */ 87 u32 GetLatestSequenceNumber(void) const; 88 89 /* Please see man pages for details 90 91 */ 92 size_t GetRestSize(void) const; 93 94 /* Please see man pages for details 95 96 97 */ 98 void Clear(void); 99 100 /* Please see man pages for details 101 102 */ 103 bool IsEmpty(void) const; 104 105 /* Please see man pages for details 106 107 */ 108 void PrintDebugInfo(void) const; 109 110 /* Please see man pages for details 111 112 */ 113 static void Test(void); 114 115 116 private: 117 /* Please see man pages for details 118 119 */ 120 ReceiveBuffer (const ReceiveBuffer&); 121 122 /* Please see man pages for details 123 124 */ 125 ReceiveBuffer& operator=(const ReceiveBuffer&); 126 127 128 // Member variables 129 RingBuffer m_ringBuf; 130 u32 m_initSeqNum; // Initial sequence number 131 u32 m_latestSeqNum; 132 bool m_initialized; // TRUE if initialized 133 134 // Padding 135 u8 m_padding[3]; 136 }; 137 138 }}} // namespace nn::rdt::CTR 139 140 #endif // end of NN_LIBRARIES_RDT_CTR_RDT_RECEIVE_BUFFER_H_ 141