• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 **+-----------------------------------------------------------------------+**
3 **|                                                                       |**
4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
5 **| All rights reserved.                                                  |**
6 **|                                                                       |**
7 **| Redistribution and use in source and binary forms, with or without    |**
8 **| modification, are permitted provided that the following conditions    |**
9 **| are met:                                                              |**
10 **|                                                                       |**
11 **|  * Redistributions of source code must retain the above copyright     |**
12 **|    notice, this list of conditions and the following disclaimer.      |**
13 **|  * Redistributions in binary form must reproduce the above copyright  |**
14 **|    notice, this list of conditions and the following disclaimer in    |**
15 **|    the documentation and/or other materials provided with the         |**
16 **|    distribution.                                                      |**
17 **|  * Neither the name Texas Instruments nor the names of its            |**
18 **|    contributors may be used to endorse or promote products derived    |**
19 **|    from this software without specific prior written permission.      |**
20 **|                                                                       |**
21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
32 **|                                                                       |**
33 **+-----------------------------------------------------------------------+**
34 ****************************************************************************/
35 
36 
37 /**************************************************************************/
38 
39 #ifndef _DEBUG_MODULE_H
40 #define _DEBUG_MODULE_H
41 
42 #include "osTIType.h"
43 #include "debug_module_ioctl.h"
44 
45 /*****************************************************/
46 /*****************************************************/
47 /* Debug mode - use this define to debug this module */
48 /* #define DEBUG_THIS_MODULE*/
49 
50 #ifdef DEBUG_THIS_MODULE
51   #ifdef _WINDOWS
52   #else  /* ifdef __LINUX__ */
53 	#define DEBUG_MESSAGE(_msg) (report_d _msg)
54   #endif
55 #else /* DEBUG_THIS_MODULE */
56 	#define DEBUG_MESSAGE(_msg)
57 #endif /* DEBUG_THIS_MODULE */
58 
59 /*****************************************************/
60 /*****************************************************/
61 
62 #define MAX_CHAR_DRIVERS					 (2)
63 
64 #define MAX_CHAR_DRIVER_NAME				 (30)
65 #define SPI_CHAR_DRIVER_NAME				 ("SPI_char_driver")
66 #define DEBUG_MSG_CHAR_DRIVER_NAME			 ("Debug_messages_char_driver")
67 
68 #define SPI_CHAR_DRIVER						 (0)
69 #define DEBUG_MSG_CHAR_DRIVER				 (1)
70 
71 #define ENQUEUE_MESSAGE_CONTROL_SIZE		 (1)
72 #define CONTROL_CODE_TYPE_MESSAGE			 (0)
73 
74 #define REPORT_MESSAGE_PARAMS				 (3)
75 #define REPORT_MESSAGE_LEN					 (sizeof(unsigned int) * REPORT_MESSAGE_PARAMS)
76 
77 #define DEBUG_MODULE_TRACE_QUEUE_ID			 (0)
78 
79 typedef struct
80 {
81 	unsigned int read_pointer;		/* Current read pointer */
82 	unsigned int write_pointer;		/* Current write pointer */
83 	unsigned int used_size;			/* The used data size */
84 	unsigned int size;				/* Total size of the buffer */
85 	unsigned int overrun_count;     /* Number of packets that were run over */
86 
87 	tiBOOL		 waiting_for_data;	/* TRUE if the user mode is pending */
88 } t_queue_status;
89 
90 extern tiBOOL module_enable;
91 extern int *buffers_default_size[MAX_CHAR_DRIVERS];
92 extern UINT8  *buffers[MAX_CHAR_DRIVERS];									/* Pointer to the allocated buffder */
93 
94 
95 void init_queue(UINT8  device_index);
96 
97 unsigned char get_message_from_queue(UINT8 device_index, t_ioctol1_format *ioctl_data);
98 void get_queue_information(UINT8 device_index, unsigned int *report_msg);
99 tiBOOL debug_module_enqueue_message(UINT8 queue_id, UINT8 param, void *p_msg, unsigned int len, UINT8  message_type);
100 
101 tiBOOL debug_module_logic_allocate_queue(UINT8 device_index, UINT8 size_in_k);
102 void debug_module_logic_deallocate_queue(UINT8 device_index, UINT8 size_in_k);
103 
104 /* OS depended function prototypes */
105 void os_cmd_spin_lock_irqsave(void);
106 void os_cmd_spin_unlock_irqrestore(void);
107 void os_cmd_up(void);
108 void os_cmd_down_interruptible(void);
109 void os_cmd_copy_to_user(void *destination, const void *source, unsigned int size);
110 void *os_malloc (UINT32 size);
111 void os_free (void *p, UINT32 size);
112 
113 
114 #endif /* _DEBUG_MODULE_H */
115