@@ -207,21 +207,6 @@ static inline int _ScbHiPriVectorPendingGet(void)
207
207
return reg .bit .vectpending ;
208
208
}
209
209
210
- /**
211
- *
212
- * @brief Find out if the currently executing exception is nested
213
- *
214
- * This routine determines if the currently executing exception is nested.
215
- *
216
- * @return 1 if nested, 0 otherwise
217
- */
218
-
219
- static inline int _ScbIsNestedExc (void )
220
- {
221
- /* !bit == preempted exceptions */
222
- return !__scs .scb .icsr .bit .rettobase ;
223
- }
224
-
225
210
/**
226
211
*
227
212
* @brief Find out if running in thread mode
@@ -280,76 +265,6 @@ static inline uint32_t _ScbActiveVectorGet(void)
280
265
return __scs .scb .icsr .bit .vectactive ;
281
266
}
282
267
283
- /**
284
- *
285
- * @brief Find out if vector table is in SRAM or ROM
286
- *
287
- * This routine determines if the currently executing exception is nested.
288
- *
289
- * @return 1 if in SRAM, 0 if in ROM
290
- */
291
-
292
- static inline uint32_t _ScbIsVtableInSram (void )
293
- {
294
- return !!__scs .scb .vtor .bit .tblbase ;
295
- }
296
-
297
- /**
298
- *
299
- * @brief Move vector table from SRAM to ROM and vice-versa
300
- *
301
- * This routine moves the vector table to the given memory region.
302
- *
303
- * @return 1 if in SRAM, 0 if in ROM
304
- */
305
-
306
- static inline void _ScbVtableLocationSet (
307
- int sram /* 1 to move vector to SRAM, 0 to move it to ROM */
308
- )
309
- {
310
- __ASSERT (!(sram & 0xfffffffe ), "" );
311
- __scs .scb .vtor .bit .tblbase = sram ;
312
- }
313
-
314
- /**
315
- *
316
- * @brief Obtain base address of vector table
317
- *
318
- * This routine returns the vector table's base address.
319
- *
320
- * @return the base address of the vector table
321
- */
322
-
323
- static inline uint32_t _ScbVtableAddrGet (void )
324
- {
325
- return __scs .scb .vtor .bit .tbloff ;
326
- }
327
-
328
- /**
329
- *
330
- * @brief Set base address of vector table
331
- *
332
- * @a addr must align to the number of exception entries in vector table:
333
- *
334
- * numException = 16 + num_interrupts where each entry is 4 Bytes
335
- *
336
- * As a minimum, @a addr must be a multiple of 128:
337
- *
338
- * 0 <= num_interrupts < 16: multiple 0x080
339
- * 16 <= num_interrupts < 48: multiple 0x100
340
- * 48 <= num_interrupts < 112: multiple 0x200
341
- * ....
342
- * @param addr base address, aligned on 128 minimum
343
- *
344
- * @return N/A
345
- */
346
-
347
- static inline void _ScbVtableAddrSet (uint32_t addr )
348
- {
349
- __ASSERT (!(addr & 0x7F ), "invalid vtable base Addr" );
350
- __scs .scb .vtor .bit .tbloff = addr ;
351
- }
352
-
353
268
/**
354
269
*
355
270
* @brief Find out if data regions are little endian
@@ -365,22 +280,6 @@ static inline int _ScbIsDataLittleEndian(void)
365
280
return !(__scs .scb .aircr .bit .endianness );
366
281
}
367
282
368
- /**
369
- *
370
- * @brief Get the programmed number of priority groups
371
- *
372
- * Exception priorities can be sub-divided into groups, with sub-priorities.
373
- * Within these groups, exceptions do not preempt each other. The sub-priorities
374
- * are only used to decide which exception will run when several are pending.
375
- *
376
- * @return the number of priority groups
377
- */
378
-
379
- static inline int _ScbNumPriGroupGet (void )
380
- {
381
- return 1 << (7 - __scs .scb .aircr .bit .prigroup );
382
- }
383
-
384
283
/**
385
284
*
386
285
* @brief CPU goes to sleep after exiting an ISR
@@ -478,36 +377,6 @@ static inline void _ScbSleepDeepClear(void)
478
377
__scs .scb .scr .bit .sleepdeep = 0 ;
479
378
}
480
379
481
- /**
482
- *
483
- * @brief Enable faulting on division by zero
484
- *
485
- * This routine enables the divide by zero fault.
486
- * By default, the CPU ignores the error.
487
- *
488
- * @return N/A
489
- */
490
-
491
- static inline void _ScbDivByZeroFaultEnable (void )
492
- {
493
- __scs .scb .ccr .bit .div_0_trp = 1 ;
494
- }
495
-
496
- /**
497
- *
498
- * @brief Ignore division by zero errors
499
- *
500
- * This routine disables the divide by zero fault.
501
- * This is the default behavior.
502
- *
503
- * @return N/A
504
- */
505
-
506
- static inline void _ScbDivByZeroFaultDisable (void )
507
- {
508
- __scs .scb .ccr .bit .div_0_trp = 0 ;
509
- }
510
-
511
380
/**
512
381
*
513
382
* @brief Enable faulting on unaligned access
@@ -614,6 +483,136 @@ static inline void _ScbExcPrioSet(uint8_t exc, uint8_t pri)
614
483
}
615
484
616
485
#if !defined(CONFIG_CPU_CORTEX_M0_M0PLUS )
486
+ /**
487
+ *
488
+ * @brief Find out if the currently executing exception is nested
489
+ *
490
+ * This routine determines if the currently executing exception is nested.
491
+ *
492
+ * @return 1 if nested, 0 otherwise
493
+ */
494
+
495
+ static inline int _ScbIsNestedExc (void )
496
+ {
497
+ /* !bit == preempted exceptions */
498
+ return !__scs .scb .icsr .bit .rettobase ;
499
+ }
500
+
501
+ /**
502
+ *
503
+ * @brief Find out if vector table is in SRAM or ROM
504
+ *
505
+ * This routine determines if the currently executing exception is nested.
506
+ *
507
+ * @return 1 if in SRAM, 0 if in ROM
508
+ */
509
+
510
+ static inline uint32_t _ScbIsVtableInSram (void )
511
+ {
512
+ return !!__scs .scb .vtor .bit .tblbase ;
513
+ }
514
+
515
+ /**
516
+ *
517
+ * @brief Move vector table from SRAM to ROM and vice-versa
518
+ *
519
+ * This routine moves the vector table to the given memory region.
520
+ *
521
+ * @return 1 if in SRAM, 0 if in ROM
522
+ */
523
+
524
+ static inline void _ScbVtableLocationSet (
525
+ int sram /* 1 to move vector to SRAM, 0 to move it to ROM */
526
+ )
527
+ {
528
+ __ASSERT (!(sram & 0xfffffffe ), "" );
529
+ __scs .scb .vtor .bit .tblbase = sram ;
530
+ }
531
+
532
+ /**
533
+ *
534
+ * @brief Obtain base address of vector table
535
+ *
536
+ * This routine returns the vector table's base address.
537
+ *
538
+ * @return the base address of the vector table
539
+ */
540
+
541
+ static inline uint32_t _ScbVtableAddrGet (void )
542
+ {
543
+ return __scs .scb .vtor .bit .tbloff ;
544
+ }
545
+
546
+ /**
547
+ *
548
+ * @brief Set base address of vector table
549
+ *
550
+ * @a addr must align to the number of exception entries in vector table:
551
+ *
552
+ * numException = 16 + num_interrupts where each entry is 4 Bytes
553
+ *
554
+ * As a minimum, @a addr must be a multiple of 128:
555
+ *
556
+ * 0 <= num_interrupts < 16: multiple 0x080
557
+ * 16 <= num_interrupts < 48: multiple 0x100
558
+ * 48 <= num_interrupts < 112: multiple 0x200
559
+ * ....
560
+ * @param addr base address, aligned on 128 minimum
561
+ *
562
+ * @return N/A
563
+ */
564
+
565
+ static inline void _ScbVtableAddrSet (uint32_t addr )
566
+ {
567
+ __ASSERT (!(addr & 0x7F ), "invalid vtable base Addr" );
568
+ __scs .scb .vtor .bit .tbloff = addr ;
569
+ }
570
+
571
+ /**
572
+ *
573
+ * @brief Enable faulting on division by zero
574
+ *
575
+ * This routine enables the divide by zero fault.
576
+ * By default, the CPU ignores the error.
577
+ *
578
+ * @return N/A
579
+ */
580
+
581
+ static inline void _ScbDivByZeroFaultEnable (void )
582
+ {
583
+ __scs .scb .ccr .bit .div_0_trp = 1 ;
584
+ }
585
+
586
+ /**
587
+ *
588
+ * @brief Ignore division by zero errors
589
+ *
590
+ * This routine disables the divide by zero fault.
591
+ * This is the default behavior.
592
+ *
593
+ * @return N/A
594
+ */
595
+
596
+ static inline void _ScbDivByZeroFaultDisable (void )
597
+ {
598
+ __scs .scb .ccr .bit .div_0_trp = 0 ;
599
+ }
600
+
601
+ /**
602
+ *
603
+ * @brief Get the programmed number of priority groups
604
+ *
605
+ * Exception priorities can be sub-divided into groups, with sub-priorities.
606
+ * Within these groups, exceptions do not preempt each other. The sub-priorities
607
+ * are only used to decide which exception will run when several are pending.
608
+ *
609
+ * @return the number of priority groups
610
+ */
611
+
612
+ static inline int _ScbNumPriGroupGet (void )
613
+ {
614
+ return 1 << (7 - __scs .scb .aircr .bit .prigroup );
615
+ }
617
616
618
617
/**
619
618
*
0 commit comments