22
22
* limitations under the License.
23
23
*/
24
24
25
- #if defined ( __ICCARM__ )
26
- #pragma system_include /* treat file as system include file for MISRA check */
25
+ #if defined ( __ICCARM__ )
26
+ #pragma system_include /* treat file as system include file for MISRA check */
27
+ #elif defined (__clang__ )
28
+ #pragma clang system_header /* treat file as system include file */
27
29
#endif
28
30
29
31
#ifdef __cplusplus
@@ -1354,8 +1356,8 @@ __STATIC_INLINE uint32_t GIC_GetGroup(IRQn_Type IRQn)
1354
1356
*/
1355
1357
__STATIC_INLINE void GIC_DistInit (void )
1356
1358
{
1357
- IRQn_Type i ;
1358
- uint32_t num_irq = 0 ;
1359
+ uint32_t i ;
1360
+ uint32_t num_irq = 0U ;
1359
1361
uint32_t priority_field ;
1360
1362
1361
1363
//A reset sets all bits in the IGROUPRs corresponding to the SPIs to 0,
@@ -1364,26 +1366,24 @@ __STATIC_INLINE void GIC_DistInit(void)
1364
1366
//Disable interrupt forwarding
1365
1367
GIC_DisableDistributor ();
1366
1368
//Get the maximum number of interrupts that the GIC supports
1367
- num_irq = 32 * ((GIC_DistributorInfo () & 0x1f ) + 1 );
1369
+ num_irq = 32U * ((GIC_DistributorInfo () & 0x1FU ) + 1U );
1368
1370
1369
1371
/* Priority level is implementation defined.
1370
1372
To determine the number of priority bits implemented write 0xFF to an IPRIORITYR
1371
1373
priority field and read back the value stored.*/
1372
- GIC_SetPriority ((IRQn_Type )0 , 0xff );
1373
- priority_field = GIC_GetPriority ((IRQn_Type )0 );
1374
+ GIC_SetPriority ((IRQn_Type )0U , 0xFFU );
1375
+ priority_field = GIC_GetPriority ((IRQn_Type )0U );
1374
1376
1375
- for (i = ( IRQn_Type ) 32 ; i < num_irq ; i ++ )
1377
+ for (i = 32U ; i < num_irq ; i ++ )
1376
1378
{
1377
1379
//Disable the SPI interrupt
1378
- GIC_DisableIRQ (i );
1379
- if (i > 15 ) {
1380
- //Set level-sensitive (and N-N model)
1381
- GIC_SetConfiguration (i , 0 );
1382
- }
1380
+ GIC_DisableIRQ ((IRQn_Type )i );
1381
+ //Set level-sensitive (and N-N model)
1382
+ GIC_SetConfiguration ((IRQn_Type )i , 0U );
1383
1383
//Set priority
1384
- GIC_SetPriority (i , priority_field /2 );
1384
+ GIC_SetPriority (( IRQn_Type ) i , priority_field /2U );
1385
1385
//Set target list to CPU0
1386
- GIC_SetTarget (i , 1 );
1386
+ GIC_SetTarget (( IRQn_Type ) i , 1U );
1387
1387
}
1388
1388
//Enable distributor
1389
1389
GIC_EnableDistributor ();
@@ -1393,7 +1393,7 @@ __STATIC_INLINE void GIC_DistInit(void)
1393
1393
*/
1394
1394
__STATIC_INLINE void GIC_CPUInterfaceInit (void )
1395
1395
{
1396
- IRQn_Type i ;
1396
+ uint32_t i ;
1397
1397
uint32_t priority_field ;
1398
1398
1399
1399
//A reset sets all bits in the IGROUPRs corresponding to the SPIs to 0,
@@ -1405,27 +1405,27 @@ __STATIC_INLINE void GIC_CPUInterfaceInit(void)
1405
1405
/* Priority level is implementation defined.
1406
1406
To determine the number of priority bits implemented write 0xFF to an IPRIORITYR
1407
1407
priority field and read back the value stored.*/
1408
- GIC_SetPriority ((IRQn_Type )0 , 0xff );
1409
- priority_field = GIC_GetPriority ((IRQn_Type )0 );
1408
+ GIC_SetPriority ((IRQn_Type )0U , 0xFFU );
1409
+ priority_field = GIC_GetPriority ((IRQn_Type )0U );
1410
1410
1411
1411
//SGI and PPI
1412
- for (i = ( IRQn_Type ) 0 ; i < 32 ; i ++ )
1412
+ for (i = 0U ; i < 32U ; i ++ )
1413
1413
{
1414
- if (i > 15 ) {
1414
+ if (i > 15U ) {
1415
1415
//Set level-sensitive (and N-N model) for PPI
1416
- GIC_SetConfiguration (i , 0U );
1416
+ GIC_SetConfiguration (( IRQn_Type ) i , 0U );
1417
1417
}
1418
1418
//Disable SGI and PPI interrupts
1419
- GIC_DisableIRQ (i );
1419
+ GIC_DisableIRQ (( IRQn_Type ) i );
1420
1420
//Set priority
1421
- GIC_SetPriority (i , priority_field /2 );
1421
+ GIC_SetPriority (( IRQn_Type ) i , priority_field /2U );
1422
1422
}
1423
1423
//Enable interface
1424
1424
GIC_EnableInterface ();
1425
1425
//Set binary point to 0
1426
- GIC_SetBinaryPoint (0 );
1426
+ GIC_SetBinaryPoint (0U );
1427
1427
//Set priority mask
1428
- GIC_SetInterfacePriorityMask (0xff );
1428
+ GIC_SetInterfacePriorityMask (0xFFU );
1429
1429
}
1430
1430
1431
1431
/** \brief Initialize and enable the GIC
@@ -1477,11 +1477,36 @@ __STATIC_INLINE void PL1_SetLoadValue(uint32_t value)
1477
1477
/** \brief Get the current counter value.
1478
1478
* \return Current counter value.
1479
1479
*/
1480
- __STATIC_INLINE uint32_t PL1_GetCurrentValue ()
1480
+ __STATIC_INLINE uint32_t PL1_GetCurrentValue (void )
1481
1481
{
1482
1482
return (__get_CNTP_TVAL ());
1483
1483
}
1484
1484
1485
+ /** \brief Get the current physical counter value.
1486
+ * \return Current physical counter value.
1487
+ */
1488
+ __STATIC_INLINE uint64_t PL1_GetCurrentPhysicalValue (void )
1489
+ {
1490
+ return (__get_CNTPCT ());
1491
+ }
1492
+
1493
+ /** \brief Set the physical compare value.
1494
+ * \param [in] value New physical timer compare value.
1495
+ */
1496
+ __STATIC_INLINE void PL1_SetPhysicalCompareValue (uint64_t value )
1497
+ {
1498
+ __set_CNTP_CVAL (value );
1499
+ __ISB ();
1500
+ }
1501
+
1502
+ /** \brief Get the physical compare value.
1503
+ * \return Physical compare value.
1504
+ */
1505
+ __STATIC_INLINE uint64_t PL1_GetPhysicalCompareValue (void )
1506
+ {
1507
+ return (__get_CNTP_CVAL ());
1508
+ }
1509
+
1485
1510
/** \brief Configure the timer by setting the control value.
1486
1511
* \param [in] value New timer control value.
1487
1512
*/
@@ -1494,7 +1519,7 @@ __STATIC_INLINE void PL1_SetControl(uint32_t value)
1494
1519
/** \brief Get the control value.
1495
1520
* \return Control value.
1496
1521
*/
1497
- __STATIC_INLINE uint32_t PL1_GetControl ()
1522
+ __STATIC_INLINE uint32_t PL1_GetControl (void )
1498
1523
{
1499
1524
return (__get_CNTP_CTL ());
1500
1525
}
0 commit comments