USB library for host controller drivers
[USB]

Library for writing host controller drivers. More...


Files

file  batch.c
 USB transfer transaction structures (implementation).
file  batch.h
 USB transfer transaction structures.
file  device_keeper.c
 Device keeper structure and functions (implementation).
file  device_keeper.h
 Device keeper structure and functions.
file  endpoint.h
file  usb_endpoint_manager.h
 Device keeper structure and functions.

Data Structures

struct  endpoint
struct  usb_device_info
 Information about attached USB device. More...
struct  usb_device_keeper_t
 Host controller device keeper. More...
struct  usb_endpoint_manager
struct  usb_transfer_batch

Defines

#define BANDWIDTH_AVAILABLE_USB11   ((BANDWIDTH_TOTAL_USB11 / 10) * 9)
#define BANDWIDTH_TOTAL_USB11   12000000
#define LIBUSBHOST_HOST_YSB_ENDPOINT_MANAGER_H
#define USB_ADDRESS_COUNT   (USB11_ADDRESS_MAX + 1)
 Number of USB address for array dimensions.

Typedefs

typedef usb_transfer_batch usb_transfer_batch_t

Functions

size_t bandwidth_count_usb11 (usb_speed_t speed, usb_transfer_type_t type, size_t size, size_t max_packet_size)
usb_address_t device_keeper_get_free_address (usb_device_keeper_t *instance, usb_speed_t speed)
 Get a free USB address.
void endpoint_clear_hc_data (endpoint_t *instance)
void endpoint_destroy (endpoint_t *instance)
int endpoint_init (endpoint_t *instance, usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size)
void endpoint_release (endpoint_t *instance)
void endpoint_set_hc_data (endpoint_t *instance, void *data, int(*toggle_get)(void *), void(*toggle_set)(void *, int))
int endpoint_toggle_get (endpoint_t *instance)
void endpoint_toggle_reset_filtered (endpoint_t *instance, usb_target_t target)
void endpoint_toggle_set (endpoint_t *instance, int toggle)
void endpoint_use (endpoint_t *instance)
void usb_device_keeper_bind (usb_device_keeper_t *instance, usb_address_t address, devman_handle_t handle)
 Bind USB address to devman handle.
usb_address_t usb_device_keeper_find (usb_device_keeper_t *instance, devman_handle_t handle)
 Find USB address associated with the device.
bool usb_device_keeper_find_by_address (usb_device_keeper_t *instance, usb_address_t address, devman_handle_t *handle)
 Find devman handle assigned to USB address.
usb_speed_t usb_device_keeper_get_speed (usb_device_keeper_t *instance, usb_address_t address)
 Get speed associated with the address.
void usb_device_keeper_init (usb_device_keeper_t *instance)
 Initialize device keeper structure.
void usb_device_keeper_release (usb_device_keeper_t *instance, usb_address_t address)
 Release used USB address.
static int usb_endpoint_manager_add_ep (usb_endpoint_manager_t *instance, usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size, size_t data_size)
void usb_endpoint_manager_destroy (usb_endpoint_manager_t *instance)
endpoint_tusb_endpoint_manager_get_ep (usb_endpoint_manager_t *instance, usb_address_t address, usb_endpoint_t ep, usb_direction_t direction, size_t *bw)
int usb_endpoint_manager_init (usb_endpoint_manager_t *instance, size_t available_bandwidth)
int usb_endpoint_manager_register_ep (usb_endpoint_manager_t *instance, endpoint_t *ep, size_t data_size)
void usb_endpoint_manager_reset_if_need (usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data)
 Check setup packet data for signs of toggle reset.
int usb_endpoint_manager_unregister_ep (usb_endpoint_manager_t *instance, usb_address_t address, usb_endpoint_t ep, usb_direction_t direction)
void usb_transfer_batch_call_in (usb_transfer_batch_t *instance)
 Prepare data, get error status and call callback in.
void usb_transfer_batch_call_in_and_dispose (usb_transfer_batch_t *instance)
 Helper function, calls callback and correctly destroys batch structure.
void usb_transfer_batch_call_out (usb_transfer_batch_t *instance)
 Get error status and call callback out.
void usb_transfer_batch_call_out_and_dispose (usb_transfer_batch_t *instance)
 Helper function calls callback and correctly destroys batch structure.
void usb_transfer_batch_dispose (usb_transfer_batch_t *instance)
 Correctly dispose all used data structures.
void usb_transfer_batch_finish (usb_transfer_batch_t *instance)
 Mark batch as finished and continue with next step.
static void usb_transfer_batch_finish_error (usb_transfer_batch_t *instance, int error)
static usb_transfer_batch_tusb_transfer_batch_from_link (link_t *l)
void usb_transfer_batch_init (usb_transfer_batch_t *instance, endpoint_t *ep, char *buffer, char *data_buffer, size_t buffer_size, char *setup_buffer, size_t setup_size, usbhc_iface_transfer_in_callback_t func_in, usbhc_iface_transfer_out_callback_t func_out, void *arg, ddf_fun_t *fun, void *private_data, void(*private_data_dtor)(void *p_data))

Detailed Description

Library for writing host controller drivers.


Function Documentation

usb_address_t device_keeper_get_free_address ( usb_device_keeper_t instance,
usb_speed_t  speed 
)

Get a free USB address.

Parameters:
[in] instance Device keeper structure to use.
[in] speed Speed of the device requiring address.
Returns:
Free address, or error code.

Definition at line 69 of file device_keeper.c.

void usb_device_keeper_bind ( usb_device_keeper_t instance,
usb_address_t  address,
devman_handle_t  handle 
)

Bind USB address to devman handle.

Parameters:
[in] instance Device keeper structure to use.
[in] address Device address
[in] handle Devman handle of the device.

Definition at line 103 of file device_keeper.c.

usb_address_t usb_device_keeper_find ( usb_device_keeper_t instance,
devman_handle_t  handle 
)

Find USB address associated with the device.

Parameters:
[in] instance Device keeper structure to use.
[in] handle Devman handle of the device seeking its address.
Returns:
USB Address, or error code.

Definition at line 142 of file device_keeper.c.

bool usb_device_keeper_find_by_address ( usb_device_keeper_t instance,
usb_address_t  address,
devman_handle_t handle 
)

Find devman handle assigned to USB address.

Intentionally refuse to find handle of default address.

Parameters:
[in] instance Device keeper structure to use.
[in] address Address the caller wants to find.
[out] handle Where to store found handle.
Returns:
Whether such address is currently occupied.

Definition at line 168 of file device_keeper.c.

usb_speed_t usb_device_keeper_get_speed ( usb_device_keeper_t instance,
usb_address_t  address 
)

Get speed associated with the address.

Parameters:
[in] instance Device keeper structure to use.
[in] address Address of the device.
Returns:
USB speed.

Definition at line 197 of file device_keeper.c.

void usb_device_keeper_init ( usb_device_keeper_t instance  ) 

Initialize device keeper structure.

Parameters:
[in] instance Memory place to initialize.
Set all values to false/0.

Definition at line 47 of file device_keeper.c.

void usb_device_keeper_release ( usb_device_keeper_t instance,
usb_address_t  address 
)

Release used USB address.

Parameters:
[in] instance Device keeper structure to use.
[in] address Device address

Definition at line 122 of file device_keeper.c.

void usb_endpoint_manager_reset_if_need ( usb_endpoint_manager_t instance,
usb_target_t  target,
const uint8_t *  data 
)

Check setup packet data for signs of toggle reset.

Parameters:
[in] instance Device keeper structure to use.
[in] target Device to receive setup packet.
[in] data Setup packet data.
Really ugly one.

Definition at line 253 of file usb_endpoint_manager.c.

void usb_transfer_batch_call_in ( usb_transfer_batch_t instance  ) 

Prepare data, get error status and call callback in.

Parameters:
[in] instance Batch structure to use. Copies data from transport buffer, and calls callback with appropriate parameters.

Definition at line 121 of file batch.c.

void usb_transfer_batch_call_in_and_dispose ( usb_transfer_batch_t instance  ) 

Helper function, calls callback and correctly destroys batch structure.

Parameters:
[in] instance Batch structure to use.

Definition at line 84 of file batch.c.

void usb_transfer_batch_call_out ( usb_transfer_batch_t instance  ) 

Get error status and call callback out.

Parameters:
[in] instance Batch structure to use.

Definition at line 145 of file batch.c.

void usb_transfer_batch_call_out_and_dispose ( usb_transfer_batch_t instance  ) 

Helper function calls callback and correctly destroys batch structure.

Parameters:
[in] instance Batch structure to use.

Definition at line 95 of file batch.c.

void usb_transfer_batch_dispose ( usb_transfer_batch_t instance  ) 

Correctly dispose all used data structures.

Parameters:
[in] instance Batch structure to use.

Definition at line 164 of file batch.c.

void usb_transfer_batch_finish ( usb_transfer_batch_t instance  ) 

Mark batch as finished and continue with next step.

Parameters:
[in] instance Batch structure to use.

Definition at line 107 of file batch.c.


Generated on Thu Jun 2 07:45:56 2011 for HelenOS/USB by  doxygen 1.4.7