• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 // Copyright (C) 2022 Beken Corporation
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 _IRDA_H_
16 #define _IRDA_H_
17 
18 #define IRDA_DEBUG
19 
20 #ifdef IRDA_DEBUG
21 #define IRDA_PRT      os_printf
22 #define IRDA_WARN     warning_prf
23 #define IRDA_FATAL    fatal_prf
24 #else
25 #define IRDA_PRT      null_prf
26 #define IRDA_WARN     null_prf
27 #define IRDA_FATAL    null_prf
28 #endif
29 
30 #if (CONFIG_SOC_BK7271)
31 #define IRDA_BASE                     (0x00802760)
32 #else
33 #define IRDA_BASE                     (0x00802400)
34 #endif
35 
36 #define IRDA_CTRL                     (IRDA_BASE + 0 * 4)
37 #define IRDA_NEC_EN                   (0x01UL << 0)
38 #define IRDA_POLARITY                 (0x01UL << 1)
39 #define UART_RX_ENABLE                (0x01UL << 2)
40 #define UART_LEN_POSI                 (3)
41 #define UART_LEN_MASK                 (0x03)
42 #define UART_PAR_EN                   (0x01UL << 5)
43 #define UART_PAR_MODE                 (0x01UL << 6)
44 #define UART_STOP_LEN                 (0x01UL << 7)
45 #define CLK_DIVID_POSI                (8)
46 #define CLK_DIVID_MASK                (0xFFFF)
47 
48 #define IRDA_INT_MASK                 (IRDA_BASE + 1 * 4)
49 #define IRDA_END_INT_MASK             (0x01UL << 0)
50 #define IRDA_RIGHT_INT_MASK           (0x01UL << 1)
51 #define IRDA_REPEAT_INT_MASK          (0x01UL << 2)
52 #define FIFO_WREN_INT_MASK            (0x01UL << 3)
53 #define PARITY_ERR_INT_MASK           (0x01UL << 4)
54 #define STOP_ERR_INT_MASK             (0x01UL << 5)
55 #define INT_MASK_EN					(0x3f)
56 
57 #define IRDA_INT                      (IRDA_BASE + 2 * 4)
58 #define IRDA_END_INT                  (0x01UL << 0)
59 #define IRDA_RIGHT_INT                (0x01UL << 1)
60 #define IRDA_REPEAT_INT               (0x01UL << 2)
61 #define FIFO_WREN_INT                 (0x01UL << 3)
62 #define PARITY_ERR_INT                (0x01UL << 4)
63 #define STOP_ERR_INT                  (0x01UL << 5)
64 
65 #define RX_FIFO_DOUT                  (IRDA_BASE + 3 * 4)
66 
67 #define IRDA_KEY_HTIMER_CHNAL 4 /*timer channle*/
68 
69 #endif
70