Merge pull request #119 from kwagyeman/master

Fix file buffer init bug.
This commit is contained in:
Ibrahim Abd Elkader 2016-04-15 13:45:14 +02:00
commit 398eb7f95b
3 changed files with 12 additions and 0 deletions

View File

@ -102,6 +102,14 @@ static uint8_t *file_buffer_pointer = 0;
static uint32_t file_buffer_size = 0; static uint32_t file_buffer_size = 0;
static uint32_t file_buffer_index = 0; static uint32_t file_buffer_index = 0;
void file_buffer_init0()
{
file_buffer_offset = 0;
file_buffer_pointer = 0;
file_buffer_size = 0;
file_buffer_index = 0;
}
ALWAYS_INLINE static void file_fill(FIL *fp) ALWAYS_INLINE static void file_fill(FIL *fp)
{ {
if (file_buffer_index == file_buffer_size) { if (file_buffer_index == file_buffer_size) {

View File

@ -18,6 +18,8 @@ void file_read_open(FIL *fp, const char *path);
void file_write_open(FIL *fp, const char *path); void file_write_open(FIL *fp, const char *path);
void file_close(FIL *fp); void file_close(FIL *fp);
void file_seek(FIL *fp, UINT offset); void file_seek(FIL *fp, UINT offset);
// File buffer functions.
void file_buffer_init0();
void file_buffer_on(FIL *fp); // does fb_alloc_all void file_buffer_on(FIL *fp); // does fb_alloc_all
uint32_t file_tell_w_buf(FIL *fp); // valid between on and off uint32_t file_tell_w_buf(FIL *fp); // valid between on and off
uint32_t file_size_w_buf(FIL *fp); // valid between on and off uint32_t file_size_w_buf(FIL *fp); // valid between on and off

View File

@ -49,6 +49,7 @@
#include "usbdbg.h" #include "usbdbg.h"
#include "sdram.h" #include "sdram.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "ff_wrapper.h"
#include "irqs.h" #include "irqs.h"
#include "usbd_core.h" #include "usbd_core.h"
@ -318,6 +319,7 @@ soft_reset:
pyb_usb_init0(); pyb_usb_init0();
sensor_init0(); sensor_init0();
fb_alloc_init0(); fb_alloc_init0();
file_buffer_init0();
py_lcd_init0(); py_lcd_init0();
py_fir_init0(); py_fir_init0();