Ignore:
Timestamp:
Jan 31, 2014, 2:37:38 PM (10 years ago)
Author:
cfuguet
Message:

Modification of comments format on SPI-SDCARD driver to respect
GIET-VM format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/giet_vm_ioc_drivers/giet_drivers/sdc_driver.h

    r283 r284  
    1 /**
    2  * \file sdc_driver.h
    3  * \date 30 August 2012
    4  * \author Cesar fuguet <cesar.fuguet-tortolero@lip6.fr>
    5  *
    6  * This file defines the driver of a SD Card device using an SPI controller
    7  */
    8 
    9 #ifndef SDC_DRIVER_H
    10 #define SDC_DRIVER_H
     1///////////////////////////////////////////////////////////////////////////////////
     2// File     : sdc_driver.h
     3// Date     : 31/08/2012
     4// Author   : cesar fuguet
     5// Copyright (c) UPMC-LIP6
     6///////////////////////////////////////////////////////////////////////////////////
     7#ifndef _GIET_SDC_DRIVER_H_
     8#define _GIET_SDC_DRIVER_H_
    119
    1210#include <ioc_driver.h>
     
    1412#include <mapping_info.h>
    1513
    16 /**
    17  * \brief SD Card type definition
    18  */
     14///////////////////////////////////////////////////////////////////////////////
     15// SD card structure definition
     16///////////////////////////////////////////////////////////////////////////////
    1917struct sdcard_dev
    2018{
    21     /**
    22      * SPI controller pointer
    23      */
     19    // SPI controller pointer
    2420    struct spi_dev * spi;
    2521
    26     /**
    27      * Block length of the SDCARD
    28      */
     22    // block length of the SDCARD
    2923    unsigned int block_length;
    3024
    31     /**
    32      * Access pointer representing the offset in bytes used
    33      * to read or write in the SDCARD.
    34      *
    35      * \note this driver is for cards SDSD, therefore this offset
    36      *       must be multiple of the block length
    37      */
     25    // access pointer representing the offset in bytes used to read or write in
     26    // the SDCARD. This driver is for cards SDSD, therefore this offset must be
     27    // multiple of the block length
    3828    unsigned int access_pointer;
    3929
    40     /**
    41      * Slave ID. This ID represents the number of the slave select signal
    42      * used in the hardware platform (SPI channel)
    43      */
    44     int    slave_id;
     30    // slave ID. This ID represents the number of the slave select signal used
     31    // in the hardware platform (SPI channel)
     32    int slave_id;
    4533
    46     /* is the card high capacity ? */
     34    // is the card high capacity ?
    4735    int sdhc;
    4836};
     
    6856
    6957
    70 /**
    71  * SD Card constants
    72  */
     58///////////////////////////////////////////////////////////////////////////////
     59// SD card constants
     60///////////////////////////////////////////////////////////////////////////////
    7361
    74 /** Number of retries after an unacknowledge command */
    75 #define SDCARD_COMMAND_TIMEOUT      100
     62// Number of retries after an unacknowledge command
     63#define SDCARD_COMMAND_TIMEOUT  100
    7664
    77 /** This command is a simple SD commmand */
    78 #define SDCARD_CMD                  0
     65// This command is a simple SD commmand
     66#define SDCARD_CMD              0
    7967
    80 /** This is an application specific command */
    81 #define SDCARD_ACMD                 1
     68// This is an application specific command
     69#define SDCARD_ACMD             1
    8270
    83 /** The transmition is done in the negative edge of the clock */
    84 #define SDCARD_TX_NEGEDGE           0
     71// The transmition is done in the negative edge of the clock
     72#define SDCARD_TX_NEGEDGE       0
    8573
    86 /** The transmition is done in the positive edge of the clock */
    87 #define SDCARD_TX_POSEDGE           1
     74// The transmition is done in the positive edge of the clock
     75#define SDCARD_TX_POSEDGE       1
    8876
    89 /** The reception is done in the negative edge of the clock */
    90 #define SDCARD_RX_NEGEDGE           0
     77// The reception is done in the negative edge of the clock
     78#define SDCARD_RX_NEGEDGE       0
    9179
    92 /** The reception is done in the positive edge of the clock */
    93 #define SDCARD_RX_POSEDGE           1
     80// The reception is done in the positive edge of the clock
     81#define SDCARD_RX_POSEDGE       1
    9482
    95 /**
    96  * SD Card macros
    97  */
     83///////////////////////////////////////////////////////////////////////////////
     84// SD card macros
     85///////////////////////////////////////////////////////////////////////////////
    9886
    99 /** Check if the response is valid */
     87///////////////////////////////////////////////////////////////////////////////
     88//   SDCARD_CHECK_R1_VALID()
     89// This macro checks if the SD card response is valid
     90// - x: SD card response
     91// Returns 1 if valid and 0 otherwise
     92///////////////////////////////////////////////////////////////////////////////
    10093#define SDCARD_CHECK_R1_VALID(x)    (~x & SDCARD_R1_RSP_VALID) ? 1 : 0
    10194
    102 /**
    103  * Check if there is an error in the response
    104  *
    105  * \note this macro must be used after verify that the response is
    106  *       valid
    107  */
     95///////////////////////////////////////////////////////////////////////////////
     96//   SDCARD_CHECK_R1_ERROR()
     97// This macro checks if there is an error in SD card response
     98// - x: SD card response
     99// Returns 1 if error and 0 otherwise
     100///////////////////////////////////////////////////////////////////////////////
    108101#define SDCARD_CHECK_R1_ERROR(x)    ( x & 0x7E)                ? 1 : 0
    109102
    110 /**
    111  * SD Card Response 1 (R1) format constants
    112  */
    113 #define SDCARD_R1_IN_IDLE_STATE     ( 1 << 0 ) /**< \brief R1 bit 0 */
    114 #define SDCARD_R1_ERASE_RESET       ( 1 << 1 ) /**< \brief R1 bit 1 */
    115 #define SDCARD_R1_ILLEGAL_CMD       ( 1 << 2 ) /**< \brief R1 bit 2 */
    116 #define SDCARD_R1_COM_CRC_ERR       ( 1 << 3 ) /**< \brief R1 bit 3 */
    117 #define SDCARD_R1_ERASE_SEQ_ERR     ( 1 << 4 ) /**< \brief R1 bit 4 */
    118 #define SDCARD_R1_ADDRESS_ERR       ( 1 << 5 ) /**< \brief R1 bit 5 */
    119 #define SDCARD_R1_PARAMETER_ERR     ( 1 << 6 ) /**< \brief R1 bit 6 */
    120 #define SDCARD_R1_RSP_VALID         ( 1 << 7 ) /**< \brief R1 bit 7 */
     103// SD card response 1 (R1) format constants
     104#define SDCARD_R1_IN_IDLE_STATE     ( 1 << 0 ) // R1 bit 0
     105#define SDCARD_R1_ERASE_RESET       ( 1 << 1 ) // R1 bit 1
     106#define SDCARD_R1_ILLEGAL_CMD       ( 1 << 2 ) // R1 bit 2
     107#define SDCARD_R1_COM_CRC_ERR       ( 1 << 3 ) // R1 bit 3
     108#define SDCARD_R1_ERASE_SEQ_ERR     ( 1 << 4 ) // R1 bit 4
     109#define SDCARD_R1_ADDRESS_ERR       ( 1 << 5 ) // R1 bit 5
     110#define SDCARD_R1_PARAMETER_ERR     ( 1 << 6 ) // R1 bit 6
     111#define SDCARD_R1_RSP_VALID         ( 1 << 7 ) // R1 bit 7
    121112
    122113#endif
    123114
    124 /*
    125  * vim: tabstop=4 : shiftwidth=4 : expandtab : softtabstop=4
    126  */
     115// Local Variables:
     116// tab-width: 4
     117// c-basic-offset: 4
     118// c-file-offsets:((innamespace . 0)(inline-open . 0))
     119// indent-tabs-mode: nil
     120// End:
     121// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
Note: See TracChangeset for help on using the changeset viewer.