2016-07-27 4 views
0

I'am을 FREERTOS_USED 정의한 후 문제,하지만 그 fs_g_status 보인다아트멜 UC3A0512 FAT의 API의 지방 API가 <code>fs_g_status</code>이 문제를 디버깅하는 데 도움 전역 변수를 사용</p> <p>기호를 플래시에서 데이터를 읽어 ASF에서 제공 <a href="http://www.atmel.com/images/doc7824.pdf" rel="nofollow">FAT API</a>를 사용

#define FS_ERR_HW    (FAIL+0) //!< Hardware driver error 
#define FS_ERR_NO_FORMAT  (FAIL+1) //!< The selected drive isn't formated 
#define FS_ERR_NO_PART   (FAIL+2) //!< The selected partition doesn't existed 
#define FS_ERR_NO_SUPPORT_PART (FAIL+3) //!< The selected partition isn't supported 
#define FS_ERR_TOO_FILE_OPEN (FAIL+4) //!< The navigation have already opened a file 
#define FS_ERR_END_OF_DRIVE  (FAIL+5) //!< There are not other driver 
#define FS_ERR_BAD_POS   (FAIL+6) //!< The position is over the file 
#define FS_ERR_FS    (FAIL+7) //!< File system error 
#define FS_ERR_NO_FIND   (FAIL+8) //!< File no found 
#define FS_ERR_ENTRY_EMPTY  (FAIL+9) //!< File entry empty 
#define FS_ERR_ENTRY_BAD  (FAIL+10) //!< File entry bad 
#define FS_ERR_ENTRY_BADTYPE (FAIL+11) //!< File entry type don't corresponding 
#define FS_ERR_NO_DIR   (FAIL+12) //!< The selected file isn't a directory 
#define FS_ERR_NO_MOUNT   (FAIL+13) //!< The partition isn't mounted 
#define FS_ERR_NO_FILE_SEL  (FAIL+14) //!< There are no selected file 
#define FS_NO_LAST_LFN_ENTRY (FAIL+15) //!< The file entry isn't the last long file entry 

#define FS_ERR_ID_FILE   (FAIL+17) //!< The file identifier is bad 
#define FS_ERR_NO_FILE   (FAIL+18) //!< The selected file entry isn't a file 
#define FS_LUN_WP    (FAIL+19) //!< Drive is in read only mode 
#define FS_ERR_READ_ONLY  (FAIL+20) //!< File is on read access only 
#define FS_ERR_NAME_INCORRECT (FAIL+21) //!< The name don't corresponding at the filter name 
//... 

: fs_g_status에 대한

가능한 값 : 의미없는 값을 사용합니다

#define FAIL  1 

이 617,451,515,내가 함수가 false를 반환하면이, fs_g_status 만 설정해야합니다 로직이 아니라고 생각 나는 플래시

int read_Flash_Data() 
{ 
    /* initialize FSACCESS mutex and navigators */ 
    if (b_fsaccess_init()) 
    { 
    usart_write_line((&AVR32_USART0), " b_fsaccess_init return true \r\n"); 
    } 
    //fs_g_status = 0x00 OK 

    /* Try to init data flash */ 
    if (at45dbx_mem_check()) 
    { 
    /* display message */ 
    usart_write_line((&AVR32_USART0), " at45dbx_mem_check return true \r\n"); 
} 
else 
{ 
    /* display error message */ 
    usart_write_line((&AVR32_USART0)," at45dbx_mem_check return false\r\n"); 
    return (-1); 
} 
//fs_g_status = 0x00 OK 

if (nav_drive_set(LUN_ID_1) == false) 
{ 
    usart_write_line((&AVR32_USART0)," nav_drive_set return false \r\n"); 
    return (-1); 
} 
//fs_g_status = 0x01 ==> Hardware driver error NOK , but the nav_drive_set(LUN_ID_1) return true !!!! 

if(!nav_partition_mount()) 
{ 
    usart_write_line((&AVR32_USART0),"nav_partition_mount return false \r\n"); 
    return (-1); 
} 
//fs_g_status = 0x04 ==> The navigation have already opened a file, but the nav_partition_mount() return true !!!! 

if ((ret = open(ACTUAL_CONFIG_FILE_PATH, O_RDONLY)) < 0) 
{ 
    usart_write_line((&AVR32_USART0),"Opening file failed \r\n"); 
    return (-1); 
} 
//fs_g_status = 0x10 ==16(decimal) open return true !!!! 
//... 
} 

에서 데이터를 읽는 데 사용할 수있는 기능입니다. 좋습니다. 사소한 문제가 있고 주요 기능으로 인해 기능이 제대로 수행되지 않고 주석으로 충분하지 않다고 가정 해 봅시다.

이제이 함수는 freeRTOS 작업에서 사용되며 기호가 정의되지 않은 위의 설명에서 일치 액세스에서 플래시를 보호하기 위해 컴파일시 FREERTOS_USED 심볼을 정의해야합니다. 이제 nav_partition_mount()이 거짓이고 fs_g_status = 0x01이 반환됩니다.

아무도 문제가 발생하지 않습니다. 문제를 디버깅하는 방법을 찾을 수없는 것 같습니다. 어떤 제안이라도 환영합니다.

답변

1

ctrl_access_semphr, 을 초기화하는 것을 잊어 버린 경우 ctrl_access_initctrl_access.c에 정의해야합니다.

int read_Flash_Data() 
{ 
    /* initialize FSACCESS mutex and navigators */ 
    if (b_fsaccess_init()) 
    { 
    usart_write_line((&AVR32_USART0), " b_fsaccess_init return true \r\n"); 
    } 

    /* initialize ctrl_access semaphore */ 
    if (ctrl_access_init()) 
    { 
    usart_write_line((&AVR32_USART0), " ctrl_access_init return true \r\n"); 
    } 
    //...... 
:

#ifdef FREERTOS_USED 

bool ctrl_access_init(void) 
{ 
// If the handle to the protecting semaphore is not valid, 
if (!ctrl_access_semphr) 
{ 
    // try to create the semaphore. 
    vSemaphoreCreateBinary(ctrl_access_semphr); 

    // If the semaphore could not be created, there is no backup solution. 
    if (!ctrl_access_semphr) return false; 
    } 

return true; 
} 
#endif 

함수는 같아야합니다