mbed library sources for airmote

Fork of mbed-src by mbed official

Committer:
zskdan
Date:
Tue Nov 24 14:02:46 2015 +0000
Revision:
625:88d3fa07e462
Parent:
448:f58c94c7c4b6
remove unused service

Who changed what in which revision?

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