Browse Source

#ifdef version - same code - no runtime check - T_3.6 >120000000 specific code that works

https://forum.pjrc.com/threads/34808-K66-Beta-Test?p=116690&viewfull=1#post116690
main
Defragster 8 years ago
parent
commit
2facd223a1
1 changed files with 8 additions and 10 deletions
  1. +8
    -10
      teensy3/usb_desc.c

+ 8
- 10
teensy3/usb_desc.c View File

@@ -1229,21 +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)
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
}
#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 ( 1 == i) {
SMC_PMCTRL = SMC_PMCTRL_RUNM(3); // enter HSRUN mode
while (SMC_PMSTAT != SMC_PMSTAT_HSRUN) ; // wait for HSRUN
}
#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

Loading…
Cancel
Save