host_din.c
2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*HEADER******************************************************************
**************************************************************************
***
*** Copyright (c) 2001-2002 ARC International.
*** All rights reserved
***
*** This software embodies materials and concepts which are
*** confidential to ARC International and is made
*** available solely pursuant to the terms of a written license
*** agreement with ARC International
***
*** File: hostapi.c
***
*** Comments:
*** This file contains the USB Host API specific functions.
***
**************************************************************************
*END*********************************************************************/
#include "os_bb.h"
#include "osint.h"
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_close_pipe
* Returned Value : None
* Comments :
* _usb_host_close_pipe routine removes the pipe from the open pipe list
*
*END*-----------------------------------------------------------------*/
void _usb_host_close_pipe
(
/* [IN] the USB Host state structure */
_usb_host_handle handle,
/* [IN] the pipe id to close */
int_16 pipeid
)
{
USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
USB_lock();
/* de-initialise the pipe descriptor */
bzero(&usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[pipeid],
sizeof(PIPE_DESCRIPTOR_STRUCT));
USB_unlock();
}
/*FUNCTION*-------------------------------------------------------------
*
* Function Name : _usb_host_close_all_pipes
* Returned Value : None
* Comments :
* _usb_host_close_all_pipes routine removes the pipe from the open pipe list
*
*END*-----------------------------------------------------------------*/
void _usb_host_close_all_pipes
(
/* [IN] the USB Host state structure */
_usb_host_handle handle
)
{
int_16 i;
USB_HOST_STATE_STRUCT_PTR usb_host_ptr;
usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;
USB_lock();
for (i=0; i<usb_host_ptr->MAX_PIPES; i++) {
if (!(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[i].OPEN)) {
break;
} else {
/* unregister the service routine if any */
(void) _usb_host_unregister_service(handle,
usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[i].PIPE_ID);
/* de-initialise the pipe descriptor */
bzero(&usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR[i],
sizeof(PIPE_DESCRIPTOR_STRUCT));
}
}
/* Initialize the current pipe id to -1 indicating that there are no pipes
** queued
*/
usb_host_ptr->CURRENT_PIPE_ID = -1;
USB_unlock();
}