Contiki-NG
usb.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Yago Fontoura do Rosario <yago.rosario@hotmail.com.br>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/*---------------------------------------------------------------------------*/
31/**
32 * \addtogroup nrf
33 * @{
34 *
35 * \addtogroup nrf-usb USB driver
36 * @{
37 *
38 * \file
39 * USB header file for the nRF.
40 * \author
41 * Yago Fontoura do Rosario <yago.rosario@hotmail.com.br>
42 *
43 */
44/*---------------------------------------------------------------------------*/
45#ifndef USB_H_
46#define USB_H_
47/*---------------------------------------------------------------------------*/
48#include "contiki.h"
49/*---------------------------------------------------------------------------*/
50/**
51 * @brief Initialize the USB driver
52 *
53 */
54void usb_init(void);
55/*---------------------------------------------------------------------------*/
56/**
57 * @brief Writes to the USB driver
58 *
59 * @param buffer data to be transferred
60 * @param buffer_size size of data
61 *
62 * @pre @ref usb_init must have been called
63 */
64void usb_write(uint8_t *buffer, uint32_t buffer_size);
65/*---------------------------------------------------------------------------*/
66/**
67 * @brief Flush USB buffer
68 *
69 * @pre @ref usb_init must have been called
70 * @pre Data must be written by @ref usb_write prior
71 */
72void usb_flush(void);
73/*---------------------------------------------------------------------------*/
74/**
75 * @brief Sets the input handler called in the event handler
76 *
77 * @param input character that has been read
78 */
79void usb_set_input(int (*input)(unsigned char c));
80/*---------------------------------------------------------------------------*/
81/**
82 * @brief Handles the interrupt
83 *
84 * @remarks Must be called from the arch interrupt handler
85 *
86 */
87void usb_interrupt_handler(void);
88/*---------------------------------------------------------------------------*/
89/* Arch specific interface */
90/*---------------------------------------------------------------------------*/
91/**
92 * @brief Initialize the architecture specific USB driver
93 *
94 */
95void usb_arch_init(void);
96/*---------------------------------------------------------------------------*/
97#endif /* USB_H_ */
98/*---------------------------------------------------------------------------*/
99/**
100 * @}
101 * @}
102 */
void usb_set_input(int(*input)(unsigned char c))
Sets the input handler called in the event handler.
Definition: usb.c:75
void usb_interrupt_handler(void)
Handles the interrupt.
Definition: usb.c:64
void usb_flush(void)
Flush USB buffer.
Definition: usb.c:112
void usb_write(uint8_t *buffer, uint32_t buffer_size)
Writes to the USB driver.
Definition: usb.c:94
void usb_arch_init(void)
Initialize the architecture specific USB driver.
void usb_init(void)
Initialize the USB driver.
Definition: usb.c:81
static void input(void)
Process a received 6lowpan packet.
Definition: sicslowpan.c:1833