コード例 #1
0
IOReturn IOHIDEventSystemUserClient::clientMemoryForType( UInt32 type,
        UInt32 * flags, IOMemoryDescriptor ** memory )
{
    IODataQueue *   eventQueue = NULL;
    IOReturn        ret = kIOReturnNoMemory;

	if (type == kIOHIDEventSystemKernelQueueID)
		eventQueue = kernelQueue;
	else
		eventQueue  = copyDataQueueWithID(type);

    if ( eventQueue ) {
        IOMemoryDescriptor * desc = NULL;
        *flags = 0;

        desc = eventQueue->getMemoryDescriptor();

        if ( desc ) {
            desc->retain();
            ret = kIOReturnSuccess;
        }

        *memory = desc;
		if (type != kIOHIDEventSystemKernelQueueID)
			eventQueue->release();

    } else {
        ret = kIOReturnBadArgument;
    }

    return ret;
}
コード例 #2
0
IOReturn
PAVirtualDeviceUserClient::clientMemoryForType(UInt32 type, UInt32 *flags,
					       IOMemoryDescriptor **memory)
{
	IOMemoryDescriptor *buf;
	debugIOLog("%s(%p)::%s clientMemoryForType %lu\n", getName(), this, __func__, (unsigned long) type);

	switch (type) {
	case kPAMemoryInputSampleData:
		buf = device->audioInputBuf;
		break;
	case kPAMemoryOutputSampleData:
		buf = device->audioOutputBuf;
		break;
	default:
		debugIOLog("  ... unsupported!\n");
		return kIOReturnUnsupported;
	}

	if (buf)
		buf->retain();

	*memory = buf;

	return kIOReturnSuccess;
}
//==============================================================================
// IOHIDEventServiceUserClient::clientMemoryForType
//==============================================================================
IOReturn IOHIDEventServiceUserClient::clientMemoryForType(
                            UInt32                      type,
                            IOOptionBits *              options,
                            IOMemoryDescriptor **       memory )
{
    IOReturn ret = kIOReturnNoMemory;
            
    if ( _queue ) {
        IOMemoryDescriptor * memoryToShare = _queue->getMemoryDescriptor();
    
        // if we got some memory
        if (memoryToShare)
        {
            // Memory will be released by user client
            // when last map is destroyed.

            memoryToShare->retain();

            ret = kIOReturnSuccess;
        }
        
        // set the result
        *options = 0;
        *memory  = memoryToShare;
    }
        
    return ret;
}
コード例 #4
0
IOReturn IOFramebufferSharedUserClient::clientMemoryForType( UInt32 type,
        IOOptionBits * options, IOMemoryDescriptor ** memory )
{
    IOMemoryDescriptor *        mem = 0;
    IOReturn                    err;

    switch (type)
    {
        case kIOFBCursorMemory:
            mem = owner->sharedCursor;
            mem->retain();
            *options = kIOMapReadOnly;
            break;

        case kIOFBVRAMMemory:
            if (kIOReturnSuccess == clientHasPrivilege(current_task(), kIOClientPrivilegeLocalUser))
                mem = owner->getVRAMRange();
            break;
    }

    *memory = mem;
    if (mem)
        err = kIOReturnSuccess;
    else
        err = kIOReturnBadArgument;

    return (err);
}
// Read a controller's queue
IOMemoryDescriptor* WirelessGamingReceiver::ReadBuffer(int index)
{
    IOMemoryDescriptor *data;
    
    data = OSDynamicCast(IOMemoryDescriptor, connections[index].inputArray->getObject(0));
    if (data != NULL)
        data->retain();
    connections[index].inputArray->removeObject(0);
    return data;
}
コード例 #6
0
ファイル: AppleSamplePCI.cpp プロジェクト: fruitsamples/IOKit
IOMemoryDescriptor * AppleSamplePCI::copyGlobalMemory( void )
{
    IOMemoryDescriptor * memory;
    
    memory = fPCIDevice->getDeviceMemoryWithRegister( kIOPCIConfigBaseAddress0 );
    if( memory)
        memory->retain();
        
    return( memory );
}
コード例 #7
0
IOReturn IOFramebufferUserClient::clientMemoryForType( UInt32 type,
        IOOptionBits * flags, IOMemoryDescriptor ** memory )
{
    static bool          havePublishedResource;
    IOMemoryDescriptor * mem;
    IOReturn             err;

    switch (type)
    {
        case kIOFBCursorMemory:

            if (!havePublishedResource)
            {
                havePublishedResource = true;
                publishResource("WindowServer");
            }

            mem = owner->sharedCursor;
            mem->retain();
            break;

        case kIOFBVRAMMemory:
            mem = owner->getVRAMRange();
            break;

        default:
            mem = (IOMemoryDescriptor *) owner->userAccessRanges->getObject( type );
            if (mem) mem->retain();
            break;
    }

    *memory = mem;
    if (mem)
        err = kIOReturnSuccess;
    else
        err = kIOReturnBadArgument;

    return (err);
}
コード例 #8
0
IOReturn info_ennowelbers_syphon_proxyframebuffer_client::clientMemoryForType( UInt32 type, IOOptionBits * options, IOMemoryDescriptor ** memory )
{
	IOMemoryDescriptor *mem;
	switch(type)
	{
		case 0:
			mem=(IOMemoryDescriptor*)fProvider->buffer;
			break;
		case 1:
			mem=(IOMemoryDescriptor*)fProvider->fbuffer->cursorMem;
			break;
	}
	mem->retain();
	if(mem==NULL)
		return kIOReturnError;
	*memory=mem;
	return kIOReturnSuccess;
}
コード例 #9
0
IOReturn IOHIDEventSystemUserClient::clientMemoryForType( UInt32 type,
        UInt32 * flags, IOMemoryDescriptor ** memory )
{
    IODataQueue *   eventQueue  = OSDynamicCast(IODataQueue, (OSObject*)type);
    IOReturn        ret         = kIOReturnNoMemory;

    if ( eventQueue ) {
        IOMemoryDescriptor * desc = NULL;
        *flags = 0;

        desc = eventQueue->getMemoryDescriptor();

        if ( desc ) {
            desc->retain();
            ret = kIOReturnSuccess;
        }

        *memory = desc;
    } else {
        ret = kIOReturnBadArgument;
    }

    return ret;
}