• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
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 #pragma once
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #define SPI_R_BASE(_id)          (SOC_SPI_REG_BASE + _id * 0x1060000)
22 
23 #define SPI_R_CTRL(_id)          (SPI_R_BASE(_id) + 4 * 0x00)
24 
25 #define SPI_F_CLK_DIV            (BIT(8))
26 #define SPI_F_CLK_DIV_M          (0xFF)
27 #define SPI_F_CLK_DIV_V          (0xFF)
28 #define SPI_F_CLK_DIV_S          (8)
29 
30 #define SPI_R_CFG(_id)           (SPI_R_BASE(_id) + 4 * 0x01)
31 
32 #define SPI_F_TX_TRANS_LEN       (BIT(8))
33 #define SPI_F_TX_TRANS_LEN_M     (0xFFF)
34 #define SPI_F_TX_TRANS_LEN_V     (0xFFF)
35 #define SPI_F_TX_TRANS_LEN_S     (8)
36 
37 #define SPI_F_RX_TRANS_LEN       (BIT(20))
38 #define SPI_F_RX_TRANS_LEN_M     (0xFFF)
39 #define SPI_F_RX_TRANS_LEN_V     (0xFFF)
40 #define SPI_F_RX_TRANS_LEN_S     (20)
41 
42 #define SPI_R_INT_STATUS(_id)    (SPI_R_BASE(_id) + 4 * 0x02)
43 
44 #define SPI_F_RX_FIOF_RD_READY   (BIT(2))
45 #define SPI_F_RX_FIOF_RD_READY_M (0x1)
46 #define SPI_F_RX_FIOF_RD_READY_V (0x1)
47 #define SPI_F_RX_FIOF_RD_READY_S (1)
48 
49 #define SPI_R_DATA(_id)          (SPI_R_BASE(_id) + 4 * 0x03)
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55