forked from flashrom/flashrom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogrammer.c
More file actions
39 lines (32 loc) · 957 Bytes
/
programmer.c
File metadata and controls
39 lines (32 loc) · 957 Bytes
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
/*
* This file is part of the flashrom project.
*
* SPDX-License-Identifier: GPL-2.0-or-later
* SPDX-FileCopyrightText: 2009,2010,2011 Carl-Daniel Hailfinger
*/
#include "flash.h"
#include "programmer.h"
/* The limit of 4 is totally arbitrary. */
#define MASTERS_MAX 4
struct registered_master registered_masters[MASTERS_MAX];
int registered_master_count = 0;
/* This function copies the struct registered_master parameter. */
int register_master(const struct registered_master *mst)
{
if (registered_master_count >= MASTERS_MAX) {
msg_perr("Tried to register more than %i master "
"interfaces.\n", MASTERS_MAX);
return ERROR_FLASHROM_LIMIT;
}
registered_masters[registered_master_count] = *mst;
registered_master_count++;
return 0;
}
enum chipbustype get_buses_supported(void)
{
int i;
enum chipbustype ret = BUS_NONE;
for (i = 0; i < registered_master_count; i++)
ret |= registered_masters[i].buses_supported;
return ret;
}