Implement uuid.c, when formattig, write uuid into volume header

This commit is contained in:
Stefan `Sec` Zehl 2011-06-17 17:49:40 +02:00
parent 6d4c09066d
commit 8437cd7921
4 changed files with 25 additions and 2 deletions

View File

@ -8,7 +8,7 @@ OBJS = main.o
VPATH += VPATH +=
OBJS += OBJS +=
OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o basic/voltage.o OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o basic/voltage.o
OBJS += basic/keyin.o OBJS += basic/keyin.o basic/uuid.o
LIBS += core/libcore.a lcd/liblcd.a modules/libmodules.a filesystem/libfat.a usb/libusb.a LIBS += core/libcore.a lcd/liblcd.a modules/libmodules.a filesystem/libfat.a usb/libusb.a
########################################################################## ##########################################################################

View File

@ -139,4 +139,8 @@ uint32_t GetVoltage(void);
#define BTN_ENTER (1<<4) #define BTN_ENTER (1<<4)
uint8_t getInput(void); uint8_t getInput(void);
//uuid.c
uint32_t GetUUID32(void);
uint16_t GetUUID16(void);
#endif #endif

18
basic/uuid.c Normal file
View File

@ -0,0 +1,18 @@
#include "lpc134x.h"
#include "sysdefs.h"
#include "core/iap/iap.h"
uint32_t GetUUID32(void){
IAP_return_t iap_return;
iap_return = iapReadSerialNumber();
return iap_return.Result[1];
};
// What OpenBeacon used. Do we want this?
uint16_t GetUUID16(void){
IAP_return_t iap_return;
iap_return = iapReadSerialNumber();
return crc16 ((uint8_t *) iap_return.Result, sizeof (iap_return.Result));
};

View File

@ -91,6 +91,7 @@
#include "ff.h" /* FatFs configurations and declarations */ #include "ff.h" /* FatFs configurations and declarations */
#include "diskio.h" /* Declarations of low level disk I/O functions */ #include "diskio.h" /* Declarations of low level disk I/O functions */
#include "basic/basic.h"
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -3692,7 +3693,7 @@ FRESULT f_mkfs (
tbl[BS_BootSig32] = 0x29; /* Extended boot signature */ tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
mem_cpy(tbl+BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */ mem_cpy(tbl+BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */
} else { } else {
ST_DWORD(tbl+BS_VolID, n); /* VSN */ ST_DWORD(tbl+BS_VolID, GetUUID32()); /* VSN */
ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of sectors per FAT */ ST_WORD(tbl+BPB_FATSz16, n_fat); /* Number of sectors per FAT */
tbl[BS_DrvNum] = 0x80; /* Drive number */ tbl[BS_DrvNum] = 0x80; /* Drive number */
tbl[BS_BootSig] = 0x29; /* Extended boot signature */ tbl[BS_BootSig] = 0x29; /* Extended boot signature */