Satellite Observers Workbench. NOT yet complete, just published for forum posters to \"cherry pick\" pieces of code as requiered as an example.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usbeh_api.h Source File

usbeh_api.h

00001 /****************************************************************************
00002  *    Copyright 2010 Andy Kirkham, Stellar Technologies Ltd
00003  *    
00004  *    This file is part of the Satellite Observers Workbench (SOWB).
00005  *
00006  *    SOWB is free software: you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation, either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    SOWB is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with SOWB.  If not, see <http://www.gnu.org/licenses/>.
00018  *
00019  *    $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $
00020  *    
00021  ***************************************************************************/
00022 
00023 #ifndef USBEH_API_H
00024 #define USBEH_API_H
00025 
00026 #include "usbeh.h"
00027 #include "usbeh_endpoint.h"
00028 #include "usbeh_device.h"
00029 #include "usbeh_controller.h"
00030 
00031 /* Define a callback for device driver OnLoad handlers. 
00032    Cast *info as (USBEH_DEVICE_INFO *) as that's what 
00033    will be passed. */
00034 typedef int (*USBEH_device_info_callback)(int device, USBEH_deviceDescriptor *deviceDesc, USBEH_interfaceDescriptor **interfaceDesc);
00035 
00036 /* Called for a device insertion. Define the driver in this function. */
00037 void usbeh_api_on_load_device(int device, USBEH_deviceDescriptor* deviceDesc, USBEH_interfaceDescriptor **interfaceDesc);
00038 
00039 /* Local statics. */
00040 static USBEH_Setup* usbeh_api_get_setup(int device);
00041 static int usbeh_api_wait_IO_done(USBEH_Endpoint* endpoint);
00042 
00043 /* The exported API. */
00044 int usbeh_api_init(void);
00045 void usbeh_api_process(void);
00046 int usbeh_api_set_address(int device, int new_addr);
00047 int usbeh_api_get_descriptor(int device, int descType,int descIndex, USBEH_U08* data, int length);
00048 int usbeh_api_get_string(int device, int index, char *dst, int length);
00049 int usbeh_api_get_port_status(int device, int port, USBEH_U32 *status);
00050 int usbeh_api_clear_port_feature(int device, int feature, int index);
00051 int usbeh_api_set_port_feature(int device, int feature, int index);
00052 int usbeh_api_set_port_power(int device, int port);
00053 int usbeh_api_set_configuration(int device, int configNum);
00054 int usbeh_api_set_port_reset(int device, int port);
00055 int usbeh_api_transfer(int device, int ep, USBEH_U08 flags, USBEH_U08 *data, int length, USBEH_callback callback, void* userData);
00056 int usbeh_api_interrupt_transfer(int device, int ep, USBEH_U08* data, int length, USBEH_callback callback, void* userData);
00057 int usbeh_api_control_transfer_short(int device, int request_type, int request, int value, int index, USBEH_U08 *data, int length);
00058 int usbeh_api_control_transfer(int device, int request_type, int request, int value, int index, USBEH_U08 *data, int length, USBEH_callback callback, void *userData);
00059 
00060 void usbeh_sof_counter_init(USBEH_SOF_COUNTER *q, USBEH_U08 mode, USBEH_U32 count);
00061 void usbeh_sof_counter_register(USBEH_SOF_COUNTER *q);
00062 void usbeh_sof_counter_unregister(USBEH_SOF_COUNTER *q);
00063 
00064 /* Debugging. */
00065 void usbeh_api_list_endpoints(void);
00066 
00067 // END #ifndef USBEH_API_H
00068 #endif