Selaa lähdekoodia

Drop HSRUN across Ser# read with interrupts off

Results in valid serial # presented to USB host when T_3.6 is in HSRUN mode.
main
Defragster 8 vuotta sitten
vanhempi
commit
fc8222a8c3
1 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. +10
    -1
      teensy3/usb_desc.c

+ 10
- 1
teensy3/usb_desc.c Näytä tiedosto

@@ -1229,12 +1229,21 @@ void usb_init_serialnumber(void)
while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF)) ; // wait
num = *(uint32_t *)&FTFL_FCCOB7;
#elif defined(HAS_KINETIS_FLASH_FTFE)
// TODO: does not work in HSRUN mode
i=0; // Track and disable HSRUN mode across ser# read
if (SMC_PMSTAT == SMC_PMSTAT_HSRUN) {
i=1;
SMC_PMCTRL = SMC_PMCTRL_RUNM(0); // exit HSRUN mode
while (SMC_PMSTAT == SMC_PMSTAT_HSRUN) ; // wait for !HSRUN
}
FTFL_FSTAT = FTFL_FSTAT_RDCOLERR | FTFL_FSTAT_ACCERR | FTFL_FSTAT_FPVIOL;
*(uint32_t *)&FTFL_FCCOB3 = 0x41070000;
FTFL_FSTAT = FTFL_FSTAT_CCIF;
while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF)) ; // wait
num = *(uint32_t *)&FTFL_FCCOBB;
if ( 1 == i) {
SMC_PMCTRL = SMC_PMCTRL_RUNM(3); // enter HSRUN mode
while (SMC_PMSTAT != SMC_PMSTAT_HSRUN) ; // wait for HSRUN
}
#endif
__enable_irq();
// add extra zero to work around OS-X CDC-ACM driver bug

Loading…
Peruuta
Tallenna