Move libbase/id.c to bios/cmd/cmd_bios.c

This commit is contained in:
Michal Sieron 2021-08-11 11:12:12 +02:00
parent 6bff5f1734
commit 26c5a8a926
5 changed files with 9 additions and 37 deletions

View File

@ -2,7 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <base/id.h>
#include <base/crc.h>
#include <system.h>
#include <base/sim_debug.h>
@ -48,9 +47,17 @@ define_command(help, help_handler, "Print this help", SYSTEM_CMDS);
*/
static void ident_handler(int nb_params, char **params)
{
const int IDENT_SIZE = 256;
char buffer[IDENT_SIZE];
get_ident(buffer);
#ifdef CSR_IDENTIFIER_MEM_BASE
int i;
for(i=0;i<IDENT_SIZE;i++)
buffer[i] = MMPTR(CSR_IDENTIFIER_MEM_BASE + CONFIG_CSR_ALIGNMENT/8*i);
#else
buffer[0] = 0;
#endif
printf("Ident: %s", *buffer ? buffer : "-");
}

View File

@ -21,7 +21,6 @@
#include <string.h>
#include <base/uart.h>
#include <system.h>
#include <base/id.h>
#include <irq.h>
#include <base/crc.h>

View File

@ -1,15 +0,0 @@
#ifndef __ID_H
#define __ID_H
#ifdef __cplusplus
extern "C" {
#endif
#define IDENT_SIZE 256
void get_ident(char *ident);
#ifdef __cplusplus
}
#endif
#endif /* __ID_H */

View File

@ -5,7 +5,6 @@ OBJECTS = exception.o \
crc16.o \
crc32.o \
system.o \
id.o \
uart.o \
spiflash.o \
i2c.o \

View File

@ -1,18 +0,0 @@
#include <generated/csr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <base/id.h>
#define DFII_ADDR_SHIFT CONFIG_CSR_ALIGNMENT/8
void get_ident(char *ident)
{
#ifdef CSR_IDENTIFIER_MEM_BASE
int i;
for(i=0;i<256;i++)
ident[i] = MMPTR(CSR_IDENTIFIER_MEM_BASE + DFII_ADDR_SHIFT*i);
#else
ident[0] = 0;
#endif
}