Fork of the GitHub

Committer:
DiegoOstuni
Date:
Thu Nov 14 14:34:50 2019 +0000
Revision:
0:75fc82583a41
Add files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DiegoOstuni 0:75fc82583a41 1
DiegoOstuni 0:75fc82583a41 2 /******************************************************************************
DiegoOstuni 0:75fc82583a41 3 * @attention
DiegoOstuni 0:75fc82583a41 4 *
DiegoOstuni 0:75fc82583a41 5 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
DiegoOstuni 0:75fc82583a41 6 *
DiegoOstuni 0:75fc82583a41 7 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
DiegoOstuni 0:75fc82583a41 8 * You may not use this file except in compliance with the License.
DiegoOstuni 0:75fc82583a41 9 * You may obtain a copy of the License at:
DiegoOstuni 0:75fc82583a41 10 *
DiegoOstuni 0:75fc82583a41 11 * http://www.st.com/myliberty
DiegoOstuni 0:75fc82583a41 12 *
DiegoOstuni 0:75fc82583a41 13 * Unless required by applicable law or agreed to in writing, software
DiegoOstuni 0:75fc82583a41 14 * distributed under the License is distributed on an "AS IS" BASIS,
DiegoOstuni 0:75fc82583a41 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
DiegoOstuni 0:75fc82583a41 16 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
DiegoOstuni 0:75fc82583a41 17 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
DiegoOstuni 0:75fc82583a41 18 * See the License for the specific language governing permissions and
DiegoOstuni 0:75fc82583a41 19 * limitations under the License.
DiegoOstuni 0:75fc82583a41 20 *
DiegoOstuni 0:75fc82583a41 21 ******************************************************************************/
DiegoOstuni 0:75fc82583a41 22
DiegoOstuni 0:75fc82583a41 23
DiegoOstuni 0:75fc82583a41 24 /*
DiegoOstuni 0:75fc82583a41 25 * PROJECT: ST25R391x firmware
DiegoOstuni 0:75fc82583a41 26 * $Revision: $
DiegoOstuni 0:75fc82583a41 27 * LANGUAGE: ISO C99
DiegoOstuni 0:75fc82583a41 28 */
DiegoOstuni 0:75fc82583a41 29
DiegoOstuni 0:75fc82583a41 30 /*! \file rfal_chip.h
DiegoOstuni 0:75fc82583a41 31 *
DiegoOstuni 0:75fc82583a41 32 * \author Gustavo Patricio
DiegoOstuni 0:75fc82583a41 33 *
DiegoOstuni 0:75fc82583a41 34 * \brief RF Chip specific Layer
DiegoOstuni 0:75fc82583a41 35 *
DiegoOstuni 0:75fc82583a41 36 * \warning This layer, which provides direct access to RF chip, should
DiegoOstuni 0:75fc82583a41 37 * only be used for debug purposes and/or advanced features
DiegoOstuni 0:75fc82583a41 38 *
DiegoOstuni 0:75fc82583a41 39 *
DiegoOstuni 0:75fc82583a41 40 * @addtogroup RFAL
DiegoOstuni 0:75fc82583a41 41 * @{
DiegoOstuni 0:75fc82583a41 42 *
DiegoOstuni 0:75fc82583a41 43 * @addtogroup RFAL-HAL
DiegoOstuni 0:75fc82583a41 44 * @brief RFAL Hardware Abstraction Layer
DiegoOstuni 0:75fc82583a41 45 * @{
DiegoOstuni 0:75fc82583a41 46 *
DiegoOstuni 0:75fc82583a41 47 * @addtogroup Chip
DiegoOstuni 0:75fc82583a41 48 * @brief RFAL RF Chip Module
DiegoOstuni 0:75fc82583a41 49 * @{
DiegoOstuni 0:75fc82583a41 50 *
DiegoOstuni 0:75fc82583a41 51 */
DiegoOstuni 0:75fc82583a41 52
DiegoOstuni 0:75fc82583a41 53
DiegoOstuni 0:75fc82583a41 54 #ifndef RFAL_CHIP_H
DiegoOstuni 0:75fc82583a41 55 #define RFAL_CHIP_H
DiegoOstuni 0:75fc82583a41 56
DiegoOstuni 0:75fc82583a41 57 /*
DiegoOstuni 0:75fc82583a41 58 ******************************************************************************
DiegoOstuni 0:75fc82583a41 59 * INCLUDES
DiegoOstuni 0:75fc82583a41 60 ******************************************************************************
DiegoOstuni 0:75fc82583a41 61 */
DiegoOstuni 0:75fc82583a41 62 #include "platform1.h"
DiegoOstuni 0:75fc82583a41 63 #include "st_errno.h"
DiegoOstuni 0:75fc82583a41 64 #include "rfal_rf.h"
DiegoOstuni 0:75fc82583a41 65
DiegoOstuni 0:75fc82583a41 66
DiegoOstuni 0:75fc82583a41 67 /*****************************************************************************
DiegoOstuni 0:75fc82583a41 68 * RF Chip *
DiegoOstuni 0:75fc82583a41 69 *****************************************************************************/
DiegoOstuni 0:75fc82583a41 70
DiegoOstuni 0:75fc82583a41 71 /*!
DiegoOstuni 0:75fc82583a41 72 *****************************************************************************
DiegoOstuni 0:75fc82583a41 73 * \brief Writes a register on the RF Chip
DiegoOstuni 0:75fc82583a41 74 *
DiegoOstuni 0:75fc82583a41 75 * Checks if the given register is valid and if so, writes the value(s)
DiegoOstuni 0:75fc82583a41 76 * on the RF Chip register
DiegoOstuni 0:75fc82583a41 77 *
DiegoOstuni 0:75fc82583a41 78 * \param[in] reg: register address to be written, or the first if len > 1
DiegoOstuni 0:75fc82583a41 79 * \param[in] values: pointer with content to be written on the register(s)
DiegoOstuni 0:75fc82583a41 80 * \param[in] len: number of consecutive registers to be written
DiegoOstuni 0:75fc82583a41 81 *
DiegoOstuni 0:75fc82583a41 82 *
DiegoOstuni 0:75fc82583a41 83 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 84 * \return ERR_NONE Write done with no error
DiegoOstuni 0:75fc82583a41 85 *****************************************************************************
DiegoOstuni 0:75fc82583a41 86 */
DiegoOstuni 0:75fc82583a41 87 ReturnCode rfalChipWriteReg( uint16_t reg, uint8_t* values, uint8_t len, SPI * mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 88
DiegoOstuni 0:75fc82583a41 89 /*!
DiegoOstuni 0:75fc82583a41 90 *****************************************************************************
DiegoOstuni 0:75fc82583a41 91 * \brief Reads a register on the RF Chip
DiegoOstuni 0:75fc82583a41 92 *
DiegoOstuni 0:75fc82583a41 93 * Checks if the given register is valid and if so, reads the value(s)
DiegoOstuni 0:75fc82583a41 94 * of the RF Chip register(s)
DiegoOstuni 0:75fc82583a41 95 *
DiegoOstuni 0:75fc82583a41 96 * \param[in] reg: register address to be read, or the first if len > 1
DiegoOstuni 0:75fc82583a41 97 * \param[out] values: pointer where the register(s) read content will be placed
DiegoOstuni 0:75fc82583a41 98 * \param[in] len: number of consecutive registers to be read
DiegoOstuni 0:75fc82583a41 99 *
DiegoOstuni 0:75fc82583a41 100 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 101 * \return ERR_NONE Read done with no error
DiegoOstuni 0:75fc82583a41 102 *****************************************************************************
DiegoOstuni 0:75fc82583a41 103 */
DiegoOstuni 0:75fc82583a41 104 ReturnCode rfalChipReadReg( uint16_t reg, uint8_t* values, uint8_t len, SPI * mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 105
DiegoOstuni 0:75fc82583a41 106 /*!
DiegoOstuni 0:75fc82583a41 107 *****************************************************************************
DiegoOstuni 0:75fc82583a41 108 * \brief Change a register on the RF Chip
DiegoOstuni 0:75fc82583a41 109 *
DiegoOstuni 0:75fc82583a41 110 * Change the value of the register bits on the RF Chip Test set in the valueMask.
DiegoOstuni 0:75fc82583a41 111 *
DiegoOstuni 0:75fc82583a41 112 * \param[in] reg: register address to be modified
DiegoOstuni 0:75fc82583a41 113 * \param[in] valueMask: mask value of the register bits to be changed
DiegoOstuni 0:75fc82583a41 114 * \param[in] value: register value to be set
DiegoOstuni 0:75fc82583a41 115 *
DiegoOstuni 0:75fc82583a41 116 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 117 * \return ERR_OK Change done with no error
DiegoOstuni 0:75fc82583a41 118 *****************************************************************************
DiegoOstuni 0:75fc82583a41 119 */
DiegoOstuni 0:75fc82583a41 120 ReturnCode rfalChipChangeRegBits( uint16_t reg, uint8_t valueMask, uint8_t value, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 121
DiegoOstuni 0:75fc82583a41 122 /*!
DiegoOstuni 0:75fc82583a41 123 *****************************************************************************
DiegoOstuni 0:75fc82583a41 124 * \brief Writes a Test register on the RF Chip
DiegoOstuni 0:75fc82583a41 125 *
DiegoOstuni 0:75fc82583a41 126 * Writes the value on the RF Chip Test register
DiegoOstuni 0:75fc82583a41 127 *
DiegoOstuni 0:75fc82583a41 128 * \param[in] reg: register address to be written
DiegoOstuni 0:75fc82583a41 129 * \param[in] value: value to be written on the register
DiegoOstuni 0:75fc82583a41 130 *
DiegoOstuni 0:75fc82583a41 131 *
DiegoOstuni 0:75fc82583a41 132 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 133 * \return ERR_NONE Write done with no error
DiegoOstuni 0:75fc82583a41 134 *****************************************************************************
DiegoOstuni 0:75fc82583a41 135 */
DiegoOstuni 0:75fc82583a41 136 ReturnCode rfalChipWriteTestReg( uint16_t reg, uint8_t value, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 137
DiegoOstuni 0:75fc82583a41 138 /*!
DiegoOstuni 0:75fc82583a41 139 *****************************************************************************
DiegoOstuni 0:75fc82583a41 140 * \brief Reads a Test register on the RF Chip
DiegoOstuni 0:75fc82583a41 141 *
DiegoOstuni 0:75fc82583a41 142 * Reads the value of the RF Chip Test register
DiegoOstuni 0:75fc82583a41 143 *
DiegoOstuni 0:75fc82583a41 144 * \param[in] reg: register address to be read
DiegoOstuni 0:75fc82583a41 145 * \param[out] value: pointer where the register content will be placed
DiegoOstuni 0:75fc82583a41 146 *
DiegoOstuni 0:75fc82583a41 147 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 148 * \return ERR_NONE Read done with no error
DiegoOstuni 0:75fc82583a41 149 *****************************************************************************
DiegoOstuni 0:75fc82583a41 150 */
DiegoOstuni 0:75fc82583a41 151 ReturnCode rfalChipReadTestReg( uint16_t reg, uint8_t* value );
DiegoOstuni 0:75fc82583a41 152
DiegoOstuni 0:75fc82583a41 153 /*!
DiegoOstuni 0:75fc82583a41 154 *****************************************************************************
DiegoOstuni 0:75fc82583a41 155 * \brief Change a Test register on the RF Chip
DiegoOstuni 0:75fc82583a41 156 *
DiegoOstuni 0:75fc82583a41 157 * Change the value of the register bits on the RF Chip Test set in the valueMask.
DiegoOstuni 0:75fc82583a41 158 *
DiegoOstuni 0:75fc82583a41 159 * \param[in] reg: test register address to be modified
DiegoOstuni 0:75fc82583a41 160 * \param[in] valueMask: mask value of the register bits to be changed
DiegoOstuni 0:75fc82583a41 161 * \param[in] value: register value to be set
DiegoOstuni 0:75fc82583a41 162 *
DiegoOstuni 0:75fc82583a41 163 * \return ERR_PARAM Invalid register or bad request
DiegoOstuni 0:75fc82583a41 164 * \return ERR_OK Change done with no error
DiegoOstuni 0:75fc82583a41 165 *****************************************************************************
DiegoOstuni 0:75fc82583a41 166 */
DiegoOstuni 0:75fc82583a41 167 ReturnCode rfalChipChangeTestRegBits( uint16_t reg, uint8_t valueMask, uint8_t value, SPI* mspiChannel, ST25R3911* mST25,
DiegoOstuni 0:75fc82583a41 168 DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 169
DiegoOstuni 0:75fc82583a41 170 /*!
DiegoOstuni 0:75fc82583a41 171 *****************************************************************************
DiegoOstuni 0:75fc82583a41 172 * \brief Execute command on the RF Chip
DiegoOstuni 0:75fc82583a41 173 *
DiegoOstuni 0:75fc82583a41 174 * Checks if the given command is valid and if so, executes it on
DiegoOstuni 0:75fc82583a41 175 * the RF Chip
DiegoOstuni 0:75fc82583a41 176 *
DiegoOstuni 0:75fc82583a41 177 * \param[in] cmd: direct command to be executed
DiegoOstuni 0:75fc82583a41 178 *
DiegoOstuni 0:75fc82583a41 179 * \return ERR_PARAM Invalid command or bad request
DiegoOstuni 0:75fc82583a41 180 * \return ERR_NONE Direct command executed with no error
DiegoOstuni 0:75fc82583a41 181 *****************************************************************************
DiegoOstuni 0:75fc82583a41 182 */
DiegoOstuni 0:75fc82583a41 183 ReturnCode rfalChipExecCmd( uint16_t cmd, SPI * mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 );
DiegoOstuni 0:75fc82583a41 184
DiegoOstuni 0:75fc82583a41 185
DiegoOstuni 0:75fc82583a41 186 #endif /* RFAL_CHIP_H */
DiegoOstuni 0:75fc82583a41 187
DiegoOstuni 0:75fc82583a41 188 /**
DiegoOstuni 0:75fc82583a41 189 * @}
DiegoOstuni 0:75fc82583a41 190 *
DiegoOstuni 0:75fc82583a41 191 * @}
DiegoOstuni 0:75fc82583a41 192 *
DiegoOstuni 0:75fc82583a41 193 * @}
DiegoOstuni 0:75fc82583a41 194 */