[2.0.x]DUE: Fix includes for SDSUPPORT (#9112)

This commit is contained in:
teemuatlut 2018-01-10 08:46:34 +02:00 committed by Scott Lahteine
parent cf654b9a1a
commit a8c446c3bc
2 changed files with 25 additions and 29 deletions

View File

@ -48,7 +48,7 @@
#define _CONF_ACCESS_H_
#include "compiler.h"
#include "../../../inc/MarlinConfigPre.h"
/*! \name Activation of Logical Unit Numbers
*/

View File

@ -2,9 +2,12 @@
* Interface from Atmel USB MSD to Marlin SD card
*/
#if defined(ARDUINO_ARCH_SAM) && defined(SDSUPPORT)
#ifdef ARDUINO_ARCH_SAM
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../../../sd/cardreader.h"
extern "C" {
#include "sd_mmc_spi_mem.h"
@ -12,37 +15,31 @@ extern "C" {
#define SD_MMC_BLOCK_SIZE 512
void sd_mmc_spi_mem_init(void)
{
void sd_mmc_spi_mem_init(void) {
}
Ctrl_status sd_mmc_spi_test_unit_ready(void)
{
Ctrl_status sd_mmc_spi_test_unit_ready(void) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
return CTRL_NO_PRESENT;
return CTRL_GOOD;
}
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector)
{
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
return CTRL_NO_PRESENT;
*nb_sector = card.getSd2Card().cardSize();
return CTRL_GOOD;
}
bool sd_mmc_spi_unload(bool unload)
{
bool sd_mmc_spi_unload(bool unload) {
return true;
}
bool sd_mmc_spi_wr_protect(void)
{
bool sd_mmc_spi_wr_protect(void) {
return false;
}
bool sd_mmc_spi_removal(void)
{
bool sd_mmc_spi_removal(void) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
return true;
return false;
@ -61,16 +58,15 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
// #define DEBUG_MMC
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector)
{
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
MYSERIAL.print(buffer);
#endif
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
MYSERIAL.print(buffer);
#endif
// Start reading
if (!card.getSd2Card().readStart(addr))
@ -96,16 +92,15 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector)
return CTRL_GOOD;
}
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector)
{
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK)
return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
MYSERIAL.print(buffer);
#endif
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
MYSERIAL.print(buffer);
#endif
if (!card.getSd2Card().writeStart(addr, nb_sector))
return CTRL_FAIL;
@ -132,4 +127,5 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector)
#endif // ACCESS_USB == true
#endif
#endif // SDSUPPORT
#endif // ARDUINO_ARCH_SAM