Loading...
Searching...
No Matches
usbdev_mock.h
1/*
2 * Copyright (C) 2019 Koen Zandberg <koen@bergzand.net>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
17#ifndef USBDEV_MOCK_H
18#define USBDEV_MOCK_H
19
20#include <stdint.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
29#define USBDEV_MOCK_NUM_EP (1)
30
51
56
62typedef void (*usbdev_mock_esr_cb_t)(usbdev_mock_t *dev);
63
72
82 size_t len);
83
101
110 usbdev_mock_ep_esr_cb_t ep_esr_cb,
111 usbdev_mock_ready_cb_t ready_cb);
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* USBDEV_MOCK_H */
void usbdev_mock_setup(usbdev_mock_esr_cb_t esr_cb, usbdev_mock_ep_esr_cb_t ep_esr_cb, usbdev_mock_ready_cb_t ready_cb)
usbdev mock device setup function
void(* usbdev_mock_esr_cb_t)(usbdev_mock_t *dev)
usbdev mock device callback for esr event checking
Definition usbdev_mock.h:62
usbdev_mock_ep_state_t
Definition usbdev_mock.h:35
void(* usbdev_mock_ready_cb_t)(usbdev_mock_t *dev, usbdev_mock_ep_t *ep, size_t len)
usbdev mock device callback for endpoint ready call checking
Definition usbdev_mock.h:80
void(* usbdev_mock_ep_esr_cb_t)(usbdev_mock_t *dev, usbdev_mock_ep_t *ep)
usbdev mock device callback for endpoint event checking
Definition usbdev_mock.h:70
#define USBDEV_MOCK_NUM_EP
Number of IN and OUT endpoints available in the mock usbdev device.
Definition usbdev_mock.h:29
@ EP_STATE_READY
Endpoint is ready/idle.
Definition usbdev_mock.h:36
@ EP_STATE_DATA_AVAILABLE
Endpoint has data
Definition usbdev_mock.h:37
usbdev endpoint descriptor
Definition usbdev.h:259
usbdev mock device endpoint
Definition usbdev_mock.h:44
usbdev_mock_ep_state_t state
Endpoint state
Definition usbdev_mock.h:46
uint8_t * buf
Internal mock buffer pointer.
Definition usbdev_mock.h:49
size_t available
Bytes available in the buffer
Definition usbdev_mock.h:47
usbdev_ep_t ep
Generic endpoint struct
Definition usbdev_mock.h:45
uint8_t * target_buf
Buffer as passed by usbdev_ep_xmit
Definition usbdev_mock.h:48
usbdev mock device
Definition usbdev_mock.h:87
usbdev_mock_ep_esr_cb_t ep_esr_cb
Endpoint ESR cb for validation
Definition usbdev_mock.h:96
usbdev_t usbdev
Generic usbdev device
Definition usbdev_mock.h:88
uint8_t config_addr
Configured address
Definition usbdev_mock.h:91
usbdev_mock_ready_cb_t ready_cb
Endpoint ready cb for validation
Definition usbdev_mock.h:98
usbdev_mock_ep_t in[USBDEV_MOCK_NUM_EP]
IN endpoints
Definition usbdev_mock.h:89
size_t req_len
Length of the current request
Definition usbdev_mock.h:92
usbdev_mock_esr_cb_t esr_cb
ESR callback for validation
Definition usbdev_mock.h:94
usbdev_mock_ep_t out[USBDEV_MOCK_NUM_EP]
OUT endpoints
Definition usbdev_mock.h:90
usbdev device descriptor
Definition usbdev.h:247