- date set works now correctly
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@375 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/times.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include "libsys.h"
|
#include "libsys.h"
|
||||||
|
|
||||||
#define NO_ERROR 0x00000000
|
#define NO_ERROR 0x00000000
|
||||||
@@ -22,11 +24,14 @@ void handler3(void)
|
|||||||
{
|
{
|
||||||
volatile UINT32 *pUART_stat = (UINT32*)sys_uart_stat;
|
volatile UINT32 *pUART_stat = (UINT32*)sys_uart_stat;
|
||||||
volatile UINT32 *pUART_data = (UINT32*)sys_uart_data;
|
volatile UINT32 *pUART_data = (UINT32*)sys_uart_data;
|
||||||
|
volatile UINT32 *pLED = (UINT32*)sys_led_port;
|
||||||
|
|
||||||
while((0x10 & *pUART_stat))
|
while((0x10 & *pUART_stat))
|
||||||
{
|
{
|
||||||
buffer[i] = (char)*pUART_data;
|
buffer[i] = (char)*pUART_data;
|
||||||
|
*pLED = buffer[i]*buffer[i];
|
||||||
i = (i+1)%sizeof(buffer);
|
i = (i+1)%sizeof(buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -312,7 +317,8 @@ int main (void)
|
|||||||
time_t curr_date;
|
time_t curr_date;
|
||||||
struct tm *pDate, date;
|
struct tm *pDate, date;
|
||||||
UINT32 start, end;
|
UINT32 start, end;
|
||||||
char sel;
|
char sel[80];
|
||||||
|
struct timeval time_sec;
|
||||||
|
|
||||||
UINT8 *ram8 = NULL;
|
UINT8 *ram8 = NULL;
|
||||||
UINT16 *ram16 = NULL;
|
UINT16 *ram16 = NULL;
|
||||||
@@ -522,9 +528,12 @@ int main (void)
|
|||||||
sputs("\r\n");
|
sputs("\r\n");
|
||||||
|
|
||||||
printf("Datum und Uhrzeit setzen? [j/N]: ");
|
printf("Datum und Uhrzeit setzen? [j/N]: ");
|
||||||
scanf("%c", &sel);
|
scanf("%s", sel);
|
||||||
if (toupper(sel) == 'J')
|
if (toupper(sel[0]) == 'J')
|
||||||
{
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
printf("Datum\n");
|
||||||
printf("Jahr : ");
|
printf("Jahr : ");
|
||||||
scanf("%d", &date.tm_year);
|
scanf("%d", &date.tm_year);
|
||||||
printf("Monat : ");
|
printf("Monat : ");
|
||||||
@@ -532,7 +541,30 @@ int main (void)
|
|||||||
printf("Tag : ");
|
printf("Tag : ");
|
||||||
scanf("%d", &date.tm_mday);
|
scanf("%d", &date.tm_mday);
|
||||||
|
|
||||||
printf("Wir haben heute den %d. %d. %d\n", date.tm_mday, date.tm_mon, date.tm_year);
|
printf("Uhrzeit\n");
|
||||||
|
printf("Stunde : ");
|
||||||
|
scanf("%d", &date.tm_hour);
|
||||||
|
printf("Minute : ");
|
||||||
|
scanf("%d", &date.tm_min);
|
||||||
|
printf("Sekunde : ");
|
||||||
|
scanf("%d", &date.tm_sec);
|
||||||
|
|
||||||
|
date.tm_year -= 1900;
|
||||||
|
date.tm_mon -= 1;
|
||||||
|
time_sec.tv_sec = mktime(&date);
|
||||||
|
time_sec.tv_usec = 0;
|
||||||
|
settimeofday(&time_sec, NULL);
|
||||||
|
|
||||||
|
printf("Datum\n");
|
||||||
|
curr_date = time(NULL);
|
||||||
|
pDate = gmtime(&curr_date);
|
||||||
|
puts(asctime(pDate));
|
||||||
|
printf("\nOK? [J/n]: ");
|
||||||
|
scanf("%s", sel);
|
||||||
|
printf("sel=%d\n", (int)sel[0]);
|
||||||
|
|
||||||
|
|
||||||
|
} while(toupper(sel[0]) == 'N');
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt_enable(3);
|
interrupt_enable(3);
|
||||||
|
|||||||
Reference in New Issue
Block a user