}
static struct MHD_Daemon * d;
+static pthread_mutex_t mutex;
+
int httpd_start(void)
{
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init( &attr );
+ pthread_mutex_init( &mutex, &attr );
int port = 8888;
LOG_USER("Launching httpd server on port %d", port);
void httpd_stop(void)
{
MHD_stop_daemon(d);
+ pthread_mutex_destroy( &mutex );
}
void openocd_sleep_prelude(void)
{
- /* FIX!!!! add locking here!!!! */
+ pthread_mutex_unlock( &mutex );
}
void openocd_sleep_postlude(void)
{
- /* FIX!!!! add locking here!!!! */
+ pthread_mutex_lock( &mutex );
}
set e
java -classpath ../../../../zy1000/build/xalan.jar\;. Stylizer menu.xsl menu.xml .
find . -regex ".*\.tcl" -type f -exec sh html2tcl.sh {} {} \;
+echo "Copy .tcl files to /usr/local/lib/openocd/httpd/"
+cp *.tcl /usr/local/lib/openocd/httpd/
\ No newline at end of file
set form_length 0x10000\r
} \r
if {[string compare $form_address ""]==0} {\r
- if {[catch {[zy1000_flash]} result]==0} {\r
+ if {[catch {[first_flash_base]} result]==0} {\r
set form_address "0x[tohex $result]"\r
} \r
} \r
# catch any exceptions, capture output and return it \r
proc capture_catch {a} {\r
catch {\r
- return [eval {capture $a}]\r
+ capture {uplevel $a}\r
} result\r
- return $result\r
+ return $result \r
}\r
\r
-proc zy1000_flash {} {\r
+proc first_flash_base {} {\r
set t [lindex 0 [ocd_flash_banks]]\r
return $t(base)\r
}\r
set form_length 0x10000\r
} \r
if {[string compare $form_address ""]==0} {\r
- if {[catch {[zy1000_flash]} result]==0} {\r
+ if {[catch {[first_flash_base]} result]==0} {\r
set form_address "0x[tohex $result]"\r
} \r
} \r
set form_command [formfetch form_command]\r
\r
set form_edittext ""\r
- if {[string length $form_command]>0} { \r
- catch {capture_catch {eval "$form_command"}} form_edittext\r
+ if {[string length $form_command]>0} {\r
+ set form_edittext [capture_catch {eval $form_command}]\r
}\r
\r
append buffer {<form action="openocd.tcl" method="post">} "\n"\r
set form_command [formfetch form_command]\r
\r
set form_edittext ""\r
- if {[string length $form_command]>0} { \r
- catch {capture_catch {eval "$form_command"}} form_edittext\r
+ if {[string length $form_command]>0} {\r
+ set form_edittext [capture_catch {eval $form_command}]\r
}\r
\r
append buffer {<form action="openocd.tcl" method="post">} "\n"\r