1 /** @file
2 This file contains the definination for host controller schedule routines.
3 
4 Copyright (c) 2013-2015 Intel Corporation.
5 
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 
17 
18 #ifndef _OHCI_SCHED_H
19 #define _OHCI_SCHED_H
20 
21 #include "Descriptor.h"
22 
23 #define HCCA_MEM_SIZE     256
24 #define GRID_SIZE         16
25 #define GRID_SHIFT        4
26 
27 /**
28 
29   Convert Error code from OHCI format to EFI format
30 
31   @Param  ErrorCode             ErrorCode in OHCI format
32 
33   @retval                       ErrorCode in EFI format
34 
35 **/
36 UINT32
37 ConvertErrorCode (
38   IN  UINT32              ErrorCode
39   );
40 /**
41 
42   Check TDs Results
43 
44   @Param  Ohc                   UHC private data
45   @Param  Td                    TD_DESCRIPTOR
46   @Param  Result                Result to return
47 
48   @retval TRUE                  means OK
49   @retval FLASE                 means Error or Short packet
50 
51 **/
52 BOOLEAN
53 OhciCheckTDsResults (
54   IN  USB_OHCI_HC_DEV     *Ohc,
55   IN  TD_DESCRIPTOR       *Td,
56   OUT UINT32              *Result
57   );
58 /**
59 
60   Check the task status on an ED
61 
62   @Param  Ed                    Pointer to the ED task that TD hooked on
63   @Param  HeadTd                TD header for current transaction
64 
65   @retval                       Task Status Code
66 
67 **/
68 
69 UINT32
70 CheckEDStatus (
71   IN  ED_DESCRIPTOR       *Ed,
72   IN  TD_DESCRIPTOR       *HeadTd
73   );
74 /**
75 
76   Check the task status
77 
78   @Param  Ohc                   UHC private data
79   @Param  ListType              Pipe type
80   @Param  Ed                    Pointer to the ED task hooked on
81   @Param  HeadTd                Head of TD corresponding to the task
82   @Param  ErrorCode             return the ErrorCode
83 
84   @retval  EFI_SUCCESS          Task done
85   @retval  EFI_NOT_READY        Task on processing
86   @retval  EFI_DEVICE_ERROR     Some error occured
87 
88 **/
89 EFI_STATUS
90 CheckIfDone (
91   IN  USB_OHCI_HC_DEV       *Ohc,
92   IN  DESCRIPTOR_LIST_TYPE  ListType,
93   IN  ED_DESCRIPTOR         *Ed,
94   IN  TD_DESCRIPTOR         *HeadTd,
95   OUT UINT32                *ErrorCode
96   );
97 /**
98 
99   Convert TD condition code to Efi Status
100 
101   @Param  ConditionCode         Condition code to convert
102 
103   @retval  EFI_SUCCESS          No error occured
104   @retval  EFI_NOT_READY        TD still on processing
105   @retval  EFI_DEVICE_ERROR     Error occured in processing TD
106 
107 **/
108 
109 EFI_STATUS
110 OhciTDConditionCodeToStatus (
111   IN  UINT32              ConditionCode
112   );
113 
114 #endif
115