diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-10-09 15:35:10 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-10-10 10:17:33 -0500 |
commit | ef4c4612e2c21feae24c0ea47a83942cbcebc465 (patch) | |
tree | a5415da86f64e02c33a54c9da7dcf134762c0be1 /c/src/lib/libbsp/arm/nds | |
parent | powerpc/ep1a: Remove if 0 sections (diff) | |
download | rtems-ef4c4612e2c21feae24c0ea47a83942cbcebc465.tar.bz2 |
arm/nds: Warning clean up
This patch eliminates most of the warnings in this BSP but attempts
very little clean up. This BSP includes copies of a lot of code
from free NDS libraries and modifications should be kept to a minimum.
Diffstat (limited to 'c/src/lib/libbsp/arm/nds')
32 files changed, 175 insertions, 131 deletions
diff --git a/c/src/lib/libbsp/arm/nds/Makefile.am b/c/src/lib/libbsp/arm/nds/Makefile.am index c8d88111e3..96f1268b28 100644 --- a/c/src/lib/libbsp/arm/nds/Makefile.am +++ b/c/src/lib/libbsp/arm/nds/Makefile.am @@ -15,6 +15,7 @@ nodist_include_HEADERS = include/bspopts.h nodist_include_HEADERS += ../../shared/include/coverhd.h nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h +nodist_include_bsp_HEADERS += irq/irq.h DISTCLEANFILES = include/bspopts.h noinst_PROGRAMS = diff --git a/c/src/lib/libbsp/arm/nds/block/block.c b/c/src/lib/libbsp/arm/nds/block/block.c index aec853aba5..a2e48c1bb3 100644 --- a/c/src/lib/libbsp/arm/nds/block/block.c +++ b/c/src/lib/libbsp/arm/nds/block/block.c @@ -1,6 +1,8 @@ /* * RTEMS for Nintendo DS flash driver. - * + */ + +/* * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com> * * The license and distribution terms for this file may be @@ -17,13 +19,13 @@ #include <disc.h> -bool +static bool nds_flash_probe (int minor) { return true; } -void +static void nds_flash_initialize (int minor) { const IO_INTERFACE *flash; @@ -43,19 +45,19 @@ nds_flash_initialize (int minor) } } -void +static void nds_flash_read_reg (int minor, int reg, uint16_t * value) { printk ("nds_flash_read_reg\n"); } -void +static void nds_flash_write_reg (int minor, int reg, uint16_t value) { printk ("nds_flash_write_reg\n"); } -void +static void nds_flash_read_block (int minor, uint32_t block_size, rtems_blkdev_sg_buffer * bufs, uint32_t * cbuf, uint32_t * pos) @@ -63,7 +65,7 @@ nds_flash_read_block (int minor, uint32_t block_size, printk ("nds_flash_read_block\n"); } -void +static void nds_flash_write_block (int minor, uint32_t block_size, rtems_blkdev_sg_buffer * bufs, uint32_t * cbuf, uint32_t * pos) @@ -71,14 +73,14 @@ nds_flash_write_block (int minor, uint32_t block_size, printk ("nds_flash_write_block\n"); } -int +static int nds_flash_control (int minor, uint32_t cmd, void *arg) { printk ("nds_flash_control\n"); return 0; } -rtems_status_code +static rtems_status_code nds_flash_io_speed (int minor, uint16_t mode) { return RTEMS_SUCCESSFUL; diff --git a/c/src/lib/libbsp/arm/nds/console/console.c b/c/src/lib/libbsp/arm/nds/console/console.c index 7c7ab9d926..6036f9cff3 100644 --- a/c/src/lib/libbsp/arm/nds/console/console.c +++ b/c/src/lib/libbsp/arm/nds/console/console.c @@ -32,7 +32,7 @@ /* from NDS support library */ extern void consolePrintChar(char c); -void +static void nds_putch (char c) { #ifdef TESTSUITE @@ -43,13 +43,15 @@ nds_putch (char c) static volatile char ch = 0; +void console_push (char c); /* used in touchscreen.c */ + void console_push (char c) { ch = c; } -int +static int nds_getch (void) { char c; diff --git a/c/src/lib/libbsp/arm/nds/coproc/coproc.c b/c/src/lib/libbsp/arm/nds/coproc/coproc.c index a2456be156..611bd31971 100644 --- a/c/src/lib/libbsp/arm/nds/coproc/coproc.c +++ b/c/src/lib/libbsp/arm/nds/coproc/coproc.c @@ -117,7 +117,7 @@ void VblankHandler(void) { // microphone code if (!is_recording && my_IPC->record) { - StartRecording(my_IPC->record_buffer, my_IPC->record_length_max); + StartRecording((u8 *)my_IPC->record_buffer, my_IPC->record_length_max); is_recording = 1; } diff --git a/c/src/lib/libbsp/arm/nds/include/bsp.h b/c/src/lib/libbsp/arm/nds/include/bsp.h index 118adf3a0c..a0bc5e1fa2 100644 --- a/c/src/lib/libbsp/arm/nds/include/bsp.h +++ b/c/src/lib/libbsp/arm/nds/include/bsp.h @@ -23,10 +23,9 @@ extern "C" #include <rtems/console.h> #include <rtems/clockdrv.h> - struct rtems_bsdnet_ifconfig; +struct rtems_bsdnet_ifconfig; - int - rtems_wifi_driver_attach (struct rtems_bsdnet_ifconfig *config, +int rtems_wifi_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach); #define RTEMS_BSP_NETWORK_DRIVER_NAME "dswifi0" @@ -34,9 +33,9 @@ extern "C" #define RTC_DRIVER_TABLE_ENTRY \ { rtc_initialize, NULL, NULL, NULL, NULL, NULL } - extern rtems_device_driver rtc_initialize (rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg); +extern rtems_device_driver rtc_initialize (rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg); #ifdef __cplusplus } diff --git a/c/src/lib/libbsp/arm/nds/irq/irq.c b/c/src/lib/libbsp/arm/nds/irq/irq.c index 571b60bfae..d0e3915452 100644 --- a/c/src/lib/libbsp/arm/nds/irq/irq.c +++ b/c/src/lib/libbsp/arm/nds/irq/irq.c @@ -1,6 +1,8 @@ /* * RTEMS for Nintendo DS interrupt manager. - * + */ + +/* * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com> * * The license and distribution terms for this file may be @@ -11,12 +13,12 @@ #include <bsp.h> #include <rtems/irq.h> +#include <bsp/irq.h> #include <nds.h> /* * this function check that the value given for the irq line is valid. */ - static int isValidInterrupt (int irq) { @@ -28,7 +30,6 @@ isValidInterrupt (int irq) /* * initialize the irq management. */ - void BSP_rtems_irq_mngt_init (void) { @@ -40,7 +41,6 @@ BSP_rtems_irq_mngt_init (void) /* * install a irq handler. */ - int BSP_install_rtems_irq_handler (const rtems_irq_connect_data * irq) { @@ -67,7 +67,6 @@ BSP_install_rtems_irq_handler (const rtems_irq_connect_data * irq) /* * return the handler hooked to the given irq. */ - int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data * irq) { @@ -77,7 +76,6 @@ BSP_get_current_rtems_irq_handler (rtems_irq_connect_data * irq) /* * remove & disable given irq. */ - int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data * irq) { diff --git a/c/src/lib/libbsp/arm/nds/irq/irq.h b/c/src/lib/libbsp/arm/nds/irq/irq.h new file mode 100644 index 0000000000..aeaccef298 --- /dev/null +++ b/c/src/lib/libbsp/arm/nds/irq/irq.h @@ -0,0 +1,21 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE + */ + +#ifndef __BSP_IRQ_H_ +#define __BSP_IRQ_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern void BSP_rtems_irq_mngt_init (void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c index 8b2ec39324..f68e74a2ac 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_efa2.c @@ -164,7 +164,7 @@ EFA2_clearStatus Reads and checks NAND status information bool return OUT: true if NAND is idle -----------------------------------------------------------------*/ -bool _EFA2_clearStatus (void) +static bool _EFA2_clearStatus (void) { // tbd: currently there is no write support, so always return // true, there is no possibility for pending operations @@ -176,7 +176,7 @@ EFA2_isInserted Checks to see if the NAND chip used by the EFA2 is present bool return OUT: true if the correct NAND chip is found -----------------------------------------------------------------*/ -bool _EFA2_isInserted (void) +static bool _EFA2_isInserted (void) { _EFA2_clearStatus(); return (_EFA2_nand_id() == EFA2_NAND_ID); @@ -191,7 +191,7 @@ u32 numSecs IN: number of 512 byte sectors to read, void* buffer OUT: pointer to 512 byte buffer to store data in bool return OUT: true if successful -----------------------------------------------------------------*/ -bool _EFA2_readSectors (u32 sector, u32 numSecs, void* buffer) +static bool _EFA2_readSectors (u32 sector, u32 numSecs, void* buffer) { int i; @@ -265,7 +265,7 @@ u32 numSecs IN: number of 512 byte sectors to write void* buffer IN: pointer to 512 byte buffer to read data from bool return OUT: true if successful -----------------------------------------------------------------*/ -bool _EFA2_writeSectors (u32 sector, u8 numSecs, void* buffer) +static bool _EFA2_writeSectors (u32 sector, u8 numSecs, void* buffer) { // Upto now I focused on reading NAND, write operations // will follow @@ -276,7 +276,7 @@ bool _EFA2_writeSectors (u32 sector, u8 numSecs, void* buffer) EFA2_shutdown unload the EFA2 interface -----------------------------------------------------------------*/ -bool _EFA2_shutdown(void) +static bool _EFA2_shutdown(void) { return _EFA2_clearStatus(); } @@ -286,7 +286,7 @@ EFA2_startUp initializes the EFA2 card, returns true if successful, otherwise returns false -----------------------------------------------------------------*/ -bool _EFA2_startUp(void) +static bool _EFA2_startUp(void) { _EFA2_global_unlock(); return (_EFA2_nand_id() == EFA2_NAND_ID); diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c index 07ab130304..c888db0a0a 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_fcsr.c @@ -73,7 +73,7 @@ _FCSR_isInserted Is a GBA Flash Cart with a valid file system inserted? bool return OUT: true if a GBA FC card is inserted -----------------------------------------------------------------*/ -bool _FCSR_isInserted (void) +static bool _FCSR_isInserted (void) { bool flagFoundFileSys = false; @@ -101,7 +101,7 @@ _FCSR_clearStatus Finish any pending operations bool return OUT: always true for GBA FC -----------------------------------------------------------------*/ -bool _FCSR_clearStatus (void) +static bool _FCSR_clearStatus (void) { return true; } @@ -116,7 +116,7 @@ u32 numSectors IN: number of 512 byte sectors to read, void* buffer OUT: pointer to 512 byte buffer to store data in bool return OUT: true if successful -----------------------------------------------------------------*/ -bool _FCSR_readSectors (u32 sector, u32 numSectors, void* buffer) +static bool _FCSR_readSectors (u32 sector, u32 numSectors, void* buffer) { int i; bool flagSramSector = false; @@ -184,7 +184,7 @@ u32 numSectors IN: number of 512 byte sectors to read, void* buffer IN: pointer to 512 byte buffer to read data from bool return OUT: true if successful -----------------------------------------------------------------*/ -bool _FCSR_writeSectors (u32 sector, u8 numSectors, void* buffer) +static bool _FCSR_writeSectors (u32 sector, u8 numSectors, void* buffer) { int i; bool flagSramSector = false; @@ -223,7 +223,7 @@ bool _FCSR_writeSectors (u32 sector, u8 numSectors, void* buffer) _FCSR_shutdown unload the Flash Cart interface -----------------------------------------------------------------*/ -bool _FCSR_shutdown(void) +static bool _FCSR_shutdown(void) { int i; if (_FCSR_clearStatus() == false) @@ -245,7 +245,7 @@ _FCSR_startUp initializes the Flash Cart interface, returns true if successful, otherwise returns false -----------------------------------------------------------------*/ -bool _FCSR_startUp(void) +static bool _FCSR_startUp(void) { bool flagFoundFileSys = false; int i; diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c index 235788a2f5..2db8eec894 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3cf.c @@ -78,7 +78,7 @@ static const CF_REGISTERS _M3CF_Registers = { }; -bool _M3CF_startup(void) { +static bool _M3CF_startup(void) { _M3_changeMode (M3_MODE_MEDIA); return _CF_startup (&_M3CF_Registers); } diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c index 88f205a249..b5b3173a9d 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_m3sd.c @@ -238,12 +238,12 @@ static void _M3SD_getClocks (u32 numClocks) { } } -bool _M3SD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _M3SD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { _M3SD_sendCommand (command, data); return _M3SD_getResponse (responseBuffer, 6); } -bool _M3SD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _M3SD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { _M3SD_sendCommand (command, data); return _M3SD_getResponse (responseBuffer, 17); } @@ -389,12 +389,12 @@ static bool _M3SD_writeData (u8* data, u8* crc) { //--------------------------------------------------------------- // Functions needed for the external interface -bool _M3SD_startUp (void) { +static bool _M3SD_startUp (void) { _M3SD_unlock(); return _M3SD_initCard(); } -bool _M3SD_isInserted (void) { +static bool _M3SD_isInserted (void) { u8 responseBuffer [6]; // Make sure the card receives the command if (!_M3SD_sendCommand (SEND_STATUS, 0)) { @@ -411,7 +411,7 @@ bool _M3SD_isInserted (void) { return true; } -bool _M3SD_readSectors (u32 sector, u32 numSectors, void* buffer) { +static bool _M3SD_readSectors (u32 sector, u32 numSectors, void* buffer) { u32 i; u8* dest = (u8*) buffer; u8 responseBuffer[6]; @@ -447,7 +447,7 @@ bool _M3SD_readSectors (u32 sector, u32 numSectors, void* buffer) { return true; } -bool _M3SD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { +static bool _M3SD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { u8 crc[8]; u8 responseBuffer[6]; u32 offset = sector * BYTES_PER_READ; @@ -495,11 +495,11 @@ bool _M3SD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { } -bool _M3SD_clearStatus (void) { +static bool _M3SD_clearStatus (void) { return _M3SD_initCard (); } -bool _M3SD_shutdown (void) { +static bool _M3SD_shutdown (void) { _M3_changeMode (M3_MODE_ROM); return true; } diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c index f004126aed..3dcafc193e 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_mpcf.c @@ -81,7 +81,7 @@ _MPCF_startup initializes the CF interface, returns true if successful, otherwise returns false -----------------------------------------------------------------*/ -bool _MPCF_startup(void) { +static bool _MPCF_startup(void) { return _CF_startup(&_MPCF_Registers); } diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c index b60f1a693e..e394076e5c 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_njsd.c @@ -384,11 +384,11 @@ static bool _NJSD_sendCMDN (int speed, u8 cmd, u32 param) { return true; } -bool _NJSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _NJSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { return _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_48, command, data); } -bool _NJSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _NJSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { return _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_136, command, data); } @@ -413,7 +413,7 @@ static bool _NJSD_cardInit (void) { } -bool _NJSD_isInserted(void) { +static bool _NJSD_isInserted(void) { u8 responseBuffer [8]; _NJSD_sendCMDR (SD_CLK_167KHz, responseBuffer, SD_RSP_48, SEND_STATUS, 0); @@ -424,15 +424,15 @@ bool _NJSD_isInserted(void) { return true; } -bool _NJSD_clearStatus (void) { +static bool _NJSD_clearStatus (void) { return _NJSD_reset(); } -bool _NJSD_shutdown(void) { +static bool _NJSD_shutdown(void) { return _NJSD_clearStatus(); } -bool _NJSD_startup(void) { +static bool _NJSD_startup(void) { if (! _NJSD_init(0xA0406000) ) { return false; } @@ -443,7 +443,7 @@ bool _NJSD_startup(void) { } -bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { +static bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { u8 crc[8]; u32 offset = sector * BYTES_PER_READ; u8* data = (u8*) buffer; @@ -461,7 +461,7 @@ bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { } #ifdef _IO_ALLOW_UNALIGNED -bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) { +static bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) { u32 tmp[BYTES_PER_READ>>2]; int i; diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c index d7a99320f3..88d8b48778 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_nmmc.c @@ -161,7 +161,7 @@ static bool _Neo_InitMMC(void) { // Neo MMC driver functions -bool _NMMC_isInserted(void) { +static bool _NMMC_isInserted(void) { int i; _Neo_EnableMMC( true ); // Open SPI port to MMC card @@ -183,7 +183,7 @@ bool _NMMC_isInserted(void) { return true; } -bool _NMMC_clearStatus (void) { +static bool _NMMC_clearStatus (void) { u32 i; _Neo_EnableMMC( true ); // Open SPI port to MMC card @@ -206,11 +206,11 @@ bool _NMMC_clearStatus (void) { return false; } -bool _NMMC_shutdown(void) { +static bool _NMMC_shutdown(void) { return _NMMC_clearStatus(); } -bool _NMMC_startUp(void) { +static bool _NMMC_startUp(void) { int i; int transSpeed; if (_Neo_InitMMC() == false) { @@ -255,7 +255,7 @@ bool _NMMC_startUp(void) { } -bool _NMMC_writeSectors (u32 sector, u32 totalSecs, const void* buffer) +static bool _NMMC_writeSectors (u32 sector, u32 totalSecs, const void* buffer) { u32 i; u8 *p=(u8*)buffer; @@ -302,7 +302,7 @@ bool _NMMC_writeSectors (u32 sector, u32 totalSecs, const void* buffer) return true; } -bool _NMMC_readSectors (u32 sector, u32 totalSecs, void* buffer) +static bool _NMMC_readSectors (u32 sector, u32 totalSecs, void* buffer) { u32 i; u8 *p=(u8*)buffer; diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c index 0765c4d379..06d1378028 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_sccf.c @@ -65,7 +65,7 @@ static const CF_REGISTERS _SCCF_Registers = { }; -bool _SCCF_startup(void) { +static bool _SCCF_startup(void) { _SC_changeMode (SC_MODE_MEDIA); return _CF_startup(&_SCCF_Registers); } diff --git a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c index 54347ccb33..231b93fc37 100644 --- a/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c +++ b/c/src/lib/libbsp/arm/nds/libfat/source/disc_io/io_scsd.c @@ -194,16 +194,17 @@ static inline bool _SCSD_getResponse_R6 (u8* dest) { static void _SCSD_sendClocks (u32 numClocks) { u16 temp; do { + (void) temp; /* avoid set but not used warning */ temp = REG_SCSD_CMD; } while (numClocks--); } -bool _SCSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _SCSD_cmd_6byte_response (u8* responseBuffer, u8 command, u32 data) { _SCSD_sendCommand (command, data); return _SCSD_getResponse (responseBuffer, 6); } -bool _SCSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { +static bool _SCSD_cmd_17byte_response (u8* responseBuffer, u8 command, u32 data) { _SCSD_sendCommand (command, data); return _SCSD_getResponse (responseBuffer, 17); } @@ -273,12 +274,12 @@ static bool _SCSD_readData (void* buffer) { //--------------------------------------------------------------- // Functions needed for the external interface -bool _SCSD_startUp (void) { +static bool _SCSD_startUp (void) { _SCSD_unlock(); return _SCSD_initCard(); } -bool _SCSD_isInserted (void) { +static bool _SCSD_isInserted (void) { u8 responseBuffer [6]; // Make sure the card receives the command @@ -296,7 +297,7 @@ bool _SCSD_isInserted (void) { return true; } -bool _SCSD_readSectors (u32 sector, u32 numSectors, void* buffer) { +static bool _SCSD_readSectors (u32 sector, u32 numSectors, void* buffer) { u32 i; u8* dest = (u8*) buffer; u8 responseBuffer[6]; @@ -332,7 +333,7 @@ bool _SCSD_readSectors (u32 sector, u32 numSectors, void* buffer) { return true; } -bool _SCSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { +static bool _SCSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { u16 crc[4]; // One per data line u8 responseBuffer[6]; u32 offset = sector * BYTES_PER_READ; @@ -376,11 +377,11 @@ bool _SCSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) { return true; } -bool _SCSD_clearStatus (void) { +static bool _SCSD_clearStatus (void) { return _SCSD_initCard (); } -bool _SCSD_shutdown (void) { +static bool _SCSD_shutdown (void) { _SC_changeMode (SC_MODE_RAM_RO); return true; } diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c index f804839892..65de47ef6b 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c @@ -40,7 +40,7 @@ static u8 range = 20; static u8 min_range = 20; //--------------------------------------------------------------------------------- -u8 CheckStylus(void){ +static u8 CheckStylus(void){ //--------------------------------------------------------------------------------- SerialWaitBusy(); @@ -133,7 +133,7 @@ static s32 xscale, yscale; static s32 xoffset, yoffset; //--------------------------------------------------------------------------------- -int16 readTouchValue(uint32 command, int16 *dist_max, u8 *err){ +static int16 readTouchValue(uint32 command, int16 *dist_max, u8 *err){ //--------------------------------------------------------------------------------- int16 values[5]; int32 aux1, aux2, aux3, dist, dist2, result = 0; @@ -224,7 +224,7 @@ int16 readTouchValue(uint32 command, int16 *dist_max, u8 *err){ } //--------------------------------------------------------------------------------- -void UpdateRange(uint8 *this_range, int16 last_dist_max, u8 data_error, u8 tsc_touched){ +static void UpdateRange(uint8 *this_range, int16 last_dist_max, u8 data_error, u8 tsc_touched){ //--------------------------------------------------------------------------------- //range_counter_1 = counter_0x380A98C //range_counter_2 = counter_0x380A990 diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c index 2e2c2a27c8..8335635c33 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c @@ -30,6 +30,17 @@ #include <nds/arm9/video.h> #include <nds/arm9/videoGL.h> +/* + * Prototypes + * + * NOTE: This code appears to be externally available test code. + */ +void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth); +int BoxTestf(float x, float y, float z, float width, float height, float depth); +void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth); +int BoxTestResult(void); +int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth); + //--------------------------------------------------------------------------------- void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth) //--------------------------------------------------------------------------------- diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c index bce4db32b7..23adf4c0c2 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c @@ -173,7 +173,7 @@ static void consoleClearLine(char mode) { } } //--------------------------------------------------------------------------------- -int con_write(struct _reent *r,int fd,const char *ptr,int len) { +static int con_write(struct _reent *r,int fd,const char *ptr,int len) { //--------------------------------------------------------------------------------- if (!consoleInitialised) return -1; diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c index 716fa89404..f0bd2bb41a 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c @@ -35,7 +35,7 @@ #include <bsp/linker-symbols.h> //--------------------------------------------------------------------------------- -unsigned long ARMShift(unsigned long value,unsigned char shift) { +static unsigned long ARMShift(unsigned long value,unsigned char shift) { //--------------------------------------------------------------------------------- // no shift at all if (shift == 0x0B) return value ; @@ -77,7 +77,7 @@ unsigned long ARMShift(unsigned long value,unsigned char shift) { //--------------------------------------------------------------------------------- -u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState) { +static u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState) { //--------------------------------------------------------------------------------- int Rf, Rb, Rd, Rn, Rm; diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c index 59755af2d8..da401ac506 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c @@ -35,6 +35,12 @@ #include <time.h> +/* + * Prototypes + * + * NOTE: Called from start.S + */ +void initSystem(void); extern time_t *punixTime; diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c index 5b3a3cc4d9..1faadcd5de 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c @@ -52,7 +52,7 @@ int card_type = -1; MotionCalibration calibration = {2048, 2048, 2048, 1680, 819, 819, 819, 825}; // sends and receives 1 byte on the SPI bus -unsigned char motion_spi(unsigned char in_byte){ +static unsigned char motion_spi(unsigned char in_byte){ unsigned char out_byte; CARD_EEPDATA = in_byte; // send the output byte to the SPI bus @@ -62,7 +62,7 @@ unsigned char motion_spi(unsigned char in_byte){ } -void motion_MK6_sensor_mode(void) { +static void motion_MK6_sensor_mode(void) { // send some commands on the SPI bus SPI_On() motion_spi(0xFE); @@ -78,7 +78,7 @@ void motion_MK6_sensor_mode(void) { SPI_Off() } -void motion_MK6_EEPROM_mode(void) { +static void motion_MK6_EEPROM_mode(void) { // send some commands on the SPI bus SPI_On() motion_spi(0xFE); @@ -95,7 +95,7 @@ void motion_MK6_EEPROM_mode(void) { } // checks whether a DS Motion Pak is plugged in -int motion_pak_is_inserted(void){ +static int motion_pak_is_inserted(void){ int motion_pak = 0; unsigned char return_byte = V_SRAM[10]; // read first byte of DS Motion Pak check swiDelay(WAIT_CYCLES); @@ -114,7 +114,7 @@ int motion_pak_is_inserted(void){ // checks whether a DS Motion Card is plugged in // this only works after motion_init() // it will return false if it is run before motion_init() -int motion_card_is_inserted(void){ +static int motion_card_is_inserted(void){ // send 0x03 to read from DS Motion Card control register SPI_On() motion_spi(0x03); // command to read from control register @@ -130,7 +130,7 @@ int motion_card_is_inserted(void){ // turn on the DS Motion Sensor (DS Motion Pak or DS Motion Card) // Requires knowing which type is present (can be found by using motion_init) -int motion_enable(int card_type) { +static int motion_enable(int card_type) { switch (card_type) { case 1: // DS Motion Pak - automatically enabled on powerup @@ -448,14 +448,16 @@ void motion_set_calibration(MotionCalibration* cal){ // enable analog input number 1 (ain_1) void motion_enable_ain_1(void){ unsigned char return_byte; - return_byte = V_SRAM[16]; + (void) return_byte; /* avoid set but unused warning */ + return_byte = V_SRAM[16]; swiDelay(WAIT_CYCLES); } // enable analog input number 2 (ain_2) void motion_enable_ain_2(void){ unsigned char return_byte; - return_byte = V_SRAM[18]; + (void) return_byte; /* avoid set but unused warning */ + return_byte = V_SRAM[18]; swiDelay(WAIT_CYCLES); } diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c index 6f460cfcda..6b516db57c 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c @@ -47,14 +47,9 @@ uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE ////////////////////////////////////////////////////////////////////// -// remove in a few versions -- joat -void vramRestorMainBanks(uint32 vramTemp) -{ - VRAM_CR = vramTemp; -} - ////////////////////////////////////////////////////////////////////// +void vramRestoreMainBanks(uint32 vramTemp); /* used in videoGL.c */ void vramRestoreMainBanks(uint32 vramTemp) { VRAM_CR = vramTemp; diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c index b1accf9d73..013e666acd 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c @@ -247,12 +247,12 @@ u32 glGetTexParameter(){ //--------------------------------------------------------------------------------- -inline uint32 alignVal( uint32 val, uint32 to ) { +static inline uint32 alignVal( uint32 val, uint32 to ) { return (val & (to-1))? (val & ~(to-1)) + to : val; } //--------------------------------------------------------------------------------- -int getNextPaletteSlot(u16 count, uint8 format) { +static int getNextPaletteSlot(u16 count, uint8 format) { //--------------------------------------------------------------------------------- // ensure the result aligns on a palette block for this format uint32 result = alignVal(glGlob->nextPBlock, 1<<(4-(format==GL_RGB4))); @@ -269,7 +269,7 @@ int getNextPaletteSlot(u16 count, uint8 format) { } //--------------------------------------------------------------------------------- -uint16* vramGetBank(uint16 *addr) { +static uint16* vramGetBank(uint16 *addr) { //--------------------------------------------------------------------------------- if(addr >= VRAM_A && addr < VRAM_B) return VRAM_A; @@ -292,7 +292,7 @@ uint16* vramGetBank(uint16 *addr) { //--------------------------------------------------------------------------------- -int vramIsTextureBank(uint16 *addr) { +static int vramIsTextureBank(uint16 *addr) { //--------------------------------------------------------------------------------- uint16* vram = vramGetBank(addr); @@ -324,7 +324,7 @@ int vramIsTextureBank(uint16 *addr) { return 0; } //--------------------------------------------------------------------------------- -uint32* getNextTextureSlot(int size) { +static uint32* getNextTextureSlot(int size) { //--------------------------------------------------------------------------------- uint32* result = glGlob->nextBlock; glGlob->nextBlock += size >> 2; diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c index 7cde3811e7..523bb6ca68 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c @@ -173,6 +173,7 @@ int cardEepromGetType(void) sysSetBusOwners(BUS_OWNER_ARM9, BUS_OWNER_ARM9); #endif + (void) c03; /* avoid set but not used warning */ c03=cardEepromCommand(0x03,0); c05=cardEepromCommand(0x05,0); c9f=cardEepromCommand(0x9f,0); diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c index 95fbc729a5..7f174e4c84 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c @@ -64,10 +64,10 @@ void gbfs_search_range( u32 gbfs_stride ) { //--------------------------------------------------------------------------------- - if ( NULL != gbfs_1st_limit ) GBFS_1ST_SEARCH_LIMIT = (u32 *)gbfs_1st_limit; - if ( NULL != gbfs_2nd_limit ) GBFS_2ND_SEARCH_LIMIT = (u32 *)gbfs_2nd_limit; - if ( NULL != gbfs_2nd_start ) GBFS_2ND_SEARCH_START = (u32 *)gbfs_2nd_start; - if ( NULL != gbfs_stride ) GBFS_STRIDE = gbfs_stride; + if ( 0 != gbfs_1st_limit ) GBFS_1ST_SEARCH_LIMIT = (u32 *)gbfs_1st_limit; + if ( 0 != gbfs_2nd_limit ) GBFS_2ND_SEARCH_LIMIT = (u32 *)gbfs_2nd_limit; + if ( 0 != gbfs_2nd_start ) GBFS_2ND_SEARCH_START = (u32 *)gbfs_2nd_start; + if ( 0 != gbfs_stride ) GBFS_STRIDE = gbfs_stride; } diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c index 5c9805a865..7e42ebf942 100644 --- a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c +++ b/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c @@ -26,9 +26,7 @@ void IntrMain(void); // Prototype for assembly interrupt dispatcher -//--------------------------------------------------------------------------------- -void irqDummy(void) {} -//--------------------------------------------------------------------------------- +static void irqDummy(void) {} #ifdef ARM9 diff --git a/c/src/lib/libbsp/arm/nds/preinstall.am b/c/src/lib/libbsp/arm/nds/preinstall.am index 5ae1d49c89..4d1cc3a719 100644 --- a/c/src/lib/libbsp/arm/nds/preinstall.am +++ b/c/src/lib/libbsp/arm/nds/preinstall.am @@ -57,6 +57,10 @@ $(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INC $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h +$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h + $(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT) TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT) diff --git a/c/src/lib/libbsp/arm/nds/rtc/rtc.c b/c/src/lib/libbsp/arm/nds/rtc/rtc.c index c56a80577c..da0f23263d 100644 --- a/c/src/lib/libbsp/arm/nds/rtc/rtc.c +++ b/c/src/lib/libbsp/arm/nds/rtc/rtc.c @@ -1,6 +1,8 @@ /* * RTEMS for Nintendo DS realtime clock driver. - * + */ + +/* * Copyright (c) 2008 by Cedric Gestes <ctaf42@gmail.com> * * The license and distribution terms for this file may be @@ -20,8 +22,7 @@ size_t RTC_Count = 1; /* * probe for a rtc. we always claim to have one. */ - -bool +static bool nds_rtc_probe (int minor) { return true; @@ -30,8 +31,7 @@ nds_rtc_probe (int minor) /* * initialize the nds rtc. */ - -void +static void nds_rtc_init (int minor) { /* nothing to do here (already done in the arm7 main) */ @@ -42,8 +42,7 @@ nds_rtc_init (int minor) * read current time from nds real-time clock chip and convert it * to the rtems_time_of_day structure. */ - -int +static int nds_rtc_get_time (int minor, rtems_time_of_day * time) { time->year = 2000 + IPC->time.rtc.year; @@ -61,8 +60,7 @@ nds_rtc_get_time (int minor, rtems_time_of_day * time) * set time to the arm7 nds rtc. * NOTE: this is not supported. */ - -int +static int nds_rtc_set_time (int minor, const rtems_time_of_day * time) { return -1; @@ -71,7 +69,6 @@ nds_rtc_set_time (int minor, const rtems_time_of_day * time) /* * driver function table. */ - rtc_fns nds_rtc_fns = { nds_rtc_init, nds_rtc_get_time, diff --git a/c/src/lib/libbsp/arm/nds/startup/bspstart.c b/c/src/lib/libbsp/arm/nds/startup/bspstart.c index e81f19bef5..5a7ff1ab81 100644 --- a/c/src/lib/libbsp/arm/nds/startup/bspstart.c +++ b/c/src/lib/libbsp/arm/nds/startup/bspstart.c @@ -1,6 +1,8 @@ /* * RTEMS for Nintendo DS platform initialization. - * + */ + +/* * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com> * * The license and distribution terms for this file may be @@ -12,14 +14,14 @@ #include <bsp.h> #include <bsp/bootcard.h> #include <bsp/linker-symbols.h> +#include <bsp/irq.h> #include <nds.h> -extern void defaultExceptionHandler (); -extern void BSP_rtems_irq_mngt_init (void); +extern void defaultExceptionHandler(void); + /* * start the platform. */ - void bsp_start (void) { /* initialize irq management */ @@ -46,17 +48,6 @@ void bsp_start (void) } /* - * reset bss area. - */ - -void -bss_reset (void) -{ - - memset (bsp_section_bss_begin, 0, (size_t) bsp_section_bss_size); -} - -/* * A few symbols needed by libnds but not used. */ diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/parser.c b/c/src/lib/libbsp/arm/nds/touchscreen/parser.c index c89267e87e..b103c615d1 100644 --- a/c/src/lib/libbsp/arm/nds/touchscreen/parser.c +++ b/c/src/lib/libbsp/arm/nds/touchscreen/parser.c @@ -22,6 +22,8 @@ */ extern void console_push (char c); +extern void register_kbd_msg_queue (char *q_name); +extern void unregister_kbd_msg_queue (void); /* * from reco.c @@ -32,7 +34,8 @@ extern char PA_CheckLetter (int down, int x, int y); /* * message queue for touchscreen and graffiti events. */ - +extern void register_mou_msg_queue (char *q_name); +extern void unregister_mou_msg_queue (void); static rtems_id mou_queue_id = 0; static rtems_id kbd_queue_id = 0; @@ -51,9 +54,14 @@ static int old_btns = 0; static int hand = 0; /* - * update touchscreen position. + * Shared methods */ +void update_touchscreen (void); +void touchscreen_sethand (int h); +/* + * update touchscreen position + */ void update_touchscreen (void) { diff --git a/c/src/lib/libbsp/arm/nds/touchscreen/reco.c b/c/src/lib/libbsp/arm/nds/touchscreen/reco.c index 08f4f8b36c..540720038f 100644 --- a/c/src/lib/libbsp/arm/nds/touchscreen/reco.c +++ b/c/src/lib/libbsp/arm/nds/touchscreen/reco.c @@ -1,6 +1,13 @@ #include <nds.h> #include "reco.h" +/* + * Prototype + * + * NOTE: These appear to be part of a public interface. + */ +char PA_CheckLetter(int down, int x, int y); + PA_StylusPosition PA_StylusPos[20000]; PA_RecoValues PA_Reco; @@ -60,7 +67,7 @@ PA_FormType PA_Graffiti[PA_RECOTESTS] = { -void PA_AddStylusPos(u8 x, u8 y){ +static void PA_AddStylusPos(u8 x, u8 y){ if (!((x == PA_StylusPos[PA_Reco.nvalues-1].x) && (y == PA_StylusPos[PA_Reco.nvalues-1].y))){ PA_StylusPos[PA_Reco.nvalues].x = x; PA_StylusPos[PA_Reco.nvalues].y = y; @@ -69,7 +76,7 @@ void PA_AddStylusPos(u8 x, u8 y){ } -void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2){ +static void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2){ int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py; dx=x2-x1; /* the horizontal distance of the line */ @@ -130,7 +137,7 @@ void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2){ -char PA_AnalyzeShape(void){ +static char PA_AnalyzeShape(void){ s32 i; // for (i = 0; i < 32; i++) PA_OutputSimpleText(1, 0, i, " "); |