• 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 
16 
17 #include <common/bk_include.h>
18 #include "psram_hal.h"
19 #include "psram_ll_macro_def.h"
20 
psram_hal_set_sf_reset(uint32_t value)21 void psram_hal_set_sf_reset(uint32_t value)
22 {
23 	psram_ll_set_sf_reset_value(value);
24 }
25 
psram_hal_set_cmd_reset(void)26 void psram_hal_set_cmd_reset(void)
27 {
28 	psram_ll_set_reg8_value(0x4);
29 }
30 
psram_hal_cmd_write(uint32_t addr,uint32_t value)31 void psram_hal_cmd_write(uint32_t addr, uint32_t value)
32 {
33 	psram_ll_set_write_address(addr);
34 	psram_ll_set_write_data(value);
35 	psram_ll_set_reg8_value(0x1);
36 	while(psram_ll_get_reg8_value() & 0x1);
37 }
38 
psram_hal_cmd_read(uint32_t addr)39 uint32_t psram_hal_cmd_read(uint32_t addr)
40 {
41 	psram_ll_set_write_address(addr);
42 	psram_ll_set_reg8_value(0x2);
43 	while(psram_ll_get_reg8_value() & 0x2);
44 
45 	return psram_ll_get_regb_value();
46 }
47 
psram_hal_set_transfer_mode(uint32_t value)48 void psram_hal_set_transfer_mode(uint32_t value)
49 {
50 	psram_ll_set_reg4_wrap_config(value);
51 }
52 
53 
54