gustavonihei commented on a change in pull request #3126: URL: https://github.com/apache/incubator-nuttx/pull/3126#discussion_r598777219
########## File path: arch/risc-v/src/esp32c3/esp32c3_spiflash.c ########## @@ -0,0 +1,745 @@ +/**************************************************************************** + * arch/risc-v/src/esp32c3/esp32c3_spiflash.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> +#include <debug.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/errno.h> + +#include <nuttx/arch.h> +#include <nuttx/init.h> +#include <nuttx/semaphore.h> +#include <nuttx/mtd/mtd.h> + +#include "esp32c3_spiflash.h" +#include "rom/esp32c3_spiflash.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define SPI_FLASH_BLK_SIZE 256 +#define SPI_FLASH_ERASE_SIZE 4096 +#define SPI_FLASH_SIZE (4 * 1024 * 1024) + +#define ESP32C3_MTD_OFFSET CONFIG_ESP32C3_MTD_OFFSET +#define ESP32C3_MTD_SIZE CONFIG_ESP32C3_MTD_SIZE + +#define MTD2PRIV(_dev) ((FAR struct esp32c3_spiflash_s *)_dev) +#define MTD_SIZE(_priv) ((_priv)->chip->chip_size) +#define MTD_BLKSIZE(_priv) ((_priv)->chip->page_size) +#define MTD_ERASESIZE(_priv) ((_priv)->chip->sector_size) +#define MTD_BLK2SIZE(_priv, _b) (MTD_BLKSIZE(_priv) * (_b)) +#define MTD_SIZE2BLK(_priv, _s) ((_s) / MTD_BLKSIZE(_priv)) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* ESP32C3 SPI Flash device private data */ Review comment: ```suggestion /* ESP32-C3 SPI Flash device private data */ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
