cache_init

Synopsis

    #include "da_cache.h"
    
    void cache_init( nid_t node );
    int cache_write( unsigned short addr, unsigned short value );
    int cache_writev( unsigned short a, unsigned short n_bytes,
                      char *data );
    int cache_lwrite( unsigned short addr, unsigned long value );
    int cache_fwrite( unsigned short addr, float value );
    unsigned short cache_read( unsigned short addr );
    unsigned short cache_readv( unsigned short a, unsigned short l,
                                char *data );
    unsigned long cache_lread( unsigned short addr );
    float cache_fread( unsigned short addr );
    int cache_quit( void );
    

Description

These routines provide access to the da_cache driver. cache_init() identifies the node on which the da_cache driver is located. If cache_init() is not called, the driver will be sought on the local node.

cache_*write*() sets the value at the specified address(es). If the address is within the hardware address range specified when the driver was started, the value is masked with CACHE_HW_MASK and then written out to the subbus address. If there is no acknowledge from the hardware, the cached value is or-ed with CACHE_NACK_MASK, which can be checked on read. The l and f versions call cache_writev() with appropriate arguments.

cache_*read*() reads the stored value for the specified address. It does not touch hardware, even for addresses within the hardware range. The l and f versions call cache_readv() with appropriate arguments.

cache_quit() sends a quit request to a resident cache driver.

All of these functions use the standard nortlib client/server routines, which means their behaviour can by modified by setting nl_response, but the default response is set to "warn", soyou'll need to check your return codes.

Returns

cache_*write*(), cache_readv() and cache_quit() return the following status codes defined in da_cache.h:

cache_*read() returns the value associated with the specified address. If the address is invalid, ~0 is returned. Values for hardware addresses will include acknowledge information in the CACHE_NACK_MASK bit. It is fairly easy to confuse the invalid return values with data values, particularly for the l and f versions.

See Also

da_cache driver.

Source File

/usr/local/src/nortlib/cache.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College