OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #if defined(FLETCH_TARGET_OS_CMSIS) | 5 #if defined(DARTINO_TARGET_OS_CMSIS) |
6 | 6 |
7 // We do not include platform_posix.h on purpose. That file | 7 // We do not include platform_posix.h on purpose. That file |
8 // should never be directly inported. platform.h is always | 8 // should never be directly inported. platform.h is always |
9 // the platform header to include. | 9 // the platform header to include. |
10 #include "src/shared/platform.h" // NOLINT | 10 #include "src/shared/platform.h" // NOLINT |
11 | 11 |
12 #include <sys/time.h> | 12 #include <sys/time.h> |
13 #include <time.h> | 13 #include <time.h> |
14 #include <signal.h> | 14 #include <signal.h> |
15 #include <unistd.h> | 15 #include <unistd.h> |
16 | 16 |
17 #include "src/shared/utils.h" | 17 #include "src/shared/utils.h" |
18 | 18 |
19 namespace fletch { | 19 namespace dartino { |
20 | 20 |
21 osMailQId fletchMailQ; | 21 osMailQId dartinoMailQ; |
22 | 22 |
23 osMailQId GetFletchMailQ() { | 23 osMailQId GetDartinoMailQ() { |
24 return fletchMailQ; | 24 return dartinoMailQ; |
25 } | 25 } |
26 | 26 |
27 // Sends a message on the fletch osMailQ used by the event handler. | 27 // Sends a message on the dartino osMailQ used by the event handler. |
28 int SendMessageCmsis(uint32_t port_id, int64_t message) { | 28 int SendMessageCmsis(uint32_t port_id, int64_t message) { |
29 CmsisMessage *cmsisMessage = | 29 CmsisMessage *cmsisMessage = |
30 reinterpret_cast<CmsisMessage*>(osMailAlloc(fletchMailQ, 0)); | 30 reinterpret_cast<CmsisMessage*>(osMailAlloc(dartinoMailQ, 0)); |
31 cmsisMessage->port_id = port_id; | 31 cmsisMessage->port_id = port_id; |
32 cmsisMessage->message = message; | 32 cmsisMessage->message = message; |
33 return osMailPut(GetFletchMailQ(), reinterpret_cast<void*>(cmsisMessage)); | 33 return osMailPut(GetDartinoMailQ(), reinterpret_cast<void*>(cmsisMessage)); |
34 } | 34 } |
35 | 35 |
36 static uint64 time_launch; | 36 static uint64 time_launch; |
37 | 37 |
38 // The size of the queue used by the event handler. | 38 // The size of the queue used by the event handler. |
39 const uint32_t kMailQSize = 50; | 39 const uint32_t kMailQSize = 50; |
40 | 40 |
41 void Platform::Setup() { | 41 void Platform::Setup() { |
42 time_launch = GetMicroseconds(); | 42 time_launch = GetMicroseconds(); |
43 osMailQDef(fletch_queue, kMailQSize, CmsisMessage); | 43 osMailQDef(dartino_queue, kMailQSize, CmsisMessage); |
44 fletchMailQ = osMailCreate(osMailQ(fletch_queue), NULL); | 44 dartinoMailQ = osMailCreate(osMailQ(dartino_queue), NULL); |
45 } | 45 } |
46 | 46 |
47 void Platform::TearDown() { } | 47 void Platform::TearDown() { } |
48 | 48 |
49 void GetPathOfExecutable(char* path, size_t path_length) { path[0] = '\0'; } | 49 void GetPathOfExecutable(char* path, size_t path_length) { path[0] = '\0'; } |
50 | 50 |
51 int Platform::GetLocalTimeZoneOffset() { return 0; } | 51 int Platform::GetLocalTimeZoneOffset() { return 0; } |
52 | 52 |
53 uint64 Platform::GetMicroseconds() { | 53 uint64 Platform::GetMicroseconds() { |
54 struct timeval tv; | 54 struct timeval tv; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool VirtualMemory::Commit(uword address, int size, bool executable) { | 189 bool VirtualMemory::Commit(uword address, int size, bool executable) { |
190 UNIMPLEMENTED(); | 190 UNIMPLEMENTED(); |
191 return false; | 191 return false; |
192 } | 192 } |
193 | 193 |
194 bool VirtualMemory::Uncommit(uword address, int size) { | 194 bool VirtualMemory::Uncommit(uword address, int size) { |
195 UNIMPLEMENTED(); | 195 UNIMPLEMENTED(); |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 } // namespace fletch | 199 } // namespace dartino |
200 | 200 |
201 #endif // defined(FLETCH_TARGET_OS_CMSIS) | 201 #endif // defined(DARTINO_TARGET_OS_CMSIS) |
OLD | NEW |