NetBurner 3.5.8
PDF Version
Toggle main menu visibility
usb_host_internal.h
1
/*
2
* USB Host Internal Definitions
3
*
4
* Internal header for USB Host driver implementation
5
*/
6
7
#ifndef _USB_HOST_INTERNAL_H_
8
#define _USB_HOST_INTERNAL_H_
9
10
#include <usb_host_config.h>
11
#include <nbrtos.h>
12
#include <stdint.h>
13
14
/* Include NXP USB Host stack headers */
15
#include "nxp_usb.h"
16
#include <usb_host.h>
17
#include <usb_host_msd.h>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
23
/*******************************************************************************
24
* MSD Class Definitions
25
******************************************************************************/
26
27
/* MSD class codes (for reference - also defined in NXP headers) */
28
#ifndef USB_HOST_MSD_CLASS_CODE
29
#define USB_HOST_MSD_CLASS_CODE (0x08U)
30
#endif
31
#ifndef USB_HOST_MSD_SUBCLASS_CODE_UFI
32
#define USB_HOST_MSD_SUBCLASS_CODE_UFI (0x04U)
33
#endif
34
#ifndef USB_HOST_MSD_SUBCLASS_CODE_SCSI
35
#define USB_HOST_MSD_SUBCLASS_CODE_SCSI (0x06U)
36
#endif
37
#ifndef USB_HOST_MSD_PROTOCOL_BULK
38
#define USB_HOST_MSD_PROTOCOL_BULK (0x50U)
39
#endif
40
41
/* MSD run states for our application */
42
typedef
enum
{
43
kMSD_AppRunIdle = 0,
44
kMSD_AppRunSetInterface,
45
kMSD_AppRunWaitSetInterface,
46
kMSD_AppRunMassStorageTest,
47
kMSD_AppRunReadCapacity,
48
kMSD_AppRunReady,
49
} msd_app_run_state_t;
50
51
/* Device attach states */
52
typedef
enum
{
53
kMSD_DevIdle = 0,
54
kMSD_DevAttached,
55
kMSD_DevDetached,
56
} msd_dev_state_t;
57
58
/* Application-level MSD instance structure
59
* This wraps the NXP class driver with additional application state */
60
typedef
struct
_msd_app_instance {
61
/* NXP USB Host handles */
62
usb_host_configuration_handle configHandle;
63
usb_device_handle deviceHandle;
64
usb_host_class_handle classHandle;
/* Pointer to NXP usb_host_msd_instance_t */
65
usb_host_interface_handle interfaceHandle;
66
67
/* Command buffer for MSD operations */
68
uint8_t *commandBuffer;
69
70
/* Application state tracking */
71
uint8_t prevDeviceState;
72
uint8_t deviceState;
/* msd_dev_state_t */
73
uint8_t runWaitState;
/* msd_app_run_state_t */
74
uint8_t runState;
/* msd_app_run_state_t */
75
76
/* Device geometry (from READ CAPACITY) */
77
uint32_t sectorSize;
78
uint32_t sectorCount;
79
} msd_app_instance_t;
80
81
/*******************************************************************************
82
* Global Variables (defined in usb_host_init.cpp)
83
******************************************************************************/
84
85
extern
usb_host_handle g_UsbHostHandle;
86
extern
msd_app_instance_t g_MsdAppInstance;
87
extern
OS_SEM
*g_MsdEventSem;
88
extern
volatile
int
g_MsdStatus;
89
90
/*******************************************************************************
91
* Platform Integration Functions (implemented in usb_host_init.cpp)
92
******************************************************************************/
93
94
/* Clock and PHY initialization */
95
void
USB_HostClockInit(
void
);
96
void
USB_HostPhyInit(
void
);
97
98
/* ISR and interrupt enable */
99
void
USB_HostIsrEnable(
void
);
100
void
USB_HostIsrDisable(
void
);
101
102
/* Internal MSD event callback */
103
usb_status_t USB_HostMsdEvent(usb_device_handle deviceHandle,
104
usb_host_configuration_handle configurationHandle,
105
uint32_t eventCode);
106
107
/* MSD task function */
108
void
USB_HostMsdTask(
void
*param);
109
110
#ifdef __cplusplus
111
}
112
#endif
113
114
#endif
/* _USB_HOST_INTERNAL_H_ */
OS_SEM
Semaphores are used to control access to shared resources or or to communicate between tasks in a mul...
Definition
nbrtos.h:407
examples
PlatformSpecific
SOMRT1061
USB
USB_MSD_Host
src
include
usb_host_internal.h
Generated by
1.18.0