comparison packages/io/usb/slave/current/src/usbs.c @ 2970:b479691ea40f

* src/usbs.c, include/usbs.h: Extend usbs_control_endpoint struct and provide usbs_get_*_endpoint() functions to facilitate dynamic data endpoint configuration. Contributed by Chris Holgate. [ Bugzilla 1001024] * doc/usbs.sgml: Document the above changes. * cdl/usbs.cdl: Fix erroneous CYGPKG_IO_USB_SLAVE_TESTS display string.
author jld
date Wed, 27 Oct 2010 10:04:33 +0000
parents 74dbf4c3f2e1
children
comparison
equal deleted inserted replaced
2969:7b425c007a6c 2970:b479691ea40f
6 // 6 //
7 //========================================================================== 7 //==========================================================================
8 // ####ECOSGPLCOPYRIGHTBEGIN#### 8 // ####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
12 // 12 //
13 // eCos is free software; you can redistribute it and/or modify it under 13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free 14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later 15 // Software Foundation; either version 2 or (at your option) any later
16 // version. 16 // version.
193 193
194 // ---------------------------------------------------------------------------- 194 // ----------------------------------------------------------------------------
195 // USB-specific functions that are useful for applications/packages which 195 // USB-specific functions that are useful for applications/packages which
196 // do not want to use the devtab interface. These may get called in DSR 196 // do not want to use the devtab interface. These may get called in DSR
197 // context. 197 // context.
198
199 usbs_rx_endpoint*
200 usbs_get_rx_endpoint(usbs_control_endpoint* control_endpoint,
201 cyg_uint8 endpoint_id)
202 {
203 CYG_CHECK_DATA_PTR(control_endpoint, "A valid control endpoint must be supplied");
204 CYG_CHECK_FUNC_PTR(control_endpoint->get_rxep_fn, "Dynamic endpoint access not supported");
205 if (control_endpoint->state != USBS_STATE_CONFIGURED)
206 return NULL;
207 return (*control_endpoint->get_rxep_fn)(control_endpoint, endpoint_id);
208 }
209
210 usbs_tx_endpoint*
211 usbs_get_tx_endpoint(usbs_control_endpoint* control_endpoint,
212 cyg_uint8 endpoint_id)
213 {
214 CYG_CHECK_DATA_PTR(control_endpoint, "A valid control endpoint must be supplied");
215 CYG_CHECK_FUNC_PTR(control_endpoint->get_txep_fn, "Dynamic endpoint access not supported");
216 if (control_endpoint->state != USBS_STATE_CONFIGURED)
217 return NULL;
218 return (*control_endpoint->get_txep_fn)(control_endpoint, endpoint_id);
219 }
198 220
199 void 221 void
200 usbs_start_rx(usbs_rx_endpoint* endpoint) 222 usbs_start_rx(usbs_rx_endpoint* endpoint)
201 { 223 {
202 CYG_CHECK_DATA_PTR( endpoint, "A valid USB endpoint must be supplied"); 224 CYG_CHECK_DATA_PTR( endpoint, "A valid USB endpoint must be supplied");