ifeq ($(CONFIG_OC_CMDPROC),y)
rocon_SOURCES += appl_cmdproc.c
+rocon_SOURCES += appl_cmds.c
ifneq ($(CONFIG_APP_ROCON_WITH_SIM_POSIX),y)
rocon_SOURCES += appl_tests.c
rocon_SOURCES += appl_dprint.c
ifeq ($(CONFIG_PXMC),y)
ifeq ($(CONFIG_PXMC_COORDMV),y)
rocon_SOURCES += appl_coordmv.c math_sqrtll.c
+rocon_SOURCES += math_sqrtll_test.c
lib_LOADLIBES += pxmc_coordmv
endif
ifneq ($(CONFIG_APP_ROCON_WITH_SIM_POSIX),y)
extern cmd_des_t const *cmd_appl_tests[];
extern cmd_des_t const *cmd_pxmc_ptable[];
extern cmd_des_t const *cmd_pxmc_coordmv[];
+extern cmd_des_t const *cmd_appl_specific[];
extern cmd_des_t const cmd_des_dprint;
CMD_DES_INCLUDE_SUBLIST(cmd_pxmc_ptable),
#endif
CMD_DES_INCLUDE_SUBLIST(cmd_pxmc_coordmv),
+ CMD_DES_INCLUDE_SUBLIST(cmd_appl_specific),
&cmd_des_dprint,
NULL
};
--- /dev/null
+/*******************************************************************
+ Motion and Robotic System (MARS) aplication components
+
+ appl_cmds.c - application specific commands - mainly global
+ PXMC state manipulation for RoCoN
+
+ Copyright (C) 2001-2014 by Pavel Pisa - originator
+ pisa@cmp.felk.cvut.cz
+ (C) 2001-2014 by PiKRON Ltd. - originator
+ http://www.pikron.com
+
+ This file can be used and copied according to next
+ license alternatives
+ - GPL - GNU Public License
+ - other license provided by project originators
+
+ *******************************************************************/
+
+#include <cpu_def.h>
+#include <system_def.h>
+#include <pxmc.h>
+#include <pxmc_coordmv.h>
+#include <cmd_proc.h>
+#include <pxmc_cmds.h>
+#include <utils.h>
+
+#include "appl_defs.h"
+
+int sqrtll_main(int argc, char *argv[]);
+
+int cmd_do_sqrtll(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+ char *ps;
+ ps = param[1];
+ sqrtll_main(!ps?1: !*ps? 1: 2, param);
+ return 0;
+}
+
+cmd_des_t const cmd_des_sqrtll={0, 0,"sqrtll","test 64-bit square root computation",
+ cmd_do_sqrtll,
+ {0,0}};
+
+
+cmd_des_t const *const cmd_appl_specific[]={
+ &cmd_des_sqrtll,
+ NULL
+};
#ifdef CONFIG_PXMC
fpga_reconfiguaration_initiated = pxmc_done;
fpga_reconfiguaration_finished = pxmc_initialize;
- printf("setup pxmc_initialize hook for FPGA\n", i);
+ printf("setup pxmc_initialize hook for FPGA\n");
#endif /*CONFIG_PXMC*/
appl_run_at_slow_sfi_setup();
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef OMK_FOR_TARGET
+ #include <cpu_def.h>
+ #include <system_def.h>
+ #include <lt_timer.h>
+ unsigned long sqrtll(unsigned long long x);
+ #define main sqrtll_main
+ #ifdef LPC_TIM0
+ #define sqrtll_ticks() (LPC_TIM0->TC)
+ #endif /*LPC_TIM0*/
+#else /*OMK_FOR_TARGET*/
+ #include "math_sqrtll.c"
+ #define lt_mstime_update() do {} while(0)
+ #define cli() do {} while(0)
+ #define sti() do {} while(0)
+ int actual_msec;
+#endif /*OMK_FOR_TARGET*/
+
+#ifndef sqrtll_ticks
+ #define sqrtll_ticks() 0
+#endif
+
+int main(int argc, char *argv[])
+{
+ unsigned long long sqr;
+ unsigned long res,inp,incr,cnt,time;
+ unsigned short spent;
+
+ char *s="a";
+
+ if (argc>=2)
+ s=argv[1];
+
+ if(*s!='a'){
+ inp=strtoul(s,NULL,0);
+ sqr=(unsigned long long int)inp*inp;
+ cli();
+ spent=sqrtll_ticks();
+ res=sqrtll(sqr);
+ spent=sqrtll_ticks()-spent;
+ sti();
+ printf("sqrtll: inp=%lu, res=%lu, spent=%u\n",inp,res,(int)spent);
+ }else{
+ inp=0; incr=1; cnt=0;
+ lt_mstime_update();
+ time=actual_msec;
+ do{
+ sqr=(unsigned long long int)inp*inp;
+ res=sqrtll(sqr);
+ if(0||(inp!=res)){
+ printf("sqrt error %lu -> %lu diff %ld sqr 0x%llx\n",inp,res,inp-res,sqr);
+ res=sqrtll(sqr);
+ }
+ inp+=incr; cnt++;
+ if(inp&0xfff) continue;
+ if(inp&((incr<<19)-1)) continue;
+ incr<<=1;
+ printf(".");fflush(NULL);
+ }while(inp);
+ lt_mstime_update();
+ time=actual_msec-time;
+ printf("\nsqrtll OK, spent %ld cnt %ld\n",time,cnt);
+ }
+ return 0;
+}