コード例 #1
0
ファイル: AMDPCNet.cs プロジェクト: zer09/Cosmos
        protected bool SendBytes(ref byte[] aData)
        {
            int txd = mNextTXDesc++;

            if (mNextTXDesc >= 16)
            {
                mNextTXDesc = 0;
            }

            uint   xOffset = (uint)(txd * 16);
            UInt32 status  = mTxDescriptor.Read32(xOffset + 4);

            if ((status & 0x80000000) == 0)
            {
                for (uint b = 0; b < aData.Length; b++)
                {
                    mTxBuffers[txd][b] = aData[b];
                }
                UInt16 buffer_len = (UInt16)(aData.Length < 64 ? 64 : aData.Length);
                buffer_len = (UInt16)(~buffer_len);
                buffer_len++;

                UInt32 flags = (UInt32)(buffer_len & 0x0FFF) | 0x0300F000 | 0x80000000;

                mTxDescriptor.Write32(xOffset + 4, flags);
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: AMDPCNet.cs プロジェクト: zer09/Cosmos
        private void ReadRawData()
        {
            uint   status;
            UInt16 recv_size;

            byte[] recv_data;

            for (int rxd = 0; rxd < 16; rxd++)
            {
                uint xOffset = (uint)(rxd * 16);
                status = mRxDescriptor.Read32(xOffset + 4);
                if ((status & 0x80000000) == 0)
                {
                    recv_size = (UInt16)(mRxDescriptor[xOffset + 0] & 0xFFF);
                    recv_data = new byte[recv_size];
                    for (uint b = 0; b < recv_size; b++)
                    {
                        recv_data[b] = mRxBuffers[rxd][b];
                    }

                    if (DataReceived != null)
                    {
                        DataReceived(recv_data);
                    }
                    else
                    {
                        mRecvBuffer.Enqueue(recv_data);
                    }

                    mRxDescriptor.Write32(xOffset + 4, status | 0x80000000);
                }
            }
        }
コード例 #3
0
ファイル: VT6102.cs プロジェクト: ChrisJamesSadler/IL2CPU
        protected bool SendBytes(ref byte[] aData)
        {
            int txd = mNextTXDesc++;

            if (mNextTXDesc >= 16)
            {
                mNextTXDesc = 0;
            }

            uint               xOffset  = (uint)(txd * 16);
            UInt32             status   = mTxDescriptors.Read32(xOffset);
            ManagedMemorySpace txBuffer = new ManagedMemorySpace(aData);

            if (((txBuffer.Offset % 4) != 0) || (txBuffer.Size < 64))
            {
                txBuffer = new ManagedMemorySpace((uint)(aData.Length < 64 ? 64 : aData.Length), 4);
                for (uint b = 0; b < aData.Length; b++)
                {
                    txBuffer[b] = aData[b];
                }
            }
            if ((status & 0x80000000) == 0)
            {
                mTxDescriptors.Write32(xOffset + 8, txBuffer.Offset);
                mTxDescriptors.Write32(xOffset + 4, txBuffer.Size | 0x600000);

                mTxDescriptors.Write32(xOffset, status | 0x80000000);
                return(true);
            }

            return(false);
        }