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#pragma once 14 15#include <platsupport/io.h> 16#include <stdint.h> 17#include <sel4/sel4.h> 18#include <camkes/error.h> 19#include <utils/attribute.h> 20 21#define IOSIZE_8 1 22#define IOSIZE_16 2 23#define IOSIZE_32 4 24 25/* Initialise an IO mapper for use with libplatsupport. Returns 0 on success. 26 */ 27int camkes_io_mapper(ps_io_mapper_t *mapper); 28 29/* Initialise an IO port accessor for use with libplatsupport. Returns 0 on 30 * success. 31 */ 32int camkes_io_port_ops(ps_io_port_ops_t *ops); 33 34/* Initialise an IO operations object for use with libplatsupport. Returns 0 on 35 * success. 36 */ 37int camkes_io_ops(ps_io_ops_t *ops); 38 39/* Initialise a malloc operations object for use with libplatsupport. Returns 0 40 * on success. 41 */ 42int camkes_ps_malloc_ops(ps_malloc_ops_t *ops); 43 44/* Initialise a FDT interface object for use with libplatsupport. Returns 0 45 * on success. 46 */ 47int camkes_io_fdt(ps_io_fdt_t *io_fdt); 48 49/* 50 * This struct describes an IO port region that is allocated by CAmkES. 51 * 52 * Instances of this struct is intended to be located inside a section in an ELF file. 53 */ 54struct ioport_region { 55 uint16_t start; 56 uint16_t end; 57 seL4_CPtr cap; 58 camkes_error_handler_t error_handler; 59 char **interface_name; 60}; 61typedef struct ioport_region ioport_region_t; 62 63/** 64 * Call registerd hardware modules initialization functions 65 * 66 * Some connectors register modules to be intialized by this call. 67 * 68 * Returns 0 on success 69 */ 70int camkes_call_hardware_init_modules(ps_io_ops_t *ops); 71