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)
 
void updateSdCardLiveFlags (void)
 
bool msd_request_hook_new (USBDriver *usbp)
 
void sdCardRequestMode (SD_MODE mode)
 
SD_MODE sdCardGetCurrentMode (void)
 
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 16 of file mmc_card.h.

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

Function Documentation

◆ initEarlyMmcCard()

void initEarlyMmcCard ( )

Definition at line 1015 of file mmc_card.cpp.

1015 {
1016#if EFI_PROD_CODE
1017 logName[0] = 0;
1018
1019 addConsoleAction("sdinfo", sdStatistics);
1021 addConsoleActionS("sdmode", sdSetMode);
1023 //incLogFileName() use same shared FDLogFile, calling it while FDLogFile is used by log writer will cause damage
1024 //addConsoleAction("incfilename", incLogFileName);
1025#endif // EFI_PROD_CODE
1026}
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:306
void sdCardRemoveReportFiles()
static void sdSetMode(const char *mode)
Definition mmc_card.cpp:323
static char logName[_MAX_FILLER+20]
Definition mmc_card.cpp:296
static void removeFile(const char *pathx)
Definition mmc_card.cpp:413

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

1028 {
1029#if EFI_PROD_CODE
1030 if (!isSdCardEnabled()) {
1031 // do not even bother starting the thread if SD card is not enabled & configured on start-up
1032 return;
1033 }
1034 chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
1035#endif // EFI_PROD_CODE
1036}
static bool isSdCardEnabled()
Definition mmc_card.cpp:434

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 ( void  )

Definition at line 426 of file mmc_card.cpp.

426 {
427 usbConnectedSemaphore.signalI();
428}
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 ( void  )

Definition at line 1049 of file mmc_card.cpp.

1050{
1051 return sdMode;
1052}
static SD_MODE sdMode
Definition mmc_card.cpp:193

Referenced by hellenDisableEn().

Here is the caller graph for this function:

◆ sdCardRemoveReportFiles()

void sdCardRemoveReportFiles ( )

Definition at line 1054 of file mmc_card.cpp.

1054 {
1055 if (sdMode != SD_MODE_ECU) {
1056 efiPrintf("SD card should be mounted to ECU");
1057 return;
1058 }
1059
1060 sdNeedRemoveReports = true;
1061}
static bool sdNeedRemoveReports
Definition mmc_card.cpp:197

Referenced by handleCommandX14(), and initEarlyMmcCard().

Here is the caller graph for this function:

◆ sdCardRequestMode()

void sdCardRequestMode ( SD_MODE  mode)

Definition at line 1040 of file mmc_card.cpp.

1041{
1042 // Check if SD is not in transition state...
1043 if (sdTargetMode == SD_MODE_IDLE) {
1044 efiPrintf("sdCardRequestMode %d", (int)mode);
1045 sdTargetMode = mode;
1046 }
1047}
static SD_MODE sdTargetMode
Definition mmc_card.cpp:195

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

Here is the caller graph for this function:

◆ updateSdCardLiveFlags()

void updateSdCardLiveFlags ( void  )

Definition at line 1001 of file mmc_card.cpp.

1001 {
1002#if EFI_PROD_CODE
1003 if (cardBlockDevice) {
1004 engine->outputChannels.sd_active_wr = (blkGetDriverState(cardBlockDevice) == BLK_WRITING);
1005 engine->outputChannels.sd_active_rd = (blkGetDriverState(cardBlockDevice) == BLK_READING);
1006 } else
1007#endif // EFI_PROD_CODE
1008 {
1011 }
1012}
TunerStudioOutputChannels outputChannels
Definition engine.h:109
static EngineAccessor engine
Definition engine.h:413
static BaseBlockDevice * cardBlockDevice
Definition mmc_card.cpp:539

Referenced by updateFlags().

Here is the caller graph for this function:

Go to the source code of this file.