Naze32 clone with Frysky receiver
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MACROS.h 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. Copyright (c) 2010 Andy Kirkham
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #ifndef MODSERIAL_MACROS_H
  20. #define MODSERIAL_MACROS_H
  21. #define MODSERIAL_RBR 0x00
  22. #define MODSERIAL_THR 0x00
  23. #define MODSERIAL_DLL 0x00
  24. #define MODSERIAL_IER 0x04
  25. #define MODSERIAL_DML 0x04
  26. #define MODSERIAL_IIR 0x08
  27. #define MODSERIAL_FCR 0x08
  28. #define MODSERIAL_LCR 0x0C
  29. #define MODSERIAL_LSR 0x14
  30. #define MODSERIAL_SCR 0x1C
  31. #define MODSERIAL_ACR 0x20
  32. #define MODSERIAL_ICR 0x24
  33. #define MODSERIAL_FDR 0x28
  34. #define MODSERIAL_TER 0x30
  35. #define MODSERIAL_LSR_RDR (1UL << 0)
  36. #define MODSERIAL_LSR_OE (1UL << 1)
  37. #define MODSERIAL_LSR_PE (1UL << 2)
  38. #define MODSERIAL_LSR_FE (1UL << 3)
  39. #define MODSERIAL_LSR_BR (1UL << 4)
  40. #define MODSERIAL_LSR_THRE (1UL << 5)
  41. #define MODSERIAL_LSR_TEMT (1UL << 6)
  42. #define MODSERIAL_LSR_RXFE (1UL << 7)
  43. #define MODSERIAL_FIFO_ENABLE 1
  44. #define MODSERIAL_FIFO_RX_RESET 2
  45. #define MODSERIAL_FIFO_TX_RESET 4
  46. #define _RBR *((char *)_base+MODSERIAL_RBR)
  47. #define _THR *((char *)_base+MODSERIAL_THR)
  48. #define _IIR *((char *)_base+MODSERIAL_IIR)
  49. #define _IER *((char *)_base+MODSERIAL_IER)
  50. #define _LSR *((char *)_base+MODSERIAL_LSR)
  51. #define _FCR *((char *)_base+MODSERIAL_FCR)
  52. #define MODSERIAL_TX_BUFFER_EMPTY (buffer_count[TxIrq]==0)
  53. #define MODSERIAL_RX_BUFFER_EMPTY (buffer_count[RxIrq]==0)
  54. #define MODSERIAL_TX_BUFFER_FULL (buffer_count[TxIrq]==buffer_size[TxIrq])
  55. #define MODSERIAL_RX_BUFFER_FULL (buffer_count[RxIrq]==buffer_size[RxIrq])
  56. #define MODSERIAL_THR_HAS_SPACE ((int)_LSR&MODSERIAL_LSR_THRE)
  57. #define MODSERIAL_TEMT_IS_EMPTY ((int)_LSR&MODSERIAL_LSR_TEMT)
  58. #define MODSERIAL_RBR_HAS_DATA ((int)_LSR&MODSERIAL_LSR_RDR)
  59. #endif