serial.h 935 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. *********************************************************************************************************
  3. * MC9S12DP256/DG128 Specific code
  4. * BANKED MEMORY MODEL
  5. *
  6. * File : rthw.c
  7. * By : parai
  8. * email:parai@foxmail.com
  9. *******************************************************************************************************/
  10. #ifndef __RT_HW_SERIAL_H__
  11. #define __RT_HW_SERIAL_H__
  12. #include <rtdevice.h>
  13. #define SERIAL_RX_BUFFER_SIZE 80
  14. struct serial_int_rx
  15. {
  16. rt_uint8_t rx_buffer[SERIAL_RX_BUFFER_SIZE];
  17. rt_uint32_t read_index, save_index;
  18. };
  19. struct serial_device
  20. {
  21. struct rt_device dev;
  22. struct serial_int_rx serial_rx;
  23. };
  24. #define SERIAL_DEVICE(dev) ((struct serial_device *)(dev))
  25. int seial_save_byte(unsigned char ch, struct serial_device * serial);
  26. rt_err_t rt_hw_serial_init(struct serial_device * serial, char * name);
  27. #endif