aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32L4xx/ADC
ModeNameSize
-rw-r--r--.cproject4363logstatsplain
-rw-r--r--.project2649logstatsplain
-rw-r--r--Makefile6148logstatsplain
-rw-r--r--chconf.h16842logstatsplain
d---------debug73logstatsplain
-rw-r--r--halconf.h12120logstatsplain
-rw-r--r--main.c4454logstatsplain
-rw-r--r--mcuconf.h14401logstatsplain
-rw-r--r--readme.txt1027logstatsplain
/a> 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
/* GHDL Wavefile reader library.
  Copyright (C) 2005-2017 Tristan Gingold

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <gnu.org/licenses>.
*/

#ifndef _LIBGHW_H_
#define _LIBGHW_H_

#include <stdio.h>
#include <stdlib.h>

/* To be libraries friendly.  */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* The libghw uses the standard c99 int32_t and int64_t.  They are declared
   in stdint.h.  Header inttypes.h includes stdint.h and provides macro for
   printf and co specifiers.  Use it if known to be available.  */

#if defined(__cplusplus) ||                                                   \
    defined(__linux__) ||                                                     \
    (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) ||           \
    defined(HAVE_INTTYPES_H)
/* Use C99 standard header.  */
#include <inttypes.h>
#define GHWPRI64 "%" PRId64
#define GHWPRI32 "%" PRId32
#else
#include <stdint.h>
#define GHWPRI64 "%lld"
#define GHWPRI32 "%d"
#endif

enum ghdl_rtik
{
  ghdl_rtik_top,		/* 0  */
  ghdl_rtik_library,
  ghdl_rtik_package,
  ghdl_rtik_package_body,
  ghdl_rtik_entity,
  ghdl_rtik_architecture,	/* 5 */
  ghdl_rtik_process,
  ghdl_rtik_block,
  ghdl_rtik_if_generate,
  ghdl_rtik_for_generate,
  ghdl_rtik_instance,
  ghdl_rtik_constant,
  ghdl_rtik_iterator,
  ghdl_rtik_variable,
  ghdl_rtik_signal,
  ghdl_rtik_file,
  ghdl_rtik_port,
  ghdl_rtik_generic,
  ghdl_rtik_alias,
  ghdl_rtik_guard,
  ghdl_rtik_component,
  ghdl_rtik_attribute,
  ghdl_rtik_type_b2,		/* 22 */
  ghdl_rtik_type_e8,
  ghdl_rtik_type_e32,
  ghdl_rtik_type_i32,		/* 25 */
  ghdl_rtik_type_i64,
  ghdl_rtik_type_f64,
  ghdl_rtik_type_p32,
  ghdl_rtik_type_p64,
  ghdl_rtik_type_access,	/* 30 */
  ghdl_rtik_type_array,
  ghdl_rtik_type_record,
  ghdl_rtik_type_file,
  ghdl_rtik_subtype_scalar,
  ghdl_rtik_subtype_array,	/* 35 */
  ghdl_rtik_subtype_array_ptr,	/* Obsolete.  */
  ghdl_rtik_subtype_unbounded_array,
  ghdl_rtik_subtype_record,
  ghdl_rtik_subtype_unbounded_record,
#if 0
  ghdl_rtik_subtype_access,	/* 40 */
  ghdl_rtik_type_protected,
  ghdl_rtik_element,
  ghdl_rtik_unit,
  ghdl_rtik_attribute_transaction,
  ghdl_rtik_attribute_quiet,
  ghdl_rtik_attribute_stable,
#endif
  ghdl_rtik_error
};

/* Well-known types.  */
enum ghw_wkt_type
{
  ghw_wkt_unknown,
  ghw_wkt_boolean,
  ghw_wkt_bit,
  ghw_wkt_std_ulogic
};

struct ghw_range_b2
{
  enum ghdl_rtik kind:8;
  int dir:8;			/* 0: to, !0: downto.  */
  unsigned char left;
  unsigned char right;
};

struct ghw_range_e8
{
  enum ghdl_rtik kind:8;
  int dir:8;			/* 0: to, !0: downto.  */
  unsigned char left;
  unsigned char right;
};

struct ghw_range_i32
{
  enum ghdl_rtik kind:8;
  int dir:8;			/* 0: to, !0: downto.  */
  int32_t left;
  int32_t right;
};

struct ghw_range_i64
{
  enum ghdl_rtik kind:8;
  int dir:8;
  int64_t left;
  int64_t right;
};

struct ghw_range_f64
{
  enum ghdl_rtik kind:8;
  int dir:8;
  double left;
  double right;
};

union ghw_range
{
  enum ghdl_rtik kind:8;
  struct ghw_range_b2 b2;
  struct ghw_range_e8 e8;
  struct ghw_range_i32 i32;
  struct ghw_range_i64 i64;
  struct ghw_range_f64 f64;
};

/* Note: the first two fields must be kind and name.  */
union ghw_type;

struct ghw_type_common
{
  enum ghdl_rtik kind;
  const char *name;
};

struct ghw_type_enum
{
  enum ghdl_rtik kind;
  const char *name;

  enum ghw_wkt_type wkt;
  unsigned int nbr;
  const char **lits;
};

struct ghw_type_scalar
{
  enum ghdl_rtik kind;
  const char *name;
};

struct ghw_unit
{
  const char *name;
  int64_t val;
};

struct ghw_type_physical
{
  enum ghdl_rtik kind;
  const char *name;
  uint32_t nbr_units;
  struct ghw_unit *units;
};

struct ghw_type_array
{
  enum ghdl_rtik kind;
  const char *name;

  unsigned int nbr_dim;
  union ghw_type *el;
  union ghw_type **dims;
};

struct ghw_subtype_unbounded_array
{
  enum ghdl_rtik kind;
  const char *name;

  union ghw_type *base;
};

struct ghw_subtype_array
{
  enum ghdl_rtik kind;
  const char *name;

  union ghw_type *base;
  int nbr_scalars;
  union ghw_range **rngs;
  union ghw_type *el;
};

struct ghw_subtype_scalar
{
  enum ghdl_rtik kind;
  const char *name;

  union ghw_type *base;
  union ghw_range *rng;
};

struct ghw_record_element
{
  const char *name;
  union ghw_type *type;
};

struct ghw_type_record
{
  enum ghdl_rtik kind;
  const char *name;

  unsigned int nbr_fields;
  int nbr_scalars;		/* Number of scalar elements (ie nbr of signals).  */
  struct ghw_record_element *els;
};

struct ghw_subtype_record
{
  enum ghdl_rtik kind;
  const char *name;

  struct ghw_type_record *base;
  int nbr_scalars;		/* Number of scalar elements (ie nbr of signals).  */
  struct ghw_record_element *els;
};

struct ghw_subtype_unbounded_record
{
  enum ghdl_rtik kind;
  const char *name;

  struct ghw_type_record *base;
};

union ghw_type
{
  enum ghdl_rtik kind;
  struct ghw_type_common common;
  struct ghw_type_enum en;
  struct ghw_type_scalar sc;
  struct ghw_type_physical ph;
  struct ghw_subtype_scalar ss;
  struct ghw_type_array ar;
  struct ghw_type_record rec;
  struct ghw_subtype_array sa;
  struct ghw_subtype_unbounded_array sua;
  struct ghw_subtype_record sr;
  struct ghw_subtype_unbounded_record sur;
};

union ghw_val
{
  unsigned char b2;
  unsigned char e8;
  int32_t i32;
  int64_t i64;
  double f64;
};

/* A non-composite signal.  */
struct ghw_sig
{
  union ghw_type *type;
  union ghw_val *val;
};

enum ghw_hie_kind
{
  ghw_hie_eoh = 0,
  ghw_hie_design = 1,
  ghw_hie_block = 3,
  ghw_hie_generate_if = 4,
  ghw_hie_generate_for = 5,
  ghw_hie_instance = 6,
  ghw_hie_package = 7,
  ghw_hie_process = 13,
  ghw_hie_generic = 14,
  ghw_hie_eos = 15,
  ghw_hie_signal = 16,
  ghw_hie_port_in = 17,
  ghw_hie_port_out = 18,
  ghw_hie_port_inout = 19,
  ghw_hie_port_buffer = 20,
  ghw_hie_port_linkage = 21
};

#define GHW_NO_SIG 0

struct ghw_hie
{
  enum ghw_hie_kind kind;
  struct ghw_hie *parent;
  const char *name;
  struct ghw_hie *brother;
  union
  {
    struct
    {
      struct ghw_hie *child;
      union ghw_type *iter_type;
      union ghw_val *iter_value;
    } blk;
    struct
    {
      union ghw_type *type;
      /* Array of signal elements.
         Last element is GHW_NO_SIG (0).  */
      unsigned int *sigs;
    } sig;
  } u;
};

struct ghw_handler
{
  FILE *stream;
  /* True if STREAM was popen, else was fopen.  */
  unsigned char stream_ispipe;
  /* True if words are big-endian.  */
  unsigned char word_be;
  unsigned char word_len;
  unsigned char off_len;
  /* Minor version.  */
  int version;

  /* Set by user.  */
  int flag_verbose;

  /* String table.  */
  /* Number of strings.  */
  unsigned nbr_str;
  /* Size of the strings (without nul).  */
  unsigned str_size;
  /* String table.  */
  char **str_table;
  /* Array containing strings.  */
  char *str_content;

  /* Type table.  */
  unsigned nbr_types;
  union ghw_type **types;