Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: bc435f106003451b39919355851cb0b4184dc94a (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                   
                                                                              
                              




















                                                                                                    









                                                                    
RoomModel room.basic.service.pinterrupt {

	import room.basic.types.* from "Types.room"

	ProtocolClass PInterrupt {
		incoming {
			Message event()
		}
		conjugated PortClass
		{
			usercode '''#include "messaging/etMessageService.h"'''
			handle
			incoming event '''// the message should be sent via the fire operation !!'''
			Operation export(): PInterruptConjPort ref '''
				msg.address = self->peerAddress;
				msg.evtID = PInterrupt_IN_event;
				callback.func=(void (*)(void*))PInterruptConjPort_dispatch;
				callback.param=(void *)self;
				etMessageService_registerHighPrioFunc(self->msgService,&callback);
				return self;
			'''
			Operation dispatch() '''
				// this operation will be executed from the message service
				if (enable){
					enable=0;
					self->msgService->msgDispatcher(&msg);
				}
			'''
			Operation fire() '''
				// this method runs on interrupt level
				enable=1;
				etSema_wakeupFromISR(&self->msgService->executionSemaphore);
			'''
			Attribute msg: etMessage = "0"
			Attribute callback: etHighPrioFunc = "{0,0}"
			Attribute enable: uint8 = "0"
		}
	}

	ExternalType PInterruptConjPort -> "PInterruptConjPort"
	ExternalType etMessage -> "etMessage"
	ExternalType etHighPrioFunc -> "etHighPrioFunc"
}

Back to the top