Automatically build CSR access functions
[litex.git] / software / libbase / board.c
index 97b18a3bc940de215d0a2b47db5f2d16f10fbab3..c0d9e24d1a06fd8d9786dc3b19c0bc83240f45b3 100644 (file)
@@ -1,5 +1,4 @@
-#include <hw/identifier.h>
-#include <hw/gpio.h>
+#include <hw/csr.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -27,7 +26,7 @@ static const struct board_desc *get_board_desc_id(unsigned short int id)
 
 static const struct board_desc *get_board_desc(void)
 {
-       return get_board_desc_id((CSR_IDENTIFIER_SYSTEMH << 8) | CSR_IDENTIFIER_SYSTEML);
+       return get_board_desc_id(identifier_sysid_read());
 }
 
 int get_pcb_revision(void)
@@ -54,12 +53,11 @@ void get_soc_version(unsigned int *major, unsigned int *minor, unsigned int *sub
 {
        unsigned int id;
 
-       id = CSR_IDENTIFIER_VERSIONH;
-       *major = (id & 0xf0) >> 4;
-       *minor = id & 0x0f;
-       id = CSR_IDENTIFIER_VERSIONL;
-       *subminor = (id & 0xf0) >> 4;
-       *rc = id & 0x0f;
+       id = identifier_version_read();
+       *major = (id & 0xf000) >> 12;
+       *minor = (id & 0x0f00) >> 8;
+       *subminor = (id & 0x00f0) >> 4;
+       *rc = id & 0x000f;
 }
 
 void get_soc_version_formatted(char *version)