SOLibraryConfig

C Specification

#include <revolution/so.h>
typedef  void*  ( *SOAlloc )( u32 name, s32 size );
typedef  void   ( *SOFree ) ( u32 name, void* ptr, s32 size );
typedef  struct SOLibraryConfig  SOLibraryConfig;
struct SOLibraryConfig
{
    SOAlloc   alloc;
    SOFree    free;
};

Description

The structure that defines the function to be called by the SO Library when actively allocating and deallocating work buffers. Specified when the SOInit function is called.

Note: See to it that a buffer aligned with a leading 32-byte border is allocated from MEM2 in the function specified in alloc. Furthermore, if the SO Library is operated from multiple threads, it is possible that alloc can be called multiple times at once. Perform exclusion control among threads among functions specifying alloc as needed for a multi-threaded application.

alloc Specifies the function called by the SO Library when actively allocating a work buffer.
Return the leading pointer to the allocated buffer as a return value. Return a null pointer when the buffer cannot be allocated.
The arguments called from the SO Library are as follows:
name Specifies the use of the buffer to be allocated.
SO_MEM_RESOLVER Used as the shared work area for the host information search function. Allocated when SOInit is called; deallocated when SOFinish is called.
SO_MEM_IPC Used as the work area for communication with the firmware. Allocation will be done appropriately each time communication with the firmware occurs.
SO_MEM_ADDRINFO Used as the area to store search results during host information search.
SO_MEM_RECVFROM Used as the temporary work area for loading data when data is being received. Allocation will be done as necessary for each data reception.
SO_MEM_SENDTO Used as the temporary work area for writing data when data is being sent. Allocation will be done as necessary for each data send.
size Specifies the size of the buffer to be allocated in bytes.
free Specifies the function called by the SO Library when deallocating a work buffer that was actively allocated.
The arguments called from the SO Library are as follows:
name The buffer to be deallocated is specified by the name specified at allocation.
ptr Specifies the leading pointer of the buffer to be deallocated.
size Specifies the size of the buffer to be deallocated in bytes.

See Also

SOInit
SOFinish

Revision History

2007/01/31 Initial version.


CONFIDENTIAL