summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2010-08-08 10:49:32 +0000
committerBertrik Sikken <bertrik@sikken.nl>2010-08-08 10:49:32 +0000
commit446445e9162d19ceeabf889e6aa916ec9ec58b5b (patch)
tree8d79e04a090e70872ecd719880ddff250dcd0591 /firmware
parent82a2cdb2adcb26a6c0c61c1f717d8749245a0e54 (diff)
downloadrockbox-446445e9162d19ceeabf889e6aa916ec9ec58b5b.tar.gz
rockbox-446445e9162d19ceeabf889e6aa916ec9ec58b5b.tar.bz2
rockbox-446445e9162d19ceeabf889e6aa916ec9ec58b5b.zip
ipod nano 2g: make functions/variables static where possible, add missing #includes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27752 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c134
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c9
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c72
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/pmu-nano2g.c1
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c5
-rw-r--r--firmware/target/arm/s5l8700/pcm-s5l8700.c8
-rw-r--r--firmware/target/arm/usb-s3c6400x.c8
7 files changed, 116 insertions, 121 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
index 65a282fe37..69fac62289 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/ftl-nano2g.c
@@ -178,7 +178,7 @@ struct ftl_cxt_type
/* Seems to be unused, but gets loaded from flash by Whimory. */
uint8_t field_130[0x15C];
-} __attribute__((packed)) FTLCxtType;
+} __attribute__((packed));
/* Keeps the state of the bank's VFL, both on flash and in memory.
@@ -363,54 +363,54 @@ const struct nand_device_info_type* ftl_nand_type;
uint32_t ftl_banks;
/* Block map, used vor pBlock to vBlock mapping */
-uint16_t ftl_map[0x2000];
+static uint16_t ftl_map[0x2000];
/* VFL context for each bank */
-struct ftl_vfl_cxt_type ftl_vfl_cxt[4];
+static struct ftl_vfl_cxt_type ftl_vfl_cxt[4];
/* FTL context */
-struct ftl_cxt_type ftl_cxt;
+static struct ftl_cxt_type ftl_cxt;
/* Temporary data buffers for internal use by the FTL */
-uint8_t ftl_buffer[0x800] STORAGE_ALIGN_ATTR;
+static uint8_t ftl_buffer[0x800] STORAGE_ALIGN_ATTR;
/* Temporary spare byte buffer for internal use by the FTL */
-union ftl_spare_data_type ftl_sparebuffer[FTL_WRITESPARE_SIZE] STORAGE_ALIGN_ATTR;
+static union ftl_spare_data_type ftl_sparebuffer[FTL_WRITESPARE_SIZE] STORAGE_ALIGN_ATTR;
#ifndef FTL_READONLY
/* Lowlevel BBT for each bank */
-uint8_t ftl_bbt[4][0x410];
+static uint8_t ftl_bbt[4][0x410];
/* Erase counters for the vBlocks */
-uint16_t ftl_erasectr[0x2000];
+static uint16_t ftl_erasectr[0x2000];
/* Used by ftl_log */
-uint16_t ftl_offsets[0x11][0x200];
+static uint16_t ftl_offsets[0x11][0x200];
/* Structs keeping record of scattered page blocks */
-struct ftl_log_type ftl_log[0x11];
+static struct ftl_log_type ftl_log[0x11];
/* Global cross-bank update sequence number of the VFL context */
-uint32_t ftl_vfl_usn;
+static uint32_t ftl_vfl_usn;
/* Keeps track (temporarily) of troublesome blocks */
-struct ftl_trouble_type ftl_troublelog[5];
+static struct ftl_trouble_type ftl_troublelog[5];
/* Counts erase counter page changes, after 100 of them the affected
page will be committed to the flash. */
-uint8_t ftl_erasectr_dirt[8];
+static uint8_t ftl_erasectr_dirt[8];
/* Buffer needed for copying pages around while moving or committing blocks.
This can't be shared with ftl_buffer, because this one could be overwritten
during the copying operation in order to e.g. commit a CXT. */
-uint8_t ftl_copybuffer[FTL_COPYBUF_SIZE][0x800] STORAGE_ALIGN_ATTR;
-union ftl_spare_data_type ftl_copyspare[FTL_COPYBUF_SIZE] STORAGE_ALIGN_ATTR;
+static uint8_t ftl_copybuffer[FTL_COPYBUF_SIZE][0x800] STORAGE_ALIGN_ATTR;
+static union ftl_spare_data_type ftl_copyspare[FTL_COPYBUF_SIZE] STORAGE_ALIGN_ATTR;
/* Needed to store the old scattered page offsets in order to be able to roll
back if something fails while compacting a scattered page block. */
-uint16_t ftl_offsets_backup[0x200] STORAGE_ALIGN_ATTR;
+static uint16_t ftl_offsets_backup[0x200] STORAGE_ALIGN_ATTR;
#endif
@@ -421,7 +421,7 @@ static struct mutex ftl_mtx;
/* Finds a device info page for the specified bank and returns its number.
Used to check if one is present, and to read the lowlevel BBT. */
-uint32_t ftl_find_devinfo(uint32_t bank)
+static uint32_t ftl_find_devinfo(uint32_t bank)
{
/* Scan the last 10% of the flash for device info pages */
uint32_t lowestBlock = ftl_nand_type->blocks
@@ -445,7 +445,7 @@ uint32_t ftl_find_devinfo(uint32_t bank)
/* Checks if all banks have proper device info pages */
-uint32_t ftl_has_devinfo(void)
+static uint32_t ftl_has_devinfo(void)
{
uint32_t i;
for (i = 0; i < ftl_banks; i++) if (ftl_find_devinfo(i) == 0) return 0;
@@ -455,7 +455,7 @@ uint32_t ftl_has_devinfo(void)
/* Loads the lowlevel BBT for a bank to the specified buffer.
This is based on some cryptic disassembly and not fully understood yet. */
-uint32_t ftl_load_bbt(uint32_t bank, uint8_t* bbt)
+static uint32_t ftl_load_bbt(uint32_t bank, uint8_t* bbt)
{
uint32_t i, j;
uint32_t pagebase, page = ftl_find_devinfo(bank), page2;
@@ -489,8 +489,8 @@ uint32_t ftl_load_bbt(uint32_t bank, uint8_t* bbt)
/* Calculates the checksums for the VFL context page of the specified bank */
-void ftl_vfl_calculate_checksum(uint32_t bank,
- uint32_t* checksum1, uint32_t* checksum2)
+static void ftl_vfl_calculate_checksum(uint32_t bank,
+ uint32_t* checksum1, uint32_t* checksum2)
{
uint32_t i;
*checksum1 = 0xAABBCCDD;
@@ -505,7 +505,7 @@ void ftl_vfl_calculate_checksum(uint32_t bank,
/* Checks if the checksums of the VFL context
of the specified bank are correct */
-uint32_t ftl_vfl_verify_checksum(uint32_t bank)
+static uint32_t ftl_vfl_verify_checksum(uint32_t bank)
{
uint32_t checksum1, checksum2;
ftl_vfl_calculate_checksum(bank, &checksum1, &checksum2);
@@ -520,7 +520,7 @@ uint32_t ftl_vfl_verify_checksum(uint32_t bank)
#ifndef FTL_READONLY
/* Updates the checksums of the VFL context of the specified bank */
-void ftl_vfl_update_checksum(uint32_t bank)
+static void ftl_vfl_update_checksum(uint32_t bank)
{
ftl_vfl_calculate_checksum(bank, &ftl_vfl_cxt[bank].checksum1,
&ftl_vfl_cxt[bank].checksum2);
@@ -531,7 +531,7 @@ void ftl_vfl_update_checksum(uint32_t bank)
#ifndef FTL_READONLY
/* Writes 8 copies of the VFL context of the specified bank to flash,
and succeeds if at least 4 can be read back properly. */
-uint32_t ftl_vfl_store_cxt(uint32_t bank)
+static uint32_t ftl_vfl_store_cxt(uint32_t bank)
{
uint32_t i;
ftl_vfl_cxt[bank].updatecount--;
@@ -575,7 +575,7 @@ uint32_t ftl_vfl_store_cxt(uint32_t bank)
#ifndef FTL_READONLY
/* Commits the VFL context of the specified bank to flash,
retries until it works or all available pages have been tried */
-uint32_t ftl_vfl_commit_cxt(uint32_t bank)
+static uint32_t ftl_vfl_commit_cxt(uint32_t bank)
{
if (ftl_vfl_cxt[bank].nextcxtpage + 8 <= ftl_nand_type->pagesperblock)
if (ftl_vfl_store_cxt(bank) == 0) return 0;
@@ -604,7 +604,7 @@ uint32_t ftl_vfl_commit_cxt(uint32_t bank)
/* Returns a pointer to the most recently updated VFL context,
used to find out the current FTL context vBlock numbers
(planetbeing's "maxthing") */
-struct ftl_vfl_cxt_type* ftl_vfl_get_newest_cxt(void)
+static struct ftl_vfl_cxt_type* ftl_vfl_get_newest_cxt(void)
{
uint32_t i, maxusn;
struct ftl_vfl_cxt_type* cxt = (struct ftl_vfl_cxt_type*)0;
@@ -621,7 +621,7 @@ struct ftl_vfl_cxt_type* ftl_vfl_get_newest_cxt(void)
/* Checks if the specified pBlock is marked bad in the supplied lowlevel BBT.
Only used while mounting the VFL. */
-uint32_t ftl_is_good_block(uint8_t* bbt, uint32_t block)
+static uint32_t ftl_is_good_block(uint8_t* bbt, uint32_t block)
{
if ((bbt[block >> 3] & (1 << (block & 7))) == 0) return 0;
else return 1;
@@ -629,7 +629,7 @@ uint32_t ftl_is_good_block(uint8_t* bbt, uint32_t block)
/* Checks if the specified vBlock could be remapped */
-uint32_t ftl_vfl_is_good_block(uint32_t bank, uint32_t block)
+static uint32_t ftl_vfl_is_good_block(uint32_t bank, uint32_t block)
{
uint8_t bbtentry = ftl_vfl_cxt[bank].bbt[block >> 6];
if ((bbtentry & (1 << ((7 - (block >> 3)) & 7))) == 0) return 0;
@@ -640,7 +640,7 @@ uint32_t ftl_vfl_is_good_block(uint32_t bank, uint32_t block)
#ifndef FTL_READONLY
/* Sets or unsets the bad bit of the specified vBlock
in the specified bank's VFL context */
-void ftl_vfl_set_good_block(uint32_t bank, uint32_t block, uint32_t isgood)
+static void ftl_vfl_set_good_block(uint32_t bank, uint32_t block, uint32_t isgood)
{
uint8_t bit = (1 << ((7 - (block >> 3)) & 7));
if (isgood == 1) ftl_vfl_cxt[bank].bbt[block >> 6] |= bit;
@@ -650,9 +650,9 @@ void ftl_vfl_set_good_block(uint32_t bank, uint32_t block, uint32_t isgood)
/* Tries to read a VFL context from the specified bank, pBlock and page */
-uint32_t ftl_vfl_read_page(uint32_t bank, uint32_t block,
- uint32_t startpage, void* databuffer,
- union ftl_spare_data_type* sparebuffer)
+static uint32_t ftl_vfl_read_page(uint32_t bank, uint32_t block,
+ uint32_t startpage, void* databuffer,
+ union ftl_spare_data_type* sparebuffer)
{
uint32_t i;
for (i = 0; i < 8; i++)
@@ -670,7 +670,7 @@ uint32_t ftl_vfl_read_page(uint32_t bank, uint32_t block,
/* Translates a bank and vBlock to a pBlock, following remaps */
-uint32_t ftl_vfl_get_physical_block(uint32_t bank, uint32_t block)
+static uint32_t ftl_vfl_get_physical_block(uint32_t bank, uint32_t block)
{
if (ftl_vfl_is_good_block(bank, block) == 1) return block;
@@ -685,7 +685,7 @@ uint32_t ftl_vfl_get_physical_block(uint32_t bank, uint32_t block)
#ifndef FTL_READONLY
/* Checks if remapping is scheduled for the specified bank and vBlock */
-uint32_t ftl_vfl_check_remap_scheduled(uint32_t bank, uint32_t block)
+static uint32_t ftl_vfl_check_remap_scheduled(uint32_t bank, uint32_t block)
{
uint32_t i;
for (i = 0x333; i > 0 && i > ftl_vfl_cxt[bank].scheduledstart; i--)
@@ -697,7 +697,7 @@ uint32_t ftl_vfl_check_remap_scheduled(uint32_t bank, uint32_t block)
#ifndef FTL_READONLY
/* Schedules remapping for the specified bank and vBlock */
-void ftl_vfl_schedule_block_for_remap(uint32_t bank, uint32_t block)
+static void ftl_vfl_schedule_block_for_remap(uint32_t bank, uint32_t block)
{
if (ftl_vfl_check_remap_scheduled(bank, block) == 1)
return;
@@ -713,7 +713,7 @@ void ftl_vfl_schedule_block_for_remap(uint32_t bank, uint32_t block)
#ifndef FTL_READONLY
/* Removes the specified bank and vBlock combination
from the remap scheduled list */
-void ftl_vfl_mark_remap_done(uint32_t bank, uint32_t block)
+static void ftl_vfl_mark_remap_done(uint32_t bank, uint32_t block)
{
uint32_t i;
uint32_t start = ftl_vfl_cxt[bank].scheduledstart;
@@ -734,7 +734,7 @@ void ftl_vfl_mark_remap_done(uint32_t bank, uint32_t block)
/* Logs that there is trouble for the specified vBlock on the specified bank.
The vBlock will be scheduled for remap
if there is too much trouble with it. */
-void ftl_vfl_log_trouble(uint32_t bank, uint32_t vblock)
+static void ftl_vfl_log_trouble(uint32_t bank, uint32_t vblock)
{
uint32_t i;
for (i = 0; i < 5; i++)
@@ -763,7 +763,7 @@ void ftl_vfl_log_trouble(uint32_t bank, uint32_t vblock)
#ifndef FTL_READONLY
/* Logs a successful erase for the specified vBlock on the specified bank */
-void ftl_vfl_log_success(uint32_t bank, uint32_t vblock)
+static void ftl_vfl_log_success(uint32_t bank, uint32_t vblock)
{
uint32_t i;
for (i = 0; i < 5; i++)
@@ -783,7 +783,7 @@ void ftl_vfl_log_success(uint32_t bank, uint32_t vblock)
not caring about data in there.
If it worked, it will return the new pBlock number,
if not (no more spare blocks available), it will return zero. */
-uint32_t ftl_vfl_remap_block(uint32_t bank, uint32_t block)
+static uint32_t ftl_vfl_remap_block(uint32_t bank, uint32_t block)
{
uint32_t i;
uint32_t newblock = 0, newidx;
@@ -813,8 +813,8 @@ uint32_t ftl_vfl_remap_block(uint32_t bank, uint32_t block)
/* Reads the specified vPage, dealing with all kinds of trouble */
-uint32_t ftl_vfl_read(uint32_t vpage, void* buffer, void* sparebuffer,
- uint32_t checkempty, uint32_t remaponfail)
+static uint32_t ftl_vfl_read(uint32_t vpage, void* buffer, void* sparebuffer,
+ uint32_t checkempty, uint32_t remaponfail)
{
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
uint32_t syshyperblocks = ftl_nand_type->blocks
@@ -852,8 +852,8 @@ uint32_t ftl_vfl_read(uint32_t vpage, void* buffer, void* sparebuffer,
/* Multi-bank version of ftl_vfl_read, will read ftl_banks pages in parallel */
-uint32_t ftl_vfl_read_fast(uint32_t vpage, void* buffer, void* sparebuffer,
- uint32_t checkempty, uint32_t remaponfail)
+static uint32_t ftl_vfl_read_fast(uint32_t vpage, void* buffer, void* sparebuffer,
+ uint32_t checkempty, uint32_t remaponfail)
{
uint32_t i, rc = 0;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -922,8 +922,8 @@ uint32_t ftl_vfl_read_fast(uint32_t vpage, void* buffer, void* sparebuffer,
#ifndef FTL_READONLY
/* Writes the specified vPage, dealing with all kinds of trouble */
-uint32_t ftl_vfl_write(uint32_t vpage, uint32_t count,
- void* buffer, void* sparebuffer)
+static uint32_t ftl_vfl_write(uint32_t vpage, uint32_t count,
+ void* buffer, void* sparebuffer)
{
uint32_t i, j;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -993,7 +993,7 @@ uint32_t ftl_vfl_write(uint32_t vpage, uint32_t count,
/* Mounts the VFL on all banks */
-uint32_t ftl_vfl_open(void)
+static uint32_t ftl_vfl_open(void)
{
uint32_t i, j, k;
uint32_t minusn, vflcxtidx, last;
@@ -1080,7 +1080,7 @@ uint32_t ftl_vfl_open(void)
/* Mounts the actual FTL */
-uint32_t ftl_open(void)
+static uint32_t ftl_open(void)
{
uint32_t i;
uint32_t ret;
@@ -1182,7 +1182,7 @@ uint32_t ftl_open(void)
#ifndef FTL_READONLY
/* Returns a pointer to the ftl_log entry for the specified vBlock,
or null, if there is none */
-struct ftl_log_type* ftl_get_log_entry(uint32_t block)
+static struct ftl_log_type* ftl_get_log_entry(uint32_t block)
{
uint32_t i;
for (i = 0; i < 0x11; i++)
@@ -1264,7 +1264,7 @@ uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer)
#ifndef FTL_READONLY
/* Performs a vBlock erase, dealing with hardware,
remapping and all kinds of trouble */
-uint32_t ftl_erase_block_internal(uint32_t block)
+static uint32_t ftl_erase_block_internal(uint32_t block)
{
uint32_t i, j;
block = block + ftl_nand_type->blocks
@@ -1308,7 +1308,7 @@ uint32_t ftl_erase_block_internal(uint32_t block)
#ifndef FTL_READONLY
/* Highlevel vBlock erase, that increments the erase counter for the block */
-uint32_t ftl_erase_block(uint32_t block)
+static uint32_t ftl_erase_block(uint32_t block)
{
ftl_erasectr[block]++;
if (ftl_erasectr_dirt[block >> 10] == 100) ftl_cxt.erasedirty = 1;
@@ -1321,7 +1321,7 @@ uint32_t ftl_erase_block(uint32_t block)
#ifndef FTL_READONLY
/* Allocates a block from the pool,
returning its vBlock number, or 0xFFFFFFFF on error */
-uint32_t ftl_allocate_pool_block(void)
+static uint32_t ftl_allocate_pool_block(void)
{
uint32_t i;
uint32_t erasectr = 0xFFFFFFFF, bestidx = 0xFFFFFFFF, block;
@@ -1355,7 +1355,7 @@ uint32_t ftl_allocate_pool_block(void)
#ifndef FTL_READONLY
/* Releases a vBlock back into the pool */
-void ftl_release_pool_block(uint32_t block)
+static void ftl_release_pool_block(uint32_t block)
{
if (block >= (uint32_t)ftl_nand_type->userblocks + 0x17)
panicf("FTL: Tried to release block %u", (unsigned)block);
@@ -1369,7 +1369,7 @@ void ftl_release_pool_block(uint32_t block)
#ifndef FTL_READONLY
/* Commits the location of the FTL context blocks
to a semi-randomly chosen VFL context */
-uint32_t ftl_store_ctrl_block_list(void)
+static uint32_t ftl_store_ctrl_block_list(void)
{
uint32_t i;
for (i = 0; i < ftl_banks; i++)
@@ -1382,7 +1382,7 @@ uint32_t ftl_store_ctrl_block_list(void)
#ifndef FTL_READONLY
/* Saves the n-th erase counter page to the flash,
because it is too dirty or needs to be moved. */
-uint32_t ftl_save_erasectr_page(uint32_t index)
+static uint32_t ftl_save_erasectr_page(uint32_t index)
{
memset(&ftl_sparebuffer[0], 0xFF, 0x40);
ftl_sparebuffer[0].meta.usn = ftl_cxt.usn;
@@ -1408,7 +1408,7 @@ uint32_t ftl_save_erasectr_page(uint32_t index)
#ifndef FTL_READONLY
/* Increments ftl_cxt.ftlctrlpage to the next available FTL context page,
allocating a new context block if neccessary. */
-uint32_t ftl_next_ctrl_pool_page(void)
+static uint32_t ftl_next_ctrl_pool_page(void)
{
uint32_t i;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1446,8 +1446,8 @@ uint32_t ftl_next_ctrl_pool_page(void)
#ifndef FTL_READONLY
/* Copies a vPage from one location to another */
-uint32_t ftl_copy_page(uint32_t source, uint32_t destination,
- uint32_t lpn, uint32_t type)
+static uint32_t ftl_copy_page(uint32_t source, uint32_t destination,
+ uint32_t lpn, uint32_t type)
{
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
uint32_t rc = ftl_vfl_read(source, ftl_copybuffer[0],
@@ -1467,7 +1467,7 @@ uint32_t ftl_copy_page(uint32_t source, uint32_t destination,
#ifndef FTL_READONLY
/* Copies a pBlock to a vBlock */
-uint32_t ftl_copy_block(uint32_t source, uint32_t destination)
+static uint32_t ftl_copy_block(uint32_t source, uint32_t destination)
{
uint32_t i, j;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1509,7 +1509,7 @@ uint32_t ftl_copy_block(uint32_t source, uint32_t destination)
#ifndef FTL_READONLY
/* Clears ftl_log.issequential, if something violating that is written. */
-void ftl_check_still_sequential(struct ftl_log_type* entry, uint32_t page)
+static void ftl_check_still_sequential(struct ftl_log_type* entry, uint32_t page)
{
if (entry->pagesused != entry->pagescurrent
|| entry->pageoffsets[page] != page)
@@ -1526,7 +1526,7 @@ void ftl_check_still_sequential(struct ftl_log_type* entry, uint32_t page)
space again. This is usually done when a scattered page block is being
removed because it is full, but less than half of the pages in there are
still in use and rest is just filled with old crap. */
-uint32_t ftl_compact_scattered(struct ftl_log_type* entry)
+static uint32_t ftl_compact_scattered(struct ftl_log_type* entry)
{
uint32_t i, j;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1582,7 +1582,7 @@ uint32_t ftl_compact_scattered(struct ftl_log_type* entry)
#ifndef FTL_READONLY
/* Commits an ftl_log entry to proper blocks, no matter what's in there. */
-uint32_t ftl_commit_scattered(struct ftl_log_type* entry)
+static uint32_t ftl_commit_scattered(struct ftl_log_type* entry)
{
uint32_t i;
uint32_t error;
@@ -1610,7 +1610,7 @@ uint32_t ftl_commit_scattered(struct ftl_log_type* entry)
sequentially until now, in order to be able to save a block erase by
committing it without needing to copy it again.
If this fails for whichever reason, it will be committed the usual way. */
-uint32_t ftl_commit_sequential(struct ftl_log_type* entry)
+static uint32_t ftl_commit_sequential(struct ftl_log_type* entry)
{
uint32_t i;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1656,7 +1656,7 @@ uint32_t ftl_commit_sequential(struct ftl_log_type* entry)
/* If a log entry is supplied, its scattered page block will be removed in
whatever way seems most appropriate. Else, the oldest scattered page block
will be freed by committing it. */
-uint32_t ftl_remove_scattered_block(struct ftl_log_type* entry)
+static uint32_t ftl_remove_scattered_block(struct ftl_log_type* entry)
{
uint32_t i;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1692,7 +1692,7 @@ uint32_t ftl_remove_scattered_block(struct ftl_log_type* entry)
#ifndef FTL_READONLY
/* Initialize a log entry to the values for an empty scattered page block */
-void ftl_init_log_entry(struct ftl_log_type* entry)
+static void ftl_init_log_entry(struct ftl_log_type* entry)
{
entry->issequential = 1;
entry->pagescurrent = 0;
@@ -1705,7 +1705,7 @@ void ftl_init_log_entry(struct ftl_log_type* entry)
#ifndef FTL_READONLY
/* Allocates a log entry for the specified vBlock,
first making space, if neccessary. */
-struct ftl_log_type* ftl_allocate_log_entry(uint32_t block)
+static struct ftl_log_type* ftl_allocate_log_entry(uint32_t block)
{
uint32_t i;
struct ftl_log_type* entry = ftl_get_log_entry(block);
@@ -1746,7 +1746,7 @@ struct ftl_log_type* ftl_allocate_log_entry(uint32_t block)
#ifndef FTL_READONLY
/* Commits the FTL block map, erase counters, and context to flash */
-uint32_t ftl_commit_cxt(void)
+static uint32_t ftl_commit_cxt(void)
{
uint32_t i;
uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks;
@@ -1788,7 +1788,7 @@ uint32_t ftl_commit_cxt(void)
/* Swaps the most and least worn block on the flash,
to better distribute wear. It will refuse to do anything
if the wear spread is lower than 5 erases. */
-uint32_t ftl_swap_blocks(void)
+static uint32_t ftl_swap_blocks(void)
{
uint32_t i;
uint32_t min = 0xFFFFFFFF, max = 0, maxidx = 0x14;
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
index e29708f40c..0600c77b62 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
@@ -153,15 +153,6 @@ void lcd_shutdown(void)
}
}
-
-void lcd_off(void)
-{
-}
-
-void lcd_on(void)
-{
-}
-
/* LCD init */
void lcd_init_device(void)
{
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
index 86eda75768..fc7d20febc 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/nand-nano2g.c
@@ -84,15 +84,15 @@ static const struct nand_device_info_type nand_deviceinfotable[] =
{0xA555D520, 8192, 3872, 0x80, 7, 2, 1, 2, 1}
};
-uint8_t nand_tunk1[4];
-uint8_t nand_twp[4];
-uint8_t nand_tunk2[4];
-uint8_t nand_tunk3[4];
-uint32_t nand_type[4];
-int nand_powered = 0;
-int nand_interleaved = 0;
-int nand_cached = 0;
-long nand_last_activity_value = -1;
+static uint8_t nand_tunk1[4];
+static uint8_t nand_twp[4];
+static uint8_t nand_tunk2[4];
+static uint8_t nand_tunk3[4];
+static uint32_t nand_type[4];
+static int nand_powered = 0;
+static int nand_interleaved = 0;
+static int nand_cached = 0;
+static long nand_last_activity_value = -1;
static long nand_stack[DEFAULT_STACK_SIZE];
static struct mutex nand_mtx;
@@ -106,7 +106,7 @@ static uint8_t nand_spare[0x40] STORAGE_ALIGN_ATTR;
static uint8_t nand_ecc[0x30] STORAGE_ALIGN_ATTR;
-uint32_t nand_unlock(uint32_t rc)
+static uint32_t nand_unlock(uint32_t rc)
{
led(false);
nand_last_activity_value = current_tick;
@@ -114,13 +114,13 @@ uint32_t nand_unlock(uint32_t rc)
return rc;
}
-uint32_t ecc_unlock(uint32_t rc)
+static uint32_t ecc_unlock(uint32_t rc)
{
mutex_unlock(&ecc_mtx);
return rc;
}
-uint32_t nand_timeout(long timeout)
+static uint32_t nand_timeout(long timeout)
{
if (TIME_AFTER(current_tick, timeout)) return 1;
else
@@ -130,7 +130,7 @@ uint32_t nand_timeout(long timeout)
}
}
-uint32_t nand_wait_rbbdone(void)
+static uint32_t nand_wait_rbbdone(void)
{
long timeout = current_tick + HZ / 50;
while (!(FMCSTAT & FMCSTAT_RBBDONE))
@@ -139,7 +139,7 @@ uint32_t nand_wait_rbbdone(void)
return 0;
}
-uint32_t nand_wait_cmddone(void)
+static uint32_t nand_wait_cmddone(void)
{
long timeout = current_tick + HZ / 50;
while (!(FMCSTAT & FMCSTAT_CMDDONE))
@@ -148,7 +148,7 @@ uint32_t nand_wait_cmddone(void)
return 0;
}
-uint32_t nand_wait_addrdone(void)
+static uint32_t nand_wait_addrdone(void)
{
long timeout = current_tick + HZ / 50;
while (!(FMCSTAT & FMCSTAT_ADDRDONE))
@@ -157,7 +157,7 @@ uint32_t nand_wait_addrdone(void)
return 0;
}
-uint32_t nand_wait_chip_ready(uint32_t bank)
+static uint32_t nand_wait_chip_ready(uint32_t bank)
{
long timeout = current_tick + HZ / 50;
while (!(FMCSTAT & (FMCSTAT_BANK0READY << bank)))
@@ -166,19 +166,19 @@ uint32_t nand_wait_chip_ready(uint32_t bank)
return 0;
}
-void nand_set_fmctrl0(uint32_t bank, uint32_t flags)
+static void nand_set_fmctrl0(uint32_t bank, uint32_t flags)
{
FMCTRL0 = (nand_tunk1[bank] << 16) | (nand_twp[bank] << 12)
| (1 << 11) | 1 | (1 << (bank + 1)) | flags;
}
-uint32_t nand_send_cmd(uint32_t cmd)
+static uint32_t nand_send_cmd(uint32_t cmd)
{
FMCMD = cmd;
return nand_wait_rbbdone();
}
-uint32_t nand_send_address(uint32_t page, uint32_t offset)
+static uint32_t nand_send_address(uint32_t page, uint32_t offset)
{
FMANUM = 4;
FMADDR0 = (page << 16) | offset;
@@ -197,7 +197,7 @@ uint32_t nand_reset(uint32_t bank)
return 0;
}
-uint32_t nand_wait_status_ready(uint32_t bank)
+static uint32_t nand_wait_status_ready(uint32_t bank)
{
long timeout = current_tick + HZ / 50;
nand_set_fmctrl0(bank, 0);
@@ -218,8 +218,8 @@ uint32_t nand_wait_status_ready(uint32_t bank)
return nand_send_cmd(NAND_CMD_READ);
}
-void nand_transfer_data_start(uint32_t bank, uint32_t direction,
- void* buffer, uint32_t size)
+static void nand_transfer_data_start(uint32_t bank, uint32_t direction,
+ void* buffer, uint32_t size)
{
nand_set_fmctrl0(bank, FMCTRL0_ENABLEDMA);
FMDNUM = size - 1;
@@ -236,7 +236,7 @@ void nand_transfer_data_start(uint32_t bank, uint32_t direction,
DMACOM3 = 4;
}
-uint32_t nand_transfer_data_collect(uint32_t direction)
+static uint32_t nand_transfer_data_collect(uint32_t direction)
{
long timeout = current_tick + HZ / 50;
while ((DMAALLST & DMAALLST_DMABUSY3))
@@ -248,15 +248,16 @@ uint32_t nand_transfer_data_collect(uint32_t direction)
return 0;
}
-uint32_t nand_transfer_data(uint32_t bank, uint32_t direction,
- void* buffer, uint32_t size)
+static uint32_t nand_transfer_data(uint32_t bank, uint32_t direction,
+ void* buffer, uint32_t size)
{
nand_transfer_data_start(bank, direction, buffer, size);
uint32_t rc = nand_transfer_data_collect(direction);
return rc;
}
-void ecc_start(uint32_t size, void* databuffer, void* sparebuffer, uint32_t type)
+static void ecc_start(uint32_t size, void* databuffer, void* sparebuffer,
+ uint32_t type)
{
mutex_lock(&ecc_mtx);
ECC_INT_CLR = 1;
@@ -268,7 +269,7 @@ void ecc_start(uint32_t size, void* databuffer, void* sparebuffer, uint32_t type
ECC_CTRL = type;
}
-uint32_t ecc_collect(void)
+static uint32_t ecc_collect(void)
{
long timeout = current_tick + HZ / 50;
while (!(SRCPND & INTMSK_ECC))
@@ -279,21 +280,21 @@ uint32_t ecc_collect(void)
return ecc_unlock(ECC_RESULT);
}
-uint32_t ecc_decode(uint32_t size, void* databuffer, void* sparebuffer)
+static uint32_t ecc_decode(uint32_t size, void* databuffer, void* sparebuffer)
{
ecc_start(size, databuffer, sparebuffer, ECCCTRL_STARTDECODING);
uint32_t rc = ecc_collect();
return rc;
}
-uint32_t ecc_encode(uint32_t size, void* databuffer, void* sparebuffer)
+static uint32_t ecc_encode(uint32_t size, void* databuffer, void* sparebuffer)
{
ecc_start(size, databuffer, sparebuffer, ECCCTRL_STARTENCODING);
ecc_collect();
return 0;
}
-uint32_t nand_check_empty(uint8_t* buffer)
+static uint32_t nand_check_empty(uint8_t* buffer)
{
uint32_t i, count;
count = 0;
@@ -302,7 +303,7 @@ uint32_t nand_check_empty(uint8_t* buffer)
return 0;
}
-uint32_t nand_get_chip_type(uint32_t bank)
+static uint32_t nand_get_chip_type(uint32_t bank)
{
mutex_lock(&nand_mtx);
uint32_t result;
@@ -443,8 +444,9 @@ uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
return nand_unlock(rc);
}
-uint32_t nand_write_page_int(uint32_t bank, uint32_t page, void* databuffer,
- void* sparebuffer, uint32_t doecc, uint32_t wait)
+static uint32_t nand_write_page_int(uint32_t bank, uint32_t page,
+ void* databuffer, void* sparebuffer,
+ uint32_t doecc, uint32_t wait)
{
uint8_t* data = nand_data;
uint8_t* spare = nand_spare;
@@ -674,7 +676,8 @@ uint32_t nand_write_page_collect(uint32_t bank)
return nand_wait_status_ready(bank);
}
-uint32_t nand_block_erase_fast(uint32_t page)
+#if 0 /* currently unused */
+static uint32_t nand_block_erase_fast(uint32_t page)
{
uint32_t i, rc = 0;
mutex_lock(&nand_mtx);
@@ -708,6 +711,7 @@ uint32_t nand_block_erase_fast(uint32_t page)
}
return nand_unlock(rc);
}
+#endif
const struct nand_device_info_type* nand_get_device_type(uint32_t bank)
{
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/pmu-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/pmu-nano2g.c
index aea9b79b55..37cc1dcced 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/pmu-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/pmu-nano2g.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "kernel.h"
#include "i2c-s5l8700.h"
+#include "pmu-target.h"
static struct mutex pmu_adc_mutex;
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c
index a75cb39729..06876be3f5 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/power-nano2g.c
@@ -23,12 +23,9 @@
#include "inttypes.h"
#include "s5l8700.h"
#include "power.h"
-#include "ftl-target.h"
-#include <string.h>
#include "panic.h"
#include "pmu-target.h"
-#include "lcd.h"
-
+#include "usb_core.h" /* for usb_charging_maxcurrent_change */
void power_off(void)
{
diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c
index e593039f64..0819088c02 100644
--- a/firmware/target/arm/s5l8700/pcm-s5l8700.c
+++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c
@@ -41,10 +41,10 @@
*/
static volatile int locked = 0;
-size_t nextsize;
-size_t dblbufsize;
-int dmamode;
-const unsigned char* dblbuf;
+static size_t nextsize;
+static size_t dblbufsize;
+static int dmamode;
+static const unsigned char* dblbuf;
/* table of recommended PLL/MCLK dividers for mode 256Fs from the datasheet */
static const struct div_entry {
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c
index 3f28e7f379..6fbf453cd1 100644
--- a/firmware/target/arm/usb-s3c6400x.c
+++ b/firmware/target/arm/usb-s3c6400x.c
@@ -21,6 +21,8 @@
#include "config.h"
#include "usb.h"
+#include "usb-target.h"
+#include "usb_drv.h"
#define OTGBASE 0x38800000
#define PHYBASE 0x3C400000
@@ -55,7 +57,7 @@ int usb_drv_port_speed(void)
return (DSTS & 2) == 0 ? 1 : 0;
}
-void reset_endpoints(int reinit)
+static void reset_endpoints(int reinit)
{
unsigned int i;
for (i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
@@ -268,7 +270,7 @@ void usb_drv_set_address(int address)
into the USB core, which will then call this dummy function. */
}
-void ep_send(int ep, void *ptr, int length)
+static void ep_send(int ep, void *ptr, int length)
{
endpoints[ep].busy = true;
endpoints[ep].size = length;
@@ -289,7 +291,7 @@ void ep_send(int ep, void *ptr, int length)
DIEPCTL(ep) |= 0x84000000; /* EPx OUT ENABLE CLEARNAK */
}
-void ep_recv(int ep, void *ptr, int length)
+static void ep_recv(int ep, void *ptr, int length)
{
endpoints[ep].busy = true;
endpoints[ep].size = length;