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 1028 of file mmc_card.cpp.

1028 {
1029#if EFI_PROD_CODE
1030 logName[0] = 0;
1031
1032 addConsoleAction("sdinfo", sdStatistics);
1034 // sdmode pc
1035 // sdmode ecu
1036 addConsoleActionS("sdmode", sdSetMode);
1038 //incLogFileName() use same shared FDLogFile, calling it while FDLogFile is used by log writer will cause damage
1039 //addConsoleAction("incfilename", incLogFileName);
1040#endif // EFI_PROD_CODE
1041}
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
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 1043 of file mmc_card.cpp.

1043 {
1044#if EFI_PROD_CODE
1045 if (!isSdCardEnabled()) {
1046 // do not even bother starting the thread if SD card is not enabled & configured on start-up
1047 return;
1048 }
1049 chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
1050#endif // EFI_PROD_CODE
1051}
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 1064 of file mmc_card.cpp.

1065{
1066 return sdMode;
1067}
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 1069 of file mmc_card.cpp.

1069 {
1070 if (sdMode != SD_MODE_ECU) {
1071 efiPrintf("SD card should be mounted to ECU");
1072 return;
1073 }
1074
1075 sdNeedRemoveReports = true;
1076}
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 1055 of file mmc_card.cpp.

1056{
1057 // Check if SD is not in transition state...
1058 if (sdTargetMode == SD_MODE_IDLE) {
1059 efiPrintf("sdCardRequestMode %d", (int)mode);
1060 sdTargetMode = mode;
1061 }
1062}
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 1014 of file mmc_card.cpp.

1014 {
1015#if EFI_PROD_CODE
1016 if (cardBlockDevice) {
1017 engine->outputChannels.sd_active_wr = (blkGetDriverState(cardBlockDevice) == BLK_WRITING);
1018 engine->outputChannels.sd_active_rd = (blkGetDriverState(cardBlockDevice) == BLK_READING);
1019 } else
1020#endif // EFI_PROD_CODE
1021 {
1024 }
1025}
TunerStudioOutputChannels outputChannels
Definition engine.h:109
static EngineAccessor engine
Definition engine.h:413
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.