Sensoray 2255 User Manual
Page 25

f2255usb.h
: DSP firmware.
Driver startup
(
probe
function in Linux)
On driver startup, the driver creates a board handle in the core. This is done with the
S2255CORE_board_init
function and in Linux is called from
s2255_probe
, the
probe
function.
S2255CORE_board_init
initializes all the core specific variables and allocates USB pipe memory.
The
probe
function also saves the in and out endpoints of the USB. The 2255 has 2 endpoints. The out
endpoint is for configuring and controlling the device. The in endpoint is for reading the buffers.
The probe function should download the firmware to the 2255. In Linux, this is done in chunks because
the USB write functions must use kmalloc’d (continuous kernel space) memory. Kmalloc’d memory is a
sparse resource and 128 KB is the maximum size in Linux 2.6. In
s2255_probe
(
s2255mod.c
) the
firmware is downloaded via
S2255MOD_USB_WriteConfiguration
just before the probe function
exits. If firmware download fails, probe should fail also as the device will be unusable.
Open
When a file is opened, the
s2255_open
callback is called in the Linux driver. This function then calls
S2255CORE_board_open
in the core, which in turn starts the USB read pipe via
S2255MOD_USB_StartPipe
(s2255usb.c
). The USB read pipe continuously reads data from the
device. If no data is present, the read pipe just waits. When the device is closed,
S2255CORE_board_close
calls
S2255MOD_USB_StopReadPipe
which aborts or cancels any URB
which was started at driver open. In Linux,
S2255_board_open
also creates all the system buffers for
storing the frames.
Functions Reference
S2255_DeviceOpen(int board, HANDLE *hdev);
Opens the 2255 device and acquires a handle.
Parameters
board
A 2255 index (0 for the first unit, 1 for the second unit, etc.).
hdev
a pointer to the variable accepting the handle value. All subsequent function calls use the
handle to address the 2255.
Returns
0 on success.
25