# drivers/sdmmc/card.c File Reference

SD/MMC card logic. More...

`#include <bitops.h>`
`#include <byteorder.h>`
`#include <debug.h>`
`#include <errno.h>`
`#include <stdbool.h>`
`#include <string.h>`
`#include <util.h>`
`#include <sdmmc/sdmmc.h>`
`#include "protocol.h"`

Include dependency graph for card.c:

Go to the source code of this file.

## Functions
void | sdmmc_decode_sd_cid (struct sdmmc_card *card, const be32_t *raw_cid)
| Decode SD card CID (Card Identification).
int | sdmmc_decode_mmc_cid (struct sdmmc_card *card, const be32_t *raw_cid)
| Decode MMC card CID (Card Identification).
int | sdmmc_decode_sd_csd (struct sdmmc_card *card, const be32_t *raw_csd)
| Decode SD card CSD (Card-Specific Data).
int | sdmmc_decode_mmc_csd (struct sdmmc_card *card, const be32_t *raw_csd)
| Decode MMC card CSD (Card-Specific Data).
void | sdmmc_card_update_timeouts (struct sdmmc_card *card, uint32_t mmc_hz)
| Update data timeout calculations.

## Detailed Description

SD/MMC card logic.

SD/MMC card logic providing utility functions to analyze card information.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file card.c.

## Function Documentation

void sdmmc_card_update_timeouts | ( | struct sdmmc_card * | card,
|  | uint32_t | mmc_hz |
| ) |  |  |

Update data timeout calculations.

Parameters:

  | card | Card to calculate timeout for
  | mmc_hz | The current frequence running on the slot

Definition at line 396 of file card.c.

int sdmmc_decode_mmc_cid | ( | struct sdmmc_card * | card,
|  | const be32_t * | raw_cid |
| ) |  |  |

Decode MMC card CID (Card Identification).

Parameters:

  | card | Card structure to fill data into
  | resp | Response from command requesting CID

Return values:

  | 0 | Success
  | <0 | decode failure

Definition at line 127 of file card.c.

References sdmmc_cid::application_id, sdmmc_cid::checksum, sdmmc_card::cid, sdmmc_card::csd, dbg_printf, extract_bitfield(), sdmmc_cid::manu_month, sdmmc_cid::manu_year, sdmmc_cid::manufacturer_id, sdmmc_csd::mmc_version, sdmmc_cid::name, sdmmc_cid::revision, and sdmmc_cid::serial.

Here is the call graph for this function:

int sdmmc_decode_mmc_csd | ( | struct sdmmc_card * | card,
|  | const be32_t * | raw_csd |
| ) |  |  |

Decode MMC card CSD (Card-Specific Data).

Parameters:

  | card | Card structure to fill data into
  | raw_csd | Response from command requesting CSD

Return values:

  | 0 | Success
  | <0 | decode failure

Definition at line 296 of file card.c.

References sdmmc_csd::can_read_misaligned, sdmmc_csd::can_read_partial, sdmmc_csd::can_write_misaligned, sdmmc_csd::can_write_partial, sdmmc_csd::capacity, sdmmc_csd::command_classes, sdmmc_card::csd, dbg_printf, extract_bitfield(), sdmmc_csd::max_transfer_rate, sdmmc_csd::mmc_version, sdmmc_csd::read_access_time_clks, sdmmc_csd::read_access_time_ns, sdmmc_csd::read_block_length, sdmmc_card_get_slot(), sdmmc_slot_update(), sdmmc_csd::write_block_length, and sdmmc_csd::write_speed_factor.

Here is the call graph for this function:

void sdmmc_decode_sd_cid | ( | struct sdmmc_card * | card,
|  | const be32_t * | raw_cid |
| ) |  |  |

Decode SD card CID (Card Identification).

Parameters:

  | card | Card structure to fill data into
  | resp | Response from command requesting CID

Definition at line 101 of file card.c.

References sdmmc_cid::application_id, sdmmc_cid::checksum, sdmmc_card::cid, extract_bitfield(), sdmmc_cid::manu_month, sdmmc_cid::manu_year, sdmmc_cid::manufacturer_id, sdmmc_cid::name, sdmmc_cid::revision, and sdmmc_cid::serial.

Here is the call graph for this function:

int sdmmc_decode_sd_csd | ( | struct sdmmc_card * | card,
|  | const be32_t * | raw_csd |
| ) |  |  |

Decode SD card CSD (Card-Specific Data).

Parameters:

  | card | Card structure to fill data into
  | raw_csd | Response from command requesting CSD

Return values:

  | 0 | Success
  | <0 | decode failure

Definition at line 207 of file card.c.

References sdmmc_csd::can_read_misaligned, sdmmc_csd::can_read_partial, sdmmc_csd::can_write_misaligned, sdmmc_csd::can_write_partial, sdmmc_csd::capacity, sdmmc_csd::command_classes, sdmmc_card::csd, dbg_printf, extract_bitfield(), sdmmc_csd::max_transfer_rate, sdmmc_csd::read_access_time_clks, sdmmc_csd::read_access_time_ns, sdmmc_csd::read_block_length, sdmmc_card_get_slot(), sdmmc_slot_update(), sdmmc_csd::write_block_length, and sdmmc_csd::write_speed_factor.

Here is the call graph for this function: