| 1 |
3 |
martin |
/*
|
| 2 |
|
|
Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
|
| 3 |
|
|
Technical University of Denmark, DTU Informatics.
|
| 4 |
|
|
All rights reserved.
|
| 5 |
|
|
|
| 6 |
|
|
Redistribution and use in source and binary forms, with or without
|
| 7 |
|
|
modification, are permitted provided that the following conditions are met:
|
| 8 |
|
|
|
| 9 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
| 10 |
|
|
this list of conditions and the following disclaimer.
|
| 11 |
|
|
|
| 12 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
| 13 |
|
|
notice, this list of conditions and the following disclaimer in the
|
| 14 |
|
|
documentation and/or other materials provided with the distribution.
|
| 15 |
|
|
|
| 16 |
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
|
| 17 |
|
|
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 18 |
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
| 19 |
|
|
NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
| 20 |
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 21 |
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 22 |
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 23 |
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 24 |
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 25 |
|
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 26 |
|
|
|
| 27 |
|
|
The views and conclusions contained in the software and documentation are
|
| 28 |
|
|
those of the authors and should not be interpreted as representing official
|
| 29 |
|
|
policies, either expressed or implied, of the copyright holder.
|
| 30 |
|
|
*/
|
| 31 |
|
|
|
| 32 |
4 |
martin |
package com.muvium.leros;
|
| 33 |
3 |
martin |
|
| 34 |
|
|
/**
|
| 35 |
4 |
martin |
* Interface to low-level IO devices. Only IO devices are
|
| 36 |
|
|
* accessible, not memory.
|
| 37 |
3 |
martin |
*
|
| 38 |
4 |
martin |
* Similar to the JOP native interface.
|
| 39 |
3 |
martin |
* @author martin
|
| 40 |
4 |
martin |
*
|
| 41 |
3 |
martin |
*/
|
| 42 |
4 |
martin |
public class Native {
|
| 43 |
|
|
|
| 44 |
5 |
martin |
public final static int LED_PORT = 0;
|
| 45 |
|
|
public final static int BUTTON_PORT = 0;
|
| 46 |
8 |
martin |
public final static int UART_STATUS = 2;
|
| 47 |
|
|
public final static int UART_DATA = 3;
|
| 48 |
4 |
martin |
/**
|
| 49 |
|
|
* Read from an IO device.
|
| 50 |
|
|
* Only 8 bit address and 16 bit data are used.
|
| 51 |
|
|
* @param address
|
| 52 |
|
|
* @return
|
| 53 |
|
|
*/
|
| 54 |
|
|
public static native int rd(int address);
|
| 55 |
|
|
/**
|
| 56 |
|
|
* Write to an IO device.
|
| 57 |
|
|
* Only 8 bit address and 16 bit data are used.
|
| 58 |
|
|
* @param data
|
| 59 |
|
|
* @param address
|
| 60 |
|
|
*/
|
| 61 |
|
|
public static native void wr(int data, int address);
|
| 62 |
3 |
martin |
}
|