1 /*-------------------------------------------------------------------------- 2 Project: HorizonSDK 3 File: rdt_SendBuffer.h 4 5 Copyright 2009 Nintendo. 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 $Date:: 2010-04-30#$ 14 $Rev: 15289 $ 15 $Author: hiratsu_daisuke $ 16 *-------------------------------------------------------------------------*/ 17 18 #include "stdafx.h" 19 20 #ifndef NN_RDT_SENDBUFFER_H_ 21 #define NN_RDT_SENDBUFFER_H_ 22 23 #include "rdt_RingBuffer.h" 24 25 namespace nn { namespace rdt { namespace CTR { 26 27 /* Please see man pages for details 28 29 */ 30 class SendBuffer{ 31 public: 32 /* Please see man pages for details 33 34 */ 35 SendBuffer(void); 36 37 /* Please see man pages for details 38 39 */ 40 ~SendBuffer(void); 41 42 /* Please see man pages for details 43 44 */ 45 void Initialize(void *pBuf, u16 bufSize); 46 47 /* Please see man pages for details 48 49 */ 50 void Finalize(void); 51 52 /* Please see man pages for details 53 54 55 56 */ 57 bool Push(const void *pBuf, size_t len); 58 59 /* Please see man pages for details 60 61 62 63 64 */ 65 size_t Pull(void *pBuf, u32 *pSeq, size_t len); 66 67 /* Please see man pages for details 68 69 */ 70 bool IsEmpty(void) const; 71 72 /* Please see man pages for details 73 74 */ 75 u32 GetInitialSequenceNumber(void) const; 76 77 /* Please see man pages for details 78 79 */ 80 u32 GetCurrentSequenceNumber(void) const; 81 82 /* Please see man pages for details 83 84 85 86 */ 87 void Clear(u32 initSeqNum); 88 89 /* Please see man pages for details 90 91 */ 92 void PrintDebugInfo(void) const; 93 94 /* Please see man pages for details 95 96 */ 97 static void Test(void); 98 99 100 private: 101 /* Please see man pages for details 102 103 */ 104 SendBuffer (const SendBuffer&); 105 106 /* Please see man pages for details 107 108 */ 109 SendBuffer& operator=(const SendBuffer&); 110 111 u32 genInitSeqNum(void) const; 112 113 RingBuffer m_ringBuf; 114 u32 m_initSeqNum; // Initial sequence number 115 u32 m_readByte; // Number of bytes of data read with Pull up to this point 116 bool m_initialized; 117 118 u8 m_padding[3]; // Padding 119 }; 120 121 122 123 }}} // namespace nn::rdt::CTR 124 125 #endif // end of NN_RDT_SENDBUFFER_H_ 126