summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.h9
-rw-r--r--firmware/common/timefuncs.c4
-rw-r--r--firmware/drivers/ata.c8
-rw-r--r--firmware/drivers/fat.c29
-rw-r--r--firmware/drivers/i2c.c2
-rw-r--r--firmware/drivers/lcd-player.c4
-rw-r--r--firmware/drivers/lcd-recorder.c3
-rw-r--r--firmware/drivers/mas.c4
-rw-r--r--firmware/export/ata.h4
-rw-r--r--firmware/export/fat.h12
-rw-r--r--firmware/export/lcd.h9
-rw-r--r--firmware/export/mas.h2
-rw-r--r--firmware/include/timefuncs.h4
-rw-r--r--uisimulator/common/lcd-common.c2
-rw-r--r--uisimulator/common/lcd-playersim.c2
-rw-r--r--uisimulator/win32/timefuncs.h4
-rw-r--r--uisimulator/x11/timefuncs.h4
17 files changed, 55 insertions, 51 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
index d44aa7d60b..53648ad4c7 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -116,7 +116,7 @@ struct plugin_api {
void (*lcd_stop_scroll)(void);
void (*lcd_set_contrast)(int x);
#ifdef HAVE_LCD_CHARCELLS
- void (*lcd_define_pattern)(int which,char *pattern);
+ void (*lcd_define_pattern)(int which,const char *pattern);
unsigned char (*lcd_get_locked_pattern)(void);
void (*lcd_unlock_pattern)(unsigned char pat);
void (*lcd_putc)(int x, int y, unsigned short ch);
@@ -145,7 +145,8 @@ struct plugin_api {
int min_shown, int max_shown, int orientation);
void (*checkbox)(int x, int y, int width, int height, bool checked);
unsigned char* lcd_framebuffer;
- void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride);
+ void (*lcd_blit) (const unsigned char* p_data, int x, int y, int width,
+ int height, int stride);
#ifndef SIMULATOR
void (*lcd_roll)(int pixels);
#endif
@@ -235,7 +236,7 @@ struct plugin_api {
/* MAS communication */
#ifndef SIMULATOR
int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len);
- int (*mas_writemem)(int bank, int addr, unsigned long* src, int len);
+ int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len);
int (*mas_readreg)(int reg);
int (*mas_writereg)(int reg, unsigned int val);
#ifdef HAVE_MAS3587F
@@ -251,7 +252,7 @@ struct plugin_api {
int(*compar)(const void *, const void *));
int (*kbd_input)(char* buffer, int buflen);
struct tm* (*get_time)(void);
- int (*set_time)(struct tm *tm);
+ int (*set_time)(const struct tm *tm);
void* (*plugin_get_buffer)(int* buffer_size);
void* (*plugin_get_mp3_buffer)(int* buffer_size);
#ifndef SIMULATOR
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 9d56126b17..1e95733399 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -27,7 +27,7 @@
static struct tm tm;
#endif
-bool valid_time(struct tm *tm)
+bool valid_time(const struct tm *tm)
{
if (tm->tm_hour < 0 || tm->tm_hour > 23 ||
tm->tm_sec < 0 || tm->tm_sec > 59 ||
@@ -81,7 +81,7 @@ struct tm *get_time(void)
#endif
}
-int set_time(struct tm *tm)
+int set_time(const struct tm *tm)
{
#ifdef HAVE_RTC
int rc;
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 663df600ca..05000b02a8 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -447,11 +447,11 @@ int ata_read_sectors(unsigned long start,
}
/* the tight loop of ata_write_sectors(), to avoid the whole in IRAM */
-static void copy_write_sectors(unsigned char* buf,
+static void copy_write_sectors(const unsigned char* buf,
int wordcount)
__attribute__ ((section (".icode")));
-static void copy_write_sectors(unsigned char* buf, int wordcount)
+static void copy_write_sectors(const unsigned char* buf, int wordcount)
{
#ifdef PREFER_C_WRITING
@@ -566,7 +566,7 @@ static void copy_write_sectors(unsigned char* buf, int wordcount)
int ata_write_sectors(unsigned long start,
int count,
- void* buf)
+ const void* buf)
{
int i;
int ret = 0;
@@ -657,7 +657,7 @@ int ata_write_sectors(unsigned long start,
return ret;
}
-extern void ata_delayed_write(unsigned long sector, void* buf)
+extern void ata_delayed_write(unsigned long sector, const void* buf)
{
memcpy(delayed_sector, buf, SECTOR_SIZE);
delayed_sector_num = sector;
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 85a9deaa8c..1b530153a5 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -236,7 +236,7 @@ static int update_fsinfo(void);
static int first_sector_of_cluster(int cluster);
static int bpb_is_sane(void);
static void *cache_fat_sector(int secnum);
-static int create_dos_name(unsigned char *name, unsigned char *newname);
+static int create_dos_name(const unsigned char *name, unsigned char *newname);
static unsigned int find_free_cluster(unsigned int start);
static int transfer( unsigned int start, int count, char* buf, bool write );
@@ -811,8 +811,8 @@ static void fat_time(unsigned short* date,
static int write_long_name(struct fat_file* file,
unsigned int firstentry,
unsigned int numentries,
- unsigned char* name,
- unsigned char* shortname,
+ const unsigned char* name,
+ const unsigned char* shortname,
bool is_directory)
{
unsigned char buf[SECTOR_SIZE];
@@ -949,7 +949,7 @@ static int write_long_name(struct fat_file* file,
static int add_dir_entry(struct fat_dir* dir,
struct fat_file* file,
- char* name,
+ const char* name,
bool is_directory,
bool dotdir)
{
@@ -1178,7 +1178,7 @@ unsigned char char2dos(unsigned char c)
return c;
}
-static int create_dos_name(unsigned char *name, unsigned char *newname)
+static int create_dos_name(const unsigned char *name, unsigned char *newname)
{
int i,j;
@@ -1265,7 +1265,7 @@ static int update_short_entry( struct fat_file* file, int size, int attr )
return 0;
}
-static int parse_direntry(struct fat_direntry *de, unsigned char *buf)
+static int parse_direntry(struct fat_direntry *de, const unsigned char *buf)
{
int i=0,j=0;
memset(de, 0, sizeof(struct fat_direntry));
@@ -1292,7 +1292,7 @@ static int parse_direntry(struct fat_direntry *de, unsigned char *buf)
int fat_open(unsigned int startcluster,
struct fat_file *file,
- struct fat_dir* dir)
+ const struct fat_dir* dir)
{
file->firstcluster = startcluster;
file->lastcluster = startcluster;
@@ -1311,7 +1311,7 @@ int fat_open(unsigned int startcluster,
return 0;
}
-int fat_create_file(char* name,
+int fat_create_file(const char* name,
struct fat_file* file,
struct fat_dir* dir)
{
@@ -1331,7 +1331,7 @@ int fat_create_file(char* name,
return rc;
}
-int fat_create_dir(char* name,
+int fat_create_dir(const char* name,
struct fat_dir* newdir,
struct fat_dir* dir)
{
@@ -1396,7 +1396,7 @@ int fat_create_dir(char* name,
return rc;
}
-int fat_truncate(struct fat_file *file)
+int fat_truncate(const struct fat_file *file)
{
/* truncate trailing clusters */
int next;
@@ -1551,7 +1551,7 @@ int fat_remove(struct fat_file* file)
}
int fat_rename(struct fat_file* file,
- unsigned char* newname,
+ const unsigned char* newname,
int size,
int attr)
{
@@ -1656,7 +1656,7 @@ static int transfer( unsigned int start, int count, char* buf, bool write )
}
-int fat_readwrite( struct fat_file *file, int sectorcount,
+int fat_readwrite( struct fat_file *file, int sectorcount,
void* buf, bool write )
{
int cluster = file->lastcluster;
@@ -1801,7 +1801,7 @@ int fat_seek(struct fat_file *file, unsigned int seeksector )
}
int fat_opendir(struct fat_dir *dir, unsigned int startcluster,
- struct fat_dir *parent_dir)
+ const struct fat_dir *parent_dir)
{
int rc;
@@ -1823,7 +1823,8 @@ int fat_opendir(struct fat_dir *dir, unsigned int startcluster,
}
/* convert from unicode to a single-byte charset */
-static void unicode2iso(unsigned char* unicode, unsigned char* iso, int count )
+static void unicode2iso(const unsigned char* unicode, unsigned char* iso,
+ int count)
{
int i;
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c
index 24ad77495d..2fc53d579f 100644
--- a/firmware/drivers/i2c.c
+++ b/firmware/drivers/i2c.c
@@ -198,7 +198,7 @@ unsigned char i2c_inb(int ack)
return byte;
}
-int i2c_write(int address, unsigned char* buf, int count )
+int i2c_write(int address, const unsigned char* buf, int count )
{
int i,x=0;
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index d4a523afe3..fb870f232a 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -398,7 +398,7 @@ void lcd_unlock_pattern(unsigned char pat)
lcd_free_pat(pat);
}
-void lcd_define_pattern(int pat, char *pattern)
+void lcd_define_pattern(int pat, const char *pattern)
{
int i;
for (i=0; i<7; i++) {
@@ -410,7 +410,7 @@ void lcd_define_pattern(int pat, char *pattern)
}
#ifndef SIMULATOR
-void lcd_define_hw_pattern (int which,char *pattern,int length)
+void lcd_define_hw_pattern (int which,const char *pattern,int length)
{
lcd_write_command(lcd_pram | which);
lcd_write_data(pattern, length);
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index a8dca92b4f..c9781e77ef 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -165,7 +165,8 @@ void lcd_init (void)
/* Performance function that works with an external buffer
note that y and height are in 8-pixel units! */
-void lcd_blit (unsigned char* p_data, int x, int y, int width, int height, int stride)
+void lcd_blit (const unsigned char* p_data, int x, int y, int width,
+ int height, int stride)
{
/* Copy display bitmap to hardware */
while (height--)
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c
index c39a46c9f2..a6fd1d1a21 100644
--- a/firmware/drivers/mas.c
+++ b/firmware/drivers/mas.c
@@ -112,12 +112,12 @@ int mas_readmem(int bank, int addr, unsigned long* dest, int len)
}
/* note: 'len' is number of 32-bit words, not number of bytes! */
-int mas_writemem(int bank, int addr, unsigned long* src, int len)
+int mas_writemem(int bank, int addr, const unsigned long* src, int len)
{
int ret = 0;
int i, j;
unsigned char buf[60];
- unsigned char* ptr = (unsigned char*)src;
+ const unsigned char* ptr = (const unsigned char*)src;
i2c_begin();
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index 213d3e5b8b..06de33a8f2 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -42,8 +42,8 @@ extern int ata_hard_reset(void);
extern int ata_soft_reset(void);
extern int ata_init(void);
extern int ata_read_sectors(unsigned long start, int count, void* buf);
-extern int ata_write_sectors(unsigned long start, int count, void* buf);
-extern void ata_delayed_write(unsigned long sector, void* buf);
+extern int ata_write_sectors(unsigned long start, int count, const void* buf);
+extern void ata_delayed_write(unsigned long sector, const void* buf);
extern void ata_flush(void);
extern void ata_spin(void);
extern unsigned short* ata_get_identify(void);
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 24c894ff35..f4f09a2d19 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -72,14 +72,14 @@ struct fat_dir
extern int fat_mount(int startsector);
extern void fat_size(unsigned int* size, unsigned int* free);
extern void fat_recalc_free(void);
-extern int fat_create_dir(char* name,
+extern int fat_create_dir(const char* name,
struct fat_dir* newdir,
struct fat_dir* dir);
extern int fat_startsector(void);
extern int fat_open(unsigned int cluster,
struct fat_file* ent,
- struct fat_dir* dir);
-extern int fat_create_file(char* name,
+ const struct fat_dir* dir);
+extern int fat_create_file(const char* name,
struct fat_file* ent,
struct fat_dir* dir);
extern int fat_readwrite(struct fat_file *ent, int sectorcount,
@@ -87,13 +87,13 @@ extern int fat_readwrite(struct fat_file *ent, int sectorcount,
extern int fat_closewrite(struct fat_file *ent, int size, int attr);
extern int fat_seek(struct fat_file *ent, unsigned int sector );
extern int fat_remove(struct fat_file *ent);
-extern int fat_truncate(struct fat_file *ent);
+extern int fat_truncate(const struct fat_file *ent);
extern int fat_rename(struct fat_file* file,
- unsigned char* newname,
+ const unsigned char* newname,
int size, int attr);
extern int fat_opendir(struct fat_dir *ent, unsigned int currdir,
- struct fat_dir *parent_dir);
+ const struct fat_dir *parent_dir);
extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry);
extern int fat_get_cluster_size(void);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 2a8a7ff0b1..7dda83d8da 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -44,13 +44,14 @@ extern void lcd_scroll_speed( int speed );
extern void lcd_scroll_delay( int ms );
extern void lcd_set_contrast(int val);
extern void lcd_write_command( int byte );
-extern void lcd_write_data( unsigned char* p_bytes, int count );
+extern void lcd_write_data( const unsigned char* p_bytes, int count );
extern int lcd_default_contrast(void);
#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
extern void lcd_update(void);
/* performance function */
-extern void lcd_blit (unsigned char* p_data, int x, int y, int width, int height, int stride);
+extern void lcd_blit (const unsigned char* p_data, int x, int y, int width,
+ int height, int stride);
/* update a fraction of the screen */
extern void lcd_update_rect(int x, int y, int width, int height);
@@ -88,8 +89,8 @@ enum
ICON_PARAM
};
-extern void lcd_define_hw_pattern (int which,char *pattern,int length);
-extern void lcd_define_pattern (int which,char *pattern);
+extern void lcd_define_hw_pattern (int which,const char *pattern,int length);
+extern void lcd_define_pattern (int which,const char *pattern);
extern void lcd_double_height (bool on);
#define JUMP_SCROLL_ALWAYS 5
extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, ..., ALWAYS */
diff --git a/firmware/export/mas.h b/firmware/export/mas.h
index 573b9b6b37..8a60389ade 100644
--- a/firmware/export/mas.h
+++ b/firmware/export/mas.h
@@ -101,7 +101,7 @@
int mas_default_read(unsigned short *buf);
int mas_run(unsigned short address);
int mas_readmem(int bank, int addr, unsigned long* dest, int len);
-int mas_writemem(int bank, int addr, unsigned long* src, int len);
+int mas_writemem(int bank, int addr, const unsigned long* src, int len);
int mas_readreg(int reg);
int mas_writereg(int reg, unsigned int val);
void mas_reset(void);
diff --git a/firmware/include/timefuncs.h b/firmware/include/timefuncs.h
index 5c6719e709..03bb06fb9c 100644
--- a/firmware/include/timefuncs.h
+++ b/firmware/include/timefuncs.h
@@ -25,7 +25,7 @@
#include "time.h"
struct tm *get_time(void);
-int set_time(struct tm *tm);
-bool valid_time(struct tm *tm);
+int set_time(const struct tm *tm);
+bool valid_time(const struct tm *tm);
#endif /* _TIMEFUNCS_H_ */
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c
index f00e9a28b2..c69ef06f1f 100644
--- a/uisimulator/common/lcd-common.c
+++ b/uisimulator/common/lcd-common.c
@@ -30,7 +30,7 @@
#include "lcd-x11.h"
#endif
-void lcd_blit(unsigned char* p_data, int x, int y, int width, int height,
+void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height,
int stride)
{
(void)p_data;
diff --git a/uisimulator/common/lcd-playersim.c b/uisimulator/common/lcd-playersim.c
index ed633b849f..3f3453b9a1 100644
--- a/uisimulator/common/lcd-playersim.c
+++ b/uisimulator/common/lcd-playersim.c
@@ -222,7 +222,7 @@ void lcd_double_height(bool on)
lcd_update();
}
-void lcd_define_hw_pattern(int which, char *pattern, int length)
+void lcd_define_hw_pattern(int which, const char *pattern, int length)
{
int i, j;
int pat = which / 8;
diff --git a/uisimulator/win32/timefuncs.h b/uisimulator/win32/timefuncs.h
index 57bb3de5ce..8fbc5b1c85 100644
--- a/uisimulator/win32/timefuncs.h
+++ b/uisimulator/win32/timefuncs.h
@@ -4,5 +4,5 @@
/* struct tm defined */
struct tm *get_time(void);
-int set_time(struct tm *tm);
-bool valid_time(struct tm *tm);
+int set_time(const struct tm *tm);
+bool valid_time(const struct tm *tm);
diff --git a/uisimulator/x11/timefuncs.h b/uisimulator/x11/timefuncs.h
index 59e8b249eb..de17fcdc73 100644
--- a/uisimulator/x11/timefuncs.h
+++ b/uisimulator/x11/timefuncs.h
@@ -3,5 +3,5 @@
/* struct tm defined */
struct tm *get_time(void);
-int set_time(struct tm *tm);
-bool valid_time(struct tm *tm);
+int set_time(const struct tm *tm);
+bool valid_time(const struct tm *tm);