FX_DIG.C
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:10k
- /**************************************************************************/
- /* */
- /* Copyright (c) 1996-2002 by Express Logic Inc. */
- /* */
- /* This software is copyrighted by and is the sole property of Express */
- /* Logic, Inc. All rights, title, ownership, or other interests */
- /* in the software remain the property of Express Logic, Inc. This */
- /* software may only be used in accordance with the corresponding */
- /* license agreement. Any unauthorized use, duplication, transmission, */
- /* distribution, or disclosure of this software is expressly forbidden. */
- /* */
- /* This Copyright notice may not be removed or modified without prior */
- /* written consent of Express Logic, Inc. */
- /* */
- /* Express Logic, Inc. reserves the right to modify this software */
- /* without notice. */
- /* */
- /* Express Logic, Inc. info@expresslogic.com */
- /* 11423 West Bernardo Court http://www.expresslogic.com */
- /* San Diego, CA 92127 */
- /* */
- /**************************************************************************/
- /**************************************************************************/
- /**************************************************************************/
- /** */
- /** FileX Component */
- /** */
- /** Directory (DIR) */
- /** */
- /**************************************************************************/
- /**************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef ENABLE_FILEX
- #ifdef _DEBUG
- #undef IFTRACE
- #define IFTRACE if (gTraceFileSys)
- #include "DebugDbgMain.h"
- #endif //_DEBUG
- #define FX_SOURCE_CODE
- /* Include necessary system files. */
- #include "PlaycoreFileSysFileXfx_api.h"
- #include "PlaycoreFileSysFileXfx_sys.h"
- #include "PlaycoreFileSysFileXfx_dir.h"
- #include "PlaycoreFileSysFileXfx_fil.h"
- #include "PlaycoreFileSysFileXfx_uti.h"
- /**************************************************************************/
- /* */
- /* FUNCTION RELEASE */
- /* */
- /* _fx_directory_information_get PORTABLE C */
- /* 3.0 */
- /* AUTHOR */
- /* */
- /* William E. Lamie, Express Logic, Inc. */
- /* */
- /* DESCRIPTION */
- /* */
- /* This function first attempts to find the specified directory name. */
- /* If found, the complete file parameters are placed in all non-null */
- /* return parameters. If the file name is not found, the appropriate */
- /* error code is returned to the caller. */
- /* */
- /* INPUT */
- /* */
- /* media_ptr Media control block pointer */
- /* directory_name Directory name pointer */
- /* attributes Pointer to attributes */
- /* size Pointer to size */
- /* year Pointer to year */
- /* month Pointer to month */
- /* day Pointer to day */
- /* hour Pointer to hour */
- /* minute Pointer to minute */
- /* second Pointer to second */
- /* */
- /* OUTPUT */
- /* */
- /* return status */
- /* */
- /* CALLS */
- /* */
- /* _fx_directory_search Search for the file name in */
- /* the directory structure */
- /* */
- /* CALLED BY */
- /* */
- /* Application Code */
- /* */
- /* RELEASE HISTORY */
- /* */
- /* DATE NAME DESCRIPTION */
- /* */
- /* 01-01-1999 William E. Lamie Initial Version 1.0 */
- /* 03-01-2000 William E. Lamie Modified comment(s), and */
- /* corrected problem returning */
- /* half-seconds instead of */
- /* seconds, resulting in */
- /* version 1.0b. */
- /* 01-28-2001 William E. Lamie Modified comment(s), */
- /* resulting in version 2.0. */
- /* 03-01-2002 William E. Lamie Modified comment(s), */
- /* resulting in version 3.0. */
- /* */
- /**************************************************************************/
- UINT _fx_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name,
- UINT *attributes, ULONG *size,
- UINT *year, UINT *month, UINT *day,
- UINT *hour, UINT *minute, UINT *second)
- {
- UINT status;
- FX_DIR_ENTRY dir_entry;
- /* Check the media to make sure it is open. */
- if (media_ptr -> fx_media_id != FX_MEDIA_ID)
- {
- /* Return the media not opened error. */
- return(FX_MEDIA_NOT_OPEN);
- }
- /* Protect against other threads accessing the media. */
- FX_PROTECT
- /* Search the system for the supplied directory name. */
- status = _fx_directory_search(media_ptr, directory_name, &dir_entry, FX_NULL, FX_NULL);
- /* Determine if the search was successful. */
- if (status != FX_SUCCESS)
- {
- /* Release media protection. */
- FX_UNPROTECT
- /* Return the error code. */
- return(status);
- }
- /* Check to see if attributes are required. */
- if (attributes)
- {
- /* Pickup the attributes. */
- *attributes = dir_entry.fx_dir_entry_attributes;
- }
- /* Check to see if the size is required. */
- if (size)
- {
- /* Pickup the size. */
- *size = dir_entry.fx_dir_entry_file_size;
- }
- /* Check to see if the year is required. */
- if (year)
- {
- /* Pickup the year. */
- *year = ((dir_entry.fx_dir_entry_date >> FX_YEAR_SHIFT) & FX_YEAR_MASK) +
- FX_BASE_YEAR;
- }
- /* Check to see if the month is required. */
- if (month)
- {
- /* Pickup the month. */
- *month = (dir_entry.fx_dir_entry_date >> FX_MONTH_SHIFT) & FX_MONTH_MASK;
- }
- /* Check to see if the day is required. */
- if (day)
- {
- /* Pickup the day. */
- *day = dir_entry.fx_dir_entry_date & FX_DAY_MASK;
- }
- /* Check to see if the hour is required. */
- if (hour)
- {
- /* Pickup the hour. */
- *hour = (dir_entry.fx_dir_entry_time >> FX_HOUR_SHIFT) & FX_HOUR_MASK;
- }
- /* Check to see if the minute is required. */
- if (minute)
- {
- /* Pickup the minute. */
- *minute = (dir_entry.fx_dir_entry_time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK;
- }
- /* Check to see if the second is required. */
- if (second)
- {
- /* Pickup the second. */
- *second = (dir_entry.fx_dir_entry_time & FX_SECOND_MASK) * 2;
- }
- /* Release media protection. */
- FX_UNPROTECT
- /* Directory information get is complete, return successful status. */
- return(FX_SUCCESS);
- }
- #endif