Copyright script applied to all sources in the radio directory

This commit is contained in:
Bertrand Songis
2015-12-23 19:57:13 +01:00
parent 0f1ccc993e
commit 97d59cfa56
335 changed files with 4423 additions and 9280 deletions
+20 -228
View File
@@ -1,231 +1,23 @@
/**
******************************************************************************
* @file stm32f4_discovery_sdio_sd.c
* @author MCD Application Team
* @version V1.0.2
* @date 05-March-2012
* @brief This file provides a set of functions needed to manage the SDIO SD
* Card memory mounted on STM32F4 Discovery board.
*
*
* @verbatim
*
* ===================================================================
* How to use this driver
* ===================================================================
* It implements a high level communication layer for read and write
* from/to this memory. The needed STM32 hardware resources (SDIO and
* GPIO) are defined in stm32f4_discovery.h file, and the initialization is
* performed in SD_LowLevel_Init() function declared in stm32f4_discovery.c
* file.
* You can easily tailor this driver to any other development board,
* by just adapting the defines for hardware resources and
* SD_LowLevel_Init() function.
*
* A - SD Card Initialization and configuration
* ============================================
* - To initialize the SD Card, use the SD_Init() function. It
* Initializes the SD Card and put it into StandBy State (Ready
* for data transfer). This function provide the following operations:
*
* 1 - Apply the SD Card initialization process at 400KHz and check
* the SD Card type (Standard Capacity or High Capacity). You
* can change or adapt this frequency by adjusting the
* "SDIO_INIT_CLK_DIV" define inside the stm32f4_discovery.h file.
* The SD Card frequency (SDIO_CK) is computed as follows:
*
* +---------------------------------------------+
* | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) |
* +---------------------------------------------+
*
* In initialization mode and according to the SD Card standard,
* make sure that the SDIO_CK frequency don't exceed 400KHz.
*
* 2 - Get the SD CID and CSD data. All these information are
* managed by the SDCardInfo structure. This structure provide
* also ready computed SD Card capacity and Block size.
*
* 3 - Configure the SD Card Data transfer frequency. By Default,
* the card transfer frequency is set to 24MHz. You can change
* or adapt this frequency by adjusting the "SDIO_TRANSFER_CLK_DIV"
* define inside the stm32f4_discovery.h file.
* The SD Card frequency (SDIO_CK) is computed as follows:
*
* +---------------------------------------------+
* | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) |
* +---------------------------------------------+
*
* In transfer mode and according to the SD Card standard,
* make sure that the SDIO_CK frequency don't exceed 25MHz
* and 50MHz in High-speed mode switch.
* To be able to use a frequency higher than 24MHz, you should
* use the SDIO peripheral in bypass mode. Refer to the
* corresponding reference manual for more details.
*
* 4 - Select the corresponding SD Card according to the address
* read with the step 2.
*
* 5 - Configure the SD Card in wide bus mode: 4-bits data.
*
* B - SD Card Read operation
* ==========================
* - You can read SD card by using two function: SD_ReadBlock() and
* SD_ReadMultiBlocks() functions. These functions support only
* 512-byte block length.
* - The SD_ReadBlock() function read only one block (512-byte). This
* function can transfer the data using DMA controller or using
* polling mode. To select between DMA or polling mode refer to
* "SD_DMA_MODE" or "SD_POLLING_MODE" inside the stm32f4_discovery_sdio_sd.h
* file and uncomment the corresponding line. By default the SD DMA
* mode is selected
* - The SD_ReadMultiBlocks() function read only mutli blocks (multiple
* of 512-byte).
* - Any read operation should be followed by two functions to check
* if the DMA Controller and SD Card status.
* - SD_ReadWaitOperation(): this function insure that the DMA
* controller has finished all data transfer.
* - SD_GetStatus(): to check that the SD Card has finished the
* data transfer and it is ready for data.
*
* - The DMA transfer is finished by the SDIO Data End interrupt.
* User has to call the SD_ProcessIRQ() function inside the SDIO_IRQHandler()
* and SD_ProcessDMAIRQ() function inside the DMA2_Streamx_IRQHandler().
* Don't forget to enable the SDIO_IRQn and DMA2_Stream3_IRQn or
* DMA2_Stream6_IRQn interrupts using the NVIC controller.
*
* C - SD Card Write operation
* ===========================
* - You can write SD card by using two function: SD_WriteBlock() and
* SD_WriteMultiBlocks() functions. These functions support only
* 512-byte block length.
* - The SD_WriteBlock() function write only one block (512-byte). This
* function can transfer the data using DMA controller or using
* polling mode. To select between DMA or polling mode refer to
* "SD_DMA_MODE" or "SD_POLLING_MODE" inside the stm32f4_discovery_sdio_sd.h
* file and uncomment the corresponding line. By default the SD DMA
* mode is selected
* - The SD_WriteMultiBlocks() function write only mutli blocks (multiple
* of 512-byte).
* - Any write operation should be followed by two functions to check
* if the DMA Controller and SD Card status.
* - SD_ReadWaitOperation(): this function insure that the DMA
* controller has finished all data transfer.
* - SD_GetStatus(): to check that the SD Card has finished the
* data transfer and it is ready for data.
*
* - The DMA transfer is finished by the SDIO Data End interrupt.
* User has to call the SD_ProcessIRQ() function inside the SDIO_IRQHandler()
* and SD_ProcessDMAIRQ() function inside the DMA2_Streamx_IRQHandler().
* Don't forget to enable the SDIO_IRQn and DMA2_Stream3_IRQn or
* DMA2_Stream6_IRQn interrupts using the NVIC controller.
*
*
* D - SD card status
* ==================
* - At any time, you can check the SD Card status and get the SD card
* state by using the SD_GetStatus() function. This function checks
* first if the SD card is still connected and then get the internal
* SD Card transfer state.
* - You can also get the SD card SD Status register by using the
* SD_SendSDStatus() function.
*
* E - Programming Model (Selecting DMA for SDIO data Transfer)
* ============================================================
* Status = SD_Init(); // Initialization Step as described in section A
*
* // SDIO Interrupt ENABLE
* NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
* NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
* NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
* NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
* NVIC_Init(&NVIC_InitStructure);
* // DMA2 STREAMx Interrupt ENABLE
* NVIC_InitStructure.NVIC_IRQChannel = SD_SDIO_DMA_IRQn;
* NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
* NVIC_Init(&NVIC_InitStructure);
*
* // Write operation as described in Section C
* Status = SD_WriteBlock(buffer, address, 512);
* Status = SD_WaitWriteOperation();
* while(SD_GetStatus() != SD_TRANSFER_OK);
*
* Status = SD_WriteMultiBlocks(buffer, address, 512, NUMBEROFBLOCKS);
* Status = SD_WaitWriteOperation();
* while(SD_GetStatus() != SD_TRANSFER_OK);
*
* // Read operation as described in Section B
* Status = SD_ReadBlock(buffer, address, 512);
* Status = SD_WaitReadOperation();
* while(SD_GetStatus() != SD_TRANSFER_OK);
*
* Status = SD_ReadMultiBlocks(buffer, address, 512, NUMBEROFBLOCKS);
* Status = SD_WaitReadOperation();
* while(SD_GetStatus() != SD_TRANSFER_OK);
*
* - Add the SDIO and DMA2 StreamX (3 or 6) IRQ Handlers:
* void SDIO_IRQHandler(void)
* {
* SD_ProcessIRQ();
* }
* void SD_SDIO_DMA_IRQHANDLER(void)
* {
* SD_ProcessDMAIRQ();
* }
*
* F - Programming Model (Selecting Polling for SDIO data Transfer)
* ================================================================
* //Only SD Card Single Block operation are managed.
* Status = SD_Init(); // Initialization Step as described in section
*
* // Write operation as described in Section C
* Status = SD_WriteBlock(buffer, address, 512);
*
* // Read operation as described in Section B
* Status = SD_ReadBlock(buffer, address, 512);
*
* STM32 SDIO Pin assignment
* =========================
* +-----------------------------------------------------------+
* | Pin assignment |
* +-----------------------------+---------------+-------------+
* | STM32 SDIO Pins | SD | Pin |
* +-----------------------------+---------------+-------------+
* | SDIO D2 | D2 | 1 |
* | SDIO D3 | D3 | 2 |
* | SDIO CMD | CMD | 3 |
* | | VCC | 4 (3.3 V)|
* | SDIO CLK | CLK | 5 |
* | | GND | 6 (0 V) |
* | SDIO D0 | D0 | 7 |
* | SDIO D1 | D1 | 8 |
* +-----------------------------+---------------+-------------+
*
* @endverbatim
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
PATCHED BY CLIVE SOURCER32@GMAIL.COM TO SUPPORT MEDIA >4GB 21-JUN-2012
******************************************************************************
*/
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Includes ------------------------------------------------------------------*/
#include "../horus/sdio_sd.h"