mbed library sources. With a patch for the can_api

Fork of mbed-dev by mbed official

Committer:
DangerousElectrician
Date:
Mon Nov 14 04:39:23 2016 +0000
Revision:
151:91825d030f9b
Parent:
149:156823d33999
stuff changed?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file char_driver.h
<> 149:156823d33999 4 * @brief Defines a character driver data type.
<> 149:156823d33999 5 * @internal
<> 149:156823d33999 6 * @author ON Semiconductor
<> 149:156823d33999 7 * $Rev: 2607 $
<> 149:156823d33999 8 * $Date: 2013-12-06 18:02:43 +0530 (Fri, 06 Dec 2013) $
<> 149:156823d33999 9 ******************************************************************************
<> 149:156823d33999 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
<> 149:156823d33999 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
<> 149:156823d33999 12 * under limited terms and conditions. The terms and conditions pertaining to the software
<> 149:156823d33999 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
<> 149:156823d33999 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
<> 149:156823d33999 15 * if applicable the software license agreement. Do not use this software and/or
<> 149:156823d33999 16 * documentation unless you have carefully read and you agree to the limited terms and
<> 149:156823d33999 17 * conditions. By using this software and/or documentation, you agree to the limited
<> 149:156823d33999 18 * terms and conditions.
<> 149:156823d33999 19 *
<> 149:156823d33999 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
<> 149:156823d33999 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
<> 149:156823d33999 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
<> 149:156823d33999 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
<> 149:156823d33999 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
<> 149:156823d33999 25 * @endinternal
<> 149:156823d33999 26 *
<> 149:156823d33999 27 * @details
<> 149:156823d33999 28 * The character driver is intended for devices that allow read and write
<> 149:156823d33999 29 * operations with "streams" of data, such as UART devices, SPI or I2c, etc.
<> 149:156823d33999 30 *
<> 149:156823d33999 31 * The character driver derives from the generic driver template (see driver.h).
<> 149:156823d33999 32 * It does so by including an element of the generic driver_t type.
<> 149:156823d33999 33 *
<> 149:156823d33999 34 * The driver defines blocking and non-blocking read and write operations. It is
<> 149:156823d33999 35 * up to the driver implementation to decide which of these to actually implement.
<> 149:156823d33999 36 *
<> 149:156823d33999 37 * @ingroup char_drivers
<> 149:156823d33999 38 */
<> 149:156823d33999 39
<> 149:156823d33999 40 #ifndef CHAR_DRIVER_H_
<> 149:156823d33999 41 #define CHAR_DRIVER_H_
<> 149:156823d33999 42
<> 149:156823d33999 43 #include "driver.h"
<> 149:156823d33999 44
<> 149:156823d33999 45 #define DRV_NO_ERROR (True)
<> 149:156823d33999 46 #define DRV_ERROR (False)
<> 149:156823d33999 47
<> 149:156823d33999 48 /** A character driver structure. */
<> 149:156823d33999 49 typedef struct char_driver {
<> 149:156823d33999 50 /** The parent generic driver. */
<> 149:156823d33999 51 driver_t driver;
<> 149:156823d33999 52
<> 149:156823d33999 53 /** Blocking read into a buffer.
<> 149:156823d33999 54 * @param device The device to read from.
<> 149:156823d33999 55 * @param buf The buffer to read into.
<> 149:156823d33999 56 * @param len The number of bytes to read.
<> 149:156823d33999 57 */
<> 149:156823d33999 58 uint8_t (*read_b)(device_pt device, uint8_t *const buf, uint32_t len);
<> 149:156823d33999 59
<> 149:156823d33999 60 /** Non-blocking read into a buffer.
<> 149:156823d33999 61 * @param device The device to read from.
<> 149:156823d33999 62 * @param buf The buffer to read into.
<> 149:156823d33999 63 * @param len The maximum number of bytes to read; typically the size of the buffer.
<> 149:156823d33999 64 * @return The number of bytes actually read.
<> 149:156823d33999 65 */
<> 149:156823d33999 66 uint32_t (*read_nb)(device_pt device, uint8_t *const buf, uint32_t len);
<> 149:156823d33999 67
<> 149:156823d33999 68 /** Blocking write from a buffer.
<> 149:156823d33999 69 * @param device The device to write to.
<> 149:156823d33999 70 * @param buf The buffer to read from.
<> 149:156823d33999 71 * @param len The number of bytes to write; typically the size of the buffer.
<> 149:156823d33999 72 * @return success or error message
<> 149:156823d33999 73 */
<> 149:156823d33999 74 uint8_t (*write_b)(device_pt device, const uint8_t *buf, uint32_t len);
<> 149:156823d33999 75
<> 149:156823d33999 76 /** Non-blocking write from a buffer.
<> 149:156823d33999 77 * @param device The device to write to.
<> 149:156823d33999 78 * @param buf The buffer to read from.
<> 149:156823d33999 79 * @param len The number of bytes to write; typically the size of the buffer.
<> 149:156823d33999 80 * @return success or error message
<> 149:156823d33999 81 */
<> 149:156823d33999 82 uint8_t (*write_nb)(device_pt device, const uint8_t *buf, uint32_t len);
<> 149:156823d33999 83 } char_driver_t, *char_driver_pt;
<> 149:156823d33999 84
<> 149:156823d33999 85 #endif /* CHAR_DRIVER_H_ */