Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\842\842_compress.c Create Date:2022-07-28 06:57:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:add_template

Proto:static int add_template(struct sw842_param *p, u8 c)

Type:int

Parameter:

TypeParameterName
struct sw842_param *p
u8c
224  b = 0
225  t = comp_ops[c]
226  bool inv = false
228  If c >= he max of the regular templates - not including the special templates Then Return -EINVAL
231  pr_debug("template %x\n", t[4])
233  ret = add_bits(p, t[4], additional bits of each op param )
234  If ret Then Return ret
237  When i < 4 cycle
238  pr_debug("op %x\n", t[i])
241  Case & == OP_AMOUNT_8
242  If b Then inv = true
244  Else if t[i] & OP_ACTION_INDEX Then ret = add_bits(p, index8[0], I8_BITS)
246  Else if t[i] & OP_ACTION_DATA Then ret = add_bits(p, data8[0], 64)
248  Else inv = true
250  Break
251  Case & == OP_AMOUNT_4
252  If b == 2 && t[i] & OP_ACTION_DATA Then ret = add_bits(p, get_input_data(p, 2, 32), 32)
254  Else if b != 0 && b != 4 Then inv = true
256  Else if t[i] & OP_ACTION_INDEX Then ret = add_bits(p, index4[b >> 2], I4_BITS)
258  Else if t[i] & OP_ACTION_DATA Then ret = add_bits(p, data4[b >> 2], 32)
260  Else inv = true
262  Break
263  Case & == OP_AMOUNT_2
264  If b != 0 && b != 2 && b != 4 && b != 6 Then inv = true
266  If t[i] & OP_ACTION_INDEX Then ret = add_bits(p, index2[b >> 1], I2_BITS)
268  Else if t[i] & OP_ACTION_DATA Then ret = add_bits(p, data2[b >> 1], 16)
270  Else inv = true
272  Break
273  Case & == OP_AMOUNT_0
274  inv = b != 8 || Not (t[i] & OP_ACTION_NOOP)
275  Break
276  Default
277  inv = true
278  Break
281  If ret Then Return ret
284  If inv Then
285  pr_err("Invalid templ %x op %d : %x %x %x %x\n", c, i, t[0], t[1], t[2], t[3])
287  Return -EINVAL
290  b += t[i] & OP_AMOUNT
293  If b != 8 Then
294  pr_err("Invalid template %x len %x : %x %x %x %x\n", c, b, t[0], t[1], t[2], t[3])
296  Return -EINVAL
299  If sw842_template_counts Then atomic_inc( & template_count[t[4]])
302  Return 0
Caller
NameDescribe
process_nextd the next template to use, and add it* the p->dataN fields must already be set for the current 8 byte block