Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 ////////////////////////////////////////////////////////////////////////////// 00002 // Product: DPP application with lwIP 00003 // Last Updated for Version: 4.0.03 00004 // Date of the Last Update: Mar 16, 2009 00005 // 00006 // Q u a n t u m L e a P s 00007 // --------------------------- 00008 // innovating embedded systems 00009 // 00010 // Copyright (C) 2002-2009 Quantum Leaps, LLC. All rights reserved. 00011 // 00012 // This software may be distributed and modified under the terms of the GNU 00013 // General Public License version 2 (GPL) as published by the Free Software 00014 // Foundation and appearing in the file GPL.TXT included in the packaging of 00015 // this file. Please note that GPL Section 2[b] requires that all works based 00016 // on this software must also be made publicly available under the terms of 00017 // the GPL ("Copyleft"). 00018 // 00019 // Alternatively, this software may be distributed and modified under the 00020 // terms of Quantum Leaps commercial licenses, which expressly supersede 00021 // the GPL and are specifically designed for licensees interested in 00022 // retaining the proprietary status of their code. 00023 // 00024 // Contact information: 00025 // Quantum Leaps Web site: http://www.quantum-leaps.com 00026 // e-mail: info@quantum-leaps.com 00027 ////////////////////////////////////////////////////////////////////////////// 00028 #include "qp_port.h" 00029 #include "dpp.h" 00030 #include "bsp.h" 00031 00032 // Local-scope objects ------------------------------------------------------- 00033 static QEvent const *l_tableQueueSto[N_PHILO]; 00034 static QEvent const *l_philoQueueSto[N_PHILO][N_PHILO]; 00035 static QEvent const *l_lwIPMgrQueueSto[10]; 00036 static QSubscrList l_subscrSto[MAX_PUB_SIG]; 00037 00038 static union SmallEvents { 00039 void *min_size; 00040 TableEvt te; 00041 // other event types to go into this pool 00042 } l_smlPoolSto[2*N_PHILO]; // storage for the small event pool 00043 00044 static union MediumEvent { 00045 void *min_size; 00046 QEvent qe; 00047 TextEvt te; 00048 // other event types to go into this pool 00049 } l_medPoolSto[4]; // storage for the medium event pool 00050 00051 //............................................................................ 00052 int main(void) { 00053 00054 BSP_init(); // initialize the BSP 00055 00056 QF::init(); // initialize the framework and the underlying RT kernel 00057 00058 // object dictionaries... 00059 QS_OBJ_DICTIONARY(l_smlPoolSto); 00060 QS_OBJ_DICTIONARY(l_medPoolSto); 00061 QS_OBJ_DICTIONARY(l_lwIPMgrQueueSto); 00062 QS_OBJ_DICTIONARY(l_philoQueueSto[0]); 00063 QS_OBJ_DICTIONARY(l_philoQueueSto[1]); 00064 QS_OBJ_DICTIONARY(l_philoQueueSto[2]); 00065 QS_OBJ_DICTIONARY(l_philoQueueSto[3]); 00066 QS_OBJ_DICTIONARY(l_philoQueueSto[4]); 00067 QS_OBJ_DICTIONARY(l_tableQueueSto); 00068 00069 QF::psInit(l_subscrSto, Q_DIM(l_subscrSto)); // init publish-subscribe 00070 00071 // initialize event pools... 00072 QF::poolInit(l_smlPoolSto, sizeof(l_smlPoolSto), sizeof(l_smlPoolSto[0])); 00073 QF::poolInit(l_medPoolSto, sizeof(l_medPoolSto), sizeof(l_medPoolSto[0])); 00074 00075 // start the active objects... 00076 AO_LwIPMgr->start((uint8_t)1, 00077 l_lwIPMgrQueueSto, Q_DIM(l_lwIPMgrQueueSto), 00078 (void *)0, 0, (QEvent *)0); 00079 uint8_t n; 00080 for (n = 0; n < N_PHILO; ++n) { 00081 AO_Philo[n]->start((uint8_t)(n + 2), 00082 l_philoQueueSto[n], Q_DIM(l_philoQueueSto[n]), 00083 (void *)0, 0, (QEvent *)0); 00084 } 00085 AO_Table->start((uint8_t)(N_PHILO + 2), 00086 l_tableQueueSto, Q_DIM(l_tableQueueSto), 00087 (void *)0, 0, (QEvent *)0); 00088 00089 QF::run(); // run the QF application 00090 00091 return 0; 00092 } 00093
Generated on Tue Jul 19 2022 02:04:04 by
1.7.2