[574fb67] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup mpc55xx_dspi |
---|
| 5 | * |
---|
| 6 | * @brief Header file for the LibI2C bus driver for the Deserial Serial Peripheral Interface (DSPI). |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * Copyright (c) 2008 |
---|
| 11 | * Embedded Brains GmbH |
---|
| 12 | * Obere Lagerstr. 30 |
---|
| 13 | * D-82178 Puchheim |
---|
| 14 | * Germany |
---|
| 15 | * rtems@embedded-brains.de |
---|
| 16 | * |
---|
| 17 | * The license and distribution terms for this file may be found in the file |
---|
| 18 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | /** |
---|
| 22 | * @defgroup mpc55xx_dspi Deserial Serial Peripheral Interface (DSPI) |
---|
| 23 | * |
---|
| 24 | * @ingroup mpc55xx |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef LIBCPU_POWERPC_MPC55XX_DSPI_H |
---|
| 28 | #define LIBCPU_POWERPC_MPC55XX_DSPI_H |
---|
| 29 | |
---|
| 30 | #include <rtems/libi2c.h> |
---|
| 31 | |
---|
[d374492] | 32 | #include <mpc55xx/edma.h> |
---|
| 33 | |
---|
[574fb67] | 34 | #ifdef __cplusplus |
---|
| 35 | extern "C" { |
---|
| 36 | #endif /* __cplusplus */ |
---|
| 37 | |
---|
| 38 | struct DSPI_tag; |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * @brief LibI2C bus driver entry. |
---|
| 42 | */ |
---|
| 43 | typedef struct { |
---|
| 44 | /** |
---|
| 45 | * @brief Standard bus driver fields. |
---|
| 46 | */ |
---|
| 47 | rtems_libi2c_bus_t bus; |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * @brief Index in the bus table: @ref mpc55xx_dspi_bus_table. |
---|
| 51 | */ |
---|
| 52 | unsigned table_index; |
---|
| 53 | |
---|
| 54 | /** |
---|
| 55 | * @brief Bus number (available after rtems_libi2c_register_bus()). |
---|
| 56 | * |
---|
| 57 | * @note You must set it in the initialization code after the bus registration. |
---|
| 58 | */ |
---|
| 59 | unsigned bus_number; |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * @brief Hardware registers. |
---|
| 63 | */ |
---|
| 64 | volatile struct DSPI_tag *regs; |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * @brief Selects SPI master or slave mode. |
---|
| 68 | */ |
---|
[d374492] | 69 | bool master; |
---|
[574fb67] | 70 | |
---|
| 71 | /** |
---|
| 72 | * @brief Data for the Push Register. |
---|
| 73 | */ |
---|
| 74 | union DSPI_PUSHR_tag push_data; |
---|
| 75 | |
---|
| 76 | /** |
---|
[d374492] | 77 | * @brief eDMA entry for transmission. |
---|
[574fb67] | 78 | * |
---|
[d374492] | 79 | * The channel is fixed to a particular DSPI. |
---|
[574fb67] | 80 | */ |
---|
[d374492] | 81 | mpc55xx_edma_channel_entry edma_transmit; |
---|
[574fb67] | 82 | |
---|
| 83 | /** |
---|
[d374492] | 84 | * @brief eDMA entry for push data generation. |
---|
[574fb67] | 85 | * |
---|
[d374492] | 86 | * You can choose every available channel. |
---|
[574fb67] | 87 | */ |
---|
[d374492] | 88 | mpc55xx_edma_channel_entry edma_push; |
---|
[574fb67] | 89 | |
---|
| 90 | /** |
---|
[d374492] | 91 | * @brief eDMA entry for receiving. |
---|
[574fb67] | 92 | * |
---|
[d374492] | 93 | * The channel is fixed to a particular DSPI. |
---|
[574fb67] | 94 | */ |
---|
[d374492] | 95 | mpc55xx_edma_channel_entry edma_receive; |
---|
[574fb67] | 96 | |
---|
| 97 | /** |
---|
[d374492] | 98 | * @brief Idle character transmitted in read only mode. |
---|
[574fb67] | 99 | */ |
---|
[d374492] | 100 | uint32_t idle_char; |
---|
[574fb67] | 101 | |
---|
| 102 | /** |
---|
[d374492] | 103 | * @brief Current baud. |
---|
[574fb67] | 104 | */ |
---|
[d374492] | 105 | uint32_t baud; |
---|
[574fb67] | 106 | } mpc55xx_dspi_bus_entry; |
---|
| 107 | |
---|
| 108 | /** |
---|
| 109 | * @brief Number of DSPIs. |
---|
| 110 | */ |
---|
| 111 | #define MPC55XX_DSPI_NUMBER 4 |
---|
| 112 | |
---|
| 113 | /** |
---|
| 114 | * @brief Table with bus driver entries. |
---|
| 115 | */ |
---|
| 116 | extern mpc55xx_dspi_bus_entry mpc55xx_dspi_bus_table [ /* MPC55XX_DSPI_NUMBER */ ]; |
---|
| 117 | |
---|
| 118 | #ifdef __cplusplus |
---|
| 119 | } |
---|
| 120 | #endif /* __cplusplus */ |
---|
| 121 | |
---|
| 122 | #endif /* LIBCPU_POWERPC_MPC55XX_DSPI_H */ |
---|