summaryrefslogtreecommitdiff
path: root/tool/mbed/mbed-sdk/libraries/USBHost/USBHost/TARGET_RENESAS/TARGET_RZ_A1H/usb1/src/host/usb1_host_usbsig.c
blob: ea8abf876aaba3ae88eed9bc9f674c43d79ba5bf (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
/*******************************************************************************
* File Name    : usb1_host_usbsig.c
* $Rev: 1116 $
* $Date:: 2014-07-09 16:29:19 +0900#$
* Device(s)    : RZ/A1H
* Tool-Chain   :
* OS           : None
* H/W Platform :
* Description  : RZ/A1H R7S72100 USB Sample Program
* Operation    :
* Limitations  :
*******************************************************************************/


/*******************************************************************************
Includes   <System Includes> , "Project Includes"
*******************************************************************************/
#include "usb1_host.h"
#include "dev_drv.h"


/*******************************************************************************
Typedef definitions
*******************************************************************************/


/*******************************************************************************
Macro definitions
*******************************************************************************/


/*******************************************************************************
Imported global variables and functions (from other files)
*******************************************************************************/


/*******************************************************************************
Exported global variables and functions (to be accessed by other files)
*******************************************************************************/
static void usb1_host_EnableINT_Module(void);
static void usb1_host_Enable_AttachINT(void);
static void usb1_host_Disable_AttachINT(void);
static void usb1_host_Disable_BchgINT(void);


/*******************************************************************************
Private global variables and functions
*******************************************************************************/


/*******************************************************************************
* Function Name: usb1_host_InitModule
* Description  : Initializes the USB module in USB host module.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_InitModule (void)
{
    uint16_t buf1;
    uint16_t buf2;
    uint16_t buf3;

    usb1_host_init_pipe_status();

    RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                        1,
                        USB_SYSCFG_DCFM_SHIFT,
                        USB_SYSCFG_DCFM);       /* HOST mode */
    RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                        1,
                        USB_SYSCFG_DRPD_SHIFT,
                        USB_SYSCFG_DRPD);       /* PORT0 D+, D- setting */

    do
    {
        buf1 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);
        Userdef_USB_usb1_host_delay_xms(50);
        buf2 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);
        Userdef_USB_usb1_host_delay_xms(50);
        buf3 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);

    } while ((buf1 != buf2) || (buf1 != buf3));

    RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                        1,
                        USB_SYSCFG_USBE_SHIFT,
                        USB_SYSCFG_USBE);

    USB201.CFIFOSEL  = (uint16_t)(USB_HOST_BITRCNT | USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
    USB201.D0FIFOSEL = (uint16_t)(                   USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
    USB201.D1FIFOSEL = (uint16_t)(                   USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
}

/*******************************************************************************
* Function Name: usb1_host_CheckAttach
* Description  : Returns the USB device connection state.
* Arguments    : none
* Return Value : uint16_t ; USB_HOST_ATTACH : Attached
*              :          ; USB_HOST_DETACH : not Attached
*******************************************************************************/
uint16_t usb1_host_CheckAttach (void)
{
    uint16_t buf1;
    uint16_t buf2;
    uint16_t buf3;
    uint16_t rhst;

    do
    {
        buf1 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);
        Userdef_USB_usb1_host_delay_xms(50);
        buf2 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);
        Userdef_USB_usb1_host_delay_xms(50);
        buf3 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);

    } while ((buf1 != buf2) || (buf1 != buf3));

    rhst = RZA_IO_RegRead_16(&USB201.DVSTCTR0,
                                USB_DVSTCTR0_RHST_SHIFT,
                                USB_DVSTCTR0_RHST);
    if (rhst == USB_HOST_UNDECID)
    {
        if (buf1 == USB_HOST_FS_JSTS)
        {
            if (g_usb1_host_SupportUsbDeviceSpeed == USB_HOST_HIGH_SPEED)
            {
                RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                                    1,
                                    USB_SYSCFG_HSE_SHIFT,
                                    USB_SYSCFG_HSE);
            }
            else
            {
                RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                                    0,
                                    USB_SYSCFG_HSE_SHIFT,
                                    USB_SYSCFG_HSE);
            }
            return USB_HOST_ATTACH;
        }
        else if (buf1 == USB_HOST_LS_JSTS)
        {
            /* Low Speed Device */
            RZA_IO_RegWrite_16(&USB201.SYSCFG0,
                                0,
                                USB_SYSCFG_HSE_SHIFT,
                                USB_SYSCFG_HSE);
            return USB_HOST_ATTACH;
        }
        else
        {
            /* Do Nothing */
        }
    }
    else if ((rhst == USB_HOST_HSMODE) || (rhst == USB_HOST_FSMODE))
    {
        return USB_HOST_ATTACH;
    }
    else if (rhst == USB_HOST_LSMODE)
    {
        return USB_HOST_ATTACH;
    }
    else
    {
        /* Do Nothing */
    }

    return USB_HOST_DETACH;
}

/*******************************************************************************
* Function Name: usb1_host_UsbAttach
* Description  : Connects the USB device.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_UsbAttach (void)
{
    usb1_host_EnableINT_Module();
    usb1_host_Disable_BchgINT();
    usb1_host_Disable_AttachINT();
    usb1_host_Enable_DetachINT();
}

/*******************************************************************************
* Function Name: usb1_host_UsbDetach
* Description  : Disconnects the USB device.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_UsbDetach (void)
{
    uint16_t pipe;
    uint16_t devadr;

    g_usb1_host_driver_state = USB_HOST_DRV_DETACHED;

    /* Terminate all the pipes in which communications on port  */
    /* are currently carried out                                */
    for (pipe = 0; pipe < (USB_HOST_MAX_PIPE_NO + 1); ++pipe)
    {
        if (g_usb1_host_pipe_status[pipe] != USB_HOST_PIPE_IDLE)
        {
            if (pipe == USB_HOST_PIPE0)
            {
                devadr = RZA_IO_RegRead_16(&USB201.DCPMAXP,
                                            USB_DCPMAXP_DEVSEL_SHIFT,
                                            USB_DCPMAXP_DEVSEL);
            }
            else
            {
                devadr = RZA_IO_RegRead_16(&g_usb1_host_pipemaxp[pipe], USB_PIPEMAXP_DEVSEL_SHIFT, USB_PIPEMAXP_DEVSEL);
            }

            if (devadr == g_usb1_host_UsbAddress)
            {
                usb1_host_stop_transfer(pipe);
            }

            g_usb1_host_pipe_status[pipe] = USB_HOST_PIPE_IDLE;
        }
    }

    g_usb1_host_ConfigNum  = 0;
    g_usb1_host_UsbAddress = 0;
    g_usb1_host_default_max_packet[USB_HOST_DEVICE_0] = 64;

    usb1_host_UsbDetach2();
}

/*******************************************************************************
* Function Name: usb1_host_UsbDetach2
* Description  : Disconnects the USB device.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_UsbDetach2 (void)
{
    usb1_host_Disable_DetachINT();
    usb1_host_Disable_BchgINT();
    usb1_host_Enable_AttachINT();
}

/*******************************************************************************
* Function Name: usb1_host_UsbBusReset
* Description  : Issues the USB bus reset signal.
* Arguments    : none
* Return Value : uint16_t               ; RHST
*******************************************************************************/
uint16_t usb1_host_UsbBusReset (void)
{
    uint16_t buffer;
    uint16_t loop;

    RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
                        1,
                        USB_DVSTCTR0_USBRST_SHIFT,
                        USB_DVSTCTR0_USBRST);
    RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
                        0,
                        USB_DVSTCTR0_UACT_SHIFT,
                        USB_DVSTCTR0_UACT);

    Userdef_USB_usb1_host_delay_xms(50);

    buffer  = USB201.DVSTCTR0;
    buffer &= (uint16_t)(~(USB_HOST_BITRST));
    buffer |= USB_HOST_BITUACT;
    USB201.DVSTCTR0 = buffer;

    Userdef_USB_usb1_host_delay_xms(20);

    for (loop = 0, buffer = USB_HOST_HSPROC;  loop < 3; ++loop)
    {
        buffer = RZA_IO_RegRead_16(&USB201.DVSTCTR0,
                                    USB_DVSTCTR0_RHST_SHIFT,
                                    USB_DVSTCTR0_RHST);
        if (buffer == USB_HOST_HSPROC)
        {
            Userdef_USB_usb1_host_delay_xms(10);
        }
        else
        {
            break;
        }
    }

    return buffer;
}

/*******************************************************************************
* Function Name: usb1_host_UsbResume
* Description  : Issues the USB resume signal.
* Arguments    : none
* Return Value : int32_t            ; DEVDRV_SUCCESS
*              :                    ; DEVDRV_ERROR
*******************************************************************************/
int32_t usb1_host_UsbResume (void)
{
    uint16_t buf;

    if ((g_usb1_host_driver_state & USB_HOST_DRV_SUSPEND) == 0)
    {
        /* not SUSPEND */
        return DEVDRV_ERROR;
    }

    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        0,
                        USB_INTENB1_BCHGE_SHIFT,
                        USB_INTENB1_BCHGE);
    RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
                        1,
                        USB_DVSTCTR0_RESUME_SHIFT,
                        USB_DVSTCTR0_RESUME);
    Userdef_USB_usb1_host_delay_xms(20);

    buf  = USB201.DVSTCTR0;
    buf &= (uint16_t)(~(USB_HOST_BITRESUME));
    buf |= USB_HOST_BITUACT;
    USB201.DVSTCTR0 = buf;

    g_usb1_host_driver_state &= (uint16_t)~USB_HOST_DRV_SUSPEND;

    return DEVDRV_SUCCESS;
}

/*******************************************************************************
* Function Name: usb1_host_UsbSuspend
* Description  : Issues the USB suspend signal.
* Arguments    : none
* Return Value : int32_t            ; DEVDRV_SUCCESS   :not SUSPEND
*              :                    ; DEVDRV_ERROR     :SUSPEND
*******************************************************************************/
int32_t usb1_host_UsbSuspend (void)
{
    uint16_t buf;

    if ((g_usb1_host_driver_state & USB_HOST_DRV_SUSPEND) != 0)
    {
        /* SUSPEND */
        return DEVDRV_ERROR;
    }

    RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
                        0,
                        USB_DVSTCTR0_UACT_SHIFT,
                        USB_DVSTCTR0_UACT);

    Userdef_USB_usb1_host_delay_xms(5);

    buf = RZA_IO_RegRead_16(&USB201.SYSSTS0,
                                USB_SYSSTS0_LNST_SHIFT,
                                USB_SYSSTS0_LNST);
    if ((buf != USB_HOST_FS_JSTS) && (buf != USB_HOST_LS_JSTS))
    {
        usb1_host_UsbDetach();
    }
    else
    {
        g_usb1_host_driver_state |= USB_HOST_DRV_SUSPEND;
    }

    return DEVDRV_SUCCESS;
}

/*******************************************************************************
* Function Name: usb1_host_Enable_DetachINT
* Description  : Enables the USB disconnection interrupt.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_Enable_DetachINT (void)
{
    USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH));
    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        1,
                        USB_INTENB1_DTCHE_SHIFT,
                        USB_INTENB1_DTCHE);
}

/*******************************************************************************
* Function Name: usb1_host_Disable_DetachINT
* Description  : Disables the USB disconnection interrupt.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_Disable_DetachINT (void)
{
    USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH));
    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        0,
                        USB_INTENB1_DTCHE_SHIFT,
                        USB_INTENB1_DTCHE);
}

/*******************************************************************************
* Function Name: usb1_host_Enable_AttachINT
* Description  : Enables the USB connection detection interrupt.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_Enable_AttachINT (void)
{
    USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH));
    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        1,
                        USB_INTENB1_ATTCHE_SHIFT,
                        USB_INTENB1_ATTCHE);
}

/*******************************************************************************
* Function Name: usb1_host_Disable_AttachINT
* Description  : Disables the USB connection detection interrupt.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_Disable_AttachINT (void)
{
    USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH));
    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        0,
                        USB_INTENB1_ATTCHE_SHIFT,
                        USB_INTENB1_ATTCHE);
}

/*******************************************************************************
* Function Name: usb1_host_Disable_BchgINT
* Description  : Disables the USB bus change detection interrupt.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_Disable_BchgINT (void)
{
    USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITBCHG));
    RZA_IO_RegWrite_16(&USB201.INTENB1,
                        0,
                        USB_INTENB1_BCHGE_SHIFT,
                        USB_INTENB1_BCHGE);
}

/*******************************************************************************
* Function Name: usb1_host_set_devadd
* Description  : DEVADDn register is set by specified value
* Arguments    : uint16_t addr             : Device address
*              : uint16_t *devadd          : Set value
* Return Value : none
*******************************************************************************/
void usb1_host_set_devadd (uint16_t addr, uint16_t * devadd)
{
    uint16_t * ptr;
    uint16_t ret_flag = DEVDRV_FLAG_ON;                             // avoid warning.

    switch (addr)
    {
        case USB_HOST_DEVICE_0:
            ptr = (uint16_t *)&USB201.DEVADD0;
        break;

        case USB_HOST_DEVICE_1:
            ptr = (uint16_t *)&USB201.DEVADD1;
        break;

        case USB_HOST_DEVICE_2:
            ptr = (uint16_t *)&USB201.DEVADD2;
        break;

        case USB_HOST_DEVICE_3:
            ptr = (uint16_t *)&USB201.DEVADD3;
        break;

        case USB_HOST_DEVICE_4:
            ptr = (uint16_t *)&USB201.DEVADD4;
        break;

        case USB_HOST_DEVICE_5:
            ptr = (uint16_t *)&USB201.DEVADD5;
        break;

        case USB_HOST_DEVICE_6:
            ptr = (uint16_t *)&USB201.DEVADD6;
        break;

        case USB_HOST_DEVICE_7:
            ptr = (uint16_t *)&USB201.DEVADD7;
        break;

        case USB_HOST_DEVICE_8:
            ptr = (uint16_t *)&USB201.DEVADD8;
        break;

        case USB_HOST_DEVICE_9:
            ptr = (uint16_t *)&USB201.DEVADD9;
        break;

        case USB_HOST_DEVICE_10:
            ptr = (uint16_t *)&USB201.DEVADDA;
        break;

        default:
            ret_flag = DEVDRV_FLAG_OFF;
        break;
    }

    if (ret_flag == DEVDRV_FLAG_ON)
    {
        *ptr = (uint16_t)(*devadd & USB_HOST_DEVADD_MASK);
    }
}

/*******************************************************************************
* Function Name: usb1_host_get_devadd
* Description  : DEVADDn register is obtained
* Arguments    : uint16_t addr      : Device address
*              : uint16_t *devadd   : USB_HOST_DEVADD register value
* Return Value : none
*******************************************************************************/
void usb1_host_get_devadd (uint16_t addr, uint16_t * devadd)
{
    uint16_t * ptr;
    uint16_t ret_flag = DEVDRV_FLAG_ON;                             // avoid warning.

    switch (addr)
    {
        case USB_HOST_DEVICE_0:
            ptr = (uint16_t *)&USB201.DEVADD0;
        break;

        case USB_HOST_DEVICE_1:
            ptr = (uint16_t *)&USB201.DEVADD1;
        break;

        case USB_HOST_DEVICE_2:
            ptr = (uint16_t *)&USB201.DEVADD2;
        break;

        case USB_HOST_DEVICE_3:
            ptr = (uint16_t *)&USB201.DEVADD3;
        break;

        case USB_HOST_DEVICE_4:
            ptr = (uint16_t *)&USB201.DEVADD4;
        break;

        case USB_HOST_DEVICE_5:
            ptr = (uint16_t *)&USB201.DEVADD5;
        break;

        case USB_HOST_DEVICE_6:
            ptr = (uint16_t *)&USB201.DEVADD6;
        break;

        case USB_HOST_DEVICE_7:
            ptr = (uint16_t *)&USB201.DEVADD7;
        break;

        case USB_HOST_DEVICE_8:
            ptr = (uint16_t *)&USB201.DEVADD8;
        break;

        case USB_HOST_DEVICE_9:
            ptr = (uint16_t *)&USB201.DEVADD9;
        break;

        case USB_HOST_DEVICE_10:
            ptr = (uint16_t *)&USB201.DEVADDA;
        break;

        default:
            ret_flag = DEVDRV_FLAG_OFF;
        break;
    }

    if (ret_flag == DEVDRV_FLAG_ON)
    {
        *devadd = *ptr;
    }
}

/*******************************************************************************
* Function Name: usb1_host_EnableINT_Module
* Description  : Enables BEMP/NRDY/BRDY interrupt and SIGN/SACK interrupt.
*              : Enables NRDY/BEMP interrupt in the pipe0.
* Arguments    : none
* Return Value : none
*******************************************************************************/
void usb1_host_EnableINT_Module (void)
{
    uint16_t buf;

    buf  = USB201.INTENB0;
    buf |= (USB_HOST_BITBEMPE | USB_HOST_BITNRDYE | USB_HOST_BITBRDYE);
    USB201.INTENB0 = buf;

    buf  = USB201.INTENB1;
    buf |= (USB_HOST_BITSIGNE | USB_HOST_BITSACKE);
    USB201.INTENB1 = buf;

    usb1_host_enable_nrdy_int(USB_HOST_PIPE0);
    usb1_host_enable_bemp_int(USB_HOST_PIPE0);
}

/* End of File */