-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pablo Ridolfi
committed
Oct 25, 2014
1 parent
b853fe2
commit 4db125d
Showing
303 changed files
with
83,640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,6 @@ | |
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
#Eclipse files | ||
.metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
html/ | ||
*~ | ||
*.db | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
html/ | ||
*~ | ||
*.db | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/Debug/ | ||
/app_blinky_lpc1769 Debug.launch | ||
/app_blinky_lpc1769 Release.launch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>app_blinky_lpc1769</name> | ||
<comment></comment> | ||
<projects> | ||
<project>lpc_board_nxp_lpcxpresso_1769</project> | ||
<project>lpc_chip_175x_6x</project> | ||
<project>uposix</project> | ||
<project>devices</project> | ||
<project>uposix_devices_lpcxpresso_1769</project> | ||
<project>uposix_lpcxpresso_1769</project> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | ||
<triggers>clean,full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | ||
<triggers>full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.cdt.core.cnature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | ||
</natures> | ||
</projectDescription> |
17 changes: 17 additions & 0 deletions
17
examples/app_blinky_lpc1769/.settings/language.settings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project> | ||
<configuration id="com.crt.advproject.config.exe.debug.967082390" name="Debug"> | ||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="com.crt.advproject.GCCBuildCommandParser" keep-relative-paths="false" name="MCU GCC Build Output Parser" parameter="(arm-none-eabi-gcc)|(arm-none-eabi-[gc]\+\+)|(gcc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/> | ||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||
</extension> | ||
</configuration> | ||
<configuration id="com.crt.advproject.config.exe.release.1087529952" name="Release"> | ||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||
<provider copy-of="extension" id="com.crt.advproject.GCCBuildCommandParser"/> | ||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||
</extension> | ||
</configuration> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
/* Copyright 2014, Pablo Ridolfi | ||
* | ||
* This file is part of uPOSIX. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
*/ | ||
|
||
/** @brief uposix_app_blinky.c source file | ||
** | ||
** This file demonstrates how to use uPOSIX library for LPCXpresso/LPC1769. | ||
** | ||
**/ | ||
|
||
/** \addtogroup uPOSIX uPOSIX | ||
** @{ */ | ||
/** \addtogroup Examples Examples | ||
** @{ */ | ||
/** \addtogroup app1769 Simple blinky application for LPCXpresso/LPC1769 port. | ||
** @{ */ | ||
|
||
/* | ||
* Initials Name | ||
* --------------------------- | ||
* PR Pablo Ridolfi | ||
*/ | ||
|
||
/* | ||
* modification history (new versions first) | ||
* ----------------------------------------------------------- | ||
* 20140925 v0.0.1 PR first version | ||
*/ | ||
|
||
/*==================[inclusions]=============================================*/ | ||
|
||
#include "uposix.h" | ||
#include <stdio.h> | ||
|
||
/*==================[macros and definitions]=================================*/ | ||
|
||
/** @brief define this with 1 to see an example using pipes, use 0 to see | ||
* an example using mutexes | ||
*/ | ||
#define USE_PIPES 0 | ||
|
||
#define USE_MUTEX (!USE_PIPES) | ||
|
||
|
||
/*==================[internal data declaration]==============================*/ | ||
|
||
/*==================[internal functions declaration]=========================*/ | ||
|
||
/** @brief user callback for systick */ | ||
static void mySysTickCallback(void); | ||
|
||
/*==================[internal data definition]===============================*/ | ||
|
||
/** @brief File Descriptor for GPIO access. | ||
*/ | ||
static int fd_gpio; | ||
|
||
/** @brief File Descriptor for SysTick access. | ||
*/ | ||
static int fd_systick; | ||
|
||
/** @brief #devGPIO_pin_t structure for LED control (port 0, bit 22). | ||
*/ | ||
static devGPIO_pin_t ledStick; | ||
|
||
#if(USE_MUTEX) | ||
/** @brief mutex declaration */ | ||
pthread_mutex_t mutex; | ||
#elif(USE_PIPES) | ||
/** @brief pipe file descriptors */ | ||
int pfds[2]; | ||
#endif | ||
|
||
/*==================[external data definition]===============================*/ | ||
|
||
/*==================[internal functions definition]==========================*/ | ||
|
||
/** @brief User SysTick Callback function (hooked to IRQ handler). | ||
*/ | ||
static void mySysTickCallback(void) | ||
{ | ||
static int cont; | ||
|
||
/* execute this every 500ms */ | ||
cont++; | ||
if(cont >= 500) | ||
{ | ||
#if(USE_PIPES) | ||
/* write data to pipe */ | ||
cont = write(pfds[1], "blink!", 7); | ||
#elif(USE_MUTEX) | ||
/* release mutex */ | ||
pthread_mutex_unlock(&mutex); | ||
#endif | ||
cont = 0; | ||
} | ||
} | ||
|
||
/** @brief Thread example. | ||
* @param arg Argument (passed from #pthread_create). | ||
* @return value to be returned, then collected by #pthread_join. | ||
*/ | ||
void * thread_main(void * arg) | ||
{ | ||
int a = (int)arg; | ||
int cont = 0; | ||
|
||
#if(USE_PIPES) | ||
char buf[10]; | ||
int rv; | ||
#endif | ||
|
||
while(a) | ||
{ | ||
#if(USE_PIPES) | ||
/* wait for data from pipe */ | ||
rv = read(pfds[0], buf, 7); | ||
buf[rv] = 0; | ||
printf("Received: %s.\n", buf); | ||
#elif(USE_MUTEX) | ||
/* wait for mutex unlock */ | ||
pthread_mutex_lock(&mutex); | ||
#endif | ||
/* toggle led */ | ||
ioctl(fd_gpio, devGPIO_REQ_TOGGLE_BIT, &ledStick); | ||
|
||
cont++; | ||
if(cont==10) | ||
{ | ||
pthread_exit(0); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
/*==================[external functions definition]==========================*/ | ||
|
||
/** @brief main function: Application entry point. | ||
*/ | ||
int main(void) | ||
{ | ||
printf("uPOSIX blinky application.\n"); | ||
|
||
/* init LPCOpen */ | ||
open("/dev/lpcopen", 0); | ||
|
||
/* init GPIO, get descriptor */ | ||
fd_gpio = open("/dev/gpio", 0); | ||
|
||
/* Set pin structure with desired output */ | ||
ledStick = devGPIO_LPCXpresso1769_LED; | ||
|
||
/* set output for P0.22 */ | ||
ledStick.value = 1; | ||
ioctl(fd_gpio, devGPIO_REQ_WRITE_DIR, &ledStick); | ||
|
||
/* P0.22 off */ | ||
ledStick.value = 0; | ||
ioctl(fd_gpio, devGPIO_REQ_WRITE_BIT, &ledStick); | ||
|
||
#if(USE_PIPES) | ||
/* create pipe */ | ||
pipe(pfds); | ||
#elif(USE_MUTEX) | ||
/* create and lock mutex */ | ||
pthread_mutex_init(&mutex, 0); | ||
pthread_mutex_lock(&mutex); | ||
#endif | ||
|
||
/* init SysTick */ | ||
fd_systick = open("/dev/systick", 0); | ||
|
||
/* set user callback for systick */ | ||
ioctl(fd_systick, devSysTick_REQ_SET_CALLBACK, (void *)mySysTickCallback); | ||
|
||
/* create thread */ | ||
pthread_t hilo; | ||
pthread_create(&hilo, 0, thread_main, (void*)0x1234ABCD); | ||
|
||
/* exit main thread */ | ||
return 0xABCDEF98; | ||
} | ||
|
||
/** @} doxygen end group definition */ | ||
/** @} doxygen end group definition */ | ||
/** @} doxygen end group definition */ | ||
/*==================[end of file]============================================*/ |
Oops, something went wrong.