• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., 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 
16 #ifndef __DUET_RF_SPI_H__
17 #define __DUET_RF_SPI_H__
18 
19 #define COMBO_SPI_CTRL_ADDR     0x4000B000
20 #define TRANS_MODE_OFT          0x0800
21 #define PRESCALER_OFT           0x0804
22 #define ADDR_REG_OFT            0x0808
23 #define READNOTWRITE_OFT        0x080c
24 #define WDATA_REG_OFT           0x0810
25 #define RDATA_REG_OFT           0x0814
26 #define START_FLAG_OFT          0x0818
27 #define SPI_COMMAND             COMBO_SPI_CTRL_ADDR
28 #define SPI_RDATA               COMBO_SPI_CTRL_ADDR
29 
30 void spi_mst_write(uint16_t addr, uint16_t data);
31 uint16_t spi_mst_read(uint16_t addr);
32 uint16_t spi_sw_protect_read(uint16_t addr);
33 void spi_sw_protect_write(uint16_t addr, uint16_t data);
34 
35 void rf_set_reg_bit(uint16_t reg, uint8_t start_bit, uint8_t len, uint16_t src_val);
36 uint16_t rf_get_reg_bit(uint16_t reg, uint8_t start_bit, uint8_t len);
37 
38 #endif // __RF_SPI_H__