| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bspi_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 12 | * $brcm_Date: 4/23/10 2:29p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/spi/7038/bspi_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/4 4/23/10 2:29p erickson |
|---|
| 21 | * SW3548-2904: don't write directly to BCHP_IRQ0_SPI_IRQEN because of |
|---|
| 22 | * possible linux SPI flash collision, clean up BCHP_CHIP lists, add _isr |
|---|
| 23 | * to two priv functions |
|---|
| 24 | * |
|---|
| 25 | * Hydra_Software_Devel/3 1/13/04 5:02p brianlee |
|---|
| 26 | * PR9268: Make write structures constant. |
|---|
| 27 | * |
|---|
| 28 | * Hydra_Software_Devel/2 9/11/03 6:24p brianlee |
|---|
| 29 | * Added more private functions. |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/1 7/31/03 10:06a brianlee |
|---|
| 32 | * Private SPI functions. |
|---|
| 33 | * |
|---|
| 34 | ***************************************************************************/ |
|---|
| 35 | #ifndef BSPI_PRIV_H__ |
|---|
| 36 | #define BSPI_PRIV_H__ |
|---|
| 37 | |
|---|
| 38 | #include "bspi.h" |
|---|
| 39 | |
|---|
| 40 | #ifdef __cplusplus |
|---|
| 41 | extern "C" { |
|---|
| 42 | #endif |
|---|
| 43 | |
|---|
| 44 | /*************************************************************************** |
|---|
| 45 | Summary: |
|---|
| 46 | This function performs a SPI read operation. |
|---|
| 47 | |
|---|
| 48 | Description: |
|---|
| 49 | This function is used to read data from a SPI slave using a particular |
|---|
| 50 | SPI channel. The slave select for that SPI channel should already have |
|---|
| 51 | been set when opening the channel. |
|---|
| 52 | |
|---|
| 53 | Returns: |
|---|
| 54 | TODO: |
|---|
| 55 | |
|---|
| 56 | See Also: |
|---|
| 57 | BSPI_AbortTxfr |
|---|
| 58 | |
|---|
| 59 | ****************************************************************************/ |
|---|
| 60 | BERR_Code BSPI_P_Read( |
|---|
| 61 | void *context, /* Device channel handle */ |
|---|
| 62 | const uint8_t *pWriteData, /* pointer to memory location where data is to sent */ |
|---|
| 63 | uint8_t *pReadData, /* pointer to memory location to store read data */ |
|---|
| 64 | size_t length /* number of bytes to read + number of bytes to write */ |
|---|
| 65 | ); |
|---|
| 66 | |
|---|
| 67 | /*************************************************************************** |
|---|
| 68 | Summary: |
|---|
| 69 | This function performs a SPI write operation. |
|---|
| 70 | |
|---|
| 71 | Description: |
|---|
| 72 | This function is used to write data to a SPI slave using a particular |
|---|
| 73 | SPI channel. The slave select for that SPI channel should already have |
|---|
| 74 | been set when opening the channel. |
|---|
| 75 | |
|---|
| 76 | Returns: |
|---|
| 77 | TODO: |
|---|
| 78 | |
|---|
| 79 | See Also: |
|---|
| 80 | BSPI_AbortTxfr |
|---|
| 81 | |
|---|
| 82 | ****************************************************************************/ |
|---|
| 83 | BERR_Code BSPI_P_Write( |
|---|
| 84 | void *context, /* Device channel handle */ |
|---|
| 85 | const uint8_t *pWriteData, /* pointer to memory location where data is to sent */ |
|---|
| 86 | size_t length /* number of bytes to write */ |
|---|
| 87 | ); |
|---|
| 88 | |
|---|
| 89 | /*************************************************************************** |
|---|
| 90 | Summary: |
|---|
| 91 | This function sets the clock setting for an SPI channel |
|---|
| 92 | |
|---|
| 93 | Description: |
|---|
| 94 | This function allows the user to change the SPI clock setting. |
|---|
| 95 | |
|---|
| 96 | Returns: |
|---|
| 97 | TODO: |
|---|
| 98 | |
|---|
| 99 | See Also: |
|---|
| 100 | |
|---|
| 101 | ****************************************************************************/ |
|---|
| 102 | void BSPI_P_SetClk ( |
|---|
| 103 | BSPI_ChannelHandle channel, /* Device channel handle */ |
|---|
| 104 | uint32_t baud, /* serial clock baud setting */ |
|---|
| 105 | uint8_t clkConfig /* clock polarity/phase setting */ |
|---|
| 106 | ); |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | /*************************************************************************** |
|---|
| 110 | Summary: |
|---|
| 111 | This function waits until a SPI transfer is finished |
|---|
| 112 | |
|---|
| 113 | Description: |
|---|
| 114 | This function is used to wait for SPI to finish. |
|---|
| 115 | |
|---|
| 116 | Returns: |
|---|
| 117 | TODO: |
|---|
| 118 | |
|---|
| 119 | See Also: |
|---|
| 120 | |
|---|
| 121 | ****************************************************************************/ |
|---|
| 122 | BERR_Code BSPI_P_WaitForCompletion |
|---|
| 123 | ( |
|---|
| 124 | BSPI_ChannelHandle hChn, /* Device channel handle */ |
|---|
| 125 | uint32_t numBytes /* number of bytes to transfer */ |
|---|
| 126 | ); |
|---|
| 127 | |
|---|
| 128 | /*************************************************************************** |
|---|
| 129 | Summary: |
|---|
| 130 | This function handles SPI interrupt |
|---|
| 131 | |
|---|
| 132 | Description: |
|---|
| 133 | This function is the SPI ISR. |
|---|
| 134 | |
|---|
| 135 | Returns: |
|---|
| 136 | TODO: |
|---|
| 137 | |
|---|
| 138 | See Also: |
|---|
| 139 | |
|---|
| 140 | ****************************************************************************/ |
|---|
| 141 | void BSPI_P_HandleInterrupt_Isr |
|---|
| 142 | ( |
|---|
| 143 | void *pParam1, /* Device channel handle */ |
|---|
| 144 | int parm2 /* not used */ |
|---|
| 145 | ); |
|---|
| 146 | |
|---|
| 147 | #ifdef __cplusplus |
|---|
| 148 | } |
|---|
| 149 | #endif |
|---|
| 150 | |
|---|
| 151 | #endif |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | |
|---|