[sky9x] Revert to r1398 for Peter's tests
This commit is contained in:
+6
-26
@@ -9,15 +9,6 @@
|
||||
#ifndef _FFCONF
|
||||
#define _FFCONF 6502 /* Revision ID */
|
||||
|
||||
#if defined(PCBARM) && !defined(SIMU)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "../CoOS/kernel/CoOS.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Functions and Buffer Configurations
|
||||
@@ -98,11 +89,8 @@ extern "C" {
|
||||
/ 1 - ASCII only (Valid for non LFN cfg.)
|
||||
*/
|
||||
|
||||
#if defined(PCBARM)
|
||||
#define _USE_LFN 2 /* 0 to 3 */
|
||||
#else
|
||||
#define _USE_LFN 1 /* 0 to 3 */
|
||||
#endif
|
||||
|
||||
#define _USE_LFN 1 /* 0 to 3 */
|
||||
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
|
||||
/* The _USE_LFN option switches the LFN support.
|
||||
/
|
||||
@@ -182,13 +170,9 @@ extern "C" {
|
||||
/* A header file that defines sync object types on the O/S, such as
|
||||
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
|
||||
#else
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#endif
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t OS_MutexID /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||
|
||||
/* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
|
||||
/
|
||||
@@ -197,12 +181,8 @@ extern "C" {
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
#if defined(PCBARM)
|
||||
#define _FS_SHARE 3 /* 0:Disable or >=1:Enable */
|
||||
#else
|
||||
#define _FS_SHARE 2 /* 0:Disable or >=1:Enable */
|
||||
#endif
|
||||
|
||||
#define _FS_SHARE 0 /* 0:Disable or >=1:Enable */
|
||||
/* To enable file shareing feature, set _FS_SHARE to 1 or greater. The value
|
||||
defines how many files can be opened simultaneously. */
|
||||
|
||||
|
||||
+10
-27
@@ -89,31 +89,6 @@ uint8_t cardType;
|
||||
const uint8_t SpeedTable[] = { 1, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 } ;
|
||||
uint32_t sdSpeedAllowed ;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Lock / unlock functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
|
||||
{
|
||||
*mutex = CoCreateMutex();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ff_req_grant (_SYNC_t mutex)
|
||||
{
|
||||
CoEnterMutexSection(mutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ff_rel_grant (_SYNC_t mutex)
|
||||
{
|
||||
CoLeaveMutexSection(mutex);
|
||||
}
|
||||
|
||||
int ff_del_syncobj (_SYNC_t mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the MCI CLKDIV in the MCI_MR register. The max. for MCI clock is
|
||||
* MCK/2 and corresponds to CLKDIV = 0
|
||||
@@ -1015,12 +990,16 @@ uint32_t sd_cmd16()
|
||||
#endif
|
||||
}
|
||||
|
||||
extern OS_MutexID sdMutex;
|
||||
|
||||
uint32_t sd_read_block(uint32_t block_no, uint32_t *data)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
Hsmci *phsmci = HSMCI;
|
||||
int32_t retry;
|
||||
|
||||
CoEnterMutexSection(sdMutex);
|
||||
|
||||
if (sd_card_ready()) {
|
||||
sd_cmd16();
|
||||
// Block size = 512, nblocks = 1
|
||||
@@ -1046,6 +1025,7 @@ uint32_t sd_read_block(uint32_t block_no, uint32_t *data)
|
||||
/* Disable PDC */
|
||||
phsmci->HSMCI_PTCR = HSMCI_PTCR_RXTDIS | HSMCI_PTCR_TXTDIS;
|
||||
|
||||
CoLeaveMutexSection(sdMutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1055,6 +1035,8 @@ uint32_t sd_write_block( uint32_t block_no, uint32_t *data )
|
||||
Hsmci *phsmci = HSMCI;
|
||||
int32_t retry;
|
||||
|
||||
CoEnterMutexSection(sdMutex);
|
||||
|
||||
if (sd_card_ready()) {
|
||||
|
||||
// TRACE_ERROR("Sector %d ", block_no);
|
||||
@@ -1076,10 +1058,9 @@ uint32_t sd_write_block( uint32_t block_no, uint32_t *data )
|
||||
phsmci->HSMCI_ARGR = (Cmd_A41_resp & OCR_SD_CCS ? block_no : (block_no << 9));
|
||||
phsmci->HSMCI_TPR = (uint32_t)data;
|
||||
phsmci->HSMCI_TCR = 512 / 4;
|
||||
phsmci->HSMCI_TNCR = 0;
|
||||
phsmci->HSMCI_CMDR = SD_WRITE_SINGLE_BLOCK;
|
||||
phsmci->HSMCI_PTCR = HSMCI_PTCR_TXTEN;
|
||||
|
||||
|
||||
retry = 500;
|
||||
while (--retry >= 0) {
|
||||
CoTickDelay(1); // 2ms
|
||||
@@ -1106,6 +1087,8 @@ uint32_t sd_write_block( uint32_t block_no, uint32_t *data )
|
||||
|
||||
phsmci->HSMCI_MR &= ~(uint32_t)HSMCI_MR_PDCMODE;
|
||||
|
||||
CoLeaveMutexSection(sdMutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user