f3s_close()

void f3s_close (f3s_socket_t *socket,
                uint32_t flags)

This function is called to close the socket. If you need to, you can disable the flash device and remove any programming voltage, etc.

The following flags are defined for the flags parameter in the socket functions:

F3S_POWER_VCC
Apply read power.
F3S_POWER_VPP
Apply program power.
F3S_OPER_SOCKET
Operation applies to socket given in socket_index.
F3S_OPER_WINDOW
Operation applies to window given in window_index.

The socket parameter is used for passing arguments and returning results from the socket services and for storing information about each socket. To handle complex interfaces such as PCMCIA, the structure has been defined so that there can be more than one socket; each socket can have more than one window. A simple linear flash array would have a single socket and no windows.

The socket structure is defined as:

typedef struct f3s_socket_s
{
  /*
   * these fields are initialized by the flash file system
   * and later validated and set by the socket services
   */
  uint16_t struct_size;    /* size of this structure */
  uint16_t status;         /* status of this structure */
  uint8_t *option;         /* option string from flashio */
  uint16_t socket_index;   /* index of socket */
  uint16_t window_index;   /* index of window */
  
  /*
   * these fields are initialized by the socket services and later
   * referenced by the flash file system
   */
  uint8_t *name;           /* name of driver */
  _Paddr64t address;       /* physical address 0 for allocated */
  uint32_t window_size;    /* size of window power of 2 mandatory */
  uint32_t array_offset;   /* offset of array 0 for based */
  uint32_t array_size;     /* size of array 0 for window_size */
  uint32_t unit_size;      /* size of unit 0 for probed */
  uint32_t flags;          /* flags for capabilities */
  uint16_t bus_width;      /* width of bus */
  uint16_t window_num;     /* number of windows 0 for not windowed */
  
  /*
   * these fields are initialized by the socket services and later
   * referenced by the socket services
   */
  uint8_t* memory;         /* access pointer for window memory */
  void *socket_handle;     /* socket handle pointer for external
                              library */
  void *window_handle;     /* window handle pointer for external
                              library */
  
  /*
   * this field is modified by the socket services as different window
   * pages are selected
   */
  uint32_t window_offset;  /* offset of window */
}
f3s_socket_t;

Here's a description of the fields:

option
Option string from command line; parse using the f3s_socket_option() function.
socket_index
Current socket.
window_index
Current window.
name
String containing name of driver.
address
Base address of flash array.
window_size
Size of window in bytes.
array_size
Size of array in bytes; 0 indicates unknown.
unit_size
Size of unit in bytes; 0 indicates probed.
flags
The flags field is currently unused.
bus_width
Width of the flash devices in bytes.
window_num
Number of windows in socket; 0 indicates non-windowed.
memory
Free for use by socket services; usually stores current window address.
socket_handle
Free for use by socket services; usually stores pointer to any extra data for socket.
window_handle
Free for use by socket services; usually stores pointer to any extra data for window.
window_offset
Offset of window from base of device in bytes.