This source file includes following definitions.
- cudbg_get_buff
- cudbg_put_buff
- cudbg_update_buff
1
2
3
4
5
6 #include "cxgb4.h"
7 #include "cudbg_if.h"
8 #include "cudbg_lib_common.h"
9
10 int cudbg_get_buff(struct cudbg_init *pdbg_init,
11 struct cudbg_buffer *pdbg_buff, u32 size,
12 struct cudbg_buffer *pin_buff)
13 {
14 u32 offset;
15
16 offset = pdbg_buff->offset;
17 if (offset + size > pdbg_buff->size)
18 return CUDBG_STATUS_NO_MEM;
19
20 if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE) {
21 if (size > pdbg_init->compress_buff_size)
22 return CUDBG_STATUS_NO_MEM;
23
24 pin_buff->data = (char *)pdbg_init->compress_buff;
25 pin_buff->offset = 0;
26 pin_buff->size = size;
27 return 0;
28 }
29
30 pin_buff->data = (char *)pdbg_buff->data + offset;
31 pin_buff->offset = offset;
32 pin_buff->size = size;
33 return 0;
34 }
35
36 void cudbg_put_buff(struct cudbg_init *pdbg_init,
37 struct cudbg_buffer *pin_buff)
38 {
39
40 if (pdbg_init->compress_type != CUDBG_COMPRESSION_NONE)
41 memset(pdbg_init->compress_buff, 0,
42 pdbg_init->compress_buff_size);
43
44 pin_buff->data = NULL;
45 pin_buff->offset = 0;
46 pin_buff->size = 0;
47 }
48
49 void cudbg_update_buff(struct cudbg_buffer *pin_buff,
50 struct cudbg_buffer *pout_buff)
51 {
52
53
54
55 pout_buff->offset += pin_buff->size;
56 }