processor-sdk/libmetal.git
4 years agosystem:freertos:zynqmp_r5: correct io mem mapping master v2017.04
Wendy Liang [Wed, 1 Mar 2017 23:33:44 +0000 (15:33 -0800)]
system:freertos:zynqmp_r5: correct io mem mapping

This fix is to workaround the memory mapping in for ZynqMP_R5.

The root cause is in the libxil.a MPU region setting.
The base address for the region setitng in libxil is
calculated as this:

region_base = addr & ~(region_size - 1);
This will cause issue if the input addr address is
in the end of the region.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agosystem:generic:zynqmp_r5: correct io mem mapping
Wendy Liang [Wed, 1 Mar 2017 22:32:58 +0000 (14:32 -0800)]
system:generic:zynqmp_r5: correct io mem mapping

This fix is to workaround the memory mapping in for ZynqMP_R5.

The root cause is in the libxil.a MPU region setting.
The base address for the region setitng in libxil is
calculated as this:

region_base = addr & ~(region_size - 1);
This will cause issue if the input addr address is
in the end of the region.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agogeneric: zynq7: set the old_value init to FIQ and IRQ disabled
Wendy Liang [Tue, 21 Feb 2017 19:11:30 +0000 (11:11 -0800)]
generic: zynq7: set the old_value init to FIQ and IRQ disabled

There can be case that FIQ and IRQ are enabled by default.
And thus, set the old_value init to FIQ and IRQ disabled.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agogeneric: zynqmp_r5: set the old_value init to FIQ and IRQ disabled
Wendy Liang [Tue, 21 Feb 2017 17:57:39 +0000 (09:57 -0800)]
generic: zynqmp_r5: set the old_value init to FIQ and IRQ disabled

There can be case that FIQ and IRQ are enabled by default.
And thus, set the old_value init to FIQ and IRQ disabled.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoFixed linux_amp_demo to increment message counter on shutdown.
Sharbel Bousemaan [Tue, 14 Feb 2017 20:39:46 +0000 (15:39 -0500)]
Fixed linux_amp_demo to increment message counter on shutdown.

4 years agocmake: options: set default install bin/lib dir
Wendy Liang [Fri, 3 Feb 2017 18:04:35 +0000 (10:04 -0800)]
cmake: options: set default install bin/lib dir

In case CMAKE_INSTALL_BINDIR/LIBDIR not set, set with default
value

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agolib: fix install paths to work for multilib
Cyril Chemparathy [Fri, 3 Feb 2017 17:10:09 +0000 (09:10 -0800)]
lib: fix install paths to work for multilib

When running multilib builds on 64-bit platforms, the system library
paths need to be adjusted to either lib64/lib32, or lib64/lib in a
distro specific way.  This is handled via CMAKE_INSTALL_LIBDIR variable.

Signed-off-by: Cyril Chemparathy <cyril.chemparathy@xilinx.com>
4 years agotest: linux: threads: initialize return var
Wendy Liang [Tue, 17 Jan 2017 23:38:57 +0000 (15:38 -0800)]
test: linux: threads: initialize return var

in metal_run_noblock(), error is not initialized. In the end of
the function, it will return this var. 6.2 toolchain complains
the 'error" may be used uninitialized during compilation.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agotest: linux: shmem: remove unused vars
Wendy Liang [Tue, 17 Jan 2017 23:38:13 +0000 (15:38 -0800)]
test: linux: shmem: remove unused vars

Removed unused var shmem_count

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoCMake: lib/include/ instead of lib/ as include dir
Wendy Liang [Mon, 28 Nov 2016 22:11:55 +0000 (14:11 -0800)]
CMake: lib/include/ instead of lib/ as include dir

Using the lib/ as include directory when compiling the libmetal
can cause issues if the header files names conflict to those
in the system. And thus, need to use a different directory as the
include directory such that the headers in the lib/ will not be
included.

The headers of libmetal library needs to be included as "metal/xxxx.h"

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoexample: generic: Add dependent libs
Wendy Liang [Fri, 11 Nov 2016 00:54:32 +0000 (16:54 -0800)]
example: generic: Add dependent libs

Add dependent libs in the CMAke file of generic examples.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoexample: zynqmp_r5: fix singed and unsigned comp warning
Wendy Liang [Fri, 11 Nov 2016 00:43:54 +0000 (16:43 -0800)]
example: zynqmp_r5: fix singed and unsigned comp warning

Fix the compilation warning of comparison between signed and
unsigned of ZynqMP r5.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agolinux: uio dev: open dev file only if it exists
Wendy Liang [Thu, 10 Nov 2016 23:55:51 +0000 (15:55 -0800)]
linux: uio dev: open dev file only if it exists

It can take some time to have the /dev/uioX in the file system
after it binds the platform device to the UIO driver.

Check if the device file exists before trying to open the file.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agotest: freertos: Add sleep API test v2016.10
Wendy Liang [Fri, 14 Oct 2016 23:43:45 +0000 (16:43 -0700)]
test: freertos: Add sleep API test

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd sleep functions
Wendy Liang [Fri, 14 Oct 2016 23:40:51 +0000 (16:40 -0700)]
Add sleep functions

For now, only implement microseconds sleep function.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd timestamp implementation
Wendy Liang [Fri, 14 Oct 2016 23:37:46 +0000 (16:37 -0700)]
Add timestamp implementation

Add getting timestamp API.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agofreertos: Add condition var place holder
Wendy Liang [Fri, 14 Oct 2016 23:08:52 +0000 (16:08 -0700)]
freertos: Add condition var place holder

As the libmetal test will verify all the header files.
Add the condition variable place holder for FreeRTOS.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoLinux:irq:move read irq fd to dev irq ack funciton
Wendy Liang [Thu, 13 Oct 2016 23:21:46 +0000 (16:21 -0700)]
Linux:irq:move read irq fd to dev irq ack funciton

As different device may have different ways to ack the IRQ,
including how to read the IRQ fd. And thus, it is better to
move reading the IRQ fd to metal device.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAllow to use shared memory without root permission
Wendy Liang [Thu, 29 Sep 2016 18:33:11 +0000 (11:33 -0700)]
Allow to use shared memory without root permission

Without root permission, we cannot get the physical address
from the virtual address from shared memory, and cannot
lock unlimited size of shared memory. However, for communication
between processes, we don't need to know the physical address
nor lock the shared memory.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd ZynqMP AMP DEMO
Wendy Liang [Wed, 24 Aug 2016 00:04:04 +0000 (17:04 -0700)]
Add ZynqMP AMP DEMO

Add a demo on ZynqMP to demonstrate use shared memory
between A53 and R5.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoUpdate top level README
Wendy Liang [Tue, 6 Sep 2016 23:04:24 +0000 (16:04 -0700)]
Update top level README

Update the top level README file for the following API changes:
* interrupt handling added for generic and FreeRTOS
* condition variable
* spinlock
* cache operations.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agolibmetal: top irq.h include lower level irq.h
Sam Sortais [Thu, 25 Aug 2016 04:04:53 +0000 (21:04 -0700)]
libmetal: top irq.h include lower level irq.h

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agolibmetal: fix bug in re-enabling global irq
Sam Sortais [Mon, 22 Aug 2016 22:51:59 +0000 (15:51 -0700)]
libmetal: fix bug in re-enabling global irq

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: protect irq register function
Sam Sortais [Wed, 10 Aug 2016 21:07:14 +0000 (14:07 -0700)]
generic: protect irq register function

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: protect irq register function
Sam Sortais [Fri, 12 Aug 2016 01:33:52 +0000 (18:33 -0700)]
freertos: protect irq register function

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: atomic ut
Sam Sortais [Fri, 12 Aug 2016 03:17:18 +0000 (20:17 -0700)]
freertos: atomic ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: atomic ut
Sam Sortais [Thu, 28 Jul 2016 21:09:27 +0000 (14:09 -0700)]
generic: atomic ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: mutex ut
Sam Sortais [Fri, 5 Aug 2016 23:34:48 +0000 (16:34 -0700)]
generic: mutex ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: irq: call mutex_deinit
Sam Sortais [Fri, 12 Aug 2016 01:37:11 +0000 (18:37 -0700)]
linux: irq: call mutex_deinit

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: add default poll func
Sam Sortais [Fri, 12 Aug 2016 02:10:27 +0000 (19:10 -0700)]
freertos: add default poll func

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: mutex ut
Sam Sortais [Sat, 6 Aug 2016 06:46:24 +0000 (23:46 -0700)]
freertos: mutex ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: mutex api
Sam Sortais [Mon, 8 Aug 2016 08:04:49 +0000 (01:04 -0700)]
freertos: mutex api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: condvar: update mutex typedef
Sam Sortais [Mon, 8 Aug 2016 23:14:00 +0000 (16:14 -0700)]
generic: condvar: update mutex typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: mutex: update typedef
Sam Sortais [Mon, 8 Aug 2016 23:12:51 +0000 (16:12 -0700)]
generic: mutex: update typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: shmem ut: update typedef
Sam Sortais [Mon, 8 Aug 2016 23:11:10 +0000 (16:11 -0700)]
linux: shmem ut: update typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: condvar ut: update typedef
Sam Sortais [Mon, 8 Aug 2016 23:10:49 +0000 (16:10 -0700)]
linux: condvar ut: update typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: mutex: update typedef
Sam Sortais [Mon, 8 Aug 2016 23:10:19 +0000 (16:10 -0700)]
linux: mutex: update typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: condvar: mutex typedef
Sam Sortais [Mon, 8 Aug 2016 18:41:38 +0000 (11:41 -0700)]
linux: condvar: mutex typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: irq: mutex typedef
Sam Sortais [Mon, 8 Aug 2016 18:41:21 +0000 (11:41 -0700)]
linux: irq: mutex typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: mutex deinit and typedef
Sam Sortais [Mon, 8 Aug 2016 18:40:53 +0000 (11:40 -0700)]
linux: mutex deinit and typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agocondvar: change mutex struct to typedef
Sam Sortais [Mon, 8 Aug 2016 18:38:56 +0000 (11:38 -0700)]
condvar: change mutex struct to typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agomutex: change struct to typedef
Sam Sortais [Mon, 8 Aug 2016 18:38:25 +0000 (11:38 -0700)]
mutex: change struct to typedef

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: rename default irq handler
Sam Sortais [Wed, 10 Aug 2016 05:39:38 +0000 (22:39 -0700)]
freertos: rename default irq handler

The handler name does not need to indicate it is for any system.
And it needs to be made visible for inclusion to end user.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: rename default irq handler
Sam Sortais [Wed, 10 Aug 2016 05:38:49 +0000 (22:38 -0700)]
generic: rename default irq handler

The handler name does not need to indicate it is for baremetal.
And it needs to be made visible for inclusion to end user.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoexplicit irq functions args
Sam Sortais [Wed, 10 Aug 2016 05:37:21 +0000 (22:37 -0700)]
explicit irq functions args

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: irq ut init gic
Sam Sortais [Tue, 9 Aug 2016 22:28:44 +0000 (15:28 -0700)]
generic: irq ut init gic

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: irq ut check retval
Sam Sortais [Tue, 9 Aug 2016 22:30:33 +0000 (15:30 -0700)]
freertos: irq ut check retval

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolist: fix list empty checking
Wendy Liang [Tue, 9 Aug 2016 22:40:41 +0000 (15:40 -0700)]
list: fix list empty checking

Determine if list is empty by checking if list->next points
to list itself.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agogeneric: irq ut check retval
Sam Sortais [Tue, 9 Aug 2016 22:28:20 +0000 (15:28 -0700)]
generic: irq ut check retval

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoAdd libmetal memset_io and memcpy_io
Wendy Liang [Mon, 8 Aug 2016 23:46:48 +0000 (16:46 -0700)]
Add libmetal memset_io and memcpy_io

The memcpy/memset may not work on device memory on some architecture,
as some architecture assumes the memcpy/memset will only access
aligned device memory address. We add memset_io and memcpy_io
to allow memset/memcpy unaligned device memory access.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agofreertos: shmem
Sam Sortais [Tue, 9 Aug 2016 00:02:20 +0000 (17:02 -0700)]
freertos: shmem

similar to generic api, placeholder to provide api similar to linux one

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: interrupt controller api
Sam Sortais [Fri, 5 Aug 2016 21:35:30 +0000 (14:35 -0700)]
freertos: interrupt controller api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agolinux: interrupt controller api
Sam Sortais [Fri, 5 Aug 2016 21:32:31 +0000 (14:32 -0700)]
linux: interrupt controller api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: interrupt controller api
Sam Sortais [Fri, 5 Aug 2016 02:27:34 +0000 (19:27 -0700)]
generic: interrupt controller api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: io api
Sam Sortais [Wed, 3 Aug 2016 21:39:51 +0000 (14:39 -0700)]
freertos: io api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: cache api
Sam Sortais [Wed, 3 Aug 2016 21:23:01 +0000 (14:23 -0700)]
freertos: cache api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: irq ut
Sam Sortais [Tue, 2 Aug 2016 07:52:28 +0000 (00:52 -0700)]
freertos: irq ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: irq.c
Sam Sortais [Wed, 3 Aug 2016 06:25:13 +0000 (23:25 -0700)]
freertos: irq.c

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: alloc ut
Sam Sortais [Tue, 2 Aug 2016 06:39:32 +0000 (23:39 -0700)]
freertos: alloc ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: add alloc api
Sam Sortais [Wed, 3 Aug 2016 06:22:12 +0000 (23:22 -0700)]
freertos: add alloc api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: setup cmake for ut
Sam Sortais [Tue, 2 Aug 2016 20:13:26 +0000 (13:13 -0700)]
freertos: setup cmake for ut

Thread prototype varies from one OS to the other.
Introduce common metal_thread_t to facilitate porting.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agofreertos: setup cmake for lib
Sam Sortais [Fri, 29 Jul 2016 21:03:49 +0000 (14:03 -0700)]
freertos: setup cmake for lib

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoAdd explicite includes
Sam Sortais [Tue, 2 Aug 2016 18:22:00 +0000 (11:22 -0700)]
Add explicite includes

device.c need to include sys.h to allow overidding nb region
others files better include locally instead of from global sys.h

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agohave includes use consistent format
Sam Sortais [Wed, 3 Aug 2016 19:56:12 +0000 (12:56 -0700)]
have includes use consistent format

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: set irq def under METAL_INTERNAL
Sam Sortais [Tue, 2 Aug 2016 18:35:39 +0000 (11:35 -0700)]
generic: set irq def under METAL_INTERNAL

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agokeep consistenccy with naming conventions
Sam Sortais [Wed, 3 Aug 2016 06:21:29 +0000 (23:21 -0700)]
keep consistenccy with naming conventions

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoinline alloc
Sam Sortais [Sat, 30 Jul 2016 01:07:26 +0000 (18:07 -0700)]
inline alloc

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: update comments
Sam Sortais [Wed, 22 Jun 2016 00:23:46 +0000 (17:23 -0700)]
generic: update comments

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoAdd cmake option to disable documentation
Sam Sortais [Thu, 28 Jul 2016 00:53:55 +0000 (17:53 -0700)]
Add cmake option to disable documentation

Passing -DWITH_DOC=off to cmake will skip documentation

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoUse (void)var in logger for unused arguements
Wendy Liang [Wed, 27 Jul 2016 16:53:11 +0000 (09:53 -0700)]
Use (void)var in logger for unused arguements

Use (void)var in the logger when WITH_DEFAULT_LOGGER is off
to make the unused variable warning go away.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agouse poll in generic condition variable wait
Wendy Liang [Wed, 27 Jul 2016 03:28:40 +0000 (20:28 -0700)]
use poll in generic condition variable wait

Use poll function in generic condition variable wait.
so that it is not just busy looping.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agogeneric: irq ut
Sam Sortais [Fri, 22 Jul 2016 08:24:07 +0000 (01:24 -0700)]
generic: irq ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agogeneric: irq api
Sam Sortais [Fri, 22 Jul 2016 18:38:08 +0000 (11:38 -0700)]
generic: irq api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoIntroduce io memory map API
Wendy Liang [Mon, 25 Jul 2016 06:57:22 +0000 (23:57 -0700)]
Introduce io memory map API

This I/O memory map API is to enable memory mapping to the specified
memory region so that the system can access the specified memory region.

4 years agoAdd memory flags to metal_io_init()
Wendy Liang [Mon, 25 Jul 2016 04:46:27 +0000 (21:46 -0700)]
Add memory flags to metal_io_init()

Add memory flags argument to metal_io_init.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd memory cache flags to I/O region
Wendy Liang [Mon, 25 Jul 2016 00:41:08 +0000 (17:41 -0700)]
Add memory cache flags to I/O region

Add flags to I/O region to specify:
 * If the memory is cached, what cache type it uses
 * If the region is for I/O memory
 * If cache operations is required in DMA transaction.
   * In some cases, you don't need cache operations in DMA transaction,
     E.g. A system has I/O coherency and with IOMMU enabled.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoZynq7: Add default generic system poll
Wendy Liang [Tue, 19 Jul 2016 00:32:44 +0000 (17:32 -0700)]
Zynq7: Add default generic system poll

Introduce default generic system poll function to allow to
wait until some event happends.
This function can be overwritten by user outside libmetal.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoZynqMP R5: Add default generic system poll
Wendy Liang [Tue, 19 Jul 2016 00:30:48 +0000 (17:30 -0700)]
ZynqMP R5: Add default generic system poll

Introduce default generic system poll function to allow to
wait until some event happends.
This function can be overwritten by user outside libmetal.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd DMA map API to generic device implementation
Wendy Liang [Fri, 24 Jun 2016 23:09:09 +0000 (16:09 -0700)]
Add DMA map API to generic device implementation

For generic device implementaiton,
* DMA map: copy the input scatter/gather list to the output one.
* DMA unmap: do nothing.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd Linux userspace DMA map/unmap
Wendy Liang [Tue, 21 Jun 2016 22:49:31 +0000 (15:49 -0700)]
Add Linux userspace DMA map/unmap

Implement Linux userspace DMA map/unamp libmetal APIs.
This patch only supports UIO MMIO memory.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd DMA API
Wendy Liang [Tue, 21 Jun 2016 22:47:17 +0000 (15:47 -0700)]
Add DMA API

This patch is to add libmetal DMA APIs:
* metal_dma_map() - map memory for DMA transaction
* metal_dma_unmap() - unmap DMA memory after DMA transaction

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd generic cache API
Wendy Liang [Tue, 26 Jul 2016 22:12:12 +0000 (15:12 -0700)]
Add generic cache API

This patch is to implement the cache flush and invalidate
APIs for generic system.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd ZynqMP R5 generic cache APIs implementation
Wendy Liang [Mon, 18 Jul 2016 23:36:32 +0000 (16:36 -0700)]
Add ZynqMP R5 generic cache APIs implementation

Add ZynqMP R5 cache APIs implementation for libmetal
generic system only.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd Zynq7 generic cache APIs implementation
Wendy Liang [Mon, 18 Jul 2016 23:35:19 +0000 (16:35 -0700)]
Add Zynq7 generic cache APIs implementation

Add Zynq7 cache APIs implementation for generic system only.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd Linux cache API
Wendy Liang [Mon, 25 Jul 2016 23:50:02 +0000 (16:50 -0700)]
Add Linux cache API

The cache APIs in libmetal for Linux does nothing,
because user may not be able to flush/invalidate
all cache levels from userspace.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoIntroduce libmetal cache APIs
Wendy Liang [Mon, 18 Jul 2016 23:28:47 +0000 (16:28 -0700)]
Introduce libmetal cache APIs

The libmetal cache APIs only handle DCACHE for now.

metal_cache_flush() - flush the specified memory range in cache
metal_cache_invalidate() - invalidate the specified memory range in cache

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agomem alloc api ut
Sam Sortais [Mon, 25 Jul 2016 20:07:55 +0000 (13:07 -0700)]
mem alloc api ut

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agomem alloc api
Sam Sortais [Mon, 25 Jul 2016 20:07:20 +0000 (13:07 -0700)]
mem alloc api

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
4 years agoLinux: Initialize IRQ handling in libmetal initialization
Wendy Liang [Fri, 13 May 2016 00:39:11 +0000 (17:39 -0700)]
Linux: Initialize IRQ handling in libmetal initialization

When doing the libmetal Linux initialization, initialize
interrupts handling, which is to start the interrupt mornitoring
thread. When shutting down the Linux libmetal, shut down interrupts
handling, which is to stop the interrupt mornitorying thread.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd Linux IRQ handling
Wendy Liang [Fri, 13 May 2016 00:37:04 +0000 (17:37 -0700)]
Add Linux IRQ handling

This patch implements the following functions:
* metal_irq_register() - This API is to register the interrupt
                         needed to be monitored by the IRQ monitoring
                         thread.
* metal_linux_irq_handling() - This is a thread to monitor the registered
                         interrupts and call the registered interrupt
                         handler if there is an interrupt triggered.
* metal_irq_save_disable() - Disable interrupts, this will put the IRQ
                         handling thread to wait for interrupts reenabled.
* metal_irq_restore_enable() - Reenable interrupts, this will wakeup
                         the IRQ handling thread to monitor the registered
                         interrupts.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agodevice: Add irq_ack device operation
Wendy Liang [Fri, 22 Jul 2016 21:51:03 +0000 (14:51 -0700)]
device: Add irq_ack device operation

Adding irq_ack device operation in case the device requires operation
after the IRQ has been handled by the application.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd irq_info to Linux UIO device handling
Wendy Liang [Wed, 6 Jul 2016 18:27:13 +0000 (11:27 -0700)]
Add irq_info to Linux UIO device handling

Store the UIO file descriptor to the irq_info data field of
the UIO metal_device. The UIO file descriptor is also the
interrupt file descriptor.

User can poll the UIO file descriptor to monitor
the interrupt.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd irq_info to metal_device structure
Wendy Liang [Wed, 6 Jul 2016 18:23:07 +0000 (11:23 -0700)]
Add irq_info to metal_device structure

Add a data field irq_info to metal_device structure.
The irq_info is of type (void *), it is used to store
the device's interrupt information.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd IRQ API
Wendy Liang [Fri, 13 May 2016 00:35:06 +0000 (17:35 -0700)]
Add IRQ API

Introduce the following IRQ APIs:
* metal_irq_register() - Register interrupts handler and enable the interrupt.
* metal_irq_save_disable() - disable all interrupts
* metal_irq_restore_enable() - reenable interrupts

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd spinlock Linux test case.
Wendy Liang [Tue, 26 Jul 2016 17:51:47 +0000 (10:51 -0700)]
Add spinlock Linux test case.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd spinlock API
Wendy Liang [Tue, 26 Jul 2016 17:47:06 +0000 (10:47 -0700)]
Add spinlock API

Add the following spinlock APIs:
* metal_spinlock_acquire() - acquire the spinlock
* metal_spinlock_release() - release the spinlock

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoAdd libmetal dependency to test apps target
Wendy Liang [Tue, 26 Jul 2016 20:43:43 +0000 (13:43 -0700)]
Add libmetal dependency to test apps target

In case of parallel build, we need to make sure the libmetal
library is built before building the test applications.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoIntroduce machine specific dir in generic system
Wendy Liang [Mon, 18 Jul 2016 23:21:52 +0000 (16:21 -0700)]
Introduce machine specific dir in generic system

Introduce the machine specific directory in the system/generic
to keep any machine specific implementation there.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoIntroduce metal_cpu_yield()
Wendy Liang [Mon, 18 Jul 2016 18:19:43 +0000 (11:19 -0700)]
Introduce metal_cpu_yield()

Introduce CPU yield in metal to provide an API for user
to use in busyloop so that the thread will not hold the cpu
or the bus.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
4 years agoset max io regions to 1 per dev for generic system
Wendy Liang [Fri, 15 Jul 2016 00:11:05 +0000 (17:11 -0700)]
set max io regions to 1 per dev for generic system

Default 32 io regsions per device is too much for generic
device. Set default max io regions to 1 for generic system.

Signed-off-by: Wendy Liang <jliang@xilinx.com>