Commit 64bf4334 authored by Xavier Piroux's avatar Xavier Piroux Committed by Matthieu Cattin

compilation of SD driver OK (only skeletton right now)

parent 131c51b7
......@@ -170,11 +170,13 @@ C_SRC += \
../reptile/FreeRTOS-Plus-FAT-SL/psp/target/rtc/psp_rtc.c
C_SRC += \
../reptile/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c #TODO: use our implementation for the driver of SD card.
../src/media-drv/sd/sd_driver_f.c
#../reptile/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c #TODO: use our implementation for the driver of SD card.
C_SRC += \
../reptile/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c \
../reptile/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test_ramdrv.c #This file test FAT SL with a given driver : now it uses the RAM driver
../src/psp/psp_test_sddriver.c
#../reptile/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.c #This file test FAT SL with a given driver : now it uses the RAM driver
INCLUDEPATHS += \
-I../reptile/FreeRTOS-Plus-FAT-SL/config/ \
......
/*
* FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded
*
* The FreeRTOS+FAT SL license terms are different to the FreeRTOS license
* terms.
*
* FreeRTOS+FAT SL uses a dual license model that allows the software to be used
* under a standard GPL open source license, or a commercial license. The
* standard GPL license (unlike the modified GPL license under which FreeRTOS
* itself is distributed) requires that all software statically linked with
* FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms.
* Details of both license options follow:
*
* - Open source licensing -
* FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and
* distributed without charge provided the user adheres to version two of the
* GNU General Public License (GPL) and does not remove the copyright notice or
* this text. The GPL V2 text is available on the gnu.org web site, and on the
* following URL: http://www.FreeRTOS.org/gpl-2.0.txt.
*
* - Commercial licensing -
* Businesses and individuals who for commercial or other reasons cannot comply
* with the terms of the GPL V2 license must obtain a commercial license before
* incorporating FreeRTOS+FAT SL into proprietary software for distribution in
* any form. Commercial licenses can be purchased from
* http://shop.freertos.org/fat_sl and do not require any source files to be
* changed.
*
* FreeRTOS+FAT SL is distributed in the hope that it will be useful. You
* cannot use FreeRTOS+FAT SL unless you agree that you use the software 'as
* is'. FreeRTOS+FAT SL is provided WITHOUT ANY WARRANTY; without even the
* implied warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. Real Time Engineers Ltd. and HCC Embedded disclaims all
* conditions and terms, be they implied, expressed, or statutory.
*
* http://www.FreeRTOS.org
* http://www.FreeRTOS.org/FreeRTOS-Plus
*
*/
#ifndef _API_MDRIVER_SD_H_
#define _API_MDRIVER_SD_H_
#include "../../reptile/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h"
#include "../version/ver_mdriver_sd.h"
#if VER_MDRIVER_SD_MAJOR != 1 || VER_MDRIVER_SD_MINOR != 0
#error Incompatible MDRIVER_SD version number!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define F_SD_DRIVE0 0
enum
{
MDRIVER_SD_NO_ERROR
, MDRIVER_SD_ERR_SECTOR = 101
, MDRIVER_SD_ERR_NOTAVAILABLE
};
F_DRIVER * sd_initfunc ( unsigned long driver_param );
#ifdef __cplusplus
}
#endif
#endif /* _API_MDRIVER_SD_H_ */
......@@ -5,7 +5,7 @@
#ifndef _CONFIG_MDRIVER_SD_H_
#define _CONFIG_MDRIVER_SD_H_
#include "../version/ver_mdriver_sd.h"
#include "../../version/ver_mdriver_sd.h"
#if VER_MDRIVER_SD_MAJOR != 1 || VER_MDRIVER_SD_MINOR != 0
#error Incompatible MDRIVER_SD version number!
#endif
......
......@@ -2,25 +2,40 @@
* TODO : license
*/
#include "../../api/api_mdriver_ram.h"
#include "config_mdriver_sd.h"
#include "../../psp/include/psp_string.h"
#if VER_MDRIVER_SD_MAJOR != 1 || VER_MDRIVER_SD_MINOR != 0
#error Incompatible MDRIVER_SD version number!
#endif
//TODO: use those CMD to send it through SPI interface
/* MMC/SD command (in SPI) */
#define USD_CMD0 (0x40+0) /* GO_IDLE_STATE */
#define USD_CMD1 (0x40+1) /* SEND_OP_COND (MMC) */
#define USD_ACMD41 (0xC0+41) /* SEND_OP_COND (SDC) */
#define USD_CMD8 (0x40+8) /* SEND_IF_COND */
#define USD_CMD9 (0x40+9) /* SEND_CSD */
#define USD_CMD10 (0x40+10) /* SEND_CID */
#define USD_CMD12 (0x40+12) /* STOP_TRANSMISSION */
#define USD_ACMD13 (0xC0+13) /* SD_STATUS (SDC) */
#define USD_CMD16 (0x40+16) /* SET_BLOCKLEN */
#define USD_CMD17 (0x40+17) /* READ_SINGLE_BLOCK */
#define USD_CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */
#define USD_CMD23 (0x40+23) /* SET_BLOCK_COUNT (MMC) */
#define USD_ACMD23 (0xC0+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
#define USD_CMD24 (0x40+24) /* WRITE_BLOCK */
#define USD_CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */
#define USD_CMD55 (0x40+55) /* APP_CMD */
#define USD_CMD58 (0x40+58) /* READ_OCR */
#define MICROSD_CMD0 (0x40+0) /* GO_IDLE_STATE */
#define MICROSD_CMD1 (0x40+1) /* SEND_OP_COND (MMC) */
#define MICROSD_ACMD41 (0xC0+41) /* SEND_OP_COND (SDC) */
#define MICROSD_CMD8 (0x40+8) /* SEND_IF_COND */
#define MICROSD_CMD9 (0x40+9) /* SEND_CSD */
#define MICROSD_CMD10 (0x40+10) /* SEND_CID */
#define MICROSD_CMD12 (0x40+12) /* STOP_TRANSMISSION */
#define MICROSD_ACMD13 (0xC0+13) /* SD_STATUS (SDC) */
#define MICROSD_CMD16 (0x40+16) /* SET_BLOCKLEN */
#define MICROSD_CMD17 (0x40+17) /* READ_SINGLE_BLOCK */
#define MICROSD_CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */
#define MICROSD_CMD23 (0x40+23) /* SET_BLOCK_COUNT (MMC) */
#define MICROSD_ACMD23 (0xC0+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */
#define MICROSD_CMD24 (0x40+24) /* WRITE_BLOCK */
#define MICROSD_CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */
#define MICROSD_CMD55 (0x40+55) /* APP_CMD */
#define MICROSD_CMD58 (0x40+58) /* READ_OCR */
#include "../../version/ver_mdriver_ram.h"
#if VER_MDRIVER_RAM_MAJOR != 1 || VER_MDRIVER_RAM_MINOR != 2
#error Incompatible MDRIVER_RAM version number!
#endif
static int sd_readsector ( F_DRIVER * driver, void * data, unsigned long sector ) {
//TODO:implement sd_readsector
......@@ -40,8 +55,8 @@ static void sd_release ( F_DRIVER * driver ) {
}
F_DRIVER * sd_initfunc ( unsigned long driver_param ) {
//TODO:implement sd_initfunc
/* Enabling clock to USART 0*/
CMU_ClockEnable(cmuClock_USART0, true);
SPI_setup(USART0_NUM, GPIO_POS1, false);
/* Enabling clock to USART 0*/
//CMU_ClockEnable(cmuClock_USART0, true);
//SPI_setup(USART0_NUM, GPIO_POS1, false);
return NULL;
}
......@@ -39,17 +39,17 @@
*/
#include <stdio.h>
#include "psp_test.h"
#include "../../reptile/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.h"
#include "config_fat_sl.h"
#include "config_mdriver_ram.h"
#include "../../../api/fat_sl.h"
#include "../../../api/api_mdriver_ram.h"
#include "../media-drv/sd/config_mdriver_sd.h"
#include "../../reptile/FreeRTOS-Plus-FAT-SL/api/fat_sl.h"
#include "../api/api_mdriver_sd.h"
#include "../../../version/ver_fat_sl.h"
#include "../../reptile/FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h"
#if VER_FAT_SL_MAJOR != 5
#error Incompatible FAT_SL version number!
#endif
#include "../../../version/ver_psp_fat_sl.h"
#include "../../reptile/FreeRTOS-Plus-FAT-SL/version/ver_psp_fat_sl.h"
#if VER_PSP_FAT_FAT_SL_MAJOR != 1 || VER_PSP_FAT_FAT_SL_MINOR != 2
#error Incompatible PSP_FAT_FAT_SL version number!
#endif
......@@ -61,13 +61,13 @@ extern void __printbuf ( char * buf, int len );
/* Use to display text (printf). */
void _f_dump ( char * s )
{
// printf( "%s\r\n", s );//(commented by xavier)
printf( "%s\r\n", s );
}
/* Use to display test result (printf). */
uint8_t _f_result ( int linenum, uint32_t result )
{
// printf( "Error:%d/%ld\r\n", linenum, result );//(commented by xavier)
printf( "Error:%d/%ld\r\n", linenum, result );
return 0;
}
......@@ -75,5 +75,5 @@ uint8_t _f_result ( int linenum, uint32_t result )
uint8_t _f_poweron ( void )
{
f_delvolume();
return f_initvolume( ram_initfunc );
return f_initvolume( sd_initfunc );
}
......@@ -8,5 +8,5 @@
#define VER_MDRIVER_SD_MAJOR 1
#define VER_MDRIVER_SD_MINOR 0
#endif /* _VER_MDRIVER_SD_H /*
#endif /* _VER_MDRIVER_SD_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment