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 __FLASH_BYPASS_H__ 16 #define __FLASH_BYPASS_H__ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #define CURRENT_ROUTINE_TEXT_SIZE (0x400) 23 24 /*Write Enable for Status Register*/ 25 #define FLASH_CMD_WR_EN_SR (0x6) 26 #define FLASH_CMD_WR_DISABLE (0x04) 27 /*Write Status Register*/ 28 #define FLASH_CMD_WR_SR (0x31) 29 #define FLASH_CMD_QUAD_IO_FAST_READ (0xEB) 30 #define FLASH_GD25Q32C_SR_QUAD_EN (0x2) 31 32 #define SPI_CFG_TX_EN_ONE_BYTE (0x10D) 33 #define SPI_CFG_TX_EN_TWO_BYTE (0x20D) 34 #define SPI_STATUS_TX_FINISH_INT (BIT(13)) 35 36 #define FLASH_ID_GD25Q32C (0xC84016) 37 38 #define QE_RETRY_TIMES (10) 39 40 __attribute__((section(".itcm_sec_code"))) void flash_bypass_quad_enable(void); 41 __attribute__((section(".itcm_sec_code"))) void flash_bypass_quad_test(uint32_t quad_enable, uint32_t delay_cycle1, uint32_t delay_cycle2); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 #endif //__FLASH_BYPASS_H__ 47 // eof 48 49