<< Previous | Next >>

sf_initDevice

int sf_initDevice( sf_device * dev, int cs_port, char * cs_shadow, int cs_pin );

Description

Replaces sf_init().

The function sfspi_init() must be called before any calls to this function. Initializes serial flash chip. This function must be called before the serial flash can be used. Currently supported devices are:

  • AT45DB041

  • AT45DB081

  • AT45DB642

  • AR45DB1282

Parameters

dev
Pointer to an empty sf_device struct that will be filled in on return. The struct will then act as a handle for the device.

cs_port
I/O port for the active low chip select pin for the device.

cs_shadow
Pointer to the shadow variable for cs_port.

cs_pin
I/O port pin number for the chip select signal.

Return Value

 0 for success
-1if no flash chip detected
-2 if error communicating with flash chip
-3 if unknown flash chip type

Library

SFLASH.LIB


Dynamic C Functions << Previous | Next >> rabbit.com