2021-07-20 09:38:27 +00:00
|
|
|
/*
|
|
|
|
* \brief C interface to Genode's base types
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2021-07-06
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__GENODE_C_API__BASE_H_
|
|
|
|
#define _INCLUDE__GENODE_C_API__BASE_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************
|
|
|
|
** Forward-declared types used in the C API **
|
|
|
|
**********************************************/
|
|
|
|
|
|
|
|
struct genode_env;
|
|
|
|
struct genode_allocator;
|
|
|
|
struct genode_signal_handler;
|
2022-03-03 15:11:32 +00:00
|
|
|
struct genode_shared_dataspace;
|
2021-07-20 09:38:27 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
** Mapping between C types and their corresponding Genode C++ types **
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <base/env.h>
|
|
|
|
#include <base/allocator.h>
|
|
|
|
#include <base/attached_dataspace.h>
|
|
|
|
|
2022-03-03 15:11:32 +00:00
|
|
|
struct genode_env : Genode::Env { };
|
|
|
|
struct genode_allocator : Genode::Allocator { };
|
|
|
|
struct genode_signal_handler : Genode::Signal_dispatcher_base { };
|
2021-07-20 09:38:27 +00:00
|
|
|
|
|
|
|
static inline auto genode_env_ptr(Genode::Env &env)
|
|
|
|
{
|
|
|
|
return static_cast<genode_env *>(&env);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline auto genode_allocator_ptr(Genode::Allocator &alloc)
|
|
|
|
{
|
|
|
|
return static_cast<genode_allocator *>(&alloc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline auto genode_signal_handler_ptr(Genode::Signal_dispatcher_base &sigh)
|
|
|
|
{
|
|
|
|
return static_cast<genode_signal_handler *>(&sigh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Genode::Signal_context_capability cap(genode_signal_handler *sigh_ptr)
|
|
|
|
{
|
|
|
|
Genode::Signal_dispatcher_base *dispatcher_ptr = sigh_ptr;
|
|
|
|
return *static_cast<Genode::Signal_handler<Genode::Meta::Empty> *>(dispatcher_ptr);
|
|
|
|
}
|
|
|
|
|
2022-03-03 15:11:32 +00:00
|
|
|
/**
|
|
|
|
* Returns local address of attached shared dataspace
|
|
|
|
*/
|
|
|
|
Genode::addr_t
|
|
|
|
genode_shared_dataspace_local_address(struct genode_shared_dataspace * ds);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns capability of shared dataspace
|
|
|
|
*/
|
|
|
|
Genode::Dataspace_capability
|
|
|
|
genode_shared_dataspace_capability(struct genode_shared_dataspace * ds);
|
2021-07-20 09:38:27 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2022-03-03 15:11:32 +00:00
|
|
|
/**
|
|
|
|
* Callback definition to allocate and attach a dataspace to share
|
|
|
|
*/
|
|
|
|
typedef struct genode_shared_dataspace *
|
|
|
|
(*genode_shared_dataspace_alloc_attach_t) (unsigned long size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback definition to detach and free dataspace
|
|
|
|
*/
|
|
|
|
typedef void
|
|
|
|
(*genode_shared_dataspace_free_t) (struct genode_shared_dataspace * ds);
|
|
|
|
|
usb: session renewal & new client API
Replace the USB session API by one that provides a devices ROM only,
which contains information about all USB devices available for this client,
as well as methods to acquire and release a single device.
The acquisition of an USB device returns the capability to a device session
that includes a packet stream buffer to communicate control transfers
in between the client and the USB host controller driver. Moreover,
additional methods to acquire and release an USB interface can be used.
The acquisition of an USB interface returns the capability to an interface
session that includes a packet stream buffer to communicate either
bulk, interrupt, or isochronous transfers in between the client and the
USB host controller driver.
This commit implements the API changes in behalf of the Genode C API's
USB server and client side. Addtionally, it provides Usb::Device,
Usb::Interface, and Usb::Endpoint utilities that can be used by native
C++ clients to use the new API and hide the sophisticated packet stream API.
The adaptations necessary target the following areas:
* lx_emul layer for USB host and client side
* Linux USB host controller driver port for PC
* Linux USB client ports: usb_hid_drv and usb_net_drv, additionally
reduce the Linux tasks used inside these drivers
* Native usb_block_drv
* black_hole component
* Port of libusb, including smartcard and usb_webcam driver depending on it
* Port of Qemu XHCI model library, including vbox5 & vbox6 depending on it
* Adapt all run-scripts and drivers_interactive recipes to work
with the new policy rules of the USB host controller driver
Fix genodelabs/genode#5021
2023-09-14 08:55:11 +00:00
|
|
|
struct genode_buffer
|
|
|
|
{
|
|
|
|
void * addr;
|
|
|
|
unsigned long size;
|
|
|
|
};
|
|
|
|
typedef struct genode_buffer genode_buffer_t;
|
|
|
|
|
2021-07-20 09:38:27 +00:00
|
|
|
#endif /* _INCLUDE__GENODE_C_API__BASE_H_ */
|