update util_lib CodeWarrior project files

pull/1/head
Chris Conlon 2014-09-17 16:39:15 -06:00
parent c1bfdeeb81
commit 53b5d7d7f4
3 changed files with 667 additions and 2707 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,52 +7,7 @@
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j6</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>${system:ECLIPSE_HOME}/../gnu/bin/mingw32-make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${ProjDirPath}/twrk70f120m_Int_Flash_SramData_Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand> <buildCommand>
@ -70,7 +25,7 @@
<variableList> <variableList>
<variable> <variable>
<name>MQX_ROOT_DIR</name> <name>MQX_ROOT_DIR</name>
<value>file:/C:/Freescale/Freescale%20MQX%203.8</value> <value>file:/C:/Freescale/Freescale_MQX_4_1</value>
</variable> </variable>
</variableList> </variableList>
</projectDescription> </projectDescription>

View File

@ -1,178 +1,180 @@
/* util.c */ /* util.c */
#include <mqx.h> #include <mqx.h>
#include <bsp.h> #include <bsp.h>
#include <mfs.h> #include <fio.h>
#include <fio.h> #include <mfs.h>
#include <sdcard.h>
#include "util.h" #include <spi.h>
#include <part_mgr.h>
#if !BSPCFG_ENABLE_IO_SUBSYSTEM
#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined \ #include "util.h"
non-zero in user_config.h. Please recompile BSP with this option.
#endif #if !BSPCFG_ENABLE_IO_SUBSYSTEM
#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined \
#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED non-zero in user_config.h. Please recompile BSP with this option.
#error This application requires BSP_DEFAULT_IO_CHANNEL to be not \ #endif
NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero \
in user_config.h and recompile BSP with this option. #ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED
#endif #error This application requires BSP_DEFAULT_IO_CHANNEL to be not \
NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero \
#if defined BSP_SDCARD_ESDHC_CHANNEL in user_config.h and recompile BSP with this option.
#if ! BSPCFG_ENABLE_ESDHC #endif
#error This application requires BSPCFG_ENABLE_ESDHC defined \
non-zero in user_config.h. Please recompile libraries with \ #if defined BSP_SDCARD_ESDHC_CHANNEL
this option. #if ! BSPCFG_ENABLE_ESDHC
#endif #error This application requires BSPCFG_ENABLE_ESDHC defined \
#elif defined BSP_SDCARD_SDHC_CHANNEL non-zero in user_config.h. Please recompile libraries with \
#if ! BSPCFG_ENABLE_SDHC this option.
#error This application requires BSPCFG_ENABLE_SDHC defined \ #endif
non-zero in user_config.h. Please recompile libraries with \ #elif defined BSP_SDCARD_SDHC_CHANNEL
this option. #if ! BSPCFG_ENABLE_SDHC
#endif #error This application requires BSPCFG_ENABLE_SDHC defined \
#endif non-zero in user_config.h. Please recompile libraries with \
this option.
#if defined (BSP_SDCARD_SPI_CHANNEL) #endif
#define SDCARD_COM_CHANNEL BSP_SDCARD_SPI_CHANNEL #endif
#elif defined (BSP_SDCARD_ESDHC_CHANNEL)
#define SDCARD_COM_CHANNEL BSP_SDCARD_ESDHC_CHANNEL #if defined (BSP_SDCARD_SPI_CHANNEL)
#elif defined (BSP_SDCARD_SDHC_CHANNEL) #define SDCARD_COM_CHANNEL BSP_SDCARD_SPI_CHANNEL
#define SDCARD_COM_CHANNEL BSP_SDCARD_SDHC_CHANNEL #elif defined (BSP_SDCARD_ESDHC_CHANNEL)
#else #define SDCARD_COM_CHANNEL BSP_SDCARD_ESDHC_CHANNEL
#error "SDCARD low level communication device not defined!" #elif defined (BSP_SDCARD_SDHC_CHANNEL)
#endif #define SDCARD_COM_CHANNEL BSP_SDCARD_SDHC_CHANNEL
#else
int sdcard_open(MQX_FILE_PTR *com_handle, MQX_FILE_PTR *sdcard_handle, #error "SDCARD low level communication device not defined!"
MQX_FILE_PTR *partman_handle, MQX_FILE_PTR *filesystem_handle, #endif
char *partman_name, char *filesystem_name)
{ int sdcard_open(MQX_FILE_PTR *com_handle, MQX_FILE_PTR *sdcard_handle,
MQX_FILE_PTR *partman_handle, MQX_FILE_PTR *filesystem_handle,
_mqx_int error_code; char *partman_name, char *filesystem_name)
_mqx_uint param; {
_mqx_int error_code;
/* Open low level communication device */ _mqx_uint param;
*com_handle = fopen(SDCARD_COM_CHANNEL, NULL);
/* Open low level communication device */
if (NULL == *com_handle) { *com_handle = fopen(SDCARD_COM_CHANNEL, NULL);
printf("Error installing communication handle.\n");
return -60; if (NULL == *com_handle) {
} printf("Error installing communication handle.\n");
return -60;
/* Install SD card device */ }
error_code = _io_sdcard_install("sdcard:", (pointer) &_bsp_sdcard0_init,
*com_handle); /* Install SD card device */
if (error_code != MQX_OK) { error_code = _io_sdcard_install("sdcard:", (void *)&_bsp_sdcard0_init,
printf("Error installing SD card device (0x%x)\n", error_code); *com_handle);
return -61; if (error_code != MQX_OK) {
} printf("Error installing SD card device (0x%x)\n", error_code);
return -61;
_time_delay(200); }
/* Open the device which MFS will be installed on */ _time_delay(200);
*sdcard_handle = fopen("sdcard:", 0);
if (*sdcard_handle == NULL) { /* Open the device which MFS will be installed on */
printf("Unable to open SD card device.\n"); *sdcard_handle = fopen("sdcard:", 0);
return -62; if (*sdcard_handle == NULL) {
} printf("Unable to open SD card device.\n");
return -62;
/* Install partition manager over SD card driver */ }
error_code = _io_part_mgr_install(*sdcard_handle, partman_name, 0);
if (error_code != MFS_NO_ERROR) { /* Install partition manager over SD card driver */
printf("Error installing partition manager: %s\n", MFS_Error_text( error_code = _io_part_mgr_install(*sdcard_handle, partman_name, 0);
(uint_32) error_code)); if (error_code != MFS_NO_ERROR) {
return -63; printf("Error installing partition manager: %s\n", MFS_Error_text(
} (uint32_t) error_code));
return -63;
/* Open partition manager */ }
*partman_handle = fopen(partman_name, NULL);
if (*partman_handle == NULL) { /* Open partition manager */
error_code = ferror(*partman_handle); *partman_handle = fopen(partman_name, NULL);
printf("Error opening partition manager: %s\n", MFS_Error_text( if (*partman_handle == NULL) {
(uint_32) error_code)); error_code = ferror(*partman_handle);
return -64; printf("Error opening partition manager: %s\n", MFS_Error_text(
} (uint32_t) error_code));
return -64;
/* Validate partition 1 */ }
param = 1;
error_code = _io_ioctl(*partman_handle, IO_IOCTL_VAL_PART, &param); /* Validate partition 1 */
if (error_code == MQX_OK) { param = 1;
/* Install MFS over partition 1 */ error_code = _io_ioctl(*partman_handle, IO_IOCTL_VAL_PART, &param);
error_code = _io_mfs_install(*partman_handle, filesystem_name, param); if (error_code == MQX_OK) {
if (error_code != MFS_NO_ERROR) { /* Install MFS over partition 1 */
printf("Error initializing MFS over partition: %s\n", error_code = _io_mfs_install(*partman_handle, filesystem_name, param);
MFS_Error_text((uint_32) error_code)); if (error_code != MFS_NO_ERROR) {
return -65; printf("Error initializing MFS over partition: %s\n",
} MFS_Error_text((uint32_t) error_code));
return -65;
} else { }
/* Install MFS over SD card driver */
error_code = _io_mfs_install(*sdcard_handle, filesystem_name, } else {
(_file_size) 0); /* Install MFS over SD card driver */
if (error_code != MFS_NO_ERROR) { error_code = _io_mfs_install(*sdcard_handle, filesystem_name,
printf("Error initializing MFS: %s\n", MFS_Error_text( (_file_size) 0);
(uint_32) error_code)); if (error_code != MFS_NO_ERROR) {
return -66; printf("Error initializing MFS: %s\n", MFS_Error_text(
} (uint32_t) error_code));
} /* end Validate partition 1 */ return -66;
}
/* Open file system */ } /* end Validate partition 1 */
*filesystem_handle = fopen(filesystem_name, NULL);
error_code = ferror(*filesystem_handle); /* Open file system */
if ((error_code != MFS_NO_ERROR) && (error_code != MFS_NOT_A_DOS_DISK)) { *filesystem_handle = fopen(filesystem_name, NULL);
printf("Error opening filesystem: %s\n", MFS_Error_text( error_code = ferror(*filesystem_handle);
(uint_32) error_code)); if ((error_code != MFS_NO_ERROR) && (error_code != MFS_NOT_A_DOS_DISK)) {
return -67; printf("Error opening filesystem: %s\n", MFS_Error_text(
} (uint32_t) error_code));
if (error_code == MFS_NOT_A_DOS_DISK) { return -67;
printf("NOT A DOS DISK! You must format to continue.\n"); }
return -68; if (error_code == MFS_NOT_A_DOS_DISK) {
} printf("NOT A DOS DISK! You must format to continue.\n");
return -68;
return 0; }
}
return 0;
int sdcard_close(MQX_FILE_PTR *sdcard_handle, MQX_FILE_PTR *partman_handle, }
MQX_FILE_PTR *filesystem_handle,
char *partman_name, char *filesystem_name) int sdcard_close(MQX_FILE_PTR *sdcard_handle, MQX_FILE_PTR *partman_handle,
{ MQX_FILE_PTR *filesystem_handle,
_mqx_int error_code; char *partman_name, char *filesystem_name)
{
/* Close the filesystem */ _mqx_int error_code;
if (MQX_OK != fclose(*filesystem_handle)) {
printf("Error closing filesystem.\n"); /* Close the filesystem */
return -69; if (MQX_OK != fclose(*filesystem_handle)) {
} printf("Error closing filesystem.\n");
*filesystem_handle = NULL; return -69;
}
/* Uninstall MFS */ *filesystem_handle = NULL;
error_code = _io_dev_uninstall(filesystem_name);
if (error_code != MFS_NO_ERROR) { /* Uninstall MFS */
printf("Error uninstalling filesystem.\n"); error_code = _io_dev_uninstall(filesystem_name);
return -70; if (error_code != MFS_NO_ERROR) {
} printf("Error uninstalling filesystem.\n");
return -70;
/* Close partition manager */ }
if (MQX_OK != fclose(*partman_handle)) {
printf("Unable to close partition manager.\n"); /* Close partition manager */
return -71; if (MQX_OK != fclose(*partman_handle)) {
} printf("Unable to close partition manager.\n");
*partman_handle = NULL; return -71;
}
/* Uninstall partition manager */ *partman_handle = NULL;
error_code = _io_dev_uninstall(partman_name);
if (error_code != MFS_NO_ERROR) { /* Uninstall partition manager */
printf("Error uninstalling partition manager.\n"); error_code = _io_dev_uninstall(partman_name);
return -72; if (error_code != MFS_NO_ERROR) {
} printf("Error uninstalling partition manager.\n");
return -72;
/* Close the SD card device */ }
if (MQX_OK != fclose(*sdcard_handle)) {
printf("Unable to close SD card device.\n"); /* Close the SD card device */
return -73; if (MQX_OK != fclose(*sdcard_handle)) {
} printf("Unable to close SD card device.\n");
*sdcard_handle = NULL; return -73;
}
return 0; *sdcard_handle = NULL;
}
return 0;
/* EOF */ }
/* EOF */