Skip to content

Query: Exclusive Access #4866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
deepikabhavnani opened this issue Aug 7, 2017 · 4 comments
Closed

Query: Exclusive Access #4866

deepikabhavnani opened this issue Aug 7, 2017 · 4 comments

Comments

@deepikabhavnani
Copy link

__EXCLUSIVE_ACCESS Macro is set in "core_cm.h" file considering the ARM architecture.

#ifndef __EXCLUSIVE_ACCESS
#if   ((__ARM_ARCH_7M__      == 1U) || \
       (__ARM_ARCH_7EM__     == 1U) || \
       (__ARM_ARCH_8M_MAIN__ == 1U))
#define __EXCLUSIVE_ACCESS      1U
#else
#define __EXCLUSIVE_ACCESS      0U
#endif
#endif

EXCLUSIVE_ACCESS macro is set in "mbed_critical.c" file.

#define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS))

Shouldn't we use single macro, as it looks both of them are for same purpose. Or any specific reason to have this redefined in *.c file?

@sg- @0xc0170 @bulislaw

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 8, 2017

Shouldn't we use single macro, as it looks both of them are for same purpose. Or any specific reason to have this redefined in *.c file?

I dont recall if we did not have it previously in the older code base. But would make sense to switch to cmsis one 👍

Looking at this further, they added as well atomic_ functions that were not there previously (I believe prior cmsis5 update)

@geky
Copy link
Contributor

geky commented Aug 8, 2017

If it's prefixed with "__", does that mean it's intended to be private?

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 8, 2017

If it's prefixed with "__", does that mean it's intended to be private?

I would expect so, but if you look at the macros defined in cmsis headers, that we even use, all of them start and end with __ .

@pan-
Copy link
Member

pan- commented Aug 9, 2017

Just a remainder any identifier that begin by an underscore followed by another underscore or an uppercase are reserved and should not be used (C99: 7.1.3).

Identifier beginning with an underscore are also reserved for use as identifier of file scope elements (C99: 7.1.3). Yes, _private_variable_name is enforced by the language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants