Esempio n. 1
0
void ChannelRenderArea::generatePainterPath(void)
{
	int current_x, current_y, oldval, newval;
	int low = this->height() - 2, high = 2, ch = getChannelNumber();
	uint64_t ss = getSampleStart(), se = getSampleEnd();

	if (sample_buffer == NULL)
		return;

	delete painterPath;
	painterPath = new QPainterPath();

	current_x = 0;
	oldval = getbit(sample_buffer, 0, ch);
	current_y = (oldval) ? high : low;
	painterPath->moveTo(current_x, current_y);

	for (uint64_t i = ss + 1; i < se; ++i) {
		current_x += 2;
		newval = getbit(sample_buffer, i, ch);
		if (oldval != newval) {
			painterPath->lineTo(current_x, current_y);
			current_y = (newval) ? high : low;
			painterPath->lineTo(current_x, current_y);
			oldval = newval;
		}
	}
	painterPath->lineTo(current_x, current_y);

	/* Force a redraw. */
	this->update();
}
Esempio n. 2
0
bool CLASS::init( IOService *       provider,
                  OSDictionary *    properties,
                  IORegistryEntry * dtEntry )
{
    if ( dtEntry )
    {
        if ( super::init( dtEntry, gIODTPlane ) == false ||
             mergeProperties( properties ) == false )
             return false;
    }
    else
    {
        if ( super::init( properties ) == false )
             return false;
    }

    fProvider = OSDynamicCast(AppleOnboardPCATARoot, provider);
    if (fProvider == 0)
        return false;

    // Call platform to register the interrupt assigned to each ATA
    // channel. For PCI interrupts (native mode), each channel will
    // share the same interrupt vector assigned to the PCI device.
    // Legacy mode channels will attempt to register IRQ 14 and 15.

    UInt32 vector = getInterruptVector();
    if (provider->callPlatformFunction( "SetDeviceInterrupts",
                   /* waitForFunction */ false,
                   /* nub             */ this,
                   /* vectors         */ (void *) &vector,
                   /* vectorCount     */ (void *) 1,
                   /* exclusive       */ (void *) false )
                                         != kIOReturnSuccess)
    {
        return false;
    }

    setLocation( getChannelNumber() ? "1" : "0" );

    return true;
}