lconf.h 3.81 KB
/* -----------------------------------------------------------------------------
 *  Copyright (C) 2020 daiteq s.r.o.                     http://www.daiteq.com
 *
 *  This program is distributed WITHOUT ANY WARRANTY; without even
 *  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE.
 *
 * -----------------------------------------------------------------------------
 *  Filename    : lconf.h
 *  Authors     : Martin Danek
 *  Description : system register definitions
 *  Release     :
 *  Version     : 1.0
 *  Date        : 18.6.2020
 * -----------------------------------------------------------------------------
 */


#ifndef LCONF_H

#define LCONF_H

// LEON2FT configuration register definitions

#define LCONF_BASE      0x80000024
#define LCONF_FPU_BASE  LCONF_BASE+4
#define LCONF_SWAR_BASE LCONF_BASE+8

// LCONF CONFIGURATION BITS

#define LCONF_WPROTEN_MSK 0x00000003
#define LCONF_WPROTEN     0x00000001
//
#define LCONF_PCI_MSK     0x0000000C
#define LCONF_PCI_INSILICON 0x00000004
#define LCONF_PCI_ESA     0x00000008
#define LCONF_PCI_OTHER   0x0000000C
//
#define LCONF_FPU_MSK     0x00000030
#define LCONF_FPU_MEIKO   0x00000010
#define LCONF_FPU_GRFPU   0x00000020
#define LCONF_FPU_DAIFPU  0x00000030
//
#define LCONF_AHBSTATEN   0x00000040
#define LCONF_WDOGEN      0x00000080
#define LCONF_MULTIPLIER  0x00000100
#define LCONF_DIVIDER     0x00000200
//
#define LCONF_DLINE_BITS  0x00000C00
#define LCONF_DSIZE       0x00007000
#define LCONF_ILINE_BITS  0x00018000
#define LCONF_ISIZE       0x000E0000
//
#define LCONF_NWINDOWS    0x01F00000
#define LCONF_MACEN       0x02000000
#define LCONF_WATCHPOINTS 0x1C000000
#define LCONF_SDRAMEN     0x20000000
#define LCONF_DSU         0x40000000
#define LCONF_MEN         0x80000000

// LCONF_FPU CONFIGURATION BITS

#define LCONF_FPU_DIV         0x000001
#define LCONF_FPU_SQRT        0x000002
//
#define LCONF_FPU_PACKED      0x000004
#define LCONF_FPU_DUAL        0x000008
//
#define LCONF_FPU_EXPH_BITS   0x0000F0
#define LCONF_FPU_TRSIGH_BITS 0x003F00
#define LCONF_FPU_EXPL_BITS   0x03C000
#define LCONF_FPU_TRSIGL_BITS 0xFC0000

// LCONF_SWAR CONFIGURATION BITS

#define LCONF_SWAR_CORREL     0x00000001
#define LCONF_SWAR_DEMOD      0x00000002
#define LCONF_SWAR_SINCOS     0x00000004
//
#define LCONF_SWAR_AUDIO      0x00000008
#define LCONF_SWAR_VIDEO      0x00000010
#define LCONF_SWAR_ALU        0x00000020
//
#define LCONF_SWAR_ACC        0x00000040
//
#define LCONF_SWAR_LANES      0x001F0000
#define LCONF_SWAR_SWIDTH     0x03E00000
#define LCONF_SWAR_AWIDTH     0xFC000000

// FPU TYPES
#define FPU_NONE    0
#define FPU_MEIKO   1
#define FPU_GRFPU   2
#define FPU_DAIFPU  3

// PCI TYPES
#define PCI_NONE      0
#define PCI_INSILICON 1
#define PCI_ESA       2
#define PCI_OTHER     3

typedef struct lconf_type {
  unsigned ahbstaten;
  unsigned wdogen;
  unsigned multiplier;
  unsigned divider;
  unsigned macen;
  unsigned sdramen;
  unsigned dsu;
  unsigned men;
  unsigned dline_bits;
  unsigned dset_bits;
  unsigned iline_bits;
  unsigned iset_bits;
  unsigned nwindows;
  unsigned watchpoints;
  unsigned fpu;
  unsigned pci;
  unsigned wproten;
} lconf_type;

typedef struct lconf_fpu_type {
  unsigned fdiv;
  unsigned fsqrt;
  unsigned packed;
  unsigned dual;
  unsigned exp_hi;
  unsigned trsig_hi;
  unsigned exp_lo;
  unsigned trsig_lo;
} lconf_fpu_type;

typedef struct lconf_swar_type {
  unsigned correl;
  unsigned demod;
  unsigned sincos;
  unsigned audio;
  unsigned video;
  unsigned alu;
  unsigned acc;
  unsigned lanes;
  unsigned swidth;
  unsigned awidth;
} lconf_swar_type;


void get_lconf(lconf_type *lconf);
void get_lconf_fpu(lconf_fpu_type *lconf_fpu);
void get_lconf_swar(lconf_swar_type *lconf_swar);

void report_lconf(lconf_type *lconf);
void report_lconf_fpu(lconf_fpu_type *lconf_fpu);
void report_lconf_swar(lconf_swar_type *lconf_swar);


#endif