pando_channel.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*******************************************************
  2. * File name: pando_channel.h
  3. * Author: ruizeng
  4. * Versions: 1.0
  5. * Description:This module is to used to simulate connection channel (eg. serial port) between device and subdevice.
  6. * History:
  7. * 1.Date: initial code
  8. * Author: ruizeng
  9. * Modification:
  10. *********************************************************/
  11. #ifndef __PANDO_CHANNEL_H__
  12. #define __PANDO_CHANNEL_H__
  13. #include "pando_types.h"
  14. typedef enum {
  15. PANDO_CHANNEL_PORT_0 = 0,
  16. PANDO_CHANNEL_PORT_1,
  17. PANDO_CHANNEL_PORT_2,
  18. PANDO_CHANNEL_PORT_3,
  19. PANDO_CHANNEL_PORT_4,
  20. PANDO_CHANNEL_PORT_5,
  21. PANDO_CHANNEL_PORT_6,
  22. PANDO_CHANNEL_PORT_7
  23. } PANDO_CHANNEL_NAME;
  24. /*
  25. * "channel_recv_callback" is a callback function invoked when recving buffer from some channel.
  26. */
  27. typedef void (* channel_recv_callback)(uint8_t * buffer, uint16_t length);
  28. /******************************************************************************
  29. * FunctionName : on_subdevice_channel_recv
  30. * Description : regiseter the callback function when subdevice received buffer from some channel.
  31. * Parameters : name: channel name
  32. * cb: callback
  33. * Returns :
  34. *******************************************************************************/
  35. void on_subdevice_channel_recv(PANDO_CHANNEL_NAME name, channel_recv_callback cb);
  36. /******************************************************************************
  37. * FunctionName : on_device_channel_recv
  38. * Description : regiseter the callback function when device received buffer from some channel.
  39. * Parameters : name: channel name
  40. * cb: callback
  41. * Returns :
  42. *******************************************************************************/
  43. void on_device_channel_recv(PANDO_CHANNEL_NAME name, channel_recv_callback cb);
  44. /******************************************************************************
  45. * FunctionName : subdevice_channel_send
  46. * Description : send data to subdevice.
  47. * Parameters : name: channel name
  48. * Returns :
  49. *******************************************************************************/
  50. void channel_send_to_subdevice(PANDO_CHANNEL_NAME name, uint8_t * buffer, uint16_t length);
  51. /******************************************************************************
  52. * FunctionName : device_channel_send
  53. * Description : send data to device.
  54. * Parameters : name: channel name
  55. * Returns :
  56. *******************************************************************************/
  57. void channel_send_to_device(PANDO_CHANNEL_NAME name, uint8_t * buffer, uint16_t length);
  58. #endif