USBDevice with MAX32620HSP platform support

Fork of USBDevice by mbed official

Committer:
mbed_official
Date:
Thu Aug 13 15:46:06 2015 +0100
Revision:
59:2af474687369
Synchronized with git revision 376d6a73e345b728a788041adb166b08cd8d2b95

Full URL: https://github.com/mbedmicro/mbed/commit/376d6a73e345b728a788041adb166b08cd8d2b95/

Silicon Labs - Add support for USBDevice

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 59:2af474687369 1 /***************************************************************************//**
mbed_official 59:2af474687369 2 * @file em_usbtimer.c
mbed_official 59:2af474687369 3 * @brief USB protocol stack library, timer API.
mbed_official 59:2af474687369 4 * @version 3.20.14
mbed_official 59:2af474687369 5 *******************************************************************************
mbed_official 59:2af474687369 6 * @section License
mbed_official 59:2af474687369 7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
mbed_official 59:2af474687369 8 *******************************************************************************
mbed_official 59:2af474687369 9 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 59:2af474687369 10 * you may not use this file except in compliance with the License.
mbed_official 59:2af474687369 11 * You may obtain a copy of the License at
mbed_official 59:2af474687369 12 *
mbed_official 59:2af474687369 13 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 59:2af474687369 14 *
mbed_official 59:2af474687369 15 * Unless required by applicable law or agreed to in writing, software
mbed_official 59:2af474687369 16 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 59:2af474687369 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 59:2af474687369 18 * See the License for the specific language governing permissions and
mbed_official 59:2af474687369 19 * limitations under the License.
mbed_official 59:2af474687369 20 *
mbed_official 59:2af474687369 21 ******************************************************************************/
mbed_official 59:2af474687369 22
mbed_official 59:2af474687369 23 #include "em_device.h"
mbed_official 59:2af474687369 24 #if defined( USB_PRESENT ) && ( USB_COUNT == 1 )
mbed_official 59:2af474687369 25 #include "em_usb.h"
mbed_official 59:2af474687369 26 #if defined( USB_DEVICE ) || defined( USB_HOST )
mbed_official 59:2af474687369 27 #include "em_cmu.h"
mbed_official 59:2af474687369 28 #include "em_timer.h"
mbed_official 59:2af474687369 29 #include "em_usbtypes.h"
mbed_official 59:2af474687369 30 #include "em_usbhal.h"
mbed_official 59:2af474687369 31
mbed_official 59:2af474687369 32 #include "device_peripherals.h"
mbed_official 59:2af474687369 33
mbed_official 59:2af474687369 34 /*
mbed_official 59:2af474687369 35 * Use one HW timer to serve n software milisecond timers.
mbed_official 59:2af474687369 36 * A timer is, when running, in a linked list of timers.
mbed_official 59:2af474687369 37 * A given timers timeout period is the acculmulated timeout
mbed_official 59:2af474687369 38 * of all timers preceeding it in the queue.
mbed_official 59:2af474687369 39 * This makes timer start (linked list insertion) computing intensive,
mbed_official 59:2af474687369 40 * but the checking of the queue at each tick very effective.
mbed_official 59:2af474687369 41 * ______ ______ ______
mbed_official 59:2af474687369 42 * | | --->| | --->| |
mbed_official 59:2af474687369 43 * head --> | | | | | | | |
mbed_official 59:2af474687369 44 * |______|--- |______|--- |______|---/ NULL
mbed_official 59:2af474687369 45 */
mbed_official 59:2af474687369 46
mbed_official 59:2af474687369 47 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
mbed_official 59:2af474687369 48
mbed_official 59:2af474687369 49 #ifndef USB_TIMER
mbed_official 59:2af474687369 50 #error HW platform must define the timer to use for USB
mbed_official 59:2af474687369 51 #endif
mbed_official 59:2af474687369 52
mbed_official 59:2af474687369 53 #if ( USB_TIMER == USB_TIMER0 ) && ( TIMER_COUNT >= 1 )
mbed_official 59:2af474687369 54 #define TIMER TIMER0
mbed_official 59:2af474687369 55 #define TIMER_CLK cmuClock_TIMER0
mbed_official 59:2af474687369 56 #define TIMER_IRQ TIMER0_IRQn
mbed_official 59:2af474687369 57 #define TIMER_IRQHandler TIMER0_IRQHandler
mbed_official 59:2af474687369 58
mbed_official 59:2af474687369 59 #elif ( USB_TIMER == USB_TIMER1 ) && ( TIMER_COUNT >= 2 )
mbed_official 59:2af474687369 60 #define TIMER TIMER1
mbed_official 59:2af474687369 61 #define TIMER_CLK cmuClock_TIMER1
mbed_official 59:2af474687369 62 #define TIMER_IRQ TIMER1_IRQn
mbed_official 59:2af474687369 63 #define TIMER_IRQHandler TIMER1_IRQHandler
mbed_official 59:2af474687369 64
mbed_official 59:2af474687369 65 #elif ( USB_TIMER == USB_TIMER2 ) && ( TIMER_COUNT >= 3 )
mbed_official 59:2af474687369 66 #define TIMER TIMER2
mbed_official 59:2af474687369 67 #define TIMER_CLK cmuClock_TIMER2
mbed_official 59:2af474687369 68 #define TIMER_IRQ TIMER2_IRQn
mbed_official 59:2af474687369 69 #define TIMER_IRQHandler TIMER2_IRQHandler
mbed_official 59:2af474687369 70
mbed_official 59:2af474687369 71 #elif ( USB_TIMER == USB_TIMER3 ) && ( TIMER_COUNT == 4 )
mbed_official 59:2af474687369 72 #define TIMER TIMER3
mbed_official 59:2af474687369 73 #define TIMER_CLK cmuClock_TIMER3
mbed_official 59:2af474687369 74 #define TIMER_IRQ TIMER3_IRQn
mbed_official 59:2af474687369 75 #define TIMER_IRQHandler TIMER3_IRQHandler
mbed_official 59:2af474687369 76
mbed_official 59:2af474687369 77 #else
mbed_official 59:2af474687369 78 #error "Illegal USB TIMER definition"
mbed_official 59:2af474687369 79 #endif
mbed_official 59:2af474687369 80
mbed_official 59:2af474687369 81 typedef struct _timer
mbed_official 59:2af474687369 82 {
mbed_official 59:2af474687369 83 uint32_t timeout; /* Delta value relative to prev. timer */
mbed_official 59:2af474687369 84 struct _timer *next;
mbed_official 59:2af474687369 85 USBTIMER_Callback_TypeDef callback;
mbed_official 59:2af474687369 86 bool running;
mbed_official 59:2af474687369 87 } USBTIMER_Timer_TypeDef;
mbed_official 59:2af474687369 88
mbed_official 59:2af474687369 89 #if ( NUM_QTIMERS > 0 )
mbed_official 59:2af474687369 90 static USBTIMER_Timer_TypeDef timers[ NUM_QTIMERS ];
mbed_official 59:2af474687369 91 static USBTIMER_Timer_TypeDef *head = NULL;
mbed_official 59:2af474687369 92 #endif
mbed_official 59:2af474687369 93
mbed_official 59:2af474687369 94 static uint32_t ticksPrMs, ticksPr1us, ticksPr10us, ticksPr100us;
mbed_official 59:2af474687369 95
mbed_official 59:2af474687369 96 #if ( NUM_QTIMERS > 0 )
mbed_official 59:2af474687369 97
mbed_official 59:2af474687369 98 static void TimerTick( void );
mbed_official 59:2af474687369 99
mbed_official 59:2af474687369 100 void TIMER_IRQHandler( void )
mbed_official 59:2af474687369 101 {
mbed_official 59:2af474687369 102 uint32_t flags;
mbed_official 59:2af474687369 103
mbed_official 59:2af474687369 104 flags = TIMER_IntGet( TIMER );
mbed_official 59:2af474687369 105
mbed_official 59:2af474687369 106 if ( flags & TIMER_IF_CC0 )
mbed_official 59:2af474687369 107 {
mbed_official 59:2af474687369 108 TIMER_IntClear( TIMER, TIMER_IFC_CC0 );
mbed_official 59:2af474687369 109 TIMER_CompareSet( TIMER, 0, TIMER_CaptureGet( TIMER, 0 ) + ticksPrMs );
mbed_official 59:2af474687369 110 TimerTick();
mbed_official 59:2af474687369 111 }
mbed_official 59:2af474687369 112 }
mbed_official 59:2af474687369 113 #endif /* ( NUM_QTIMERS > 0 ) */
mbed_official 59:2af474687369 114
mbed_official 59:2af474687369 115 static void DelayTicks( uint16_t ticks )
mbed_official 59:2af474687369 116 {
mbed_official 59:2af474687369 117 uint16_t startTime;
mbed_official 59:2af474687369 118 volatile uint16_t now;
mbed_official 59:2af474687369 119
mbed_official 59:2af474687369 120 if ( ticks )
mbed_official 59:2af474687369 121 {
mbed_official 59:2af474687369 122 startTime = TIMER_CounterGet( TIMER );
mbed_official 59:2af474687369 123 do
mbed_official 59:2af474687369 124 {
mbed_official 59:2af474687369 125 now = TIMER_CounterGet(TIMER);
mbed_official 59:2af474687369 126 } while ( (uint16_t)( now - startTime ) < ticks );
mbed_official 59:2af474687369 127 }
mbed_official 59:2af474687369 128 }
mbed_official 59:2af474687369 129
mbed_official 59:2af474687369 130 /** @endcond */
mbed_official 59:2af474687369 131
mbed_official 59:2af474687369 132 /** @addtogroup USB_COMMON
mbed_official 59:2af474687369 133 * @{*/
mbed_official 59:2af474687369 134
mbed_official 59:2af474687369 135 /***************************************************************************//**
mbed_official 59:2af474687369 136 * @brief
mbed_official 59:2af474687369 137 * Active wait millisecond delay function. Can also be used inside
mbed_official 59:2af474687369 138 * interrupt handlers.
mbed_official 59:2af474687369 139 *
mbed_official 59:2af474687369 140 * @param[in] msec
mbed_official 59:2af474687369 141 * Number of milliseconds to wait.
mbed_official 59:2af474687369 142 ******************************************************************************/
mbed_official 59:2af474687369 143 void USBTIMER_DelayMs( uint32_t msec )
mbed_official 59:2af474687369 144 {
mbed_official 59:2af474687369 145 uint64_t totalTicks;
mbed_official 59:2af474687369 146
mbed_official 59:2af474687369 147 totalTicks = (uint64_t)ticksPrMs * msec;
mbed_official 59:2af474687369 148 while ( totalTicks > 20000 )
mbed_official 59:2af474687369 149 {
mbed_official 59:2af474687369 150 DelayTicks( 20000 );
mbed_official 59:2af474687369 151 totalTicks -= 20000;
mbed_official 59:2af474687369 152 }
mbed_official 59:2af474687369 153 DelayTicks( (uint16_t)totalTicks );
mbed_official 59:2af474687369 154 }
mbed_official 59:2af474687369 155
mbed_official 59:2af474687369 156 /***************************************************************************//**
mbed_official 59:2af474687369 157 * @brief
mbed_official 59:2af474687369 158 * Active wait microsecond delay function. Can also be used inside
mbed_official 59:2af474687369 159 * interrupt handlers.
mbed_official 59:2af474687369 160 *
mbed_official 59:2af474687369 161 * @param[in] usec
mbed_official 59:2af474687369 162 * Number of microseconds to wait.
mbed_official 59:2af474687369 163 ******************************************************************************/
mbed_official 59:2af474687369 164 void USBTIMER_DelayUs( uint32_t usec )
mbed_official 59:2af474687369 165 {
mbed_official 59:2af474687369 166 uint64_t totalTicks;
mbed_official 59:2af474687369 167
mbed_official 59:2af474687369 168 totalTicks = (uint64_t)ticksPr1us * usec;
mbed_official 59:2af474687369 169 if ( totalTicks == 0 )
mbed_official 59:2af474687369 170 {
mbed_official 59:2af474687369 171 usec /= 10;
mbed_official 59:2af474687369 172 totalTicks = (uint64_t)ticksPr10us * usec;
mbed_official 59:2af474687369 173
mbed_official 59:2af474687369 174 if ( totalTicks == 0 )
mbed_official 59:2af474687369 175 {
mbed_official 59:2af474687369 176 usec /= 10;
mbed_official 59:2af474687369 177 totalTicks = (uint64_t)ticksPr100us * usec;
mbed_official 59:2af474687369 178 }
mbed_official 59:2af474687369 179 }
mbed_official 59:2af474687369 180
mbed_official 59:2af474687369 181 while ( totalTicks > 60000 )
mbed_official 59:2af474687369 182 {
mbed_official 59:2af474687369 183 DelayTicks( 60000 );
mbed_official 59:2af474687369 184 totalTicks -= 60000;
mbed_official 59:2af474687369 185 }
mbed_official 59:2af474687369 186 DelayTicks( (uint16_t)totalTicks );
mbed_official 59:2af474687369 187 }
mbed_official 59:2af474687369 188
mbed_official 59:2af474687369 189 /***************************************************************************//**
mbed_official 59:2af474687369 190 * @brief
mbed_official 59:2af474687369 191 * Activate the hardware timer used to pace the 1 millisecond timer system.
mbed_official 59:2af474687369 192 *
mbed_official 59:2af474687369 193 * @details
mbed_official 59:2af474687369 194 * Call this function whenever the HFPERCLK frequency is changed.
mbed_official 59:2af474687369 195 * This function is initially called by HOST and DEVICE stack xxxx_Init()
mbed_official 59:2af474687369 196 * functions.
mbed_official 59:2af474687369 197 ******************************************************************************/
mbed_official 59:2af474687369 198 void USBTIMER_Init( void )
mbed_official 59:2af474687369 199 {
mbed_official 59:2af474687369 200 uint32_t freq;
mbed_official 59:2af474687369 201 TIMER_Init_TypeDef timerInit = TIMER_INIT_DEFAULT;
mbed_official 59:2af474687369 202 TIMER_InitCC_TypeDef timerCCInit = TIMER_INITCC_DEFAULT;
mbed_official 59:2af474687369 203
mbed_official 59:2af474687369 204 freq = CMU_ClockFreqGet( cmuClock_HFPER );
mbed_official 59:2af474687369 205 ticksPrMs = ( freq + 500 ) / 1000;
mbed_official 59:2af474687369 206 ticksPr1us = ( freq + 500000 ) / 1000000;
mbed_official 59:2af474687369 207 ticksPr10us = ( freq + 50000 ) / 100000;
mbed_official 59:2af474687369 208 ticksPr100us = ( freq + 5000 ) / 10000;
mbed_official 59:2af474687369 209
mbed_official 59:2af474687369 210 timerCCInit.mode = timerCCModeCompare;
mbed_official 59:2af474687369 211 CMU_ClockEnable( TIMER_CLK, true );
mbed_official 59:2af474687369 212 TIMER_TopSet( TIMER, 0xFFFF );
mbed_official 59:2af474687369 213 TIMER_InitCC( TIMER, 0, &timerCCInit );
mbed_official 59:2af474687369 214 TIMER_Init( TIMER, &timerInit );
mbed_official 59:2af474687369 215
mbed_official 59:2af474687369 216 #if ( NUM_QTIMERS > 0 )
mbed_official 59:2af474687369 217 TIMER_IntClear( TIMER, 0xFFFFFFFF );
mbed_official 59:2af474687369 218 TIMER_IntEnable( TIMER, TIMER_IEN_CC0 );
mbed_official 59:2af474687369 219 TIMER_CompareSet( TIMER, 0, TIMER_CounterGet( TIMER ) + ticksPrMs );
mbed_official 59:2af474687369 220 NVIC_ClearPendingIRQ( TIMER_IRQ );
mbed_official 59:2af474687369 221 NVIC_EnableIRQ( TIMER_IRQ );
mbed_official 59:2af474687369 222 #endif /* ( NUM_QTIMERS > 0 ) */
mbed_official 59:2af474687369 223 }
mbed_official 59:2af474687369 224
mbed_official 59:2af474687369 225 #if ( NUM_QTIMERS > 0 ) || defined( DOXY_DOC_ONLY )
mbed_official 59:2af474687369 226 /***************************************************************************//**
mbed_official 59:2af474687369 227 * @brief
mbed_official 59:2af474687369 228 * Start a timer.
mbed_official 59:2af474687369 229 *
mbed_official 59:2af474687369 230 * @details
mbed_official 59:2af474687369 231 * If the timer is already running, it will be restarted with new timeout.
mbed_official 59:2af474687369 232 *
mbed_official 59:2af474687369 233 * @param[in] id
mbed_official 59:2af474687369 234 * Timer id (0..).
mbed_official 59:2af474687369 235 *
mbed_official 59:2af474687369 236 * @param[in] timeout
mbed_official 59:2af474687369 237 * Number of milliseconds before timer will elapse.
mbed_official 59:2af474687369 238 *
mbed_official 59:2af474687369 239 * @param[in] callback
mbed_official 59:2af474687369 240 * Function to be called on timer elapse, ref. @ref USBTIMER_Callback_TypeDef.
mbed_official 59:2af474687369 241 ******************************************************************************/
mbed_official 59:2af474687369 242 void USBTIMER_Start( uint32_t id, uint32_t timeout,
mbed_official 59:2af474687369 243 USBTIMER_Callback_TypeDef callback )
mbed_official 59:2af474687369 244 {
mbed_official 59:2af474687369 245 uint32_t accumulated;
mbed_official 59:2af474687369 246 USBTIMER_Timer_TypeDef *this, **last;
mbed_official 59:2af474687369 247
mbed_official 59:2af474687369 248 INT_Disable();
mbed_official 59:2af474687369 249
mbed_official 59:2af474687369 250 if ( timers[ id ].running )
mbed_official 59:2af474687369 251 {
mbed_official 59:2af474687369 252 USBTIMER_Stop( id );
mbed_official 59:2af474687369 253 }
mbed_official 59:2af474687369 254
mbed_official 59:2af474687369 255 if ( timeout == 0 )
mbed_official 59:2af474687369 256 {
mbed_official 59:2af474687369 257 callback();
mbed_official 59:2af474687369 258 INT_Enable();
mbed_official 59:2af474687369 259 return;
mbed_official 59:2af474687369 260 }
mbed_official 59:2af474687369 261
mbed_official 59:2af474687369 262 timers[ id ].running = true;
mbed_official 59:2af474687369 263 timers[ id ].callback = callback;
mbed_official 59:2af474687369 264 timers[ id ].next = NULL;
mbed_official 59:2af474687369 265
mbed_official 59:2af474687369 266 if ( !head ) /* Queue empty ? */
mbed_official 59:2af474687369 267 {
mbed_official 59:2af474687369 268 timers[ id ].timeout = timeout;
mbed_official 59:2af474687369 269 head = &timers[ id ];
mbed_official 59:2af474687369 270 }
mbed_official 59:2af474687369 271 else
mbed_official 59:2af474687369 272 {
mbed_official 59:2af474687369 273 this = head;
mbed_official 59:2af474687369 274 last = &head;
mbed_official 59:2af474687369 275 accumulated = 0;
mbed_official 59:2af474687369 276
mbed_official 59:2af474687369 277 /* Do a sorted insert */
mbed_official 59:2af474687369 278 while ( this )
mbed_official 59:2af474687369 279 {
mbed_official 59:2af474687369 280 if ( timeout < accumulated + this->timeout ) /* Insert before "this" ? */
mbed_official 59:2af474687369 281 {
mbed_official 59:2af474687369 282 timers[ id ].timeout = timeout - accumulated;
mbed_official 59:2af474687369 283 timers[ id ].next = this;
mbed_official 59:2af474687369 284 *last = &timers[ id ];
mbed_official 59:2af474687369 285 this->timeout -= timers[ id ].timeout; /* Adjust timeout */
mbed_official 59:2af474687369 286 break;
mbed_official 59:2af474687369 287 }
mbed_official 59:2af474687369 288 else if ( this->next == NULL ) /* At end of queue ? */
mbed_official 59:2af474687369 289 {
mbed_official 59:2af474687369 290 timers[ id ].timeout = timeout - accumulated - this->timeout;
mbed_official 59:2af474687369 291 this->next = &timers[ id ];
mbed_official 59:2af474687369 292 break;
mbed_official 59:2af474687369 293 }
mbed_official 59:2af474687369 294 accumulated += this->timeout;
mbed_official 59:2af474687369 295 last = &this->next;
mbed_official 59:2af474687369 296 this = this->next;
mbed_official 59:2af474687369 297 }
mbed_official 59:2af474687369 298 }
mbed_official 59:2af474687369 299
mbed_official 59:2af474687369 300 INT_Enable();
mbed_official 59:2af474687369 301 }
mbed_official 59:2af474687369 302
mbed_official 59:2af474687369 303 /***************************************************************************//**
mbed_official 59:2af474687369 304 * @brief
mbed_official 59:2af474687369 305 * Stop a timer.
mbed_official 59:2af474687369 306 *
mbed_official 59:2af474687369 307 * @param[in] id
mbed_official 59:2af474687369 308 * Timer id (0..).
mbed_official 59:2af474687369 309 ******************************************************************************/
mbed_official 59:2af474687369 310 void USBTIMER_Stop( uint32_t id )
mbed_official 59:2af474687369 311 {
mbed_official 59:2af474687369 312 USBTIMER_Timer_TypeDef *this, **last;
mbed_official 59:2af474687369 313
mbed_official 59:2af474687369 314 INT_Disable();
mbed_official 59:2af474687369 315
mbed_official 59:2af474687369 316 if ( head ) /* Queue empty ? */
mbed_official 59:2af474687369 317 {
mbed_official 59:2af474687369 318 this = head;
mbed_official 59:2af474687369 319 last = &head;
mbed_official 59:2af474687369 320 timers[ id ].running = false;
mbed_official 59:2af474687369 321
mbed_official 59:2af474687369 322 while ( this )
mbed_official 59:2af474687369 323 {
mbed_official 59:2af474687369 324 if ( this == &timers[ id ] ) /* Correct timer ? */
mbed_official 59:2af474687369 325 {
mbed_official 59:2af474687369 326 if ( this->next )
mbed_official 59:2af474687369 327 {
mbed_official 59:2af474687369 328 this->next->timeout += timers[ id ].timeout; /* Adjust timeout */
mbed_official 59:2af474687369 329 }
mbed_official 59:2af474687369 330 *last = this->next;
mbed_official 59:2af474687369 331 break;
mbed_official 59:2af474687369 332 }
mbed_official 59:2af474687369 333 last = &this->next;
mbed_official 59:2af474687369 334 this = this->next;
mbed_official 59:2af474687369 335 }
mbed_official 59:2af474687369 336 }
mbed_official 59:2af474687369 337
mbed_official 59:2af474687369 338 INT_Enable();
mbed_official 59:2af474687369 339 }
mbed_official 59:2af474687369 340 #endif /* ( NUM_QTIMERS > 0 ) */
mbed_official 59:2af474687369 341
mbed_official 59:2af474687369 342 /** @} (end addtogroup USB_COMMON) */
mbed_official 59:2af474687369 343
mbed_official 59:2af474687369 344 #if ( NUM_QTIMERS > 0 )
mbed_official 59:2af474687369 345 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
mbed_official 59:2af474687369 346
mbed_official 59:2af474687369 347 static void TimerTick( void )
mbed_official 59:2af474687369 348 {
mbed_official 59:2af474687369 349 USBTIMER_Callback_TypeDef cb;
mbed_official 59:2af474687369 350
mbed_official 59:2af474687369 351 INT_Disable();
mbed_official 59:2af474687369 352
mbed_official 59:2af474687369 353 if ( head )
mbed_official 59:2af474687369 354 {
mbed_official 59:2af474687369 355 head->timeout--;
mbed_official 59:2af474687369 356
mbed_official 59:2af474687369 357 while ( head )
mbed_official 59:2af474687369 358 {
mbed_official 59:2af474687369 359 if ( head->timeout == 0 )
mbed_official 59:2af474687369 360 {
mbed_official 59:2af474687369 361 cb = head->callback;
mbed_official 59:2af474687369 362 head->running = false;
mbed_official 59:2af474687369 363 head = head->next;
mbed_official 59:2af474687369 364 /* The callback may place new items in the queue !!! */
mbed_official 59:2af474687369 365 if ( cb )
mbed_official 59:2af474687369 366 {
mbed_official 59:2af474687369 367 (cb)();
mbed_official 59:2af474687369 368 }
mbed_official 59:2af474687369 369 continue; /* There might be more than one timeout pr. tick */
mbed_official 59:2af474687369 370 }
mbed_official 59:2af474687369 371 break;
mbed_official 59:2af474687369 372 }
mbed_official 59:2af474687369 373 }
mbed_official 59:2af474687369 374
mbed_official 59:2af474687369 375 INT_Enable();
mbed_official 59:2af474687369 376 }
mbed_official 59:2af474687369 377 /** @endcond */
mbed_official 59:2af474687369 378 #endif /* ( NUM_QTIMERS > 0 ) */
mbed_official 59:2af474687369 379
mbed_official 59:2af474687369 380 #endif /* defined( USB_DEVICE ) || defined( USB_HOST ) */
mbed_official 59:2af474687369 381 #endif /* defined( USB_PRESENT ) && ( USB_COUNT == 1 ) */