Stack Space for Full Duplex Serial Driver v1.2 object
JoeFL
Posts: 10
I'm lost for a little comprehension about Chip Gracey and Jeff Martin's Full Duplex Serial Driver object
and how much stack space is required and where is addr for this stack space?
PUB start(rxpin, txpin, mode, baudrate) : okay
'' Start serial driver - starts a cog
'' returns false if no cog available
''
'' mode bit 0 = invert rx
'' mode bit 1 = invert tx
'' mode bit 2 = open-drain/source tx
'' mode bit 3 = ignore tx echo on rx
stop
longfill(@rx_head, 0, 4)
longmove(@rx_pin, @rxpin, 3)
bit_ticks := clkfreq / baudrate
buffer_ptr := @rx_buffer
okay := cog := cognew(@entry, @rx_head) + 1 <
what addr is @ rx_head ?
If this is started from Cog_0 , then the stack addr is [0]
If this is started from say Cog_4 , and cognew starts in Cog_5 , then what is the addr @ rx_head ?
Approx how much stack space does this object use?
Thanks
Joe
and how much stack space is required and where is addr for this stack space?
PUB start(rxpin, txpin, mode, baudrate) : okay
'' Start serial driver - starts a cog
'' returns false if no cog available
''
'' mode bit 0 = invert rx
'' mode bit 1 = invert tx
'' mode bit 2 = open-drain/source tx
'' mode bit 3 = ignore tx echo on rx
stop
longfill(@rx_head, 0, 4)
longmove(@rx_pin, @rxpin, 3)
bit_ticks := clkfreq / baudrate
buffer_ptr := @rx_buffer
okay := cog := cognew(@entry, @rx_head) + 1 <
what addr is @ rx_head ?
If this is started from Cog_0 , then the stack addr is [0]
If this is started from say Cog_4 , and cognew starts in Cog_5 , then what is the addr @ rx_head ?
Approx how much stack space does this object use?
Thanks
Joe
Comments
The Spin portion of the object runs in the cog that calls it and it uses the stack used by that cog. You have to remember that objects and cogs are different like apples and donuts. An object can use several cogs to do its work or it can use no cogs at all other than the one that calls its public methods. An object is just a way to encapsulate a function ... to make a sort of library package to do something for you. A cog is a separate computer. You can have a program that consists of just one object (the main one) yet uses all the cogs of the Propeller.