Initial import of NFC GNSS SDK project
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
MODULE = crc32_syscall
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <stdio.h>
|
||||
#include "cpu.h"
|
||||
#include "crc32.h"
|
||||
#include "syscall-arom.h"
|
||||
|
||||
/* Set bit 0 to 1 for thumb code */
|
||||
#define AROM_FUNC_ADDRESS(X) ((void *)((X) + 1))
|
||||
|
||||
static void *
|
||||
crc32_get_handler(void)
|
||||
{
|
||||
void *crc32_handler;
|
||||
unsigned int chipid = hw_chip_id();
|
||||
|
||||
switch(chipid) {
|
||||
case CHIP_ID_CRANEG:
|
||||
case CHIP_ID_CRANEM:
|
||||
/* 3603/1603, Bootrom release version: 2020.07.30 */
|
||||
crc32_handler = AROM_FUNC_ADDRESS(0xd1005fcc);
|
||||
break;
|
||||
case CHIP_ID_CRANEL:
|
||||
/* 1606, Bootrom release version: 2021.10.16 */
|
||||
crc32_handler = AROM_FUNC_ADDRESS(0xd1f02f18);
|
||||
break;
|
||||
case CHIP_ID_CRANELR:
|
||||
/* 1602, Bootrom release version: 2022.11.11 */
|
||||
crc32_handler = AROM_FUNC_ADDRESS(0xd1f0358c);
|
||||
break;
|
||||
case CHIP_ID_CRANELS:
|
||||
/* 1609, Bootrom release version: 2022.12.15 */
|
||||
crc32_handler = AROM_FUNC_ADDRESS(0xd1f035c0);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Since Bootrom release version 2023.09.12(Fulmar Z1) the crc32 syscall
|
||||
* is supported.
|
||||
*/
|
||||
crc32_handler = syscall_get_handler(SYSCALL_106_CRC32);
|
||||
}
|
||||
|
||||
return crc32_handler;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
crc32(unsigned int val, const void *ss, int len)
|
||||
{
|
||||
return ((typeof(crc32) *)crc32_get_handler())(val, ss, len);
|
||||
}
|
||||
Reference in New Issue
Block a user