2008-03-01 15:15:07 Question about blackfin_cam.c
Frank Van Hooft (CANADA)
Message: 51957 I'm working my way through the blackfin_cam.c file as an educational exercise. I understand this is an example V4L1 driver, and the preferred method is V4L2. Still, blackfin_cam.c works, and I'm never one to argue with things that work. There is one line in the code I don't understand. In the bcap_open function is the line:
bottom_buffer = (unsigned char *)0x1000;
I understand there are two buffers, called bottom_buffer & top_buffer. I see that top_buffer is allocated using an alloc. Why wasn't bottom_buffer allocated the same way? What's the advantage of using a "magic number" approach to bottom_buffer, versus using an alloc? Or am I just completely misunderstanding here?
Thanks!
QuoteReplyEditDelete
2008-03-01 16:02:42 Re: Question about blackfin_cam.c
Mike Frysinger (UNITED STATES)
Message: 51958 there is no "magic number". we use the first address at the bottom of memory that is feasible (right after the NULL pointer section) and that address is at 4k (0x1000).
we picked the bottom of memory and the top of memory as we need uncachable memory for dma and we wanted to make sure they were in different memory banks.
QuoteReplyEditDelete
2008-03-01 16:49:25 Re: Question about blackfin_cam.c
Frank Van Hooft (CANADA)
Message: 51959 Ahh. Thanks Mike. The light goes on. You wanted the two buffers in different memory banks. That also explains the related question that had been running through my mind, which was, "Why not simply alloc a single doubled-sized buffer, then set one pointer to its start, and one pointer to its middle?". Obviously (now :-), if you'd done that, you'd again have the performance impact of both buffers most likely being in the same bank.
QuoteReplyEditDelete
2008-03-01 16:55:25 Re: Question about blackfin_cam.c
Mike Frysinger (UNITED STATES)
Message: 51960 that was the idea ... i'm not surely we entirely benchmarked it to see what the real world impact was ...