]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/GCC/RISC-V/portmacro.h
Replace portasmHAS_CLINT with configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRES...
[freertos] / FreeRTOS / Source / portable / GCC / RISC-V / portmacro.h
index 65aa9cf5f341aff510dff917e220db568f06bcf7..db8bcbf2cb9b27b3813960a7dadf80d0e08b030c 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * FreeRTOS Kernel V10.1.1\r
- * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
  *\r
  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
  * this software and associated documentation files (the "Software"), to deal in\r
@@ -44,14 +44,33 @@ extern "C" {
  */\r
 \r
 /* Type definitions. */\r
-#define portSTACK_TYPE uint32_t\r
-#define portBASE_TYPE  long\r
+#if __riscv_xlen == 64\r
+       #define portSTACK_TYPE                  uint64_t\r
+       #define portBASE_TYPE                   int64_t\r
+       #define portUBASE_TYPE                  uint64_t\r
+       #define portMAX_DELAY                   ( TickType_t ) 0xffffffffffffffffUL\r
+       #define portPOINTER_SIZE_TYPE   uint64_t\r
+#elif __riscv_xlen == 32\r
+       #define portSTACK_TYPE  uint32_t\r
+       #define portBASE_TYPE   int32_t\r
+       #define portUBASE_TYPE  uint32_t\r
+       #define portMAX_DELAY ( TickType_t ) 0xffffffffUL\r
+#else\r
+       #error Assembler did not define __riscv_xlen\r
+#endif\r
+\r
 \r
 typedef portSTACK_TYPE StackType_t;\r
-typedef long BaseType_t;\r
-typedef unsigned long UBaseType_t;\r
-typedef uint32_t TickType_t;\r
-#define portMAX_DELAY ( TickType_t ) 0xffffffffUL\r
+typedef portBASE_TYPE BaseType_t;\r
+typedef portUBASE_TYPE UBaseType_t;\r
+typedef portUBASE_TYPE TickType_t;\r
+\r
+/* Legacy type definitions. */\r
+#define portCHAR               char\r
+#define portFLOAT              float\r
+#define portDOUBLE             double\r
+#define portLONG               long\r
+#define portSHORT              short\r
 \r
 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do\r
 not need to be guarded with a critical section. */\r
@@ -65,7 +84,7 @@ not need to be guarded with a critical section. */
        #error This is the RV32 port that has not yet been adapted for 64.\r
        #define portBYTE_ALIGNMENT                      16\r
 #else\r
-       #define portBYTE_ALIGNMENT 8\r
+       #define portBYTE_ALIGNMENT                      16\r
 #endif\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -133,6 +152,32 @@ not necessary for to use this port.  They are defined so the common demo files
        #define portFORCE_INLINE inline __attribute__(( always_inline))\r
 #endif\r
 \r
+#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/* configCLINT_BASE_ADDRESS is a legacy definition that was replaced by the\r
+configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS definitions.  For\r
+backward compatibility derive the newer definitions from the old if the old\r
+definition is found. */\r
+#if defined( configCLINT_BASE_ADDRESS ) && !defined( configMTIME_BASE_ADDRESS ) && ( configCLINT_BASE_ADDRESS == 0 )\r
+       /* Legacy case where configCLINT_BASE_ADDRESS was defined as 0 to indicate\r
+       there was no CLINT.  Equivalent now is to set the MTIME and MTIMECMP\r
+       addresses to 0. */\r
+       #define configMTIME_BASE_ADDRESS        ( 0 )\r
+       #define configMTIMECMP_BASE_ADDRESS ( 0 )\r
+#elif defined( configCLINT_BASE_ADDRESS ) && !defined( configMTIME_BASE_ADDRESS )\r
+       /* Legacy case where configCLINT_BASE_ADDRESS was set to the base address of\r
+       the CLINT.  Equivalent now is to derive the MTIME and MTIMECMP addresses\r
+       from the CLINT address. */\r
+       #define configMTIME_BASE_ADDRESS        ( ( configCLINT_BASE_ADDRESS ) + 0xBFF8UL )\r
+       #define configMTIMECMP_BASE_ADDRESS ( ( configCLINT_BASE_ADDRESS ) + 0x4000UL )\r
+#elif !defined( configMTIME_BASE_ADDRESS ) || !defined( configMTIMECMP_BASE_ADDRESS )\r
+       #error configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  Set them to zero if there is no MTIME (machine time) clock.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html\r
+#endif\r
+\r
+\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r