Access to main memory
tekochip
Posts: 56
I have an application that will have one cog running an address bus, a second cog that will run a task and would like to pass data to the first cog, and a third cog that would like to pass data to the first cog. The idea is that only one cog will handle the bus and the other cogs pass data for the first cog to place on the bus.
I have not found a way for multiple cogs to view the same address in main memory. Any VAR I declare is replicated each time the object is declared in OBJ, and if I don’t declare the object, it doesn’t have visibility in the current object.
What am I missing?
I have not found a way for multiple cogs to view the same address in main memory. Any VAR I declare is replicated each time the object is declared in OBJ, and if I don’t declare the object, it doesn’t have visibility in the current object.
What am I missing?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
The only way I can think of is to have one master object that starts all the others and points PAR to its global pool of memory. All globals would have to be defined in the master object.
If you want to do this from assembly, you'd add another PUB routine to the address bus manager object that simply returns the address of the work area in the DAT block. Whatever other objects that need to call the address bus manager would have to be passed this address by their start routines (in their PAR relative data area) and they'd have to have their own assembly version of the routine to check for an idle bus manager and set an address for it.
Of course the easiest is to simply have all the code which needs access to the locations in the same object and use the reference label to the value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.