Revision 891fd122

View differences:

core/src/aos_main.cpp
64 64
 */
65 65
#define DELAYEVENT_MASK                         EVENT_MASK(4)
66 66

  
67
/**
68
 * @brief Event mask to identify rtcan message events.
69
 */
70
#define RTCANEVENT_MASK                         EVENT_MASK(5)
71

  
67 72
#if ((AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_CAN == TRUE)) || defined(__DOXYGEN__)
68 73
#define SSSP_STAGE3_ENABLE                      true
69 74
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) && (HAL_USE_CAN == TRUE) */
core/src/aos_rtcan.c
21 21
#include <hal_can_lld.h>
22 22
#include <aos_rtcan.h>
23 23
#include <aos_thread.h>
24
#include <chthreads.h>
25 24
#include <chtime.h>
26 25
#include <ch.h>
27 26
#include <stdbool.h>
......
32 31
#define NRTMSG 11
33 32
#define SLEEPTIME 20
34 33

  
35
static THD_WORKING_AREA(myThreadWorkingArea, 128);
34
/**
35
 * @brief Event mask to identify rtcan message events.
36
 */
37
#define RTCANEVENT_MASK                         EVENT_MASK(5)
38

  
39

  
40

  
36 41

  
42
// need to be initialized somewhere
37 43
msgqueue_t hrtQueue;
38 44
msgqueue_t srtQueue;
39 45
msgqueue_t nrtQueue;
46
event_source_t msgEventSource;
40 47

  
41 48
/*
42 49
 * @brief transmit Message over CAN
......
140 147

  
141 148
u_int32_t createId(rtcan_msg_t *msg, uint8_t msgType){
142 149
    // first 6 bit laxity
143
    // 6-21 id
144
    // 21-29 fragment
150
    // 6-21 id, einfach irgendetwas eindeutiges
151
    // 22-28 fragment
152
    // Differenz
145 153
    u_int32_t id = 0;
146 154
    aos_timestamp_t uptime;
147 155
    aosSysGetUptime(&uptime);
148 156

  
149
   uint32_t uptimeMcs = (uint32_t)(uptime / MICROSECONDS_PER_DAY);
157
}
150 158

  
159
static THD_WORKING_AREA(queueThdWorkingArea,128);
151 160

  
152
}
161
static THD_FUNCTION(queueThd,arg){
162
    event_listener_t msgListener;
163
    chEvtRegisterMask(&msgEventSource,&msgListener,RTCANEVENT_MASK);
153 164

  
165
    while(true){
166
      eventmask_t evt = chEvtWaitAny(RTCANEVENT_MASK);
167
    }
168
}
154 169

  
155 170
/**
156 171
 * @brief schedule rtcan messages into mailboxes
157 172
 */
158 173

  
159
static msg_t Thread(void *arg){
160
  (void)arg;
174
static THD_WORKING_AREA(SendThdWorkingArea, 128);
175
//todo rename
176
static THD_FUNCTION(rtcanSendThd,arg){
161 177
  chRegSetThreadName("RTCAN Timer");
162 178
  int nextSlot; // set by while loop from calendar
163 179

  
......
180 196
      // frame needs id, payload(later) and ___
181 197
      // place it in Mailbox to be sent in next time slot
182 198
    }
183
     // maybe send empty message if no message to reduce jitter????
199
    // in reserved slot should a message be sent
184 200
    chThdSleepMilliseconds( SLEEPTIME );
185 201
  }
186 202

  

Also available in: Unified diff