• 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 #include <soc/soc.h>
18 #include "hal_port.h"
19 #include "trng_hw.h"
20 #include <driver/hal/hal_trng_types.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define TRNG_LL_REG_BASE(_trng_unit_id)    (SOC_TRNG_REG_BASE)
27 
trng_ll_init(trng_hw_t * hw)28 static inline void trng_ll_init(trng_hw_t *hw)
29 {
30 	hw->ctrl.en = 0;
31 }
32 
trng_ll_enable(trng_hw_t * hw)33 static inline void trng_ll_enable(trng_hw_t *hw)
34 {
35 	hw->ctrl.en = 1;
36 }
37 
trng_ll_disable(trng_hw_t * hw)38 static inline void trng_ll_disable(trng_hw_t *hw)
39 {
40 	hw->ctrl.en = 0;
41 }
42 
trng_ll_get_random_data(trng_hw_t * hw)43 static inline uint32_t trng_ll_get_random_data(trng_hw_t *hw)
44 {
45 	return hw->data;
46 }
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52