00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include <stdlib.h>
00047 #include <string.h>
00048
00049 #include "board.h"
00050
00051 #include "gpio.h"
00052
00053
00054
00055 #include "FreeRTOS.h"
00056 #include "task.h"
00057 #include "queue.h"
00058
00059 #include "ctrl_access.h"
00060 #include "conf_access.h"
00061 #include "navigation.h"
00062
00063 #include "tracedump.h"
00064 #include "shell.h"
00065 #include "fscmds.h"
00066 #include "supervisor.h"
00067
00068 #include "MMI.h"
00069 #include "dip204.h"
00070 #include "spi.h"
00071
00072 #include "cptime.h"
00073
00074
00075
00076
00077
00079 #define MMI_LINE_LENGTH 20
00080
00081 #define MMI_NB_LINE 4
00082
00083 #define MMI_QUEUE_SIZE MMI_NB_LINE
00084
00085 #define LINE_1 0x01
00086
00087 #define LINE_2 0x02
00088
00089 #define LINE_3 0x03
00090
00091 #define LINE_4 0x04
00092
00093 #define DATE_LINE LINE_1
00094
00095 #define PARAM_LINE LINE_2
00096
00097 #define USER_MENU_LINE LINE_3
00098
00099 #define USER_MESS_LINE LINE_4
00100
00102 #define MMI_USB_CONNECTED 0xB7
00103
00104 #define MMI_SPACE 0x20
00105
00107 #define MMI_USB_HOST_MENU_MAX_ITEM 4
00108
00109 #define MMI_USB_DEVICE_MENU_MAX_ITEM 1
00110
00111 #ifdef USB_ENABLE
00112 #if USB_DEVICE_FEATURE == ENABLED
00113
00114 #define MMI_IDLE_MENU_MAX_ITEM 7
00115 #else
00116 #define MMI_IDLE_MENU_MAX_ITEM 6
00117 #endif
00118 #else
00119 #define MMI_IDLE_MENU_MAX_ITEM 6
00120 #endif
00121
00122 #define MMI_WAIT_MENU_MAX_ITEM 1
00123
00125 #define ATMEL_BANNER " ATMEL AVR32 UC3 "
00126
00128 typedef Bool (*pfUserAction) (void);
00129
00130
00131 #if USB_DEVICE_FEATURE != ENABLED
00132
00133 Bool b_MMI_do_nothing( void );
00134 #endif
00135
00136 #ifndef USB_ENABLE
00137
00138 Bool b_MMI_do_nothing( void );
00139 #endif
00140
00141 static Bool b_mmi_format_a( void );
00142 static Bool b_mmi_mkdir_aLOG( void );
00143 static Bool b_mmi_format_b( void );
00144 static Bool b_mmi_mkdir_bLOG( void );
00145
00146 #ifdef USB_ENABLE
00147
00148 const portCHAR *const MMI_USBHostMenu[MMI_USB_HOST_MENU_MAX_ITEM] = {
00149 "\x20 Copy Logs \x10",
00150 "\x11 Move Logs \x10",
00151 "\x11 Upload WEB Files \x10",
00152 "\x11 Upload CFG Files \x20"
00153 };
00154
00156 const portCHAR *const MMI_USBHostActingMenu[MMI_USB_HOST_MENU_MAX_ITEM] = {
00157 "Copying Logs ",
00158 "Moving Logs ",
00159 "Uploading WEB Files ",
00160 "Uploading CFG Files "
00161 };
00162
00164 pfUserAction const pfUSBHostUserAction[MMI_USB_HOST_MENU_MAX_ITEM] = {
00165 b_USBHostCopyLogs,
00166 b_USBHostMoveLogs,
00167 b_USBHostCopyWeb,
00168 b_USBHostCopyCfg
00169 };
00170
00171 #if USB_DEVICE_FEATURE == ENABLED
00172
00173 const portCHAR *const MMI_USBDeviceMenu[MMI_USB_DEVICE_MENU_MAX_ITEM] = {
00174 "USB Mass Storage "
00175 };
00176
00178 pfUserAction const pfUSBDeviceUserAction[MMI_USB_DEVICE_MENU_MAX_ITEM] = {
00179 b_supervisor_leave_UsbMassStorage_mode
00180 };
00181 #endif
00182
00183 #endif
00184
00186 const portCHAR *const MMI_IdleMenu[MMI_IDLE_MENU_MAX_ITEM] = {
00187 #ifdef USB_ENABLE
00188 #if USB_DEVICE_FEATURE == ENABLED
00189 "\x20 Set as USB key \x10",
00190 "\x11 Format a:(DF) \x10",
00191 "\x11 Create a:/LOG \x10",
00192 "\x11 Log to a:(DF) \x10",
00193 "\x11 Format b:(SDMMC) \x10",
00194 "\x11 Create b:/LOG \x10",
00195 "\x11 Log to b:(SDMMC) \x20"
00196 #else
00197 "\x20 Format a:(DF) \x10",
00198 "\x11 Create a:/LOG \x10",
00199 "\x11 Log to a:(DF) \x10",
00200 "\x11 Format b:(SDMMC) \x10",
00201 "\x11 Create b:/LOG \x10",
00202 "\x11 Log to b:(SDMMC) \x20"
00203 #endif
00204 #else
00205 "\x20 Format a:(DF) \x10",
00206 "\x11 Create a:/LOG \x10",
00207 "\x11 Log to a:(DF) \x10",
00208 "\x11 Format b:(SDMMC) \x10",
00209 "\x11 Create b:/LOG \x10",
00210 "\x11 Log to b:(SDMMC) \x20"
00211 #endif
00212 };
00213
00215 const portCHAR *const MMI_IdleActingMenu[MMI_IDLE_MENU_MAX_ITEM] = {
00216 #ifdef USB_ENABLE
00217 #if USB_DEVICE_FEATURE == ENABLED
00218 "",
00219 "Formating a: ",
00220 "Creating a:/LOG ",
00221 "LOGS set to DF ",
00222 "Formating b: ",
00223 "Creating b:/LOG ",
00224 "LOGS set to SDMMC "
00225 #else
00226 "Formating a: ",
00227 "Creating a:/LOG ",
00228 "LOGS set to DF ",
00229 "Formating b: ",
00230 "Creating b:/LOG ",
00231 "LOGS set to SDMMC "
00232 #endif
00233 #else
00234 "Formating a: ",
00235 "Creating a:/LOG ",
00236 "LOGS set to DF ",
00237 "Formating b: ",
00238 "Creating b:/LOG ",
00239 "LOGS set to SDMMC "
00240 #endif
00241 };
00242
00244 pfUserAction const pfIdleUserAction[MMI_IDLE_MENU_MAX_ITEM] = {
00245 #ifdef USB_ENABLE
00246 #if USB_DEVICE_FEATURE == ENABLED
00247 b_supervisor_switch_to_maintenance_mode,
00248 #endif
00249 #endif
00250 b_mmi_format_a,
00251 b_mmi_mkdir_aLOG,
00252 b_datalog_set_current_log_drive_toDF,
00253 b_mmi_format_b,
00254 b_mmi_mkdir_bLOG,
00255 b_datalog_set_current_log_drive_toSDMMC
00256 };
00257
00258 #ifdef USB_ENABLE
00259 #if USB_DEVICE_FEATURE == ENABLED
00260
00261 const portCHAR *const MMI_WaitHostMenu[MMI_WAIT_MENU_MAX_ITEM] = {
00262 MMI_MAINTAINER_MODE
00263 };
00264
00266 pfUserAction const pfWaitHostUserAction[MMI_WAIT_MENU_MAX_ITEM] = {
00267 b_supervisor_leave_waitingforhost_mode
00268 };
00269 #endif
00270 #endif
00271
00273 portCHAR Line[MMI_NB_LINE][MMI_LINE_LENGTH + 1];
00274
00276 portCHAR * ParamScreen = Line[PARAM_LINE - 1];
00278 portCHAR * DateScreen = Line[DATE_LINE - 1];
00280 portCHAR * UserMenuScreen = Line[USER_MENU_LINE - 1];
00282 portCHAR * UserMessScreen = Line[USER_MESS_LINE - 1];
00283
00285 eUserMenu eCurrentUserMenu = eUserMenuIdle;
00286
00288 portCHAR cMMI_SubMenu_CurrentItem = 0;
00289
00291 static xQueueHandle xMMIQueue = 0;
00292
00294 static char pcTempoDate[17];
00295
00297 extern xQueueHandle xSUPERVISORQueue;
00298
00300 extern signed short sMmiNavId;
00301
00302 static void prvMMI_Init();
00303
00305 const signed portCHAR *const pcStringLogDirName = (signed portCHAR *)"LOG";
00306
00308 extern const signed portCHAR *const pcStringLogDirectoryNameA;
00309 extern const signed portCHAR *const pcStringLogDirectoryNameB;
00310
00311
00315 Bool bMMI_start( void )
00316 {
00317 unsigned short i;
00318
00319 for (i = 0 ; i < MMI_NB_LINE ; i++)
00320 {
00321 memset(Line[i], MMI_SPACE, MMI_LINE_LENGTH);
00322 Line[i][MMI_LINE_LENGTH] = '\0';
00323 }
00324
00325 xMMIQueue = xQueueCreate( MMI_QUEUE_SIZE, sizeof(portCHAR *) );
00326
00327 if( 0 == xMMIQueue )
00328 {
00329 return pdFALSE;
00330 }
00331
00332
00333 prvMMI_Init();
00334
00335
00336 vMMI_SetUserMenuMode(eUserMenuIdle, pdTRUE);
00337 vMMI_UserMessDisplay(ATMEL_BANNER);
00338 return pdTRUE;
00339 }
00340
00346 void vMMI_DisplayIP(portCHAR * IPAddress)
00347 {
00348 unsigned short i = 0;
00349
00350 memset(UserMenuScreen, MMI_SPACE, MMI_LINE_LENGTH - 1);
00351
00352 do
00353 {
00354 ParamScreen[i++] = *IPAddress++;
00355 }while (*IPAddress != '\0' || i >= 15);
00356
00357 xQueueSend( xMMIQueue, (void *)&ParamScreen, 0 );
00358 }
00359
00360
00366 void vMMI_DisplayUSBState(Bool bConnected)
00367 {
00368 if (bConnected == pdTRUE)
00369 {
00370 ParamScreen[MMI_LINE_LENGTH - 1] = MMI_USB_CONNECTED;
00371 }
00372 else
00373 {
00374 ParamScreen[MMI_LINE_LENGTH - 1] = MMI_SPACE;
00375 }
00376
00377 xQueueSend( xMMIQueue, (void *)&ParamScreen, 0 );
00378 }
00379
00380
00386 void vMMI_DisplayDateAndTime(portCHAR * pcDateTime)
00387 {
00388 strcpy(DateScreen, pcDateTime);
00389
00390 xQueueSend( xMMIQueue, (void *)&DateScreen, 0 );
00391 }
00392
00393
00399 void vMMI_UserMenuValidateItem(Bool UnderIT)
00400 {
00401 portBASE_TYPE xYieldRequired = pdFALSE;
00402 #ifdef USB_ENABLE
00403
00404 if (eCurrentUserMenu == eUserMenuUSBHost)
00405 {
00406
00407 if (UnderIT)
00408 {
00409 portENTER_CRITICAL();
00410
00411 xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfUSBHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00412 portEXIT_CRITICAL();
00413 }
00414 else
00415 {
00416
00417 xQueueSend( xSUPERVISORQueue, (void *)&(pfUSBHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00418 }
00419 }
00420
00421 else if (eCurrentUserMenu == eUserMenuUSBDevice)
00422 {
00423
00424 if (UnderIT)
00425 {
00426 portENTER_CRITICAL();
00427
00428 xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfUSBDeviceUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00429 portEXIT_CRITICAL();
00430 }
00431 }
00432
00433 else if (eCurrentUserMenu == eUserMenuWaitHost)
00434 {
00435
00436 if (UnderIT)
00437 {
00438 portENTER_CRITICAL();
00439
00440 xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfWaitHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00441 portEXIT_CRITICAL();
00442 }
00443 else
00444 {
00445
00446 xQueueSend( xSUPERVISORQueue, (void *)&(pfWaitHostUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00447 }
00448 }
00449
00450 else if (eCurrentUserMenu == eUserMenuIdle)
00451 #else
00452
00453 if (eCurrentUserMenu == eUserMenuIdle)
00454 #endif
00455 {
00456
00457 if (UnderIT)
00458 {
00459 portENTER_CRITICAL();
00460
00461 xQueueSendFromISR( xSUPERVISORQueue, (void *)&(pfIdleUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), &xYieldRequired );
00462 portEXIT_CRITICAL();
00463 }
00464 else
00465 {
00466
00467 xQueueSend( xSUPERVISORQueue, (void *)&(pfIdleUserAction[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]), 0 );
00468 }
00469 }
00470
00471 else
00472 {
00473 return;
00474 }
00475 }
00476
00483 void vMMI_SetUserMenuMode(eUserMenu UserMenu, Bool ResetCurrentState)
00484 {
00485 if (ResetCurrentState)
00486 {
00487
00488 cMMI_SubMenu_CurrentItem = 0;
00489 }
00490 #ifdef USB_ENABLE
00491
00492 if (UserMenu == eUserMenuUSBHost)
00493 {
00494
00495 eCurrentUserMenu = eUserMenuUSBHost;
00496
00497 strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00498 }
00499
00500 else if (UserMenu == eUserMenuUSBHostActing)
00501 {
00502
00503 eCurrentUserMenu = eUserMenuUSBHostActing;
00504
00505 strcpy(UserMenuScreen, MMI_USBHostActingMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00506 }
00507
00508 #if USB_DEVICE_FEATURE == ENABLED
00509 else if (UserMenu == eUserMenuUSBDevice)
00510 {
00511
00512 eCurrentUserMenu = eUserMenuUSBDevice;
00513
00514 strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00515 }
00516 else if (UserMenu == eUserMenuWaitHost)
00517 {
00518
00519 eCurrentUserMenu = eUserMenuWaitHost;
00520
00521 strcpy(UserMenuScreen, MMI_WaitHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00522 }
00523 #endif
00524 else if( UserMenu == eUserMenuIdle )
00525 #endif
00526 {
00527
00528 eCurrentUserMenu = eUserMenuIdle;
00529
00530 strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00531 }
00532 else
00533 {
00534
00535 eCurrentUserMenu = eUserMenuIdleActing;
00536
00537 strcpy(UserMenuScreen, MMI_IdleActingMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00538 }
00539
00540 xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00541 }
00542
00543
00549 void vMMI_UserMenuDisplayNextItem(Bool UnderIT)
00550 {
00551 #ifdef USB_ENABLE
00552
00553 if (eCurrentUserMenu == eUserMenuUSBHost)
00554 {
00555
00556 cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_USB_HOST_MENU_MAX_ITEM - 1);
00557
00558 strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00559 }
00560 #if USB_DEVICE_FEATURE == ENABLED
00561
00562 else if (eCurrentUserMenu == eUserMenuUSBDevice)
00563 {
00564
00565 cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_USB_DEVICE_MENU_MAX_ITEM - 1);
00566
00567 strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00568 }
00569 #endif
00570 else
00571 #endif
00572 if( eCurrentUserMenu == eUserMenuIdle )
00573 {
00574
00575 cMMI_SubMenu_CurrentItem = Min(cMMI_SubMenu_CurrentItem + 1, MMI_IDLE_MENU_MAX_ITEM - 1);
00576
00577 strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00578 }
00579 #ifdef USB_ENABLE
00580
00581 if (UnderIT)
00582 {
00583 portBASE_TYPE xYieldRequired = pdFALSE;
00584 portENTER_CRITICAL();
00585
00586 xQueueSendFromISR( xMMIQueue, (void *)&UserMenuScreen, &xYieldRequired );
00587 portEXIT_CRITICAL();
00588 }
00589 else
00590 {
00591
00592 xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00593 }
00594 #endif
00595 }
00596
00597
00603 void vMMI_UserMenuDisplayPreviousItem(Bool UnderIT)
00604 {
00605 #ifdef USB_ENABLE
00606
00607 if (eCurrentUserMenu == eUserMenuUSBHost)
00608 {
00609
00610 cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00611
00612 strcpy(UserMenuScreen, MMI_USBHostMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00613 }
00614
00615 #if USB_DEVICE_FEATURE == ENABLED
00616 else if (eCurrentUserMenu == eUserMenuUSBDevice)
00617 {
00618
00619 cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00620
00621 strcpy(UserMenuScreen, MMI_USBDeviceMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00622 }
00623 #endif
00624 else
00625 #endif
00626 if( eCurrentUserMenu == eUserMenuIdle )
00627 {
00628
00629 cMMI_SubMenu_CurrentItem = Max(cMMI_SubMenu_CurrentItem - 1, 0);
00630
00631 strcpy(UserMenuScreen, MMI_IdleMenu[(unsigned portCHAR)cMMI_SubMenu_CurrentItem]);
00632 }
00633 #ifdef USB_ENABLE
00634
00635 if (UnderIT)
00636 {
00637 portBASE_TYPE xYieldRequired = pdFALSE;
00638 portENTER_CRITICAL();
00639
00640 xQueueSendFromISR( xMMIQueue, (void *)&UserMenuScreen, &xYieldRequired );
00641 portEXIT_CRITICAL();
00642 }
00643 else
00644 {
00645
00646 xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00647 }
00648 #endif
00649 }
00650
00651
00657 void vMMI_UserMenuDisplay(portCHAR * Message)
00658 {
00659 unsigned short i = 0;
00660
00661
00662 if (eCurrentUserMenu == eUserMenuIdle)
00663 {
00664
00665 do
00666 {
00667 UserMenuScreen[i++] = *Message++;
00668 }while (*Message != '\0' && i < MMI_LINE_LENGTH);
00669
00670 do
00671 {
00672 UserMenuScreen[i++] = MMI_SPACE;
00673 }while (i < MMI_LINE_LENGTH);
00674
00675 UserMenuScreen[MMI_LINE_LENGTH] = '\0';
00676
00677 xQueueSend( xMMIQueue, (void *)&UserMenuScreen, 0 );
00678 }
00679 }
00680
00681
00687 void vMMI_UserMessDisplay(portCHAR * Message)
00688 {
00689 unsigned short i = 0;
00690
00691
00692 do
00693 {
00694 UserMessScreen[i++] = *Message++;
00695 }while (*Message != '\0' && i < MMI_LINE_LENGTH);
00696
00697 do
00698 {
00699 UserMessScreen[i++] = MMI_SPACE;
00700 }while (i < MMI_LINE_LENGTH);
00701
00702 UserMessScreen[MMI_LINE_LENGTH] = '\0';
00703
00704 xQueueSend( xMMIQueue, (void *)&UserMessScreen, 0 );
00705 }
00706
00707
00711 void vMMI_Manage( void )
00712 {
00713 portCHAR * Line;
00714
00715
00716 while ( pdTRUE == xQueueReceive( xMMIQueue, &Line, ( portTickType ) 0 ) )
00717 {
00718
00719 if (Line == ParamScreen)
00720 {
00721 dip204_set_cursor_position(1,PARAM_LINE);
00722 dip204_write_string(ParamScreen);
00723 }
00724
00725 else if (Line == DateScreen)
00726 {
00727 dip204_set_cursor_position(1,DATE_LINE);
00728 dip204_write_string(DateScreen);
00729 }
00730
00731 else if (Line == UserMenuScreen)
00732 {
00733 dip204_set_cursor_position(1,USER_MENU_LINE);
00734 dip204_write_string(UserMenuScreen);
00735 }
00736
00737 else if (Line == UserMessScreen)
00738 {
00739 dip204_set_cursor_position(1,USER_MESS_LINE);
00740 dip204_write_string(UserMessScreen);
00741 }
00742 }
00743 }
00744
00745
00746
00750 static void prvMMI_Init( void )
00751 {
00752 spi_options_t spiOptions =
00753 {
00754 .reg = DIP204_SPI_NPCS,
00755 .baudrate = 1000000,
00756 .bits = 8,
00757 .spck_delay = 0,
00758 .trans_delay = 0,
00759 .stay_act = 1,
00760 .spi_mode = 0,
00761 .modfdis = 1
00762 };
00763
00764 #if BOARD == EVK1100
00765 #warning DIP204 and AT45DBX are sharing the same SPI
00766
00767 gpio_enable_module_pin(DIP204_SPI_NPCS_PIN, DIP204_SPI_NPCS_FUNCTION);
00768
00769 #else
00770 static const gpio_map_t DIP204_SPI_GPIO_MAP =
00771 {
00772 {DIP204_SPI_SCK_PIN, DIP204_SPI_SCK_FUNCTION },
00773 {DIP204_SPI_MISO_PIN, DIP204_SPI_MISO_FUNCTION},
00774 {DIP204_SPI_MOSI_PIN, DIP204_SPI_MOSI_FUNCTION},
00775 {DIP204_SPI_NPCS_PIN, DIP204_SPI_NPCS_FUNCTION}
00776 };
00777
00778
00779 gpio_enable_module(DIP204_SPI_GPIO_MAP,
00780 sizeof(DIP204_SPI_GPIO_MAP) / sizeof(DIP204_SPI_GPIO_MAP[0]));
00781
00782
00783 spi_initMaster(DIP204_SPI, &spiOptions);
00784
00785
00786 spi_selectionMode(DIP204_SPI, 0, 0, 0);
00787
00788
00789 spi_enable(DIP204_SPI);
00790 #endif
00791
00792
00793 spi_setupChipReg(DIP204_SPI, &spiOptions, CP_PBA_SPEED);
00794
00795
00796 dip204_init( backlight_PWM, TRUE );
00797
00798
00799 dip204_hide_cursor();
00800 }
00801
00805 Bool b_MMI_do_nothing( void )
00806 {
00807 NAKED_TRACE_COM2( "Nothing to do for this action" );
00808 return (pdTRUE);
00809 }
00810
00815 static Bool b_mmi_format_a( void )
00816 {
00817 Bool bRet = pdTRUE;
00818
00819
00820
00821 vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00822 vTaskDelay( 3 );
00823
00824
00825 if( FSCMDS_STATUS_OK != e_fscmds_format( sMmiNavId, LUN_ID_AT45DBX_MEM ) )
00826 bRet = pdFALSE;
00827
00828 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00829 return( bRet );
00830 }
00831
00832
00837 static Bool b_mmi_format_b( void )
00838 {
00839 Bool bRet = pdTRUE;
00840
00841
00842
00843 vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00844 vTaskDelay( 3 );
00845
00846
00847 if( FSCMDS_STATUS_OK != e_fscmds_format( sMmiNavId, LUN_ID_SD_MMC_SPI_MEM ) )
00848 bRet = pdFALSE;
00849
00850 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00851 return( bRet );
00852 }
00853
00854
00859 static Bool b_mmi_mkdir_aLOG( void )
00860 {
00861 Bool bRet = pdFALSE;
00862
00863
00864
00865 vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00866 vTaskDelay( 3 );
00867
00868 nav_select( sMmiNavId );
00869
00870 if( !nav_drive_set( LUN_ID_AT45DBX_MEM ))
00871 {
00872
00873 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00874 return( bRet );
00875 }
00876 if( !nav_partition_mount() )
00877 {
00878
00879 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00880 return( bRet );
00881 }
00882
00883 if( SHELL_EXECSTATUS_OK == e_fscmds_shell_mkdir( SYS_MODID_MMI, sMmiNavId, 1,
00884 (signed portCHAR **)&pcStringLogDirName, NULL ) )
00885 bRet = pdTRUE;
00886
00887 v_cptime_GetDateInFatStringFormat( pcTempoDate );
00888
00889 nav_file_dateset( (FS_STRING)pcTempoDate, FS_DATE_LAST_WRITE );
00890
00891 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00892 return( bRet );
00893 }
00894
00895
00900 static Bool b_mmi_mkdir_bLOG( void )
00901 {
00902 Bool bRet = pdFALSE;
00903
00904
00905
00906 vMMI_SetUserMenuMode(eUserMenuIdleActing, pdFALSE);
00907 vTaskDelay( 3 );
00908
00909 nav_select( sMmiNavId );
00910
00911 if( !nav_drive_set( LUN_ID_SD_MMC_SPI_MEM ))
00912 {
00913
00914 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00915 return( bRet );
00916 }
00917 if( !nav_partition_mount() )
00918 {
00919
00920 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00921 return( bRet );
00922 }
00923
00924 if( SHELL_EXECSTATUS_OK == e_fscmds_shell_mkdir( SYS_MODID_MMI, sMmiNavId, 1,
00925 (signed portCHAR **)&pcStringLogDirName, NULL ) )
00926 bRet = pdTRUE;
00927
00928 v_cptime_GetDateInFatStringFormat( pcTempoDate );
00929
00930 nav_file_dateset( (FS_STRING)pcTempoDate, FS_DATE_LAST_WRITE );
00931
00932 vMMI_SetUserMenuMode(eUserMenuIdle, pdFALSE);
00933 return( bRet );
00934 }