Change the waitloop logic in peripheral odma write(). Fixes #21.

- Peripheral odma could enter a dead state if a block larger than the
  ODMA buffer size was written. Thanks to @denravonska for reporting this.