embkernel
 All Classes Functions Variables Typedefs Groups Pages
main.cpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #include "RtosInclude.hpp"
7 #include "NetInclude.hpp"
8 #include "FsFile.hpp"
9 #include "FsDriveSdio.hpp"
10 #include "LibInclude.hpp"
11 #include "LibStringFormat.hpp"
12 #include "LibDebug.hpp"
13 #include "Hw.hpp"
14 #include "LibRtc.hpp"
15 #include "LibRtosTraceNet.hpp"
16 #include "TlsSocket.hpp"
17 #include "Telnet.hpp"
18 #include "Comm.hpp"
19 #include <string.h>
20 #include <stdio.h>
21 
22 uint32_t netBuffer[4096];
23 LibDmem netMem(netBuffer, sizeof(netBuffer));
24 NetMac netMac;
25 
26 FsDriveSdio fsDriveSdio;
27 FsPartition fsPartitionSd0(&fsDriveSdio, 0);
28 FsPartition* fsPartitions[] = { &fsPartitionSd0 };
29 
30 static void demoTaskRun(RtosTask* task);
31 
32 RtosTask demoTask(0, "DemoTask", 1000, demoTaskRun);
33 LibTraceRtosNet trace(1, 1000, 53000);
34 Telnet telnet(1, 1000);
35 Comm comm(1, 1000);
36 
37 NetTcpSocket logSocket;
38 
39 int main() {
40  Hw::init();
41 
42  Net::init(1, 1024, &netMac, &netMem);
43 
44  logSocket.setWindowSize(0);
45  logSocket.autoListenAndAccept(53001);
46  LibLog::setStream(&logSocket);
47  LibLog::setLevel(LibLog::LEVEL_VERBOSE);
48 
49  Fs::init(fsPartitions, sizeof(fsPartitions) / sizeof(fsPartitions[0]));
50 
51  Rtos::start();
52  return 0;
53 }
54 
55 void demoTaskRun(RtosTask* task) {
56  unsigned int counter = 1;
57  while (true) {
59  USER_DEBUG(LibLog::LEVEL_VERBOSE, "Demo task cycle #%u", counter++);
60  }
61 }
62