Dt3152ls internals
This presentation is the property of its rightful owner.
Sponsored Links
1 / 33

DT3152LS Internals PowerPoint PPT Presentation


  • 48 Views
  • Uploaded on
  • Presentation posted in: General

DT3152LS Internals. DT3152LS training overview. What is different with the DT3152LS? How does the driver deal with these differences? How does the SDK deal with these differences? Some code examples. What is different with the LS?.

Download Presentation

DT3152LS Internals

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Dt3152ls internals

DT3152LS Internals


Dt3152ls training overview

DT3152LS training overview

  • What is different with the DT3152LS?

  • How does the driver deal with these differences?

  • How does the SDK deal with these differences?

  • Some code examples.


What is different with the ls

What is different with the LS?

  • LS stands for Line Scan, which means that the output of the camera is no longer an area, but just a single line.

  • Line scan camera can sometimes have very long line - up to 8192 pixels with the 3152LS.

  • Pictures acquired with the LS don’t have any predefined number of lines. Since the LS cameras output only one line at the time, an image is built up from adding successive lines, so it can be any number of lines.

  • Large number of lines * many pixels per line leads to very large frame - possibly larger than 4 MB, the limit of our PCI SA7116 chip. In order to work around this limitation, we had to come out with a pseudo scatter/gather mechanism along with new SDK calls that don’t use our previous device memory management scheme.

  • The LS can also behave like a standard DT3152. There are minor differences with the digital I/O.


How does the driver deal with the different needs

How does the driver deal with the different needs?


Dt3152ls internals

DT3152LS Driver configuration - Tab #1

  • The first tab is used to enable/disable the 1 dimensional and 2 dimensional mode

  • If you disable the board, the 2 other choices will be grayed.


Dt3152ls internals

DT3152LS Driver configuration - Tab #2

  • The tab #2 is the same than the dt3152 standard configuration.

  • It sets how much contiguous memory the driver is going to allocate at boot time.

  • This memory is NOT used for line scan operation, so you should disable area scan if it is not used, in order to save this amount of physical memory for system use.


Dt3152ls internals

DT3152LS Driver settings - Tab #3

  • The tab #3 specifies how many circular buffers has to be allocated at boot time (or load time for NT).

  • Circular buffer are used for the pseudo scatter/gather. They are not directly related with the size of the largest picture that can be aquired.

  • Each buffer is about 500kB. We recommend about 9 circular buffers for smooth operation. Any number lower than 4 may cause the pseudo scatter/gather mechanism to overflow.

  • Under Windows NT, the driver can be reloaded dynamically if no huge contiguous buffer has been allocated


Dt3152ls internals

User buffer - GlobalAlloc()

DT3152LS Pseudo scatter/gather mechanism for acquiring

DtLineScan.dll

User Driver

DT3152LS.drv

User Application

OlImg32.dll

OlFg32.dll

Thread

User land

Circular buffers

Kernel land

Kernel Driver

DT3152LS.sys

ISR

PCI - Bus Dt3152LS


Dt3152ls internals

User buffer - GlobalAlloc()

DT3152LS Pseudo scatter/gather mechanism for acquiring

DtLineScan.dll

User Driver

DT3152LS.drv

User Application

OlImg32.dll

OlFg32.dll

Thread

User land

Circular buffers

Kernel land

Kernel Driver

DT3152LS.sys

ISR

PCI - Bus Dt3152LS


Dt3152ls internals

DT3152LS Pseudo scatter/gather mechanism for acquiring

  • The pseudo scatter/gather is done using 500kB circulars buffers.

  • Each buffer is allocated from the non-pageable memory pool.

  • The PCI interface is reprogrammed every 500kB with the address of the next buffer.

  • Each buffer has an associated flag that can be monitored by a user mode thread.

  • This same user thread will copied the incoming data into the user allocated buffer (allocated from the heap, most likely) when the completion flag for a buffer has been set.


Dt3152ls internals

Thread

Thread

DT3152LS Pseudo scatter/gather mechanism for passthru

User Application

Windows GDI

SDK DLLs

User buffers - GlobalAlloc()

User Driver

DT3152LS.drv

User land

Circular buffers

Kernel land

Kernel Driver

DT3152LS.sys

ISR

PCI - Bus Dt3152LS


Dt3152ls internals

DT3152LS Pseudo scatter/gather mechanism for passthru

  • With the DT3152LS, passthru gathers the functionnality for live video and/or continiuous acquire, since they are very related.

  • Passthru can distribute the data among multiple buffer so parallel processing is possible.

  • Live video and continuous acquire are NOT mutually exclusive, which means that you can do a continuous acquire and display the result at the same time on the screen.

  • A separate thread is responsible to draw the live video on the screen.

  • A Win32 synchonisation is object is available to achieve callback functionnality


Dt3152ls internals

Clock generator

Mux

Acquire circuitry

Sync Counter (0 - 8191)

DT3152LS Synchronisation signals

External clock

Master Clock Out

Line Start

Clock dividor

Reset

Line Drive HI

Line Drive

Line Drive LO

Integration HI

Integration Drive

Integration LO


Dt3152ls internals

DT3152LS Digital I/O Lines

Out 3

Out 2

Out 1

Out 0

In 7

In 6

In 5

In 4

In 3

In 2

In 0

In 0

  • The DT3152LS has 4 output digital lines, TTL level.

  • The 4 output are fedback into the 4 MSB of the 8 digital inputs.

  • THIS IS DIFFERENT THAN WHAT WE HAVE ON THE DT3152.


Dt3152ls internals

New extension call for the SDK

  • OlFgEnableLsMode()* Turn the LS mode on

  • OlFgDrawAcquiredLines()* Draw a previously acquired buffer

  • OlFgGetLsDigIo()* Read the digital I/O lines

  • OlFgSetLsDigIo()* Set the digital I/O

  • OlFgSetLsDriveClkDiv()* Set the clock dividor used for the timer counters

  • OlFgGetLsDriveClkDiv()* Get the clock dividor value

  • OlFgSetLsIntegration()* Set the information about the integration timer counter

  • OlFgGetLsIntegration()* Get the information about the integration timer counter

  • OlFgSetLsLineDrive()* Set the information about the line drive timer counter

  • OlFgGetLsLineDrive()* Get the information about the line drive timer counter

  • OlFgIsAcquireLinesDone()* Get the information about an asynchronous acquire operation

  • OlFgStartAsyncLsPassthru()* Start live video and/or a continuous acquire operation

  • OlFgStopAsyncLsPassthru()* Stop passthru


Dt3152ls internals

OlFgEnableLsMode ()

Description

This function enables or disables line-scan mode. From this point, a lot of the standard SDK functions will return an error message if used.

Parameters

OLT_IMG_DEV_ID DeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

BOOL bEnableLineScan

A boolean value that is set to TRUE to enable line-scan mode or to FALSE to disable line-scan mode (returning the board to area-scan mode).


Dt3152ls internals

OlFgAcquireLines ()

Description

When in line-scan mode, acquires lines of data to a user-allocated buffer in host memory either synchronously or asynchronously.

Parameters

OLT_IMG_DEV_ID DeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

LPVOID lpUserBuffer

This is a pointer to a user allocated buffer. The user must allocate the buffer first by calling one of the Win32 memory management function like GlobalAlloc(). The data will be copied into that buffer by the driver.

DWORD dwUserBufferSize

This parameter is used to verify that the size of the user-allocated buffer is large enough to accommodate the number of pixels per line (frame width) multiplied by the number of lines (frame height). Usually, this value is the same expression that was given to GlobalAlloc() or to an equivalent buffer allocation function.

DWORD dwAcqFlag

Specifies whether the acquisition is synchronous or asynchronous. The flags that can be used for this value are the following:

ASYNC_ACQUIREPerform an asynchronous acquire. The function returns immediately.

SYNC_ACQUIREThe function waits for the acquire to be finished before returning.


Dt3152ls internals

OlFgDrawAcquiredLines()

Description

When in line-scan mode, draws the contents of a user-allocated buffer to a window.

Parameters

OLT_IMG_DEV_ID DeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

HWND hWnd

Specifies the handle to the window in which the acquired line-scan data is displayed.

LS_BUFFER_INFOBufferInfo

Pointer to a LS_BUFFER_INFO structure that will have been previously filled by the user. This is used to indicate to the drawing routine the characteristics of the buffer to draw.


Dt3152ls internals

OlFgSetLsDigIo()

Description

Sets the value of digital output lines 0 to 3.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwValue

Sets the output value for digital outputs 0 to 3. This value can range from 0 to 15.


Dt3152ls internals

OlFgGetLsDigIo()

Description

Returns the value of digital I/O lines.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

LPDWORDlpdwValue

Pointer to a variable that is filled with the value of digital I/O lines. This value can range from 0 to 255. The digital input lines are bits 0 to 3 of this value. The digital output lines are bits 4 to 7 of this value.


Dt3152ls internals

OlFgSetLsDriveClkDiv()

Description

Sets the value used to divide the master clock frequency that goes to the line-sync output and integration output counters. This value is used to generate the frequency of the line-sync output and integration pulse output signals.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwValue

Sets the value used to divide the master clock frequency on the board. Values range from 1 (2^0) to 4,096 (2^12).


Dt3152ls internals

OlFgGetLsDriveClkDiv()

Description

Returns the value used to divide the master clock frequency that goes to the line-sync output and integration output counters. This value is used to generate the frequency of the line-sync output and integration pulse output signals.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

LPDWORDlpdwValue

Gets the value used to divide the master clock frequency on the board. Values range from 1 (2^0) to 4,096 (2^12).

Comments

The following clock divider values are supported: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, and 4096.


Dt3152ls internals

OlFgSetLsLineDrive()

Description

When in line-scan mode, determines the number of pixel clocks that occur before the specified edge of the line-sync output pulse becomes active.

Includes

#include <DtLineScan.h>

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwEdge

Specifies the active edge of the line-sync output pulse. Values are LS_SYNC_LO_TO_HI (the high portion of the line-sync output pulse period is active), or LS_SYNC_HI_TO_LO (the low portion of the line-sync output pulse period is active).

DWORDdwValue

Specifies the number of pixel clocks that are counted before the specified edge of the line-sync output pulse becomes active. Values range from 0 to 8,191.


Dt3152ls internals

OlFgGetLsLineDrive()

Description

When in line-scan mode, returns the number of pixel clocks that occur before the specified edge of the line-sync output pulse becomes active.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwEdge

Specifies the active edge of the line-sync output pulse. Values are LS_SYNC_LO_TO_HI (the high portion of the line-sync output pulse period is active), or LS_SYNC_HI_TO_LO (the low portion of the line-sync output pulse period is active).

LPDWORDlpdwValue

Pointer to variable that returns the number of pixel clocks that are counted before the specified edge of the line-sync output pulse becomes active (edge changes transition). Values range from 0 to 8,191.


Dt3152ls internals

OlFgSetLsIntegration()

Description

When in line-scan mode, determines the number of pixel clocks that occur before the specified edge of the integration output pulse becomes active.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwEdge

Specifies the active edge of the integration output pulse. Values are LS_INTGR_LO_TO_HI (the high portion of the integration output pulse period is active), or LS_INTGR_HI_TO_LO (the low portion of the integration output pulse period is active).

DWORDdwValue

Specifies the number of pixel clocks that are counted before the specified edge of the integration output pulse becomes active. Values range from 0 to 8,191.


Dt3152ls internals

OlFgGetLsIntegration()

Description

When in line-scan mode, returns the number of pixel clocks that occur before the specified edge of the integration output pulse becomes active.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

DWORDdwEdge

Specifies the active edge of the integration output pulse. Values are LS_INTGR_LO_TO_HI (the high portion of the integration output pulse period is active), or LS_INTGR_HI_TO_LO (the low portion of the integration output pulse period is active).

LPDWORDlpdwValue

Pointer to variable that contains the number of pixel clocks that are counted before the specified edge of the integration output pulse becomes active. Values range from 0 to 8,191.


Dt3152ls internals

OlFgIsAcquireLinesDone()

Description

Returns the status of the line-scan acquisition. If the operation is not completed, returns the number of lines acquired in the buffer and the granularity of the value.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

LPBOOLlpbComplete

A pointer to a boolean value that is set to TRUE if the line-scan acquisition has completed or FALSE if the line-scan operation has not completed.

LPDWORDlpdwLinesCompleted

The number of lines acquired in the user-allocated buffer.

LPDWORDlpdwGranularity

The granularity of the number of lines returned. For example, if the granularity is 300, the value of lpdwLinesCompleted is within 300 lines of the actual number of lines acquired.


Dt3152ls internals

OlFgStartAsyncLsPassthru()

Description

When in line-scan mode, starts a continuous-acquire passthru operation, keeping track of whether the buffers have been filled. You can display the data without storing it, store the data without displaying it, or display and store the data.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.

HWNDhWnd

Specifies the handle to the window in which the continuous-acquire passthru data is displayed.

If this parameter is NULL, the data is not displayed.

LPVOID*lplpPointerList

Specifies a list of void pointers to user-allocated data buffers; passthru data is stored in these user-allocated buffers. Refer to page 147 for information on allocating a list of pointers.

If this parameter is NULL, the passthru data is not stored.


Dt3152ls internals

DWORDdwDataBufferSize

Specifies the size of the user-allocated data buffers. Each user-allocated buffer must be the same size. Specify 0 for this parameter if you do not wish to store the passthru data.

DWORDdwPointerListSize

Specifies the size of the list of pointers (lplpPointerList) to the user-allocated data buffers. Specify 0 for this parameter if you do not wish to store the passthru data.

DWORDdwNumPointers

Specifies the number of pointers (in lplpPointerList) to user-allocated data buffers. Specify 0 for this parameter if you do not wish to store the passthru data.

LPHANDLElphEvent

A WIN32 synchronization object used to determine when a buffer has been filled. Specify NULL for this parameter if you do not wish to use the WIN32 synchronization object.

LPBOOLlpbDoneList

A pointer to a list of buffer-done flags, which are used to monitor whether the user-allocated data buffers have been filled. If the flag pointed to is TRUE, the buffer has been filled; if the flag pointed to is FALSE, the buffer has not been filled. Specify NULL for this parameter if you do not wish to store the passthru data. Once a user-allocated data buffer has been filled, you must reset the flag, otherwise the operation will stop if LS_STOP_ON_OVERFLOW is set.

DWORDdwDoneListSize

Specifies the size of the list of buffer-done flags (lpbDoneList). Specify 0 for this parameter if you do not wish to store the passthru data.


Dt3152ls internals

DWORDdwFlags

Specifies how to perform the continuous acquire passthru operation. Specify the flag as LS_PASS_STOP_ON_OVERFLOW if you want the operation to stop when the allocated number of buffers have been filled. Specify the flag as LS_PASS_DONT_STOP_ON_OVERFLOW if you want the operation to continue after the allocated number of buffers have been filled; in this case, the data in the buffers is overwritten.


Dt3152ls internals

OlFgStopAsyncLsPassthru()

Description

When in line-scan mode, stops the passthru operation that was started with OlFgStartAsyncLsPassthru.

Parameters

OLT_IMG_DEV_IDDeviceId

Identifies the device. Returned from a call to OlImgOpenDevice.


Dt3152ls internals

Code example #1

OlImgOpenDevice(lpAlias,&DeviceId);

OlFgEnableLsMode(DeviceId,TRUE);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_FIRST_ACTIVE_PIXEL,100, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_ACTIVE_PIXEL_COUNT,1500, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_FRAME_WIDTH,1500, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_FRAME_HEIGHT,100, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_VIDEO_TYPE, OLC_FG_VID_VARSCAN, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_VARSCAN_FLAGS, 0, &OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_CLOCK_SOURCE,OLC_FG_CLOCK_EXTERNAL,&OldData);

OlFgSetInputControlValue(DeviceId, 0, OLC_FG_CTL_CLOCK_FREQ, 6*1000*1000, &OldData);

OlFgSetLsLineDrive (DeviceId,LS_SYNC_LO_TO_HI,0x1B00);

OlFgSetLsLineDrive (DeviceId,LS_SYNC_HI_TO_LO,0x1B58);

lpUserBuffer = GlobalAlloc(GPTR, 1500 * 100);

BufferSize = 1500 * 100;

OlFgAcquireLines(DeviceId, lpUserBuffer, 1500*100, SYNC_ACQUIRE);

BufferInfo.dwSize=sizeof(LS_BUFFER_INFO);

BufferInfo.dwPixelDepth=1;

BufferInfo.dwWidth=1500;

BufferInfo.dwHeight=100;

BufferInfo.dwOriginX=0;

BufferInfo.dwOriginY=0;

BufferInfo.lpBuffer=lpUserBuffer;

hWnd = ShowBasicWindow (100, 100, 640, 480);

OlFgDrawAcquiredLines(DeviceId,hWnd,BufferInfo);


Dt3152ls internals

Code example #2

for (i=0; i<NUM_PASS_BUFFERS; i++)

{

lplpBuffers[i] = GlobalAlloc(GPTR, ActivePixCount * NumLines);

lpDone[i] = 0;

}

Error = OlFgStartAsyncLsPassthru(DeviceId1,

hWndDisplay,

lplpBuffers,

(ActivePixCount * NumLines),

NUM_PASS_BUFFERS * sizeof(char*),

NUM_PASS_BUFFERS,

&hSyncEvent,

lpDone,

NUM_PASS_BUFFERS * sizeof(DWORD),

0

);

hSyncThread = CreateThread ( NULL, 0, (LPTHREAD_START_ROUTINE)SyncThread,

0, 0, &ThreadId);

DWORDSyncThread(DWORD Parameter)

{

// This is a blocking call, which means that the thread will be removed

// from the running queue until this object is being signaled. The object

// is being signaled by the driver.

while (WaitForSingleObject(hSyncEvent,INFINITE) != WAIT_FAILED)

{

PostMessage(hMainWnd,WMUSER_CALLBACK,0,0);

}

return TRUE;

}


  • Login