STM8S/A Standard Peripherals Firmware Library
|
This file provides a set of functions needed to manage the SPI SD Card memory mounted on STM8xx-EVAL board (refer to stm8s_eval.h to know about the boards supporting this memory). It implements a high level communication layer for read and write from/to this memory. The needed STM8 hardware resources (SPI and GPIO) are defined in stm8xx_eval.h file, and the initialization is performed in SD_LowLevel_Init() function declared in stm8xx_eval.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. More...
#include "stm8s_eval_spi_sd.h"
Go to the source code of this file.
Functions | |
void | SD_DeInit (void) |
DeInitializes the SD/SD communication. | |
uint8_t | SD_Detect (void) |
Detect if SD card is correctly plugged in the memory slot. | |
uint8_t | SD_GetCardInfo (SD_CardInfo *cardinfo) |
Returns information about specific card. | |
uint8_t | SD_GetCIDRegister (SD_CID *SD_cid) |
Read the CID card register. | |
uint8_t | SD_GetCSDRegister (SD_CSD *SD_csd) |
Read the CSD card register. | |
uint8_t | SD_GetDataResponse (void) |
Get SD card data response. | |
uint8_t | SD_GetResponse (uint8_t Response) |
Returns the SD response. | |
uint16_t | SD_GetStatus (void) |
Returns the SD status. | |
uint8_t | SD_GoIdleState (void) |
Put SD in Idle state. | |
uint8_t | SD_Init (void) |
Initializes the SD/SD communication. | |
uint8_t | SD_ReadBlock (uint8_t *pBuffer, uint32_t ReadAddr, uint16_t BlockSize) |
Reads a block of data from the SD. | |
uint8_t | SD_ReadBuffer (uint8_t *pBuffer, uint32_t ReadAddr, uint32_t NumByteToRead) |
Read a buffer (many blocks) from the SD card. | |
uint8_t | SD_ReadByte (void) |
Read a byte from the SD. | |
void | SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc) |
Send 5 bytes command to the SD card. | |
uint8_t | SD_WriteBlock (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t BlockSize) |
Writes a block on the SD. | |
uint8_t | SD_WriteBuffer (uint8_t *pBuffer, uint32_t WriteAddr, uint32_t NumByteToWrite) |
Write a buffer (many blocks) in the SD card. | |
uint8_t | SD_WriteByte (uint8_t Data) |
Write a byte on the SD. |
Detailed Description
This file provides a set of functions needed to manage the SPI SD Card memory mounted on STM8xx-EVAL board (refer to stm8s_eval.h to know about the boards supporting this memory). It implements a high level communication layer for read and write from/to this memory. The needed STM8 hardware resources (SPI and GPIO) are defined in stm8xx_eval.h file, and the initialization is performed in SD_LowLevel_Init() function declared in stm8xx_eval.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.
- Author:
- MCD Application Team
- Version:
- V1.0.1
- Date:
- 30-September-2014 +-------------------------------------------------------+ | Pin assignment | +-------------------------+---------------+-------------+ | STM8 SPI Pins | SD | Pin | +-------------------------+---------------+-------------+ | SD_SPI_CS_PIN | ChipSelect | 1 | | SD_SPI_MOSI_PIN / MOSI | DataIn | 2 | | | GND | 3 (0 V) | | | VDD | 4 (3.3 V)| | SD_SPI_SCK_PIN / SCLK | Clock | 5 | | | GND | 6 (0 V) | | SD_SPI_MISO_PIN / MISO | DataOut | 7 | +-------------------------+---------------+-------------+
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.
Definition in file stm8s_eval_spi_sd.c.