diff --git a/T1/TP1/cacti-master/cache.cfg.out b/T1/TP1/cacti-master/cache.cfg.out new file mode 100644 index 0000000..d8dd7ab --- /dev/null +++ b/T1/TP1/cacti-master/cache.cfg.out @@ -0,0 +1,2 @@ +Tech node (nm), Capacity (bytes), Number of banks, Associativity, Output width (bits), Access time (ns), Random cycle time (ns), Dynamic search energy (nJ), Dynamic read energy (nJ), Dynamic write energy (nJ), Standby leakage per bank(mW), Area (mm2), Ndwl, Ndbl, Nspd, Ndcm, Ndsam_level_1, Ndsam_level_2, Data arrary area efficiency %, Ntwl, Ntbl, Ntspd, Ntcm, Ntsam_level_1, Ntsam_level_2, Tag arrary area efficiency %, +90, 131072, 1, 2, 512, 1.47098, 1.86851, N/A, 0.303592, 0.615022, 63.7023, 2.24949, 2, 2, 1, 2, 2, 1, 78.3192, 2, 2, 4, 1, 8, 1, 77.9289, diff --git a/T1/TP1/cacti-master/cacti.exe b/T1/TP1/cacti-master/cacti.exe new file mode 100644 index 0000000..a0db47b Binary files /dev/null and b/T1/TP1/cacti-master/cacti.exe differ diff --git a/T1/TP1/cacti-master/obj_dbg/TSV.o b/T1/TP1/cacti-master/obj_dbg/TSV.o new file mode 100644 index 0000000..6c6c8f7 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/TSV.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/Ucache.o b/T1/TP1/cacti-master/obj_dbg/Ucache.o new file mode 100644 index 0000000..6cb3f1e Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/Ucache.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/arbiter.o b/T1/TP1/cacti-master/obj_dbg/arbiter.o new file mode 100644 index 0000000..fc270d0 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/arbiter.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/area.o b/T1/TP1/cacti-master/obj_dbg/area.o new file mode 100644 index 0000000..e41f7dc Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/area.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/bank.o b/T1/TP1/cacti-master/obj_dbg/bank.o new file mode 100644 index 0000000..4ce01b4 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/bank.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/basic_circuit.o b/T1/TP1/cacti-master/obj_dbg/basic_circuit.o new file mode 100644 index 0000000..8a133af Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/basic_circuit.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/cacti.exe b/T1/TP1/cacti-master/obj_dbg/cacti.exe new file mode 100644 index 0000000..a0db47b Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/cacti.exe differ diff --git a/T1/TP1/cacti-master/obj_dbg/cacti_interface.o b/T1/TP1/cacti-master/obj_dbg/cacti_interface.o new file mode 100644 index 0000000..4c7f2f2 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/cacti_interface.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/component.o b/T1/TP1/cacti-master/obj_dbg/component.o new file mode 100644 index 0000000..93e8295 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/component.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/crossbar.o b/T1/TP1/cacti-master/obj_dbg/crossbar.o new file mode 100644 index 0000000..b92e256 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/crossbar.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/decoder.o b/T1/TP1/cacti-master/obj_dbg/decoder.o new file mode 100644 index 0000000..f161b76 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/decoder.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/extio.o b/T1/TP1/cacti-master/obj_dbg/extio.o new file mode 100644 index 0000000..619e0bc Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/extio.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/extio_technology.o b/T1/TP1/cacti-master/obj_dbg/extio_technology.o new file mode 100644 index 0000000..c083d9b Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/extio_technology.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/htree2.o b/T1/TP1/cacti-master/obj_dbg/htree2.o new file mode 100644 index 0000000..310538f Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/htree2.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/io.o b/T1/TP1/cacti-master/obj_dbg/io.o new file mode 100644 index 0000000..48a517b Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/io.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/main.o b/T1/TP1/cacti-master/obj_dbg/main.o new file mode 100644 index 0000000..710ced1 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/main.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/mat.o b/T1/TP1/cacti-master/obj_dbg/mat.o new file mode 100644 index 0000000..698c61d Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/mat.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/memcad.o b/T1/TP1/cacti-master/obj_dbg/memcad.o new file mode 100644 index 0000000..df2faff Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/memcad.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/memcad_parameters.o b/T1/TP1/cacti-master/obj_dbg/memcad_parameters.o new file mode 100644 index 0000000..94997ef Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/memcad_parameters.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/memorybus.o b/T1/TP1/cacti-master/obj_dbg/memorybus.o new file mode 100644 index 0000000..f303d06 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/memorybus.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/nuca.o b/T1/TP1/cacti-master/obj_dbg/nuca.o new file mode 100644 index 0000000..b671dec Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/nuca.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/parameter.o b/T1/TP1/cacti-master/obj_dbg/parameter.o new file mode 100644 index 0000000..73baacb Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/parameter.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/powergating.o b/T1/TP1/cacti-master/obj_dbg/powergating.o new file mode 100644 index 0000000..8011f16 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/powergating.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/router.o b/T1/TP1/cacti-master/obj_dbg/router.o new file mode 100644 index 0000000..d25a075 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/router.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/subarray.o b/T1/TP1/cacti-master/obj_dbg/subarray.o new file mode 100644 index 0000000..143a769 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/subarray.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/technology.o b/T1/TP1/cacti-master/obj_dbg/technology.o new file mode 100644 index 0000000..3c89eb3 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/technology.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/uca.o b/T1/TP1/cacti-master/obj_dbg/uca.o new file mode 100644 index 0000000..56ebe4d Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/uca.o differ diff --git a/T1/TP1/cacti-master/obj_dbg/wire.o b/T1/TP1/cacti-master/obj_dbg/wire.o new file mode 100644 index 0000000..a27f578 Binary files /dev/null and b/T1/TP1/cacti-master/obj_dbg/wire.o differ diff --git a/T2/tp/Makefile b/T2/tp/Makefile deleted file mode 100755 index 4a58bb6..0000000 --- a/T2/tp/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -.POSIX: -CC = cc -CFLAGS = -std=c11 -Wall -Wextra -O3 -mcx16 -pthread #-DDEBUG -LDFLAGS = -pthread -#LDLIBS = -latomic - -C= $(wildcard *.c) -H= $(wildcard *.h) -PREAMBULE_SRCS := preambule.c -POSIX_SRCS := $(filter-out %preambule.c %Atomic.c %TestAndSet.c, $(C)) -ATOMIC_SRCS := $(filter-out %preambule.c %POSIX.c %TestAndSet.c, $(C)) -TESTANDSET_SRCS := $(filter-out %preambule.c %POSIX.c %Atomic.c, $(C)) -DEPS= $(H:.h) -PREAMBULE_OBJS= $(PREAMBULE_SRCS:.c=.o) -POSIX_OBJS= $(POSIX_SRCS:.c=.o) -ATOMIC_OBJS= $(ATOMIC_SRCS:.c=.o) -TESTANDSET_OBJS= $(TESTANDSET_SRCS:.c=.o) - -preambule: $(PREAMBULE_OBJS) $(DEPS) - $(CC) $(LDFLAGS) -o preambule $(PREAMBULE_OBJS) $(LDLIBS) - -posix: $(POSIX_OBJS) $(DEPS) - $(CC) $(LDFLAGS) -o mySoftwarePosix $(POSIX_OBJS) $(LDLIBS) - -atomic: $(ATOMIC_OBJS) $(DEPS) - $(CC) $(LDFLAGS) -o mySoftwareAtomic $(ATOMIC_OBJS) $(LDLIBS) - -testandset: $(TESTANDSET_OBJS) $(DEPS) - $(CC) $(LDFLAGS) -o mySoftwareTestAndSet $(TESTANDSET_OBJS) $(LDLIBS) - -clean: - rm -f preambule mySoftwarePosix mySoftwareAtomic mySoftwareTestAndSet $(PREAMBULE_OBJS) $(POSIX_OBJS) $(ATOMIC_OBJS) $(TESTANDSET_OBJS) - -runpreambule: clean preambule - ./preambule - -runposix: clean posix - ./mySoftwarePosix - -runatomic: clean atomic - ./mySoftwareAtomic - -runtestandset: clean testandset - ./mySoftwareTestAndSet \ No newline at end of file diff --git a/T2/tp/acquisitionManager.h b/T2/tp/acquisitionManager.h deleted file mode 100755 index 72bf728..0000000 --- a/T2/tp/acquisitionManager.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef ACQUISITION_MANAGER_H -#define ACQUISITION_MANAGER_H - -#include "msg.h" - -/** - * Initializes the acquisitions - */ -unsigned int acquisitionManagerInit(void); - -/** - * Waits that acquisitions terminate - */ -void acquisitionManagerJoin(void); - -/** - * Get producer count (debug output) - */ -unsigned int getProducerCount(void); - -/** - * Get new message (blocking) - */ -void getMessage(volatile MSG_BLOCK* mBlock); - -#endif diff --git a/T2/tp/acquisitionManagerPOSIX.c b/T2/tp/acquisitionManagerPOSIX.c deleted file mode 100755 index ca2d009..0000000 --- a/T2/tp/acquisitionManagerPOSIX.c +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "acquisitionManager.h" -#include "msg.h" -#include "iSensor.h" -#include "mySoftware.h" -#include "iAcquisitionManager.h" -#include "debug.h" - - -//producer count storage -volatile unsigned int produceCount = 0; - -pthread_t producers[4]; - -static void *produce(void *ithread); - -/** -* Semaphores and Mutex -*/ -pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; - -// Ring buffer -MSG_BLOCK buffer[100]; -unsigned int buf_head = 0; -unsigned int buf_tail = 0; - -/* -* Creates the synchronization elements. -* @return ERROR_SUCCESS if the init is ok, ERROR_INIT otherwise -*/ -static unsigned int createSynchronizationObjects(void); - -/* -* Increments the produce count. -*/ -static void incrementProducerCount(void); - -static unsigned int createSynchronizationObjects(void) -{ - //TODO - printf("[acquisitionManager]Semaphore created\n"); - return ERROR_SUCCESS; -} - -static void incrementProducerCount(void) -{ - pthread_mutex_lock(&m1); - produceCount++; - pthread_mutex_unlock(&m1); -} - -unsigned int getProducerCount(void) -{ - unsigned int p = 0; - pthread_mutex_lock(&m1); - p = produceCount; - pthread_mutex_unlock(&m1); - return p; -} - -void getMessage(volatile MSG_BLOCK* mBlock) { - volatile MSG_BLOCK msg; - char done = 0; - - // Voir TD Vincent David - // Là c'est une version de personne frustrée ne correspondant pas au TD - while (!done) { - pthread_mutex_lock(&m1); - if (buf_tail > buf_head) { - msg = buffer[buf_tail]; - buf_tail++; - done = 1; - } - pthread_mutex_unlock(&m1); - } - *mBlock = msg; -} - -unsigned int acquisitionManagerInit(void) -{ - unsigned int i; - printf("[acquisitionManager]Synchronization initialization in progress...\n"); - fflush( stdout ); - if (createSynchronizationObjects() == ERROR_INIT) - return ERROR_INIT; - - printf("[acquisitionManager]Synchronization initialization done.\n"); - - for (i = 0; i < PRODUCER_COUNT; i++) - { - pthread_create(&producers[i], NULL, &produce, &i); - } - - return ERROR_SUCCESS; -} - -void acquisitionManagerJoin(void) -{ - unsigned int i; - for (i = 0; i < PRODUCER_COUNT; i++) - { - pthread_join(producers[i], NULL); - } - - //TODO - printf("[acquisitionManager]Semaphore cleaned\n"); -} - -void *produce(void *ithread) -{ - D(printf("[acquisitionManager]Producer created with id %d\n", gettid())); - unsigned int i = 0; - MSG_BLOCK msg; - char done = 0; - while (i < PRODUCER_LOOP_LIMIT) - { - i++; - sleep(PRODUCER_SLEEP_TIME+(rand() % 5)); - - // Acquire input - getInput(*(int *)ithread, &msg); - - // Store in ring buffer - pthread_mutex_lock(&m1); - while (!done) { - pthread_mutex_lock(&m1); - if (buf_head < 100) { - buffer[buf_head] = msg; - buf_head++; - done = 1; - } - pthread_mutex_unlock(&m1); - } - pthread_mutex_unlock(&m1); - - } - printf("[acquisitionManager] %ld termination\n", gettid()); - pthread_exit(NULL); -} diff --git a/T2/tp/debug.h b/T2/tp/debug.h deleted file mode 100755 index 10af5ee..0000000 --- a/T2/tp/debug.h +++ /dev/null @@ -1,6 +0,0 @@ -//C macro to active debug printf -#ifdef DEBUG -# define D(x) x -#else -# define D(x) -#endif \ No newline at end of file diff --git a/T2/tp/display.c b/T2/tp/display.c deleted file mode 100755 index 5619b72..0000000 --- a/T2/tp/display.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "iDisplay.h" -#include -#include -#include "debug.h" - -void messageDisplay(volatile MSG_BLOCK* mBlock){ - unsigned int i; - messageCheck(mBlock); - printf("Message\n"); - D(printf("[")); - for(i=0;i < DATA_SIZE;i++) - D(printf("%u ",mBlock->mData[i])); - D(printf("]\n")); -} \ No newline at end of file diff --git a/T2/tp/displayManager.c b/T2/tp/displayManager.c deleted file mode 100755 index bb843e6..0000000 --- a/T2/tp/displayManager.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include "displayManager.h" -#include "iDisplay.h" -#include "iAcquisitionManager.h" -#include "iMessageAdder.h" -#include "msg.h" -#include "mySoftware.h" -#include "debug.h" - -// DisplayManager thread. -pthread_t displayThread; - -/** - * Display manager entry point. - */ -static void *display( void *parameters ); - - -void displayManagerInit(void){ - pthread_create(&displayThread, NULL, display, NULL); -} - -void displayManagerJoin(void){ - pthread_join(displayThread, NULL); -} - -static void *display( void *parameters ) -{ - D(printf("[displayManager] Thread created for display with id %d\n", gettid())); - unsigned int diffCount = 0; - while(diffCount < DISPLAY_LOOP_LIMIT){ - sleep(DISPLAY_SLEEP_TIME); - // TODO - } - printf("[displayManager] %ld termination\n", gettid()); - pthread_exit(NULL); -} diff --git a/T2/tp/displayManager.h b/T2/tp/displayManager.h deleted file mode 100755 index 76e031e..0000000 --- a/T2/tp/displayManager.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MESSAGE_DISPLAY_H -#define MESSAGE_DISPLAY_H - -/** -* Initializes display manager -*/ -void displayManagerInit(void); - -/** -* Waits that display manager terminates -*/ -void displayManagerJoin(void); - -#endif \ No newline at end of file diff --git a/T2/tp/iAcquisitionManager.h b/T2/tp/iAcquisitionManager.h deleted file mode 100755 index 040491e..0000000 --- a/T2/tp/iAcquisitionManager.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef I_ACQUISITION_MANAGER_H -#define I_ACQUISITION_MANAGER_H - -#include "msg.h" - -//TODO create accessors prototype here. - -#endif \ No newline at end of file diff --git a/T2/tp/iDisplay.h b/T2/tp/iDisplay.h deleted file mode 100755 index b3b65a7..0000000 --- a/T2/tp/iDisplay.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef I_DISPLAY_H -#define I_DISPLAY_H - -#include "msg.h" - -/** -* Displays the message content -* @param mBlock the message pointer -*/ -void messageDisplay(volatile MSG_BLOCK* mBlock); - -#endif \ No newline at end of file diff --git a/T2/tp/iMessageAdder.h b/T2/tp/iMessageAdder.h deleted file mode 100755 index 3958b91..0000000 --- a/T2/tp/iMessageAdder.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef I_MESSAGE_ADDER_H -#define I_MESSAGE_ADDER_H - -#include "msg.h" - - -//TODO create accessors prototype here. - -#endif \ No newline at end of file diff --git a/T2/tp/iSensor.h b/T2/tp/iSensor.h deleted file mode 100755 index eda4eec..0000000 --- a/T2/tp/iSensor.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef I_SENSOR_H -#define I_SENSOR_H - -#include "msg.h" - -/** -* Gets the input message. -* @param input the input number -* @param mBlock the message pointer returned -*/ -void getInput(const unsigned int input, volatile MSG_BLOCK* mBlock); - -#endif diff --git a/T2/tp/messageAdder.c b/T2/tp/messageAdder.c deleted file mode 100755 index 5edaaf8..0000000 --- a/T2/tp/messageAdder.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include -#include -#include -#include "messageAdder.h" -#include "msg.h" -#include "iMessageAdder.h" -#include "mySoftware.h" -#include "iAcquisitionManager.h" -#include "debug.h" - -//consumer thread -pthread_t consumer; -//Message computed -volatile MSG_BLOCK out; -//Consumer count storage -volatile unsigned int consumeCount = 0; - -/** - * Increments the consume count. - */ -static void incrementConsumeCount(void); - -/** - * Consumer entry point. - */ -static void *sum( void *parameters ); - -//TODO create accessors to limit semaphore and mutex usage outside of this C module. - -void messageAdderInit(void){ - out.checksum = 0; - for (size_t i = 0; i < DATA_SIZE; i++) - { - out.mData[i] = 0; - pthread_create(&consumer, NULL, sum, NULL); - } -} - -void messageAdderJoin(void){ - pthread_join(consumer, NULL); -} - -static void *sum( void *parameters ) -{ - D(printf("[messageAdder] Thread created for sum with id %ld\n", gettid())); - unsigned int i = 0; - while(i -#include -#include "msg.h" -#include "debug.h" -#include - - -/** -* Add to the src message the content of add message -* @param src the message pointer -* @param add the message to add -*/ -void messageAdd(volatile MSG_BLOCK* src, volatile MSG_BLOCK* add){ - unsigned int i; - src->checksum = 0; - for(i=0;i < DATA_SIZE;i++){ - src->mData[i] += add->mData[i]; - src->checksum ^= src->mData[i]; - } - D(printf("[msg]....Sum done...\n")); -} - -/** -* Display the message content -* @param mBlock the message pointer -*/ -unsigned int messageCheck(volatile MSG_BLOCK* mBlock){ - unsigned int i, tcheck=0; - for(i=0;i < DATA_SIZE;i++) - tcheck ^= mBlock->mData[i]; - if(tcheck == mBlock->checksum){ - printf("[OK ] Checksum validated\n"); - return 1; - }else{ - printf("[ FAILED] Checksum failed, message corrupted\n"); - return 0; - } -} - -long gettid(void){ - return syscall(SYS_gettid); -} diff --git a/T2/tp/msg.h b/T2/tp/msg.h deleted file mode 100755 index e141290..0000000 --- a/T2/tp/msg.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef MSG_H -#define MSG_H - -//Message data size -#define DATA_SIZE 256 - -//message type definition -typedef struct MSG_BLOCK_TAG -{ - unsigned int checksum; - unsigned int mData[DATA_SIZE]; -} MSG_BLOCK; - -/** -* Displays the message content -* @param mBlock the message pointer -* @return 1 if the checksum is ok, 0 otherwise -*/ -unsigned int messageCheck(volatile MSG_BLOCK* mBlock); - -/** -* Adds to the src message the content of add message -* @param src the message pointer -* @param add the message to add -*/ -void messageAdd(volatile MSG_BLOCK* src, volatile MSG_BLOCK* add); - - -long gettid(void); - -#endif diff --git a/T2/tp/mySoftware.c b/T2/tp/mySoftware.c deleted file mode 100755 index 425e463..0000000 --- a/T2/tp/mySoftware.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "mySoftware.h" -#include "acquisitionManager.h" -#include "displayManager.h" -#include "messageAdder.h" -#include "displayManager.h" -#include "debug.h" - - -//The entry point of the process -int main( void ) -{ - printf("[mySoftware]Software initialization in progress...\n"); - acquisitionManagerInit(); - messageAdderInit(); - displayManagerInit(); - printf("[mySoftware]Task initialization done.\n"); - - printf("[mySoftware]Scheduling in progress...\n"); - - displayManagerJoin(); - messageAdderJoin(); - acquisitionManagerJoin(); - - printf("[mySoftware]Threads terminated\n"); - - exit(EXIT_SUCCESS); - -} diff --git a/T2/tp/mySoftware.h b/T2/tp/mySoftware.h deleted file mode 100755 index fdcaf72..0000000 --- a/T2/tp/mySoftware.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef MY_SOFTWARE_H -#define MY_SOFTWARE_H - -#include "msg.h" - -//The application return code -#define ERROR_INIT 1 -#define ERROR_SUCCESS 0 -//The number of producers -#define PRODUCER_COUNT 4 -//The number of second the producer shall sleep -#define PRODUCER_SLEEP_TIME 1 -//The number producer iterations -#define PRODUCER_LOOP_LIMIT 2 -//The number of second the display shall sleep -#define DISPLAY_SLEEP_TIME 3 -//The number display iterations -#define DISPLAY_LOOP_LIMIT 2 -//The number of second the adder shall sleep -#define ADDER_SLEEP_TIME 2 -//The number adder iterations -#define ADDER_LOOP_LIMIT PRODUCER_LOOP_LIMIT * PRODUCER_COUNT * PRODUCER_SLEEP_TIME - -#endif \ No newline at end of file diff --git a/T2/tp/preambule.c b/T2/tp/preambule.c deleted file mode 100755 index bad1276..0000000 --- a/T2/tp/preambule.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include - -#define ERROR_INIT 1 -#define ERROR_SUCCESS 0 -#define SEMAPHORE_INITIAL_VALUE 0 -#define SEM_NAME "/preambule_sem" - -pthread_t thread_1; -sem_t *semaphore; - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -void *produce(void *params) -{ - printf("Trying to own the mutex\n"); - pthread_mutex_lock(&mutex); - printf("Owns the mutex\n"); - pthread_mutex_unlock(&mutex); - printf("Mutex released\n"); - sem_post(semaphore); - printf("Semaphore posted\n"); - printf("Trying to gets the semaphore\n"); - sem_wait(semaphore); - printf("Semaphore taken\n"); - printf("Thread ended\n"); - pthread_exit(NULL); -} - -int main() -{ - - sem_unlink(SEM_NAME); - semaphore = sem_open(SEM_NAME, O_CREAT, 0644, SEMAPHORE_INITIAL_VALUE); - if (semaphore == SEM_FAILED) - { - perror("[sem_open"); - return ERROR_INIT; - } - printf("Creating the thread\n"); - pthread_create(&thread_1, NULL, produce, NULL); - - printf("Waiting the thread end\n"); - pthread_join(thread_1, NULL); - printf("Deleting the semaphore\n"); - sem_destroy(semaphore); - printf("Process ended\n"); - return ERROR_SUCCESS; -} \ No newline at end of file diff --git a/T2/tp/sensorManager.c b/T2/tp/sensorManager.c deleted file mode 100755 index 5d5f505..0000000 --- a/T2/tp/sensorManager.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "iSensor.h" -#include -#include -#include "debug.h" - - -void getInput(const unsigned int input, volatile MSG_BLOCK* mBlock){ - unsigned int i; - unsigned int j = input; - D(printf("Get message for input %u \n",j)); - mBlock->checksum = 0; - for(i=0;i < DATA_SIZE;i++){ - mBlock->mData[i] = rand(); - mBlock->checksum ^= mBlock->mData[i]; - } - return; -} \ No newline at end of file