00001 /* Implémentation Linux de la bibliotheque XADLL de Sidena 00002 * Copyright (C) 2005 ENSTAR 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * You can contact us: 00019 * Association ENSTAR 00020 * Ecole Nationale Superieure de Techniques Avancees 00021 * 32 boulevard Victor 00022 * 75739 Paris Cedex 15 00023 * FRANCE 00024 * 00025 * enstar@ensta.fr 00026 */ 00027 00028 /** @file os_dep_usb.h 00029 * @brief Bibliothèque de fonctions de communication avec le port USB 00030 * @author Francois Fevotte <francois.fevotte@ensta.org> 00031 * $Revision: 7 $ 00032 * $Date: 2006-02-13 14:34:33 +0100 (Mon, 13 Feb 2006) $ 00033 */ 00034 00035 /* $Id: os_dep_usb.h 7 2006-02-13 13:34:33Z francois $ */ 00036 00037 #ifndef OS_DEP_USB_H 00038 #define OS_DEP_USB_H 00039 00040 00041 /** @brief Fonctions de communication USB 00042 */ 00043 namespace usb 00044 { 00045 /** @brief Ouverture du périphérique USB 00046 * 00047 * Le périphérique USB est détecté, ouvert puis configuré selon la séquence suivante : 00048 * @li listage des périphériques FTDI 00049 * @li ouverture du premier périphérique FTDI 00050 * @li réinitialisation 00051 * @li réglage des 'timeouts' d'écriture et lecture à 100ms 00052 * 00053 * @return @li 0 en cas de succes 00054 * @li 1 en cas d'échec 00055 */ 00056 int open(void); 00057 00058 00059 /** @brief Fermeture du périphérique USB 00060 */ 00061 void close(void); 00062 00063 00064 /** @brief Écriture sur le périphérique USB 00065 * 00066 * Le contenu de la variable globale 'Out_buffer' est envoyé au périphérique USB 00067 * 00068 * @param length longueur du buffer à transmettre 00069 * @return @li 1 en cas de succès 00070 * @li 0 en cas d'échec 00071 */ 00072 int write(short length); 00073 00074 00075 /** @brief Lecture sur le périphérique USB 00076 * 00077 * Lit 'length' caractères sur le périphérique USB et les place en fin du buffer de réception 'Rec_buffer' 00078 * 00079 * @param length le nombre de caractères à lire 00080 * @return le nombre de caractères lus 00081 */ 00082 int read(short length); 00083 } 00084 00085 #endif