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/spi_driver.c

    r283 r284  
    1 /**
    2  * \file    spi.c
    3  * \date    31 August 2012
    4  * \author  Cesar Fuguet <cesar.fuguet-tortolero@lip6.fr>
    5  */
     1///////////////////////////////////////////////////////////////////////////////////
     2// File     : spi_driver.c
     3// Date     : 31/08/2012
     4// Author   : cesar fuguet
     5// Copyright (c) UPMC-LIP6
     6///////////////////////////////////////////////////////////////////////////////////
    67#include <spi_driver.h>
    78#include <utils.h>
    89
    9 /**
    10  * \param   x: input value
    11  *
    12  * \return  byte-swapped value
    13  *
    14  * \brief   byte-swap a 32bit word
    15  */
     10///////////////////////////////////////////////////////////////////////////////
     11//      bswap32()
     12// This function makes a byte swap for a 4 bytes word
     13// Arguments are:
     14// - x : word
     15// Returns the word x swapped
     16///////////////////////////////////////////////////////////////////////////////
    1617static unsigned int bswap32(unsigned int x)
    1718{
     
    2425}
    2526
    26 /**
    27  * \param   spi :   Initialized pointer to the SPI controller
    28  *
    29  * \brief   Wait until the SPI controller has finished a transfer
    30  *
    31  * Wait until the GO_BUSY bit of the SPI controller be deasserted
    32  */
     27///////////////////////////////////////////////////////////////////////////////
     28//      _spi_wait_if_busy()
     29// This function returns when the SPI controller has finished a transfer
     30// Arguments are:
     31// - spi : initialized pointer to the SPI controller
     32///////////////////////////////////////////////////////////////////////////////
    3333static void _spi_wait_if_busy(struct spi_dev * spi)
    3434{
     
    4141}
    4242
    43 /**
    44  * \param   spi : Initialized pointer to the SPI controller
    45  *
    46  * \return  void
    47  *
    48  * \brief   Init transfer of the tx registers to the selected slaves
    49  */
     43///////////////////////////////////////////////////////////////////////////////
     44//      _spi_init_transfer()
     45// This function trigger transfer of the tx registers to the selected slaves
     46// Arguments are:
     47// - spi : initialized pointer to the SPI controller
     48///////////////////////////////////////////////////////////////////////////////
    5049static void _spi_init_transfer(struct spi_dev * spi)
    5150{
     
    5554}
    5655
    57 /**
    58  * \param   spi_freq    : Desired frequency for the generated clock from the SPI
    59  *                        controller
    60  * \param   sys_freq    : System clock frequency
    61  *
    62  * \brief   Calculated the value for the divider register in order to obtain the SPI
    63  *          desired clock frequency
    64  */
     56///////////////////////////////////////////////////////////////////////////////
     57//      _spi_calc_divider_value()
     58// This function computes the value for the divider register in order to obtain
     59// the SPI desired clock frequency
     60// - spi_freq : desired frequency for the generated clock from the SPI
     61//              controller
     62// - sys_freq : system clock frequency
     63// Returns the computed frequency
     64///////////////////////////////////////////////////////////////////////////////
    6565static unsigned int _spi_calc_divider_value( unsigned int spi_freq ,
    6666                                             unsigned int sys_freq )
     
    6969}
    7070
     71///////////////////////////////////////////////////////////////////////////////
     72//      spi_put_tx()
     73// This function writes a byte on the tx register and trigger transfert
     74// - spi  : initialized pointer to the SPI controller
     75// - byte : byte to write on tx register
     76// - index: index of the tx register
     77///////////////////////////////////////////////////////////////////////////////
    7178void spi_put_tx(struct spi_dev * spi, unsigned char byte, int index)
    7279{
     
    7986}
    8087
     88///////////////////////////////////////////////////////////////////////////////
     89//      spi_get_rx()
     90// This function reads a byte on the rx register
     91// - spi  : initialized pointer to the SPI controller
     92// - index: index of the rx register
     93// Returns the byte read
     94///////////////////////////////////////////////////////////////////////////////
    8195volatile unsigned char spi_get_rx(struct spi_dev * spi, int index)
    8296{
     
    8498}
    8599
     100///////////////////////////////////////////////////////////////////////////////
     101//      spi_get_data()
     102// This function reads count bytes and store them on a memory buffer
     103// - spi   : initialized pointer to the SPI controller
     104// - buffer: physical address of the buffer containing the read data
     105// - count : number of bytes to get (must be 512 bytes)
     106// Returns 0 if success and other value when failure
     107///////////////////////////////////////////////////////////////////////////////
    86108unsigned int spi_get_data( struct spi_dev * spi,
    87109                           paddr_t buffer      ,
     
    161183    }
    162184
    163 //reset_ctrl:
     185#if 0
     186reset_ctrl:
     187#endif
    164188
    165189    /* Switch back to original word size */
     
    169193}
    170194
     195///////////////////////////////////////////////////////////////////////////////
     196//      spi_ss_assert()
     197// This function enables a SPI slave
     198// - spi   : initialized pointer to the SPI controller
     199// - index : slave index
     200///////////////////////////////////////////////////////////////////////////////
    171201void spi_ss_assert(struct spi_dev * spi, int index)
    172202{
     
    176206}
    177207
     208///////////////////////////////////////////////////////////////////////////////
     209//      spi_ss_deassert()
     210// This function disables a SPI slave
     211// - spi   : initialized pointer to the SPI controller
     212// - index : slave index
     213///////////////////////////////////////////////////////////////////////////////
    178214void spi_ss_deassert(struct spi_dev * spi, int index)
    179215{
     
    183219}
    184220
     221///////////////////////////////////////////////////////////////////////////////
     222//      _spi_init()
     223// This function initializes the configuration register of SPI controller
     224// - spi      : initialized pointer to the SPI controller
     225// - spi_freq : SPI desired frequency (Hz)
     226// - sys_freq : system frequency (Hz)
     227// - char_len : bits per transfer
     228// - tx_edge  : if 1, transfer on positive edge
     229// - rx_edge  : if 1, latch received data on negative edge
     230///////////////////////////////////////////////////////////////////////////////
    185231void _spi_init ( struct spi_dev * spi,
    186232                 int spi_freq        ,
     
    205251}
    206252
    207 /*
    208  * vim: tabstop=4 : shiftwidth=4 : expandtab : softtabstop=4
    209  */
     253// Local Variables:
     254// tab-width: 4
     255// c-basic-offset: 4
     256// c-file-offsets:((innamespace . 0)(inline-open . 0))
     257// indent-tabs-mode: nil
     258// End:
     259// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
Note: See TracChangeset for help on using the changeset viewer.