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

Dependencies:   mbed

Committer:
AjK
Date:
Mon Oct 11 10:34:55 2010 +0000
Revision:
0:0a841b89d614
Totally Alpha quality as this project isn\t completed. Just publishing it as it answers many questions asked in the forums

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:0a841b89d614 1 /****************************************************************************
AjK 0:0a841b89d614 2 * Copyright 2010 Andy Kirkham, Stellar Technologies Ltd
AjK 0:0a841b89d614 3 *
AjK 0:0a841b89d614 4 * This file is part of the Satellite Observers Workbench (SOWB).
AjK 0:0a841b89d614 5 *
AjK 0:0a841b89d614 6 * SOWB is free software: you can redistribute it and/or modify
AjK 0:0a841b89d614 7 * it under the terms of the GNU General Public License as published by
AjK 0:0a841b89d614 8 * the Free Software Foundation, either version 3 of the License, or
AjK 0:0a841b89d614 9 * (at your option) any later version.
AjK 0:0a841b89d614 10 *
AjK 0:0a841b89d614 11 * SOWB is distributed in the hope that it will be useful,
AjK 0:0a841b89d614 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
AjK 0:0a841b89d614 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
AjK 0:0a841b89d614 14 * GNU General Public License for more details.
AjK 0:0a841b89d614 15 *
AjK 0:0a841b89d614 16 * You should have received a copy of the GNU General Public License
AjK 0:0a841b89d614 17 * along with SOWB. If not, see <http://www.gnu.org/licenses/>.
AjK 0:0a841b89d614 18 *
AjK 0:0a841b89d614 19 * $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $
AjK 0:0a841b89d614 20 *
AjK 0:0a841b89d614 21 ***************************************************************************/
AjK 0:0a841b89d614 22
AjK 0:0a841b89d614 23 #ifndef USBEH_API_H
AjK 0:0a841b89d614 24 #define USBEH_API_H
AjK 0:0a841b89d614 25
AjK 0:0a841b89d614 26 #include "usbeh.h"
AjK 0:0a841b89d614 27 #include "usbeh_endpoint.h"
AjK 0:0a841b89d614 28 #include "usbeh_device.h"
AjK 0:0a841b89d614 29 #include "usbeh_controller.h"
AjK 0:0a841b89d614 30
AjK 0:0a841b89d614 31 /* Define a callback for device driver OnLoad handlers.
AjK 0:0a841b89d614 32 Cast *info as (USBEH_DEVICE_INFO *) as that's what
AjK 0:0a841b89d614 33 will be passed. */
AjK 0:0a841b89d614 34 typedef int (*USBEH_device_info_callback)(int device, USBEH_deviceDescriptor *deviceDesc, USBEH_interfaceDescriptor **interfaceDesc);
AjK 0:0a841b89d614 35
AjK 0:0a841b89d614 36 /* Called for a device insertion. Define the driver in this function. */
AjK 0:0a841b89d614 37 void usbeh_api_on_load_device(int device, USBEH_deviceDescriptor* deviceDesc, USBEH_interfaceDescriptor **interfaceDesc);
AjK 0:0a841b89d614 38
AjK 0:0a841b89d614 39 /* Local statics. */
AjK 0:0a841b89d614 40 static USBEH_Setup* usbeh_api_get_setup(int device);
AjK 0:0a841b89d614 41 static int usbeh_api_wait_IO_done(USBEH_Endpoint* endpoint);
AjK 0:0a841b89d614 42
AjK 0:0a841b89d614 43 /* The exported API. */
AjK 0:0a841b89d614 44 int usbeh_api_init(void);
AjK 0:0a841b89d614 45 void usbeh_api_process(void);
AjK 0:0a841b89d614 46 int usbeh_api_set_address(int device, int new_addr);
AjK 0:0a841b89d614 47 int usbeh_api_get_descriptor(int device, int descType,int descIndex, USBEH_U08* data, int length);
AjK 0:0a841b89d614 48 int usbeh_api_get_string(int device, int index, char *dst, int length);
AjK 0:0a841b89d614 49 int usbeh_api_get_port_status(int device, int port, USBEH_U32 *status);
AjK 0:0a841b89d614 50 int usbeh_api_clear_port_feature(int device, int feature, int index);
AjK 0:0a841b89d614 51 int usbeh_api_set_port_feature(int device, int feature, int index);
AjK 0:0a841b89d614 52 int usbeh_api_set_port_power(int device, int port);
AjK 0:0a841b89d614 53 int usbeh_api_set_configuration(int device, int configNum);
AjK 0:0a841b89d614 54 int usbeh_api_set_port_reset(int device, int port);
AjK 0:0a841b89d614 55 int usbeh_api_transfer(int device, int ep, USBEH_U08 flags, USBEH_U08 *data, int length, USBEH_callback callback, void* userData);
AjK 0:0a841b89d614 56 int usbeh_api_interrupt_transfer(int device, int ep, USBEH_U08* data, int length, USBEH_callback callback, void* userData);
AjK 0:0a841b89d614 57 int usbeh_api_control_transfer_short(int device, int request_type, int request, int value, int index, USBEH_U08 *data, int length);
AjK 0:0a841b89d614 58 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);
AjK 0:0a841b89d614 59
AjK 0:0a841b89d614 60 void usbeh_sof_counter_init(USBEH_SOF_COUNTER *q, USBEH_U08 mode, USBEH_U32 count);
AjK 0:0a841b89d614 61 void usbeh_sof_counter_register(USBEH_SOF_COUNTER *q);
AjK 0:0a841b89d614 62 void usbeh_sof_counter_unregister(USBEH_SOF_COUNTER *q);
AjK 0:0a841b89d614 63
AjK 0:0a841b89d614 64 /* Debugging. */
AjK 0:0a841b89d614 65 void usbeh_api_list_endpoints(void);
AjK 0:0a841b89d614 66
AjK 0:0a841b89d614 67 // END #ifndef USBEH_API_H
AjK 0:0a841b89d614 68 #endif