__IO & __I & __O meaning in lpc13uxx.h

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

__IO & __I & __O meaning in lpc13uxx.h

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Tue Nov 20 05:37:24 MST 2012
__IO uint32_t TC;     
  __O  uint32_t FEED;
  __I  uint32_t TV;
0 Kudos
8 Replies

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Brutte on Wed Nov 21 12:55:57 MST 2012

Quote:
Don't blame GCC - it is *C*(..)


There are hundreds of attributes for this and for that, and about the same count those that are missing.


Quote:
You can always join to the GCC's programmers crowd


I am not complaining, I was just hoping to inspire someone :)
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Nov 21 01:37:21 MST 2012
See
http://www.embedded.com/electronics-blogs/barr-code/4236917/Combining-C-s-volatile-and-const-keyword...
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Tue Nov 20 21:57:21 MST 2012
It does sound like it but I don't think so, volatile means [B]somebody else[/B] may be writing to it, const means [B]you [/B]can't.
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Tue Nov 20 21:53:29 MST 2012
1. volatile & const  together for register. isn't it contradictory for each other.

2. __o is volatile & have read only permission
   __IO is also volatile & have both read/write permissions.

As both are volatile so that means both should have same permission I guess read/write both.
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Tue Nov 20 19:56:14 MST 2012

Quote: Brutte
It would be nice if GCC had the true __O attribute (and not "pretending __IO"):
tmp = FEED;

so that the code produced warning.



You can always join to the GCC's programmers crowd
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue Nov 20 08:25:59 MST 2012
Don't blame GCC - it is *C* that does not have the concept of write-only variables.
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Brutte on Tue Nov 20 07:32:27 MST 2012
It would be nice if GCC had the true __O attribute (and not "pretending __IO"):
tmp = FEED;

so that the code produced warning.
0 Kudos

603 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Tue Nov 20 06:04:12 MST 2012
IIRC they are just macros for volatile and const.

EDIT: Found them

#define     __I     volatile const       // defines 'read only' permissions
#define     __O     volatile             // defines 'write only' permissions
#define     __IO    volatile             // defines 'read / write' permissions
0 Kudos