blob: 7e8feb0453e8464f9840dc858abbf42a5525f3db [file] [log] [blame]
Kévin Redon69b92d92019-01-24 16:39:20 +01001/**
2 * \file
3 *
4 * \brief I/O functionality implementation.
5 *
6 * Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Subject to your compliance with these terms, you may use Microchip
13 * software and any derivatives exclusively with Microchip products.
14 * It is your responsibility to comply with third party license terms applicable
15 * to your use of third party software (including open source software) that
16 * may accompany Microchip software.
17 *
18 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 *
30 * \asf_license_stop
31 *
32 */
33
34#include <hal_io.h>
35#include <utils_assert.h>
36
37/**
38 * \brief Driver version
39 */
40#define DRIVER_VERSION 0x00000001u
41
42uint32_t io_get_version(void)
43{
44 return DRIVER_VERSION;
45}
46
47/**
48 * \brief I/O write interface
49 */
50int32_t io_write(struct io_descriptor *const io_descr, const uint8_t *const buf, const uint16_t length)
51{
52 ASSERT(io_descr && buf);
53 return io_descr->write(io_descr, buf, length);
54}
55
56/**
57 * \brief I/O read interface
58 */
59int32_t io_read(struct io_descriptor *const io_descr, uint8_t *const buf, const uint16_t length)
60{
61 ASSERT(io_descr && buf);
62 return io_descr->read(io_descr, buf, length);
63}