1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _REG_WRAPPER_H 16 #define _REG_WRAPPER_H 17 18 #include <stddef.h> 19 20 /** 21 * Register access wrapper. 22 */ 23 24 // BLE register wrapper. 25 #define BLE_REG_READ(addr) (*(volatile uint32_t *)(addr)) 26 #define BLE_REG_WRITE(addr, value) (*(volatile uint32_t *)(addr)) 27 #define BLE_CTRL_READ(addr) (*(volatile uint16_t *)(addr)) 28 #define BLE_CTRL_WRITE(addr,value) (*(volatile uint16_t *)(addr)) = (value) 29 30 // BT register wrapper 31 #define BT_REG_READ(addr) (*(volatile uint32_t *)(addr)) 32 #define BT_REG_WRITE(addr, value) (*(volatile uint32_t *)(addr)) = (value) 33 #define BT_CTRL_READ(addr) (*(volatile uint16_t *)(addr)) 34 #define BT_CTRL_WRITE(addr, value) (*(volatile uint16_t *)(addr)) = (value) 35 36 // Platform register wrapper. 37 #define PLATFORM_REG_READ(addr) (*(volatile uint32_t *)(addr)) 38 #define PLATFORM_REG_WRITE(addr, value) (*(volatile uint32_t *)(addr)) = (value) 39 #define IP_REG_READ(addr) (*(volatile uint32_t *)(addr)) 40 #define IP_REG_WRITE(addr, value) (*(volatile uint32_t *)(addr)) = (value) 41 42 #endif // _REG_WRAPPER_H 43