1st Release
Fork of USBDevice by
USBDevice/TARGET_RENESAS/TARGET_RZ_A1H/usb1/src/function/usb1_function_controlrw.c@46:378357d7e90d, 2015-03-31 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Mar 31 16:15:39 2015 +0100
- Revision:
- 46:378357d7e90d
Synchronized with git revision 251f3f8b55a4dc98b831c80e032464ed45cce309
Full URL: https://github.com/mbedmicro/mbed/commit/251f3f8b55a4dc98b831c80e032464ed45cce309/
[RZ/A1H]Add some function(USB 2port, NVIC wrapper) and modify some settings(OS, Terminal).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 46:378357d7e90d | 1 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 2 | * DISCLAIMER |
mbed_official | 46:378357d7e90d | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
mbed_official | 46:378357d7e90d | 4 | * intended for use with Renesas products. No other uses are authorized. This |
mbed_official | 46:378357d7e90d | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
mbed_official | 46:378357d7e90d | 6 | * all applicable laws, including copyright laws. |
mbed_official | 46:378357d7e90d | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
mbed_official | 46:378357d7e90d | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
mbed_official | 46:378357d7e90d | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 46:378357d7e90d | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
mbed_official | 46:378357d7e90d | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
mbed_official | 46:378357d7e90d | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
mbed_official | 46:378357d7e90d | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
mbed_official | 46:378357d7e90d | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
mbed_official | 46:378357d7e90d | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
mbed_official | 46:378357d7e90d | 16 | * Renesas reserves the right, without notice, to make changes to this software |
mbed_official | 46:378357d7e90d | 17 | * and to discontinue the availability of this software. By using this software, |
mbed_official | 46:378357d7e90d | 18 | * you agree to the additional terms and conditions found by accessing the |
mbed_official | 46:378357d7e90d | 19 | * following link: |
mbed_official | 46:378357d7e90d | 20 | * http://www.renesas.com/disclaimer |
mbed_official | 46:378357d7e90d | 21 | * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved. |
mbed_official | 46:378357d7e90d | 22 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 23 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 24 | * File Name : usb1_function_controlrw.c |
mbed_official | 46:378357d7e90d | 25 | * $Rev: 1116 $ |
mbed_official | 46:378357d7e90d | 26 | * $Date:: 2014-07-09 16:29:19 +0900#$ |
mbed_official | 46:378357d7e90d | 27 | * Device(s) : RZ/A1H |
mbed_official | 46:378357d7e90d | 28 | * Tool-Chain : |
mbed_official | 46:378357d7e90d | 29 | * OS : None |
mbed_official | 46:378357d7e90d | 30 | * H/W Platform : |
mbed_official | 46:378357d7e90d | 31 | * Description : RZ/A1H R7S72100 USB Sample Program |
mbed_official | 46:378357d7e90d | 32 | * Operation : |
mbed_official | 46:378357d7e90d | 33 | * Limitations : |
mbed_official | 46:378357d7e90d | 34 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 35 | |
mbed_official | 46:378357d7e90d | 36 | |
mbed_official | 46:378357d7e90d | 37 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 38 | Includes <System Includes> , "Project Includes" |
mbed_official | 46:378357d7e90d | 39 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 40 | #include "usb1_function.h" |
mbed_official | 46:378357d7e90d | 41 | |
mbed_official | 46:378357d7e90d | 42 | |
mbed_official | 46:378357d7e90d | 43 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 44 | Typedef definitions |
mbed_official | 46:378357d7e90d | 45 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 46 | |
mbed_official | 46:378357d7e90d | 47 | |
mbed_official | 46:378357d7e90d | 48 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 49 | Macro definitions |
mbed_official | 46:378357d7e90d | 50 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 51 | |
mbed_official | 46:378357d7e90d | 52 | |
mbed_official | 46:378357d7e90d | 53 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 54 | Imported global variables and functions (from other files) |
mbed_official | 46:378357d7e90d | 55 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 56 | |
mbed_official | 46:378357d7e90d | 57 | |
mbed_official | 46:378357d7e90d | 58 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 59 | Exported global variables and functions (to be accessed by other files) |
mbed_official | 46:378357d7e90d | 60 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 61 | |
mbed_official | 46:378357d7e90d | 62 | |
mbed_official | 46:378357d7e90d | 63 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 64 | Private global variables and functions |
mbed_official | 46:378357d7e90d | 65 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 66 | |
mbed_official | 46:378357d7e90d | 67 | |
mbed_official | 46:378357d7e90d | 68 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 69 | * Function Name: usb1_api_function_CtrlReadStart |
mbed_official | 46:378357d7e90d | 70 | * Description : Executes the USB control read transfer. |
mbed_official | 46:378357d7e90d | 71 | * : USB host controller <- USB device |
mbed_official | 46:378357d7e90d | 72 | * Arguments : uint16_t size ; Data Size |
mbed_official | 46:378357d7e90d | 73 | * : uint8_t *data ; Data Address |
mbed_official | 46:378357d7e90d | 74 | * Return Value : DEVDRV_USBF_WRITEEND ; End of data write |
mbed_official | 46:378357d7e90d | 75 | * : DEVDRV_USBF_WRITESHRT ; End of short data write |
mbed_official | 46:378357d7e90d | 76 | * : DEVDRV_USBF_WRITING ; Continue of data write |
mbed_official | 46:378357d7e90d | 77 | * : DEVDRV_USBF_FIFOERROR ; FIFO access error |
mbed_official | 46:378357d7e90d | 78 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 79 | uint16_t usb1_api_function_CtrlReadStart (uint32_t size, uint8_t * data) |
mbed_official | 46:378357d7e90d | 80 | { |
mbed_official | 46:378357d7e90d | 81 | uint16_t status; |
mbed_official | 46:378357d7e90d | 82 | uint16_t mbw; |
mbed_official | 46:378357d7e90d | 83 | |
mbed_official | 46:378357d7e90d | 84 | usb1_function_set_pid_nak(USB_FUNCTION_PIPE0); |
mbed_official | 46:378357d7e90d | 85 | |
mbed_official | 46:378357d7e90d | 86 | g_usb1_function_data_count[USB_FUNCTION_PIPE0] = size; |
mbed_official | 46:378357d7e90d | 87 | g_usb1_function_data_pointer[USB_FUNCTION_PIPE0] = data; |
mbed_official | 46:378357d7e90d | 88 | |
mbed_official | 46:378357d7e90d | 89 | mbw = usb1_function_get_mbw(g_usb1_function_data_count[USB_FUNCTION_PIPE0], |
mbed_official | 46:378357d7e90d | 90 | (uint32_t)g_usb1_function_data_pointer[USB_FUNCTION_PIPE0]); |
mbed_official | 46:378357d7e90d | 91 | usb1_function_set_curpipe(USB_FUNCTION_PIPE0, USB_FUNCTION_CUSE, USB_FUNCTION_CFIFO_WRITE, mbw); |
mbed_official | 46:378357d7e90d | 92 | USB201.CFIFOCTR = USB_FUNCTION_BITBCLR; |
mbed_official | 46:378357d7e90d | 93 | |
mbed_official | 46:378357d7e90d | 94 | status = usb1_function_write_buffer_c(USB_FUNCTION_PIPE0); |
mbed_official | 46:378357d7e90d | 95 | |
mbed_official | 46:378357d7e90d | 96 | /* Peripheral Control sequence */ |
mbed_official | 46:378357d7e90d | 97 | switch (status) |
mbed_official | 46:378357d7e90d | 98 | { |
mbed_official | 46:378357d7e90d | 99 | case DEVDRV_USBF_WRITESHRT: /* End of data write */ |
mbed_official | 46:378357d7e90d | 100 | case DEVDRV_USBF_WRITEEND: /* End of data write (not null) */ |
mbed_official | 46:378357d7e90d | 101 | case DEVDRV_USBF_WRITING: /* Continue of data write */ |
mbed_official | 46:378357d7e90d | 102 | usb1_function_enable_bemp_int(USB_FUNCTION_PIPE0); /* Enable Empty Interrupt */ |
mbed_official | 46:378357d7e90d | 103 | usb1_function_set_pid_buf(USB_FUNCTION_PIPE0); /* Set BUF */ |
mbed_official | 46:378357d7e90d | 104 | break; |
mbed_official | 46:378357d7e90d | 105 | |
mbed_official | 46:378357d7e90d | 106 | case DEVDRV_USBF_FIFOERROR: /* FIFO access error */ |
mbed_official | 46:378357d7e90d | 107 | break; |
mbed_official | 46:378357d7e90d | 108 | |
mbed_official | 46:378357d7e90d | 109 | default: |
mbed_official | 46:378357d7e90d | 110 | break; |
mbed_official | 46:378357d7e90d | 111 | } |
mbed_official | 46:378357d7e90d | 112 | |
mbed_official | 46:378357d7e90d | 113 | return status; /* End or Err or Continue */ |
mbed_official | 46:378357d7e90d | 114 | } |
mbed_official | 46:378357d7e90d | 115 | |
mbed_official | 46:378357d7e90d | 116 | /******************************************************************************* |
mbed_official | 46:378357d7e90d | 117 | * Function Name: usb1_api_function_CtrlWriteStart |
mbed_official | 46:378357d7e90d | 118 | * Description : Executes the USB control write transfer. |
mbed_official | 46:378357d7e90d | 119 | * : USB host controller -> USB device |
mbed_official | 46:378357d7e90d | 120 | * Arguments : uint16_t size ; Data Size |
mbed_official | 46:378357d7e90d | 121 | * : uint8_t *data ; Data Address |
mbed_official | 46:378357d7e90d | 122 | * Return Value : none |
mbed_official | 46:378357d7e90d | 123 | *******************************************************************************/ |
mbed_official | 46:378357d7e90d | 124 | void usb1_api_function_CtrlWriteStart (uint32_t size, uint8_t * data) |
mbed_official | 46:378357d7e90d | 125 | { |
mbed_official | 46:378357d7e90d | 126 | uint16_t mbw; |
mbed_official | 46:378357d7e90d | 127 | |
mbed_official | 46:378357d7e90d | 128 | usb1_function_set_pid_nak(USB_FUNCTION_PIPE0); |
mbed_official | 46:378357d7e90d | 129 | |
mbed_official | 46:378357d7e90d | 130 | g_usb1_function_data_count[USB_FUNCTION_PIPE0] = size; |
mbed_official | 46:378357d7e90d | 131 | g_usb1_function_data_pointer[USB_FUNCTION_PIPE0] = data; |
mbed_official | 46:378357d7e90d | 132 | |
mbed_official | 46:378357d7e90d | 133 | mbw = usb1_function_get_mbw(g_usb1_function_data_count[USB_FUNCTION_PIPE0], |
mbed_official | 46:378357d7e90d | 134 | (uint32_t)g_usb1_function_data_pointer[USB_FUNCTION_PIPE0]); |
mbed_official | 46:378357d7e90d | 135 | usb1_function_set_curpipe(USB_FUNCTION_PIPE0, USB_FUNCTION_CUSE, USB_FUNCTION_CFIFO_WRITE, mbw); |
mbed_official | 46:378357d7e90d | 136 | USB201.CFIFOCTR = USB_FUNCTION_BITBCLR; |
mbed_official | 46:378357d7e90d | 137 | |
mbed_official | 46:378357d7e90d | 138 | usb1_function_enable_brdy_int(USB_FUNCTION_PIPE0); |
mbed_official | 46:378357d7e90d | 139 | usb1_function_set_pid_buf(USB_FUNCTION_PIPE0); |
mbed_official | 46:378357d7e90d | 140 | } |
mbed_official | 46:378357d7e90d | 141 | |
mbed_official | 46:378357d7e90d | 142 | /* End of File */ |