-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release merge for v1.03 for MLA v2016-04-27:
* Added required user defined callback for internal flash physical layer: DRV_FILEIO_INTERNAL_FLASH_CONFIG_UNLOCK_VERIFICATION_FUNCTION. This function should validate that the system parameters are valid for flash writes on the device on the board (Vdd, clock speeds, etc. are all in valid range for self writes). * migrated from system_config.h to direct include of fileio_config.h
- Loading branch information
1 parent
ec02cd6
commit 33e0887
Showing
10 changed files
with
112 additions
and
121 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ please contact [email protected] | |
|
||
#include "fileio_config.h" | ||
#include <fileio.h> | ||
#include <fileio_media.h> | ||
|
||
uint8_t FILEIO_InternalFlash_MediaDetect(void* config); | ||
FILEIO_MEDIA_INFORMATION * FILEIO_InternalFlash_MediaInitialize(void* config); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// DOM-IGNORE-BEGIN | ||
/******************************************************************************* | ||
Copyright 2016 Microchip Technology Inc. (www.microchip.com) | ||
Licensed 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. | ||
To request to license the code under the MLA license (www.microchip.com/mla_license), | ||
please contact [email protected] | ||
*******************************************************************************/ | ||
//DOM-IGNORE-END | ||
|
||
// Macro maps to a user function that will determine if the system parameters are valid for a self write | ||
// for the processor on the board. Returns true if the write can continue and false if it should not. | ||
#define DRV_FILEIO_INTERNAL_FLASH_CONFIG_UNLOCK_VERIFICATION_FUNCTION() true | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ please contact [email protected] | |
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
#include <fileio_media.h> | ||
|
||
/*****************************************************************************/ | ||
/* Custom structures and definitions */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,11 @@ please contact [email protected] | |
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include "system_config.h" | ||
#include "fileio_config.h" | ||
#include "system.h" | ||
|
||
#include <fileio_media.h> | ||
|
||
|
||
/*******************************************************************/ | ||
/* Structures and defines */ | ||
|
@@ -176,33 +178,6 @@ typedef enum | |
FILEIO_GET_PROPERTIES_STILL_WORKING = 0xFF | ||
} FILEIO_DRIVE_ERRORS; | ||
|
||
// Enumeration to define media error types | ||
typedef enum | ||
{ | ||
MEDIA_NO_ERROR, // No errors | ||
MEDIA_DEVICE_NOT_PRESENT, // The requested device is not present | ||
MEDIA_CANNOT_INITIALIZE // Cannot initialize media | ||
} FILEIO_MEDIA_ERRORS; | ||
|
||
// Media information flags. The driver's MediaInitialize function will return a pointer to one of these structures. | ||
typedef struct | ||
{ | ||
FILEIO_MEDIA_ERRORS errorCode; // The status of the intialization FILEIO_MEDIA_ERRORS | ||
// Flags | ||
union | ||
{ | ||
uint8_t value; | ||
struct | ||
{ | ||
uint8_t sectorSize : 1; // The sector size parameter is valid. | ||
uint8_t maxLUN : 1; // The max LUN parameter is valid. | ||
} bits; | ||
} validityFlags; | ||
|
||
uint16_t sectorSize; // The sector size of the target device. | ||
uint8_t maxLUN; // The maximum Logical Unit Number of the device. | ||
} FILEIO_MEDIA_INFORMATION; | ||
|
||
/*************************************************************************** | ||
Function: | ||
void (*FILEIO_DRIVER_IOInitialize)(void * mediaConfig); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ please contact [email protected] | |
#include "system_config.h" | ||
#include "system.h" | ||
|
||
#include <fileio_media.h> | ||
|
||
|
||
/*******************************************************************/ | ||
/* Structures and defines */ | ||
|
@@ -178,32 +180,6 @@ typedef enum | |
FILEIO_GET_PROPERTIES_STILL_WORKING = 0xFF | ||
} FILEIO_DRIVE_ERRORS; | ||
|
||
// Enumeration to define media error types | ||
typedef enum | ||
{ | ||
MEDIA_NO_ERROR, // No errors | ||
MEDIA_DEVICE_NOT_PRESENT, // The requested device is not present | ||
MEDIA_CANNOT_INITIALIZE // Cannot initialize media | ||
} FILEIO_MEDIA_ERRORS; | ||
|
||
// Media information flags. The driver's MediaInitialize function will return a pointer to one of these structures. | ||
typedef struct | ||
{ | ||
FILEIO_MEDIA_ERRORS errorCode; // The status of the intialization FILEIO_MEDIA_ERRORS | ||
// Flags | ||
union | ||
{ | ||
uint8_t value; | ||
struct | ||
{ | ||
uint8_t sectorSize : 1; // The sector size parameter is valid. | ||
uint8_t maxLUN : 1; // The max LUN parameter is valid. | ||
} bits; | ||
} validityFlags; | ||
|
||
uint16_t sectorSize; // The sector size of the target device. | ||
uint8_t maxLUN; // The maximum Logical Unit Number of the device. | ||
} FILEIO_MEDIA_INFORMATION; | ||
|
||
/*************************************************************************** | ||
Function: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// DOM-IGNORE-BEGIN | ||
/******************************************************************************* | ||
Copyright 2015 Microchip Technology Inc. (www.microchip.com) | ||
Licensed 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. | ||
To request to license the code under the MLA license (www.microchip.com/mla_license), | ||
please contact [email protected] | ||
*******************************************************************************/ | ||
//DOM-IGNORE-END | ||
|
||
#ifndef _FILEIO_MEDIA_H | ||
#define _FILEIO_MEDIA_H | ||
|
||
// Enumeration to define media error types | ||
typedef enum | ||
{ | ||
MEDIA_NO_ERROR, // No errors | ||
MEDIA_DEVICE_NOT_PRESENT, // The requested device is not present | ||
MEDIA_CANNOT_INITIALIZE // Cannot initialize media | ||
} FILEIO_MEDIA_ERRORS; | ||
|
||
// Media information flags. The driver's MediaInitialize function will return a pointer to one of these structures. | ||
typedef struct | ||
{ | ||
FILEIO_MEDIA_ERRORS errorCode; // The status of the initialization FILEIO_MEDIA_ERRORS | ||
// Flags | ||
union | ||
{ | ||
uint8_t value; | ||
struct | ||
{ | ||
uint8_t sectorSize : 1; // The sector size parameter is valid. | ||
uint8_t maxLUN : 1; // The max LUN parameter is valid. | ||
} bits; | ||
} validityFlags; | ||
|
||
uint16_t sectorSize; // The sector size of the target device. | ||
uint8_t maxLUN; // The maximum Logical Unit Number of the device. | ||
} FILEIO_MEDIA_INFORMATION; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ please contact [email protected] | |
*******************************************************************************/ | ||
//DOM-IGNORE-END | ||
|
||
#include <system_config.h> | ||
#include <fileio_config.h> | ||
#include <system.h> | ||
#include <fileio.h> | ||
#include "fileio_private.h" | ||
|
@@ -798,7 +798,6 @@ void FILEIO_FormatShortFileName (const char * fileName, FILEIO_OBJECT * filePtr) | |
} | ||
} | ||
|
||
|
||
int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * fileName, uint16_t mode) | ||
{ | ||
FILEIO_ERROR_TYPE error; | ||
|
@@ -811,11 +810,11 @@ int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * fileName, uint16_t mode) | |
uint16_t currentClusterOffset = 0; | ||
|
||
fileName = FILEIO_CacheDirectory (&directory, fileName, false); | ||
|
||
if (fileName == NULL) | ||
{ | ||
return FILEIO_RESULT_FAILURE; | ||
} | ||
} | ||
|
||
currentCluster = directory.cluster; | ||
|
||
|
@@ -939,7 +938,7 @@ int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * fileName, uint16_t mode) | |
} | ||
} | ||
|
||
// Check to ensure no errors occured | ||
// Check to ensure no errors occurred | ||
if (error != FILEIO_ERROR_NONE) | ||
{ | ||
directory.drive->error = error; | ||
|
@@ -1061,7 +1060,7 @@ const char * FILEIO_CacheDirectory (FILEIO_DIRECTORY * dir, const char * path, b | |
#endif | ||
|
||
// Find the next forward slash (indicates part of the path is a directory) | ||
while ((i = FILEIO_FindNextDelimiter(path)) != -1) | ||
while ((i = FILEIO_FindNextDelimiter(path)) != ((uint16_t)-1)) | ||
{ | ||
// If someone terminated a directory path with a delimiter, break out of the loop | ||
if (*(path + i) == FILEIO_CONFIG_DELIMITER) | ||
|
@@ -1126,7 +1125,7 @@ uint16_t FILEIO_FindNextDelimiter(const char * path) | |
|
||
if (c == 0) | ||
{ | ||
return -1; | ||
return ((uint16_t)-1); | ||
} | ||
else | ||
{ | ||
|