USB device stack - Added support for the logo/windows key to USB keyboard.

Dependents:   randomSearch

Fork of USBDevice by mbed official

Committer:
mbed_official
Date:
Thu Nov 06 11:01:12 2014 +0000
Revision:
35:a8484e16c2f3
Synchronized with git revision 8724eb616b6e07a3bd111d3022652eb5bbefe9b7

Full URL: https://github.com/mbedmicro/mbed/commit/8724eb616b6e07a3bd111d3022652eb5bbefe9b7/

[RZ/A1H] mbed-RZ first release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 35:a8484e16c2f3 1 /*******************************************************************************
mbed_official 35:a8484e16c2f3 2 * DISCLAIMER
mbed_official 35:a8484e16c2f3 3 * This software is supplied by Renesas Electronics Corporation and is only
mbed_official 35:a8484e16c2f3 4 * intended for use with Renesas products. No other uses are authorized. This
mbed_official 35:a8484e16c2f3 5 * software is owned by Renesas Electronics Corporation and is protected under
mbed_official 35:a8484e16c2f3 6 * all applicable laws, including copyright laws.
mbed_official 35:a8484e16c2f3 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
mbed_official 35:a8484e16c2f3 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
mbed_official 35:a8484e16c2f3 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
mbed_official 35:a8484e16c2f3 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
mbed_official 35:a8484e16c2f3 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
mbed_official 35:a8484e16c2f3 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
mbed_official 35:a8484e16c2f3 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
mbed_official 35:a8484e16c2f3 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
mbed_official 35:a8484e16c2f3 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
mbed_official 35:a8484e16c2f3 16 * Renesas reserves the right, without notice, to make changes to this software
mbed_official 35:a8484e16c2f3 17 * and to discontinue the availability of this software. By using this software,
mbed_official 35:a8484e16c2f3 18 * you agree to the additional terms and conditions found by accessing the
mbed_official 35:a8484e16c2f3 19 * following link:
mbed_official 35:a8484e16c2f3 20 * http://www.renesas.com/disclaimer
mbed_official 35:a8484e16c2f3 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
mbed_official 35:a8484e16c2f3 22 *******************************************************************************/
mbed_official 35:a8484e16c2f3 23 /*******************************************************************************
mbed_official 35:a8484e16c2f3 24 * File Name : rza_io_regrw.c
mbed_official 35:a8484e16c2f3 25 * $Rev: 1121 $
mbed_official 35:a8484e16c2f3 26 * $Date:: 2014-08-06 17:09:53 +0900#$
mbed_official 35:a8484e16c2f3 27 * Description : Low level register read/write
mbed_official 35:a8484e16c2f3 28 *******************************************************************************/
mbed_official 35:a8484e16c2f3 29
mbed_official 35:a8484e16c2f3 30 /******************************************************************************
mbed_official 35:a8484e16c2f3 31 Includes <System Includes> , "Project Includes"
mbed_official 35:a8484e16c2f3 32 ******************************************************************************/
mbed_official 35:a8484e16c2f3 33 #include "r_typedefs.h"
mbed_official 35:a8484e16c2f3 34
mbed_official 35:a8484e16c2f3 35 #ifdef __CC_ARM
mbed_official 35:a8484e16c2f3 36 #pragma arm section code = "CODE_IO_REGRW"
mbed_official 35:a8484e16c2f3 37 #pragma arm section rodata = "CONST_IO_REGRW"
mbed_official 35:a8484e16c2f3 38 #pragma arm section rwdata = "DATA_IO_REGRW"
mbed_official 35:a8484e16c2f3 39 #pragma arm section zidata = "BSS_IO_REGRW"
mbed_official 35:a8484e16c2f3 40 #endif
mbed_official 35:a8484e16c2f3 41
mbed_official 35:a8484e16c2f3 42 /******************************************************************************
mbed_official 35:a8484e16c2f3 43 Typedef definitions
mbed_official 35:a8484e16c2f3 44 ******************************************************************************/
mbed_official 35:a8484e16c2f3 45
mbed_official 35:a8484e16c2f3 46
mbed_official 35:a8484e16c2f3 47 /******************************************************************************
mbed_official 35:a8484e16c2f3 48 Macro definitions
mbed_official 35:a8484e16c2f3 49 ******************************************************************************/
mbed_official 35:a8484e16c2f3 50
mbed_official 35:a8484e16c2f3 51
mbed_official 35:a8484e16c2f3 52 /******************************************************************************
mbed_official 35:a8484e16c2f3 53 Imported global variables and functions (from other files)
mbed_official 35:a8484e16c2f3 54 ******************************************************************************/
mbed_official 35:a8484e16c2f3 55
mbed_official 35:a8484e16c2f3 56
mbed_official 35:a8484e16c2f3 57 /******************************************************************************
mbed_official 35:a8484e16c2f3 58 Exported global variables and functions (to be accessed by other files)
mbed_official 35:a8484e16c2f3 59 ******************************************************************************/
mbed_official 35:a8484e16c2f3 60
mbed_official 35:a8484e16c2f3 61
mbed_official 35:a8484e16c2f3 62 /******************************************************************************
mbed_official 35:a8484e16c2f3 63 Private global variables and functions
mbed_official 35:a8484e16c2f3 64 ******************************************************************************/
mbed_official 35:a8484e16c2f3 65
mbed_official 35:a8484e16c2f3 66
mbed_official 35:a8484e16c2f3 67 /******************************************************************************
mbed_official 35:a8484e16c2f3 68 * Function Name: RZA_IO_RegWrite_8
mbed_official 35:a8484e16c2f3 69 * Description : IO register 8-bit write
mbed_official 35:a8484e16c2f3 70 * Arguments : volatile uint8_t * ioreg : IO register for writing
mbed_official 35:a8484e16c2f3 71 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 72 * : : iodefine.h
mbed_official 35:a8484e16c2f3 73 * : uint8_t write_value : Write value for the IO register
mbed_official 35:a8484e16c2f3 74 * : uint8_t shift : The number of left shifts to the
mbed_official 35:a8484e16c2f3 75 * : : target bit
mbed_official 35:a8484e16c2f3 76 * : uint8_t mask : Mask value for the IO register
mbed_official 35:a8484e16c2f3 77 * : : (Target bit : "1")
mbed_official 35:a8484e16c2f3 78 * Return Value : None
mbed_official 35:a8484e16c2f3 79 ******************************************************************************/
mbed_official 35:a8484e16c2f3 80 void RZA_IO_RegWrite_8(volatile uint8_t * ioreg, uint8_t write_value, uint8_t shift, uint8_t mask)
mbed_official 35:a8484e16c2f3 81 {
mbed_official 35:a8484e16c2f3 82 uint8_t reg_value;
mbed_official 35:a8484e16c2f3 83
mbed_official 35:a8484e16c2f3 84 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 85 reg_value = (reg_value & (~mask)) | (write_value << shift); /* Modify value */
mbed_official 35:a8484e16c2f3 86 *ioreg = reg_value; /* Write to register */
mbed_official 35:a8484e16c2f3 87 }
mbed_official 35:a8484e16c2f3 88
mbed_official 35:a8484e16c2f3 89 /******************************************************************************
mbed_official 35:a8484e16c2f3 90 * Function Name: RZA_IO_RegWrite_16
mbed_official 35:a8484e16c2f3 91 * Description : IO register 16-bit write
mbed_official 35:a8484e16c2f3 92 * Arguments : volatile uint16_t * ioreg : IO register for writing
mbed_official 35:a8484e16c2f3 93 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 94 * : : iodefine.h
mbed_official 35:a8484e16c2f3 95 * : uint16_t write_value : Write value for the IO register
mbed_official 35:a8484e16c2f3 96 * : uint16_t shift : The number of left shifts to the
mbed_official 35:a8484e16c2f3 97 * : : target bit
mbed_official 35:a8484e16c2f3 98 * : uint16_t mask : Mask value for the IO register
mbed_official 35:a8484e16c2f3 99 * : : (Target bit : "1")
mbed_official 35:a8484e16c2f3 100 * Return Value : None
mbed_official 35:a8484e16c2f3 101 ******************************************************************************/
mbed_official 35:a8484e16c2f3 102 void RZA_IO_RegWrite_16(volatile uint16_t * ioreg, uint16_t write_value, uint16_t shift, uint16_t mask)
mbed_official 35:a8484e16c2f3 103 {
mbed_official 35:a8484e16c2f3 104 uint16_t reg_value;
mbed_official 35:a8484e16c2f3 105
mbed_official 35:a8484e16c2f3 106 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 107 reg_value = (reg_value & (~mask)) | (write_value << shift); /* Modify value */
mbed_official 35:a8484e16c2f3 108 *ioreg = reg_value; /* Write to register */
mbed_official 35:a8484e16c2f3 109 }
mbed_official 35:a8484e16c2f3 110
mbed_official 35:a8484e16c2f3 111 /******************************************************************************
mbed_official 35:a8484e16c2f3 112 * Function Name: RZA_IO_RegWrite_32
mbed_official 35:a8484e16c2f3 113 * Description : IO register 32-bit write
mbed_official 35:a8484e16c2f3 114 * Arguments : volatile uint32_t * ioreg : IO register for writing
mbed_official 35:a8484e16c2f3 115 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 116 * : : iodefine.h
mbed_official 35:a8484e16c2f3 117 * : uint32_t write_value : Write value for the IO register
mbed_official 35:a8484e16c2f3 118 * : uint32_t shift : The number of left shifts to the
mbed_official 35:a8484e16c2f3 119 * : : target bit
mbed_official 35:a8484e16c2f3 120 * : uint32_t mask : Mask value for the IO register
mbed_official 35:a8484e16c2f3 121 * : : (Target bit : "1")
mbed_official 35:a8484e16c2f3 122 * Return Value : None
mbed_official 35:a8484e16c2f3 123 ******************************************************************************/
mbed_official 35:a8484e16c2f3 124 void RZA_IO_RegWrite_32(volatile uint32_t * ioreg, uint32_t write_value, uint32_t shift, uint32_t mask)
mbed_official 35:a8484e16c2f3 125 {
mbed_official 35:a8484e16c2f3 126 uint32_t reg_value;
mbed_official 35:a8484e16c2f3 127
mbed_official 35:a8484e16c2f3 128 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 129 reg_value = (reg_value & (~mask)) | (write_value << shift); /* Modify value */
mbed_official 35:a8484e16c2f3 130 *ioreg = reg_value; /* Write to register */
mbed_official 35:a8484e16c2f3 131 }
mbed_official 35:a8484e16c2f3 132
mbed_official 35:a8484e16c2f3 133 /******************************************************************************
mbed_official 35:a8484e16c2f3 134 * Function Name: RZA_IO_RegRead_8
mbed_official 35:a8484e16c2f3 135 * Description : IO register 8-bit read
mbed_official 35:a8484e16c2f3 136 * Arguments : volatile uint8_t * ioreg : IO register for reading
mbed_official 35:a8484e16c2f3 137 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 138 * : : iodefine.h
mbed_official 35:a8484e16c2f3 139 * : uint8_t shift : The number of right shifts to the
mbed_official 35:a8484e16c2f3 140 * : : target bit
mbed_official 35:a8484e16c2f3 141 * : uint8_t mask : Mask bit for the IO register
mbed_official 35:a8484e16c2f3 142 * : : (Target bit: "1")
mbed_official 35:a8484e16c2f3 143 * Return Value : uint8_t : Value of the obtained target bit
mbed_official 35:a8484e16c2f3 144 ******************************************************************************/
mbed_official 35:a8484e16c2f3 145 uint8_t RZA_IO_RegRead_8(volatile uint8_t * ioreg, uint8_t shift, uint8_t mask)
mbed_official 35:a8484e16c2f3 146 {
mbed_official 35:a8484e16c2f3 147 uint8_t reg_value;
mbed_official 35:a8484e16c2f3 148
mbed_official 35:a8484e16c2f3 149 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 150 reg_value = (reg_value & mask) >> shift; /* Clear other bit and Bit shift */
mbed_official 35:a8484e16c2f3 151
mbed_official 35:a8484e16c2f3 152 return reg_value;
mbed_official 35:a8484e16c2f3 153 }
mbed_official 35:a8484e16c2f3 154
mbed_official 35:a8484e16c2f3 155 /******************************************************************************
mbed_official 35:a8484e16c2f3 156 * Function Name: RZA_IO_RegRead_16
mbed_official 35:a8484e16c2f3 157 * Description : IO register 16-bit read
mbed_official 35:a8484e16c2f3 158 * Arguments : volatile uint16_t * ioreg : IO register for reading
mbed_official 35:a8484e16c2f3 159 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 160 * : : iodefine.h
mbed_official 35:a8484e16c2f3 161 * : uint16_t shift : The number of right shifts to the
mbed_official 35:a8484e16c2f3 162 * : : target bit
mbed_official 35:a8484e16c2f3 163 * : uint16_t mask : Mask bit for the IO register
mbed_official 35:a8484e16c2f3 164 * : : (Target bit: "1")
mbed_official 35:a8484e16c2f3 165 * Return Value : uint16_t : Value of the obtained target bit
mbed_official 35:a8484e16c2f3 166 ******************************************************************************/
mbed_official 35:a8484e16c2f3 167 uint16_t RZA_IO_RegRead_16(volatile uint16_t * ioreg, uint16_t shift, uint16_t mask)
mbed_official 35:a8484e16c2f3 168 {
mbed_official 35:a8484e16c2f3 169 uint16_t reg_value;
mbed_official 35:a8484e16c2f3 170
mbed_official 35:a8484e16c2f3 171 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 172 reg_value = (reg_value & mask) >> shift; /* Clear other bit and Bit shift */
mbed_official 35:a8484e16c2f3 173
mbed_official 35:a8484e16c2f3 174 return reg_value;
mbed_official 35:a8484e16c2f3 175 }
mbed_official 35:a8484e16c2f3 176
mbed_official 35:a8484e16c2f3 177 /******************************************************************************
mbed_official 35:a8484e16c2f3 178 * Function Name: RZA_IO_RegRead_32
mbed_official 35:a8484e16c2f3 179 * Description : IO register 32-bit read
mbed_official 35:a8484e16c2f3 180 * Arguments : volatile uint32_t * ioreg : IO register for reading
mbed_official 35:a8484e16c2f3 181 * : : Use register definition name of the
mbed_official 35:a8484e16c2f3 182 * : : iodefine.h
mbed_official 35:a8484e16c2f3 183 * : uint32_t shift : The number of right shifts to the
mbed_official 35:a8484e16c2f3 184 * : : target bit
mbed_official 35:a8484e16c2f3 185 * : uint32_t mask : Mask bit for the IO register
mbed_official 35:a8484e16c2f3 186 * : : (Target bit: "1")
mbed_official 35:a8484e16c2f3 187 * Return Value : uint32_t : Value of the obtained target bit
mbed_official 35:a8484e16c2f3 188 ******************************************************************************/
mbed_official 35:a8484e16c2f3 189 uint32_t RZA_IO_RegRead_32(volatile uint32_t * ioreg, uint32_t shift, uint32_t mask)
mbed_official 35:a8484e16c2f3 190 {
mbed_official 35:a8484e16c2f3 191 uint32_t reg_value;
mbed_official 35:a8484e16c2f3 192
mbed_official 35:a8484e16c2f3 193 reg_value = *ioreg; /* Read from register */
mbed_official 35:a8484e16c2f3 194 reg_value = (reg_value & mask) >> shift; /* Clear other bit and Bit shift */
mbed_official 35:a8484e16c2f3 195
mbed_official 35:a8484e16c2f3 196 return reg_value;
mbed_official 35:a8484e16c2f3 197 }
mbed_official 35:a8484e16c2f3 198
mbed_official 35:a8484e16c2f3 199
mbed_official 35:a8484e16c2f3 200 /* End of File */