Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
driver_examples/sdhc_sdcard/main.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fsl_clock_manager.h"
#include "fsl_os_abstraction.h"
#include "board.h"
#include "fsl_mpu_driver.h"
#include "fsl_sdhc_card.h"
#include "fsl_sdmmc_card.h"
#include "sdhc_sdcard.h"
#include "fsl_debug_console.h"

Macros

#define TEST_BLOCK_NUM
 
#define TEST_START_BLOCK
 

Enumerations

enum  test_result_t {
  kTestResultPassed,
  kTestResultFailed,
  kTestResultInitFailed,
  kTestResultAborted
}
 

Functions

static uint32_t fill_reference_data (uint8_t *pdata, uint8_t seed, uint32_t len)
 A function to fill a memory buffer of 'len' no of bytes with a reference data governed by a seed value. More...
 
static void show_card_cid (sdcard_cid_t *cid)
 Function to show few card information. More...
 
static float decode_taac (uint8_t taac)
 Function to decode card read access time '1' value. More...
 
static float decode_transpeed (uint8_t ts)
 Function to decode card data transfer speed. More...
 
static void show_card_csd (sdcard_csd_t *csd)
 Function to parse and show Card Specific Data fields. More...
 
static void show_card_scr (sdcard_scr_t *scr)
 Function to parse and show Card Configuration Register (CSR) fields. More...
 
static void show_card_info (sdhc_card_t *card, bool showDetail)
 Function to show Card informations. More...
 
void sdhc_card_detection (bool inserted)
 Function to indicate whether a card is detected or not. More...
 
void sdhc_cd_irqhandler (void)
 Function to be called from Card detection interrupt context etc. More...
 
static test_result_t demo_card_data_access (void)
 This function demonstrates read, write and erase functionalities of the card. More...
 
int main (void)
 Main demo function. More...
 

Variables

const char * monthStr []
 
static uint8_t refData [FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE]
 
static uint8_t testData [FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE]
 
static uint8_t refData2 [FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE *TEST_BLOCK_NUM]
 
static uint8_t testData2 [FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE *TEST_BLOCK_NUM]
 
static semaphore_t cd
 
static volatile uint32_t cardInserted
 
static volatile uint32_t cardInited
 

Macro Definition Documentation

#define TEST_BLOCK_NUM
#define TEST_START_BLOCK

Enumeration Type Documentation

Enumerator
kTestResultPassed 
kTestResultFailed 
kTestResultInitFailed 
kTestResultAborted 

Function Documentation

static float decode_taac ( uint8_t  taac)
static
static float decode_transpeed ( uint8_t  ts)
static
static test_result_t demo_card_data_access ( void  )
static
static uint32_t fill_reference_data ( uint8_t *  pdata,
uint8_t  seed,
uint32_t  len 
)
static
int main ( void  )

Function prototype for main function.

Parameters
receiveBuffBuffer used to hold received data

Return code from each SSD function

Address of the target location

Return protection status

Number of longword or phrase to be verified

0=normal, 1=user, 2=factory - margin read for reading

Indicate LED is brighter or dimmer

Use LPTMR in Time Counter mode

When hit compare value, set counter back to zero

bypass prescaler

use 1kHz Low Power Clock

void sdhc_card_detection ( bool  inserted)
void sdhc_cd_irqhandler ( void  )
static void show_card_cid ( sdcard_cid_t *  cid)
static
static void show_card_csd ( sdcard_csd_t *  csd)
static
static void show_card_info ( sdhc_card_t *  card,
bool  showDetail 
)
static
static void show_card_scr ( sdcard_scr_t *  scr)
static

Variable Documentation

volatile uint32_t cardInited
static

Flag to indicate the card has been initialized successfully

volatile uint32_t cardInserted
static

Flag to indicate a card has been inserted

semaphore_t cd
static

Semaphore for card detection indication

const char* monthStr[]
uint8_t refData[FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE]
static

Buffer to hold a reference data used for write/read/compare tests

uint8_t refData2[FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE *TEST_BLOCK_NUM]
static

Buffer to hold a reference data used for write/read/compare tests

uint8_t testData[FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE]
static

Buffer to reac back data from card for write/read/compare tests

uint8_t testData2[FSL_SDHC_CARD_DEFAULT_BLOCK_SIZE *TEST_BLOCK_NUM]
static

Buffer to reac back data from card for write/read/compare tests