Loading ...
Sorry, an error occurred while loading the content.

80428RE: [XP] Necessary comments?

Expand Messages
  • Ilja Preuss
    Oct 2, 2003
      Robert Blum wrote:

      > First, some background info: My target environment loves sending data
      > using DMA. The DMA is driven by command tags and data. In our case,
      > the data always follows the command tag. You can chain commands (and
      > data) together by either putting them in sequence in memory, or you
      > can issue a DMA command that actually calls another chain (which has
      > to end in a return tag, or you will be punished :)
      > Unfortunately, the return stack for those calls is small.
      > The code in question is
      > /* We could've used callChain instead, but we don't know
      > * if there is any room in the DMA call stack left */
      > masterChain.appendChain(someCommandChain);
      > That comment is there since 'callChain' would be the more intuitive
      > approach - usually we know if there's room left in the call stack. We
      > just don't in this particular case.
      > I can't check it, either - that would cost too much performance.
      > Any suggestions how to express this better in code are appreciated.

      Here are two suggestions to express this in code - wether it's actually
      *better* might be questionable:

      1) sendInPresenceOfUnknownRoomOnDmaStack(someCommandChain)

      2) write a unit test which simulates a full DMA call stack and therefore
      fails when you change the code to use callChain

      What do you think?

      Take care, Ilja
    • Show all 19 messages in this topic