#include_HEADERS = $(notdir $(wildcard $(SOURCES_DIR)/*.h))
-include_HEADERS = cpu_def.h hal_intr.h types.h
+include_HEADERS = cpu_def.h hal_intr.h types.h bbconf_info.h
--- /dev/null
+#ifndef _BBCONF_INFO_H_
+#define _BBCONF_INFO_H_
+
+#if 1 /* Provide FLASH start directly */
+
+#define BBCONF_FLASH_START 0x10000000
+
+#else /* FLASH start taken from ldscript */
+
+#ifndef __ASSEMBLY__
+extern char __flash_base;
+#define BBCONF_FLASH_START ((unsigned long)(&__flash_base))
+#else /*__ASSEMBLY__*/
+.global __flash_base
+#define BBCONF_FLASH_START __flash_base
+#endif /*__ASSEMBLY__*/
+
+#endif /* decission about flash start */
+
+#define BBCONF_MAGIC_VAL 0xd1ab46d6
+
+#define BBCONF_MAGIC_ADDR (BBCONF_FLASH_START+0x40)
+#define BBCONF_PTPTR_ADDR (BBCONF_FLASH_START+0x44)
+
+#define BBCONF_PTTAG_END 0x00
+#define BBCONF_PTTAG_BBVER 0x01
+#define BBCONF_PTTAG_KVPB_START 0x12
+#define BBCONF_PTTAG_KVPB_BYCFI 0x13
+#define BBCONF_PTTAG_KVPB_SIZE 0x14
+#define BBCONF_PTTAG_WITH_BATPACK 0x15
+
+#define BBCONF_PT_MAX_CNT 0x80
+
+
+#ifndef __ASSEMBLY__
+
+int bbconf_get_param(unsigned long tag, unsigned long *pval);
+
+#endif /*__ASSEMBLY__*/
+
+#endif /*_BBCONF_INFO_H_*/
lib_LIBRARIES = arch
-arch_SOURCES = system_stub.c
+arch_SOURCES = system_stub.c bbconf_info.c
lib_obj_SOURCES = system_stub.c
--- /dev/null
+/*******************************************************************
+ Components for embedded applications builded for
+ laboratory and medical instruments firmware
+
+ bbconf_info.c - boot block config parameters retrieval
+
+ Copyright (C) 2001 by Pavel Pisa pisa@cmp.felk.cvut.cz
+ (C) 2002 by PiKRON Ltd. http://www.pikron.com
+
+ *******************************************************************/
+
+#include <string.h>
+#include <bbconf_info.h>
+
+int bbconf_get_param(unsigned long tag, unsigned long *pval)
+{
+ unsigned long *magic = (unsigned long *)BBCONF_MAGIC_ADDR;
+ unsigned long *pt_ptr = (unsigned long *)BBCONF_PTPTR_ADDR;
+ unsigned long *pt;
+ int cnt;
+
+ if(*magic != BBCONF_MAGIC_VAL)
+ return -2;
+
+ if(!(*pt_ptr) || !(*pt_ptr+1))
+ return -2;
+
+ pt = (unsigned long *)*pt_ptr;
+
+ for(cnt = 0; (cnt < BBCONF_PT_MAX_CNT) &&
+ (pt[0] != BBCONF_PTTAG_END); cnt++, pt += 2) {
+ if(pt[0] == tag) {
+ *pval=pt[1];
+ return 1;
+ }
+ }
+ return -1;
+}
/* Setup vector table. Note that undf, pabt, dabt, fiq just execute
a null loop. */
+#include <bbconf_info.h>
+
+.global __bbconf_magic_addr
+.global __bbconf_ptptr_addr
+.global __bbconf_pt_addr
+
.section .ivt,"ax"
.code 32
.align 0
DAbt_Handler: B DAbt_Handler
FIQ_Handler: B FIQ_Handler
+__bbconf_magic_addr:
+ .word BBCONF_MAGIC_VAL
+__bbconf_ptptr_addr:
+ .word __bbconf_pt_addr
+
#if defined(__thumb__)
IRQ_Trampoline:
sub lr, lr, #4
+PROVIDE( __bbconf_pt_addr = 0 );
/* Memory Definitions */
MEMORY
KEYVAL_PAGE_LEN = 0x00002000;
+PROVIDE( __bbconf_pt_addr = 0 );
+
/* Memory Definitions */
MEMORY
{
KEYVAL_PAGE_LEN = 0x00001000;
+PROVIDE( __bbconf_pt_addr = 0 );
+
/* Memory Definitions */
MEMORY
{