MCPcopy Create free account
hub / github.com/acidanthera/BrcmPatchRAM / bulkWrite

Method bulkWrite

BrcmPatchRAM/BrcmPatchRAM.cpp:1219–1249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217}
1218
1219IOReturn BrcmPatchRAM::bulkWrite(const void* data, UInt16 length)
1220{
1221 IOReturn result;
1222
1223 if (IOMemoryDescriptor* buffer = IOMemoryDescriptor::withAddress((void*)data, length, kIODirectionIn))
1224 {
1225 if ((result = buffer->prepare()) == kIOReturnSuccess)
1226 {
1227 if ((result = mBulkPipe.write(buffer, 0, 0, buffer->getLength(), NULL)) == kIOReturnSuccess)
1228 {
1229 //DEBUG_LOG("%s: Wrote %d bytes to bulk pipe.\n", getName(), length);
1230 }
1231 else
1232 AlwaysLog("[%04x:%04x]: Failed to write to bulk pipe (\"%s\" 0x%08x).\n", mVendorId, mProductId, stringFromReturn(result), result);
1233 }
1234 else
1235 AlwaysLog("[%04x:%04x]: Failed to prepare bulk write memory buffer (\"%s\" 0x%08x).\n", mVendorId, mProductId, stringFromReturn(result), result);
1236
1237 if ((result = buffer->complete()) != kIOReturnSuccess)
1238 AlwaysLog("[%04x:%04x]: Failed to complete bulk write memory buffer (\"%s\" 0x%08x).\n", mVendorId, mProductId, stringFromReturn(result), result);
1239
1240 buffer->release();
1241 }
1242 else
1243 {
1244 AlwaysLog("[%04x:%04x]: Unable to allocate bulk write buffer.\n", mVendorId, mProductId);
1245 result = kIOReturnNoMemory;
1246 }
1247
1248 return result;
1249}
1250
1251bool BrcmPatchRAM::performUpgrade()
1252{

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected