[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 | |
---|
| 32 | #ifdef __cplusplus |
---|
| 33 | extern "C" { |
---|
| 34 | #endif /* __cplusplus */ |
---|
| 35 | |
---|
| 36 | struct DSPI_tag; |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * @brief LibI2C bus driver entry. |
---|
| 40 | */ |
---|
| 41 | typedef struct { |
---|
| 42 | /** |
---|
| 43 | * @brief Standard bus driver fields. |
---|
| 44 | */ |
---|
| 45 | rtems_libi2c_bus_t bus; |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * @brief Index in the bus table: @ref mpc55xx_dspi_bus_table. |
---|
| 49 | */ |
---|
| 50 | unsigned table_index; |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * @brief Bus number (available after rtems_libi2c_register_bus()). |
---|
| 54 | * |
---|
| 55 | * @note You must set it in the initialization code after the bus registration. |
---|
| 56 | */ |
---|
| 57 | unsigned bus_number; |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * @brief Hardware registers. |
---|
| 61 | */ |
---|
| 62 | volatile struct DSPI_tag *regs; |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * @brief Selects SPI master or slave mode. |
---|
| 66 | */ |
---|
| 67 | int master; |
---|
| 68 | |
---|
| 69 | /** |
---|
| 70 | * @brief Data for the Push Register. |
---|
| 71 | */ |
---|
| 72 | union DSPI_PUSHR_tag push_data; |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * @brief eDMA channel for transmission. |
---|
| 76 | * |
---|
| 77 | * The channel is fixed to particular DSPI. |
---|
| 78 | */ |
---|
| 79 | int edma_channel_transmit; |
---|
| 80 | |
---|
| 81 | /** |
---|
| 82 | * @brief eDMA channel to generate the push data. |
---|
| 83 | * |
---|
| 84 | * You can choose any available channel. |
---|
| 85 | */ |
---|
| 86 | int edma_channel_push; |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | * @brief eDMA channel for receiving. |
---|
| 90 | * |
---|
| 91 | * The channel is fixed to particular DSPI. |
---|
| 92 | */ |
---|
| 93 | int edma_channel_receive; |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * @brief Semaphore ID for a transmit update. |
---|
| 97 | */ |
---|
| 98 | rtems_id edma_channel_transmit_update; |
---|
| 99 | |
---|
| 100 | /** |
---|
| 101 | * @brief Semaphore ID for a receive update. |
---|
| 102 | */ |
---|
| 103 | rtems_id edma_channel_receive_update; |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * @brief Transmit error status. |
---|
| 107 | */ |
---|
| 108 | uint32_t edma_channel_transmit_error; |
---|
| 109 | |
---|
| 110 | /** |
---|
| 111 | * @brief Receive error status. |
---|
| 112 | */ |
---|
| 113 | uint32_t edma_channel_receive_error; |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * @brief Idle character transmitted in read only mode. |
---|
| 117 | */ |
---|
| 118 | uint32_t idle_char; |
---|
| 119 | } mpc55xx_dspi_bus_entry; |
---|
| 120 | |
---|
| 121 | /** |
---|
| 122 | * @brief Number of DSPIs. |
---|
| 123 | */ |
---|
| 124 | #define MPC55XX_DSPI_NUMBER 4 |
---|
| 125 | |
---|
| 126 | /** |
---|
| 127 | * @brief Table with bus driver entries. |
---|
| 128 | */ |
---|
| 129 | extern mpc55xx_dspi_bus_entry mpc55xx_dspi_bus_table [ /* MPC55XX_DSPI_NUMBER */ ]; |
---|
| 130 | |
---|
| 131 | #ifdef __cplusplus |
---|
| 132 | } |
---|
| 133 | #endif /* __cplusplus */ |
---|
| 134 | |
---|
| 135 | #endif /* LIBCPU_POWERPC_MPC55XX_DSPI_H */ |
---|