/**
 * \file    osdrv_mcspi.h
 *
 * \brief   McPI Driver header file.
*/

/*
 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
 */

#ifndef _OSDRV_MCSPI_H
#define _OSDRV_MCSPI_H
/* ========================================================================== */
/*                             Include Files                                  */
/* ========================================================================== */
#include "stdio.h"
#include "hw_types.h"
#include "hw_mcspi.h"
#include "mcspi.h"
#include "hw_cm_per.h"
#include "plat_mcspi.h"
#include "plat_delay.h"
/* ========================================================================== */
/*                           Macros & Typedefs                                */
/* ========================================================================== */

/* ========================================================================== */
/*                         Structures and Enums                               */
/* ========================================================================== */

/* ========================================================================== */
/*                            Global Variables Declarations                   */
/* ========================================================================== */


/* ========================================================================== */
/*                          Function Declarations                             */
/* ========================================================================== */
/**
 * \brief   Initialize the given McSPI instance in master mode.
 *
 * \param   spiId        [IN]   API Instance number
 * \param   spiClockDiv  [IN]   SPI Clck divider.
 * \param   spiDir       [IN]   
 * \param   chMode       [IN]   Channel mode
 *
 *          Can take the following values
 *                      MCSPI_SINGLE_CH
 *                      MCSPI_MULTI_CH
 * \param   chNum        [IN]   Channel number
 *
 * 
 * \return  None.
 *
 **/
unsigned int McSPIInit(int spiId, unsigned char spiClockDiv, 
        unsigned char spiDir,unsigned int chMode, unsigned int chNum);
                       
/**
 * \brief   Reads data from the given McSPI instance from the selected slave 
 *
 * \param   spiId     [IN]      API Instance number
 * \param   buf       [OUT]     Buffer to whcih data to be copied.
 * \param   len       [IN]      Lengt of the data to be read.
 * \param   spiCs     [IN]      Chip select 
 *
 *
 * \return  None.
 *
 **/
void McSPIRead( int spiId, unsigned char *buf, 
                unsigned short len, unsigned short spiCs );                       
/**
 * \brief   Writes data to the selected McSPI slave 
 *
 * \param   spiId    [IN]       API Instance number
 * \param   buf      [IN]       Data to be written.
 * \param   len      [IN]       Lengt of the data to be read.
 * \param   spiCs    [IN]       Chip select 
 *
 *
 * \return  None.
 *
 **/                
void McSPIWrite( int spiId, unsigned char *buf,
                 unsigned short len, unsigned short spiCs );
#endif  //_OSDRV_MCSPI_H


