Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:54

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup mpc55xx_dspi
0007  *
0008  * @brief Header file for the LibI2C bus driver for the Deserial Serial Peripheral Interface (DSPI).
0009  */
0010 
0011 /*
0012  * Copyright (c) 2008 embedded brains GmbH & Co. KG
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Redistributions in binary form must reproduce the above copyright
0019  *    notice, this list of conditions and the following disclaimer in the
0020  *    documentation and/or other materials provided with the distribution.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0026  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0027  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0028  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0031  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0032  * POSSIBILITY OF SUCH DAMAGE.
0033  */
0034 
0035 /**
0036  * @defgroup mpc55xx_dspi Deserial Serial Peripheral Interface (DSPI)
0037  *
0038  * @ingroup RTEMSBSPsPowerPCMPC55XX
0039  */
0040 
0041 #ifndef LIBCPU_POWERPC_MPC55XX_DSPI_H
0042 #define LIBCPU_POWERPC_MPC55XX_DSPI_H
0043 
0044 #include <rtems/libi2c.h>
0045 
0046 #include <mpc55xx/edma.h>
0047 
0048 #ifdef __cplusplus
0049 extern "C" {
0050 #endif /* __cplusplus */
0051 
0052 struct DSPI_tag;
0053 
0054 typedef struct {
0055   edma_channel_context edma;
0056   rtems_id id;
0057 } mpc55xx_dspi_edma_entry;
0058 
0059 /**
0060  * @brief LibI2C bus driver entry.
0061  */
0062 typedef struct {
0063     /**
0064      * @brief Standard bus driver fields.
0065      */
0066     rtems_libi2c_bus_t bus;
0067 
0068     /**
0069      * @brief Index in the bus table: @ref mpc55xx_dspi_bus_table.
0070      */
0071     unsigned table_index;
0072 
0073     /**
0074      * @brief Bus number (available after rtems_libi2c_register_bus()).
0075      *
0076      * @note You must set it in the initialization code after the bus registration.
0077      */
0078     unsigned bus_number;
0079 
0080     /**
0081      * @brief Hardware registers.
0082      */
0083     volatile struct DSPI_tag *regs;
0084 
0085     /**
0086      * @brief Selects SPI master or slave mode.
0087      */
0088     bool master;
0089 
0090     /**
0091      * @brief Data for the Push Register.
0092      */
0093     union DSPI_PUSHR_tag push_data;
0094 
0095     /**
0096      * @brief eDMA entry for transmission.
0097      *
0098      * The channel is fixed to a particular DSPI.
0099      */
0100     mpc55xx_dspi_edma_entry edma_transmit;
0101 
0102     /**
0103      * @brief eDMA entry for push data generation.
0104      *
0105      * You can choose every available channel.
0106      */
0107     mpc55xx_dspi_edma_entry edma_push;
0108 
0109     /**
0110      * @brief eDMA entry for receiving.
0111      *
0112      * The channel is fixed to a particular DSPI.
0113      */
0114     mpc55xx_dspi_edma_entry edma_receive;
0115 
0116     /**
0117      * @brief Idle character transmitted in read only mode.
0118      */
0119     uint32_t idle_char;
0120 
0121     /**
0122      * @brief Current baud.
0123      */
0124     uint32_t baud;
0125 } mpc55xx_dspi_bus_entry;
0126 
0127 /**
0128  * @brief Number of DSPIs.
0129  */
0130 #define MPC55XX_DSPI_NUMBER 4
0131 
0132 /**
0133  * @brief Table with bus driver entries.
0134  */
0135 extern mpc55xx_dspi_bus_entry mpc55xx_dspi_bus_table [ /* MPC55XX_DSPI_NUMBER */ ];
0136 
0137 #ifdef __cplusplus
0138 }
0139 #endif /* __cplusplus */
0140 
0141 #endif /* LIBCPU_POWERPC_MPC55XX_DSPI_H */