1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13/** 14 * This interface defines presents an RPC interface to ia32 I/O ports. The 15 * camkes port configured with this interface should be connected using a 16 * HardwareIOPorts connector to a hardware component. 17 */ 18 19procedure IOPort { 20 include <stdint.h>; 21 22 uint8_t in8(in uint16_t ioport); 23 uint16_t in16(in uint16_t ioport); 24 uint32_t in32(in uint16_t ioport); 25 26 uint8_t in8_offset(in uint16_t offset); 27 uint16_t in16_offset(in uint16_t offset); 28 uint32_t in32_offset(in uint16_t offset); 29 30 void out8(in uint16_t ioport, in uint8_t value); 31 void out16(in uint16_t ioport, in uint16_t value); 32 void out32(in uint16_t ioport, in uint32_t value); 33 34 void out8_offset(in uint16_t offset, in uint8_t value); 35 void out16_offset(in uint16_t offset, in uint16_t value); 36 void out32_offset(in uint16_t offset, in uint32_t value); 37 38 /* This function is expected to return 0 if the given port does not fall in 39 * the addressable range of this interface, or non-zero if it does. 40 */ 41 int in_range(in unsigned int port); 42} 43