/* ======================================================================== Routine Description: Write 32-bit MAC register Arguments: Return Value: IRQL = Note: ======================================================================== */ NTSTATUS RTUSBWriteMACRegister( IN RTMP_ADAPTER *pAd, IN USHORT Offset, IN UINT32 Value, IN BOOLEAN bWriteHigh) { NTSTATUS Status; UINT32 localVal; localVal = Value; /* MT76xx HW has 4 byte alignment constrained */ if (IS_MT76xx(pAd)) { Status = RTUSBMultiWrite_nBytes( pAd, Offset, (UCHAR*)&Value, 4, 4); } else { Status = RTUSBSingleWrite(pAd, Offset, (USHORT)(localVal & 0xffff), bWriteHigh); Status = RTUSBSingleWrite(pAd, Offset + 2, (USHORT)((localVal & 0xffff0000) >> 16), bWriteHigh); } return Status; }
/* ======================================================================== Routine Description: Write Firmware to NIC. Arguments: Return Value: IRQL = Note: ======================================================================== */ NTSTATUS RTUSBFirmwareWrite( IN PRTMP_ADAPTER pAd, IN PUCHAR pFwImage, IN ULONG FwLen) { UINT32 MacReg; NTSTATUS Status; /* ULONG i;*/ USHORT writeLen; /*ULONG FMode = 0;*/ Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacReg); /* write firmware */ writeLen = FwLen; #if defined(USB_FIRMWARE_MULTIBYTE_WRITE) || defined(DPA_S) DBGPRINT(RT_DEBUG_TRACE, ("USB_FIRMWARE_MULTIBYTE_WRITE defined! Write_Bytes = %d\n", writeLen)); RTUSBMultiWrite_nBytes(pAd, FIRMWARE_IMAGE_BASE, pFwImage, writeLen, 64); #else DBGPRINT(RT_DEBUG_TRACE, ("USB_FIRMWARE_MULTIBYTE_WRITE not defined!\n")); RTUSBMultiWrite(pAd, FIRMWARE_IMAGE_BASE, pFwImage, writeLen, FALSE); #endif Status = RTUSBWriteMACRegister(pAd, 0x7014, 0xffffffff, FALSE); Status = RTUSBWriteMACRegister(pAd, 0x701c, 0xffffffff, FALSE); /* change 8051 from ROM to RAM */ Status = RTUSBFirmwareRun(pAd); return Status; }
INT MCUBurstWrite(PRTMP_ADAPTER pAd, UINT32 Offset, UINT32 *Data, UINT32 Cnt) { RTUSBMultiWrite_nBytes(pAd, Offset, Data, Cnt * 4, 64); return 0; }