add device type into manifest
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
#ifndef __MEM_SEG_H__
|
#ifndef __MEM_SEG_H__
|
||||||
#define __MEM_SEG_H__
|
#define __MEM_SEG_H__
|
||||||
|
|
||||||
|
#ifndef DEVICE_TYPE
|
||||||
|
#define DEVICE_TYPE EXTENDED_DEVICE_TYPE_DUMMY
|
||||||
|
#endif
|
||||||
|
|
||||||
// #define MEMSEG_PC_SEG_NUM 0
|
// #define MEMSEG_PC_SEG_NUM 0
|
||||||
// #define MEMSEG_PC_ADDR 0
|
// #define MEMSEG_PC_ADDR 0
|
||||||
|
|||||||
@@ -8,9 +8,14 @@ def main():
|
|||||||
return
|
return
|
||||||
manifest_dir = sys.argv[1]
|
manifest_dir = sys.argv[1]
|
||||||
|
|
||||||
|
with open(manifest_dir + '/dev_type', 'r') as f:
|
||||||
|
dev_type = f.read()
|
||||||
|
|
||||||
|
|
||||||
mem_segments = []
|
mem_segments = []
|
||||||
out_manifest = {
|
out_manifest = {
|
||||||
'mem_segments': mem_segments
|
'mem_segments': mem_segments,
|
||||||
|
'dev_type': dev_type
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(manifest_dir + '/seg_data.csv', 'r', newline='') as csvfile:
|
with open(manifest_dir + '/seg_data.csv', 'r', newline='') as csvfile:
|
||||||
|
|||||||
65
manifest_src/generate_dev_type.c
Normal file
65
manifest_src/generate_dev_type.c
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#include "mem.h"
|
||||||
|
#include "mem_seg.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
if(argc != 2)
|
||||||
|
{
|
||||||
|
printf("provide target directory\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *dirpath = argv[1];
|
||||||
|
const char *filename = "dev_type";
|
||||||
|
|
||||||
|
char *tgtpath = (char*)calloc(strlen(dirpath) + strlen(filename) + 1, sizeof(char));
|
||||||
|
if(tgtpath == NULL)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(tgtpath, "%s/%s", dirpath, filename);
|
||||||
|
|
||||||
|
FILE *fptr;
|
||||||
|
|
||||||
|
fptr = fopen(tgtpath, "w");
|
||||||
|
|
||||||
|
if(fptr == NULL)
|
||||||
|
{
|
||||||
|
printf("errof opening file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dev_type = DEVICE_TYPE;
|
||||||
|
int exitcode = 0;
|
||||||
|
|
||||||
|
switch (dev_type)
|
||||||
|
{
|
||||||
|
case EXTENDED_DEVICE_TYPE_DUMMY:
|
||||||
|
{
|
||||||
|
fprintf(fptr, "dummy");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EXTENDED_DEVICE_TYPE_INSTR_SIMUL:
|
||||||
|
{
|
||||||
|
fprintf(fptr, "instr_simul");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
printf("invalid device type: %d\n", dev_type);
|
||||||
|
exitcode = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fclose(fptr);
|
||||||
|
free(tgtpath);
|
||||||
|
return exitcode;
|
||||||
|
}
|
||||||
@@ -646,6 +646,6 @@ device_public_context_t* init(device_specs_t* specs, char* errbuf)
|
|||||||
|
|
||||||
uint8_t pubDeviceType()
|
uint8_t pubDeviceType()
|
||||||
{
|
{
|
||||||
return EXTENDED_DEVICE_TYPE_DUMMY;
|
return DEVICE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user