fix: move RTL-SDR to userspace
This commit is contained in:
@@ -163,15 +163,15 @@ extern "C" {
|
||||
#define MTK_SYS_BTSETADDR 137
|
||||
#define MTK_SYS_BTBONDS 138
|
||||
#define MTK_SYS_BTFORGET 139
|
||||
#define MTK_SYS_SDR_COUNT 140
|
||||
#define MTK_SYS_SDR_INFO 141
|
||||
#define MTK_SYS_SDR_OPEN 142
|
||||
#define MTK_SYS_SDR_CLOSE 143
|
||||
#define MTK_SYS_SDR_START 144
|
||||
#define MTK_SYS_SDR_STOP 145
|
||||
#define MTK_SYS_SDR_READ 146
|
||||
#define MTK_SYS_SDR_SETPARAM 147
|
||||
#define MTK_SYS_SDR_GETPARAM 148
|
||||
#define MTK_SYS_RESERVED_140 140
|
||||
#define MTK_SYS_RESERVED_141 141
|
||||
#define MTK_SYS_RESERVED_142 142
|
||||
#define MTK_SYS_RESERVED_143 143
|
||||
#define MTK_SYS_RESERVED_144 144
|
||||
#define MTK_SYS_RESERVED_145 145
|
||||
#define MTK_SYS_RESERVED_146 146
|
||||
#define MTK_SYS_RESERVED_147 147
|
||||
#define MTK_SYS_RESERVED_148 148
|
||||
#define MTK_SYS_POWERINFO 149
|
||||
#define MTK_SYS_FBFLIP 150
|
||||
#define MTK_SYS_GETEXECPATH 151
|
||||
@@ -201,6 +201,13 @@ extern "C" {
|
||||
#define MTK_SYS_KILLSESSION 175
|
||||
#define MTK_SYS_LOG_WRITE 176
|
||||
#define MTK_SYS_TERMINAL_ATTACHED 177
|
||||
#define MTK_SYS_USB_LIST 178
|
||||
#define MTK_SYS_USB_CLAIM 179
|
||||
#define MTK_SYS_USB_CLOSE 180
|
||||
#define MTK_SYS_USB_CONTROL 181
|
||||
#define MTK_SYS_USB_BULK_IN_START 182
|
||||
#define MTK_SYS_USB_BULK_IN_STOP 183
|
||||
#define MTK_SYS_USB_BULK_IN_READ 184
|
||||
/* @SYSCALLS-END */
|
||||
|
||||
#define MTK_SOCK_TCP 1
|
||||
@@ -210,6 +217,14 @@ extern "C" {
|
||||
#define MTK_IPC_SIGNAL_PEER_CLOSED (1u << 2)
|
||||
#define MTK_IPC_SIGNAL_EXITED (1u << 3)
|
||||
#define MTK_IPC_SIGNAL_READY (1u << 4)
|
||||
#define MTK_USB_ERR_INVALID (-1)
|
||||
#define MTK_USB_ERR_BUSY (-2)
|
||||
#define MTK_USB_ERR_DISCONNECTED (-3)
|
||||
#define MTK_USB_ERR_UNSUPPORTED (-4)
|
||||
#define MTK_USB_ERR_IO (-5)
|
||||
#define MTK_USB_ERR_NO_RESOURCES (-6)
|
||||
#define MTK_USB_ERR_NOT_FOUND (-7)
|
||||
#define MTK_USB_ERR_KERNEL_BOUND (-8)
|
||||
|
||||
/* Window event types */
|
||||
#define MTK_EVENT_KEY 0
|
||||
@@ -314,6 +329,34 @@ typedef struct {
|
||||
uint32_t dns_server;
|
||||
} mtk_netcfg;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t slot_id;
|
||||
uint8_t port_id;
|
||||
uint8_t speed;
|
||||
uint8_t interface_number;
|
||||
uint16_t vendor_id;
|
||||
uint16_t product_id;
|
||||
uint8_t device_class;
|
||||
uint8_t interface_class;
|
||||
uint8_t interface_subclass;
|
||||
uint8_t interface_protocol;
|
||||
uint8_t bulk_in_endpoint;
|
||||
uint8_t bulk_out_endpoint;
|
||||
uint16_t bulk_in_max_packet;
|
||||
uint16_t bulk_out_max_packet;
|
||||
uint8_t kernel_driver_bound;
|
||||
uint8_t claimed;
|
||||
uint8_t reserved[4];
|
||||
} mtk_usb_interface_info;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t request_type;
|
||||
uint8_t request;
|
||||
uint16_t value;
|
||||
uint16_t index;
|
||||
uint16_t length;
|
||||
} mtk_usb_control_request;
|
||||
|
||||
typedef struct {
|
||||
int32_t pid;
|
||||
int32_t parent_pid;
|
||||
@@ -778,6 +821,44 @@ static inline void mtk_get_netcfg(mtk_netcfg *out) {
|
||||
_mtk_syscall1(MTK_SYS_GETNETCFG, (long)out);
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
Generic USB interface access
|
||||
==================================================================== */
|
||||
|
||||
static inline int mtk_usb_list(mtk_usb_interface_info *out, int max_count) {
|
||||
return (int)_mtk_syscall2(MTK_SYS_USB_LIST, (long)out, (long)max_count);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_claim(uint8_t slot_id, uint8_t interface_number) {
|
||||
return (int)_mtk_syscall2(MTK_SYS_USB_CLAIM, (long)slot_id,
|
||||
(long)interface_number);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_close(int handle) {
|
||||
return (int)_mtk_syscall1(MTK_SYS_USB_CLOSE, (long)handle);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_control(int handle, const mtk_usb_control_request *request,
|
||||
void *data, uint32_t data_len) {
|
||||
return (int)_mtk_syscall4(MTK_SYS_USB_CONTROL, (long)handle, (long)request,
|
||||
(long)data, (long)data_len);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_bulk_in_start(int handle, uint32_t transfer_bytes,
|
||||
uint32_t buffer_count) {
|
||||
return (int)_mtk_syscall3(MTK_SYS_USB_BULK_IN_START, (long)handle,
|
||||
(long)transfer_bytes, (long)buffer_count);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_bulk_in_stop(int handle) {
|
||||
return (int)_mtk_syscall1(MTK_SYS_USB_BULK_IN_STOP, (long)handle);
|
||||
}
|
||||
|
||||
static inline int mtk_usb_bulk_in_read(int handle, void *data, uint32_t data_len) {
|
||||
return (int)_mtk_syscall3(MTK_SYS_USB_BULK_IN_READ, (long)handle,
|
||||
(long)data, (long)data_len);
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
Audio
|
||||
==================================================================== */
|
||||
|
||||
Reference in New Issue
Block a user