www.pudn.com > camera.rar > qci_ioctl.cpp


// 
// Copyright (c) Microsoft Corporation.  All rights reserved. 
// 
// 
// Use of this sample source code is subject to the terms of the Microsoft 
// license agreement under which you licensed this sample source code. If 
// you did not accept the terms of the license agreement, you are not 
// authorized to use this sample source code. For the terms of the license, 
// please see the license agreement between you and Microsoft or, if applicable, 
// see the LICENSE.RTF on your install media or the root of your tools installation. 
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES. 
// 
// 
// (C) Copyright 2006 Marvell International Ltd. 
// All Rights Reserved 
// 
 
#include  
#include  
#include "pdd_private.h" 
#include "qci.h" 
 
 
void CCameraPdd::qci_clock_enable(BOOL is_on) 
{ 
    DWORD bytes_return;         
    BusIoControl(qci_bus, IOCTL_QCI_CLOCK_ENABLE, 
                 (LPVOID)&is_on, sizeof(is_on), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
 
// to access qci bus driver 
void CCameraPdd::qci_enable() 
{ 
    DWORD bytes_return; 
    BusIoControl(qci_bus, IOCTL_QCI_ENABLE, 
                 NULL, 0, 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_start_capture(int still_skips) 
{ 
    DWORD bytes_return;     
    BusIoControl(qci_bus, IOCTL_QCI_START_CAPTURE, 
                 (LPVOID)&still_skips, sizeof(still_skips), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_stop_capture() 
{ 
    DWORD bytes_return; 
    BusIoControl(qci_bus, IOCTL_QCI_STOP_CAPTURE, 
                 NULL, 0, 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_master_timing(qci_master_timing_t* timing) 
{ 
    DWORD bytes_return; 
 
    BusIoControl(qci_bus, IOCTL_QCI_SET_MASTER_TIMING, 
                 (LPVOID)timing, sizeof(*timing), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_image_format(int in_format, int out_format) 
{ 
    DWORD bytes_return; 
    int input[2]; 
    input[0] = in_format; 
    input[1] = out_format; 
 
    BusIoControl(qci_bus, IOCTL_QCI_SET_IMAGE_FORMAT, 
                 (LPVOID)input, sizeof(input), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_interface(qci_interface_t* qci_interface) 
{ 
    DWORD bytes_return; 
 
    BusIoControl(qci_bus, IOCTL_QCI_SET_INTERFACE, 
                 (LPVOID)qci_interface, sizeof(*qci_interface), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_capture_callback(capture_callback_t callback,  
                                          ULONG user,  
                                          ULONG mode) 
{     
    DWORD bytes_return; 
    callback_data_t callback_data = { 
        callback, 
        user, 
        mode, 
        &qci_frame 
    }; 
    //NKDbgPrintfW(L"CCameraPdd::qci_frame addr is 0x%x\r\n",qci_frame); 
    BusIoControl(qci_bus, IOCTL_QCI_SET_CAPTURE_CALLBACK, 
                 (LPVOID)&callback_data, sizeof(callback_data), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_notify_formats(format_t* format) 
{ 
    DWORD bytes_return; 
 
    BusIoControl(qci_bus, IOCTL_QCI_NOTIFY_FORMAT, 
                 (LPVOID)format, sizeof(*format), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_frame_format(format_t* format) 
{ 
    DWORD bytes_return; 
 
    BusIoControl(qci_bus, IOCTL_QCI_SET_FRAME_FORMAT, 
                 (LPVOID)format, sizeof(*format), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
} 
 
void CCameraPdd::qci_set_image_proc_cfg(qci_image_proc_cfg_t* cfg) 
{ 
    DWORD bytes_return; 
 
    BusIoControl(qci_bus, IOCTL_QCI_SET_IMAGE_PROC_CFG, 
                 (LPVOID)cfg, sizeof(*cfg), 
                 NULL, 0, 
                 &bytes_return, 
                 NULL); 
}