BIOS Reference - RAMBANK Functions

From NanoComputerWiki

Revision as of 06:24, 1 November 2008 by FlyingElectron (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

RAMBANK Module Functions

NanoComputer BIOS Reference

RAMBANK Module

Note: This information may be out of date. For the latest information always check the header files shipped with the NanoComputer SDK.

Last update: Oct 31 2008

// --------------------------------------------------
//  Defines
// --------------------------------------------------
    #define RAMBANK_APP_START_ADDRESS   0x4090

    #define RAMBANK_APP_ARGS_BUFFERSIZE 0x80

    #define RAMBANK_OS_BANK    0
    #define RAMBANK_APP0_BANK  1
    #define RAMBANK_APP1_BANK  2
    #define RAMBANK_APP2_BANK  3
    #define RAMBANK_APP3_BANK  4
    #define RAMBANK_BIOS_BANK  5
    #define RAMBANK_RESERVED0  6
    #define RAMBANK_RESERVED1  7

    #define RAMBANK_STATUS_FREE         0
    #define RAMBANK_STATUS_RESERVED     1

    #define E_RAMBANK_BUFFER_TOO_LARGE  -100
    #define E_RAMBANK_NONE_FREE         -101


    // Properties
    #define RAMBANK_PROP_STATUS_FLAG                        0x80
    #define RAMBANK_PROP_CURRENT_RAM_BANK                   PROP_RAMBANK + 0x01
    #define RAMBANK_PROP_RAMBANK_COUNT                      PROP_RAMBANK + 0x02
    #define RAMBANK_PROP_RAMBANK_OS_BANK_STATUS             PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_OS_BANK
    #define RAMBANK_PROP_RAMBANK_APP0_BANK_STATUS           PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_APP0_BANK
    #define RAMBANK_PROP_RAMBANK_APP1_BANK_STATUS           PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_APP1_BANK
    #define RAMBANK_PROP_RAMBANK_APP2_BANK_STATUS           PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_APP2_BANK
    #define RAMBANK_PROP_RAMBANK_APP3_BANK_STATUS           PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_APP3_BANK
    #define RAMBANK_PROP_RAMBANK_BIOS_BANK_STATUS           PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_BIOS_BANK
    #define RAMBANK_PROP_RAMBANK_RESERVED0_BANK_STATUS      PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_RESERVED0_BANK
    #define RAMBANK_PROP_RAMBANK_RESERVED1_BANK_STATUS      PROP_RAMBANK + RAMBANK_PROP_STATUS_FLAG + RAMBANK_RESERVED1_BANK


// --------------------------------------------------
//  Function Prototypes
// --------------------------------------------------
    /**
     * Executes a function in a remote RamBank
     *
     *  RamBankID        - [in]  ID of the RamBank the remote function is in
     *  Addr             - [in]  Address of the function inside the remote RamBank
     *
     *  E_OK on success, other error on failure.
     **/
    char RAMBANK_Exec(unsigned char RamBankID, unsigned short Addr);

    /**
     * Executes an application in a remote RamBank
     *
     *  RamBankID        - [in]  ID of the RamBank the remote function is in
     *  pBufferIn        - [in]  Buffer containing data to pass into the Application being executed
     *  BufferInSize     - [in]  Size of the pBufferIn buffer
     *  pBufferReturn    - [out] Buffer which will contain data passed back by the Application after it has been executed
     *  BufferReturnSize - [in]  Size of the pBufferReturn buffer
     *
     *  E_OK on success, other error on failure.
     **/
    char RAMBANK_ExecApp(unsigned char RamBankID, void* pBufferIn, unsigned short BufferInSize, void* pBufferReturn, unsigned short BufferReturnSize);

    /**
     * Copies data from a RamBank to a buffer
     *
     *  RamBankID - [in]  ID of the source RamBank
     *  Addr      - [in]  Address inside the source RamBank to read from
     *  Size      - [in]  Number of bytes to read
     *  pBuf      - [out] Buffer to copy bytes into
     *
     *  E_OK on success, other error on failure.
     **/
    char RAMBANK_Read(unsigned char RamBankID, unsigned short Addr, unsigned short Size, unsigned char* pBuf);

    /**
     * Writes data from a buffer to a RamBank
     *
     *  RamBankID - [in] ID of the destination RamBank
     *  Addr      - [in] Address inside the destination RamBank to write to
     *  Size      - [in] Number of bytes to write
     *  pBuf      - [in] Buffer to copy bytes from
     *
     *  E_OK on success, other error on failure.
     **/
    char RAMBANK_Write(unsigned char RamBankID, unsigned short Addr, unsigned short Size, unsigned char* pBuf);

Navigation

Click on any of the links below to navigate to a new page
Personal tools