Click here to Skip to main content
13,549,170 members

C / C++ / MFC

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder12-Jul-09 22:37
adminChris Maunder12-Jul-09 22:37 
PinnedHOW TO ASK A QUESTION Pin
Chris Maunder12-Feb-09 17:19
adminChris Maunder12-Feb-09 17:19 
QuestionReturn a local 2d Array Pin
kinderu18-May-18 8:59
memberkinderu18-May-18 8:59 
AnswerRe: Return a local 2d Array Pin
Richard MacCutchan18-May-18 9:13
protectorRichard MacCutchan18-May-18 9:13 
GeneralRe: Return a local 2d Array Pin
kinderu18-May-18 9:45
memberkinderu18-May-18 9:45 
GeneralRe: Return a local 2d Array Pin
leon de boer18-May-18 16:34
memberleon de boer18-May-18 16:34 
GeneralRe: Return a local 2d Array Pin
Richard MacCutchan18-May-18 20:46
protectorRichard MacCutchan18-May-18 20:46 
QuestionCan someone show me an example of including a DLL or function in a C program ? Pin
m3mb3r17-May-18 10:41
memberm3mb3r17-May-18 10:41 
SuggestionRe: Can someone show me an example of including a DLL or function in a C program ? Pin
Randor 17-May-18 11:52
professional Randor 17-May-18 11:52 
AnswerRe: Can someone show me an example of including a DLL or function in a C program ? Pin
Richard MacCutchan17-May-18 21:40
protectorRichard MacCutchan17-May-18 21:40 
AnswerRe: Can someone show me an example of including a DLL or function in a C program ? Pin
leon de boer18-May-18 8:58
memberleon de boer18-May-18 8:58 
Questionvolatile misbehaves Pin
Vaclav_17-May-18 3:19
memberVaclav_17-May-18 3:19 
" volatile " keyword instructs the compiler NOT to optimize the code.
It is commonly used in interrupts. Fine.
The library code I am using was apparently written with intent to use ether interrupts or multiprocessor hardware. Fine.

The following snippet class variables are declared as " volatile uint32_t *".

But the <b>code does not perform simple addition</b> - it always returns "1".
It fails even when declared as local variable - see "TEST".

Am I missing something ?


<pre lang="c++">
bcm2835_peripherals = (uint32_t*) BCM2835_PERI_BASE;
bcm2835_pads = bcm2835_peripherals + BCM2835_GPIO_PADS / 4;
bcm2835_clk = bcm2835_peripherals + BCM2835_CLOCK_BASE / 4;
bcm2835_gpio = (uint32_t*)bcm2835_peripherals + BCM2835_GPIO_BASE / 4;

volatile uint32_t *TEST = bcm2835_peripherals + BCM2835_GPIO_BASE / 4;

cout <<"bcm2835_peripherals "<<bcm2835_peripherals<< endl;
cout <<"BCM2835_GPIO_BASE / 4 "<< hex << BCM2835_GPIO_BASE / 4<< endl;
cout <<"bcm2835_gpio "<< hex << +bcm2835_gpio<< endl;
cout <<" TEST cm2835_gpio "<< hex << TEST << endl;

</pre>

Thanks for any comments.
Cheers Vaclav
AnswerRe: volatile misbehaves Pin
Richard MacCutchan17-May-18 4:04
protectorRichard MacCutchan17-May-18 4:04 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 4:26
memberVaclav_17-May-18 4:26 
GeneralRe: volatile misbehaves Pin
Richard MacCutchan17-May-18 4:42
protectorRichard MacCutchan17-May-18 4:42 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 5:39
memberVaclav_17-May-18 5:39 
AnswerRe: volatile misbehaves Pin
Joe Woodbury17-May-18 5:48
professionalJoe Woodbury17-May-18 5:48 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 6:04
memberVaclav_17-May-18 6:04 
GeneralRe: volatile misbehaves Pin
Vaclav_17-May-18 7:24
memberVaclav_17-May-18 7:24 
AnswerRe: volatile misbehaves Pin
leon de boer18-May-18 8:16
memberleon de boer18-May-18 8:16 
GeneralRe: volatile misbehaves Pin
Vaclav_19-May-18 14:02
memberVaclav_19-May-18 14:02 
GeneralRe: volatile misbehaves Pin
Vaclav_23hrs 41mins ago
memberVaclav_23hrs 41mins ago 
GeneralRe: volatile misbehaves Pin
leon de boer9hrs 36mins ago
memberleon de boer9hrs 36mins ago 
GeneralRe: volatile misbehaves Pin
Vaclav_8hrs 33mins ago
memberVaclav_8hrs 33mins ago 
Question__sync_synchronize stops processor ? Pin
Vaclav_16-May-18 10:31
memberVaclav_16-May-18 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy |
Web03 | 2.8.180515.1 | Last Updated 20 May 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid