-
Notifications
You must be signed in to change notification settings - Fork 13
/
altera.h
86 lines (75 loc) · 2.51 KB
/
altera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* altera.h
*
* altera FPGA driver
*
* Copyright (C) Altera Corporation 1998-2001
* Copyright (C) 2010 NetUP Inc.
* Copyright (C) 2010 Igor M. Liplianin <[email protected]>
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _ALTERA_H_
#define _ALTERA_H_
#include <stdint.h>
#include <stdbool.h>
struct altera_config {
void *dev;
uint8_t *action;
int (*jtag_io) (void *dev, int tms, int tdi, int tdo);
};
struct altera_procinfo {
char *name;
uint8_t attrs;
struct altera_procinfo *next;
};
struct altera_varinit {
char *name;
uint32_t value;
struct altera_varinit *next;
};
enum {
ALTERA_SUCCESS = 0,
ALTERA_STACK_OVERFLOW,
ALTERA_OUT_OF_MEMORY,
ALTERA_BOUNDS_ERROR,
ALTERA_IO_ERROR,
ALTERA_CRC_ERROR,
ALTERA_ACTION_NOT_FOUND,
ALTERA_ILLEGAL_OPCODE,
ALTERA_UNEXPECTED_END,
ALTERA_INTERNAL_ERROR,
ALTERA_MAX_ERROR
};
extern bool trace;
int altera_check_crc(uint8_t *p, int32_t program_size);
int altera_get_file_info(uint8_t *p, int32_t program_size,
int *format_version, int *action_count, int *procedure_count);
int altera_get_note(uint8_t *p, int32_t program_size, int32_t *offset,
char *key, char *value, int length);
int altera_get_act_info(uint8_t *p, int32_t program_size, int index,
char **name, char **description,
struct altera_procinfo **proc_list);
int altera_execute(uint8_t *p, int32_t program_size, char *action,
struct altera_varinit *init_list, int32_t *error_address,
int *exit_code, int *format_version);
void altera_message(char *message_text);
void altera_export_int(char *key, int32_t value);
void altera_export_bool_array(char *key, uint8_t *data, int32_t count);
int altera_jtag_io(int tms, int tdi, int read_tdo);
uint32_t altera_shrink(uint8_t *in, uint32_t in_length, uint8_t *out, uint32_t out_length, int32_t version);
//extern int altera_init(struct altera_config *config, const struct firmware *fw);
#endif /* _ALTERA_H_ */