/*================================================================ Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. Quectel Wireless Solution Proprietary and Confidential. =================================================================*/ /*================================================================= EDIT HISTORY FOR MODULE This section contains comments describing changes made to the module. Notice that changes are listed in reverse chronological order. WHEN WHO WHAT, WHERE, WHY ------------ ------- ------------------------------------------------------------------------------- =================================================================*/ #include #include #include #include "ql_api_osi.h" #include "ql_api_spi_nand_flash.h" #include "ql_log.h" #include "spi_nand_flash_demo.h" #include "ql_gpio.h" #define QL_SPI_NAND_LOG_LEVEL QL_LOG_LEVEL_INFO #define QL_SPI_NAND_LOG(msg, ...) QL_LOG(QL_SPI_NAND_LOG_LEVEL, "ql_SPI_NAND_DEMO", msg, ##__VA_ARGS__) #define QL_SPI_NAND_LOG_PUSH(msg, ...) QL_LOG_PUSH("ql_SPI_NAND_DEMO", msg, ##__VA_ARGS__) ql_task_t spi_nand_flash_demo_task = NULL; #define QL_CUR_SPI_PORT QL_SPI_PORT1 #define QL_CUR_SPI_CS_PIN QL_CUR_SPI1_CS_PIN #define QL_CUR_SPI_CS_FUNC QL_CUR_SPI1_CS_FUNC #define QL_CUR_SPI_CLK_PIN QL_CUR_SPI1_CLK_PIN #define QL_CUR_SPI_CLK_FUNC QL_CUR_SPI1_CLK_FUNC #define QL_CUR_SPI_DO_PIN QL_CUR_SPI1_DO_PIN #define QL_CUR_SPI_DO_FUNC QL_CUR_SPI1_DO_FUNC #define QL_CUR_SPI_DI_PIN QL_CUR_SPI1_DI_PIN #define QL_CUR_SPI_DI_FUNC QL_CUR_SPI1_DI_FUNC void ql_spi_nand_flash_data_prifnt(unsigned char *data, int len) { int i = 0; int count_len = 256; int count = 0; int exit = 0; int write_len = 0; unsigned char *str_data = (unsigned char *)malloc(len*2+64); if (str_data == NULL) { QL_SPI_NAND_LOG("malloc err"); return ; } QL_SPI_NAND_LOG("read len=%d", len); while ((exit == 0)) { if (len - count > 256) { count_len = 256; } else { count_len = len - count; exit = 1; } memset(str_data, 0, len*2+64); for (i=count; i