Commit graph

19237 commits

Author SHA1 Message Date
Peter Mitsis
76db3ae424 Clean up microkernel sys_kernel configuration files
As no default platform configuration uses the PIC/PIT, the project
configuration file 'prj_console_pc8253.conf' is no longer required.

Change-Id: Ic91922e9431a2853bb5fdcdd3e31e39f3dce90c4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
21832e3bf1 Clean up microkernel latency_measure configuration files
As no default platform configuration uses the PIC/PIT, the project
configuration file 'prj_pc8253.conf' is no longer required.

Change-Id: I89fac2685d9fca0452e5ce9d9b035e102bd62d70
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
db608ec123 Clean up microkernel app_kernel configuration files
Removes the following project configuration files:
 - prj_console_float_pc8253.conf : PIT is no longer used
 - prj_console_nofloat_*.conf    : unsupported by Makefile

Change-Id: I72689fa56413947f3a552645c7b2ed5ad599ed71
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
8760c49d80 basic_minuteia to use HPET timer
Updates the basic_minuteia platform configuration to use the HPET timer as both
the PIC and PIT will be removed in a future commit.

Change-Id: Ieefcf48175d6d2731acd6b39a5e73879902940b1
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
578d417e87 Use HPET timer Kconfig options
Removes the HPET timer macros from board.h and uses the HPET timer Kconfig
options in their stead.

Change-Id: Ia0b3cd87716277ac25f12deb31d5c5934f355050
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
366962557c HPET: Add additional Kconfig options
Adds additional Kconfig options to the HPET timer for setting its base address,
IRQ, IRQ priority and condition for triggering an interrupt.

Change-Id: I80349c60237380129da9ef41ccf6850c6b874c3c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
bbb57b5f80 ia32: Add HPET timer initialization abstraction
Initializes the HPET timer if it is configured into the system.

Change-Id: Ia9474e868101abe88e031266b956c6a559745d75
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
097a1a17dc ia32_pci: Abstract device initialization
Abstracts the initialization of the following devices:
    LOAPIC, IOAPIC, and HPET TIMER
This allows for a more configurable ia32_pci platform.

Change-Id: I05d0d983c163be499dd967ffe0121290a4305c9e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
9216a2cbb9 cosmetic: Fix camel case in ia32 and ia32_pci platforms
Converts camel case routine names to lower-case with underscores to comply with
coding practices.

Change-Id: I9fac0d3858389039c00882a7d2e97fcd4e4c812b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
3ecf65e5ef x86: Rename quark_init() to ia32_pci_init()
The new name corresponds to the platform (ia32_pci), whereas the old name
referred to the old platform/bsp name.

Change-Id: I1b6f3416db146af4fdbadf70d0ab153741c781d5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
0ea6e60035 x86: Rename pc_init() to ia32_init()
The new name corresponds to the platform (ia32), whereas the old name referred
to the old platform/bsp name.

Change-Id: Ia8fe5d2b35bceb7e04dd8ac9c41b9de7947ed1f9
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis
503dd66334 x86: Remove obsolete IOAPIC initialization comment
Change-Id: I26d75e36191f348598a807f5f943de99cc3bcf67
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:19 -05:00
Rodrigo Caballero
a8f3110905 Doc: Restructures the Quick Start Guide.
The Quick Start Guide is now comprised by Installing, Building and
Running the Zephyr Kernel Guides. The Installing Guide contains all the
procedures needed to install the required components and get access to
the code. The Building Guide contains the procedure to build the kernel
using a sample application. The Running Guide contains the procedures to
run an application using QEMU or the Galileo 2 board. Files and folders
were renamed. The toctree directives were updated to reflect the new
names.

Change-Id: I4398befd4a24b12a50970c21a5288afa5c533fc8
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:15:19 -05:00
Anas Nashif
d2fff1fb7a drivers: use subdir-ccflags-y for all drivers
All driver Makefiles are adding the same cflags and they
have been done inconsistenly, make all drivers inherit
from the top level Makefile and remove unused includes.

Change-Id: Ie66d0ba7a418ac26f7eb709f50c887dc682e935c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:19 -05:00
Anas Nashif
427cdd36ec sanity: add new line when emitting an error
Change-Id: I4075dbe3706b45e926e9ab4d0f620fe262aaa705
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:19 -05:00
Anas Nashif
abb4404689 Move PCI settings to drivers/pci
Change-Id: I92ccbcdd1292f8f4f017b45968c2204c06e6f73e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:15:19 -05:00
Dirk Brandewie
6c9a846eae gpio: Fix function signature for gpio_set_callback()
Change-Id: I66c6630b2eced4e0219b0f36b1bf7b0454770290
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:15:19 -05:00
Benjamin Walsh
add6b9794b arc: fixes in context switch explanation comments
There were some typos and some weird phrasing.

Change-Id: I7b183755058e5ffedca97d434c43f448aafd1926
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:19 -05:00
Benjamin Walsh
ac60583b76 drivers: rename cortex_m_timer to cortex_m_systick
The name of the device is SYSTICK. The device name should be part of the
file name, like all other timer drivers we support. The name
'cortex_m_timer' said nothing about which device the driver is for, since
it's way too generic: it could be for any timer present on any Cortex-M
board.

Change-Id: I39b4f79c32516ec9aff82c55c0ca639fad1b52bb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:19 -05:00
Benjamin Walsh
6ebb212e18 ioapic: remove comment about split kernel
The Zephyr kernel must always be built as a monolithic image, not as
separate nanokernel and microkernel images.

Change-Id: I44fdd2349b32f409c84710f58bc4b3fe96fd79b7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:19 -05:00
Daniel Leung
971eb0ef44 samples/microkernel: add test for private memory maps
This adds unit test for microkernel private memory maps.
The code piggybacks to the public memory map test (by
including the same source file), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private memory maps test move the memory maps inside
source code. So, both mdef files will need to be updated at
the same time.

Change-Id: Ia7f65f55b61d9fb0d42ba58d63662e914d69194e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
0abe07a0cd microkernel: introduce support for private memory maps
This enable defining memory maps in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_MEM_MAP(mem_map_name, ...). The memory maps created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
memory map APIs.

Define the memory map using:

  DEFINE_MEM_MAP(mem_map1, blocks, block_size);

and "mem_map1" can be used, for example:

  task_mem_map_alloc(mem_map1, ...);

or,

  task_mem_map_free(mem_map1, ...);

etc.

To use the memory map defined in another source file, simply add:

extern const kmemory_map_t mem_map1;

to the desired C or header file.

Change-Id: I9c551b90f9d0a95f961fd8ec1c5278c2ea44312d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
201aa8c708 microkernel: put memory map pointers into its own binary section
The _k_mem_map_list was a static array generated by sysgen,
where it containing all pre-defined memory maps from MDEF file.
To support private memory map objects (aka, defining them within
source files), the list has to accommodate memory maps that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all memory
map pointers go into this section. By doing this, the list
can still be manipulated as an array.

Change-Id: I1f3414b72f685fef4b99850749178661f14d9345
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
a77808462e Redefine microkernel memory map object identifier type
The opaque memory map object id type is now a pointer to
the associated memory map structure, rather than an index
into the microkernel's array of memory map structures.

This change is a pre-requisite to support for private
memory map objects, which are defined in source code.

Change-Id: I82ecb59eeed00efa54f781f775710c92ff9c9fc9
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
8eec65c742 samples/microkernel: add test for private pipes
This adds unit test for microkernel private pipes.
The code piggybacks to the public pipe test (by
including the same source file), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private pipes test move the pipes inside source
code. So, both mdef files will need to be updated at
the same time.

Change-Id: I6fdb5eab7c3a1d6f4b72c26a3620cee0188b07a5
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
b5517ab61c microkernel: introduce support for private pipes
This enable defining pipes in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_PIPE(pipe_name, ...). The pipes created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
pipe APIs.

Define the pipe using:

  DEFINE_PIPE(pipe1, size);

and "pipe1" can be used, for example:

  task_pipe_put(pipe1, ...);

or,

  task_pipe_get(pipe1, ...);

etc.

To use the pipe defined in another source file, simply add:

extern const kpipe_t pipe1;

to the desired C or header file.

Change-Id: Iae8e04706359bc18aae51acc75df3e3d26388882
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
815d64522f microkernel: put pipe pointer list into its own binary section
The _k_pipe_list was a static array generated by sysgen,
where it containing all pre-defined pipes from MDEF file.
To support private pipe objects (aka, defining pipes within
source files), the pipe list has to accommodate pipes that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all pipe
pointers go into this section. By doing this, the pipe list
can still be manipulated as an array. The reason behind
putting the pointers to pipe, instead of the pipe objects
themselves, is that some compiler/linker may pad the large pipe
struct. For example, compiling under gcc and march=i686 pads
the struct to 32-byte alignment (march=atom to 64-byte alignment).
This causes issue with sizeof() and pointer arithmetic because
they have no idea about the padding. So use pointers here to
prevent padding.

Change-Id: I6d3b75614c4d8760c037a5c26746410d4e4b17cb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
2285976f03 microkernel: redefine pipe object identifier type
The opaque pipe object id type is now a pointer to
the associated pipe structure, rather than an index
into the microkernel's array of pipe structures.

This change is a pre-requisite to support for private
pipes, which are defined in source code.

This also moves the required struct into more visible
headers such that private pipes can be declared.
Renaming the struct is also being done to conform to
naming convention for private kernel objects.
Since a couple structs have to be moved anyway, so
do the moving and renaming here too (contrary to what
have been done in the past, with separated patches).

Change-Id: Ibb6ec7f62745a81439ae3ea2616688b757439843
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
62077917b6 samples/microkernel: add test for private tasks
This adds unit test for microkernel private tasks.
The code piggybacks to the public task test (by
including the same source file), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private tasks test move the tasks inside source
code. So, both mdef files will need to be updated at
the same time.

Change-Id: I2890f70be460c0e45208ce03d6e7897d2662f6f0
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
2bc5880d85 microkernel: introduce support for private tasks
This enable defining tasks in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_TASK(task_name). The tasks created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
task APIs.

Define the task using:

  DEFINE_TASK(task1, priority, entry_func, stack_size, groups);

and "task1" can be used, for example:

  task_start(task1);

or,

  task_abort(task1);

etc.

To use the task defined in another source file, simply add:

extern const ktask_t task1;

to the desired C or header file.

Change-Id: Ib2f3572950ca74b359b7fde1ccd6cfd04783eefb
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
75e5427e15 microkernel: put _k_task_list into its own binary section
The _k_task_list was a static array generated by sysgen,
where it containing all pre-defined tasks from MDEF file.
To support private task objects (aka, defining tasks within
source files), the task list has to accommodate tasks that
are not only processed through sysgen, but also those defined
within source files.

This is done by creating a new section in binary, and all task
objects go into this section. By doing this, the task list
can still be manipulated as an array, which is required for
task group operation.

Change-Id: I799d6967567079498bc414e0cb809e8af856b53e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
1367a98e9e Redefine microkernel task object identifier type
The opaque task object id type is now a pointer to
the associated task structure, rather than an index
into the microkernel's array of task structures.

This change is a pre-requisite to support for private
task objects, which are defined in source code.

Change-Id: Idb53ea7f8a8a5b7e6477a74273930b08fc77dcfe
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
c290ebaebd Redefine microkernel timer objects identifier type
The opaque timer object id type is now a pointer to
the associated timer structure, rather than an index
into the microkernel's array of timer structures.

This is simply to be consistent with other microkernel
objects, such as semaphore, mutex, and mailbox.

Change-Id: If803e22ae450d4ef28e81e8a5f2451b9c26c6dce
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
f6369abf4d samples/microkernel: add test for private mailboxes
This adds unit test for microkernel private mailboxes.
The code piggybacks to the public mailbox test (by
including the same source files), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private mailboxes test move the mailboxes inside source
code. So, both mdef files will need to be updated at
the same time.

Change-Id: I52ccc5931b1abfd3ae3d654f888d4a019268bba0
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
39887c4358 microkernel: introduce support for private mailboxes
This enable defining mailboxes in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_MAILBOX(mailbox_name). The mailboxes created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
mailbox APIs.

Define the mailbox using:

  DEFINE_MAILBOX(mailbox1);

and "mailbox1" can be used, for example:

  task_mbox_put(mailbox1, &msg);

or,

  task_mbox_get(mailbox1, &msg);

etc.

To use the mailbox defined in another source file, simply add:

extern const kmox_t mailbox1;

to the desired C or header file.

Change-Id: I32d4194af740f96fc8df8c6cd3144a0c9accb4ec
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
105e723faa microkernel: Rename struct mbx_struct to _k_mbox_struct
This is in preparation to enable private mailbox support.
The struct needs to be moved into more visible header
so private mailboxes can be declared. This also renames
according to naming convention to be private kernel
objects.

Change-Id: Ibd75497e726efd447d27f3bfd0b4695ed1695693
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
09387cc9dd Redefine microkernel mailbox object identifier type
The opaque mailbox object id type is now a pointer to
the associated mailbox structure, rather than an index
into the microkernel's array of mailbox structures.

This change is a pre-requisite to support for private
mailboxes, which are defined in source code.

Change-Id: Ide832eee2a0762e601847ad07afba380bd79ed8b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
5d934a3786 samples/microkernel: add test for private FIFOs
This adds unit test for microkernel private FIFOs.
The code piggybacks to the public FIFOs tests (by
including the same source file), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private FIFOs test move some of the FIFOs
inside source code.

Change-Id: I4130ac540b10a31cd30f37890e9cc389af73e89b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
e510742d43 microkernel: introduce support for private FIFOs
This enable defining FIFOs in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_FIFO(fifo_name). The FIFOs created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
FIFO APIs.

Define the FIFO using:

  DEFINE_FIFO(fifo1, depth, width);

and "fifo1" can be used, for example:

  task_fifo_put(fifo1);

or,

  task_fifo_get(fifo1);

etc.

To use the FIFO defined in another source file, simply add:

extern const kfifo_t fifo1;

to the desired C or header file.

Change-Id: I29667c4cfdcd0e6d189358478acf1a6149ecb826
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
e27b5c9abf microkernel: Rename struct que_struct to _k_fifo_struct
This is in preparation to enable private FIFO support.
The struct needs to be moved into more visible header
so private FIFOs can be declared. This also renames
according to naming convention to be private kernel
objects.

Change-Id: I9b90ddccbaf01ff8c7e2ef03c926d0328dd7ec39
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
ef242d3291 Redefine microkernel FIFO object identifier type
The opaque FIFO object id type is now a pointer to
the associated FIFO structure, rather than an index
into the microkernel's array of FIFO structures.

This change is a pre-requisite to support for private
FIFOs, which are defined in source code.

Change-Id: Ieb1343d6d5dd1b747063603457d47fab2710f557
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
8232067646 samples/microkernel: add test for private semaphores
This adds unit test for microkernel private semaphores.
The code piggybacks to the public semaphores tests (by
including the same source files), so any updates to
the test will be applied to both.

Note that the prj.mdef are different for both tests, since
the private semaphores test move some of the semaphores
inside source code.

Change-Id: Ic318bf6808514c5d335a46cb3e88ebf6000f4c3e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
a0224842bc microkernel: introduce support for private semaphores
This enable defining semaphores in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_SEMAPHORE(semaphore_name). The semaphores created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
semaphore APIs.

Define the semaphore using:

  DEFINE_SEMAPHORE(sem1);

and "sem1" can be used, for example:

  task_sem_give(sem1);

or,

  task_sem_take(sem1);

etc.

To use the semaphore defined in another source file, simply add:

extern const ksem_t sem11;

to the desired C or header file.

Change-Id: Ia9c128648f7a26fc776eeb8f6fcc4158b1712a97
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
1036aee613 microkernel: Rename struct sem_struct to _k_sem_struct
This is in preparation to enable private semaphore support.
The struct needs to be moved into more visible header
so private semaphores can be declared. This also renames
according to naming convention to be private kernel
objects.

Change-Id: I84ac7d580404ac5e1753c1bd446d38993fd23310
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Daniel Leung
013666c964 Redefine microkernel semaphore object identifier type
The opaque semaphore object id type is now a pointer to
the associated semaphore structure, rather than an index
into the microkernel's array of semaphore structures.

This change is a pre-requisite to support for private
semaphores, which are defined in source code.

Change-Id: I3821360be35237bfe3bf090efce84f99e335d309
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:15:18 -05:00
Allan Stephens
eddae0e0f2 sysgen: Don't generate mutex object id variables
It is no longer necessary to generate variables containing the
object id each public mutex. This capability was once needed to
allow kernel code to reference mutexes generated by the build
system (i.e. pseudo-private mutexes); however, the existence of
private mutexes renders this obsolete.

Change-Id: I594be31268c9a336ae2a43d48c1b32dbf3d7cde0
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:15:18 -05:00
Allan Stephens
457caf92a3 samples/microkernel: recursive mutex testing using in-file mutex
Enhances the existing microkernel mutex test project to verify
that recursive mutex locking works properly. The implementation
utilizes the new in-file defined mutexes to demonstrate that
this capability also works.

[DL: Update the original patch from Allan Stephens
     @ https://oic-review.01.org/gerrit/3256 to utilize
     the new interface. Also updated the commit message. ]

Change-Id: Iaf8b4a5cd97d1dce53d6134a978cc565279d038c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:51 -05:00
Daniel Leung
811c838ff1 microkernel: introduce support for private mutexes
This enable defining mutexes in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_MUTEX(mutex_name). The mutexes created this way are
the same, in functionality, as those defined in MDEF files.
They can be manipulated by the standard microkernel
mutex APIs.

Sample usage:

    DEFINE_MUTEX(mutex1);

    void one_function(void)
    {
        task_mutex_lock_wait(mutex1);
        ...
        task_mutex_unlock(mutex1);
    }

To use the mutex defined in another source file, simply add:

    extern const kmutex_t mutex1;

to the desired C or header file.

[ DL: This is a slightly modified version of similar patch
      by Allan Stephens available at
      https://oic-review.01.org/gerrit/3255 ]

Change-Id: Ib9cd8193eaf849a8aad1d217912759324ee8818e
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:14:46 -05:00
Daniel Leung
43eed86737 microkernel: Rename struct mutex_struct to _k_mutex_struct
This is in preparation to enable private mutex support.
The struct needs to be moved into more visible header
so private mutexes can be declared. This also renames
according to naming convention to be private kernel
objects.

Change-Id: Ifccb60a837b44e443be0b091c2df4f06373718fe
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:14:46 -05:00
Allan Stephens
ffd802250e Redefine microkernel mutex object identifier type
The opaque mutex object id type is now a pointer to the associated
mutex structure, rather than an index into the microkernel's
array of mutex structures.

This change is a pre-requisite to support for private mutexes
(i.e. mutexes not defined using a project's MDEF file).

[DL: fix some whitespace issues.]

Change-Id: Ida419f1674df245f51a36d28ca7d4631239f1edd
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:14:46 -05:00