Explorar el Código

Merge pull request #1 from Defragster/Defragster-patch-1

Drop HSRUN across Ser# read with interrupts off
main
Defragster hace 8 años
padre
commit
459ac4cfc7
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. +8
    -1
      teensy3/usb_desc.c

+ 8
- 1
teensy3/usb_desc.c Ver fichero

@@ -1229,12 +1229,19 @@ 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
#if F_CPU > 120000000 // Disable HSRUN mode across ser# read
SMC_PMCTRL = SMC_PMCTRL_RUNM(0); // exit HSRUN mode
while (SMC_PMSTAT == SMC_PMSTAT_HSRUN) ; // wait for !(HSRUN)
#endif
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 F_CPU > 120000000
SMC_PMCTRL = SMC_PMCTRL_RUNM(3); // enter HSRUN mode
while (SMC_PMSTAT != SMC_PMSTAT_HSRUN) ; // wait for HSRUN
#endif
#endif
__enable_irq();
// add extra zero to work around OS-X CDC-ACM driver bug

Cargando…
Cancelar
Guardar