Temporary traces added for Kilrah and MAC debuggers ...

This commit is contained in:
bsongis
2012-05-25 21:30:54 +00:00
parent 4d3c4e4ecf
commit 2fb32eb9cc
4 changed files with 11 additions and 9 deletions
+7 -5
View File
@@ -32,7 +32,8 @@
*/
#include "open9x.h"
#include "errno.h"
#include <errno.h>
#include <fcntl.h>
volatile uint8_t pinb=0xff, pinc=0xff, pind, pine=0xff, ping=0xff, pinh=0xff, pinj=0xff, pinl=0;
uint8_t portb, portc, porth=0, dummyport;
@@ -56,7 +57,7 @@ extern const char* eeprom_buffer_data;
#endif
uint8_t eeprom[EESIZE];
sem_t eeprom_write_sem;
sem_t *eeprom_write_sem;
void setSwitch(int8_t swtch)
{
@@ -105,7 +106,7 @@ bool eeprom_thread_running = true;
void *eeprom_write_function(void *)
{
printf("on entre dans eeprom_write_function\n"); fflush(stdout);
while (!sem_wait(&eeprom_write_sem) || errno==EINTR) {
while (!sem_wait(eeprom_write_sem) || errno==EINTR) {
printf("sortie sem_wait"); fflush(stdout);
if (!eeprom_thread_running)
return NULL;
@@ -223,7 +224,8 @@ void StartEepromThread(const char *filename)
fp = fopen(eepromFile, "w+");
if (!fp) perror("error in fopen");
}
sem_init(&eeprom_write_sem, 0, 0);
// sem_init(&eeprom_write_sem, 0, 0);
eeprom_write_sem = sem_open("eepromsemaphore", O_CREAT);
eeprom_thread_running = true;
assert(!pthread_create(&eeprom_thread_pid, NULL, &eeprom_write_function, NULL));
}
@@ -231,7 +233,7 @@ void StartEepromThread(const char *filename)
void StopEepromThread()
{
eeprom_thread_running = false;
sem_post(&eeprom_write_sem);
sem_post(eeprom_write_sem);
pthread_join(eeprom_thread_pid, NULL);
}