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_endpoint.cpp Source File

usbeh_endpoint.cpp

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 #include "sowb.h"
00024 #include "usbeh.h"
00025 #include "usbeh_endpoint.h"
00026 
00027 int USBEH_Endpoint::address(void) {
00028     int address = (endpointDescriptor.control >> 7) & 0xf;
00029     if (address) {
00030         address |= flags & 0x80;
00031     }
00032     return address;    
00033 }
00034 
00035 int USBEH_Endpoint::device(void) {
00036     return endpointDescriptor.control & 0x7f;
00037 }
00038 
00039 int USBEH_Endpoint::status(void) {
00040     return (tdHead.control >> 28) & 0xF;
00041 }
00042 
00043 USBEH_U32 USBEH_Endpoint::queue(USBEH_U32 head) {
00044     if (currentState == notQueued) {
00045         endpointDescriptor.next = head;
00046         head = (USBEH_U32)&endpointDescriptor;
00047         currentState = idle;
00048     }   
00049     return head;
00050 }