Álvaro de Rada / X_NUCLEO_PLC01A1
Committer:
Davidroid
Date:
Thu Jul 13 16:43:31 2017 +0000
Revision:
5:0845d4141a01
Aligning to ARM mbed coding style.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 5:0845d4141a01 1 /**
Davidroid 5:0845d4141a01 2 ******************************************************************************
Davidroid 5:0845d4141a01 3 * @file component_def.h
Davidroid 5:0845d4141a01 4 * @author AST
Davidroid 5:0845d4141a01 5 * @version V1.0.0
Davidroid 5:0845d4141a01 6 * @date 1 April 2015
Davidroid 5:0845d4141a01 7 * @brief Generic header file containing a generic component's definitions
Davidroid 5:0845d4141a01 8 * and I/O functions.
Davidroid 5:0845d4141a01 9 ******************************************************************************
Davidroid 5:0845d4141a01 10 * @attention
Davidroid 5:0845d4141a01 11 *
Davidroid 5:0845d4141a01 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Davidroid 5:0845d4141a01 13 *
Davidroid 5:0845d4141a01 14 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 5:0845d4141a01 15 * are permitted provided that the following conditions are met:
Davidroid 5:0845d4141a01 16 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 5:0845d4141a01 17 * this list of conditions and the following disclaimer.
Davidroid 5:0845d4141a01 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 5:0845d4141a01 19 * this list of conditions and the following disclaimer in the documentation
Davidroid 5:0845d4141a01 20 * and/or other materials provided with the distribution.
Davidroid 5:0845d4141a01 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 5:0845d4141a01 22 * may be used to endorse or promote products derived from this software
Davidroid 5:0845d4141a01 23 * without specific prior written permission.
Davidroid 5:0845d4141a01 24 *
Davidroid 5:0845d4141a01 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 5:0845d4141a01 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 5:0845d4141a01 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 5:0845d4141a01 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 5:0845d4141a01 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 5:0845d4141a01 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 5:0845d4141a01 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 5:0845d4141a01 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 5:0845d4141a01 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 5:0845d4141a01 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 5:0845d4141a01 35 *
Davidroid 5:0845d4141a01 36 ******************************************************************************
Davidroid 5:0845d4141a01 37 */
Davidroid 5:0845d4141a01 38
Davidroid 5:0845d4141a01 39
Davidroid 5:0845d4141a01 40 /* Define to prevent recursive inclusion -------------------------------------*/
Davidroid 5:0845d4141a01 41
Davidroid 5:0845d4141a01 42 #ifndef __COMPONENT_H
Davidroid 5:0845d4141a01 43 #define __COMPONENT_H
Davidroid 5:0845d4141a01 44
Davidroid 5:0845d4141a01 45
Davidroid 5:0845d4141a01 46 /* Types ---------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 47
Davidroid 5:0845d4141a01 48 /**
Davidroid 5:0845d4141a01 49 * @brief Component's Context structure definition.
Davidroid 5:0845d4141a01 50 */
Davidroid 5:0845d4141a01 51 typedef struct
Davidroid 5:0845d4141a01 52 {
Davidroid 5:0845d4141a01 53 /* Identity. */
Davidroid 5:0845d4141a01 54 uint8_t who_am_i;
Davidroid 5:0845d4141a01 55
Davidroid 5:0845d4141a01 56 /* ACTION ----------------------------------------------------------------*/
Davidroid 5:0845d4141a01 57 /* There should be only a unique identifier for each component, which */
Davidroid 5:0845d4141a01 58 /* should be the "who_am_i" parameter, hence this parameter is optional. */
Davidroid 5:0845d4141a01 59 /* -----------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 60 /* Type. */
Davidroid 5:0845d4141a01 61 uint8_t type;
Davidroid 5:0845d4141a01 62
Davidroid 5:0845d4141a01 63 /* Configuration. */
Davidroid 5:0845d4141a01 64 uint8_t address;
Davidroid 5:0845d4141a01 65
Davidroid 5:0845d4141a01 66 /* Pointer to the Data. */
Davidroid 5:0845d4141a01 67 void *p_data;
Davidroid 5:0845d4141a01 68
Davidroid 5:0845d4141a01 69 /* Pointer to the Virtual Table. */
Davidroid 5:0845d4141a01 70 void *p_vt;
Davidroid 5:0845d4141a01 71
Davidroid 5:0845d4141a01 72 /* ACTION ----------------------------------------------------------------*/
Davidroid 5:0845d4141a01 73 /* There should be only a unique virtual table for each component, which */
Davidroid 5:0845d4141a01 74 /* should be the "p_vt" parameter, hence this parameter is optional. */
Davidroid 5:0845d4141a01 75 /* -----------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 76 /* Pointer to the Extended Virtual Table. */
Davidroid 5:0845d4141a01 77 void *p_ext_vt;
Davidroid 5:0845d4141a01 78 } handle_t;
Davidroid 5:0845d4141a01 79
Davidroid 5:0845d4141a01 80 /**
Davidroid 5:0845d4141a01 81 * @brief Component's Status enumerator definition.
Davidroid 5:0845d4141a01 82 */
Davidroid 5:0845d4141a01 83 typedef enum
Davidroid 5:0845d4141a01 84 {
Davidroid 5:0845d4141a01 85 COMPONENT_OK = 0,
Davidroid 5:0845d4141a01 86 COMPONENT_ERROR,
Davidroid 5:0845d4141a01 87 COMPONENT_TIMEOUT,
Davidroid 5:0845d4141a01 88 COMPONENT_NOT_IMPLEMENTED
Davidroid 5:0845d4141a01 89 } status_t;
Davidroid 5:0845d4141a01 90
Davidroid 5:0845d4141a01 91 #endif /* __COMPONENT_H */
Davidroid 5:0845d4141a01 92
Davidroid 5:0845d4141a01 93 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/