Move some functions into basic/ and add prototypes for them

This commit is contained in:
Stefan `Sec` Zehl 2011-06-13 21:06:09 +02:00
parent 31634eaafc
commit 572bf9439b
5 changed files with 40 additions and 24 deletions

View File

@ -7,9 +7,8 @@ OBJS = main.o
VPATH +=
OBJS +=
OBJS += basic/basic.o
OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o
OBJS += eeprom/eeprom.o
OBJS += reinvoke_isp.o
LIBS += core/libcore.a lcd/liblcd.a modules/libmodules.a
##########################################################################

View File

@ -116,4 +116,12 @@
void rbInit(void);
// reinvoke_isp.c
void ReinvokeISP(void);
void EnableWatchdog(uint32_t ms);
void EnterISP(void);
// delayms.c
void delayms(uint32_t ms);
#endif

24
basic/delayms.c Normal file
View File

@ -0,0 +1,24 @@
#include <sysdefs.h>
#include "lpc134x.h"
/**************************************************************************/
/*!
Approximates a 1 millisecond delay using "nop". This is less
accurate than a dedicated timer, but is useful in certain situations.
The number of ticks to delay depends on the optimisation level set
when compiling (-O). Depending on the compiler settings, one of the
two defined values for 'delay' should be used.
*/
/**************************************************************************/
void delayms(uint32_t ms)
{
uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 45); // Release Mode (-Os)
// uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 120); // Debug Mode (No optimisations)
while (delay > 0)
{
__asm volatile ("nop");
delay--;
}
}

View File

@ -71,3 +71,9 @@ void EnableWatchdog(uint32_t ms){
WDT_WDFEED = WDT_WDFEED_FEED1;
WDT_WDFEED = WDT_WDFEED_FEED2;
};
void ISPandReset(int delay){
EnableWatchdog(1000*delay);
ReinvokeISP();
};

View File

@ -2,28 +2,7 @@
#include <sysdefs.h>
#include "lpc134x.h"
#include "gpio/gpio.h"
/**************************************************************************/
/*!
Approximates a 1 millisecond delay using "nop". This is less
accurate than a dedicated timer, but is useful in certain situations.
The number of ticks to delay depends on the optimisation level set
when compiling (-O). Depending on the compiler settings, one of the
two defined values for 'delay' should be used.
*/
/**************************************************************************/
void delayms(uint32_t ms)
{
uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 45); // Release Mode (-Os)
// uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 120); // Debug Mode (No optimisations)
while (delay > 0)
{
__asm volatile ("nop");
delay--;
}
}
#include "basic/basic.h"
/**************************************************************************/
/* Utility routines to manage nokia display */