C语言源码
static void camera_callback(u32 mask, void *dev)
{
struct mxc_v4l_frame *done_frame;
struct mxc_v4l_frame *ready_frame;
cam_data *cam = (cam_data *) dev;
if (cam == NULL)
return;
if (mask == 1) {
printk("oh no,mask is 1 set cam->overflow = 1 ######");
cam->overflow = 1;
}
if (list_empty(&cam->working_q)) {
if (empty_wq_cnt == 0) {
printk(KERN_ERR "camera_callback: working queue empty %d\n",empty_wq_cnt);
}
empty_wq_cnt++;
if (list_empty(&cam->ready_q)) {
cam->skip_frame++;
} else {
ready_frame =
list_entry(cam->ready_q.next, struct mxc_v4l_frame,
queue);
list_del(cam->ready_q.next);
list_add_tail(&ready_frame->queue, &cam->working_q);
cam->enc_update_eba(ready_frame->paddress,
&cam->ping_pong_csi);
}
return;
}
done_frame =
list_entry(cam->working_q.next, struct mxc_v4l_frame, queue);
if (done_frame->buffer.flags & V4L2_BUF_FLAG_QUEUED) {
done_frame->buffer.flags |= V4L2_BUF_FLAG_DONE;
done_frame->buffer.flags &= ~V4L2_BUF_FLAG_QUEUED;
if (list_empty(&cam->ready_q)) {
cam->skip_frame++;
} else {
ready_frame =
list_entry(cam->ready_q.next, struct mxc_v4l_frame,
queue);
list_del(cam->ready_q.next);
list_add_tail(&ready_frame->queue, &cam->working_q);
cam->enc_update_eba(ready_frame->paddress,
&cam->ping_pong_csi);
}
/* Added to the done queue */
list_del(cam->working_q.next);
list_add_tail(&done_frame->queue, &cam->done_q);
/* Wake up the queue */
cam->enc_counter++;
wake_up_interruptible(&cam->enc_queue);
} else {
printk(KERN_ERR "camera_callback :buffer not queued\n");
}
}
放汇编
000025cc <camera_callback>:
25cc: e1a0c00d mov ip, sp
25d0: e92dd870 stmdb sp!, {r4, r5, r6, fp, ip, lr, pc}
25d4: e24cb004 sub fp, ip, #4 ; 0x4
25d8: e2515000 subs r5, r1, #0 ; 0x0
25dc: e1a04000 mov r4, r0
25e0: 089da870 ldmeqia sp, {r4, r5, r6, fp, sp, pc}
25e4: e3500001 cmp r0, #1 ; 0x1
25e8: 1a000002 bne 25f8 <camera_callback+0x2c>
25ec: e59f0174 ldr r0, [pc, #372] ; 2768 <.text+0x2768>
25f0: ebfffffe bl 0 <printk>
25f4: e585416c str r4, [r5, #364]
25f8: e5952030 ldr r2, [r5, #48]
25fc: e2854030 add r4, r5, #48 ; 0x30
2600: e1520004 cmp r2, r4
2604: 1a00001f bne 2688 <camera_callback+0xbc>
2608: e59f615c ldr r6, [pc, #348] ; 276c <.text+0x276c>
260c: e5961000 ldr r1, [r6]
2610: e3510000 cmp r1, #0 ; 0x0
2614: 1a000001 bne 2620 <camera_callback+0x54>
2618: e59f0150 ldr r0, [pc, #336] ; 2770 <.text+0x2770>
261c: ebfffffe bl 0 <printk>
2620: e5963000 ldr r3, [r6]
2624: e2852020 add r2, r5, #32 ; 0x20
2628: e2833001 add r3, r3, #1 ; 0x1
262c: e5863000 str r3, [r6]
2630: e595c020 ldr ip, [r5, #32]
2634: e15c0002 cmp ip, r2
2638: 05953168 ldreq r3, [r5, #360]
263c: 02833001 addeq r3, r3, #1 ; 0x1
2640: 05853168 streq r3, [r5, #360]
2644: 089da870 ldmeqia sp, {r4, r5, r6, fp, sp, pc}
2648: e59c1004 ldr r1, [ip, #4]
264c: e59c2000 ldr r2, [ip]
2650: e59f311c ldr r3, [pc, #284] ; 2774 <.text+0x2774>