summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-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
6 files changed, 26 insertions, 24 deletions
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,
447} 447}
448 448
449/* the tight loop of ata_write_sectors(), to avoid the whole in IRAM */ 449/* the tight loop of ata_write_sectors(), to avoid the whole in IRAM */
450static void copy_write_sectors(unsigned char* buf, 450static void copy_write_sectors(const unsigned char* buf,
451 int wordcount) 451 int wordcount)
452 __attribute__ ((section (".icode"))); 452 __attribute__ ((section (".icode")));
453 453
454static void copy_write_sectors(unsigned char* buf, int wordcount) 454static void copy_write_sectors(const unsigned char* buf, int wordcount)
455{ 455{
456#ifdef PREFER_C_WRITING 456#ifdef PREFER_C_WRITING
457 457
@@ -566,7 +566,7 @@ static void copy_write_sectors(unsigned char* buf, int wordcount)
566 566
567int ata_write_sectors(unsigned long start, 567int ata_write_sectors(unsigned long start,
568 int count, 568 int count,
569 void* buf) 569 const void* buf)
570{ 570{
571 int i; 571 int i;
572 int ret = 0; 572 int ret = 0;
@@ -657,7 +657,7 @@ int ata_write_sectors(unsigned long start,
657 return ret; 657 return ret;
658} 658}
659 659
660extern void ata_delayed_write(unsigned long sector, void* buf) 660extern void ata_delayed_write(unsigned long sector, const void* buf)
661{ 661{
662 memcpy(delayed_sector, buf, SECTOR_SIZE); 662 memcpy(delayed_sector, buf, SECTOR_SIZE);
663 delayed_sector_num = sector; 663 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);
236static int first_sector_of_cluster(int cluster); 236static int first_sector_of_cluster(int cluster);
237static int bpb_is_sane(void); 237static int bpb_is_sane(void);
238static void *cache_fat_sector(int secnum); 238static void *cache_fat_sector(int secnum);
239static int create_dos_name(unsigned char *name, unsigned char *newname); 239static int create_dos_name(const unsigned char *name, unsigned char *newname);
240static unsigned int find_free_cluster(unsigned int start); 240static unsigned int find_free_cluster(unsigned int start);
241static int transfer( unsigned int start, int count, char* buf, bool write ); 241static int transfer( unsigned int start, int count, char* buf, bool write );
242 242
@@ -811,8 +811,8 @@ static void fat_time(unsigned short* date,
811static int write_long_name(struct fat_file* file, 811static int write_long_name(struct fat_file* file,
812 unsigned int firstentry, 812 unsigned int firstentry,
813 unsigned int numentries, 813 unsigned int numentries,
814 unsigned char* name, 814 const unsigned char* name,
815 unsigned char* shortname, 815 const unsigned char* shortname,
816 bool is_directory) 816 bool is_directory)
817{ 817{
818 unsigned char buf[SECTOR_SIZE]; 818 unsigned char buf[SECTOR_SIZE];
@@ -949,7 +949,7 @@ static int write_long_name(struct fat_file* file,
949 949
950static int add_dir_entry(struct fat_dir* dir, 950static int add_dir_entry(struct fat_dir* dir,
951 struct fat_file* file, 951 struct fat_file* file,
952 char* name, 952 const char* name,
953 bool is_directory, 953 bool is_directory,
954 bool dotdir) 954 bool dotdir)
955{ 955{
@@ -1178,7 +1178,7 @@ unsigned char char2dos(unsigned char c)
1178 return c; 1178 return c;
1179} 1179}
1180 1180
1181static int create_dos_name(unsigned char *name, unsigned char *newname) 1181static int create_dos_name(const unsigned char *name, unsigned char *newname)
1182{ 1182{
1183 int i,j; 1183 int i,j;
1184 1184
@@ -1265,7 +1265,7 @@ static int update_short_entry( struct fat_file* file, int size, int attr )
1265 return 0; 1265 return 0;
1266} 1266}
1267 1267
1268static int parse_direntry(struct fat_direntry *de, unsigned char *buf) 1268static int parse_direntry(struct fat_direntry *de, const unsigned char *buf)
1269{ 1269{
1270 int i=0,j=0; 1270 int i=0,j=0;
1271 memset(de, 0, sizeof(struct fat_direntry)); 1271 memset(de, 0, sizeof(struct fat_direntry));
@@ -1292,7 +1292,7 @@ static int parse_direntry(struct fat_direntry *de, unsigned char *buf)
1292 1292
1293int fat_open(unsigned int startcluster, 1293int fat_open(unsigned int startcluster,
1294 struct fat_file *file, 1294 struct fat_file *file,
1295 struct fat_dir* dir) 1295 const struct fat_dir* dir)
1296{ 1296{
1297 file->firstcluster = startcluster; 1297 file->firstcluster = startcluster;
1298 file->lastcluster = startcluster; 1298 file->lastcluster = startcluster;
@@ -1311,7 +1311,7 @@ int fat_open(unsigned int startcluster,
1311 return 0; 1311 return 0;
1312} 1312}
1313 1313
1314int fat_create_file(char* name, 1314int fat_create_file(const char* name,
1315 struct fat_file* file, 1315 struct fat_file* file,
1316 struct fat_dir* dir) 1316 struct fat_dir* dir)
1317{ 1317{
@@ -1331,7 +1331,7 @@ int fat_create_file(char* name,
1331 return rc; 1331 return rc;
1332} 1332}
1333 1333
1334int fat_create_dir(char* name, 1334int fat_create_dir(const char* name,
1335 struct fat_dir* newdir, 1335 struct fat_dir* newdir,
1336 struct fat_dir* dir) 1336 struct fat_dir* dir)
1337{ 1337{
@@ -1396,7 +1396,7 @@ int fat_create_dir(char* name,
1396 return rc; 1396 return rc;
1397} 1397}
1398 1398
1399int fat_truncate(struct fat_file *file) 1399int fat_truncate(const struct fat_file *file)
1400{ 1400{
1401 /* truncate trailing clusters */ 1401 /* truncate trailing clusters */
1402 int next; 1402 int next;
@@ -1551,7 +1551,7 @@ int fat_remove(struct fat_file* file)
1551} 1551}
1552 1552
1553int fat_rename(struct fat_file* file, 1553int fat_rename(struct fat_file* file,
1554 unsigned char* newname, 1554 const unsigned char* newname,
1555 int size, 1555 int size,
1556 int attr) 1556 int attr)
1557{ 1557{
@@ -1656,7 +1656,7 @@ static int transfer( unsigned int start, int count, char* buf, bool write )
1656} 1656}
1657 1657
1658 1658
1659int fat_readwrite( struct fat_file *file, int sectorcount, 1659int fat_readwrite( struct fat_file *file, int sectorcount,
1660 void* buf, bool write ) 1660 void* buf, bool write )
1661{ 1661{
1662 int cluster = file->lastcluster; 1662 int cluster = file->lastcluster;
@@ -1801,7 +1801,7 @@ int fat_seek(struct fat_file *file, unsigned int seeksector )
1801} 1801}
1802 1802
1803int fat_opendir(struct fat_dir *dir, unsigned int startcluster, 1803int fat_opendir(struct fat_dir *dir, unsigned int startcluster,
1804 struct fat_dir *parent_dir) 1804 const struct fat_dir *parent_dir)
1805{ 1805{
1806 int rc; 1806 int rc;
1807 1807
@@ -1823,7 +1823,8 @@ int fat_opendir(struct fat_dir *dir, unsigned int startcluster,
1823} 1823}
1824 1824
1825/* convert from unicode to a single-byte charset */ 1825/* convert from unicode to a single-byte charset */
1826static void unicode2iso(unsigned char* unicode, unsigned char* iso, int count ) 1826static void unicode2iso(const unsigned char* unicode, unsigned char* iso,
1827 int count)
1827{ 1828{
1828 int i; 1829 int i;
1829 1830
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)
198 return byte; 198 return byte;
199} 199}
200 200
201int i2c_write(int address, unsigned char* buf, int count ) 201int i2c_write(int address, const unsigned char* buf, int count )
202{ 202{
203 int i,x=0; 203 int i,x=0;
204 204
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)
398 lcd_free_pat(pat); 398 lcd_free_pat(pat);
399} 399}
400 400
401void lcd_define_pattern(int pat, char *pattern) 401void lcd_define_pattern(int pat, const char *pattern)
402{ 402{
403 int i; 403 int i;
404 for (i=0; i<7; i++) { 404 for (i=0; i<7; i++) {
@@ -410,7 +410,7 @@ void lcd_define_pattern(int pat, char *pattern)
410} 410}
411 411
412#ifndef SIMULATOR 412#ifndef SIMULATOR
413void lcd_define_hw_pattern (int which,char *pattern,int length) 413void lcd_define_hw_pattern (int which,const char *pattern,int length)
414{ 414{
415 lcd_write_command(lcd_pram | which); 415 lcd_write_command(lcd_pram | which);
416 lcd_write_data(pattern, length); 416 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)
165 165
166/* Performance function that works with an external buffer 166/* Performance function that works with an external buffer
167 note that y and height are in 8-pixel units! */ 167 note that y and height are in 8-pixel units! */
168void lcd_blit (unsigned char* p_data, int x, int y, int width, int height, int stride) 168void lcd_blit (const unsigned char* p_data, int x, int y, int width,
169 int height, int stride)
169{ 170{
170 /* Copy display bitmap to hardware */ 171 /* Copy display bitmap to hardware */
171 while (height--) 172 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)
112} 112}
113 113
114/* note: 'len' is number of 32-bit words, not number of bytes! */ 114/* note: 'len' is number of 32-bit words, not number of bytes! */
115int mas_writemem(int bank, int addr, unsigned long* src, int len) 115int mas_writemem(int bank, int addr, const unsigned long* src, int len)
116{ 116{
117 int ret = 0; 117 int ret = 0;
118 int i, j; 118 int i, j;
119 unsigned char buf[60]; 119 unsigned char buf[60];
120 unsigned char* ptr = (unsigned char*)src; 120 const unsigned char* ptr = (const unsigned char*)src;
121 121
122 i2c_begin(); 122 i2c_begin();
123 123