Files

32 lines
687 B
C

/*
* Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
*
* SPDX-License-Identifier: MIT
*/
#ifndef RISCV_PMA_H
#define RISCV_PMA_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Attr setting, N320 HW default setting is cacheable
* Priority: NON Cache > Cache > Device
*/
#define PMA_ENABLE (1 << 0)
#define PMA_DEVICE (1 << 1)
#define PMA_NON_CACHE (1 << 2)
/*
* start_address, alignment is 4K
* mask, mask = ~(size - 1)
* atrr, default is cacheable, NON_CACHE: PMA_ENABLE | PMA_NON_CACHE
*/
void set_region_mem_attr(int idx, uint32_t start_addr, uint32_t mask, uint8_t attr);
void disable_region_attr(int idx);
#endif