# Forum: ARM programming with GCC/GNU tools EFSL + AT91SAM7X+ hwinterface

 Author: Flying Arm (flying) Posted on: 2007-06-14 11:03

Rate this post
 0 ▲ useful ▼ not useful
Hi

I am working on EFSL and trying to port this on to my Olimex board
SAM7-EX256.

I am using a microsd card with an adapter.

I did all the necessary SPI functions.

I checked even the sd card pins, and the chip selct pin shows signals
like low, high, low and there are signals on other pins as well.

Now i am not sure if i need to change anything in the header file
arm_spi.h.

I observed all the examples provided with EFSL but didn't find any
information.

But according to the manual of EFSL we need to configure the .c and .h
files to suit our hardware after choosing and defining the Hardware
endpoint.

The structure 'hwinterface' doesn't have anything here so my question
is:
Do i need to change or add anything to this structure because as far as
i observed the file system in all source files efs_init is done by
passing a pointer of type hwinterface and if yes how i can defind this.

My arm_spi.h is as follows:

/***********************************************************************
******\
*              efs - General purpose Embedded Filesystem library
*
*          --------------------- -----------------------------------
*
*
*
* Filename    : arm_spi.h
*
* Description : Headerfile for at91_spi.c and lpc2000_spi.c
*
*
*
* This program is free software; you can redistribute it and/or
*
* modify it under the terms of the GNU General Public License
*
*
*
*
* This program is distributed in the hope that it will be useful,
*
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*
* GNU General Public License for more details.
*
*
*
* As a special exception, if other files instantiate templates or
*
* use macros or inline functions from this file, or you compile this
*
* file and link it with other works to produce a work based on this
file,     *
* this file does not by itself cause the resulting work to be covered
*
* by the GNU General Public License. However the source code for this
*
* file must still be made available in accordance with section (3) of
*
* the GNU General Public License.
*
*
*
* This exception does not invalidate any other reasons why a work based
*
* on this file might be covered by the GNU General Public License.
*
*
*
*                        AT91 and LPC2000 Interfaces (c)2005 Martin
Thomas    *
\***********************************************************************
******/

#ifndef _ARM_SPI_H
#define _ARM_SPI_H

#ifndef FALSE
#define FALSE  0x00
#define TRUE  0x01
#endif

#include "../debug.h"
#include "../../conf/config.h"

/*************************************************************\
hwInterface
----------
FILE   imagefile    File emulation of hw interface.
* long    sectorCount    Number of sectors on the file.
\*************************************************************/
struct  hwInterface{
/*FILE   *imageFile;*/
eint32    sectorCount;
};
typedef struct hwInterface hwInterface;

esint8 if_initInterface(hwInterface* file,eint8* opts);

esint8 if_getDriveSize(hwInterface *iface, euint32* drive_size );

void if_spiInit(hwInterface *iface);
euint8 if_spiSend(hwInterface *iface, euint8 outgoing);
void if_spiSelectDevice(hwInterface *iface);
void if_spiUnselectDevice(hwInterface *iface);

void if_spiSetSpeed(euint8 speed);

#endif

If anyone of you had success with EFSL porting onto AT91SAM7X256 or
working with this please give me your suggestions to fix this problem.

Regards
Flying

• $formula (LaTeX syntax)$