Commit 45999dcd authored by Upi Tamminen's avatar Upi Tamminen

Add project files

parent 60dcc6cc
Copyright (c) 2013 Upi Tamminen
All rights reserved.
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. The names of the author(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
/******************************************************************************
* author: Freddie Chopin, http://www.freddiechopin.info/
* file: LPC1758_59_67_68_69_rom.ld
* last change: 2012-04-07
*
* chip: LPC1758 / LPC1759 / LPC1767 / LPC1768 / LPC1769
* compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2
* 20110921 (release) [ARM/embedded-4_6-branch revision 182083]
*
* description:
* Linker script for LPC1758, LPC1759, LPC1767, LPC1768 and LPC1769 chips (512kB
* Flash, 32kB SRAM, 16kB AHB SRAM0 and 16kB AHB SRAM1). Only main block of SRAM
* (32kB) is used.
******************************************************************************/
SEARCH_DIR(.);
/*
+=============================================================================+
| format configurations
+=============================================================================+
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm");
OUTPUT_ARCH(arm);
/*
+=============================================================================+
| stacks sizes
+=============================================================================+
*/
/* Handler mode (core exceptions / interrupts) can use only main stack */
/* Thread mode can use main stack (default) or process stack - selected in CONTROL special register */
__main_stack_size = 1024;
__process_stack_size = 1024;
PROVIDE(__main_stack_size = __main_stack_size);
PROVIDE(__process_stack_size = __process_stack_size);
/*
+=============================================================================+
| available memories definitions
+=============================================================================+
*/
MEMORY
{
rom (rx) : org = 0x00000000, len = 512k
ram (rwx) : org = 0x10000000, len = 32k
ahb_sram0 (rwx) : org = 0x2007C000, len = 16k
ahb_sram1 (rwx) : org = 0x20080000, len = 16k
}
__rom_start = ORIGIN(rom);
__rom_size = LENGTH(rom);
__rom_end = __rom_start + __rom_size;
__ram_start = ORIGIN(ram);
__ram_size = LENGTH(ram);
__ram_end = __ram_start + __ram_size;
__ahb_sram0_start = ORIGIN(ahb_sram0);
__ahb_sram0_size = LENGTH(ahb_sram0);
__ahb_sram0_end = __ahb_sram0_start + __ahb_sram0_size;
__ahb_sram1_start = ORIGIN(ahb_sram1);
__ahb_sram1_size = LENGTH(ahb_sram1);
__ahb_sram1_end = __ahb_sram1_start + __ahb_sram1_size;
PROVIDE(__rom_start = __rom_start);
PROVIDE(__rom_size = __rom_size);
PROVIDE(__rom_end = __rom_end);
PROVIDE(__ram_start = __ram_start);
PROVIDE(__ram_size = __ram_size);
PROVIDE(__ram_end = __ram_end);
PROVIDE(__ahb_sram0_start = __ahb_sram0_start);
PROVIDE(__ahb_sram0_size = __ahb_sram0_size);
PROVIDE(__ahb_sram0_end = __ahb_sram0_end);
PROVIDE(__ahb_sram1_start = __ahb_sram1_start);
PROVIDE(__ahb_sram1_size = __ahb_sram1_size);
PROVIDE(__ahb_sram1_end = __ahb_sram1_end);
/*
+=============================================================================+
| entry point
+=============================================================================+
*/
ENTRY(Reset_Handler);
/*
+=============================================================================+
| put data in sections
+=============================================================================+
*/
SECTIONS
{
.text :
{
. = ALIGN(4);
__text_start = .;
PROVIDE(__text_start = __text_start);
. = ALIGN(4);
KEEP(*(.vectors));
. = ALIGN(4);
*(.text .text.* .gnu.linkonce.t.*);
. = ALIGN(4);
*(.glue_7t .glue_7);
. = ALIGN(4);
*(.rodata .rodata.* .gnu.linkonce.r.*);
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*); /* exception unwinding information */
. = ALIGN(4);
*(.gcc_except_table); /* information used for stack unwinding during exception */
. = ALIGN(4);
*(.eh_frame_hdr); /* additional information about .ex_frame section */
. = ALIGN(4);
*(.eh_frame); /* information used for stack unwinding during exception */
. = ALIGN(4);
KEEP(*(.init));
. = ALIGN(4);
__preinit_array_start = .;
KEEP(*(.preinit_array));
. = ALIGN(4);
__preinit_array_end = .;
__init_array_start = .;
KEEP(*(SORT(.init_array.*)));
. = ALIGN(4);
KEEP(*(.init_array));
. = ALIGN(4);
__init_array_end = .;
KEEP(*(.fini));
. = ALIGN(4);
__fini_array_start = .;
KEEP(*(.fini_array));
. = ALIGN(4);
KEEP(*(SORT(.fini_array.*)));
. = ALIGN(4);
__fini_array_end = .;
. = ALIGN(4);
__text_end = .;
PROVIDE(__text_end = __text_end);
} > rom AT > rom
. = ALIGN(4);
__exidx_start = .;
PROVIDE(__exidx_start = __exidx_start);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*);
} > rom AT > rom /* index entries for section unwinding */
. = ALIGN(4);
__exidx_end = .;
PROVIDE(__exidx_end = __exidx_end);
.data :
{
. = ALIGN(4);
__data_init_start = LOADADDR (.data);
PROVIDE(__data_init_start = __data_init_start);
__data_start = .;
PROVIDE(__data_start = __data_start);
. = ALIGN(4);
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
__data_end = .;
PROVIDE(__data_end = __data_end);
} > ram AT > rom
.bss :
{
. = ALIGN(4);
__bss_start = .;
PROVIDE(__bss_start = __bss_start);
. = ALIGN(4);
*(.bss .bss.* .gnu.linkonce.b.*)
. = ALIGN(4);
*(COMMON);
. = ALIGN(4);
__bss_end = .;
PROVIDE(__bss_end = __bss_end);
} > ram AT > ram
.stack :
{
. = ALIGN(8);
__stack_start = .;
PROVIDE(__stack_start = __stack_start);
. = ALIGN(8);
__main_stack_start = .;
PROVIDE(__main_stack_start = __main_stack_start);
. += __main_stack_size;
. = ALIGN(8);
__main_stack_end = .;
PROVIDE(__main_stack_end = __main_stack_end);
. = ALIGN(8);
__process_stack_start = .;
PROVIDE(__process_stack_start = __process_stack_start);
. += __process_stack_size;
. = ALIGN(8);
__process_stack_end = .;
PROVIDE(__process_stack_end = __process_stack_end);
. = ALIGN(8);
__stack_end = .;
PROVIDE(__stack_end = __stack_end);
} > ram AT > ram
. = ALIGN(4);
__heap_start = .;
PROVIDE(__heap_start = __heap_start);
. = ALIGN(4);
__heap_end = __ram_end;
PROVIDE(__heap_end = __heap_end);
.stab 0 (NOLOAD) : { *(.stab) }
.stabstr 0 (NOLOAD) : { *(.stabstr) }
/* DWARF debug sections.
* Symbols in the DWARF debugging sections are relative to the beginning
* of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.note.gnu.arm.ident 0 : { KEEP(*(.note.gnu.arm.ident)) }
.ARM.attributes 0 : { KEEP(*(.ARM.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) }
}
PROVIDE(__text_size = __text_end - __text_start);
PROVIDE(__exidx_size = __exidx_end - __exidx_start);
PROVIDE(__data_size = __data_end - __data_start);
PROVIDE(__bss_size = __bss_end - __bss_start);
PROVIDE(__stack_size = __stack_end - __stack_start);
PROVIDE(__heap_size = __heap_end - __heap_start);
/******************************************************************************
* END OF FILE
******************************************************************************/
This diff is collapsed.
/** \file hdr_bitband.h
* \brief Header for bit-banding
* \author Freddie Chopin, http://www.freddiechopin.info/
* \date 2012-04-06
*/
/******************************************************************************
* chip: ARMv7-M(E) (Cortex-M3 / Cortex-M4)
* compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2
* 20110921 (release) [ARM/embedded-4_6-branch revision 182083]
******************************************************************************/
#ifndef HDR_BITBAND_H_
#define HDR_BITBAND_H_
/*
+=============================================================================+
| global definitions
+=============================================================================+
*/
#define BITBAND_SRAM_REF 0x20000000
#define BITBAND_SRAM_BASE 0x22000000
#define BITBAND_PERIPH_REF 0x40000000
#define BITBAND_PERIPH_BASE 0x42000000
/*
+=============================================================================+
| strange variables
+=============================================================================+
*/
#define bitband_t *(volatile unsigned long*)
/*
+=============================================================================+
| macros
+=============================================================================+
*/
#define BITBAND_SRAM(address, bit) (BITBAND_SRAM_BASE + (((unsigned long)address) - BITBAND_SRAM_REF) * 32 + (bit) * 4)
#define BITBAND_PERIPH(address, bit) (BITBAND_PERIPH_BASE + (((unsigned long)address) - BITBAND_PERIPH_REF) * 32 + (bit) * 4)
#define BITBAND(address, bit) ( \
(((unsigned long)address) >= 0x20000000) && (((unsigned long)address) <= 0x200FFFFF) ? BITBAND_SRAM(address, bit) : \
(((unsigned long)address) >= 0x40000000) && (((unsigned long)address) <= 0x400FFFFF) ? BITBAND_PERIPH(address, bit) : \
0 /* fail */ \
)
/******************************************************************************
* END OF FILE
******************************************************************************/
#endif /* HDR_BITBAND_H_ */
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/** \file hdr_special_registers.h
* \brief Header with definition of bits in special registers in ARMv7-M(E) core
* \author Freddie Chopin, http://www.freddiechopin.info/
* \date 2012-03-18
*/
/******************************************************************************
* chip: ARMv7-M(E) (Cortex-M3 / Cortex-M4)
* compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2
* 20110921 (release) [ARM/embedded-4_6-branch revision 182083]
******************************************************************************/
#ifndef HDR_SPECIAL_REGISTERS_H_
#define HDR_SPECIAL_REGISTERS_H_
/*
+-----------------------------------------------------------------------------+
| PRIMASK - Register to mask out configurable exceptions
+-----------------------------------------------------------------------------+
*/
#define PRIMASK_MASK_EXCEPTIONS_bit 0
#define PRIMASK_MASK_EXCEPTIONS (1 << PRIMASK_MASK_EXCEPTIONS_bit)
/*
+-----------------------------------------------------------------------------+
| FAULTMASK - Register to raise priority to the HardFault level
+-----------------------------------------------------------------------------+
*/
#define FAULTMASK_MASK_EXCEPTIONS_bit 0
#define FAULTMASK_MASK_EXCEPTIONS (1 << FAULTMASK_MASK_EXCEPTIONS_bit)
/*
+-----------------------------------------------------------------------------+
| CONTROL - The special-purpose control register
+-----------------------------------------------------------------------------+
*/
#define CONTROL_THREAD_UNPRIVILEGED_bit 0
#define CONTROL_ALTERNATE_STACK_bit 1
#define CONTROL_THREAD_UNPRIVILEGED (1 << CONTROL_THREAD_UNPRIVILEGED_bit)
#define CONTROL_ALTERNATE_STACK (1 << CONTROL_ALTERNATE_STACK_bit)
/******************************************************************************
* END OF FILE
******************************************************************************/
#endif /* HDR_SPECIAL_REGISTERS_H_ */
This diff is collapsed.
#ifndef __ARCH_CC_H__
#define __ARCH_CC_H__
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#define BYTE_ORDER LITTLE_ENDIAN
typedef uint8_t u8_t;
typedef int8_t s8_t;
typedef uint16_t u16_t;
typedef int16_t s16_t;
typedef uint32_t u32_t;
typedef int32_t s32_t;
typedef uintptr_t mem_ptr_t;
#define LWIP_ERR_T int
/* Define (sn)printf formatters for these lwIP types */
#define U16_F "u"
#define S16_F "i"
#define X16_F "x"
#define U32_F "n"
#define S32_F "l"
#define X32_F "x"
/* Compiler hints for packing structures */
#define PACK_STRUCT_FIELD(x) x
#define PACK_STRUCT_STRUCT __attribute__((packed))
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END
/* Plaform specific diagnostic output */
#define LWIP_PLATFORM_DIAG(x) {tprintf x;}
#define LWIP_PLATFORM_ASSERT(x) do {tprintf("Assertion \"%s\" failed at line %d in %s\n", \
x, __LINE__, __FILE__); while (1);} while(0)
#endif /* __ARCH_CC_H__ */
/*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#ifndef __LWIP_ARCH_PERF_H__
#define __LWIP_ARCH_PERF_H__
#define PERF_START
#define PERF_STOP(x)
#endif /* __LWIP_ARCH_PERF_H__ */
/** \file config.h
* \brief Basic configuration of the project
* \author Freddie Chopin, http://www.freddiechopin.info/
* \date 2012-04-06
*/
/******************************************************************************
* project: lpc1769_blink_led
* chip: LPC1769
* compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2
* 20110921 (release) [ARM/embedded-4_6-branch revision 182083]
******************************************************************************/
#ifndef CONFIG_H_
#define CONFIG_H_
#include "hdr/hdr_bitband.h"
/*
+=============================================================================+
| global definitions
+=============================================================================+
*/
#define CRYSTAL 12000000ul ///< quartz crystal resonator which is connected to the chip
#define FREQUENCY 100000000ul ///< desired target frequency of the core
#define LED_GPIO LPC_GPIO0 ///< GPIO port to which the LED is connected
#define LED_pin 22 ///< pin number of the LED
#define LED (1 << LED_pin)
#define LED_FIOPIN LED_GPIO->FIOPIN ///< output register for the LED
#define LED_bb bitband_t BITBAND(&LED_FIOPIN, LED_pin) ///< bit-band "variable" to directly handle the pin
/*
+=============================================================================+
| strange variables
+=============================================================================+
*/
/*
+=============================================================================+
| global variables
+=============================================================================+
*/
/*
+=============================================================================+
| global functions' declarations
+=============================================================================+
*/
/******************************************************************************
* END OF FILE
******************************************************************************/
#endif /* CONFIG_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __CPLD_H
#define __CPLD_H
void cpld_capture(void);
void cpld_xfr(void);
#endif
/* vim: set sw=4 et: */
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __CPU_H
#define __CPU_H
#include <stdint.h>
void flash_latency(uint32_t frequency);
void pll0_feed(void);
uint32_t pll0_start(uint32_t crystal, uint32_t frequency);
void system_init(void);
#endif
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __DMA_H
#define __DMA_H
void dma_init(uint8_t *buf, uint16_t len);
void dma_start(uint8_t *buf, uint16_t len);
void dma_transfer(uint8_t *buf);
void dma_test(uint8_t *buf);
void dma_showdebug(void);
#endif
/* vim: set sw=4 et: */
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __ENC28J60_H
#define __ENC28J60_H
#include <stdint.h>
void enc_init(const uint8_t *mac);
uint8_t enc_test(void);
uint8_t enc_action(void);
void enc_send_packet(const uint8_t *buf, uint16_t count);
void enc_send_packet_begin(uint16_t count);
void enc_send_packet_end(uint16_t count);
uint16_t enc_receive_packet_begin(void);
void enc_receive_packet(uint8_t *buf, uint16_t len);
void enc_receive_packet_end(void);
void enc_get_mac_addr(uint8_t *mac_addr);
uint8_t enc_revid(void);
#endif
/* vim: set sw=4 et: */
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __ENC28J60IF_H
#define __ENC28J60IF_H
#include <stdint.h>
void ethernet_init(void);
void ethernet_action(void);
#endif
/* vim: set sw=4 et: */
This diff is collapsed.
/** \file gpio.h
* \brief Header for gpio.c
* \details Header for gpio.c
* \author Freddie Chopin, http://www.freddiechopin.info/
* \date 2012-04-07
*/
/******************************************************************************
* chip: LPC175x / LPC176x
* compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2
* 20110921 (release) [ARM/embedded-4_6-branch revision 182083]
******************************************************************************/
#ifndef GPIO_H_
#define GPIO_H_
#include "inc/LPC17xx.h"
#include "hdr/hdr_pincon.h"
#include "hdr/hdr_gpio.h"
/*
+=============================================================================+
| global definitions
+=============================================================================+
*/
#define GPIO_COMBINE(sel, mode, mode_od, dir) ((sel) | ((mode) << 8) | ((mode_od) << 16) | ((dir) << 24))
// all possible configurations of GPIO
// input configurations
#define GPIO_IN_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_PULL_UP_value, 0, LPC_GPIO_FIODIR_IN_value)
#define GPIO_IN_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_REPEATER_value, 0, LPC_GPIO_FIODIR_IN_value)
#define GPIO_IN_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_FLOATING_value, 0, LPC_GPIO_FIODIR_IN_value)
#define GPIO_IN_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, 0, LPC_GPIO_FIODIR_IN_value)
// output configurations
#define GPIO_OUT_PP GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, 0, LPC_PINCON_PINMODE_ODx_PP_value, LPC_GPIO_FIODIR_OUT_value)
#define GPIO_OUT_OD GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_OD_value, LPC_GPIO_FIODIR_OUT_value)
#define GPIO_OUT_OD_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_OD_value, LPC_GPIO_FIODIR_OUT_value)
#define GPIO_OUT_OD_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_OD_value, LPC_GPIO_FIODIR_OUT_value)
#define GPIO_OUT_OD_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_DEFAULT_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_OD_value, LPC_GPIO_FIODIR_OUT_value)
// alternate function configurations
#define GPIO_ALT1_PP_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT1_PP_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT1_PP_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT1_PP_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT1_OD_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT1_OD_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT1_OD_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT1_OD_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT1_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT2_PP_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT2_PP_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT2_PP_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT2_PP_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT2_OD_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT2_OD_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT2_OD_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT2_OD_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT2_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT3_PP_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT3_PP_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT3_PP_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT3_PP_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_PP_value, 0)
#define GPIO_ALT3_OD_PULL_UP GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_PULL_UP_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT3_OD_REPEATER GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_REPEATER_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT3_OD_FLOATING GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_FLOATING_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
#define GPIO_ALT3_OD_PULL_DOWN GPIO_COMBINE(LPC_PINCON_PINSELx_ALT3_value, LPC_PINCON_PINMODEx_PULL_DOWN_value, LPC_PINCON_PINMODE_ODx_OD_value, 0)
/*
+=============================================================================+
| strange variables
+=============================================================================+
*/
/*
+=============================================================================+
| global variables
+=============================================================================+
*/
/*
+=============================================================================+
| global functions' declarations
+=============================================================================+
*/
void gpio_pin_cfg(LPC_GPIO_TypeDef *gpio_ptr, uint32_t pin, uint32_t configuration);
/******************************************************************************
* END OF FILE
******************************************************************************/
#endif /* GPIO_H_ */
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __HTTPD_H__
#define __HTTPD_H__
void httpd_init(void);
#endif
This diff is collapsed.
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __LED_H
#define __LED_H
inline void led_init(void);
inline void led_on(void);
inline void led_off(void);
inline void led_toggle(void);
#endif
/* vim: set sw=4 et: */
This diff is collapsed.
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __SPI_H
#define __SPI_H
void spi_init(void);
uint16_t spi_write(uint16_t data);
uint16_t spi_read(uint16_t data);
#endif
/* vim: set sw=4 et: */
This diff is collapsed.
#ifndef __TPRINTF_H
#define __TPRINTF_H
void tprintf(char *format, ...);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#ifndef __UTILS_H
#define __UTILS_H
__INLINE void delay_ms(uint32_t dlyTicks);
uint16_t hex2int(char *a, uint16_t len);
void split_args(char *buf, char *p1, char *p2);
#endif
/* vim: set sw=4 et: */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment