Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style fixes for nanoframework/nf-interpreter PR#2849 #12

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Target_Windows_Storage.h>

#define WORKING_DRIVE_IS_INTERNAL_DRIVE \
(memcmp(workingDrive, INTERNAL_DRIVE0_LETTER, sizeof(INTERNAL_DRIVE0_LETTER)) == 0 || \
(memcmp(workingDrive, INTERNAL_DRIVE0_LETTER, sizeof(INTERNAL_DRIVE0_LETTER)) == 0 || \
memcmp(workingDrive, INTERNAL_DRIVE1_LETTER, sizeof(INTERNAL_DRIVE1_LETTER)) == 0)

extern int32_t GetInternalDriveIndex(char *drive);
Expand Down
39 changes: 18 additions & 21 deletions targets/FreeRTOS/NXP/_common/Target_Windows_Storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

#include "fsl_sd.h"


// need to declare this here as extern
extern void PostManagedEvent(uint8_t category, uint8_t subCategory, uint16_t data1, uint32_t data2);

#define SD_CARD_DRIVE_INDEX "0"
#define SD_CARD_DRIVE_INDEX_NUMERIC (0)

#define SD_CARD_DRIVE_INDEX "0"
#define SD_CARD_DRIVE_INDEX_NUMERIC (0)

///////////////////////////////////////////
// code specific to SD Card
Expand All @@ -31,12 +29,12 @@ bool sdCardFileSystemReady;
static FATFS sdCard_FS;

/*!
* call back function for SD card detect.
*
* @param isInserted true, indicate the card is insert.
* false, indicate the card is remove.
* @param userData
*/
* call back function for SD card detect.
*
* @param isInserted true, indicate the card is insert.
* false, indicate the card is remove.
* @param userData
*/
static void SDCARD_DetectCallBack(bool isInserted, void *userData);

/*! Card descriptor. */
Expand Down Expand Up @@ -83,44 +81,45 @@ static void CardDetectTask(void *pvParameters)
vTaskDelay(100 / portTICK_PERIOD_MS);
if (s_cardInserted)
{
//Card inserted.
// Card inserted.
/* power on the card */
SD_PowerOnCard(g_sd.host.base, g_sd.usrParam.pwr);
/* Init card. */
if (SD_CardInit(&g_sd))
{
//SD card init failed.
// SD card init failed.
continue;
}

FRESULT err = f_mount(&sdCard_FS, "0", 1U);
if (err != FR_OK) {
if (err != FR_OK)
{
vTaskDelay(1000 / portTICK_PERIOD_MS);
SD_CardDeinit(&g_sd);
continue;
}
sdCardFileSystemReady = true;

// post event to managed app
PostManagedEvent( EVENT_STORAGE, 0, StorageEventType_RemovableDeviceInsertion, SD_CARD_DRIVE_INDEX_NUMERIC );
PostManagedEvent(EVENT_STORAGE, 0, StorageEventType_RemovableDeviceInsertion, SD_CARD_DRIVE_INDEX_NUMERIC);
}
else
{
SD_CardDeinit(&g_sd);

//Card removed
// Card removed
sdCardFileSystemReady = false;

// post event to managed app
PostManagedEvent( EVENT_STORAGE, 0, StorageEventType_RemovableDeviceRemoval, SD_CARD_DRIVE_INDEX_NUMERIC );
PostManagedEvent(EVENT_STORAGE, 0, StorageEventType_RemovableDeviceRemoval, SD_CARD_DRIVE_INDEX_NUMERIC);
}
}
}

void SdCardThread(void * argument)
void SdCardThread(void *argument)
{
(void)argument;

s_CardDetectSemaphore = xSemaphoreCreateBinary();

sdCardFileSystemReady = false;
Expand All @@ -134,7 +133,7 @@ void SdCardThread(void * argument)
/* SD host init function */
if (SD_HostInit(&g_sd) != kStatus_Success)
{
//SD host init fail
// SD host init fail
vTaskDelete(NULL);
return;
}
Expand All @@ -144,6 +143,4 @@ void SdCardThread(void * argument)
vTaskDelete(NULL);
}


///////////////////////////////////////////

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See LICENSE file in the project root for full license information.
//


#ifndef WIN_STORAGE_NATIVE_TARGET_H
#define WIN_STORAGE_NATIVE_TARGET_H

Expand Down