⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serialeeprom.c

📁 轻量嵌入JVM,可用于掌上设备手机等手持消息设备.
💻 C
字号:
/**************************************************************************************
*  SerialEEProm.c
*
*  This file implements all native methods declared in the SerialEEProm class.
*  IMPORTANT:
*       As there are many different types of serial EEPROMs this file contains only
*       function stubs. You will need to implement appropriate routines for
*       programming serial EEPROMs connected to the processor either via 3-wire bus
*       or IIC bus.
*
* NOTE:
*  Be careful when accessing the native methods arguments. If native method is
*  declared as static then the first argoment starts at index zero. Non-static native
*  methods have arguments starting at index one, while argument at index zero is
*  a reference to the object on which the method is being invoked.
**************************************************************************************
*
* This file is covered by the GNU GPL with the following exception:
*   As a special exception, the copyright holders of this library give you permission
*   to link this library with independent modules to produce an executable, regardless
*   of the license terms of these independent modules, and to copy and distribute the
*   resulting executable under terms of your choice, provided that you also meet, for
*   each linked independent module, the terms and conditions of the license of that
*   module. An independent module is a module which is not derived from or based on
*   this library. If you modify this library, you may extend this exception to your
*   version of the library, but you are not obligated to do so. If you do not wish
*   to do so, delete this exception statement from your version.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL RTJ COMPUTING BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Copyright (c) 2000-2002 RTJ Computing Pty. Ltd. All rights reserved.
**************************************************************************************/

#include "javavm.h"

extern vm_config_t vmconfig;

#define SERIAL_EEPROM_SIZE      0x0400


/****************************************************************************
* Verifies if the requested EEPROM memory area is valid.
*
* Java prototype:
*       protected static native boolean regionOk0(int start, int length);
*
****************************************************************************/
int16 javax_memory_SerialEEProm_regionOk0(int32 param[], int32 *retval)
{
    *retval = false;
    if (param[0] >= 0 && (param[0] + param[1]) < EEPROM_SIZE)
        *retval = true;
    return NO_EXCEP;
}

/****************************************************************************
* Writes a byte into serial EEPROM.
*
* Java prototype:
*       protected static native boolean writeByte0(int address, int value);
*
****************************************************************************/
int16 javax_memory_SerialEEProm_writeByte0(int32 param[], int32 *retval)
{
    *retval = true;
    // inplement here algorithm for programming a single byte

    return NO_EXCEP;
}

/****************************************************************************
* Readss a byte from serial EEPROM.
*
* Java prototype:
*       protected static native int readByte0(int Address);
*
****************************************************************************/
int16 javax_memory_SerialEEProm_writeByte0(int32 param[], int32 *retval)
{
    // inplement here algorithm for reading a single byte
//    *retval = something;

    return NO_EXCEP;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -