Example #1
0
/*! \internal \brief Send an IOCTL to the parallel port driver

 This function sends an IOCTL to the parallel port driver.
 It is an internal helper function for the following functions.

 \param Pdx
   Pointer to the device extension of the driver

 \param Ioctl
   The IOCTL to perform

 \param InBuffer
   Pointer to a buffer which holds the input.
   This can be NULL.

 \param InBufferLength
   Length of the buffer pointed to by InBuffer. 
   Must be 0 if InBuffer == NULL.

 \param OutBuffer
   Pointer to a buffer which will get the output.
   This can be NULL.

 \param OutBufferLength
   Length of the buffer pointed to by OutBuffer. 
   Must be 0 if OutBuffer == NULL.

 This function must be run at IRQL == PASSIVE_LEVEL.
*/
static NTSTATUS
ParPortIoctlInOut(IN PDEVICE_EXTENSION Pdx, IN ULONG Ioctl, 
                  IN PVOID InBuffer, IN ULONG InBufferLength, 
                  OUT PVOID OutBuffer, IN ULONG OutBufferLength)
{
    IO_STATUS_BLOCK ioStatusBlock;
    NTSTATUS ntStatus;
    KEVENT event;   // event to be signalled when the IOCTL has finished
    PIRP irp;

    FUNC_ENTER();

    // Initialize the event which we will use to be notified
    // when the IRP has finished

    DBG_IRQL( == PASSIVE_LEVEL);
    KeInitializeEvent(&event, NotificationEvent, FALSE);

    ntStatus = STATUS_SUCCESS;

    // build an IRP for this IOCTL

    DBG_IRQL( == PASSIVE_LEVEL);
    irp = IoBuildDeviceIoControlRequest(
        Ioctl,
        Pdx->ParallelPortFdo,
        InBuffer,
        InBufferLength,
        OutBuffer,
        OutBufferLength,
        TRUE,           // it's an internal device control
        &event,
        &ioStatusBlock
        );

    if (irp)
    {
        PIO_STACK_LOCATION irpStack;

        // get the current IRP stack location

        DBG_IRQL( <= DISPATCH_LEVEL);
        irpStack = IoGetNextIrpStackLocation(irp);

        // Reference the file object we are about to call.
        // This ensures the driver is not removed while we call it,
        // even if the underlying hardware is removed

        DBG_IRQL( <= DISPATCH_LEVEL);
        ObReferenceObject(Pdx->ParallelPortFileObject);

        // tell the IRP stack location to which file object we are
        // referring

        irpStack->FileObject = Pdx->ParallelPortFileObject;

        // Call the driver to perform the requested IOCTL

        DBG_IRQL( <= DISPATCH_LEVEL);
        ntStatus = IoCallDriver(Pdx->ParallelPortFdo, irp);

        // We're done, we can dereference the file object again

        DBG_IRQL( <= DISPATCH_LEVEL);
        ObDereferenceObject(Pdx->ParallelPortFileObject);

        if (!NT_SUCCESS(ntStatus))
        {
            DBG_WARN((DBG_PREFIX "IoCallDriver FAILED!"));
        }
        else 
        {
            // wait for the IRP to be completed

            DBG_IRQL( <= DISPATCH_LEVEL /* = only if timeout of NULL */);
            ntStatus = KeWaitForSingleObject(
               &event, 
               Executive, 
               KernelMode, 
               FALSE, // we are not alertable
               NULL);

            if (!NT_SUCCESS(ntStatus)) 
            {
                DBG_WARN((DBG_PREFIX "KeWaitForSingleObject FAILED!"));
            }
        }
    }

    FUNC_LEAVE_NTSTATUS(ntStatus);
}
Example #2
0
VaapiEncoderH264::~VaapiEncoderH264()
{
    FUNC_ENTER();
}
// ---------------------------------------------------------------------------
// CLbtCreateTriggerAOOperation::ConstructL
// ---------------------------------------------------------------------------
//
void CLbtCreateTriggerAOOperation::ConstructL()
	{
	FUNC_ENTER("CLbtCreateTriggerAOOperation::ConstructL");
	CActiveScheduler::Add(this);
	}
Example #4
0
Encode_Status VaapiEncoderBase::getMVBufferSize(uint32_t *Size)
{
    FUNC_ENTER();
    *Size = 0;
    return ENCODE_SUCCESS;
}
Example #5
0
void
smap_rxeof(void *arg)
{
	struct smap_softc *sc = arg;
	struct smap_desc *d;
	struct ifnet *ifp = &sc->ethercom.ec_if;
	struct mbuf *m;
	u_int16_t r16, stat;
	u_int32_t *p;
	int i, j, sz, rxsz, cnt;

	FUNC_ENTER();

	i = sc->rx_done_index;

	for (cnt = 0;; cnt++, i = (i + 1) & 0x3f) {
		m = NULL;
		d = &sc->rx_desc[i];
		stat = d->stat;

		if ((stat & SMAP_RXDESC_EMPTY) != 0) {
			break;
		} else if (stat & 0x7fff) {
			ifp->if_ierrors++;
			goto next_packet;
		}

		sz = d->sz;
		rxsz = ROUND4(sz);

		KDASSERT(sz >= ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN);
		KDASSERT(sz <= ETHER_MAX_LEN);

		/* load data from FIFO */
		_reg_write_2(SMAP_RXFIFO_PTR_REG16, d->ptr & 0x3ffc);
		p = sc->rx_buf;
		for (j = 0; j < rxsz; j += sizeof(u_int32_t)) {
			*p++ = _reg_read_4(SMAP_RXFIFO_DATA_REG);
		}

		/* put to mbuf */
		MGETHDR(m, M_DONTWAIT, MT_DATA);
		if (m == NULL) {
			printf("%s: unable to allocate Rx mbuf\n", DEVNAME);
			ifp->if_ierrors++;
			goto next_packet;
		}

		if (sz > (MHLEN - 2)) {
			MCLGET(m, M_DONTWAIT);
			if ((m->m_flags & M_EXT) == 0) {
				printf("%s: unable to allocate Rx cluster\n",
				    DEVNAME);
				m_freem(m);
				m = NULL;
				ifp->if_ierrors++;
				goto next_packet;
			}
		}

		m->m_data += 2; /* for alignment */
		m->m_pkthdr.rcvif = ifp;
		m->m_pkthdr.len = m->m_len = sz;
		memcpy(mtod(m, void *), (void *)sc->rx_buf, sz);

	next_packet:
		ifp->if_ipackets++;

		_reg_write_1(SMAP_RXFIFO_FRAME_DEC_REG8, 1);

		/* free descriptor */
		d->sz	= 0;
		d->ptr	= 0;
		d->stat	= SMAP_RXDESC_EMPTY;
		_wbflush();
		
		if (m != NULL) {
			if (ifp->if_bpf)
				bpf_mtap(ifp->if_bpf, m);
			(*ifp->if_input)(ifp, m);
		}
	}
	sc->rx_done_index = i;

	r16 = _reg_read_2(SPD_INTR_ENABLE_REG16);
	if (((r16 & SPD_INTR_RXDNV) == 0) && cnt > 0) {
		r16  |= SPD_INTR_RXDNV;
		_reg_write_2(SPD_INTR_ENABLE_REG16, r16);
	}

	FUNC_EXIT();
}
Example #6
0
/*! \brief Wait until listener is ready to receive

 This function waits until a listener is ready.

 \param Pdx
   Pointer to the device extension.

 \param SendEoi
   TRUE if we want to signal an EOI.
   FALSE otherwise.
*/
VOID
cbmiec_wait_for_listener(IN PDEVICE_EXTENSION Pdx, IN BOOLEAN SendEoi)
{
    ULONG NumberOfAcks = SendEoi ? 2 : 1;

    FUNC_ENTER();

    PERF_EVENT_VERBOSE(0x1100, NumberOfAcks);

    // This function has two incarnations. The first one
    // is used if we have successfully allocated the interrupt.
    // In this case, we just wait until the ISR has done the
    // essential work

    // When entering this function, DATA_IN should not be active

    DBG_ASSERT(CBMIEC_GET(PP_DATA_IN));

    if (Pdx->ParallelPortAllocatedInterrupt)
    {
        LONG ret;

        // This is implementation 1. It needs a working
        // ISR. The main work is done there

        // Tell the ISR how many interrupts to wait for

        PERF_EVENT_VERBOSE(0x1101, NumberOfAcks);
        ret = InterlockedExchange(&Pdx->IrqCount, NumberOfAcks);
        DBG_ASSERT(ret==0);
        PERF_EVENT_VERBOSE(0x1102, ret);

        // in the sequel, allow interrupts to occur

        DBG_IRQ(("Allow Interrupts"));
        CBMIEC_SET(PP_LP_IRQ);

        /*! \todo Shouldn't we make sure that there
         * is no spurious interrupt until now?
         */

        // Give the LISTENer the sign: We want to send something

        DBG_IRQ(("Release CLK_OUT"));
        CBMIEC_RELEASE(PP_CLK_OUT);

#ifdef USE_DPC

        // set the cancel routine which will wake us up if we do not get
        // an IRQ, and a cancellation is requested

        PERF_EVENT_VERBOSE(0x1103, 0);
        DBG_VERIFY(IoSetCancelRoutine(Pdx->IrpQueue.CurrentIrp, WaitCancelRoutine) DBGDO(== NULL));

        // Now, wait until we have been signalled

        PERF_EVENT_VERBOSE(0x1104, 0);
        DBG_DPC((DBG_PREFIX "CALL KeWaitForSingleObject()"));
        KeWaitForSingleObject(&Pdx->EventWaitForListener, Executive, KernelMode, FALSE, NULL);
        DBG_DPC((DBG_PREFIX "RETURN from KeWaitForSingleObject()"));

        PERF_EVENT_VERBOSE(0x1105, 0);

        // we do not need the cancel routine anymore:

        if (IoSetCancelRoutine(Pdx->IrpQueue.CurrentIrp, NULL) == NULL)
        {
            PERF_EVENT_VERBOSE(0x1106, -1);
            // the cancel routine was called!

            // Make sure the IrqCount is resetted to zero.

            InterlockedExchange(&Pdx->IrqCount, 0);
        }

#else

        // Wait until the listener has told us that it is able to listen

        while (!QueueShouldCancelCurrentIrp(&Pdx->IrpQueue) && Pdx->IrqCount)
        {
            cbmiec_schedule_timeout(libiec_global_timeouts.T_WaitForListener_Granu_T_H);
        }
#endif

        DBG_IRQ(("IrqCount = 0"));

        // from here on, no interrupts will be generated anymore

        CBMIEC_RELEASE(PP_LP_IRQ);
        DBG_IRQ(("No more Interrupts"));
    }
Example #7
0
Encode_Status VaapiEncoderBase::getConfig(VideoParamConfigType type, Yami_PTR videoEncConfig)
{
    FUNC_ENTER();
    return ENCODE_SUCCESS;
}
// ---------------------------------------------------------------------------
// CLbtCleanupHandler::ReadCleanupDataFromFileL
// ---------------------------------------------------------------------------
//
void CLbtCleanupHandler::ReadCleanupDataFromFileL()
	{
	FUNC_ENTER("CLbtCleanupHandler::ReadCleanupDataFromFileL");
	
	// First reset the cleanup data 
	iCleanupItems.ResetAndDestroy();
	
	// Open handle to file system
	RFs fs;
	User::LeaveIfError(fs.Connect());
	
	CleanupClosePushL(fs);
	
	// Obtain the file path
    TFileName file;
    
    // Gets the path in which the file can be created
    fs.SessionPath(file);

    // Create the file Directory ie the private directory of the process
    fs.MkDirAll(file);
    
    // Append the name of the file
    file.Append(KLbtAppCleanupFileName);
    
    // Open read stream
    RFileReadStream readStream;
    
    TInt error = readStream.Open( fs, file, EFileRead );
    if( error != KErrNone )
    	{
    	// File may not exists
    	ERROR("Opening of cleanup file failed with : %d", error);
    	readStream.Close();
    	CleanupStack::PopAndDestroy(); //fs
    	return;
    	}
    CleanupClosePushL( readStream );
    
    // Get the count in the cleanup array
    TInt count = readStream.ReadInt16L();    
    for(TInt i=0; i<count; ++i)
    	{
    	RArray<TLbtTriggerId> triggers;
    	CleanupClosePushL(triggers);
    	
    	// Read the trigger ids
    	TInt triggerCount = readStream.ReadInt16L();
    	for(TInt j=0;j<triggerCount;++j)
    		{
    		triggers.Append( readStream.ReadUint32L() );
    		}
    	
    	// Read the universal time
    	TInt year = readStream.ReadInt32L();
    	TMonth month = static_cast<TMonth>( readStream.ReadInt32L() );
    	TInt day = readStream.ReadInt32L();
    	
    	TDateTime dateTime( year,
    						month,
    						day,
    						0,
    						0,
    						0,
    						0 );
    	TTime time( dateTime );
    	
    	CLbtCleanupItem* cleanupItem = new (ELeave) CLbtCleanupItem();
    	cleanupItem->AddCleanupItem( triggers, time );
    	
    	CleanupStack::Pop(); // triggers
    	triggers.Close();
    	
    	// Append cleanup item to the cleaup items array
    	iCleanupItems.Append( cleanupItem );
    	}

    CleanupStack::PopAndDestroy(2); // fs and readStream
	}
// ---------------------------------------------------------------------------
// CLbtCleanupHandler::~CLbtCleanupHandler
// ---------------------------------------------------------------------------
//	
CLbtCleanupHandler::~CLbtCleanupHandler()
	{
	FUNC_ENTER("CLbtCleanupHandler::~CLbtCleanupHandler");
	Cancel();	
	iCleanupItems.ResetAndDestroy();
	}
// ---------------------------------------------------------------------------
// CLbtCleanupHandler::RunError
// ---------------------------------------------------------------------------
//	
TInt CLbtCleanupHandler::RunError( TInt aError )
	{
	FUNC_ENTER("CLbtCleanupHandler::RunError");
	ERROR("CLbtCleanupHandler::RunL left with error code", aError);
	return KErrNone;
	}
// ---------------------------------------------------------------------------
// CLbtCleanupHandler::WriteCleanupDataToFileL
// ---------------------------------------------------------------------------
//
void CLbtCleanupHandler::WriteCleanupDataToFileL()
	{
	FUNC_ENTER("CLbtCleanupHandler::WriteCleanupDataToFileL");	
	
	RFs fs;
	User::LeaveIfError( fs.Connect() );
	
	CleanupClosePushL( fs );
    
    // Obtain the file path
    TFileName file;
    
    // Gets the path in which the file can be created
    fs.SessionPath(file);

    // Create the file Directory ie the private directory of the process
    fs.MkDirAll(file);
    
    // Append the name of the file
    file.Append(KLbtAppCleanupFileName);
    
    // Open write stream to write to the file
    RFileWriteStream writeStream;
    
    // Open the file to replace the contents. If the file is not preset
    // this method will create the file
    TInt error = writeStream.Replace( fs, file, EFileWrite );    
    if( error != KErrNone )
    	{
    	ERROR("Opening of cleanup file failed with : %d", error);
    	writeStream.Close();
    	CleanupStack::PopAndDestroy(); //fs
    	User::Leave(error);
    	}
    CleanupClosePushL( writeStream );
    
    // First write the number of cleanup items
    writeStream.WriteInt16L( iCleanupItems.Count() );

	for(TInt i=0;i<iCleanupItems.Count();++i)
		{
		RArray<TLbtTriggerId>& triggers = iCleanupItems[i]->GetTriggers();
		
		// Write the trigger ids into the file
		writeStream.WriteInt16L( triggers.Count() );
		for(TInt j=0;j<triggers.Count();++j)
			{
			writeStream.WriteUint32L( triggers[j] );
			}
		
		// Write the time into the file
		const TDateTime dateTime = iCleanupItems[i]->GetTime().DateTime();
		
		// Write the year
		writeStream.WriteInt32L( dateTime.Year() );
		
		// Write the month
		writeStream.WriteInt32L( dateTime.Month() );
		
		// Write the day
		writeStream.WriteInt32L( dateTime.Day() );
		}
    
    CleanupStack::PopAndDestroy(2); //fs and writeSteam    
	}
Example #12
0
Encode_Status VaapiEncoderH264::start()
{
    FUNC_ENTER();
    resetParams();
    return VaapiEncoderBase::start();
}
// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
//
CLbtDbOperationAO::~CLbtDbOperationAO()
{
    FUNC_ENTER("CLbtDbOperationAO::~CLbtDbOperationAO");
}
// ---------------------------------------------------------------------------
// RunError
// ---------------------------------------------------------------------------
//
TInt CLbtDbOperationAO::RunError(TInt /*aError*/)
{
    FUNC_ENTER("CLbtDbOperationAO::RunError");
    // RunL doesn't have any Leaving calls. So no implementation here.
    return KErrNone;
}
Example #15
0
/*! \brief Executes IOCTLs

 Executes IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

 \param Pdx
   Pointer to the DEVICE_EXTENSION structure.

 \param Irp
   Pointer to an IRP structure that describes the requested I/O operation.

 \return
   If the routine succeeds, it returns STATUS_SUCCESS.
   Otherwise, it return one of the error status values:
   \n STATUS_SUCCESS              - Success.
   \n STATUS_BUFFER_TOO_SMALL     - Buffer too small.

 This function does not perform any validity checks on the input and
 output buffer! This should already been done in cbm_devicecontrol.
*/
NTSTATUS
cbm_execute_devicecontrol(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
{
    PPAR_SET_INFORMATION setInfo;
    PIO_STACK_LOCATION irpSp;
    ULONG_PTR returnLength;
    NTSTATUS ntStatus;

    FUNC_ENTER();

    // As not every IOCTL needs to return a value, we initialize
    // the return length here. This way, it needs only be altered
    // if the IOCTL returns some value.

    returnLength = 0;

    // get the current IRP stack location

    irpSp = IoGetCurrentIrpStackLocation(Irp);

    PERF_EVENT_IOCTL_EXECUTE(irpSp->Parameters.DeviceIoControl.IoControlCode);

    DBG_IRPPATH_EXECUTE("Execute Ioctl");

    // Call the appropriate function for processing the IOCTL
    // PrimaryAddresses are ANDed with 0x1F, as these are the only legitimate
    // primary addresses allowed for a IEC serial bus.

    switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {

    case CBMCTRL_TALK:
        DBG_IRP(CBMCTRL_TALK);
        ntStatus = cbmiec_talk(Pdx, INPUTVALUE(CBMT_TALK_IN)->PrimaryAddress & 0x1F,
                               INPUTVALUE(CBMT_TALK_IN)->SecondaryAddress);
        break;

    case CBMCTRL_LISTEN:
        DBG_IRP(CBMCTRL_LISTEN);
        ntStatus = cbmiec_listen(Pdx, INPUTVALUE(CBMT_LISTEN_IN)->PrimaryAddress & 0x1F,
                                 INPUTVALUE(CBMT_LISTEN_IN)->SecondaryAddress);
        break;

    case CBMCTRL_UNTALK:
        DBG_IRP(CBMCTRL_UNTALK);
        ntStatus = cbmiec_untalk(Pdx);
        break;

    case CBMCTRL_UNLISTEN:
        DBG_IRP(CBMCTRL_UNLISTEN);
        ntStatus = cbmiec_unlisten(Pdx);
        break;

    case CBMCTRL_OPEN:
        DBG_IRP(CBMCTRL_OPEN);
        ntStatus = cbmiec_open(Pdx, INPUTVALUE(CBMT_OPEN_IN)->PrimaryAddress & 0x1F,
                               INPUTVALUE(CBMT_OPEN_IN)->SecondaryAddress);
        break;

    case CBMCTRL_CLOSE:
        DBG_IRP(CBMCTRL_CLOSE);
        ntStatus = cbmiec_close(Pdx,INPUTVALUE(CBMT_CLOSE_IN)->PrimaryAddress & 0x1F,
                                INPUTVALUE(CBMT_CLOSE_IN)->SecondaryAddress);
        break;

    case CBMCTRL_RESET:
        DBG_IRP(CBMCTRL_RESET);
        ntStatus = cbmiec_reset(Pdx);
        break;

    case CBMCTRL_GET_EOI:
        DBG_IRP(CBMCTRL_GET_EOI);
        returnLength = sizeof(CBMT_GET_EOI_OUT);
        ntStatus = cbmiec_get_eoi(Pdx, &(OUTPUTVALUE(CBMT_GET_EOI_OUT)->Decision));
        break;

    case CBMCTRL_CLEAR_EOI:
        DBG_IRP(CBMCTRL_CLEAR_EOI);
        ntStatus = cbmiec_clear_eoi(Pdx);
        break;

    case CBMCTRL_PP_READ:
        DBG_IRP(CBMCTRL_PP_READ);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PP_READ_OUT), STATUS_SUCCESS);
        returnLength = sizeof(CBMT_PP_READ_OUT);
        ntStatus = cbmiec_pp_read(Pdx, &(OUTPUTVALUE(CBMT_PP_READ_OUT)->Byte));
        break;

    case CBMCTRL_PP_WRITE:
        DBG_IRP(CBMCTRL_PP_WRITE);
        ntStatus = cbmiec_pp_write(Pdx, INPUTVALUE(CBMT_PP_WRITE_IN)->Byte);
        break;

    case CBMCTRL_IEC_POLL:
        DBG_IRP(CBMCTRL_IEC_POLL);
        returnLength = sizeof(CBMT_IEC_POLL_OUT);
        ntStatus = cbmiec_iec_poll(Pdx, &(OUTPUTVALUE(CBMT_IEC_POLL_OUT)->Line));
        break;

    case CBMCTRL_IEC_SET:
        DBG_IRP(CBMCTRL_IEC_SET);
        ntStatus = cbmiec_iec_set(Pdx, INPUTVALUE(CBMT_IEC_SET_IN)->Line);
        break;

    case CBMCTRL_IEC_RELEASE:
        DBG_IRP(CBMCTRL_IEC_RELEASE);
        ntStatus = cbmiec_iec_release(Pdx, INPUTVALUE(CBMT_IEC_RELEASE_IN)->Line);
        break;

    case CBMCTRL_IEC_SETRELEASE:
        DBG_IRP(CBMCTRL_IEC_SETRELEASE);
        ntStatus = cbmiec_iec_setrelease(Pdx,
                                         INPUTVALUE(CBMT_IEC_SETRELEASE_IN)->State,
                                         INPUTVALUE(CBMT_IEC_SETRELEASE_IN)->Line);
        break;

    case CBMCTRL_IEC_WAIT:
        DBG_IRP(CBMCTRL_IEC_WAIT);
        returnLength = sizeof(CBMT_IEC_WAIT_OUT);
        ntStatus = cbmiec_iec_wait(Pdx, INPUTVALUE(CBMT_IEC_WAIT_IN)->Line,
                                   INPUTVALUE(CBMT_IEC_WAIT_IN)->State,
                                   &(OUTPUTVALUE(CBMT_IEC_WAIT_OUT)->Line));
        break;

    case CBMCTRL_PARBURST_READ:
        DBG_IRP(CBMCTRL_PARBURST_READ);
        returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
        ntStatus = cbmiec_parallel_burst_read(Pdx, &(OUTPUTVALUE(CBMT_PARBURST_PREAD_OUT)->Byte));
        break;

    case CBMCTRL_PARBURST_WRITE:
        DBG_IRP(CBMCTRL_PARBURST_READ);
        returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
        ntStatus = cbmiec_parallel_burst_write(Pdx, INPUTVALUE(CBMT_PARBURST_PWRITE_IN)->Byte);
        break;

    case CBMCTRL_PARBURST_READ_TRACK:
        DBG_IRP(CBMCTRL_PARBURST_READ_TRACK);
        returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
        ntStatus = cbmiec_parallel_burst_read_track(Pdx,
                   Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
        break;

    case CBMCTRL_PARBURST_WRITE_TRACK:
        DBG_IRP(CBMCTRL_PARBURST_WRITE_TRACK);
        returnLength = irpSp->Parameters.DeviceIoControl.InputBufferLength;
        ntStatus = cbmiec_parallel_burst_write_track(Pdx,
                   Irp->AssociatedIrp.SystemBuffer, (ULONG) returnLength);
        break;

    case CBMCTRL_I_INSTALL:
        DBG_IRP(CBMCTRL_I_INSTALL);
        returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
        ntStatus = cbm_install(Pdx, OUTPUTVALUE(CBMT_I_INSTALL_OUT), (PULONG) &returnLength);
        break;

    case CBMCTRL_PARPORT_LOCK:
        DBG_IRP(CBMCTRL_PARPORT_LOCK);
        ntStatus = cbm_lock(Pdx);
        break;

    case CBMCTRL_PARPORT_UNLOCK:
        DBG_IRP(CBMCTRL_PARPORT_UNLOCK);
        ntStatus = cbm_unlock(Pdx);
        break;

    case CBMCTRL_UPDATE:
        DBG_IRP(CBMCTRL_UPDATE);
        cbm_init_registry(NULL, Pdx);
        ntStatus = STATUS_SUCCESS;
        break;

#if DBG

    case CBMCTRL_I_READDBG:
        DBG_IRP(CBMCTRL_I_READDBG);
        returnLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
        ntStatus = cbm_dbg_readbuffer(Pdx, OUTPUTVALUE(CHAR), (PULONG) &returnLength);
        break;

#endif // #if DBG

    default:
        // As cbm_devicecontrol() already checked the IRP,
        // this piece of code should never be entered. If it
        // is, this is a sign of a forgotten IOCTL, or a severe
        // programming error

        DBG_ERROR((DBG_PREFIX "unknown IRP_MJ_DEVICE_CONTROL"));
        DBG_ASSERT(("THIS SHOULD NOT HAPPEN!", 0));
        ntStatus = STATUS_INVALID_PARAMETER;
        break;
    }

    // If an error occurred, make sure not to return anything.

    if (!NT_SUCCESS(ntStatus))
    {
        returnLength = 0;
    }

    // Complete the request:

    DBG_IRPPATH_COMPLETE("Execute Ioctl");
    QueueCompleteIrp(&Pdx->IrpQueue, Irp, ntStatus, returnLength);

    FUNC_LEAVE_NTSTATUS(ntStatus);
}
// ---------------------------------------------------------------------------
// CLbtCleanupItem::~CLbtCleanupItem
// ---------------------------------------------------------------------------
//
CLbtCleanupItem::~CLbtCleanupItem()
	{
	FUNC_ENTER("CLbtCleanupItem::~CLbtCleanupItem");
	iTriggers.Close();
	}
Example #17
0
/*! \brief Log an error entry in the system log

 Log an error entry in the system log.

 \param Fdo
   Pointer to a DEVICE_OBJECT structure. 
   This is the device object for the target device, 
   previously created by the driver's AddDevice routine.
 
 \param ErrorCode
   The NTSTATUS code which should be reported on behalf of
   this error log entry

 \param String1
   Pointer to the 1st (WCHAR) string which has to be included
   into the error log entry. This can be NULL if no string
   is to be inserted.

 \param String2
   Pointer to the 2nd (WCHAR) string which has to be included
   into the error log entry. This can be NULL if no string
   is to be inserted.
*/
VOID
LogError(IN PDEVICE_OBJECT Fdo,
         IN NTSTATUS ErrorCode,
         const WCHAR *String1,
         const WCHAR *String2)
{
    USHORT stringSize;
    USHORT stringOffset;
    USHORT stringSize1;
    USHORT stringSize2;
    USHORT size;
    USHORT numberOfStrings;

    FUNC_ENTER();

    // IoAllocateErrorLogEntry() and IoWriteErrorLogEntry() require this

    DBG_IRQL( <= DISPATCH_LEVEL);

    // calculate the size of the strings

    numberOfStrings = 0;

    // Check if there is a string 1, and calculate its size
    // (including the trailing zero)

    stringSize1 = String1 ? (++numberOfStrings, sizeof(WCHAR) * (wcslen(String1) + 1)) : 0;

    // Check if there is a string 2, and calculate its size
    // (including the trailing zero)

    stringSize2 = String2 ? (++numberOfStrings, sizeof(WCHAR) * (wcslen(String2) + 1)) : 0;

    // Add the sizes of both strings
    // This is the size of what has to be added to the error log entry

    stringSize = stringSize1 + stringSize2;

    // Offset where the string(s) will be written into the error log entry

    stringOffset = sizeof(IO_ERROR_LOG_PACKET);

    // The complete size of the event log entry

    size = stringOffset + stringSize;

    // Make sure we don't need more space than needed.
    // For debugging purposes, have an DBG_ASSERT(). Anyway,
    // in the wild, don't do anything if the size is too big.
    // Remember: Not being able to write a log is not an error!

    /*! \todo Would it make sense to short the strings if the
     * error log entry would be too big?
     */

    DBG_ASSERT(size <= ERROR_LOG_MAXIMUM_SIZE);

    if (size <= ERROR_LOG_MAXIMUM_SIZE) 
    {
        PIO_ERROR_LOG_PACKET pentry;

        // allocate the entry for the error log

        DBG_IRQL( <= DISPATCH_LEVEL);
        pentry = IoAllocateErrorLogEntry(Fdo, (UCHAR) size);

        DBG_ASSERT(pentry);
        if (pentry) {

            // clear the complete entry (to be sure)

            RtlZeroMemory(pentry, sizeof(*pentry));

            // Write the relevant entries

            pentry->NumberOfStrings = numberOfStrings;
            pentry->StringOffset = stringOffset;
            pentry->ErrorCode = ErrorCode;

            // If there was a string1, write that into the entry

            if (String1)
            {
                wcscpy((wchar_t*)&((UCHAR*)pentry)[stringOffset], String1);
            }

            // If there was a string2, write that into the entry

            if (String2)
            {
                wcscpy((wchar_t*)&((UCHAR*)pentry)[stringOffset + stringSize1], String2);
            }

            // Now, give that entry to the system

            DBG_IRQL( <= DISPATCH_LEVEL);
            IoWriteErrorLogEntry(pentry);
        }
    }
void CLbtContainerAttrFilter::ProcessFilter(CLbtContainerTriggerEntry* aEntry,TInt& aIsFilterPresent,TBool& aIsEntryRequested  )
	{
	FUNC_ENTER("CLbtContainerAttrFilter::ProcessFilter");
	TInt isFilterPresent = 0;
	TBool isEntryRequested=EFalse;
	if(aEntry)
		{
		CLbtTriggerEntry* trigEntry=aEntry->TriggerEntry();
        CLbtExtendedTriggerInfo* contExtInfo=aEntry->ExtendedTriggerInfo();
        TInt i=0;
        if(trigEntry!=NULL)
        	{
            if( iTriggerStateArray.Count()>0 )
            	{
                 isFilterPresent++;
                 for(i=0;i<iTriggerStateArray.Count();i++)
 	                {
                    if(trigEntry->State()==iTriggerStateArray[i])
                        {
                        isEntryRequested=ETrue;
                        break;
                        }
                    }
                }
            if( (isFilterPresent>0 && isEntryRequested ) || 
                (isFilterPresent==0) )
                {
                	if(iTriggerValidityArray.Count()>0)
                		{
                isFilterPresent++;
                isEntryRequested=EFalse;
                for(i=0;i<iTriggerValidityArray.Count();i++)
                   {
                   if(aEntry->DynInfo()->iValidity == iTriggerValidityArray[i])
                      {
                      isEntryRequested=ETrue;
                      }                
                   }
                }
              }
                   
            if((isFilterPresent>0 && isEntryRequested && iTriggerTypeArray.Count()>0) || (iTriggerTypeArray.Count()>0 && isFilterPresent==0))
                {
                 isFilterPresent++;
                 isEntryRequested=EFalse;
                 for(i=0;i<iTriggerTypeArray.Count();i++)
                    {
                    if(trigEntry->Type()==iTriggerTypeArray[i])
                       {
                       isEntryRequested=ETrue;
                       }
                
                    }
                 }
                   
            if((isFilterPresent>0 && isEntryRequested && iIdArray.Count()>0) || (iIdArray.Count()>0 && isFilterPresent==0 ))
                {
                isFilterPresent++;
                isEntryRequested=EFalse;
                for(i=0;i<iIdArray.Count();i++)
                    {
                    if(trigEntry->Id()==iIdArray[i])
                        {
                        isEntryRequested=ETrue;
                        }
                    }

                 }
                    
            if((isFilterPresent>0 && isEntryRequested && iManagerUiArray.Count()>0) || (iManagerUiArray.Count()>0 && isFilterPresent==0 )) 
                {
                isFilterPresent++;
                isEntryRequested=EFalse;
                for(i=0;i<iManagerUiArray.Count();i++)
                    {
                    if(trigEntry->ManagerUi()==iManagerUiArray[i])
                        {
                        isEntryRequested=ETrue;
                        }
                    }
                }
             
            if((isFilterPresent>0 && isEntryRequested && iStartupProcessArray.Count()>0) || (iStartupProcessArray.Count()>0 && isFilterPresent==0 )) 
                {
                // This filter applies to only startup triggers
                if( trigEntry->Type() == CLbtTriggerEntry::ETypeStartup )
                	{
                	CLbtStartupTrigger* startupTrigger = static_cast<CLbtStartupTrigger*>(trigEntry);
                	isFilterPresent++;
	                isEntryRequested=EFalse;
	                
	                TFileName fileName;
                	TSecureId secureId;
	                startupTrigger->GetProcessId(fileName, secureId);
					
					// Append the EXE extension
	                if (fileName.LocateReverse('.') == KErrNotFound)
						{
						if (fileName.Length() + 4 > KMaxFileName)
							return;
						fileName.Append( KFileExtensionExe );
						}

					LOGSTRING( "Trigger File Name : \"%S\" ", &fileName );
	                for(i=0;i<iStartupProcessArray.Count();i++)
	                    {
						LOGSTRING( "Filter startup name: \"%S\" ", &iStartupProcessArray[i] );
	                    if( FilesIdentical(fileName, iStartupProcessArray[i] ) )
	                    	{
	                    	LOG("Files Are Identical");
	                    	isEntryRequested=ETrue;
	                    	break;
	                    	}
	                    }
                	}                
                }
                
           }// end of if(trigEntry!=NULL)
              
             if(contExtInfo!=NULL)
             	{
                 if((isFilterPresent>0 && isEntryRequested && iHystRadiusArray.Count()>0) || (iHystRadiusArray.Count()>0 && isFilterPresent==0 ))  
                    {
                    isFilterPresent++;
                    isEntryRequested=EFalse;
                    for(i=0;i<iHystRadiusArray.Count();i++)
                	    {
                	    if(contExtInfo->HysteresisRadius()==iHystRadiusArray[i])
                    	    {                    	    
                            isEntryRequested=ETrue;
                    	    }                        
                	    }
                    }
                     
                    
                    if((isFilterPresent>0 && isEntryRequested && iTriggerFiredArray.Count()>0) || (iTriggerFiredArray.Count()>0 && isFilterPresent==0 ))  
                        {
                        isFilterPresent++;
                        isEntryRequested=EFalse;
                        for(i=0;i<iTriggerFiredArray.Count();i++)
                    	    {
                    	    if(contExtInfo->IsTriggerFired()==iTriggerFiredArray[i])
                    		    {
                                isEntryRequested=ETrue;
                        
                    		    }
                   		    }
                        }

                     if((isFilterPresent>0 && isEntryRequested && iSidArray.Count()>0) || (iSidArray.Count()>0 && isFilterPresent==0 ))  
                        {
                        isFilterPresent++;
                        isEntryRequested=EFalse;
                        for(i=0;i<iSidArray.Count();i++)
                    	    {
                    	    if(contExtInfo->OwnerSid()==iSidArray[i])
                        	    {                        	    
                                isEntryRequested=ETrue;
                        	    }
                            
                    	    }
                        }
                        
                      if((isFilterPresent>0 && isEntryRequested && iTriggerFireOnCreationArray.Count()>0) || (iTriggerFireOnCreationArray.Count()>0 && isFilterPresent==0 ))  
                        {
                        isFilterPresent++;
                        isEntryRequested=EFalse;
                        for(i=0;i<iTriggerFireOnCreationArray.Count();i++)
                    	    {
                    	    if(contExtInfo->IsTriggerFireOnCreation()==iTriggerFireOnCreationArray[i])
                        	    {
                        	    
                                isEntryRequested=ETrue;
                        	    }
                            
                    	    }
                        }          
                    
                    } // end of if(contExtInfo!=NULL)                  
        
		}//end of if(aEntry)
	aIsFilterPresent = isFilterPresent;
	aIsEntryRequested = isEntryRequested;
	}
Example #19
0
static int v4l2_case_measure(void* user_ptr, int test_num)
{
	FUNC_ENTER();
	int max_width;
	int max_height;
	v4l2_data* data = (v4l2_data*)user_ptr;

	BLTS_DEBUG("Test number %i:\n", test_num);
	if(!open_device (data->device))
	{
		BLTS_DEBUG("Can't open device %s\n", data->device->dev_name);
		FUNC_LEAVE();
		return -1;
	}

	if(init_device (data->device, MAX_WIDTH, MAX_HEIGHT))
	{
		BLTS_DEBUG("Maximum resolution is: %ix%i\n", data->device->format.fmt.pix.width, data->device->format.fmt.pix.height);
		BLTS_DEBUG("Measuring FPS on maximum resolution\n");

		max_width = data->device->format.fmt.pix.width;
		max_height = data->device->format.fmt.pix.height;
		BLTS_DEBUG("-----------------------\n");
		BLTS_DEBUG("%ix%i resolution\n", max_width, max_height);
		BLTS_DEBUG("-----------------------\n");

		if(!start_capturing (data->device))
			goto err;
		mainloop (data->device, LOOPS);

		stop_capturing (data->device);
		uninit_device (data->device);
		close_device (data->device);
	}
	else
	{
		BLTS_DEBUG("Can't initialize device\n");
		goto err;
	}

	BLTS_DEBUG("Stepping down resolutions and calculating FPS\n");

	int step_size_x, step_size_y, i, x, y;


	step_size_x = max_width / 10;
	step_size_y = max_height / 10;

	for(i=1; i<8; i++)
	{
		x = max_width - step_size_x * i;
		y = max_height - step_size_y * i;
		BLTS_DEBUG("-----------------------\n");
		BLTS_DEBUG("%ix%i resolution\n", x, y);
		BLTS_DEBUG("-----------------------\n");
		if(!open_device (data->device))
			goto err;

		if(init_device (data->device, x, y))
		{
			BLTS_DEBUG("Resolution is: %ix%i\n", x, y);
			if(!start_capturing (data->device))
				goto err;

			if(!mainloop (data->device, LOOPS))
				goto err;

			stop_capturing (data->device);
			uninit_device (data->device);
		}
		else
		{
			BLTS_DEBUG("Can't initialize device\n");
			goto err;
		}

		close_device (data->device);
	}
	FUNC_LEAVE();
	return 0;

err:
	stop_capturing(data->device);
	uninit_device(data->device);
	close_device(data->device);
	FUNC_LEAVE();
	return -1;
}
// ---------------------------------------------------------------------------
// CLbtAppChangeHandler::RunL
// ---------------------------------------------------------------------------
//
void CLbtAppChangeHandler::RunL()
	{
	FUNC_ENTER("CLbtAppChangeHandler::RunL");
	switch(iOperation)
		{
		case EOpRegiseteredForInitialListPoplulation:
			{
			// First get the set of installed applications in the system
			iAppArcSession.GetAllApps();
			
			TApaAppInfo appInfo;
			TInt error = iAppArcSession.GetNextApp(appInfo);
			
			while(KErrNone == error)
				{
		        TLbtAppInfo lbtAppInfo;
		        lbtAppInfo.iUid = appInfo.iUid;
		        lbtAppInfo.iFullName.Zero();
		        lbtAppInfo.iFullName.Copy( appInfo.iFullName );

				iCurrentInstalledApps.AppendL(lbtAppInfo);
				error = iAppArcSession.GetNextApp(appInfo);
				}
			iOperation = EOpNone;
			break;
			}
		case EOpRegiseteredForListPoplulation:
			{
			HandleAppListEvent(KErrNone);
			break;
			}
		case EOpRemovalTriggerDeletion:
			{
			// Here the observer is set to the get the information pertaining
            // triggers that were deleted.
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerDeleted;
            iContainer.SetChangeObserver( this,eventMask );
            
			// Delete triggers for which the un-installed application is the 
			// startup process
			iOperation = EOpDeletionStartupProcessTriggers;
			DeleteTriggersOfStartupProcessL();
			break;
			}
		case EOpRemovalListingStartupProcessTriggers:
			{
			// Here the observer is set to the get the information pertaining
            // triggers that were deleted.
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerDeleted;
            iContainer.SetChangeObserver( this,eventMask );
            
			CLbtContainerFilter* containerFilter = CLbtContainerFilter::NewL();
			CleanupStack::PushL(containerFilter);
			
			for(TInt i=0;i<iAppList.Count();++i)
				{
				containerFilter->AddOwnerSidInFilterL(iAppList[i].iUid);
				}
			
			CLbtTriggerFilterByAttribute* filterByAttribute = 
						CLbtTriggerFilterByAttribute::NewL();
			CleanupStack::PushL(filterByAttribute);
			filterByAttribute->AddTriggerTypeL(CLbtTriggerEntry::ETypeStartup);
			
			CLbtContainerUpdateFilter* updateFilter = CLbtContainerUpdateFilter::NewL(filterByAttribute ,containerFilter);
			
			iContainer.DeleteTriggers(updateFilter, iOpId, iStatus);
			SetActive();
			iOperation = EOpRemovalDeletingStartupProcessTriggers;
			break;
			}
		case EOpRemovalDeletingStartupProcessTriggers:
		    {
		    // Here the observer is set to the get the information pertaining
            // triggers that were deleted.
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerDeleted;
            iContainer.SetChangeObserver( this,eventMask );
		    break;
		    }
			
		case EOpMMCInsertionListingTriggers:			
		case EOpMMCRemovalListingTriggers:
			{
			// Listing Triggers of startup process
			LOG("Listing Triggers Over");
			
			if( iOperation == EOpMMCInsertionListingTriggers )
				{
				iOperation = EOpMMCInsertionListingTriggerForStartupProcess;
				}
			else
				{
				iOperation = EOpMMCRemovalListingTriggerForStartupProcess;
				}
		
			ListTriggersOfStartupProcessL();
			iAppList.Close();
			LOG("Listing Triggers for startup Process");
			break;
			}
		case EOpMMCRemovalListingTriggerForStartupProcess:
		case EOpMMCInsertionListingTriggerForStartupProcess:
			{
			LOG("Listing Trigger For startup Process Done");
			LOG1("iStatus = %d", iStatus.Int());
			LOG1("Triggers Count = %d", iTriggerEntries.Count());
			if(KErrNone == iStatus.Int())
				{
				// The list operation is a success. Hence invalidate the triggers now
				RArray<TLbtTriggerId> triggerIds;
				
				for(TInt i=0;i<iTriggerEntries.Count();++i)
					{
					triggerIds.AppendL(iTriggerEntries[i]->TriggerEntry()->Id());
					}
				
				TLbtTriggerDynamicInfo::TLbtTriggerValidity validity;
				
				if(iOperation == EOpMMCRemovalListingTriggerForStartupProcess)
					{
					validity = TLbtTriggerDynamicInfo::EInvalid;
					iCleanupHandler.AddTriggersForCleanupL( triggerIds );
					}
				else
					{
					validity = TLbtTriggerDynamicInfo::EValid;
					iCleanupHandler.RemoveTriggersFromCleanupL( triggerIds );
					}
			    
				// update validity of the triggers
				iContainer.UpdateTriggersValidity( validity,
												   triggerIds,
												   iOpId,
												   iStatus );
				SetActive();				
				iOperation = EOpRequestValidityChange;
				triggerIds.Close();
				iTriggerEntries.ResetAndDestroy();
				}
			else
				{
				// Listing is not successful. Hence dont do anything
				iOperation = EOpNone;
				iTriggerEntries.ResetAndDestroy();
				iAppList.Reset();
				}
			break;
			}
		case EOpRequestValidityChange:
		    {
		    // Here the observer is set to the get the information pertaining
            // triggers that were changed to invalid
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerValidityFieldChanged;
            iContainer.SetChangeObserver( this,eventMask );
            break;
		    }
		default:
			{
			// Operation complete
			iTriggerEntries.ResetAndDestroy();
			iAppList.Close();
			iOperation = EOpNone;
			break;			
			}
		}
	}
Example #21
0
Encode_Status VaapiEncoderBase::getMaxOutSize(uint32_t *maxSize)
{
    FUNC_ENTER();
    *maxSize = 0;
    return ENCODE_SUCCESS;
}
// ---------------------------------------------------------------------------
// CLbtAppChangeHandler::ConstructL
// ---------------------------------------------------------------------------
//
void CLbtAppChangeHandler::ConstructL()
	{
	FUNC_ENTER("CLbtAppChangeHandler::ConstructL");
	User::LeaveIfError(iAppArcSession.Connect());
	MemoryCardChar();
	}
Example #23
0
Encode_Status VaapiEncoderBase::stop(void)
{
    FUNC_ENTER();
    cleanupVA();
    return ENCODE_SUCCESS;
}
static void ppm_lcmoff_early_suspend(struct early_suspend *h)
{
	FUNC_ENTER(FUNC_LV_POLICY);
	ppm_lcmoff_switch(0);
	FUNC_EXIT(FUNC_LV_POLICY);
}
Example #25
0
void
smap_start(struct ifnet *ifp)
{
	struct smap_softc *sc = ifp->if_softc;
	struct smap_desc *d;
	struct mbuf *m0, *m;
	u_int8_t *p, *q;
	u_int32_t *r;
	int i, sz, pktsz;
	u_int16_t fifop;
	u_int16_t r16;

	KDASSERT(ifp->if_flags & IFF_RUNNING);
	FUNC_ENTER();

	while (1) {
		IFQ_POLL(&ifp->if_snd, m0);
		if (m0 == NULL)
			goto end;

		pktsz = m0->m_pkthdr.len;
		KDASSERT(pktsz <= ETHER_MAX_LEN - ETHER_CRC_LEN);
		sz = ROUND4(pktsz);

		if (sz > sc->tx_buf_freesize ||
		    sc->tx_desc_cnt >= SMAP_DESC_MAX ||
		    emac3_tx_done() != 0) {
			ifp->if_flags |= IFF_OACTIVE;
			goto end;
		}

		IFQ_DEQUEUE(&ifp->if_snd, m0);
		KDASSERT(m0 != NULL);
		if (ifp->if_bpf)
			bpf_mtap(ifp->if_bpf, m0);

		p = (u_int8_t *)sc->tx_buf;
		q = p + sz;
		/* copy to temporary buffer area */
		for (m = m0; m != 0; m = m->m_next) {
			memcpy(p, mtod(m, void *), m->m_len);
			p += m->m_len;
		}
		m_freem(m0);

		/* zero padding area */
		for (; p < q; p++)
			*p = 0;

		/* put to FIFO */
		fifop = sc->tx_fifo_ptr;
		KDASSERT((fifop & 3) == 0);
		_reg_write_2(SMAP_TXFIFO_PTR_REG16, fifop);
		sc->tx_fifo_ptr = (fifop + sz) & 0xfff;

		r = sc->tx_buf;
		for (i = 0; i < sz; i += sizeof(u_int32_t))
			*(volatile u_int32_t *)SMAP_TXFIFO_DATA_REG = *r++;
		_wbflush();

		/* put FIFO to EMAC3 */
		d = &sc->tx_desc[sc->tx_start_index];
		KDASSERT((d->stat & SMAP_TXDESC_READY) == 0);

		d->sz = pktsz;
		d->ptr = fifop + SMAP_TXBUF_BASE;
		d->stat = SMAP_TXDESC_READY | SMAP_TXDESC_GENFCS |
		    SMAP_TXDESC_GENPAD;
		_wbflush();

		sc->tx_buf_freesize -= sz;
		sc->tx_desc_cnt++;
		sc->tx_start_index = (sc->tx_start_index + 1) & 0x3f;
		_reg_write_1(SMAP_TXFIFO_FRAME_INC_REG8, 1);

		emac3_tx_kick();
		r16 = _reg_read_2(SPD_INTR_ENABLE_REG16);
		if ((r16 & SPD_INTR_TXDNV) == 0) {
			r16 |= SPD_INTR_TXDNV;
			_reg_write_2(SPD_INTR_ENABLE_REG16, r16);
		}
	}
 end:
	/* set watchdog timer */
	ifp->if_timer = 5;

	FUNC_EXIT();
}
static void ppm_lcmoff_late_resume(struct early_suspend *h)
{
	FUNC_ENTER(FUNC_LV_POLICY);
	ppm_lcmoff_switch(1);
	FUNC_EXIT(FUNC_LV_POLICY);
}
Example #27
0
Encode_Status VaapiEncoderH264::getMVBufferSize(uint32_t *Size)
{
    FUNC_ENTER();
    *Size = sizeof(VAMotionVectorIntel)*16*m_mbWidth*m_mbHeight;
    return ENCODE_SUCCESS;
}
Example #28
0
/*! \brief Services IOCTLs

 Services IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

 \param Fdo
   Pointer to a DEVICE_OBJECT structure.
   This is the device object for the target device,
   previously created by the driver's AddDevice routine.

 \param Irp
   Pointer to an IRP structure that describes the requested I/O operation.

 \return
   If the routine succeeds, it returns STATUS_SUCCESS.
   Otherwise, it return one of the error status values:
   \n STATUS_SUCCESS              - Success.
   \n STATUS_PENDING              - Request pending.
   \n STATUS_BUFFER_TOO_SMALL     - Buffer too small.
   \n STATUS_INVALID_PARAMETER    - Invalid io control request.

 The driver's DriverEntry routine stored this routine's address in
 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL].

 Generally, all Dispatch routines execute in an arbitrary thread context
 at IRQL PASSIVE_LEVEL, but there are exceptions.
*/
NTSTATUS
cbm_devicecontrol(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
{
    PPAR_SET_INFORMATION setInfo;
    PIO_STACK_LOCATION irpSp;
    PDEVICE_EXTENSION pdx;
    NTSTATUS ntStatus;
    BOOLEAN fastStart;

    FUNC_ENTER();

    // get the device extension

    pdx = Fdo->DeviceExtension;

    // get the current IRP stack location

    irpSp = IoGetCurrentIrpStackLocation(Irp);


    DBG_IRPPATH_PROCESS("Ioctl");

    // assume we do not want to perform a faststart of this IRP

    fastStart = FALSE;

    // Now, check the input and/or output buffers of the given
    // IOCTLs if they are at least as big as the specification.
    // If not, the IRP (and thus the IOCTL) is failed

    switch (irpSp->Parameters.DeviceIoControl.IoControlCode) {

    case CBMCTRL_TALK:
        DBG_IRP(CBMCTRL_TALK);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_TALK_IN), STATUS_SUCCESS);
        break;

    case CBMCTRL_LISTEN:
        DBG_IRP(CBMCTRL_LISTEN);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_LISTEN_IN), STATUS_SUCCESS);
        break;

    case CBMCTRL_UNTALK:
        DBG_IRP(CBMCTRL_UNTALK);
        ntStatus = STATUS_SUCCESS;
        break;

    case CBMCTRL_UNLISTEN:
        DBG_IRP(CBMCTRL_UNLISTEN);
        ntStatus = STATUS_SUCCESS;
        break;

    case CBMCTRL_OPEN:
        DBG_IRP(CBMCTRL_OPEN);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_OPEN_IN), STATUS_SUCCESS);
        break;

    case CBMCTRL_CLOSE:
        DBG_IRP(CBMCTRL_CLOSE);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_CLOSE_IN), STATUS_SUCCESS);
        break;

    case CBMCTRL_RESET:
        DBG_IRP(CBMCTRL_RESET);
        ntStatus = STATUS_SUCCESS;
        break;

    case CBMCTRL_GET_EOI:
        DBG_IRP(CBMCTRL_GET_EOI);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_GET_EOI_OUT), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_CLEAR_EOI:
        DBG_IRP(CBMCTRL_CLEAR_EOI);
        ntStatus = STATUS_SUCCESS;
        fastStart = TRUE;
        break;

    case CBMCTRL_PP_READ:
        DBG_IRP(CBMCTRL_PP_READ);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PP_READ_OUT), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_PP_WRITE:
        DBG_IRP(CBMCTRL_PP_WRITE);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_PP_WRITE_IN), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_IEC_POLL:
        DBG_IRP(CBMCTRL_IEC_POLL);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_IEC_POLL_OUT), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_IEC_SET:
        DBG_IRP(CBMCTRL_IEC_SET);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_SET_IN), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_IEC_RELEASE:
        DBG_IRP(CBMCTRL_IEC_RELEASE);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_RELEASE_IN), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_IEC_SETRELEASE:
        DBG_IRP(CBMCTRL_IEC_SETRELEASE);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_SETRELEASE_IN), STATUS_SUCCESS);
        fastStart = TRUE;
        break;

    case CBMCTRL_IEC_WAIT:
        DBG_IRP(CBMCTRL_IEC_WAIT);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_IEC_WAIT_OUT),
                                         cbm_checkinputbuffer(irpSp, sizeof(CBMT_IEC_WAIT_IN), STATUS_SUCCESS));
        break;

    case CBMCTRL_PARBURST_READ:
        DBG_IRP(CBMCTRL_PARBURST_READ);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_PARBURST_PREAD_OUT), STATUS_SUCCESS);
        break;

    case CBMCTRL_PARBURST_WRITE:
        DBG_IRP(CBMCTRL_PARBURST_WRITE);
        ntStatus = cbm_checkinputbuffer(irpSp, sizeof(CBMT_PARBURST_PWRITE_IN), STATUS_SUCCESS);
        break;

    case CBMCTRL_PARBURST_READ_TRACK:
        DBG_IRP(CBMCTRL_PARBURST_READ_TRACK);
        ntStatus = cbm_checkoutputbuffer(irpSp, 1, STATUS_SUCCESS);
        break;

    case CBMCTRL_PARBURST_WRITE_TRACK:
        DBG_IRP(CBMCTRL_PARBURST_WRITE_TRACK);
        ntStatus = cbm_checkinputbuffer(irpSp, 1, STATUS_SUCCESS);
        break;

    case CBMCTRL_I_INSTALL:
        DBG_IRP(CBMCTRL_I_INSTALL);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CBMT_I_INSTALL_OUT), STATUS_SUCCESS);
        break;

    case CBMCTRL_PARPORT_LOCK:
        DBG_IRP(CBMCTRL_PARPORT_LOCK);
        ntStatus = STATUS_SUCCESS;
        break;

    case CBMCTRL_PARPORT_UNLOCK:
        DBG_IRP(CBMCTRL_PARPORT_UNLOCK);
        ntStatus = STATUS_SUCCESS;
        break;

    case CBMCTRL_UPDATE:
        DBG_IRP(CBMCTRL_UPDATE);
        ntStatus = STATUS_SUCCESS;
        fastStart = TRUE;
        break;

#if DBG

    case CBMCTRL_I_READDBG:
        DBG_IRP(CBMCTRL_I_READDBG);
        ntStatus = cbm_checkoutputbuffer(irpSp, sizeof(CHAR), STATUS_SUCCESS);
        break;

#endif // #if DBG

    default:
        DBG_ERROR((DBG_PREFIX "unknown IRP_MJ_DEVICE_CONTROL"));
        ntStatus = STATUS_INVALID_PARAMETER;
        break;
    }

    if (NT_SUCCESS(ntStatus))
    {
        PERF_EVENT_IOCTL_QUEUE(irpSp->Parameters.DeviceIoControl.IoControlCode);

        // queue the IRP to be processed
        // If faststart is TRUE, it will be processed immediately
        // (for performance reasons)

        ntStatus = QueueStartPacket(&pdx->IrpQueue, Irp, fastStart, Fdo);
    }
    else
    {
        // there was an error, complete the request
        // with that error status

        QueueCompleteIrp(NULL, Irp, ntStatus, 0);
    }

    FUNC_LEAVE_NTSTATUS(ntStatus);
}
// ---------------------------------------------------------------------------
// CLbtCreateTriggerAOOperation::CreateTriggerL()
// ---------------------------------------------------------------------------
//
void CLbtCreateTriggerAOOperation::CreateTriggerL()
	{
	FUNC_ENTER("CLbtCreateTriggerAOOperation::CreateTriggerL");
	// Copy the trigger entry object descriptor from the client IPC message
	HBufC8* triggerEntryBuffer = LbtGlobal::CopyClientBuffer8LC(iMessage, KParamTriggerEntry);
	
	if( triggerEntryBuffer == NULL )
		{
		iObserver.HandleOperationClosureL(this, KErrBadDescriptor);
		return;
		}
	
	TLbtTriggerCreationInfo triggerCreationInfo;
	
	TPckg<TLbtTriggerCreationInfo> des(triggerCreationInfo);
	LbtGlobal::Read(iMessage,2,des);

		
	// Read the buffer into a stream
	RDesReadStream stream(*triggerEntryBuffer);
	CleanupClosePushL(stream);
	
	// Create the trigger entry object based on the type of trigger
	CLbtTriggerEntry* trigger;
	if( triggerCreationInfo.iTriggerType== CLbtTriggerEntry::ETypeStartup)
		{
		trigger = CLbtStartupTrigger::NewLC();
		}
	else
		{
		trigger = CLbtSessionTrigger::NewLC();
		}
		
	// Internalize the trigger entry class since it is a "C" class
	trigger->InternalizeL(stream);	
		
	// Fill the extended trigger info required by Stratergy
	CLbtExtendedTriggerInfo::TLbtTriggerRectArea area;
		
	if(trigger->GetCondition()->Type() == CLbtTriggerConditionBase::ETriggerConditionArea)
		{
		// Get the condition area base
		CLbtTriggerConditionArea* conditionArea = 
				static_cast<CLbtTriggerConditionArea*>(trigger->GetCondition());
		
		// Check if the area is a circle
		if(conditionArea->TriggerArea()->Type() == CLbtGeoAreaBase::ECircle)
			{
			CLbtGeoCircle* circle = static_cast<CLbtGeoCircle*>(conditionArea->TriggerArea());
			
			// If the triggering area specified is less than the minimum triggering area
			// the return KErrTriggerAreaTooSmall
			
			if(circle->Radius() < iSettingsManager.MinimumTriggeringArea())
				{
				CleanupStack::PopAndDestroy( 3 ); // trigger,stream,triggerEntry
				LbtGlobal::RequestComplete(iMessage, KErrTriggerAreaTooSmall);
				iObserver.HandleOperationClosureL(this, KErrTriggerAreaTooSmall);
				return;
				}

            CalculateRectangularArea(area, circle);
			}
		}
		
	// Create the extended trigger info
	CLbtExtendedTriggerInfo* extendedTriggerInfo = 
							CLbtExtendedTriggerInfo::NewL(area,
														  CalculateHysteresisAreaForTrigger(*trigger),
														  EFalse,
														  KNullDesC8,
														  iMessage.SecureId(),
														  triggerCreationInfo.iFireOnCreation);
	CleanupStack::PushL(extendedTriggerInfo);
	
	TLbtTriggerDynamicInfo* dynInfo = new (ELeave) TLbtTriggerDynamicInfo;
	CleanupStack::PushL(dynInfo);
	dynInfo->iValidity = TLbtTriggerDynamicInfo::EValid;
	

		
	// Create trigger class of Container. Container takes ownership of trigger and all info sent to it
	iContainerTriggerEntry = CLbtContainerTriggerEntry::NewL(trigger, dynInfo, extendedTriggerInfo);
	
	// Register for container change event observer
    TLbtTriggerEventMask eventMask = 0;
    eventMask|= CLbtContainer::ELbtConTriggerCreated;
                
    iContainer.SetChangeObserver( this ,eventMask );
	
	// Creates the trigger in the container		
	iContainer.CreateTrigger(*iContainerTriggerEntry,iAOIdentificationNum,iStatus);
	SetActive();
	
	CleanupStack::Pop(5); //trigger, stream, triggerEntryBuffer, dynInfo and extendedTriggerInfo
	stream.Close();
	delete triggerEntryBuffer;
	}
Example #30
0
/*! \brief Initialize the knowledge on a parallel port

 This function gets some knowledge on a parallel port,
 and stores this info into the given DEVICE_EXTENSION.

 \param ParallelPortName
   UNICODE_STRING which holds the name of the parallel port driver

 \param Pdx
   Device extension which will be initialized with the needed
   knowledge on the parallel port.

 This function should be called before any other parallel port
 function is called. Usually, it is done in the driver's 
 AddDevice (WDM) or DriverEntry (WKM, WDM) function.

 One of the purposes of this function is to make sure the
 parallel port driver is not unloaded from memory (via 
 IoGetDeviceObjectPointer()).

 This function must be run at IRQL == PASSIVE_LEVEL.
*/
NTSTATUS
ParPortInit(PUNICODE_STRING ParallelPortName, PDEVICE_EXTENSION Pdx)
{
    NTSTATUS ntStatus;

    FUNC_ENTER();

    DBG_ASSERT(ParallelPortName);
    DBG_ASSERT(Pdx);

    // First of all, get the PDEVICE_OBJECT of the parallel port driver

    DBG_IRQL( == PASSIVE_LEVEL);
    ntStatus = IoGetDeviceObjectPointer(ParallelPortName, 
                                        FILE_READ_ATTRIBUTES,
                                        &Pdx->ParallelPortFileObject,
                                        &Pdx->ParallelPortFdo);

    if (!NT_SUCCESS(ntStatus))
    {
        DBG_WARN((DBG_PREFIX "IoGetDeviceObjectPointer() FAILED!"));
        FUNC_LEAVE_NTSTATUS(ntStatus);
    }

    // Allocate memory to hold to parallel port info

    DBG_IRQL( == PASSIVE_LEVEL);
    Pdx->PortInfo = (PPARALLEL_PORT_INFORMATION) ExAllocatePoolWithTag(NonPagedPool, 
        sizeof(*Pdx->PortInfo), MTAG_PPINFO);

    // If we got memory, get the info out of the parallel port driver

    if (Pdx->PortInfo)
    {
        ntStatus = ParPortIoctlInOut(Pdx, IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO,
                                     NULL, 0,
                                     Pdx->PortInfo, sizeof(*Pdx->PortInfo));
    }
    else
    {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (NT_SUCCESS(ntStatus))
    {
        Pdx->ParPortPortAddress = Pdx->PortInfo->Controller;
        DBG_PPORT((DBG_PREFIX "Got parallel port information:"));
        DBG_PPORT((DBG_PREFIX "- OriginalController = 0x%p", Pdx->PortInfo->OriginalController));
        DBG_PPORT((DBG_PREFIX "- Controller         = 0x%p", Pdx->PortInfo->Controller));
        DBG_PPORT((DBG_PREFIX "- Span of controller = 0x%08x", Pdx->PortInfo->SpanOfController));
        DBG_PPORT((DBG_PREFIX "- TryAllocatePort    = 0x%p", Pdx->PortInfo->TryAllocatePort));
        DBG_PPORT((DBG_PREFIX "- FreePort           = 0x%p", Pdx->PortInfo->FreePort));
        DBG_PPORT((DBG_PREFIX "- QueryNumWaiters    = 0x%p", Pdx->PortInfo->QueryNumWaiters));
        DBG_PPORT((DBG_PREFIX "- Context            = 0x%p", Pdx->PortInfo->Context));
    }

    // if we failed getting the parallel port info, but there was memory
    // allocated, free the memory.

    if (!NT_SUCCESS(ntStatus) && Pdx->PortInfo)
    {
        DBG_IRQL( < DISPATCH_LEVEL);
        ExFreePool(Pdx->PortInfo);
        Pdx->PortInfo = NULL;
    }