Restored LPC2148 demo.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12464 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
parent
f3249c78d9
commit
358fdba16d
|
@ -111,6 +111,8 @@ PROJECT = ch
|
||||||
|
|
||||||
# Imported source files and paths
|
# Imported source files and paths
|
||||||
CHIBIOS = ../../..
|
CHIBIOS = ../../..
|
||||||
|
# Licensing files.
|
||||||
|
include $(CHIBIOS)/os/license/license.mk
|
||||||
# Startup files.
|
# Startup files.
|
||||||
include $(CHIBIOS)/os/common/startup/ARM/compilers/GCC/mk/startup_lpc214x.mk
|
include $(CHIBIOS)/os/common/startup/ARM/compilers/GCC/mk/startup_lpc214x.mk
|
||||||
# HAL-OSAL files (optional).
|
# HAL-OSAL files (optional).
|
||||||
|
@ -131,19 +133,13 @@ LDSCRIPT= $(STARTUPLD)/LPC2148.ld
|
||||||
|
|
||||||
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
||||||
# setting.
|
# setting.
|
||||||
CSRC = $(STARTUPSRC) \
|
CSRC = $(ALLCSRC) \
|
||||||
$(KERNSRC) \
|
|
||||||
$(PORTSRC) \
|
|
||||||
$(OSALSRC) \
|
|
||||||
$(HALSRC) \
|
|
||||||
$(PLATFORMSRC) \
|
|
||||||
$(BOARDSRC) \
|
|
||||||
$(TESTSRC) \
|
$(TESTSRC) \
|
||||||
main.c
|
main.c
|
||||||
|
|
||||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||||
# setting.
|
# setting.
|
||||||
CPPSRC =
|
CPPSRC = $(ALLCPPSRC)
|
||||||
|
|
||||||
# C sources to be compiled in ARM mode regardless of the global setting.
|
# C sources to be compiled in ARM mode regardless of the global setting.
|
||||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||||
|
@ -165,14 +161,14 @@ TCSRC =
|
||||||
# option that results in lower performance and larger code size.
|
# option that results in lower performance and larger code size.
|
||||||
TCPPSRC =
|
TCPPSRC =
|
||||||
|
|
||||||
# List ASM source files here
|
# List ASM source files here.
|
||||||
ASMSRC =
|
ASMSRC = $(ALLASMSRC)
|
||||||
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
|
|
||||||
|
|
||||||
INCDIR = $(CHIBIOS)/os/license \
|
# List ASM with preprocessor source files here.
|
||||||
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
|
ASMXSRC = $(ALLXASMSRC)
|
||||||
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
|
|
||||||
$(CHIBIOS)/os/various
|
# Inclusion directories.
|
||||||
|
INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Project, sources and paths
|
# Project, sources and paths
|
||||||
|
|
|
@ -24,6 +24,18 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Architecture-dependent core initialization.
|
||||||
|
* @details This hook is invoked immediately after the stack initialization
|
||||||
|
* and before the DATA and BSS segments initialization.
|
||||||
|
* @note This function is a weak symbol.
|
||||||
|
*/
|
||||||
|
#if !defined(__DOXYGEN__)
|
||||||
|
__attribute__((weak))
|
||||||
|
#endif
|
||||||
|
/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
|
||||||
|
void __core_init(void) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Early initialization.
|
* @brief Early initialization.
|
||||||
* @details This hook is invoked immediately after the stack initialization
|
* @details This hook is invoked immediately after the stack initialization
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
/* Driver constants. */
|
/* Driver constants. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Circular mode support flag.
|
||||||
|
*/
|
||||||
|
#define SPI_SUPPORTS_CIRCULAR FALSE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hardware FIFO depth.
|
* @brief Hardware FIFO depth.
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +66,7 @@
|
||||||
* @details The default action is to stop the system.
|
* @details The default action is to stop the system.
|
||||||
*/
|
*/
|
||||||
#if !defined(LPC214x_SPI_SSP_ERROR_HOOK) || defined(__DOXYGEN__)
|
#if !defined(LPC214x_SPI_SSP_ERROR_HOOK) || defined(__DOXYGEN__)
|
||||||
#define LPC214x_SPI_SSP_ERROR_HOOK() osalSysHalt()
|
#define LPC214x_SPI_SSP_ERROR_HOOK() osalSysHalt("overflow")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -76,122 +81,34 @@
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Type of a structure representing an SPI driver.
|
|
||||||
*/
|
|
||||||
typedef struct SPIDriver SPIDriver;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SPI notification callback type.
|
|
||||||
*
|
|
||||||
* @param[in] spip pointer to the @p SPIDriver object triggering the
|
|
||||||
* callback
|
|
||||||
*/
|
|
||||||
typedef void (*spicallback_t)(SPIDriver *spip);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Driver configuration structure.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/**
|
|
||||||
* @brief Operation complete callback or @p NULL.
|
|
||||||
*/
|
|
||||||
spicallback_t end_cb;
|
|
||||||
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LINE) || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief The chip select line.
|
|
||||||
*/
|
|
||||||
ioline_t ssline;
|
|
||||||
#endif
|
|
||||||
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PORT) || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief The chip select port.
|
|
||||||
*/
|
|
||||||
ioportid_t ssport;
|
|
||||||
/**
|
|
||||||
* @brief The chip select port mask.
|
|
||||||
*/
|
|
||||||
ioportmask_t ssmask;
|
|
||||||
#endif
|
|
||||||
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PAD) || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief The chip select port.
|
|
||||||
*/
|
|
||||||
ioportid_t ssport;
|
|
||||||
/**
|
|
||||||
* @brief The chip select pad number.
|
|
||||||
*/
|
|
||||||
uint_fast8_t sspad;
|
|
||||||
#endif
|
|
||||||
/* End of the mandatory fields.*/
|
|
||||||
/**
|
|
||||||
* @brief SSP CR0 initialization data.
|
|
||||||
*/
|
|
||||||
uint16_t cr0;
|
|
||||||
/**
|
|
||||||
* @brief SSP CPSR initialization data.
|
|
||||||
*/
|
|
||||||
uint32_t cpsr;
|
|
||||||
} SPIConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Structure representing a SPI driver.
|
|
||||||
*/
|
|
||||||
struct SPIDriver {
|
|
||||||
/**
|
|
||||||
* @brief Driver state.
|
|
||||||
*/
|
|
||||||
spistate_t state;
|
|
||||||
/**
|
|
||||||
* @brief Current configuration data.
|
|
||||||
*/
|
|
||||||
const SPIConfig *config;
|
|
||||||
#if SPI_USE_WAIT || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief Waiting thread.
|
|
||||||
*/
|
|
||||||
Thread *thread;
|
|
||||||
#endif /* SPI_USE_WAIT */
|
|
||||||
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
|
|
||||||
#if CH_USE_MUTEXES || defined(__DOXYGEN__)
|
|
||||||
/**
|
|
||||||
* @brief Mutex protecting the bus.
|
|
||||||
*/
|
|
||||||
Mutex mutex;
|
|
||||||
#elif CH_USE_SEMAPHORES
|
|
||||||
Semaphore semaphore;
|
|
||||||
#endif
|
|
||||||
#endif /* SPI_USE_MUTUAL_EXCLUSION */
|
|
||||||
#if defined(SPI_DRIVER_EXT_FIELDS)
|
|
||||||
SPI_DRIVER_EXT_FIELDS
|
|
||||||
#endif
|
|
||||||
/* End of the mandatory fields.*/
|
|
||||||
/**
|
|
||||||
* @brief Pointer to the SSP registers block.
|
|
||||||
*/
|
|
||||||
SSP *ssp;
|
|
||||||
/**
|
|
||||||
* @brief Number of bytes yet to be received.
|
|
||||||
*/
|
|
||||||
uint32_t rxcnt;
|
|
||||||
/**
|
|
||||||
* @brief Receive pointer or @p NULL.
|
|
||||||
*/
|
|
||||||
void *rxptr;
|
|
||||||
/**
|
|
||||||
* @brief Number of bytes yet to be transmitted.
|
|
||||||
*/
|
|
||||||
uint32_t txcnt;
|
|
||||||
/**
|
|
||||||
* @brief Transmit pointer or @p NULL.
|
|
||||||
*/
|
|
||||||
const void *txptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver macros. */
|
/* Driver macros. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low level fields of the SPI driver structure.
|
||||||
|
*/
|
||||||
|
#define spi_lld_driver_fields \
|
||||||
|
/* Pointer to the SSP registers block.*/ \
|
||||||
|
SSP *ssp; \
|
||||||
|
/* Number of bytes yet to be received.*/ \
|
||||||
|
uint32_t rxcnt; \
|
||||||
|
/* Receive pointer or @p NULL.*/ \
|
||||||
|
void *rxptr; \
|
||||||
|
/* Number of bytes yet to be transmitted.*/ \
|
||||||
|
uint32_t txcnt; \
|
||||||
|
/* Transmit pointer or @p NULL.*/ \
|
||||||
|
const void *txptr
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low level fields of the SPI configuration structure.
|
||||||
|
*/
|
||||||
|
#define spi_lld_config_fields \
|
||||||
|
/* SSP CR0 initialization data.*/ \
|
||||||
|
uint16_t cr0; \
|
||||||
|
/* SSP CPSR initialization data.*/ \
|
||||||
|
uint32_t cpsr
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
Loading…
Reference in New Issue