rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Enumerations | Functions
mmc_card.h File Reference

Enumerations

enum  SD_MODE {
  SD_MODE_IDLE = 0 , SD_MODE_ECU , SD_MODE_PC , SD_MODE_UNMOUNT ,
  SD_MODE_FORMAT
}
 

Functions

void initEarlyMmcCard ()
 
void initMmcCard ()
 
void onUsbConnectedNotifyMmcI ()
 
void updateSdCardLiveFlags ()
 
bool msd_request_hook_new (USBDriver *usbp)
 
void sdCardRequestMode (SD_MODE mode)
 
SD_MODE sdCardGetCurrentMode ()
 
void sdCardRemoveReportFiles ()
 

Enumeration Type Documentation

◆ SD_MODE

enum SD_MODE
Enumerator
SD_MODE_IDLE 
SD_MODE_ECU 
SD_MODE_PC 
SD_MODE_UNMOUNT 
SD_MODE_FORMAT 

Definition at line 17 of file mmc_card.h.

17 {
18 SD_MODE_IDLE = 0,
23} SD_MODE;
SD_MODE
Definition mmc_card.h:17
@ SD_MODE_UNMOUNT
Definition mmc_card.h:21
@ SD_MODE_PC
Definition mmc_card.h:20
@ SD_MODE_ECU
Definition mmc_card.h:19
@ SD_MODE_IDLE
Definition mmc_card.h:18
@ SD_MODE_FORMAT
Definition mmc_card.h:22

Function Documentation

◆ initEarlyMmcCard()

void initEarlyMmcCard ( )

Definition at line 1033 of file mmc_card.cpp.

1033 {
1034#if EFI_PROD_CODE
1035 logName[0] = 0;
1036
1037 addConsoleAction("sdinfo", sdStatistics);
1038 addConsoleAction("sdsuppresslogging", [](){
1039 sdLoggedSuppressed = true;
1040 efiPrintf("Suppressed!");
1041 });
1043 // sdmode pc
1044 // sdmode ecu
1045 addConsoleActionS("sdmode", sdSetMode);
1047 //incLogFileName() use same shared FDLogFile, calling it while FDLogFile is used by log writer will cause damage
1048 //addConsoleAction("incfilename", incLogFileName);
1049#endif // EFI_PROD_CODE
1050}
void addConsoleActionS(const char *token, VoidCharPtr callback)
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
static void sdStatistics()
Definition mmc_card.cpp:311
static bool sdLoggedSuppressed
Definition mmc_card.cpp:665
void sdCardRemoveReportFiles()
static void sdSetMode(const char *mode)
Definition mmc_card.cpp:334
static char logName[_MAX_FILLER+20]
Definition mmc_card.cpp:297
static void removeFile(const char *pathx)
Definition mmc_card.cpp:424

Referenced by initHardwareNoConfig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initMmcCard()

void initMmcCard ( )

Definition at line 1052 of file mmc_card.cpp.

1052 {
1053#if EFI_PROD_CODE
1054 if (!isSdCardEnabled()) {
1055 // do not even bother starting the thread if SD card is not enabled & configured on start-up
1056 return;
1057 }
1058 chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
1059#endif // EFI_PROD_CODE
1060}
static bool isSdCardEnabled()
Definition mmc_card.cpp:445

Referenced by commonEarlyInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ msd_request_hook_new()

bool msd_request_hook_new ( USBDriver *  usbp)

Definition at line 211 of file mass_storage_device.cpp.

211 {
212 /* check that the request is for interface 0.*/
213 if (MSD_SETUP_INDEX(usbp->setup) != 0) {
214 return false;
215 }
216
217 if (usbp->setup[0] == (USB_RTYPE_TYPE_CLASS | USB_RTYPE_RECIPIENT_INTERFACE | USB_RTYPE_DIR_HOST2DEV)
218 && usbp->setup[1] == MSD_REQ_RESET) {
219 /* Bulk-Only Mass Storage Reset (class-specific request)
220 This request is used to reset the mass storage device and its associated interface.
221 This class-specific request shall ready the device for the next CBW from the host. */
222 /* Do any special reset code here. */
223 /* The device shall NAK the status stage of the device request until
224 * the Bulk-Only Mass Storage Reset is complete.
225 * NAK EP1 in and out */
226 // usbp->otg->ie[1].DIEPCTL = DIEPCTL_SNAK;
227 // usbp->otg->oe[1].DOEPCTL = DOEPCTL_SNAK;
228 /* response to this request using EP0 */
229 usbSetupTransfer(usbp, 0, 0, NULL);
230 return true;
231 } else if (usbp->setup[0] == (USB_RTYPE_TYPE_CLASS | USB_RTYPE_RECIPIENT_INTERFACE | USB_RTYPE_DIR_DEV2HOST)
232 && usbp->setup[1] == MSD_REQ_GET_MAX_LUN) {
233 /* Return the maximum supported LUN. */
234 static uint8_t zero = USB_MSD_LUN_COUNT - 1;
235 usbSetupTransfer(usbp, &zero, 1, NULL);
236 return true;
237 }
238
239 return false;
240}

Referenced by hybridRequestHook().

Here is the caller graph for this function:

◆ onUsbConnectedNotifyMmcI()

void onUsbConnectedNotifyMmcI ( )

Definition at line 437 of file mmc_card.cpp.

437 {
438 usbConnectedSemaphore.signalI();
439}
static chibios_rt::BinarySemaphore usbConnectedSemaphore(true)

Referenced by usb_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sdCardGetCurrentMode()

SD_MODE sdCardGetCurrentMode ( )

Definition at line 1073 of file mmc_card.cpp.

1074{
1075 return sdMode;
1076}
static SD_MODE sdMode
Definition mmc_card.cpp:194

Referenced by hellenDisableEn().

Here is the caller graph for this function:

◆ sdCardRemoveReportFiles()

void sdCardRemoveReportFiles ( )

Definition at line 1078 of file mmc_card.cpp.

1078 {
1079 if (sdMode != SD_MODE_ECU) {
1080 efiPrintf("SD card should be mounted to ECU");
1081 return;
1082 }
1083
1084 sdNeedRemoveReports = true;
1085}
static bool sdNeedRemoveReports
Definition mmc_card.cpp:198

Referenced by handleCommandX14(), and initEarlyMmcCard().

Here is the caller graph for this function:

◆ sdCardRequestMode()

void sdCardRequestMode ( SD_MODE  mode)

Definition at line 1064 of file mmc_card.cpp.

1065{
1066 // Check if SD is not in transition state...
1067 if (sdTargetMode == SD_MODE_IDLE) {
1068 efiPrintf("sdCardRequestMode %d", (int)mode);
1069 sdTargetMode = mode;
1070 }
1071}
static SD_MODE sdTargetMode
Definition mmc_card.cpp:196

Referenced by handleCommandX14(), hellenDisableEn(), and sdSetMode().

Here is the caller graph for this function:

◆ updateSdCardLiveFlags()

void updateSdCardLiveFlags ( )

Definition at line 1019 of file mmc_card.cpp.

1019 {
1020#if EFI_PROD_CODE
1021 if (cardBlockDevice) {
1022 engine->outputChannels.sd_active_wr = (blkGetDriverState(cardBlockDevice) == BLK_WRITING);
1023 engine->outputChannels.sd_active_rd = (blkGetDriverState(cardBlockDevice) == BLK_READING);
1024 } else
1025#endif // EFI_PROD_CODE
1026 {
1029 }
1030}
TunerStudioOutputChannels outputChannels
Definition engine.h:113
static EngineAccessor engine
Definition engine.h:421
static BaseBlockDevice * cardBlockDevice
Definition mmc_card.cpp:550

Referenced by updateFlags().

Here is the caller graph for this function:

Go to the source code of this file.