Files | |
file | batch.c |
OHCI driver USB transaction structure. | |
file | batch.h |
OHCI driver USB transaction structure. | |
file | completion_codes.h |
OHCI driver. | |
file | endpoint_descriptor.c |
OHCI driver. | |
file | endpoint_descriptor.h |
OHCI driver. | |
file | endpoint_list.c |
OHCI driver transfer list implementation. | |
file | endpoint_list.h |
OHCI driver transfer list structure. | |
file | hc.h |
OHCI host controller driver structure. | |
file | hcca.h |
OHCI driver. | |
file | hcd_endpoint.c |
OHCI driver. | |
file | hcd_endpoint.h |
OHCI driver. | |
file | iface.c |
OHCI driver hc interface implementation. | |
file | iface.h |
Common OHCI definitions. | |
file | iso_transfer_descriptor.h |
OHCI driver. | |
file | main.c |
Main routines of OHCI driver. | |
file | malloc32.h |
OHCI driver. | |
file | ohci.c |
OHCI driver. | |
file | ohci.h |
OHCI driver main structure for both host controller and root-hub. | |
file | pci.c |
PCI related functions needed by the OHCI driver. | |
file | pci.h |
PCI related functions needed by OHCI driver. | |
file | root_hub.c |
OHCI driver. | |
file | root_hub.h |
OHCI driver. | |
file | transfer_descriptor.c |
OHCI driver. | |
file | transfer_descriptor.h |
OHCI driver. | |
Data Structures | |
struct | ed |
struct | endpoint_list |
Structure maintains both OHCI queue and software list of active endpoints. More... | |
struct | hc |
Main OHCI drier structure. More... | |
struct | hcca |
Host controller communication area. More... | |
struct | hcd_endpoint |
Connector structure linking ED to to prepared TD. More... | |
struct | itd |
struct | ohci |
struct | ohci_transfer_batch |
OHCI specific data required for USB transfer. More... | |
struct | rh |
ohci root hub representation More... | |
struct | td |
Defines | |
#define | CC_BITSTUFF (0x2) |
#define | CC_BUFFEROVERRRUN (0xc) |
#define | CC_BUFFERUNDERRUN (0xd) |
#define | CC_CRC (0x1) |
#define | CC_DATAOVERRRUN (0x8) |
#define | CC_DATAUNDERRRUN (0x9) |
#define | CC_NOACCESS1 (0xe) |
#define | CC_NOACCESS2 (0xf) |
#define | CC_NOERROR (0x0) |
#define | CC_NORESPONSE (0x5) |
#define | CC_PIDFAIL (0x6) |
#define | CC_PIDUNEXPECTED (0x7) |
#define | CC_STALL (0x4) |
#define | CC_TOGGLE (0x3) |
#define | NAME "ohci" |
#define | OHCI_NEEDED_IRQ_COMMANDS 5 |
#define | OHCI_TD_MAX_TRANSFER (4 * 1024) |
Typedefs | |
typedef endpoint_list | endpoint_list_t |
Structure maintains both OHCI queue and software list of active endpoints. | |
typedef hc | hc_t |
Main OHCI drier structure. | |
typedef hcca | hcca_t |
Host controller communication area. | |
typedef hcd_endpoint | hcd_endpoint_t |
Connector structure linking ED to to prepared TD. | |
typedef ohci_transfer_batch | ohci_transfer_batch_t |
OHCI specific data required for USB transfer. | |
typedef rh | rh_t |
ohci root hub representation | |
Functions | |
static uintptr_t | addr_to_phys (void *addr) |
Get physical address translation. | |
void | batch_bulk_in (usb_transfer_batch_t *instance) |
Prepare bulk in transfer. | |
void | batch_bulk_out (usb_transfer_batch_t *instance) |
Prepare bulk out transfer. | |
void | batch_commit (usb_transfer_batch_t *instance) |
Starts execution of the TD list. | |
static void | batch_control (usb_transfer_batch_t *instance, usb_direction_t data_dir, usb_direction_t status_dir) |
Prepare generic control transfer. | |
void | batch_control_read (usb_transfer_batch_t *instance) |
Prepares control read transfer. | |
void | batch_control_write (usb_transfer_batch_t *instance) |
Prepares control write transfer. | |
static void | batch_data (usb_transfer_batch_t *instance) |
Prepare generic data transfer. | |
usb_transfer_batch_t * | batch_get (ddf_fun_t *fun, endpoint_t *ep, char *buffer, size_t buffer_size, const 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) |
Allocate memory initialize internal structures. | |
void | batch_interrupt_in (usb_transfer_batch_t *instance) |
Prepare interrupt in transfer. | |
void | batch_interrupt_out (usb_transfer_batch_t *instance) |
Prepare interrupt out transfer. | |
bool | batch_is_complete (usb_transfer_batch_t *instance) |
Check batch TDs' status. | |
static int | bind_address (ddf_fun_t *fun, usb_address_t address, devman_handle_t handle) |
Bind address interface function. | |
static int | bulk_in (ddf_fun_t *fun, usb_target_t target, void *data, size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) |
Schedule bulk in transfer. | |
static int | bulk_out (ddf_fun_t *fun, usb_target_t target, void *data, size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) |
Schedule bulk out transfer. | |
static int | cc_to_rc (int cc) |
static int | control_read (ddf_fun_t *fun, usb_target_t target, void *setup_data, size_t setup_size, void *data, size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) |
Schedule control read transfer. | |
static int | control_write (ddf_fun_t *fun, usb_target_t target, void *setup_data, size_t setup_size, void *data, size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) |
Schedule control write transfer. | |
static void | create_interrupt_mask_in_instance (rh_t *instance) |
create answer to status interrupt consisting of change bitmap | |
static int | create_serialized_hub_descriptor (rh_t *instance) |
Create hub descriptor used in hub-driver <-> hub communication. | |
static ohci_t * | dev_to_ohci (ddf_dev_t *dev) |
int | device_setup_ohci (ddf_dev_t *device) |
Initialize hc and rh ddf structures and their respective drivers. | |
static void | ed_append_ed (ed_t *instance, ed_t *next) |
void | ed_init (ed_t *instance, endpoint_t *ep) |
static void | ed_set_end_td (ed_t *instance, td_t *td) |
static void | ed_set_td (ed_t *instance, td_t *td) |
static int | ed_toggle_get (ed_t *instance) |
static void | ed_toggle_set (ed_t *instance, int toggle) |
void | endpoint_list_add_ep (endpoint_list_t *instance, hcd_endpoint_t *hcd_ep) |
Add endpoint to the list and queue. | |
static void | endpoint_list_fini (endpoint_list_t *instance) |
Dispose transfer list structures. | |
int | endpoint_list_init (endpoint_list_t *instance, const char *name) |
Initialize transfer list structures. | |
void | endpoint_list_remove_ep (endpoint_list_t *instance, hcd_endpoint_t *hcd_ep) |
Remove endpoint from the list and queue. | |
void | endpoint_list_set_next (endpoint_list_t *instance, endpoint_list_t *next) |
Set the next list in transfer list chain. | |
static int | find_by_address (ddf_fun_t *fun, usb_address_t address, devman_handle_t *handle) |
Find device handle by address interface function. | |
static void | free32 (void *addr) |
Physical mallocator simulator. | |
static hc_t * | fun_to_hc (ddf_fun_t *fun) |
Get and cast pointer to the driver data. | |
int | hc_add_endpoint (hc_t *instance, usb_address_t address, usb_endpoint_t ep, usb_speed_t speed, usb_transfer_type_t type, usb_direction_t direction, size_t max_packet_size, size_t size, unsigned interval) |
Create end register endpoint structures. | |
static void | hc_fini (hc_t *instance) |
Safely dispose host controller internal structures. | |
endpoint_t * | hc_get_endpoint (hc_t *instance, usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, size_t *bw) |
Get access to endpoint structures. | |
int | hc_init (hc_t *instance, uintptr_t regs, size_t reg_size, bool interrupts) |
Initialize OHCI hc driver structure. | |
void | hc_interrupt (hc_t *instance, uint32_t status) |
Interrupt handling routine. | |
int | hc_register_hub (hc_t *instance, ddf_fun_t *hub_fun) |
Announce OHCI root hub to the DDF. | |
int | hc_remove_endpoint (hc_t *instance, usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction) |
Dequeue and delete endpoint structures. | |
int | hc_schedule (hc_t *instance, usb_transfer_batch_t *batch) |
Add USB transfer to the schedule. | |
void | hc_start_hw (hc_t *instance) |
OHCI hw initialization routine. | |
hcd_endpoint_t * | hcd_endpoint_assign (endpoint_t *ep) |
Creates new hcd endpoint representation. | |
void | hcd_endpoint_clear (endpoint_t *ep) |
Disposes assigned hcd endpoint structure. | |
static hcd_endpoint_t * | hcd_endpoint_get (endpoint_t *ep) |
Get and convert assigned hcd_endpoint_t structure. | |
static int | hcd_ep_toggle_get (void *hcd_ep) |
Callback to get value of toggle bit. | |
static void | hcd_ep_toggle_set (void *hcd_ep, int toggle) |
Callback to set toggle on ED. | |
static int | interrupt_in (ddf_fun_t *fun, usb_target_t target, void *data, size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) |
Schedule interrupt in transfer. | |
static int | interrupt_out (ddf_fun_t *fun, usb_target_t target, void *data, size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) |
Schedule interrupt out transfer. | |
static void | irq_handler (ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call) |
IRQ handling callback, identifies device. | |
static bool | is_zeros (void *buffer, size_t size) |
return whether the buffer is full of zeros | |
int | main (int argc, char *argv[]) |
Main entry point. | |
static void * | malloc32 (size_t size) |
Physical mallocator simulator. | |
static int | ohci_add_device (ddf_dev_t *device) |
Initializes a new ddf driver instance of OHCI hcd. | |
static void | ohci_transfer_batch_dispose (void *ohci_batch) |
Safely destructs ohci_transfer_batch_t structure. | |
int | pci_enable_interrupts (ddf_dev_t *device) |
Calls the PCI driver with a request to enable interrupts. | |
int | pci_get_my_registers (ddf_dev_t *dev, uintptr_t *mem_reg_address, size_t *mem_reg_size, int *irq_no) |
Get address of registers and IRQ for given device. | |
static int | process_address_set_request (rh_t *instance, uint16_t address) |
register address to this device | |
static int | process_ctrl_request (rh_t *instance, usb_transfer_batch_t *request) |
process hub control request | |
static int | process_get_configuration_request (rh_t *instance, usb_transfer_batch_t *request) |
answer to get configuration request | |
static int | process_get_descriptor_request (rh_t *instance, usb_transfer_batch_t *request) |
create answer to a descriptor request | |
static int | process_get_hub_status_request (rh_t *instance, usb_transfer_batch_t *request) |
create answer to port status_request | |
static int | process_get_port_status_request (rh_t *instance, uint16_t port, usb_transfer_batch_t *request) |
create answer to port status_request | |
static int | process_get_status_request (rh_t *instance, usb_transfer_batch_t *request) |
create answer to status request | |
static int | process_hub_feature_clear_request (rh_t *instance, uint16_t feature) |
process feature-disabling request on hub | |
static int | process_hub_feature_set_request (rh_t *instance, uint16_t feature) |
process feature-enabling request on hub | |
static int | process_interrupt_mask_in_instance (rh_t *instance, usb_transfer_batch_t *request) |
process hanging interrupt request | |
static int | process_port_feature_clear_request (rh_t *instance, uint16_t feature, uint16_t port) |
process feature-disabling request on hub | |
static int | process_port_feature_set_request (rh_t *instance, uint16_t feature, uint16_t port) |
process feature-enabling request on hub | |
static int | process_request_with_input (rh_t *instance, usb_transfer_batch_t *request) |
process one of requests that carry input data | |
static int | process_request_with_output (rh_t *instance, usb_transfer_batch_t *request) |
process one of requests that requere output data | |
static int | process_request_without_data (rh_t *instance, usb_transfer_batch_t *request) |
process one of requests that do not request nor carry additional data | |
static int | register_endpoint (ddf_fun_t *fun, usb_address_t address, usb_speed_t ep_speed, usb_endpoint_t endpoint, usb_transfer_type_t transfer_type, usb_direction_t direction, size_t max_packet_size, unsigned int interval) |
Register endpoint for bandwidth reservation. | |
static int | release_address (ddf_fun_t *fun, usb_address_t address) |
Release address interface function. | |
static int | request_address (ddf_fun_t *fun, usb_speed_t speed, usb_address_t *address) |
Request address interface function. | |
int | rh_init (rh_t *instance, ohci_regs_t *regs) |
Root hub initialization. | |
static int | rh_init_descriptors (rh_t *instance) |
initialize hub descriptors | |
void | rh_interrupt (rh_t *instance) |
process interrupt on a hub | |
int | rh_request (rh_t *instance, usb_transfer_batch_t *request) |
process root hub request | |
static int | setup_batch (ddf_fun_t *fun, usb_target_t target, usb_direction_t direction, void *data, size_t size, void *setup_data, size_t setup_size, usbhc_iface_transfer_in_callback_t in, usbhc_iface_transfer_out_callback_t out, void *arg, const char *name, hc_t **hc, usb_transfer_batch_t **batch) |
static int | td_error (td_t *instance) |
void | td_init (td_t *instance, usb_direction_t dir, void *buffer, size_t size, int toggle) |
static bool | td_is_finished (td_t *instance) |
static size_t | td_remain_size (td_t *instance) |
static void | td_set_next (td_t *instance, td_t *next) |
static int | unregister_endpoint (ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction) |
static int | usb_iface_get_address (ddf_fun_t *fun, devman_handle_t handle, usb_address_t *address) |
Get address of the device identified by handle. | |
static int | usb_iface_get_hc_handle (ddf_fun_t *fun, devman_handle_t *handle) |
Gets handle of the respective hc (this device, hc function). | |
Variables | |
static unsigned | direc [3] |
static unsigned | dp [3] |
usbhc_iface_t | hc_iface |
usbhc_iface_t | hc_iface |
static ddf_dev_ops_t | hc_ops |
Standard USB HC options (HC interface). | |
static const uint32_t | hub_clear_feature_by_writing_one_mask |
bitmask of hub features that are cleared by writing 1 (and not 0) | |
static const uint32_t | hub_clear_feature_valid_mask |
bitmask of hub features that are valid to be cleared | |
static const uint32_t | hub_set_feature_direct_mask |
bitmask of hub features that are set by writing 1 and cleared by writing 0 | |
static const uint32_t | hub_set_feature_valid_mask |
bitmask of hub features that are valid to be set | |
static driver_t | ohci_driver |
static driver_ops_t | ohci_driver_ops |
static const usb_standard_configuration_descriptor_t | ohci_rh_conf_descriptor |
standart configuration descriptor with filled common values for ohci root hubs | |
static const usb_standard_device_descriptor_t | ohci_rh_device_descriptor |
standart device descriptor for ohci root hub | |
static const usb_standard_endpoint_descriptor_t | ohci_rh_ep_descriptor |
standart ohci root hub endpoint descriptor | |
static const usb_standard_interface_descriptor_t | ohci_rh_iface_descriptor |
standart ohci root hub interface descriptor | |
static const uint32_t | port_clear_feature_valid_mask |
bitmask of port features that can be cleared | |
static const uint32_t | port_set_feature_valid_mask |
bitmask of port features that are valid to be set | |
static const uint32_t | port_status_change_mask = RHPS_CHANGE_WC_MASK |
bitmask with port status changes | |
static ddf_dev_ops_t | rh_ops |
Standard USB RH options (RH interface). | |
static unsigned | togg [2] = { TD_STATUS_T_0, TD_STATUS_T_1 } |
static usb_iface_t | usb_iface |
Root hub USB interface. |
Host controller communication area.
Shared memory used for communication between the controller and the driver.
static uintptr_t addr_to_phys | ( | void * | addr | ) | [inline, static] |
Get physical address translation.
[in] | addr | Virtual address to translate |
Definition at line 48 of file malloc32.h.
void batch_bulk_in | ( | usb_transfer_batch_t * | instance | ) |
void batch_bulk_out | ( | usb_transfer_batch_t * | instance | ) |
void batch_commit | ( | usb_transfer_batch_t * | instance | ) |
void batch_control | ( | usb_transfer_batch_t * | instance, | |
usb_direction_t | data_dir, | |||
usb_direction_t | status_dir | |||
) | [static] |
Prepare generic control transfer.
[in] | instance | Batch structure to use. |
[in] | data_dir | Direction to use for data stage. |
[in] | status_dir | Direction to use for status stage. |
void batch_control_read | ( | usb_transfer_batch_t * | instance | ) |
void batch_control_write | ( | usb_transfer_batch_t * | instance | ) |
void batch_data | ( | usb_transfer_batch_t * | instance | ) | [static] |
usb_transfer_batch_t * batch_get | ( | ddf_fun_t * | fun, | |
endpoint_t * | ep, | |||
char * | buffer, | |||
size_t | buffer_size, | |||
const 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 | |||
) |
Allocate memory initialize internal structures.
[in] | fun | DDF function to pass to callback. |
[in] | ep | Communication target |
[in] | buffer | Data source/destination. |
[in] | buffer_size | Size of the buffer. |
[in] | setup_buffer | Setup data source (if not NULL) |
[in] | setup_size | Size of setup_buffer (should be always 8) |
[in] | func_in | function to call on inbound transfer completion |
[in] | func_out | function to call on outbound transfer completion |
[in] | arg | additional parameter to func_in or func_out |
void batch_interrupt_in | ( | usb_transfer_batch_t * | instance | ) |
void batch_interrupt_out | ( | usb_transfer_batch_t * | instance | ) |
bool batch_is_complete | ( | usb_transfer_batch_t * | instance | ) |
Check batch TDs' status.
[in] | instance | Batch structure to use. |
static int bind_address | ( | ddf_fun_t * | fun, | |
usb_address_t | address, | |||
devman_handle_t | handle | |||
) | [static] |
static int bulk_in | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_in_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule bulk in transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | data | Buffer where to store the data (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of the data buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static int bulk_out | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_out_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule bulk out transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | data | Data to be sent (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of the data buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static int control_read | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | setup_data, | |||
size_t | setup_size, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_in_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule control read transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | setup_packet | Setup packet buffer (in USB endianess, allocated and deallocated by the caller). |
[in] | setup_size | Size of setup_packet buffer in bytes. |
[in] | data_buffer | Buffer where to store the data (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of data_buffer buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static int control_write | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | setup_data, | |||
size_t | setup_size, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_out_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule control write transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | setup_packet | Setup packet buffer (in USB endianess, allocated and deallocated by the caller). |
[in] | setup_size | Size of setup_packet buffer in bytes. |
[in] | data_buffer | Data buffer (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of data_buffer buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static void create_interrupt_mask_in_instance | ( | rh_t * | instance | ) | [static] |
create answer to status interrupt consisting of change bitmap
Result contains bitmap where bit 0 indicates change on hub and bit i indicates change on i`th port (i>0). For more info see Hub and Port status bitmap specification in USB specification (chapter 11.13.4). Uses instance`s interrupt buffer to store the interrupt information.
instance | root hub instance |
Definition at line 484 of file root_hub.c.
static int create_serialized_hub_descriptor | ( | rh_t * | instance | ) | [static] |
Create hub descriptor used in hub-driver <-> hub communication.
This means creating byt array from data in root hub registers. For more info see usb hub specification.
instance | root hub instance |
Definition at line 305 of file root_hub.c.
int device_setup_ohci | ( | ddf_dev_t * | device | ) |
Initialize hc and rh ddf structures and their respective drivers.
[in] | device | DDF instance of the device to use. |
[in] | instance | OHCI structure to use. |
void endpoint_list_add_ep | ( | endpoint_list_t * | instance, | |
hcd_endpoint_t * | hcd_ep | |||
) |
Add endpoint to the list and queue.
[in] | instance | List to use. |
[in] | endpoint | Endpoint to add. |
Definition at line 88 of file endpoint_list.c.
static void endpoint_list_fini | ( | endpoint_list_t * | instance | ) | [inline, static] |
Dispose transfer list structures.
[in] | instance | Memory place to use. |
Definition at line 63 of file endpoint_list.h.
int endpoint_list_init | ( | endpoint_list_t * | instance, | |
const char * | name | |||
) |
Initialize transfer list structures.
[in] | instance | Memory place to use. |
[in] | name | Name of the new list. |
Definition at line 48 of file endpoint_list.c.
void endpoint_list_remove_ep | ( | endpoint_list_t * | instance, | |
hcd_endpoint_t * | hcd_ep | |||
) |
Remove endpoint from the list and queue.
[in] | instance | List to use. |
[in] | endpoint | Endpoint to remove. |
Definition at line 140 of file endpoint_list.c.
void endpoint_list_set_next | ( | endpoint_list_t * | instance, | |
endpoint_list_t * | next | |||
) |
Set the next list in transfer list chain.
[in] | instance | List to lead. |
[in] | next | List to append. |
Definition at line 74 of file endpoint_list.c.
static int find_by_address | ( | ddf_fun_t * | fun, | |
usb_address_t | address, | |||
devman_handle_t * | handle | |||
) | [static] |
static void free32 | ( | void * | addr | ) | [inline, static] |
Physical mallocator simulator.
[in] | addr | Address of the place allocated by malloc32 |
Definition at line 70 of file malloc32.h.
int hc_add_endpoint | ( | hc_t * | instance, | |
usb_address_t | address, | |||
usb_endpoint_t | endpoint, | |||
usb_speed_t | speed, | |||
usb_transfer_type_t | type, | |||
usb_direction_t | direction, | |||
size_t | mps, | |||
size_t | size, | |||
unsigned | interval | |||
) |
Create end register endpoint structures.
[in] | instance | OHCI driver structure. |
[in] | address | USB address of the device. |
[in] | endpoint | USB endpoint number. |
[in] | speed | Communication speeed of the device. |
[in] | type | Endpoint's transfer type. |
[in] | direction | Endpoint's direction. |
[in] | mps | Maximum packet size the endpoint accepts. |
[in] | size | Maximum allowed buffer size. |
[in] | interval | Time between transfers(interrupt transfers only). |
static void hc_fini | ( | hc_t * | instance | ) | [inline, static] |
endpoint_t* hc_get_endpoint | ( | hc_t * | instance, | |
usb_address_t | address, | |||
usb_endpoint_t | endpoint, | |||
usb_direction_t | direction, | |||
size_t * | bw | |||
) |
Initialize OHCI hc driver structure.
[in] | instance | Memory place for the structure. |
[in] | regs | Address of the memory mapped I/O registers. |
[in] | reg_size | Size of the memory mapped area. |
[in] | interrupts | True if w interrupts should be used |
void hc_interrupt | ( | hc_t * | instance, | |
uint32_t | status | |||
) |
int hc_remove_endpoint | ( | hc_t * | instance, | |
usb_address_t | address, | |||
usb_endpoint_t | endpoint, | |||
usb_direction_t | direction | |||
) |
int hc_schedule | ( | hc_t * | instance, | |
usb_transfer_batch_t * | batch | |||
) |
void hc_start_hw | ( | hc_t * | instance | ) |
hcd_endpoint_t * hcd_endpoint_assign | ( | endpoint_t * | ep | ) |
Creates new hcd endpoint representation.
[in] | ep | USBD endpoint structure |
Definition at line 68 of file hcd_endpoint.c.
void hcd_endpoint_clear | ( | endpoint_t * | ep | ) |
Disposes assigned hcd endpoint structure.
[in] | ep | USBD endpoint structure |
Definition at line 99 of file hcd_endpoint.c.
static hcd_endpoint_t* hcd_endpoint_get | ( | endpoint_t * | ep | ) | [inline, static] |
Get and convert assigned hcd_endpoint_t structure.
[in] | ep | USBD endpoint structure. |
Definition at line 61 of file hcd_endpoint.h.
static int hcd_ep_toggle_get | ( | void * | hcd_ep | ) | [static] |
Callback to get value of toggle bit.
[in] | hcd_ep | hcd endpoint structure |
Definition at line 55 of file hcd_endpoint.c.
static void hcd_ep_toggle_set | ( | void * | hcd_ep, | |
int | toggle | |||
) | [static] |
Callback to set toggle on ED.
[in] | hcd_ep | hcd endpoint structure |
[in] | toggle | new value of toggle bit |
Definition at line 42 of file hcd_endpoint.c.
static int interrupt_in | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_in_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule interrupt in transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | data | Buffer where to store the data (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of the data buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static int interrupt_out | ( | ddf_fun_t * | fun, | |
usb_target_t | target, | |||
void * | data, | |||
size_t | size, | |||
usbhc_iface_transfer_out_callback_t | callback, | |||
void * | arg | |||
) | [static] |
Schedule interrupt out transfer.
The callback is supposed to be called once the transfer (on the wire) is complete regardless of the outcome. However, the callback could be called only when this function returns with success status (i.e. returns EOK).
[in] | fun | Device function the action was invoked on. |
[in] | target | Target pipe (address and endpoint number) specification. |
[in] | data | Data to be sent (in USB endianess, allocated and deallocated by the caller). |
[in] | size | Size of the data buffer in bytes. |
[in] | callback | Callback to be issued once the transfer is complete. |
[in] | arg | Pass-through argument to the callback. |
static void irq_handler | ( | ddf_dev_t * | dev, | |
ipc_callid_t | iid, | |||
ipc_call_t * | call | |||
) | [static] |
return whether the buffer is full of zeros
Convenience function.
buffer | ||
size |
Definition at line 931 of file root_hub.c.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
static void* malloc32 | ( | size_t | size | ) | [inline, static] |
Physical mallocator simulator.
[in] | size | Size of the required memory space |
Definition at line 63 of file malloc32.h.
static int ohci_add_device | ( | ddf_dev_t * | device | ) | [static] |
static void ohci_transfer_batch_dispose | ( | void * | ohci_batch | ) | [static] |
int pci_enable_interrupts | ( | ddf_dev_t * | device | ) |
int pci_get_my_registers | ( | ddf_dev_t * | dev, | |
uintptr_t * | mem_reg_address, | |||
size_t * | mem_reg_size, | |||
int * | irq_no | |||
) |
Get address of registers and IRQ for given device.
[in] | dev | Device asking for the addresses. |
[out] | mem_reg_address | Base address of the memory range. |
[out] | mem_reg_size | Size of the memory range. |
[out] | irq_no | IRQ assigned to the device. |
static int process_address_set_request | ( | rh_t * | instance, | |
uint16_t | address | |||
) | [static] |
register address to this device
instance | root hub instance | |
address | new address |
Definition at line 707 of file root_hub.c.
static int process_ctrl_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
process hub control request
If needed, writes answer into the request structure. Request can be one of USB_DEVREQ_GET_STATUS, USB_DEVREQ_GET_DESCRIPTOR, USB_DEVREQ_GET_CONFIGURATION, USB_DEVREQ_CLEAR_FEATURE, USB_DEVREQ_SET_FEATURE, USB_DEVREQ_SET_ADDRESS, USB_DEVREQ_SET_DESCRIPTOR or USB_DEVREQ_SET_CONFIGURATION.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 846 of file root_hub.c.
static int process_get_configuration_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
answer to get configuration request
Root hub works independently on the configuration.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 589 of file root_hub.c.
static int process_get_descriptor_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
create answer to a descriptor request
This might be a request for standard (configuration, device, endpoint or interface) or device specific (hub) descriptor.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 512 of file root_hub.c.
static int process_get_hub_status_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
create answer to port status_request
This copies flags in hub status register into the buffer. The format of the status register and status message is the same, according to USB hub specification and OHCI root hub specification.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 429 of file root_hub.c.
static int process_get_port_status_request | ( | rh_t * | instance, | |
uint16_t | port, | |||
usb_transfer_batch_t * | request | |||
) | [static] |
create answer to port status_request
Copy content of corresponding port status register to answer buffer. The format of the port status register and port status data is the same ( see OHCI root hub and USB hub documentation).
instance | root hub instance | |
port | port number, counted from 1 | |
request | structure containing both request and response information |
Definition at line 407 of file root_hub.c.
static int process_get_status_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
create answer to status request
This might be either hub status or port status request. If neither, ENOTSUP is returned.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 450 of file root_hub.c.
static int process_hub_feature_clear_request | ( | rh_t * | instance, | |
uint16_t | feature | |||
) | [static] |
process feature-disabling request on hub
instance | root hub instance | |
feature | feature selector |
Definition at line 630 of file root_hub.c.
static int process_hub_feature_set_request | ( | rh_t * | instance, | |
uint16_t | feature | |||
) | [static] |
process feature-enabling request on hub
instance | root hub instance | |
feature | feature selector |
Definition at line 609 of file root_hub.c.
static int process_interrupt_mask_in_instance | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
process hanging interrupt request
If an interrupt transfer has been received and there was no change, the driver stores the transfer information and waits for change to occcur. This routine is called when that happens and it finalizes the interrupt transfer.
instance | hub instance | |
request | batch request to be processed |
Definition at line 910 of file root_hub.c.
static int process_port_feature_clear_request | ( | rh_t * | instance, | |
uint16_t | feature, | |||
uint16_t | port | |||
) | [static] |
process feature-disabling request on hub
instance | root hub instance | |
feature | feature selector | |
port | port number, counted from 1 | |
enable | enable or disable the specified feature |
Definition at line 681 of file root_hub.c.
static int process_port_feature_set_request | ( | rh_t * | instance, | |
uint16_t | feature, | |||
uint16_t | port | |||
) | [static] |
process feature-enabling request on hub
instance | root hub instance | |
feature | feature selector | |
port | port number, counted from 1 | |
enable | enable or disable the specified feature |
Definition at line 659 of file root_hub.c.
static int process_request_with_input | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
process one of requests that carry input data
Request can be one of USB_DEVREQ_SET_DESCRIPTOR or USB_DEVREQ_SET_CONFIGURATION.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 752 of file root_hub.c.
static int process_request_with_output | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
process one of requests that requere output data
Request can be one of USB_DEVREQ_GET_STATUS, USB_DEVREQ_GET_DESCRIPTOR or USB_DEVREQ_GET_CONFIGURATION.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 722 of file root_hub.c.
static int process_request_without_data | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) | [static] |
process one of requests that do not request nor carry additional data
Request can be one of USB_DEVREQ_CLEAR_FEATURE, USB_DEVREQ_SET_FEATURE or USB_DEVREQ_SET_ADDRESS.
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 779 of file root_hub.c.
static int register_endpoint | ( | ddf_fun_t * | fun, | |
usb_address_t | address, | |||
usb_speed_t | ep_speed, | |||
usb_endpoint_t | endpoint, | |||
usb_transfer_type_t | transfer_type, | |||
usb_direction_t | direction, | |||
size_t | max_packet_size, | |||
unsigned int | interval | |||
) | [static] |
Register endpoint for bandwidth reservation.
[in] | fun | Device function the action was invoked on. |
[in] | address | USB address of the device. |
[in] | ep_speed | Endpoint speed (invalid means to use device one). |
[in] | endpoint | Endpoint number. |
[in] | transfer_type | USB transfer type. |
[in] | direction | Endpoint data direction. |
[in] | max_packet_size | Max packet size of the endpoint. |
[in] | interval | Polling interval. |
static int release_address | ( | ddf_fun_t * | fun, | |
usb_address_t | address | |||
) | [static] |
static int request_address | ( | ddf_fun_t * | fun, | |
usb_speed_t | speed, | |||
usb_address_t * | address | |||
) | [static] |
int rh_init | ( | rh_t * | instance, | |
ohci_regs_t * | regs | |||
) |
static int rh_init_descriptors | ( | rh_t * | instance | ) | [static] |
initialize hub descriptors
Initialized are device and full configuration descriptor. These need to be initialized only once per hub. root hub instance
Definition at line 354 of file root_hub.c.
void rh_interrupt | ( | rh_t * | instance | ) |
process interrupt on a hub
If there is no pending interrupt transfer, nothing happens.
instance |
Definition at line 285 of file root_hub.c.
int rh_request | ( | rh_t * | instance, | |
usb_transfer_batch_t * | request | |||
) |
process root hub request
instance | root hub instance | |
request | structure containing both request and response information |
Definition at line 248 of file root_hub.c.
static int usb_iface_get_address | ( | ddf_fun_t * | fun, | |
devman_handle_t | handle, | |||
usb_address_t * | address | |||
) | [static] |
static int usb_iface_get_hc_handle | ( | ddf_fun_t * | fun, | |
devman_handle_t * | handle | |||
) | [static] |