mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
Extract usbdev declarations to a separate header.
This is a simple refactor that aims to simplify maintenance and to clarify file dependency inside the project. Currently, most of the declarations reside in programmer.h making it difficult to really understand file dependency. Change-Id: I9d819ea1c5bd51289d02189c1dff367ce6d25617 Signed-off-by: Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/84982 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Miklós Márton <martonmiklosqdev@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
parent
3a1c0d0e85
commit
69a03a3ab1
@ -26,6 +26,7 @@
|
|||||||
#include "chipdrivers.h"
|
#include "chipdrivers.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "usbdev.h"
|
||||||
|
|
||||||
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
/* LIBUSB_CALL ensures the right calling conventions on libusb callbacks.
|
||||||
* However, the macro is not defined everywhere. m(
|
* However, the macro is not defined everywhere. m(
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "usbdev.h"
|
||||||
|
|
||||||
/* Bit positions for each pin. */
|
/* Bit positions for each pin. */
|
||||||
#define DEVELOPERBOX_SPI_SCK 0
|
#define DEVELOPERBOX_SPI_SCK 0
|
||||||
|
@ -526,13 +526,4 @@ static inline bool spi_chip_4ba(const struct flashctx *const flash)
|
|||||||
(flash->chip->feature_bits & (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7));
|
(flash->chip->feature_bits & (FEATURE_4BA_ENTER | FEATURE_4BA_ENTER_WREN | FEATURE_4BA_ENTER_EAR7));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* usbdev.c */
|
|
||||||
struct libusb_device_handle;
|
|
||||||
struct libusb_context;
|
|
||||||
struct libusb_device_handle *usb_dev_get_by_vid_pid_serial(
|
|
||||||
struct libusb_context *usb_ctx, uint16_t vid, uint16_t pid, const char *serialno);
|
|
||||||
struct libusb_device_handle *usb_dev_get_by_vid_pid_number(
|
|
||||||
struct libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__PROGRAMMER_H__ */
|
#endif /* !__PROGRAMMER_H__ */
|
||||||
|
27
include/usbdev.h
Normal file
27
include/usbdev.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the flashrom project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Antonio Vázquez Blanco <antoniovazquezblanco@gmail.com>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __USBDEV_H__
|
||||||
|
#define __USBDEV_H__ 1
|
||||||
|
|
||||||
|
#include <libusb.h>
|
||||||
|
|
||||||
|
struct libusb_device_handle *usb_dev_get_by_vid_pid_serial(
|
||||||
|
struct libusb_context *usb_ctx, uint16_t vid, uint16_t pid, const char *serialno);
|
||||||
|
struct libusb_device_handle *usb_dev_get_by_vid_pid_number(
|
||||||
|
struct libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num);
|
||||||
|
|
||||||
|
#endif /* __USBDEV_H__ */
|
@ -26,6 +26,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "programmer.h"
|
#include "programmer.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "usbdev.h"
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
6
usbdev.c
6
usbdev.c
@ -15,11 +15,13 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "usbdev.h"
|
||||||
|
|
||||||
|
#include "flash.h" // msg_perr, msg_pdbg...
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libusb.h>
|
|
||||||
#include "programmer.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether we should filter the current device.
|
* Check whether we should filter the current device.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user