al_console.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef __CONSOLE_H_
  2. #define __CONSOLE_H_
  3. #include <unistd.h>
  4. #include <stdbool.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <signal.h>
  8. #include <sys/file.h>
  9. #include <termios.h>
  10. #include <time.h>
  11. #include <sys/ioctl.h>
  12. #include "types.h"
  13. //#define condbg(fmt,args...) printf("[CONSOLE] " fmt, ## args)
  14. #define condbg(fmt,args...)
  15. #define condbg2(pipe,fmt,args...) fprintf(pipe,fmt,## args)
  16. #define SIG_CONSOLE_ON 47
  17. #define SIG_CONSOLE_OFF 48
  18. #define MAX_CMD_LENGTH 5120
  19. #define GAMMA_TABLE_SIZE 1024
  20. #define TMPBUFSIZE 1024
  21. #define UART_BUF_SIZE 1024
  22. enum{
  23. RS_Rx,
  24. RS_Tx,
  25. RS_Dx,
  26. RS_Sx,
  27. };
  28. enum{
  29. RSDBG_CONSOLE = 1,
  30. RSDBG_UMF,
  31. RSDBG_ALL,
  32. };
  33. enum _UPDATE_DETECT
  34. {
  35. UPDATE_DETECT_OK = 0x0,
  36. UPDATE_DETECT_NO_DEV,
  37. UPDATE_DETECT_HAS_USB_DEV,
  38. UPDATE_DETECT_HAS_SDCARD_DEV,
  39. };
  40. typedef struct _CON_DEV{
  41. bool bConnectViaUSB;
  42. pid_t pid;
  43. FILE *in;
  44. FILE *out;
  45. FILE *dbg;
  46. volatile bool bActive;
  47. volatile unsigned int n;
  48. unsigned int tmpbuf[TMPBUFSIZE];
  49. }CON_DEV, *pCON_DEV;
  50. typedef struct _CON_DBG{
  51. bool DbgOSDPos;
  52. bool DbgEnable;
  53. unsigned char DbgMsgtoUSB;
  54. unsigned char Txlen;
  55. unsigned char Rxlen;
  56. unsigned char Tx[16];
  57. unsigned char Rx[16];
  58. }CON_DBG;
  59. typedef struct _CON_UART{
  60. unsigned char uartA_Thread;
  61. unsigned char uartB_Thread;
  62. unsigned char uartA_Thread_close;
  63. unsigned char uartB_Thread_close;
  64. unsigned char uartA_Stop;
  65. unsigned char uartB_Stop;
  66. unsigned char UART_UARTA_Listen_Status;
  67. unsigned char UART_UARTB_Listen_Status;
  68. unsigned char UART_UARTA_Wait_Status;
  69. unsigned char UART_UARTB_Wait_Status;
  70. }CON_UART;
  71. typedef void (*con_Header_Parse_t)(unsigned char* buff, unsigned int bufflen, unsigned int *commandlen);
  72. void CONSOLE_INIT(void *arg);
  73. extern void con_SetDbgMsgtoUSB(UINT8 value);
  74. void CONSOLE_UART_START(UINT8 uartType);
  75. INT32 CONSOLE_EXIT(void);
  76. #endif