Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2359 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
3340acc7ae
commit
9998f85110
@ -45,6 +45,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -60,14 +63,14 @@
|
||||
#define PIC_REG_STRING "r10"
|
||||
|
||||
/* Macros to get and set the PIC base register. picbase is assumed to be
|
||||
* of type (void*) and that it will fit into a uint32. These must be
|
||||
* of type (void*) and that it will fit into a uint32_t. These must be
|
||||
* inline so that they will be compatible with the ABIs rules for
|
||||
* preserving the PIC register
|
||||
*/
|
||||
|
||||
#define up_getpicbase(ppicbase) \
|
||||
do { \
|
||||
uint32 picbase; \
|
||||
uint32_t picbase; \
|
||||
__asm__ \
|
||||
( \
|
||||
"\tmov %0, " PIC_REG_STRING "\n\t" \
|
||||
@ -78,7 +81,7 @@ do { \
|
||||
|
||||
#define up_setpicbase(picbase) \
|
||||
do { \
|
||||
uint32 _picbase = (uint32)picbase; \
|
||||
uint32_t _picbase = (uint32_t)picbase; \
|
||||
__asm__ \
|
||||
( \
|
||||
"\tmov " PIC_REG_STRING ", %0\n\t" \
|
||||
|
@ -45,7 +45,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -147,13 +149,13 @@ struct xcptcontext
|
||||
* signal processing.
|
||||
*/
|
||||
|
||||
uint32 saved_pc;
|
||||
uint32 saved_cpsr;
|
||||
uint32_t saved_pc;
|
||||
uint32_t saved_cpsr;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
uint32_t regs[XCPTCONTEXT_REGS];
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
@ -137,14 +140,14 @@ struct xcptcontext
|
||||
* signal processing.
|
||||
*/
|
||||
|
||||
uint32 saved_pc;
|
||||
uint32 saved_primask;
|
||||
uint32 saved_xpsr;
|
||||
uint32_t saved_pc;
|
||||
uint32_t saved_primask;
|
||||
uint32_t saved_xpsr;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
uint32_t regs[XCPTCONTEXT_REGS];
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -195,19 +198,19 @@ static inline void irqrestore(irqstate_t primask)
|
||||
|
||||
/* Get/set the primask register */
|
||||
|
||||
static inline ubyte getprimask(void)
|
||||
static inline uint8_t getprimask(void)
|
||||
{
|
||||
uint32 primask;
|
||||
uint32_t primask;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, primask\n"
|
||||
: "=r" (primask)
|
||||
:
|
||||
: "memory");
|
||||
return (ubyte)primask;
|
||||
return (uint8_t)primask;
|
||||
}
|
||||
|
||||
static inline void setprimask(uint32 primask)
|
||||
static inline void setprimask(uint32_t primask)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
@ -219,19 +222,19 @@ static inline void setprimask(uint32 primask)
|
||||
|
||||
/* Get/set the basepri register */
|
||||
|
||||
static inline ubyte getbasepri(void)
|
||||
static inline uint8_t getbasepri(void)
|
||||
{
|
||||
uint32 basepri;
|
||||
uint32_t basepri;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, basepri\n"
|
||||
: "=r" (basepri)
|
||||
:
|
||||
: "memory");
|
||||
return (ubyte)basepri;
|
||||
return (uint8_t)basepri;
|
||||
}
|
||||
|
||||
static inline void setbasepri(uint32 basepri)
|
||||
static inline void setbasepri(uint32_t basepri)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
@ -243,9 +246,9 @@ static inline void setbasepri(uint32 basepri)
|
||||
|
||||
/* Get IPSR */
|
||||
|
||||
static inline uint32 getipsr(void)
|
||||
static inline uint32_t getipsr(void)
|
||||
{
|
||||
uint32 ipsr;
|
||||
uint32_t ipsr;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, ipsr\n"
|
||||
@ -257,7 +260,7 @@ static inline uint32 getipsr(void)
|
||||
|
||||
/* SVC system call */
|
||||
|
||||
static inline void svcall(uint32 cmd, uint32 arg)
|
||||
static inline void svcall(uint32_t cmd, uint32_t arg)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
|
@ -45,7 +45,6 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -44,6 +44,10 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
@ -88,7 +92,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef void (*vic_vector_t)(uint32 *regs);
|
||||
typedef void (*vic_vector_t)(uint32_t *regs);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/serial.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
@ -45,7 +45,6 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -45,7 +45,6 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
|
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#undef CONFIG_ALIGNMENT_TRAP
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -52,7 +52,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -78,9 +78,9 @@
|
||||
|
||||
/* I don't know if the builtin to get SP is enabled */
|
||||
|
||||
static inline uint32 up_getsp(void)
|
||||
static inline uint32_t up_getsp(void)
|
||||
{
|
||||
uint32 sp;
|
||||
uint32_t sp;
|
||||
__asm__
|
||||
(
|
||||
"\tmov %0, sp\n\t"
|
||||
@ -94,13 +94,13 @@ static inline uint32 up_getsp(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_stackdump(uint32 sp, uint32 stack_base)
|
||||
static void up_stackdump(uint32_t sp, uint32_t stack_base)
|
||||
{
|
||||
uint32 stack ;
|
||||
uint32_t stack ;
|
||||
|
||||
for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
|
||||
{
|
||||
uint32 *ptr = (uint32*)stack;
|
||||
uint32_t *ptr = (uint32_t*)stack;
|
||||
lldbg("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
stack, ptr[0], ptr[1], ptr[2], ptr[3],
|
||||
ptr[4], ptr[5], ptr[6], ptr[7]);
|
||||
@ -127,7 +127,7 @@ static inline void up_registerdump(void)
|
||||
|
||||
for (regs = REG_R0; regs <= REG_R15; regs += 8)
|
||||
{
|
||||
uint32 *ptr = (uint32*)¤t_regs[regs];
|
||||
uint32_t *ptr = (uint32_t*)¤t_regs[regs];
|
||||
lldbg("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
regs, ptr[0], ptr[1], ptr[2], ptr[3],
|
||||
ptr[4], ptr[5], ptr[6], ptr[7]);
|
||||
@ -147,13 +147,13 @@ static inline void up_registerdump(void)
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_dumpstate(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 sp = up_getsp();
|
||||
uint32 ustackbase;
|
||||
uint32 ustacksize;
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32_t sp = up_getsp();
|
||||
uint32_t ustackbase;
|
||||
uint32_t ustacksize;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
uint32 istackbase;
|
||||
uint32 istacksize;
|
||||
uint32_t istackbase;
|
||||
uint32_t istacksize;
|
||||
#endif
|
||||
|
||||
/* Get the limits on the user stack memory */
|
||||
@ -165,14 +165,14 @@ static void up_dumpstate(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
ustackbase = (uint32)rtcb->adj_stack_ptr;
|
||||
ustacksize = (uint32)rtcb->adj_stack_size;
|
||||
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
|
||||
ustacksize = (uint32_t)rtcb->adj_stack_size;
|
||||
}
|
||||
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32)&g_userstack;
|
||||
istackbase = (uint32_t)&g_userstack;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
|
||||
/* Show interrupt stack info */
|
||||
@ -269,7 +269,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
|
||||
* Name: up_assert
|
||||
****************************************************************************/
|
||||
|
||||
void up_assert(const ubyte *filename, int lineno)
|
||||
void up_assert(const uint8_t *filename, int lineno)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
@ -291,7 +291,7 @@ void up_assert(const ubyte *filename, int lineno)
|
||||
* Name: up_assert_code
|
||||
****************************************************************************/
|
||||
|
||||
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
|
||||
void up_assert_code(const uint8_t *filename, int lineno, int errorcode)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
|
@ -38,8 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -96,7 +96,7 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
else
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
boolean switch_needed;
|
||||
bool switch_needed;
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list. If we
|
||||
* are blocking the task at the head of the task list (the
|
||||
|
@ -39,13 +39,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
/* A little faster than most memcpy's */
|
||||
|
||||
void up_copystate(uint32 *dest, uint32 *src)
|
||||
void up_copystate(uint32_t *dest, uint32_t *src)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -38,14 +38,17 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -73,7 +76,7 @@
|
||||
* Name: up_dataabort
|
||||
****************************************************************************/
|
||||
|
||||
void up_dataabort(uint32 *regs)
|
||||
void up_dataabort(uint32_t *regs)
|
||||
{
|
||||
lldbg("Data abort at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
|
@ -38,16 +38,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -66,7 +68,7 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void up_doirq(int irq, uint32 *regs)
|
||||
void up_doirq(int irq, uint32_t *regs)
|
||||
{
|
||||
up_ledon(LED_INIRQ);
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
|
@ -38,7 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -48,7 +49,7 @@
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -87,11 +88,11 @@ void up_initial_state(_TCB *tcb)
|
||||
|
||||
/* Save the initial stack pointer */
|
||||
|
||||
xcp->regs[REG_SP] = (uint32)tcb->adj_stack_ptr;
|
||||
xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr;
|
||||
|
||||
/* Save the task entry point */
|
||||
|
||||
xcp->regs[REG_PC] = (uint32)tcb->start;
|
||||
xcp->regs[REG_PC] = (uint32_t)tcb->start;
|
||||
|
||||
/* If this task is running PIC, then set the PIC base register to the
|
||||
* address of the allocated D-Space region.
|
||||
@ -104,7 +105,7 @@ void up_initial_state(_TCB *tcb)
|
||||
* alloacated D-Space region.
|
||||
*/
|
||||
|
||||
xcp->regs[REG_PIC] = (uint32)tcb->dspace->region;
|
||||
xcp->regs[REG_PIC] = (uint32_t)tcb->dspace->region;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -38,14 +38,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -73,7 +75,7 @@
|
||||
* Name: up_prefetchabort
|
||||
****************************************************************************/
|
||||
|
||||
void up_prefetchabort(uint32 *regs)
|
||||
void up_prefetchabort(uint32_t *regs)
|
||||
{
|
||||
lldbg("Prefetch abort at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
|
@ -38,15 +38,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -38,15 +38,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -81,7 +84,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
void up_reprioritize_rtr(_TCB *tcb, uint8_t priority)
|
||||
{
|
||||
/* Verify that the caller is sane */
|
||||
|
||||
@ -95,12 +98,12 @@ void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
else
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
boolean switch_needed;
|
||||
bool switch_needed;
|
||||
|
||||
slldbg("TCB=%p PRI=%d\n", tcb, priority);
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list.
|
||||
* sched_removereadytorun will return TRUE if we just
|
||||
* sched_removereadytorun will return true if we just
|
||||
* remove the head of the ready to run list.
|
||||
*/
|
||||
|
||||
@ -108,10 +111,10 @@ void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
|
||||
/* Setup up the new task priority */
|
||||
|
||||
tcb->sched_priority = (ubyte)priority;
|
||||
tcb->sched_priority = (uint8_t)priority;
|
||||
|
||||
/* Return the task to the specified blocked task list.
|
||||
* sched_addreadytorun will return TRUE if the task was
|
||||
* sched_addreadytorun will return true if the task was
|
||||
* added to the new list. We will need to perform a context
|
||||
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
||||
* (i.e., one and only one the calls changes the head of the
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -161,7 +161,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
||||
* disabled
|
||||
*/
|
||||
|
||||
current_regs[REG_PC] = (uint32)up_sigdeliver;
|
||||
current_regs[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
current_regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
|
||||
|
||||
/* And make sure that the saved context in the TCB
|
||||
@ -193,7 +193,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
||||
* disabled
|
||||
*/
|
||||
|
||||
tcb->xcp.regs[REG_PC] = (uint32)up_sigdeliver;
|
||||
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
tcb->xcp.regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -82,7 +82,7 @@
|
||||
void up_sigdeliver(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
uint32_t regs[XCPTCONTEXT_REGS];
|
||||
sig_deliver_t sigdeliver;
|
||||
|
||||
/* Save the errno. This must be preserved throughout the
|
||||
|
@ -38,14 +38,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -86,7 +88,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_syscall(uint32 *regs)
|
||||
void up_syscall(uint32_t *regs)
|
||||
{
|
||||
lldbg("Syscall from 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
|
@ -38,16 +38,17 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "clock_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -38,14 +38,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -73,7 +73,7 @@
|
||||
* Name: up_undefinedinsn
|
||||
****************************************************************************/
|
||||
|
||||
void up_undefinedinsn(uint32 *regs)
|
||||
void up_undefinedinsn(uint32_t *regs)
|
||||
{
|
||||
lldbg("Undefined instruction at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/c5471/c5471_ethernet.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based one a C5471 Linux driver and released under this BSD license with
|
||||
@ -45,8 +45,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#if defined(CONFIG_NET)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@ -67,7 +67,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
@ -293,9 +293,9 @@
|
||||
|
||||
struct c5471_driver_s
|
||||
{
|
||||
boolean c_bifup; /* TRUE:ifup FALSE:ifdown */
|
||||
WDOG_ID c_txpoll; /* TX poll timer */
|
||||
WDOG_ID c_txtimeout; /* TX timeout timer */
|
||||
bool c_bifup; /* true:ifup false:ifdown */
|
||||
WDOG_ID c_txpoll; /* TX poll timer */
|
||||
WDOG_ID c_txtimeout; /* TX timeout timer */
|
||||
|
||||
/* Note: According to the C547x documentation: "The software has to maintain
|
||||
* two pointers to the current RX-CPU and TX-CPU descriptors. At init time,
|
||||
@ -303,40 +303,40 @@ struct c5471_driver_s
|
||||
* to be incremented each time a descriptor ownership is give to the SWITCH".
|
||||
*/
|
||||
|
||||
volatile uint32 c_txcpudesc;
|
||||
volatile uint32 c_rxcpudesc;
|
||||
volatile uint32_t c_txcpudesc;
|
||||
volatile uint32_t c_rxcpudesc;
|
||||
|
||||
/* Last TX descriptor saved for error handling */
|
||||
|
||||
uint32 c_lastdescstart;
|
||||
uint32 c_lastdescend;
|
||||
uint32_t c_lastdescstart;
|
||||
uint32_t c_lastdescend;
|
||||
|
||||
/* Shadowed registers */
|
||||
|
||||
uint32 c_eimstatus;
|
||||
uint32_t c_eimstatus;
|
||||
|
||||
#ifdef CONFIG_C5471_NET_STATS
|
||||
/* TX statistics */
|
||||
|
||||
uint32 c_txpackets; /* Number of packets sent */
|
||||
uint32 c_txmiss; /* Miss */
|
||||
uint32 c_txvlan; /* VLAN */
|
||||
uint32 c_txlframe; /* Long frame errors */
|
||||
uint32 c_txsframe; /* Short frame errors */
|
||||
uint32 c_txcrc; /* CRC errors */
|
||||
uint32 c_txoverrun; /* Overrun errors */
|
||||
uint32 c_txalign; /* Non-octect align errors */
|
||||
uint32 c_txtimeouts; /* TX timeouts */
|
||||
uint32_t c_txpackets; /* Number of packets sent */
|
||||
uint32_t c_txmiss; /* Miss */
|
||||
uint32_t c_txvlan; /* VLAN */
|
||||
uint32_t c_txlframe; /* Long frame errors */
|
||||
uint32_t c_txsframe; /* Short frame errors */
|
||||
uint32_t c_txcrc; /* CRC errors */
|
||||
uint32_t c_txoverrun; /* Overrun errors */
|
||||
uint32_t c_txalign; /* Non-octect align errors */
|
||||
uint32_t c_txtimeouts; /* TX timeouts */
|
||||
|
||||
uint32 c_rxpackets; /* Number of packets received */
|
||||
uint32 c_rxretries; /* Exceed retry errors */
|
||||
uint32 c_rxheartbeat; /* Heartbeat (SQE) */
|
||||
uint32 c_rxlcollision; /* Late collision errors */
|
||||
uint32 c_rxcollision; /* Collision */
|
||||
uint32 c_rxcrc; /* CRC errors */
|
||||
uint32 c_rxunderrun; /* Underrun errors */
|
||||
uint32 c_rxloc; /* Loss of carrier */
|
||||
uint32 c_rxdropped; /* Packets dropped because of size */
|
||||
uint32_t c_rxpackets; /* Number of packets received */
|
||||
uint32_t c_rxretries; /* Exceed retry errors */
|
||||
uint32_t c_rxheartbeat; /* Heartbeat (SQE) */
|
||||
uint32_t c_rxlcollision; /* Late collision errors */
|
||||
uint32_t c_rxcollision; /* Collision */
|
||||
uint32_t c_rxcrc; /* CRC errors */
|
||||
uint32_t c_rxunderrun; /* Underrun errors */
|
||||
uint32_t c_rxloc; /* Loss of carrier */
|
||||
uint32_t c_rxdropped; /* Packets dropped because of size */
|
||||
#endif
|
||||
|
||||
/* This holds the information visible to uIP/NuttX */
|
||||
@ -386,8 +386,8 @@ static int c5471_interrupt(int irq, FAR void *context);
|
||||
|
||||
/* Watchdog timer expirations */
|
||||
|
||||
static void c5471_polltimer(int argc, uint32 arg, ...);
|
||||
static void c5471_txtimeout(int argc, uint32 arg, ...);
|
||||
static void c5471_polltimer(int argc, uint32_t arg, ...);
|
||||
static void c5471_txtimeout(int argc, uint32_t arg, ...);
|
||||
|
||||
/* NuttX callback functions */
|
||||
|
||||
@ -415,7 +415,7 @@ static void c5471_macassign(struct c5471_driver_s *c5471);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_C5471_NET_DUMPBUFFER
|
||||
static inline void c5471_dumpbuffer(const char *msg, const ubyte *buffer, unsigned int nbytes)
|
||||
static inline void c5471_dumpbuffer(const char *msg, const uint8_t *buffer, unsigned int nbytes)
|
||||
{
|
||||
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_NET have to be
|
||||
* defined or the following does nothing.
|
||||
@ -516,7 +516,7 @@ static void c5471_mdtxbit (int bit_state)
|
||||
|
||||
static int c5471_mdrxbit (void)
|
||||
{
|
||||
register volatile uint32 bit_state;
|
||||
register volatile uint32_t bit_state;
|
||||
|
||||
/* config MDIO as input pin. */
|
||||
|
||||
@ -807,7 +807,7 @@ static inline void c5471_inctxcpu(struct c5471_driver_s *c5471)
|
||||
}
|
||||
else
|
||||
{
|
||||
c5471->c_txcpudesc += 2*sizeof(uint32);
|
||||
c5471->c_txcpudesc += 2*sizeof(uint32_t);
|
||||
}
|
||||
|
||||
nvdbg("TX CPU desc: %08x\n", c5471->c_txcpudesc);
|
||||
@ -830,7 +830,7 @@ static inline void c5471_incrxcpu(struct c5471_driver_s *c5471)
|
||||
}
|
||||
else
|
||||
{
|
||||
c5471->c_rxcpudesc += 2*sizeof(uint32);
|
||||
c5471->c_rxcpudesc += 2*sizeof(uint32_t);
|
||||
}
|
||||
|
||||
nvdbg("RX CPU desc: %08x\n", c5471->c_rxcpudesc);
|
||||
@ -856,9 +856,9 @@ static inline void c5471_incrxcpu(struct c5471_driver_s *c5471)
|
||||
static int c5471_transmit(struct c5471_driver_s *c5471)
|
||||
{
|
||||
struct uip_driver_s *dev = &c5471->c_dev;
|
||||
volatile uint16 *packetmem;
|
||||
uint16 framelen;
|
||||
boolean bfirstframe;
|
||||
volatile uint16_t *packetmem;
|
||||
uint16_t framelen;
|
||||
bool bfirstframe;
|
||||
int nbytes;
|
||||
int nshorts;
|
||||
unsigned int i;
|
||||
@ -866,7 +866,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471)
|
||||
|
||||
nbytes = (dev->d_len + 1) & ~1;
|
||||
j = 0;
|
||||
bfirstframe = TRUE;
|
||||
bfirstframe = true;
|
||||
c5471->c_lastdescstart = c5471->c_rxcpudesc;
|
||||
|
||||
nvdbg("Packet size: %d RX CPU desc: %08x\n", nbytes, c5471->c_rxcpudesc);
|
||||
@ -916,12 +916,12 @@ static int c5471_transmit(struct c5471_driver_s *c5471)
|
||||
|
||||
/* Words #2 and #3 of descriptor */
|
||||
|
||||
packetmem = (uint16*)getreg32(c5471->c_rxcpudesc + sizeof(uint32));
|
||||
packetmem = (uint16_t*)getreg32(c5471->c_rxcpudesc + sizeof(uint32_t));
|
||||
for (i = 0; i < nshorts; i++, j++)
|
||||
{
|
||||
/* 16-bits at a time. */
|
||||
|
||||
packetmem[i] = htons(((uint16*)dev->d_buf)[j]);
|
||||
packetmem[i] = htons(((uint16_t*)dev->d_buf)[j]);
|
||||
}
|
||||
|
||||
putreg32(((getreg32(c5471->c_rxcpudesc) & ~EIM_RXDESC_BYTEMASK) | framelen), c5471->c_rxcpudesc);
|
||||
@ -949,7 +949,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471)
|
||||
/* Advance to the next free descriptor */
|
||||
|
||||
c5471_incrxcpu(c5471);
|
||||
bfirstframe = FALSE;
|
||||
bfirstframe = false;
|
||||
}
|
||||
|
||||
/* Packet transferred .. Update statistics */
|
||||
@ -960,7 +960,7 @@ static int c5471_transmit(struct c5471_driver_s *c5471)
|
||||
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
|
||||
(void)wd_start(c5471->c_txtimeout, C5471_TXTIMEOUT, c5471_txtimeout, 1, (uint32)c5471);
|
||||
(void)wd_start(c5471->c_txtimeout, C5471_TXTIMEOUT, c5471_txtimeout, 1, (uint32_t)c5471);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1036,8 +1036,8 @@ static int c5471_uiptxpoll(struct uip_driver_s *dev)
|
||||
#ifdef CONFIG_C5471_NET_STATS
|
||||
static void c5471_rxstatus(struct c5471_driver_s *c5471)
|
||||
{
|
||||
uint32 desc = c5471->c_txcpudesc;
|
||||
uint32 rxstatus;
|
||||
uint32_t desc = c5471->c_txcpudesc;
|
||||
uint32_t rxstatus;
|
||||
|
||||
/* Walk that last packet we just received to collect xmit status bits. */
|
||||
|
||||
@ -1068,7 +1068,7 @@ static void c5471_rxstatus(struct c5471_driver_s *c5471)
|
||||
}
|
||||
else
|
||||
{
|
||||
desc += 2 * sizeof(uint32);
|
||||
desc += 2 * sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1138,8 +1138,8 @@ static void c5471_rxstatus(struct c5471_driver_s *c5471)
|
||||
static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
{
|
||||
struct uip_driver_s *dev = &c5471->c_dev;
|
||||
uint16 *packetmem;
|
||||
boolean bmore = TRUE;
|
||||
uint16_t *packetmem;
|
||||
bool bmore = true;
|
||||
int packetlen = 0;
|
||||
int framelen;
|
||||
int nshorts;
|
||||
@ -1176,7 +1176,7 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
{
|
||||
/* Get the packet memory from words #2 and #3 of descriptor */
|
||||
|
||||
packetmem = (uint16*)getreg32(c5471->c_txcpudesc + sizeof(uint32));
|
||||
packetmem = (uint16_t*)getreg32(c5471->c_txcpudesc + sizeof(uint32_t));
|
||||
|
||||
/* Divide by 2 with round up to get the number of 16-bit words. */
|
||||
|
||||
@ -1190,7 +1190,7 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
* a time.
|
||||
*/
|
||||
|
||||
((uint16*)dev->d_buf)[j] = htons(packetmem[i]);
|
||||
((uint16_t*)dev->d_buf)[j] = htons(packetmem[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1200,7 +1200,7 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
|
||||
if (getreg32(c5471->c_txcpudesc) & EIM_TXDESC_LIF)
|
||||
{
|
||||
bmore = FALSE;
|
||||
bmore = false;
|
||||
}
|
||||
|
||||
/* Next, Clear all bits of words0/1 of the emptied descriptor except preserve
|
||||
@ -1312,8 +1312,8 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
#ifdef CONFIG_C5471_NET_STATS
|
||||
static void c5471_txstatus(struct c5471_driver_s *c5471)
|
||||
{
|
||||
uint32 desc = c5471->c_lastdescstart;
|
||||
uint32 txstatus;
|
||||
uint32_t desc = c5471->c_lastdescstart;
|
||||
uint32_t txstatus;
|
||||
|
||||
/* Walk that last packet we just sent to collect xmit status bits. */
|
||||
|
||||
@ -1338,7 +1338,7 @@ static void c5471_txstatus(struct c5471_driver_s *c5471)
|
||||
}
|
||||
else
|
||||
{
|
||||
desc += 2 * sizeof(uint32);
|
||||
desc += 2 * sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1515,7 +1515,7 @@ static int c5471_interrupt(int irq, FAR void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void c5471_txtimeout(int argc, uint32 arg, ...)
|
||||
static void c5471_txtimeout(int argc, uint32_t arg, ...)
|
||||
{
|
||||
struct c5471_driver_s *c5471 = (struct c5471_driver_s *)arg;
|
||||
|
||||
@ -1553,7 +1553,7 @@ static void c5471_txtimeout(int argc, uint32 arg, ...)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void c5471_polltimer(int argc, uint32 arg, ...)
|
||||
static void c5471_polltimer(int argc, uint32_t arg, ...)
|
||||
{
|
||||
struct c5471_driver_s *c5471 = (struct c5471_driver_s *)arg;
|
||||
|
||||
@ -1594,7 +1594,7 @@ static void c5471_polltimer(int argc, uint32 arg, ...)
|
||||
static int c5471_ifup(struct uip_driver_s *dev)
|
||||
{
|
||||
struct c5471_driver_s *c5471 = (struct c5471_driver_s *)dev->d_private;
|
||||
volatile uint32 clearbits;
|
||||
volatile uint32_t clearbits;
|
||||
|
||||
ndbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
@ -1626,11 +1626,11 @@ static int c5471_ifup(struct uip_driver_s *dev)
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
(void)wd_start(c5471->c_txpoll, C5471_WDDELAY, c5471_polltimer, 1, (uint32)c5471);
|
||||
(void)wd_start(c5471->c_txpoll, C5471_WDDELAY, c5471_polltimer, 1, (uint32_t)c5471);
|
||||
|
||||
/* Enable the Ethernet interrupt */
|
||||
|
||||
c5471->c_bifup = TRUE;
|
||||
c5471->c_bifup = true;
|
||||
up_enable_irq(C5471_IRQ_ETHER);
|
||||
return OK;
|
||||
}
|
||||
@ -1682,7 +1682,7 @@ static int c5471_ifdown(struct uip_driver_s *dev)
|
||||
|
||||
/* Reset the device */
|
||||
|
||||
c5471->c_bifup = FALSE;
|
||||
c5471->c_bifup = false;
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
@ -1793,9 +1793,9 @@ static void c5471_eimreset (struct c5471_driver_s *c5471)
|
||||
|
||||
static void c5471_eimconfig(struct c5471_driver_s *c5471)
|
||||
{
|
||||
volatile uint32 pbuf;
|
||||
volatile uint32 desc;
|
||||
volatile uint32 val;
|
||||
volatile uint32_t pbuf;
|
||||
volatile uint32_t desc;
|
||||
volatile uint32_t val;
|
||||
int i;
|
||||
|
||||
desc = EIM_RAM_START;
|
||||
@ -1815,16 +1815,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471)
|
||||
val |= EIM_TXDESC_OWN_HOST|EIM_TXDESC_INTRE|EIM_TXDESC_PADCRC|EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(val, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(pbuf, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */
|
||||
pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */
|
||||
}
|
||||
|
||||
/* RX ENET 0 */
|
||||
@ -1841,16 +1841,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471)
|
||||
val |= EIM_RXDESC_OWN_ENET|EIM_RXDESC_INTRE|EIM_RXDESC_PADCRC|EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(val, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(pbuf, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */
|
||||
pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */
|
||||
}
|
||||
|
||||
/* TX CPU */
|
||||
@ -1870,16 +1870,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471)
|
||||
val |= EIM_TXDESC_OWN_HOST|EIM_TXDESC_INTRE|EIM_TXDESC_PADCRC|EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(val, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(pbuf, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg(0, pbuf);
|
||||
pbuf += EIM_PACKET_BYTES;
|
||||
|
||||
putreg(0, pbuf);
|
||||
pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */
|
||||
pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */
|
||||
}
|
||||
|
||||
/* RX CPU */
|
||||
@ -1899,16 +1899,16 @@ static void c5471_eimconfig(struct c5471_driver_s *c5471)
|
||||
val |= EIM_RXDESC_OWN_ENET|EIM_RXDESC_INTRE|EIM_RXDESC_PADCRC|EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(val, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(pbuf, desc);
|
||||
desc += sizeof(uint32);
|
||||
desc += sizeof(uint32_t);
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += EIM_PACKET_BYTES;
|
||||
|
||||
putreg32(0, pbuf);
|
||||
pbuf += sizeof(uint32); /* Ether Module's "Buffer Usage Word" */
|
||||
pbuf += sizeof(uint32_t); /* Ether Module's "Buffer Usage Word" */
|
||||
}
|
||||
ndbg("END desc: %08x pbuf: %08x\n", desc, pbuf);
|
||||
|
||||
@ -2018,8 +2018,8 @@ static void c5471_reset(struct c5471_driver_s *c5471)
|
||||
static void c5471_macassign(struct c5471_driver_s *c5471)
|
||||
{
|
||||
struct uip_driver_s *dev = &c5471->c_dev;
|
||||
uint8 *mptr = dev->d_mac.ether_addr_octet;
|
||||
register uint32 tmp;
|
||||
uint8_t *mptr = dev->d_mac.ether_addr_octet;
|
||||
register uint32_t tmp;
|
||||
|
||||
ndbg("MAC: %0x:%0x:%0x:%0x:%0x:%0x\n",
|
||||
mptr[0], mptr[1], mptr[2], mptr[3], mptr[4], mptr[5]);
|
||||
@ -2028,11 +2028,11 @@ static void c5471_macassign(struct c5471_driver_s *c5471)
|
||||
* this destination address.
|
||||
*/
|
||||
|
||||
tmp = (((uint32)mptr[0]) << 8) | ((uint32)mptr[1]);
|
||||
tmp = (((uint32_t)mptr[0]) << 8) | ((uint32_t)mptr[1]);
|
||||
putreg32(tmp, EIM_CPU_DAHI);
|
||||
|
||||
tmp = (((uint32)mptr[2]) << 24) | (((uint32)mptr[3]) << 16) |
|
||||
(((uint32)mptr[4]) << 8) | ((uint32)mptr[5]);
|
||||
tmp = (((uint32_t)mptr[2]) << 24) | (((uint32_t)mptr[3]) << 16) |
|
||||
(((uint32_t)mptr[4]) << 8) | ((uint32_t)mptr[5]);
|
||||
putreg32(tmp, EIM_CPU_DALO);
|
||||
|
||||
#if 0
|
||||
|
@ -38,8 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "arm.h"
|
||||
@ -48,7 +48,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ILR_EDGESENSITIVE 0x00000020
|
||||
@ -58,7 +58,7 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
uint32 *current_regs;
|
||||
uint32_t *current_regs;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -107,7 +107,7 @@ static up_vector_t g_vectorinittab[] =
|
||||
|
||||
static inline void up_ackirq(unsigned int irq)
|
||||
{
|
||||
uint32 reg;
|
||||
uint32_t reg;
|
||||
reg = getreg32(SRC_IRQ_REG); /* Insure appropriate IT_REG bit clears */
|
||||
putreg32(reg | 0x00000001, INT_CTRL_REG); /* write the NEW_IRQ_AGR bit. */
|
||||
}
|
||||
@ -125,7 +125,7 @@ static inline void up_ackirq(unsigned int irq)
|
||||
|
||||
static inline void up_ackfiq(unsigned int irq)
|
||||
{
|
||||
uint32 reg;
|
||||
uint32_t reg;
|
||||
reg = getreg32(SRC_FIQ_REG); /* Insure appropriate IT_REG bit clears */
|
||||
putreg32(reg | 0x00000002, INT_CTRL_REG); /* write the NEW_FIQ_AGR bit. */
|
||||
}
|
||||
@ -197,7 +197,7 @@ void up_disable_irq(int irq)
|
||||
{
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
uint32 reg = getreg32(MASK_IT_REG);
|
||||
uint32_t reg = getreg32(MASK_IT_REG);
|
||||
putreg32(reg | (1 << irq), MASK_IT_REG);
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ void up_enable_irq(int irq)
|
||||
{
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
uint32 reg = getreg32(MASK_IT_REG);
|
||||
uint32_t reg = getreg32(MASK_IT_REG);
|
||||
putreg32(reg & ~(1 << irq), MASK_IT_REG);
|
||||
}
|
||||
}
|
||||
@ -229,7 +229,7 @@ void up_enable_irq(int irq)
|
||||
|
||||
void up_maskack_irq(int irq)
|
||||
{
|
||||
uint32 reg = getreg32(INT_CTRL_REG);
|
||||
uint32_t reg = getreg32(INT_CTRL_REG);
|
||||
|
||||
/* Mask the interrupt */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* c5471/c5471_serial.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,8 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
@ -56,7 +58,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BASE_BAUD 115200
|
||||
@ -71,12 +73,12 @@
|
||||
|
||||
struct uart_regs_s
|
||||
{
|
||||
uint32 ier;
|
||||
uint32 lcr;
|
||||
uint32 fcr;
|
||||
uint32_t ier;
|
||||
uint32_t lcr;
|
||||
uint32_t fcr;
|
||||
#ifdef CONFIG_UART_HWFLOWCONTROL
|
||||
uint32 efr;
|
||||
uint32 tcr;
|
||||
uint32_t efr;
|
||||
uint32_t tcr;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -85,16 +87,16 @@ struct up_dev_s
|
||||
unsigned int uartbase; /* Base address of UART registers */
|
||||
unsigned int baud_base; /* Base baud for conversions */
|
||||
unsigned int baud; /* Configured baud */
|
||||
ubyte xmit_fifo_size; /* Size of transmit FIFO */
|
||||
ubyte irq; /* IRQ associated with this UART */
|
||||
ubyte parity; /* 0=none, 1=odd, 2=even */
|
||||
ubyte bits; /* Number of bits (7 or 8) */
|
||||
uint8_t xmit_fifo_size; /* Size of transmit FIFO */
|
||||
uint8_t irq; /* IRQ associated with this UART */
|
||||
uint8_t parity; /* 0=none, 1=odd, 2=even */
|
||||
uint8_t bits; /* Number of bits (7 or 8) */
|
||||
#ifdef CONFIG_UART_HWFLOWCONTROL
|
||||
boolean flowcontrol; /* TRUE: Hardware flow control
|
||||
* is enabled. */
|
||||
bool flowcontrol; /* true: Hardware flow control
|
||||
* is enabled. */
|
||||
#endif
|
||||
boolean stopbits2; /* TRUE: Configure with 2
|
||||
* stop bits instead of 1 */
|
||||
bool stopbits2; /* true: Configure with 2
|
||||
* stop bits instead of 1 */
|
||||
struct uart_regs_s regs; /* Shadow copy of readonly regs */
|
||||
};
|
||||
|
||||
@ -102,19 +104,19 @@ struct up_dev_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_txready(struct uart_dev_s *dev);
|
||||
static boolean up_txempty(struct uart_dev_s *dev);
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_txready(struct uart_dev_s *dev);
|
||||
static bool up_txempty(struct uart_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
@ -155,7 +157,7 @@ static struct up_dev_s g_irdapriv =
|
||||
.parity = CONFIG_UART_IRDA_PARITY,
|
||||
.bits = CONFIG_UART_IRDA_BITS,
|
||||
#ifdef CONFIG_UART_IRDA_HWFLOWCONTROL
|
||||
.flowcontrol = TRUE,
|
||||
.flowcontrol = true,
|
||||
#endif
|
||||
.stopbits2 = CONFIG_UART_IRDA_2STOP,
|
||||
};
|
||||
@ -188,7 +190,7 @@ static struct up_dev_s g_modempriv =
|
||||
.parity = CONFIG_UART_MODEM_PARITY,
|
||||
.bits = CONFIG_UART_MODEM_BITS,
|
||||
#ifdef CONFIG_UART_MODEM_HWFLOWCONTROL
|
||||
.flowcontrol = TRUE,
|
||||
.flowcontrol = true,
|
||||
#endif
|
||||
.stopbits2 = CONFIG_UART_MODEM_2STOP,
|
||||
};
|
||||
@ -229,7 +231,7 @@ static uart_dev_t g_modemport =
|
||||
* Name: up_inserial
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 up_inserial(struct up_dev_s *priv, uint32 offset)
|
||||
static inline uint32_t up_inserial(struct up_dev_s *priv, uint32_t offset)
|
||||
{
|
||||
return getreg32(priv->uartbase + offset);
|
||||
}
|
||||
@ -238,7 +240,7 @@ static inline uint32 up_inserial(struct up_dev_s *priv, uint32 offset)
|
||||
* Name: up_serialout
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 value)
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint32_t value)
|
||||
{
|
||||
putreg32(value, priv->uartbase + offset);
|
||||
}
|
||||
@ -247,7 +249,7 @@ static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 val
|
||||
* Name: up_disableuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint16 *ier)
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint16_t *ier)
|
||||
{
|
||||
if (ier)
|
||||
{
|
||||
@ -261,7 +263,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint16 *ier)
|
||||
* Name: up_restoreuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint16 ier)
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint16_t ier)
|
||||
{
|
||||
priv->regs.ier |= ier & (UART_IER_RECVINT|UART_IER_XMITINT);
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
@ -309,7 +311,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv)
|
||||
|
||||
static inline void up_setrate(struct up_dev_s *priv, unsigned int rate)
|
||||
{
|
||||
uint32 div_bit_rate;
|
||||
uint32_t div_bit_rate;
|
||||
|
||||
switch (rate)
|
||||
{
|
||||
@ -420,7 +422,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
up_setrate(priv, priv->baud);
|
||||
|
||||
priv->regs.lcr &= 0xffffffe0; /* clear original field, and... */
|
||||
priv->regs.lcr |= (uint32)cval; /* Set new bits in that field. */
|
||||
priv->regs.lcr |= (uint32_t)cval; /* Set new bits in that field. */
|
||||
up_serialout(priv, UART_LCR_OFFS, priv->regs.lcr);
|
||||
|
||||
#ifdef CONFIG_UART_HWFLOWCONTROL
|
||||
@ -532,7 +534,7 @@ static int up_interrupt(int irq, void *context)
|
||||
{
|
||||
struct uart_dev_s *dev = NULL;
|
||||
struct up_dev_s *priv;
|
||||
volatile uint32 cause;
|
||||
volatile uint32_t cause;
|
||||
|
||||
if (g_irdapriv.irq == irq)
|
||||
{
|
||||
@ -552,7 +554,7 @@ static int up_interrupt(int irq, void *context)
|
||||
|
||||
if ((cause & 0x0000000c) == 0x0000000c)
|
||||
{
|
||||
uint32 ier_val = 0;
|
||||
uint32_t ier_val = 0;
|
||||
|
||||
/* Is this an interrupt from the IrDA UART? */
|
||||
|
||||
@ -671,8 +673,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
static int up_receive(struct uart_dev_s *dev, unsigned int *status)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint32 rhr;
|
||||
uint32 lsr;
|
||||
uint32_t rhr;
|
||||
uint32_t lsr;
|
||||
|
||||
/* Construct a 16bit status word that uses the high byte to
|
||||
* hold the status bits associated with framing,parity,break
|
||||
@ -696,7 +698,7 @@ static int up_receive(struct uart_dev_s *dev, unsigned int *status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
if (enable)
|
||||
@ -717,11 +719,11 @@ static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_rxavailable
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the receive fifo is not empty
|
||||
* Return true if the receive fifo is not empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static bool up_rxavailable(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return up_inserial(priv, UART_LSR_OFFS) & UART_RX_FIFO_NOEMPTY;
|
||||
@ -738,7 +740,7 @@ static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static void up_send(struct uart_dev_s *dev, int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
up_serialout(priv, UART_THR_OFFS, (ubyte)ch);
|
||||
up_serialout(priv, UART_THR_OFFS, (uint8_t)ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -749,7 +751,7 @@ static void up_send(struct uart_dev_s *dev, int ch)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
if (enable)
|
||||
@ -770,11 +772,11 @@ static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_txready
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the tranmsit fifo is not full
|
||||
* Return true if the tranmsit fifo is not full
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txready(struct uart_dev_s *dev)
|
||||
static bool up_txready(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return (up_inserial(priv, UART_SSR_OFFS) & UART_SSR_TXFULL) == 0;
|
||||
@ -784,11 +786,11 @@ static boolean up_txready(struct uart_dev_s *dev)
|
||||
* Name: up_txempty
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the transmit fifo is empty
|
||||
* Return true if the transmit fifo is empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txempty(struct uart_dev_s *dev)
|
||||
static bool up_txempty(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return (up_inserial(priv, UART_LSR_OFFS) & UART_LSR_TREF) != 0;
|
||||
@ -813,7 +815,7 @@ void up_earlyserialinit(void)
|
||||
up_disableuartint(TTYS0_DEV.priv, NULL);
|
||||
up_disableuartint(TTYS1_DEV.priv, NULL);
|
||||
|
||||
CONSOLE_DEV.isconsole = TRUE;
|
||||
CONSOLE_DEV.isconsole = true;
|
||||
up_setup(&CONSOLE_DEV);
|
||||
}
|
||||
|
||||
@ -845,11 +847,11 @@ void up_serialinit(void)
|
||||
int up_putc(int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||
uint16 ier;
|
||||
uint16_t ier;
|
||||
|
||||
up_disableuartint(priv, &ier);
|
||||
up_waittxready(priv);
|
||||
up_serialout(priv, UART_THR_OFFS, (ubyte)ch);
|
||||
up_serialout(priv, UART_THR_OFFS, (uint8_t)ch);
|
||||
|
||||
/* Check for LF */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************
|
||||
* c5471/c5471_timerisr.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -38,15 +38,17 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "clock_internal.h"
|
||||
#include "up_internal.h"
|
||||
#include "up_arch.h"
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************/
|
||||
|
||||
/* We want the general purpose timer running at the rate
|
||||
@ -87,7 +89,7 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
int up_timerisr(int irq, uint32 *regs)
|
||||
int up_timerisr(int irq, uint32_t *regs)
|
||||
{
|
||||
/* Process timer interrupt */
|
||||
|
||||
@ -106,7 +108,7 @@ int up_timerisr(int irq, uint32 *regs)
|
||||
|
||||
void up_timerinit(void)
|
||||
{
|
||||
uint32 val;
|
||||
uint32_t val;
|
||||
|
||||
up_disable_irq(C5471_IRQ_SYSTIMER);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**************************************************************************
|
||||
* c5471/c5471_watchdog.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -38,13 +38,18 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/watchdog.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
||||
/**************************************************************************
|
||||
@ -72,8 +77,8 @@
|
||||
|
||||
/* Macros to manage access to to watchdog timer macros */
|
||||
|
||||
#define c5471_wdt_cntl (*(volatile uint32*)C5471_TIMER0_CTRL)
|
||||
#define c5471_wdt_count (*(volatile uint32*)C5471_TIMER0_CNT)
|
||||
#define c5471_wdt_cntl (*(volatile uint32_t*)C5471_TIMER0_CTRL)
|
||||
#define c5471_wdt_count (*(volatile uint32_t*)C5471_TIMER0_CNT)
|
||||
|
||||
/**************************************************************************
|
||||
* Private Types
|
||||
@ -87,20 +92,20 @@
|
||||
|
||||
static inline unsigned int wdt_prescaletoptv(unsigned int prescale);
|
||||
|
||||
static int wdt_setusec(uint32 usec);
|
||||
static int wdt_setusec(uint32_t usec);
|
||||
static int wdt_interrupt(int irq, void *context);
|
||||
|
||||
static int wdt_open(struct file *filep);
|
||||
static int wdt_close(struct file *filep);
|
||||
static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen);
|
||||
static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen);
|
||||
static int wdt_ioctl(struct file *filep, int cmd, uint32 arg);
|
||||
static int wdt_ioctl(struct file *filep, int cmd, uint32_t arg);
|
||||
|
||||
/**************************************************************************
|
||||
* Private Data
|
||||
**************************************************************************/
|
||||
|
||||
static boolean g_wdtopen;
|
||||
static bool g_wdtopen;
|
||||
|
||||
static const struct file_operations g_wdtops =
|
||||
{
|
||||
@ -156,15 +161,15 @@ static inline unsigned int wdt_prescaletoptv(unsigned int prescale)
|
||||
* Name: wdt_setusec
|
||||
**************************************************************************/
|
||||
|
||||
static int wdt_setusec(uint32 usec)
|
||||
static int wdt_setusec(uint32_t usec)
|
||||
{
|
||||
/* prescaler: clock / prescaler = #clock ticks per counter in ptv
|
||||
* divisor: #counts until the interrupt comes.
|
||||
*/
|
||||
|
||||
uint32 prescaler = MAX_PRESCALER;
|
||||
uint32 divisor = 1;
|
||||
uint32 mode;
|
||||
uint32_t prescaler = MAX_PRESCALER;
|
||||
uint32_t divisor = 1;
|
||||
uint32_t mode;
|
||||
|
||||
dbg("usec=%d\n", usec);
|
||||
|
||||
@ -283,7 +288,7 @@ static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen)
|
||||
* Name: wdt_ioctl
|
||||
**************************************************************************/
|
||||
|
||||
static int wdt_ioctl(struct file *filep, int cmd, uint32 arg)
|
||||
static int wdt_ioctl(struct file *filep, int cmd, uint32_t arg)
|
||||
{
|
||||
dbg("ioctl Call: cmd=0x%x arg=0x%x", cmd, arg);
|
||||
|
||||
@ -323,7 +328,7 @@ static int wdt_open(struct file *filep)
|
||||
c5471_wdt_cntl = C5471_DISABLE_VALUE1;
|
||||
c5471_wdt_cntl = C5471_DISABLE_VALUE2;
|
||||
|
||||
g_wdtopen = TRUE;
|
||||
g_wdtopen = true;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -345,7 +350,7 @@ static int wdt_close(struct file *filep)
|
||||
c5471_wdt_cntl = C5471_TIMER_MODE;
|
||||
#endif
|
||||
|
||||
g_wdtopen = FALSE;
|
||||
g_wdtopen = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -42,14 +42,14 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include "chip.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -58,25 +58,25 @@
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
# define getreg8(a) (*(volatile ubyte *)(a))
|
||||
# define putreg8(v,a) (*(volatile ubyte *)(a) = (v))
|
||||
# define getreg32(a) (*(volatile uint32 *)(a))
|
||||
# define putreg32(v,a) (*(volatile uint32 *)(a) = (v))
|
||||
# define getreg8(a) (*(volatile uint8_t *)(a))
|
||||
# define putreg8(v,a) (*(volatile uint8_t *)(a) = (v))
|
||||
# define getreg32(a) (*(volatile uint32_t *)(a))
|
||||
# define putreg32(v,a) (*(volatile uint32_t *)(a) = (v))
|
||||
|
||||
/* Some compiler options will convert short loads and stores into byte loads
|
||||
* and stores. We don't want this to happen for IO reads and writes!
|
||||
*/
|
||||
|
||||
/* # define getreg16(a) (*(volatile uint16 *)(a)) */
|
||||
static inline uint16 getreg16(unsigned int addr)
|
||||
/* # define getreg16(a) (*(volatile uint16_t *)(a)) */
|
||||
static inline uint16_t getreg16(unsigned int addr)
|
||||
{
|
||||
uint16 retval;
|
||||
uint16_t retval;
|
||||
__asm__ __volatile__("\tldrh %0, [%1]\n\t" : "=r"(retval) : "r"(addr));
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* define putreg16(v,a) (*(volatile uint16 *)(a) = (v)) */
|
||||
static inline void putreg16(uint16 val, unsigned int addr)
|
||||
/* define putreg16(v,a) (*(volatile uint16_t *)(a) = (v)) */
|
||||
static inline void putreg16(uint16_t val, unsigned int addr)
|
||||
{
|
||||
__asm__ __volatile__("\tstrh %0, [%1]\n\t": : "r"(val), "r"(addr));
|
||||
}
|
||||
@ -95,9 +95,9 @@ extern "C" {
|
||||
|
||||
/* Atomic modification of registers */
|
||||
|
||||
EXTERN void modifyreg8(unsigned int addr, ubyte clearbits, ubyte setbits);
|
||||
EXTERN void modifyreg16(unsigned int addr, uint16 clearbits, uint16 setbits);
|
||||
EXTERN void modifyreg32(unsigned int addr, uint32 clearbits, uint32 setbits);
|
||||
EXTERN void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits);
|
||||
EXTERN void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits);
|
||||
EXTERN void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -93,7 +94,7 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
|
||||
if (!tcb->stack_alloc_ptr)
|
||||
{
|
||||
tcb->stack_alloc_ptr = (uint32 *)kzmalloc(stack_size);
|
||||
tcb->stack_alloc_ptr = (uint32_t*)kzmalloc(stack_size);
|
||||
}
|
||||
|
||||
if (tcb->stack_alloc_ptr)
|
||||
@ -108,7 +109,7 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
* referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
|
||||
/* The ARM stack must be aligned at word (4 byte)
|
||||
* boundaries. If necessary top_of_stack must be rounded
|
||||
@ -116,11 +117,11 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
|
||||
/* Save the adjusted stack values in the _TCB */
|
||||
|
||||
tcb->adj_stack_ptr = (uint32*)top_of_stack;
|
||||
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
up_ledon(LED_STACKCREATED);
|
||||
|
@ -38,7 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_idle.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,12 +38,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -49,7 +48,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -40,8 +40,12 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Bring-up debug configurations. These are here (vs defconfig)
|
||||
@ -103,7 +107,7 @@ typedef void (*up_vector_t)(void);
|
||||
* interrupt processing.
|
||||
*/
|
||||
|
||||
extern uint32 *current_regs;
|
||||
extern uint32_t *current_regs;
|
||||
|
||||
/* This is the beginning of heap as provided from up_head.S.
|
||||
* This is the first address in DRAM after the loaded
|
||||
@ -111,33 +115,33 @@ extern uint32 *current_regs;
|
||||
* CONFIG_DRAM_END
|
||||
*/
|
||||
|
||||
extern uint32 g_heapbase;
|
||||
extern uint32_t g_heapbase;
|
||||
|
||||
/* Address of the saved user stack pointer */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
extern uint32 g_userstack;
|
||||
extern uint32_t g_userstack;
|
||||
#endif
|
||||
|
||||
/* These 'addresses' of these values are setup by the linker script. They are
|
||||
* not actual uint32 storage locations! They are only used meaningfully in the
|
||||
* not actual uint32_t storage locations! They are only used meaningfully in the
|
||||
* following way:
|
||||
*
|
||||
* - The linker script defines, for example, the symbol_sdata.
|
||||
* - The declareion extern uint32 _sdata; makes C happy. C will believe
|
||||
* that the value _sdata is the address of a uint32 variable _data (it is
|
||||
* - The declareion extern uint32_t _sdata; makes C happy. C will believe
|
||||
* that the value _sdata is the address of a uint32_t variable _data (it is
|
||||
* not!).
|
||||
* - We can recoved the linker value then by simply taking the address of
|
||||
* of _data. like: uint32 *pdata = &_sdata;
|
||||
* of _data. like: uint32_t *pdata = &_sdata;
|
||||
*/
|
||||
|
||||
extern uint32 _stext; /* Start of .text */
|
||||
extern uint32 _etext; /* End_1 of .text + .rodata */
|
||||
extern const uint32 _eronly; /* End+1 of read only section (.text + .rodata) */
|
||||
extern uint32 _sdata; /* Start of .data */
|
||||
extern uint32 _edata; /* End+1 of .data */
|
||||
extern uint32 _sbss; /* Start of .bss */
|
||||
extern uint32 _ebss; /* End+1 of .bss */
|
||||
extern uint32_t _stext; /* Start of .text */
|
||||
extern uint32_t _etext; /* End_1 of .text + .rodata */
|
||||
extern const uint32_t _eronly; /* End+1 of read only section (.text + .rodata) */
|
||||
extern uint32_t _sdata; /* Start of .data */
|
||||
extern uint32_t _edata; /* End+1 of .data */
|
||||
extern uint32_t _sbss; /* Start of .bss */
|
||||
extern uint32_t _ebss; /* End+1 of .bss */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -153,31 +157,31 @@ extern uint32 _ebss; /* End+1 of .bss */
|
||||
/* Defined in files with the same name as the function */
|
||||
|
||||
extern void up_boot(void);
|
||||
extern void up_copystate(uint32 *dest, uint32 *src);
|
||||
extern void up_decodeirq(uint32 *regs);
|
||||
extern void up_copystate(uint32_t *dest, uint32_t *src);
|
||||
extern void up_decodeirq(uint32_t *regs);
|
||||
extern void up_irqinitialize(void);
|
||||
#ifdef CONFIG_ARCH_DMA
|
||||
extern void weak_function up_dmainitialize(void);
|
||||
#endif
|
||||
extern int up_saveusercontext(uint32 *saveregs);
|
||||
extern void up_fullcontextrestore(uint32 *restoreregs) __attribute__ ((noreturn));
|
||||
extern void up_switchcontext(uint32 *saveregs, uint32 *restoreregs);
|
||||
extern int up_saveusercontext(uint32_t *saveregs);
|
||||
extern void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn));
|
||||
extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
||||
extern void up_sigdeliver(void);
|
||||
extern int up_timerisr(int irq, uint32 *regs);
|
||||
extern int up_timerisr(int irq, uint32_t *regs);
|
||||
extern void up_lowputc(char ch);
|
||||
extern void up_puts(const char *str);
|
||||
extern void up_lowputs(const char *str);
|
||||
|
||||
#ifdef CONFIG_ARCH_CORTEXM3
|
||||
extern uint32 *up_doirq(int irq, uint32 *regs);
|
||||
extern uint32_t *up_doirq(int irq, uint32_t *regs);
|
||||
extern int up_svcall(int irq, FAR void *context);
|
||||
extern int up_hardfault(int irq, FAR void *context);
|
||||
#else
|
||||
extern void up_doirq(int irq, uint32 *regs);
|
||||
extern void up_dataabort(uint32 *regs);
|
||||
extern void up_prefetchabort(uint32 *regs);
|
||||
extern void up_syscall(uint32 *regs);
|
||||
extern void up_undefinedinsn(uint32 *regs);
|
||||
extern void up_doirq(int irq, uint32_t *regs);
|
||||
extern void up_dataabort(uint32_t *regs);
|
||||
extern void up_prefetchabort(uint32_t *regs);
|
||||
extern void up_syscall(uint32_t *regs);
|
||||
extern void up_undefinedinsn(uint32_t *regs);
|
||||
#endif
|
||||
|
||||
/* Defined in up_vectors.S */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_interruptcontext.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,9 +38,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -58,11 +60,11 @@
|
||||
/****************************************************************************
|
||||
* Name: up_interrupt_context
|
||||
*
|
||||
* Description: Return TRUE is we are currently executing in
|
||||
* Description: Return true is we are currently executing in
|
||||
* the interrupt handler context.
|
||||
****************************************************************************/
|
||||
|
||||
boolean up_interrupt_context(void)
|
||||
bool up_interrupt_context(void)
|
||||
{
|
||||
return current_regs != NULL;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_lowputs.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,12 +38,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
@ -48,7 +48,7 @@
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -71,10 +71,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void modifyreg16(unsigned int addr, uint16 clearbits, uint16 setbits)
|
||||
void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint16 regval;
|
||||
uint16_t regval;
|
||||
|
||||
flags = irqsave();
|
||||
regval = getreg16(addr);
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
@ -48,7 +48,7 @@
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -71,10 +71,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void modifyreg32(unsigned int addr, uint32 clearbits, uint32 setbits)
|
||||
void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
|
||||
flags = irqsave();
|
||||
regval = getreg32(addr);
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
@ -48,7 +48,7 @@
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -71,10 +71,10 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void modifyreg8(unsigned int addr, ubyte clearbits, ubyte setbits)
|
||||
void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits)
|
||||
{
|
||||
irqstate_t flags;
|
||||
ubyte regval;
|
||||
uint8_t regval;
|
||||
|
||||
flags = irqsave();
|
||||
regval = getreg8(addr);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_puts.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,13 +38,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_releasestack.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,10 +38,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
|
@ -38,11 +38,15 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -99,7 +103,7 @@ int up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
|
||||
* referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
|
||||
/* The ARM stack must be aligned at word (4 byte)
|
||||
* boundaries. If necessary top_of_stack must be rounded
|
||||
@ -107,11 +111,11 @@ int up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
|
||||
/* Save the adjusted stack values in the _TCB */
|
||||
|
||||
tcb->adj_stack_ptr = (uint32*)top_of_stack;
|
||||
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
return OK;
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* NVIC base address ****************************************************************/
|
||||
|
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Application Program Status Register (APSR) */
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -52,7 +52,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
@ -78,9 +78,9 @@
|
||||
|
||||
/* I don't know if the builtin to get SP is enabled */
|
||||
|
||||
static inline uint32 up_getsp(void)
|
||||
static inline uint32_t up_getsp(void)
|
||||
{
|
||||
uint32 sp;
|
||||
uint32_t sp;
|
||||
__asm__
|
||||
(
|
||||
"\tmov %0, sp\n\t"
|
||||
@ -94,13 +94,13 @@ static inline uint32 up_getsp(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_stackdump(uint32 sp, uint32 stack_base)
|
||||
static void up_stackdump(uint32_t sp, uint32_t stack_base)
|
||||
{
|
||||
uint32 stack ;
|
||||
uint32_t stack ;
|
||||
|
||||
for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
|
||||
{
|
||||
uint32 *ptr = (uint32*)stack;
|
||||
uint32_t *ptr = (uint32_t*)stack;
|
||||
lldbg("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
stack, ptr[0], ptr[1], ptr[2], ptr[3],
|
||||
ptr[4], ptr[5], ptr[6], ptr[7]);
|
||||
@ -148,13 +148,13 @@ static inline void up_registerdump(void)
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_dumpstate(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 sp = up_getsp();
|
||||
uint32 ustackbase;
|
||||
uint32 ustacksize;
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32_t sp = up_getsp();
|
||||
uint32_t ustackbase;
|
||||
uint32_t ustacksize;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
uint32 istackbase;
|
||||
uint32 istacksize;
|
||||
uint32_t istackbase;
|
||||
uint32_t istacksize;
|
||||
#endif
|
||||
|
||||
/* Get the limits on the user stack memory */
|
||||
@ -166,14 +166,14 @@ static void up_dumpstate(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
ustackbase = (uint32)rtcb->adj_stack_ptr;
|
||||
ustacksize = (uint32)rtcb->adj_stack_size;
|
||||
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
|
||||
ustacksize = (uint32_t)rtcb->adj_stack_size;
|
||||
}
|
||||
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32)&g_userstack;
|
||||
istackbase = (uint32_t)&g_userstack;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
|
||||
/* Show interrupt stack info */
|
||||
@ -270,7 +270,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
|
||||
* Name: up_assert
|
||||
****************************************************************************/
|
||||
|
||||
void up_assert(const ubyte *filename, int lineno)
|
||||
void up_assert(const uint8_t *filename, int lineno)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
@ -292,7 +292,7 @@ void up_assert(const ubyte *filename, int lineno)
|
||||
* Name: up_assert_code
|
||||
****************************************************************************/
|
||||
|
||||
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
|
||||
void up_assert_code(const uint8_t *filename, int lineno, int errorcode)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
|
@ -38,8 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -96,7 +96,7 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
else
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
boolean switch_needed;
|
||||
bool switch_needed;
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list. If we
|
||||
* are blocking the task at the head of the task list (the
|
||||
|
@ -39,13 +39,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
/* A little faster than most memcpy's */
|
||||
|
||||
void up_copystate(uint32 *dest, uint32 *src)
|
||||
void up_copystate(uint32_t *dest, uint32_t *src)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -38,16 +38,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -66,7 +68,7 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
uint32 *up_doirq(int irq, uint32 *regs)
|
||||
uint32_t *up_doirq(int irq, uint32_t *regs)
|
||||
{
|
||||
up_ledon(LED_INIRQ);
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
|
@ -67,7 +67,7 @@
|
||||
* Description:
|
||||
* Restore the current thread context. Full prototype is:
|
||||
*
|
||||
* void up_fullcontextrestore(uint32 *restoreregs) __attribute__ ((noreturn));
|
||||
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn));
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
|
@ -38,8 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -94,13 +94,13 @@
|
||||
|
||||
int up_hardfault(int irq, FAR void *context)
|
||||
{
|
||||
uint32 *regs = (uint32*)context;
|
||||
uint16 *pc;
|
||||
uint16 insn;
|
||||
uint32_t *regs = (uint32_t*)context;
|
||||
uint16_t *pc;
|
||||
uint16_t insn;
|
||||
|
||||
/* Get the value of the program counter where the fault occurred */
|
||||
|
||||
pc = (uint16*)regs[REG_PC] - 1;
|
||||
pc = (uint16_t*)regs[REG_PC] - 1;
|
||||
if ((void*)pc >= (void*)&_stext && (void*)pc < (void*)&_etext)
|
||||
{
|
||||
/* Fetch the instruction that caused the Hard fault */
|
||||
|
@ -38,7 +38,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -48,7 +50,7 @@
|
||||
#include "psr.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -87,11 +89,11 @@ void up_initial_state(_TCB *tcb)
|
||||
|
||||
/* Save the initial stack pointer */
|
||||
|
||||
xcp->regs[REG_SP] = (uint32)tcb->adj_stack_ptr;
|
||||
xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr;
|
||||
|
||||
/* Save the task entry point (stripping off the thumb bit) */
|
||||
|
||||
xcp->regs[REG_PC] = (uint32)tcb->start & ~1;
|
||||
xcp->regs[REG_PC] = (uint32_t)tcb->start & ~1;
|
||||
|
||||
/* Specify thumb mode */
|
||||
|
||||
@ -108,7 +110,7 @@ void up_initial_state(_TCB *tcb)
|
||||
* alloacated D-Space region.
|
||||
*/
|
||||
|
||||
xcp->regs[REG_PIC] = (uint32)tcb->dspace->region;
|
||||
xcp->regs[REG_PIC] = (uint32_t)tcb->dspace->region;
|
||||
}
|
||||
|
||||
/* Make certain that bit 0 is set in the main entry address. This
|
||||
@ -118,7 +120,7 @@ void up_initial_state(_TCB *tcb)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NXFLAT
|
||||
tcb->entry.main = (main_t)((uint32)tcb->entry.main | 1);
|
||||
tcb->entry.main = (main_t)((uint32_t)tcb->entry.main | 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -38,15 +38,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -38,15 +38,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -81,7 +84,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
void up_reprioritize_rtr(_TCB *tcb, uint8_t priority)
|
||||
{
|
||||
/* Verify that the caller is sane */
|
||||
|
||||
@ -95,12 +98,12 @@ void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
else
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
boolean switch_needed;
|
||||
bool switch_needed;
|
||||
|
||||
slldbg("TCB=%p PRI=%d\n", tcb, priority);
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list.
|
||||
* sched_removereadytorun will return TRUE if we just
|
||||
* sched_removereadytorun will return true if we just
|
||||
* remove the head of the ready to run list.
|
||||
*/
|
||||
|
||||
@ -108,10 +111,10 @@ void up_reprioritize_rtr(_TCB *tcb, ubyte priority)
|
||||
|
||||
/* Setup up the new task priority */
|
||||
|
||||
tcb->sched_priority = (ubyte)priority;
|
||||
tcb->sched_priority = (uint8_t)priority;
|
||||
|
||||
/* Return the task to the specified blocked task list.
|
||||
* sched_addreadytorun will return TRUE if the task was
|
||||
* sched_addreadytorun will return true if the task was
|
||||
* added to the new list. We will need to perform a context
|
||||
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
||||
* (i.e., one and only one the calls changes the head of the
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "nvic.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Preprocessor Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
@ -67,7 +67,7 @@
|
||||
* Description:
|
||||
* Save the current thread context. Full prototype is:
|
||||
*
|
||||
* int up_saveusercontext(uint32 *saveregs);
|
||||
* int up_saveusercontext(uint32_t *saveregs);
|
||||
*
|
||||
* Return:
|
||||
* 0: Normal return
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -162,7 +162,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
||||
* disabled
|
||||
*/
|
||||
|
||||
current_regs[REG_PC] = (uint32)up_sigdeliver;
|
||||
current_regs[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
current_regs[REG_PRIMASK] = 1;
|
||||
current_regs[REG_XPSR] = CORTEXM3_XPSR_T;
|
||||
|
||||
@ -196,7 +196,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
||||
* disabled
|
||||
*/
|
||||
|
||||
tcb->xcp.regs[REG_PC] = (uint32)up_sigdeliver;
|
||||
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
tcb->xcp.regs[REG_PRIMASK] = 1;
|
||||
tcb->xcp.regs[REG_XPSR] = CORTEXM3_XPSR_T;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -82,7 +82,7 @@
|
||||
void up_sigdeliver(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
uint32_t regs[XCPTCONTEXT_REGS];
|
||||
sig_deliver_t sigdeliver;
|
||||
|
||||
/* Save the errno. This must be preserved throughout the
|
||||
@ -117,7 +117,7 @@ void up_sigdeliver(void)
|
||||
|
||||
/* Then restore the task interrupt state */
|
||||
|
||||
irqrestore((uint16)regs[REG_PRIMASK]);
|
||||
irqrestore((uint16_t)regs[REG_PRIMASK]);
|
||||
|
||||
/* Deliver the signals */
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -88,7 +88,7 @@
|
||||
|
||||
int up_svcall(int irq, FAR void *context)
|
||||
{
|
||||
uint32 *regs = (uint32*)context;
|
||||
uint32_t *regs = (uint32_t*)context;
|
||||
|
||||
DEBUGASSERT(regs && regs == current_regs);
|
||||
DEBUGASSERT(regs[REG_R1] != 0);
|
||||
@ -115,7 +115,7 @@ int up_svcall(int irq, FAR void *context)
|
||||
{
|
||||
/* R0=0: This is a save context command:
|
||||
*
|
||||
* int up_saveusercontext(uint32 *saveregs);
|
||||
* int up_saveusercontext(uint32_t *saveregs);
|
||||
*
|
||||
* At this point, the following values are saved in context:
|
||||
*
|
||||
@ -128,13 +128,13 @@ int up_svcall(int irq, FAR void *context)
|
||||
|
||||
case 0:
|
||||
{
|
||||
memcpy((uint32*)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
|
||||
memcpy((uint32_t*)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
|
||||
}
|
||||
break;
|
||||
|
||||
/* R0=1: This a restore context command:
|
||||
*
|
||||
* void up_fullcontextrestore(uint32 *restoreregs) __attribute__ ((noreturn));
|
||||
* void up_fullcontextrestore(uint32_t *restoreregs) __attribute__ ((noreturn));
|
||||
*
|
||||
* At this point, the following values are saved in context:
|
||||
*
|
||||
@ -149,13 +149,13 @@ int up_svcall(int irq, FAR void *context)
|
||||
|
||||
case 1:
|
||||
{
|
||||
current_regs = (uint32*)regs[REG_R1];
|
||||
current_regs = (uint32_t*)regs[REG_R1];
|
||||
}
|
||||
break;
|
||||
|
||||
/* R0=2: This a switch context command:
|
||||
*
|
||||
* void up_switchcontext(uint32 *saveregs, uint32 *restoreregs);
|
||||
* void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
||||
*
|
||||
* At this point, the following values are saved in context:
|
||||
*
|
||||
@ -172,8 +172,8 @@ int up_svcall(int irq, FAR void *context)
|
||||
case 2:
|
||||
{
|
||||
DEBUGASSERT(regs[REG_R2] != 0);
|
||||
memcpy((uint32*)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
|
||||
current_regs = (uint32*)regs[REG_R2];
|
||||
memcpy((uint32_t*)regs[REG_R1], regs, XCPTCONTEXT_SIZE);
|
||||
current_regs = (uint32_t*)regs[REG_R2];
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "nvic.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Preprocessor Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
@ -68,7 +68,7 @@
|
||||
* Save the current thread context and restore the specified context.
|
||||
* Full prototype is:
|
||||
*
|
||||
* void up_switchcontext(uint32 *saveregs, uint32 *restoreregs);
|
||||
* void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
|
@ -38,16 +38,17 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "clock_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_uart.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* AHB Bus Controller (AHBBUSC) Registers *******************************************/
|
||||
|
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -38,7 +38,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "arm.h"
|
||||
#include "up_internal.h"
|
||||
@ -54,18 +54,18 @@
|
||||
|
||||
struct section_mapping_s
|
||||
{
|
||||
uint32 physbase; /* Physical address of the region to be mapped */
|
||||
uint32 virtbase; /* Virtual address of the region to be mapped */
|
||||
uint32 mmuflags; /* MMU settings for the region (e.g., cache-able) */
|
||||
uint32 nsections; /* Number of mappings in the region */
|
||||
uint32_t physbase; /* Physical address of the region to be mapped */
|
||||
uint32_t virtbase; /* Virtual address of the region to be mapped */
|
||||
uint32_t mmuflags; /* MMU settings for the region (e.g., cache-able) */
|
||||
uint32_t nsections; /* Number of mappings in the region */
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Public Variables
|
||||
************************************************************************************/
|
||||
|
||||
extern uint32 _vector_start; /* Beginning of vector block */
|
||||
extern uint32 _vector_end; /* End+1 of vector block */
|
||||
extern uint32_t _vector_start; /* Beginning of vector block */
|
||||
extern uint32_t _vector_end; /* End+1 of vector block */
|
||||
|
||||
/************************************************************************************
|
||||
* Private Variables
|
||||
@ -100,10 +100,10 @@ static const struct section_mapping_s section_mapping[] =
|
||||
* Name: up_setlevel1entry
|
||||
************************************************************************************/
|
||||
|
||||
static inline void up_setlevel1entry(uint32 paddr, uint32 vaddr, uint32 mmuflags)
|
||||
static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags)
|
||||
{
|
||||
uint32 *pgtable = (uint32*)PGTABLE_BASE_VADDR;
|
||||
uint32 index = vaddr >> 20;
|
||||
uint32_t *pgtable = (uint32_t*)PGTABLE_BASE_VADDR;
|
||||
uint32_t index = vaddr >> 20;
|
||||
|
||||
/* Save the page table entry */
|
||||
|
||||
@ -114,11 +114,11 @@ static inline void up_setlevel1entry(uint32 paddr, uint32 vaddr, uint32 mmuflags
|
||||
* Name: up_setlevel2coarseentry
|
||||
************************************************************************************/
|
||||
|
||||
static inline void up_setlevel2coarseentry(uint32 ctabvaddr, uint32 paddr,
|
||||
uint32 vaddr, uint32 mmuflags)
|
||||
static inline void up_setlevel2coarseentry(uint32_t ctabvaddr, uint32_t paddr,
|
||||
uint32_t vaddr, uint32_t mmuflags)
|
||||
{
|
||||
uint32 *ctable = (uint32*)ctabvaddr;
|
||||
uint32 index;
|
||||
uint32_t *ctable = (uint32_t*)ctabvaddr;
|
||||
uint32_t index;
|
||||
|
||||
/* The coarse table divides a 1Mb address space up into 256 entries, each
|
||||
* corresponding to 4Kb of address space. The coarse page table index is
|
||||
@ -142,9 +142,9 @@ static void up_setupmappings(void)
|
||||
|
||||
for (i = 0; i < NMAPPINGS; i++)
|
||||
{
|
||||
uint32 sect_paddr = section_mapping[i].physbase;
|
||||
uint32 sect_vaddr = section_mapping[i].virtbase;
|
||||
uint32 mmuflags = section_mapping[i].mmuflags;
|
||||
uint32_t sect_paddr = section_mapping[i].physbase;
|
||||
uint32_t sect_vaddr = section_mapping[i].virtbase;
|
||||
uint32_t mmuflags = section_mapping[i].mmuflags;
|
||||
|
||||
for (j = 0; j < section_mapping[i].nsections; j++)
|
||||
{
|
||||
@ -161,9 +161,9 @@ static void up_setupmappings(void)
|
||||
|
||||
static void up_vectormapping(void)
|
||||
{
|
||||
uint32 vector_paddr = DM320_IRAM_PADDR;
|
||||
uint32 vector_vaddr = DM320_VECTOR_VADDR;
|
||||
uint32 end_paddr = vector_paddr + DM320_IRAM_SIZE;
|
||||
uint32_t vector_paddr = DM320_IRAM_PADDR;
|
||||
uint32_t vector_vaddr = DM320_VECTOR_VADDR;
|
||||
uint32_t end_paddr = vector_paddr + DM320_IRAM_SIZE;
|
||||
|
||||
/* We want to keep our interrupt vectors and interrupt-related logic in zero-wait
|
||||
* state internal RAM (IRAM). The DM320 has 16Kb of IRAM positioned at physical
|
||||
@ -193,9 +193,9 @@ static void up_vectormapping(void)
|
||||
|
||||
static void up_copyvectorblock(void)
|
||||
{
|
||||
uint32 *src = (uint32*)&_vector_start;
|
||||
uint32 *end = (uint32*)&_vector_end;
|
||||
uint32 *dest = (uint32*)VECTOR_BASE;
|
||||
uint32_t *src = (uint32_t*)&_vector_start;
|
||||
uint32_t *end = (uint32_t*)&_vector_end;
|
||||
uint32_t *dest = (uint32_t*)VECTOR_BASE;
|
||||
|
||||
while (src < end)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_busc.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Bus Controller Register Map (BUSC) ***********************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_clkc.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clock Controller Register Map (CLKC) *********************************************/
|
||||
|
@ -39,7 +39,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
@ -50,7 +51,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/********************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
@ -69,7 +70,7 @@
|
||||
* Public Funtions
|
||||
********************************************************************************/
|
||||
|
||||
void up_decodeirq(uint32* regs)
|
||||
void up_decodeirq(uint32_t* regs)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
lib_lowprintf("Unexpected IRQ\n");
|
||||
@ -78,7 +79,7 @@ void up_decodeirq(uint32* regs)
|
||||
#else
|
||||
/* Decode the interrupt. First, fetch the interrupt id register. */
|
||||
|
||||
uint16 irqentry = getreg16(DM320_INTC_IRQENTRY0);
|
||||
uint16_t irqentry = getreg16(DM320_INTC_IRQENTRY0);
|
||||
|
||||
/* The irqentry value is an offset into a table. Zero means no interrupt. */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_emif.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* External Memory Interface (EMIF) Registers */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/dm320/dm320_framebuffer.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -53,7 +53,7 @@
|
||||
#include "dm320_osd.h"
|
||||
|
||||
/************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
/* Configuration ********************************************************/
|
||||
@ -592,34 +592,34 @@ static struct fb_vtable_s g_osd1vtable =
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline void dm320_blankscreen(ubyte *buffer, int len)
|
||||
static inline void dm320_blankscreen(uint8_t *buffer, int len)
|
||||
{
|
||||
memset(buffer, 0xff, len);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_physaddr(FAR void *fb_vaddr)
|
||||
static inline uint32_t dm320_physaddr(FAR void *fb_vaddr)
|
||||
{
|
||||
return (uint32)fb_vaddr - DM320_SDRAM_VADDR;
|
||||
return (uint32_t)fb_vaddr - DM320_SDRAM_VADDR;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DM320_VID0_DISABLE
|
||||
static inline uint32 dm320_vid0upperoffset(void)
|
||||
static inline uint32_t dm320_vid0upperoffset(void)
|
||||
{
|
||||
return (((dm320_physaddr(g_vid0base) / 32) >> 16) & 0xff);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_vid0loweroffset(void)
|
||||
static inline uint32_t dm320_vid0loweroffset(void)
|
||||
{
|
||||
return ((dm320_physaddr(g_vid0base) / 32) & 0xffff);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DM320_DISABLE_PINGPONG
|
||||
static inline uint32 dm320_vid0ppupperoffset(void)
|
||||
static inline uint32_t dm320_vid0ppupperoffset(void)
|
||||
{
|
||||
return (((dm320_physaddr(g_vid0ppbase) / 32) >> 16) & 0xff);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_vid0pploweroffset(void)
|
||||
static inline uint32_t dm320_vid0pploweroffset(void)
|
||||
{
|
||||
return ((dm320_physaddr(g_vid0ppbase) / 32) & 0xffff);
|
||||
}
|
||||
@ -627,36 +627,36 @@ static inline uint32 dm320_vid0pploweroffset(void)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DM320_VID1_DISABLE
|
||||
static inline uint32 dm320_vid1upperoffset(void)
|
||||
static inline uint32_t dm320_vid1upperoffset(void)
|
||||
{
|
||||
return (((dm320_physaddr(g_vid1base) / 32) >> 16) & 0xff);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_vid1loweroffset(void)
|
||||
static inline uint32_t dm320_vid1loweroffset(void)
|
||||
{
|
||||
return ((dm320_physaddr(g_vid1base) / 32) & 0xffff);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DM320_OSD0_DISABLE
|
||||
static inline uint32 dm320_osd0upperoffset(void)
|
||||
static inline uint32_t dm320_osd0upperoffset(void)
|
||||
{
|
||||
return (((dm320_physaddr(g_osd0base) / 32) >> 16) & 0xff);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_osd0loweroffset(void)
|
||||
static inline uint32_t dm320_osd0loweroffset(void)
|
||||
{
|
||||
return ((dm320_physaddr(g_osd0base) / 32) & 0xffff);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DM320_OSD1_DISABLE
|
||||
static inline uint32 dm320_osd1upperoffset(void)
|
||||
static inline uint32_t dm320_osd1upperoffset(void)
|
||||
{
|
||||
return (((dm320_physaddr(g_osd1base) / 32) >> 16) & 0xff);
|
||||
}
|
||||
|
||||
static inline uint32 dm320_osd1loweroffset(void)
|
||||
static inline uint32_t dm320_osd1loweroffset(void)
|
||||
{
|
||||
return ((dm320_physaddr(g_osd1base) / 32) & 0xffff);
|
||||
}
|
||||
@ -823,7 +823,7 @@ static void dm320_hwinitialize(void)
|
||||
|
||||
gvdbg("DM320_OSD_VIDWINADH: %04x\n", getreg16(DM320_OSD_VIDWINADH));
|
||||
gvdbg("DM320_OSD_VIDWIN0ADL: %04x\n", getreg16(DM320_OSD_VIDWIN0ADL));
|
||||
dm320_blankscreen((ubyte *)g_vid0base, DM320_VID0_FBLEN);
|
||||
dm320_blankscreen((uint8_t *)g_vid0base, DM320_VID0_FBLEN);
|
||||
|
||||
#ifndef CONFIG_DM320_DISABLE_PINGPONG
|
||||
putreg16(dm320_vid0ppupperoffset(), DM320_OSD_PPVWIN0ADH);
|
||||
@ -831,7 +831,7 @@ static void dm320_hwinitialize(void)
|
||||
|
||||
gvdbg("DM320_OSD_PPVWIN0ADH: %04x\n", getreg16(DM320_OSD_PPVWIN0ADH));
|
||||
gvdbg("DM320_OSD_PPVWIN0ADL: %04x\n", getreg16(DM320_OSD_PPVWIN0ADL));
|
||||
dm320_blankscreen((ubyte *)g_vid0ppbase, DM320_VID0_FBLEN);
|
||||
dm320_blankscreen((uint8_t *)g_vid0ppbase, DM320_VID0_FBLEN);
|
||||
#endif
|
||||
|
||||
putreg16(CONFIG_DM320_VID0_XPOS, DM320_OSD_VIDWIN0XP);
|
||||
@ -855,7 +855,7 @@ static void dm320_hwinitialize(void)
|
||||
|
||||
gvdbg("DM320_OSD_VIDWINADH: %04x\n", getreg16(DM320_OSD_VIDWINADH));
|
||||
gvdbg("DM320_OSD_VIDWIN1ADL: %04x\n", getreg16(DM320_OSD_VIDWIN1ADL));
|
||||
dm320_blankscreen((ubyte *)g_vid1base, DM320_VID1_FBLEN);
|
||||
dm320_blankscreen((uint8_t *)g_vid1base, DM320_VID1_FBLEN);
|
||||
|
||||
putreg16(CONFIG_DM320_VID1_XPOS, DM320_OSD_VIDWIN1XP);
|
||||
putreg16(CONFIG_DM320_VID1_XPOS, DM320_OSD_VIDWIN1YP);
|
||||
@ -877,7 +877,7 @@ static void dm320_hwinitialize(void)
|
||||
|
||||
#ifndef CONFIG_DM320_OSD0_DISABLE
|
||||
gvdbg("Initialize OSD win0:\n");
|
||||
dm320_blankscreen((ubyte *)g_osd0base, DM320_OSD0_FBLEN);
|
||||
dm320_blankscreen((uint8_t *)g_osd0base, DM320_OSD0_FBLEN);
|
||||
|
||||
putreg16(CONFIG_DM320_OSD0_XPOS, DM320_OSD_OSDWIN0XP);
|
||||
putreg16(CONFIG_DM320_OSD0_YPOS, DM320_OSD_OSDWIN0YP);
|
||||
@ -902,7 +902,7 @@ static void dm320_hwinitialize(void)
|
||||
|
||||
#ifndef CONFIG_DM320_OSD1_DISABLE
|
||||
gvdbg("Initialize OSD win1\n");
|
||||
dm320_blankscreen((ubyte *)g_osd1base, DM320_OSD1_FBLEN);
|
||||
dm320_blankscreen((uint8_t *)g_osd1base, DM320_OSD1_FBLEN);
|
||||
|
||||
putreg16(CONFIG_DM320_OSD1_XPOS, DM320_OSD_OSDWIN1XP);
|
||||
putreg16(CONFIG_DM320_OSD1_YPOS, DM320_OSD_OSDWIN1YP);
|
||||
@ -1183,12 +1183,12 @@ static int dm320_getcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *c
|
||||
static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *cmap)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint16 regval;
|
||||
ubyte y;
|
||||
ubyte u;
|
||||
ubyte v;
|
||||
int len
|
||||
int i;
|
||||
uint16_t regval;
|
||||
uint8_t y;
|
||||
uint8_t u;
|
||||
uint8_t v;
|
||||
int len
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!vtable || !cmap || !cmap->read || !cmap->green || !cmap->blue)
|
||||
@ -1207,8 +1207,8 @@ static int dm320_putcmap(FAR struct fb_vtable_s *vtable, FAR struct fb_cmap_s *c
|
||||
/* Program the CLUT */
|
||||
|
||||
while (getreg16(DM320_OSD_MISCCTL) & 0x8);
|
||||
putreg16(((uint16)y) << 8 | uint16(u)), DM320_OSD_CLUTRAMYCB);
|
||||
putreg16(((uint16)v << 8 | i), DM320_OSD_CLUTRAMCR);
|
||||
putreg16(((uint16_t)y) << 8 | uint16_t(u)), DM320_OSD_CLUTRAMYCB);
|
||||
putreg16(((uint16_t)v << 8 | i), DM320_OSD_CLUTRAMCR);
|
||||
}
|
||||
|
||||
/* Select RAM clut */
|
||||
@ -1279,7 +1279,7 @@ static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursora
|
||||
static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint16 regval;
|
||||
uint16_t regval;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!vtable || !settings)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_gio.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -41,11 +41,11 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* General I/O Registers */
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
#define _GIO_READ_REG(pin, reg0, reg1, reg2, bval) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
register uint32_t _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
#define _GIO_SET_REG(pin, reg0, reg1, reg2) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
register uint32_t _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
@ -95,7 +95,7 @@
|
||||
|
||||
#define _GIO_CLEAR_REG(pin, reg0, reg1, reg2) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
register uint32_t _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_intc.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Interrupt Controller Registers */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* arch/arm/src/dm320/dm320_irq.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -31,14 +31,15 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "arm.h"
|
||||
@ -46,19 +47,19 @@
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
/************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Public Data
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
uint32 *current_regs;
|
||||
uint32_t *current_regs;
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
/* The value of _vflashstart is defined in ld.script. It
|
||||
* could be hard-coded because we know that correct IRAM
|
||||
@ -67,17 +68,17 @@ uint32 *current_regs;
|
||||
|
||||
extern int _svectors; /* Type does not matter */
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Name: up_irqinitialize
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
void up_irqinitialize(void)
|
||||
{
|
||||
@ -119,13 +120,13 @@ void up_irqinitialize(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Name: up_disable_irq
|
||||
*
|
||||
* Description:
|
||||
* Disable the IRQ specified by 'irq'
|
||||
*
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
void up_disable_irq(int irq)
|
||||
{
|
||||
@ -159,13 +160,13 @@ void up_disable_irq(int irq)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Name: up_enable_irq
|
||||
*
|
||||
* Description:
|
||||
* Enable the IRQ specified by 'irq'
|
||||
*
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
void up_enable_irq(int irq)
|
||||
{
|
||||
@ -199,13 +200,13 @@ void up_enable_irq(int irq)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/************************************************************************
|
||||
* Name: up_maskack_irq
|
||||
*
|
||||
* Description:
|
||||
* Mask the IRQ and acknowledge it
|
||||
*
|
||||
************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
void up_maskack_irq(int irq)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_memorymap.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -40,14 +40,10 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Mapped base of all registers *****************************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_osd.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* On Screen Display Register Map (OSD) *********************************************/
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
@ -59,7 +61,7 @@
|
||||
#ifdef CONFIG_USE_SERIALDRIVER
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -68,33 +70,33 @@
|
||||
|
||||
struct up_dev_s
|
||||
{
|
||||
uint32 uartbase; /* Base address of UART registers */
|
||||
uint32 baud; /* Configured baud */
|
||||
uint16 msr; /* Saved MSR value */
|
||||
ubyte irq; /* IRQ associated with this UART */
|
||||
ubyte parity; /* 0=none, 1=odd, 2=even */
|
||||
ubyte bits; /* Number of bits (7 or 8) */
|
||||
boolean stopbits2; /* TRUE: Configure with 2
|
||||
* stop bits instead of 1 */
|
||||
uint32_t uartbase; /* Base address of UART registers */
|
||||
uint32_t baud; /* Configured baud */
|
||||
uint16_t msr; /* Saved MSR value */
|
||||
uint8_t irq; /* IRQ associated with this UART */
|
||||
uint8_t parity; /* 0=none, 1=odd, 2=even */
|
||||
uint8_t bits; /* Number of bits (7 or 8) */
|
||||
bool stopbits2; /* true: Configure with 2
|
||||
* stop bits instead of 1 */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, uint32 *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_txready(struct uart_dev_s *dev);
|
||||
static boolean up_txempty(struct uart_dev_s *dev);
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, uint32_t *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_txready(struct uart_dev_s *dev);
|
||||
static bool up_txempty(struct uart_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
@ -199,7 +201,7 @@ static uart_dev_t g_uart1port =
|
||||
* Name: up_serialin
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint16 up_serialin(struct up_dev_s *priv, uint32 offset)
|
||||
static inline uint16_t up_serialin(struct up_dev_s *priv, uint32_t offset)
|
||||
{
|
||||
return getreg16(priv->uartbase + offset);
|
||||
}
|
||||
@ -208,7 +210,7 @@ static inline uint16 up_serialin(struct up_dev_s *priv, uint32 offset)
|
||||
* Name: up_serialout
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint16 value)
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint16_t value)
|
||||
{
|
||||
putreg16(value, priv->uartbase + offset);
|
||||
}
|
||||
@ -217,7 +219,7 @@ static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint16 val
|
||||
* Name: up_disableuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint16 *msr)
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint16_t *msr)
|
||||
{
|
||||
if (msr)
|
||||
{
|
||||
@ -232,7 +234,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint16 *msr)
|
||||
* Name: up_restoreuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint16 msr)
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint16_t msr)
|
||||
{
|
||||
priv->msr |= msr & UART_MSR_ALLIE;
|
||||
up_serialout(priv, UART_MSR, priv->msr);
|
||||
@ -259,9 +261,9 @@ static inline void up_waittxready(struct up_dev_s *priv)
|
||||
* Name: up_enablebreaks
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_enablebreaks(struct up_dev_s *priv, boolean enable)
|
||||
static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
|
||||
{
|
||||
uint16 lcr = up_serialin(priv, UART_LCR);
|
||||
uint16_t lcr = up_serialin(priv, UART_LCR);
|
||||
if (enable)
|
||||
{
|
||||
lcr |= UART_LCR_BOC;
|
||||
@ -287,7 +289,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint16 brsr;
|
||||
uint16_t brsr;
|
||||
|
||||
/* Clear fifos */
|
||||
|
||||
@ -380,7 +382,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
|
||||
up_serialout(priv, UART_MSR, priv->msr);
|
||||
up_serialout(priv, UART_BRSR, brsr);
|
||||
up_enablebreaks(priv, FALSE);
|
||||
up_enablebreaks(priv, false);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
@ -468,7 +470,7 @@ static int up_interrupt(int irq, void *context)
|
||||
{
|
||||
struct uart_dev_s *dev = NULL;
|
||||
struct up_dev_s *priv;
|
||||
uint16 status;
|
||||
uint16_t status;
|
||||
int passes = 0;
|
||||
|
||||
if (g_uart1priv.irq == irq)
|
||||
@ -559,7 +561,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
|
||||
{
|
||||
irqstate_t flags = irqsave();
|
||||
up_enablebreaks(priv, TRUE);
|
||||
up_enablebreaks(priv, true);
|
||||
irqrestore(flags);
|
||||
}
|
||||
break;
|
||||
@ -568,7 +570,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
flags = irqsave();
|
||||
up_enablebreaks(priv, FALSE);
|
||||
up_enablebreaks(priv, false);
|
||||
irqrestore(flags);
|
||||
}
|
||||
break;
|
||||
@ -591,10 +593,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_receive(struct uart_dev_s *dev, uint32 *status)
|
||||
static int up_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint16 dtrr;
|
||||
uint16_t dtrr;
|
||||
|
||||
dtrr = up_serialin(priv, UART_DTRR);
|
||||
*status = dtrr;
|
||||
@ -609,7 +611,7 @@ static int up_receive(struct uart_dev_s *dev, uint32 *status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
if (enable)
|
||||
@ -629,11 +631,11 @@ static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_rxavailable
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the receive fifo is not empty
|
||||
* Return true if the receive fifo is not empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static bool up_rxavailable(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return ((up_serialin(priv, UART_SR) & UART_SR_RFNEF) != 0);
|
||||
@ -650,7 +652,7 @@ static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static void up_send(struct uart_dev_s *dev, int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
up_serialout(priv, UART_DTRR, (uint16)ch);
|
||||
up_serialout(priv, UART_DTRR, (uint16_t)ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -661,7 +663,7 @@ static void up_send(struct uart_dev_s *dev, int ch)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
if (enable)
|
||||
@ -681,11 +683,11 @@ static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_txready
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the tranmsit fifo is not full
|
||||
* Return true if the tranmsit fifo is not full
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txready(struct uart_dev_s *dev)
|
||||
static bool up_txready(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return ((up_serialin(priv, UART_SR) & UART_SR_TFTI) != 0);
|
||||
@ -695,11 +697,11 @@ static boolean up_txready(struct uart_dev_s *dev)
|
||||
* Name: up_txempty
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the transmit fifo is empty
|
||||
* Return true if the transmit fifo is empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txempty(struct uart_dev_s *dev)
|
||||
static bool up_txempty(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
return ((up_serialin(priv, UART_SR) & UART_SR_TREF) == 0);
|
||||
@ -724,7 +726,7 @@ void up_earlyserialinit(void)
|
||||
up_disableuartint(TTYS0_DEV.priv, NULL);
|
||||
up_disableuartint(TTYS1_DEV.priv, NULL);
|
||||
|
||||
CONSOLE_DEV.isconsole = TRUE;
|
||||
CONSOLE_DEV.isconsole = true;
|
||||
up_setup(&CONSOLE_DEV);
|
||||
}
|
||||
|
||||
@ -756,11 +758,11 @@ void up_serialinit(void)
|
||||
int up_putc(int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||
uint16 ier;
|
||||
uint16_t ier;
|
||||
|
||||
up_disableuartint(priv, &ier);
|
||||
up_waittxready(priv);
|
||||
up_serialout(priv, UART_DTRR, (uint16)ch);
|
||||
up_serialout(priv, UART_DTRR, (uint16_t)ch);
|
||||
|
||||
/* Check for LF */
|
||||
|
||||
@ -814,7 +816,7 @@ static inline void up_waittxready(void)
|
||||
int up_putc(int ch)
|
||||
{
|
||||
up_waittxready();
|
||||
putreg16((uint16)ch, DM320_REGISTER_BASE + UART_DTRR);
|
||||
putreg16((uint16_t)ch, DM320_REGISTER_BASE + UART_DTRR);
|
||||
|
||||
/* Check for LF */
|
||||
|
||||
@ -823,7 +825,7 @@ int up_putc(int ch)
|
||||
/* Add CR */
|
||||
|
||||
up_waittxready();
|
||||
putreg16((uint16)'\r', DM320_REGISTER_BASE + UART_DTRR);
|
||||
putreg16((uint16_t)'\r', DM320_REGISTER_BASE + UART_DTRR);
|
||||
}
|
||||
|
||||
up_waittxready();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_timer.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Timer Registers */
|
||||
|
@ -39,15 +39,17 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "clock_internal.h"
|
||||
#include "up_internal.h"
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* DM320 Timers
|
||||
@ -114,7 +116,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_timerisr(int irq, uint32 *regs)
|
||||
int up_timerisr(int irq, uint32_t *regs)
|
||||
{
|
||||
/* Process timer interrupt */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_uart.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -14,7 +14,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -41,11 +41,11 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* UART definitions *****************************************************************/
|
||||
@ -80,18 +80,18 @@
|
||||
|
||||
/* And baud = UART_REFCLK / (brsr+1) */
|
||||
|
||||
#define UART_BAUD_2400 ((uint16)((UART_REFCLK / 2400 ) - 1))
|
||||
#define UART_BAUD_4800 ((uint16)((UART_REFCLK / 4800 ) - 1))
|
||||
#define UART_BAUD_9600 ((uint16)((UART_REFCLK / 9600 ) - 1))
|
||||
#define UART_BAUD_14400 ((uint16)((UART_REFCLK / 14400 ) - 1))
|
||||
#define UART_BAUD_19200 ((uint16)((UART_REFCLK / 19200 ) - 1))
|
||||
#define UART_BAUD_28800 ((uint16)((UART_REFCLK / 28800 ) - 1))
|
||||
#define UART_BAUD_38400 ((uint16)((UART_REFCLK / 38400 ) - 1))
|
||||
#define UART_BAUD_57600 ((uint16)((UART_REFCLK / 57600 ) - 1))
|
||||
#define UART_BAUD_115200 ((uint16)((UART_REFCLK / 115200) - 1))
|
||||
#define UART_BAUD_230400 ((uint16)((UART_REFCLK / 230400) - 1))
|
||||
#define UART_BAUD_460800 ((uint16)((UART_REFCLK / 460800) - 1))
|
||||
#define UART_BAUD_921600 ((uint16)((UART_REFCLK / 921600) - 1))
|
||||
#define UART_BAUD_2400 ((uint16_t)((UART_REFCLK / 2400 ) - 1))
|
||||
#define UART_BAUD_4800 ((uint16_t)((UART_REFCLK / 4800 ) - 1))
|
||||
#define UART_BAUD_9600 ((uint16_t)((UART_REFCLK / 9600 ) - 1))
|
||||
#define UART_BAUD_14400 ((uint16_t)((UART_REFCLK / 14400 ) - 1))
|
||||
#define UART_BAUD_19200 ((uint16_t)((UART_REFCLK / 19200 ) - 1))
|
||||
#define UART_BAUD_28800 ((uint16_t)((UART_REFCLK / 28800 ) - 1))
|
||||
#define UART_BAUD_38400 ((uint16_t)((UART_REFCLK / 38400 ) - 1))
|
||||
#define UART_BAUD_57600 ((uint16_t)((UART_REFCLK / 57600 ) - 1))
|
||||
#define UART_BAUD_115200 ((uint16_t)((UART_REFCLK / 115200) - 1))
|
||||
#define UART_BAUD_230400 ((uint16_t)((UART_REFCLK / 230400) - 1))
|
||||
#define UART_BAUD_460800 ((uint16_t)((UART_REFCLK / 460800) - 1))
|
||||
#define UART_BAUD_921600 ((uint16_t)((UART_REFCLK / 921600) - 1))
|
||||
|
||||
/* UART MSR register bit definitions */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* dm320/dm320_uart.h
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -40,12 +40,8 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* USB Controller Registers *********************************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* arch/arm/src/dm320/dm320_usbdev.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -38,8 +38,10 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -208,11 +210,11 @@ struct dm320_ep_s
|
||||
struct dm320_usbdev_s *dev; /* Reference to private driver data */
|
||||
struct dm320_req_s *head; /* Request list for this endpoint */
|
||||
struct dm320_req_s *tail;
|
||||
ubyte epphy; /* Physical EP address/index */
|
||||
ubyte stalled:1; /* Endpoint is halted */
|
||||
ubyte in:1; /* Endpoint is IN only */
|
||||
ubyte halted:1; /* Endpoint feature halted */
|
||||
ubyte txnullpkt:1; /* Null packet needed at end of transfer */
|
||||
uint8_t epphy; /* Physical EP address/index */
|
||||
uint8_t stalled:1; /* Endpoint is halted */
|
||||
uint8_t in:1; /* Endpoint is IN only */
|
||||
uint8_t halted:1; /* Endpoint feature halted */
|
||||
uint8_t txnullpkt:1; /* Null packet needed at end of transfer */
|
||||
};
|
||||
|
||||
/* This structure encapsulates the overall driver state */
|
||||
@ -232,12 +234,12 @@ struct dm320_usbdev_s
|
||||
|
||||
/* DM320-specific fields */
|
||||
|
||||
ubyte stalled:1; /* 1: Protocol stalled */
|
||||
ubyte selfpowered:1; /* 1: Device is self powered */
|
||||
ubyte paddrset:1; /* 1: Peripheral addr has been set */
|
||||
ubyte attached:1; /* 1: Host attached */
|
||||
ubyte rxpending:1; /* 1: RX pending */
|
||||
ubyte paddr; /* Peripheral address */
|
||||
uint8_t stalled:1; /* 1: Protocol stalled */
|
||||
uint8_t selfpowered:1; /* 1: Device is self powered */
|
||||
uint8_t paddrset:1; /* 1: Peripheral addr has been set */
|
||||
uint8_t attached:1; /* 1: Host attached */
|
||||
uint8_t rxpending:1; /* 1: RX pending */
|
||||
uint8_t paddr; /* Peripheral address */
|
||||
|
||||
/* The endpoint list */
|
||||
|
||||
@ -248,13 +250,13 @@ struct dm320_usbdev_s
|
||||
|
||||
struct dm320_epinfo_s
|
||||
{
|
||||
ubyte addr; /* Logical endpoint address */
|
||||
ubyte attr; /* Endpoint attributes */
|
||||
ubyte fifo; /* FIFO mx pkt size + dual buffer bits */
|
||||
uint8_t addr; /* Logical endpoint address */
|
||||
uint8_t attr; /* Endpoint attributes */
|
||||
uint8_t fifo; /* FIFO mx pkt size + dual buffer bits */
|
||||
#ifdef CONFIG_USBDEV_HIGHSPEED
|
||||
uint16 maxpacket; /* Max packet size */
|
||||
uint16_t maxpacket; /* Max packet size */
|
||||
#else
|
||||
ubyte maxpacket; /* Max packet size */
|
||||
uint8_t maxpacket; /* Max packet size */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -265,12 +267,12 @@ struct dm320_epinfo_s
|
||||
/* Register operations */
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static uint32 dm320_getreg8(uint32 addr);
|
||||
static uint32 dm320_getreg16(uint32 addr);
|
||||
static uint32 dm320_getreg32(uint32 addr);
|
||||
static void dm320_putreg8(ubyte val, uint32 addr);
|
||||
static void dm320_putreg16(uint16 val, uint32 addr);
|
||||
static void dm320_putreg32(uint32 val, uint32 addr);
|
||||
static uint32_t dm320_getreg8(uint32_t addr);
|
||||
static uint32_t dm320_getreg16(uint32_t addr);
|
||||
static uint32_t dm320_getreg32(uint32_t addr);
|
||||
static void dm320_putreg8(uint8_t val, uint32_t addr);
|
||||
static void dm320_putreg16(uint16_t val, uint32_t addr);
|
||||
static void dm320_putreg32(uint32_t val, uint32_t addr);
|
||||
#else
|
||||
# define dm320_getreg8(addr) getreg8(addr)
|
||||
# define dm320_getreg16(addr) getreg16(addr)
|
||||
@ -287,12 +289,12 @@ static void dm320_rqenqueue(FAR struct dm320_ep_s *privep, FAR struct dm320_req_
|
||||
|
||||
/* Low level data transfers and request operations */
|
||||
|
||||
static int dm320_ep0write(ubyte *buf, uint16 nbytes);
|
||||
static int dm320_epwrite(ubyte epphy, ubyte *buf, uint16 nbytes);
|
||||
static int dm320_epread(ubyte epphy, ubyte *buf, uint16 nbytes);
|
||||
static int dm320_ep0write(uint8_t *buf, uint16_t nbytes);
|
||||
static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes);
|
||||
static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes);
|
||||
static inline void dm320_abortrequest(struct dm320_ep_s *privep,
|
||||
struct dm320_req_s *privreq, sint16 result);
|
||||
static void dm320_reqcomplete(struct dm320_ep_s *privep, sint16 result);
|
||||
struct dm320_req_s *privreq, int16_t result);
|
||||
static void dm320_reqcomplete(struct dm320_ep_s *privep, int16_t result);
|
||||
static int dm320_wrrequest(struct dm320_ep_s *privep);
|
||||
static int dm320_rdrequest(struct dm320_ep_s *privep);
|
||||
static void dm320_cancelrequests(struct dm320_ep_s *privep);
|
||||
@ -300,11 +302,11 @@ static void dm320_cancelrequests(struct dm320_ep_s *privep);
|
||||
/* Interrupt handling */
|
||||
|
||||
static struct dm320_ep_s *dm320_epfindbyaddr(struct dm320_usbdev_s *priv,
|
||||
uint16 eplog);
|
||||
uint16_t eplog);
|
||||
static void dm320_dispatchrequest(struct dm320_usbdev_s *priv,
|
||||
const struct usb_ctrlreq_s *ctrl);
|
||||
static inline void dm320_ep0setup(struct dm320_usbdev_s *priv);
|
||||
static inline uint32 dm320_highestpriinterrupt(int intstatus);
|
||||
static inline uint32_t dm320_highestpriinterrupt(int intstatus);
|
||||
static int dm320_ctlrinterrupt(int irq, FAR void *context);
|
||||
static int dm320_attachinterrupt(int irq, FAR void *context);
|
||||
|
||||
@ -317,12 +319,12 @@ static void dm320_ctrlinitialize(struct dm320_usbdev_s *priv);
|
||||
/* Endpoint methods */
|
||||
|
||||
static int dm320_epconfigure(FAR struct usbdev_ep_s *ep,
|
||||
const struct usb_epdesc_s *desc, boolean last);
|
||||
const struct usb_epdesc_s *desc, bool last);
|
||||
static int dm320_epdisable(FAR struct usbdev_ep_s *ep);
|
||||
static FAR struct usbdev_req_s *dm320_epallocreq(FAR struct usbdev_ep_s *ep);
|
||||
static void dm320_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req);
|
||||
#ifdef CONFIG_DM320_USBDEV_DMA
|
||||
static FAR void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16 nbytes);
|
||||
static FAR void *dm320_epallocbuffer(FAR struct usbdev_ep_s *ep, uint16_t nbytes);
|
||||
static void dm320_epfreebuffer(FAR struct usbdev_ep_s *ep, void *buf);
|
||||
#endif
|
||||
static int dm320_epsubmit(FAR struct usbdev_ep_s *ep, struct usbdev_req_s *privreq);
|
||||
@ -331,12 +333,12 @@ static int dm320_epcancel(FAR struct usbdev_ep_s *ep, struct usbdev_req_s *priv
|
||||
/* USB device controller methods */
|
||||
|
||||
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev,
|
||||
ubyte epno, boolean in, ubyte eptype);
|
||||
uint8_t epno, bool in, uint8_t eptype);
|
||||
static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep);
|
||||
static int dm320_getframe(struct usbdev_s *dev);
|
||||
static int dm320_wakeup(struct usbdev_s *dev);
|
||||
static int dm320_selfpowered(struct usbdev_s *dev, boolean selfpowered);
|
||||
static int dm320_pullup(struct usbdev_s *dev, boolean enable);
|
||||
static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered);
|
||||
static int dm320_pullup(struct usbdev_s *dev, bool enable);
|
||||
|
||||
/*******************************************************************************
|
||||
* Private Data
|
||||
@ -419,15 +421,15 @@ static const struct dm320_epinfo_s g_epinfo[DM320_NENDPOINTS] =
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static ubyte dm320_getreg8(uint32 addr)
|
||||
static uint8_t dm320_getreg8(uint32_t addr)
|
||||
{
|
||||
static uint32 prevaddr = 0;
|
||||
static ubyte preval = 0;
|
||||
static uint32 count = 0;
|
||||
static uint32_t prevaddr = 0;
|
||||
static uint8_t preval = 0;
|
||||
static uint32_t count = 0;
|
||||
|
||||
/* Read the value from the register */
|
||||
|
||||
ubyte val = getreg8(addr);
|
||||
uint8_t val = getreg8(addr);
|
||||
|
||||
/* Is this the same value that we read from the same registe last time? Are
|
||||
* we polling the register? If so, suppress some of the output.
|
||||
@ -481,15 +483,15 @@ static ubyte dm320_getreg8(uint32 addr)
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static uint32 dm320_getreg16(uint32 addr)
|
||||
static uint32_t dm320_getreg16(uint32_t addr)
|
||||
{
|
||||
static uint32 prevaddr = 0;
|
||||
static uint16 preval = 0;
|
||||
static uint32 count = 0;
|
||||
static uint32_t prevaddr = 0;
|
||||
static uint16_t preval = 0;
|
||||
static uint32_t count = 0;
|
||||
|
||||
/* Read the value from the register */
|
||||
|
||||
uint16 val = getreg16(addr);
|
||||
uint16_t val = getreg16(addr);
|
||||
|
||||
/* Is this the same value that we read from the same registe last time? Are
|
||||
* we polling the register? If so, suppress some of the output.
|
||||
@ -543,15 +545,15 @@ static uint32 dm320_getreg16(uint32 addr)
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static uint32 dm320_getreg32(uint32 addr)
|
||||
static uint32_t dm320_getreg32(uint32_t addr)
|
||||
{
|
||||
static uint32 prevaddr = 0;
|
||||
static uint32 preval = 0;
|
||||
static uint32 count = 0;
|
||||
static uint32_t prevaddr = 0;
|
||||
static uint32_t preval = 0;
|
||||
static uint32_t count = 0;
|
||||
|
||||
/* Read the value from the register */
|
||||
|
||||
uint32 val = getreg32(addr);
|
||||
uint32_t val = getreg32(addr);
|
||||
|
||||
/* Is this the same value that we read from the same registe last time? Are
|
||||
* we polling the register? If so, suppress some of the output.
|
||||
@ -605,7 +607,7 @@ static uint32 dm320_getreg32(uint32 addr)
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static void dm320_putreg8(ubyte val, uint32 addr)
|
||||
static void dm320_putreg8(uint8_t val, uint32_t addr)
|
||||
{
|
||||
/* Show the register value being written */
|
||||
|
||||
@ -626,7 +628,7 @@ static void dm320_putreg8(ubyte val, uint32 addr)
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static void dm320_putreg16(uint16 val, uint32 addr)
|
||||
static void dm320_putreg16(uint16_t val, uint32_t addr)
|
||||
{
|
||||
/* Show the register value being written */
|
||||
|
||||
@ -647,7 +649,7 @@ static void dm320_putreg16(uint16 val, uint32 addr)
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DM320_USBDEV_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static void dm320_putreg32(uint32 val, uint32 addr)
|
||||
static void dm320_putreg32(uint32_t val, uint32_t addr)
|
||||
{
|
||||
/* Show the register value being written */
|
||||
|
||||
@ -717,11 +719,11 @@ static void dm320_rqenqueue(FAR struct dm320_ep_s *privep,
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int dm320_ep0write(ubyte *buf, uint16 nbytes)
|
||||
static int dm320_ep0write(uint8_t *buf, uint16_t nbytes)
|
||||
{
|
||||
ubyte csr0 = USB_PERCSR0_TXPKTRDY; /* XMT packet ready bit */
|
||||
uint16 bytesleft;
|
||||
uint16 nwritten;
|
||||
uint8_t csr0 = USB_PERCSR0_TXPKTRDY; /* XMT packet ready bit */
|
||||
uint16_t bytesleft;
|
||||
uint16_t nwritten;
|
||||
|
||||
if ( nbytes <= DM320_EP0MAXPACKET)
|
||||
{
|
||||
@ -752,10 +754,10 @@ static int dm320_ep0write(ubyte *buf, uint16 nbytes)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int dm320_epwrite(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
static int dm320_epwrite(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
|
||||
{
|
||||
volatile ubyte *fifo;
|
||||
uint16 bytesleft;
|
||||
volatile uint8_t *fifo;
|
||||
uint16_t bytesleft;
|
||||
int ret = ERROR;
|
||||
|
||||
if (/*epphy < USB_EP0_SELECT || */ epphy >= DM320_NENDPOINTS)
|
||||
@ -776,7 +778,7 @@ static int dm320_epwrite(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
}
|
||||
|
||||
ret = bytesleft;
|
||||
fifo = (volatile ubyte *)DM320_USB_FIFO0;
|
||||
fifo = (volatile uint8_t *)DM320_USB_FIFO0;
|
||||
fifo = fifo + (epphy << 2);
|
||||
|
||||
if (dm320_getreg8(DM320_USB_PERTXCSR1) & USB_TXCSR1_FIFOEMP)
|
||||
@ -803,9 +805,9 @@ static int dm320_epwrite(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int dm320_epread(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
static int dm320_epread(uint8_t epphy, uint8_t *buf, uint16_t nbytes)
|
||||
{
|
||||
volatile ubyte *fifo;
|
||||
volatile uint8_t *fifo;
|
||||
int bytesleft;
|
||||
int ret = ERROR;
|
||||
|
||||
@ -834,7 +836,7 @@ static int dm320_epread(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
}
|
||||
|
||||
ret = bytesleft;
|
||||
fifo = (ubyte*)DM320_USB_FIFO0;
|
||||
fifo = (uint8_t*)DM320_USB_FIFO0;
|
||||
fifo = fifo + (epphy << 2);
|
||||
|
||||
while (bytesleft > 0)
|
||||
@ -858,10 +860,10 @@ static int dm320_epread(ubyte epphy, ubyte *buf, uint16 nbytes)
|
||||
*******************************************************************************/
|
||||
|
||||
static inline void dm320_abortrequest(struct dm320_ep_s *privep,
|
||||
struct dm320_req_s *privreq,
|
||||
sint16 result)
|
||||
struct dm320_req_s *privreq,
|
||||
int16_t result)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_REQABORTED), (uint16)privep->epphy);
|
||||
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_REQABORTED), (uint16_t)privep->epphy);
|
||||
|
||||
/* Save the result in the request structure */
|
||||
|
||||
@ -880,7 +882,7 @@ static inline void dm320_abortrequest(struct dm320_ep_s *privep,
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static void dm320_reqcomplete(struct dm320_ep_s *privep, sint16 result)
|
||||
static void dm320_reqcomplete(struct dm320_ep_s *privep, int16_t result)
|
||||
{
|
||||
struct dm320_req_s *privreq;
|
||||
int stalled = privep->stalled;
|
||||
@ -935,7 +937,7 @@ static void dm320_reqcomplete(struct dm320_ep_s *privep, sint16 result)
|
||||
static int dm320_wrrequest(struct dm320_ep_s *privep)
|
||||
{
|
||||
struct dm320_req_s *privreq;
|
||||
ubyte *buf;
|
||||
uint8_t *buf;
|
||||
int nbytes;
|
||||
int bytesleft;
|
||||
int nbyteswritten;
|
||||
@ -1026,7 +1028,7 @@ static int dm320_wrrequest(struct dm320_ep_s *privep)
|
||||
static int dm320_rdrequest(struct dm320_ep_s *privep)
|
||||
{
|
||||
struct dm320_req_s *privreq;
|
||||
ubyte *buf;
|
||||
uint8_t *buf;
|
||||
int nbytesread;
|
||||
|
||||
/* Check the request from the head of the endpoint request queue */
|
||||
@ -1092,7 +1094,7 @@ static void dm320_cancelrequests(struct dm320_ep_s *privep)
|
||||
*******************************************************************************/
|
||||
|
||||
static struct dm320_ep_s *dm320_epfindbyaddr(struct dm320_usbdev_s *priv,
|
||||
uint16 eplog)
|
||||
uint16_t eplog)
|
||||
{
|
||||
struct dm320_ep_s *privep;
|
||||
int i;
|
||||
@ -1166,9 +1168,9 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
|
||||
struct dm320_req_s *privreq = dm320_rqpeek(ep0);
|
||||
struct dm320_ep_s *privep;
|
||||
struct usb_ctrlreq_s ctrl;
|
||||
uint16 index;
|
||||
uint16 value;
|
||||
uint16 len;
|
||||
uint16_t index;
|
||||
uint16_t value;
|
||||
uint16_t len;
|
||||
int ret;
|
||||
|
||||
/* Starting a control request? */
|
||||
@ -1182,7 +1184,7 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
|
||||
|
||||
while (!dm320_rqempty(ep0))
|
||||
{
|
||||
sint16 result = OK;
|
||||
int16_t result = OK;
|
||||
if (privreq->req.xfrd != privreq->req.len)
|
||||
{
|
||||
result = -EPROTO;
|
||||
@ -1199,7 +1201,7 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
|
||||
|
||||
/* Read EP0 data */
|
||||
|
||||
ret = dm320_epread(USB_EP0_SELECT, (ubyte*)&ctrl, USB_SIZEOF_CTRLREQ);
|
||||
ret = dm320_epread(USB_EP0_SELECT, (uint8_t*)&ctrl, USB_SIZEOF_CTRLREQ);
|
||||
if (ret <= 0)
|
||||
{
|
||||
return;
|
||||
@ -1285,7 +1287,7 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
|
||||
*/
|
||||
|
||||
dm320_putreg8(USB_PERCSR0_CLRRXRDY | USB_PERCSR0_DATAEND, DM320_USB_PERCSR0);
|
||||
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_CLEARFEATURE), (uint16)ctrl.req);
|
||||
usbtrace(TRACE_INTDECODE(DM320_TRACEINTID_CLEARFEATURE), (uint16_t)ctrl.req);
|
||||
if (ctrl.type != USB_REQ_RECIPIENT_ENDPOINT)
|
||||
{
|
||||
dm320_dispatchrequest(priv, &ctrl);
|
||||
@ -1433,7 +1435,7 @@ static inline void dm320_ep0setup(struct dm320_usbdev_s *priv)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static inline uint32 dm320_highestpriinterrupt(int intstatus)
|
||||
static inline uint32_t dm320_highestpriinterrupt(int intstatus)
|
||||
{
|
||||
if ((intstatus & USB_INT_CONNECTED) != 0)
|
||||
return USB_INT_CONNECTED;
|
||||
@ -1473,17 +1475,17 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context)
|
||||
{
|
||||
struct dm320_usbdev_s *priv = &g_usbdev;
|
||||
struct dm320_ep_s *privep ;
|
||||
uint32 intstatus;
|
||||
uint32 priorityint;
|
||||
ubyte csr0;
|
||||
uint32_t intstatus;
|
||||
uint32_t priorityint;
|
||||
uint8_t csr0;
|
||||
|
||||
usbtrace(TRACE_INTENTRY(DM320_TRACEINTID_USBCTLR), 0);
|
||||
|
||||
/* Combine interretup registers into one interrupt status value */
|
||||
|
||||
intstatus = ((uint32)dm320_getreg8(DM320_USB_INTRTX1) << 12) |
|
||||
(((uint32)dm320_getreg8(DM320_USB_INTRRX1) >> 1) << 8) |
|
||||
(uint32)dm320_getreg8(DM320_USB_INTRUSB);
|
||||
intstatus = ((uint32_t)dm320_getreg8(DM320_USB_INTRTX1) << 12) |
|
||||
(((uint32_t)dm320_getreg8(DM320_USB_INTRRX1) >> 1) << 8) |
|
||||
(uint32_t)dm320_getreg8(DM320_USB_INTRUSB);
|
||||
/* Then process each interrupt source, highest priority first */
|
||||
|
||||
do
|
||||
@ -1639,7 +1641,7 @@ static int dm320_ctlrinterrupt(int irq, FAR void *context)
|
||||
static int dm320_attachinterrupt(int irq, FAR void *context)
|
||||
{
|
||||
struct dm320_usbdev_s *priv = &g_usbdev;
|
||||
uint16 gio;
|
||||
uint16_t gio;
|
||||
|
||||
/* Check if the USB device was connected to or disconnected from a host */
|
||||
|
||||
@ -1708,9 +1710,9 @@ static void dm320_epreset(unsigned int index)
|
||||
|
||||
static inline void dm320_epinitialize(struct dm320_usbdev_s *priv)
|
||||
{
|
||||
uint16 offset; /* Full USB buffer offset */
|
||||
ubyte addrhi; /* MS bytes of ofset */
|
||||
ubyte addrlo; /* LS bytes of offset */
|
||||
uint16_t offset; /* Full USB buffer offset */
|
||||
uint8_t addrhi; /* MS bytes of ofset */
|
||||
uint8_t addrlo; /* LS bytes of offset */
|
||||
int i;
|
||||
|
||||
/* Initialize endpoint 0 */
|
||||
@ -1862,7 +1864,7 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
|
||||
* Input Parameters:
|
||||
* ep - the struct usbdev_ep_s instance obtained from allocep()
|
||||
* desc - A struct usb_epdesc_s instance describing the endpoint
|
||||
* last - TRUE if this this last endpoint to be configured. Some hardware
|
||||
* last - true if this this last endpoint to be configured. Some hardware
|
||||
* needs to take special action when all of the endpoints have been
|
||||
* configured.
|
||||
*
|
||||
@ -1870,7 +1872,7 @@ static void dm320_ctrlinitialize(FAR struct dm320_usbdev_s *priv)
|
||||
|
||||
static int dm320_epconfigure(FAR struct usbdev_ep_s *ep,
|
||||
FAR const struct usb_epdesc_s *desc,
|
||||
boolean last)
|
||||
bool last)
|
||||
{
|
||||
FAR struct dm320_ep_s *privep = (FAR struct dm320_ep_s *)ep;
|
||||
|
||||
@ -2141,14 +2143,14 @@ static int dm320_epcancel(struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req)
|
||||
* eplog - 7-bit logical endpoint number (direction bit ignored). Zero means
|
||||
* that any endpoint matching the other requirements will suffice. The
|
||||
* assigned endpoint can be found in the eplog field.
|
||||
* in - TRUE: IN (device-to-host) endpoint requested
|
||||
* in - true: IN (device-to-host) endpoint requested
|
||||
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
|
||||
* USB_EP_ATTR_XFER_INT}
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, ubyte eplog,
|
||||
boolean in, ubyte eptype)
|
||||
static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, uint8_t eplog,
|
||||
bool in, uint8_t eptype)
|
||||
{
|
||||
FAR struct dm320_usbdev_s *priv = (FAR struct dm320_usbdev_s *)dev;
|
||||
int ndx;
|
||||
@ -2212,7 +2214,7 @@ static FAR struct usbdev_ep_s *dm320_allocep(FAR struct usbdev_s *dev, ubyte epl
|
||||
static void dm320_freeep(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep)
|
||||
{
|
||||
FAR struct dm320_ep_s *privep = (FAR struct dm320_ep_s *)ep;
|
||||
usbtrace(TRACE_DEVFREEEP, (uint16)privep->epphy);
|
||||
usbtrace(TRACE_DEVFREEEP, (uint16_t)privep->epphy);
|
||||
|
||||
/* Nothing needs to be done */
|
||||
}
|
||||
@ -2278,11 +2280,11 @@ static int dm320_wakeup(struct usbdev_s *dev)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int dm320_selfpowered(struct usbdev_s *dev, boolean selfpowered)
|
||||
static int dm320_selfpowered(struct usbdev_s *dev, bool selfpowered)
|
||||
{
|
||||
struct dm320_usbdev_s *priv = &g_usbdev;
|
||||
|
||||
usbtrace(TRACE_DEVSELFPOWERED, (uint16)selfpowered);
|
||||
usbtrace(TRACE_DEVSELFPOWERED, (uint16_t)selfpowered);
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!dev)
|
||||
@ -2305,11 +2307,11 @@ static int dm320_selfpowered(struct usbdev_s *dev, boolean selfpowered)
|
||||
*******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DM320_GIO_USBDPPULLUP
|
||||
static int dm320_pullup(struct usbdev_s *dev, boolean enable)
|
||||
static int dm320_pullup(struct usbdev_s *dev, bool enable)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
usbtrace(TRACE_DEVPULLUP, (uint16)enable);
|
||||
usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
|
||||
|
||||
flags = irqsave();
|
||||
if (enable)
|
||||
@ -2343,7 +2345,7 @@ void up_usbinitialize(void)
|
||||
struct dm320_usbdev_s *priv = &g_usbdev;
|
||||
struct dm320_ep_s *privep;
|
||||
#ifdef CONFIG_DEBUG_USB
|
||||
uint16 chiprev;
|
||||
uint16_t chiprev;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
@ -2507,7 +2509,7 @@ int usbdev_register(FAR struct usbdevclass_driver_s *driver)
|
||||
ret = CLASS_BIND(driver, &g_usbdev.usbdev);
|
||||
if (ret)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_BINDFAILED), (uint16)-ret);
|
||||
usbtrace(TRACE_DEVERROR(DM320_TRACEERR_BINDFAILED), (uint16_t)-ret);
|
||||
g_usbdev.driver = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
@ -39,7 +39,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/mm.h>
|
||||
#include <nuttx/arch.h>
|
||||
@ -48,7 +50,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -98,8 +100,8 @@ void up_addregion(void)
|
||||
|
||||
#if !defined(CONFIG_BOOT_RUNFROMFLASH) && !defined(CONFIG_BOOT_COPYTORAM)
|
||||
# if (CONFIG_DRAM_NUTTXENTRY & 0xffff0000) != CONFIG_DRAM_VSTART
|
||||
uint32 start = CONFIG_DRAM_VSTART + 0x1000;
|
||||
uint32 end = (CONFIG_DRAM_NUTTXENTRY & 0xffff0000);
|
||||
uint32_t start = CONFIG_DRAM_VSTART + 0x1000;
|
||||
uint32_t end = (CONFIG_DRAM_NUTTXENTRY & 0xffff0000);
|
||||
mm_addregion((FAR void*)start, end - start);
|
||||
# endif
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -39,13 +39,13 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "up_arch.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Private Types
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
@ -54,18 +54,18 @@
|
||||
|
||||
struct section_mapping_s
|
||||
{
|
||||
uint32 physbase; /* Physical address of the region to be mapped */
|
||||
uint32 virtbase; /* Virtual address of the region to be mapped */
|
||||
uint32 mmuflags; /* MMU settings for the region (e.g., cache-able) */
|
||||
uint32 nsections; /* Number of mappings in the region */
|
||||
uint32_t physbase; /* Physical address of the region to be mapped */
|
||||
uint32_t virtbase; /* Virtual address of the region to be mapped */
|
||||
uint32_t mmuflags; /* MMU settings for the region (e.g., cache-able) */
|
||||
uint32_t nsections; /* Number of mappings in the region */
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Public Variables
|
||||
************************************************************************************/
|
||||
|
||||
extern uint32 _vector_start; /* Beginning of vector block */
|
||||
extern uint32 _vector_end; /* End+1 of vector block */
|
||||
extern uint32_t _vector_start; /* Beginning of vector block */
|
||||
extern uint32_t _vector_end; /* End+1 of vector block */
|
||||
|
||||
/************************************************************************************
|
||||
* Private Variables
|
||||
@ -114,10 +114,10 @@ extern void imx_boardinitialize(void);
|
||||
* Name: up_setlevel1entry
|
||||
************************************************************************************/
|
||||
|
||||
static inline void up_setlevel1entry(uint32 paddr, uint32 vaddr, uint32 mmuflags)
|
||||
static inline void up_setlevel1entry(uint32_t paddr, uint32_t vaddr, uint32_t mmuflags)
|
||||
{
|
||||
uint32 *pgtable = (uint32*)PGTABLE_VBASE;
|
||||
uint32 index = vaddr >> 20;
|
||||
uint32_t *pgtable = (uint32_t*)PGTABLE_VBASE;
|
||||
uint32_t index = vaddr >> 20;
|
||||
|
||||
/* Save the page table entry */
|
||||
|
||||
@ -134,9 +134,9 @@ static void up_setupmappings(void)
|
||||
|
||||
for (i = 0; i < NMAPPINGS; i++)
|
||||
{
|
||||
uint32 sect_paddr = section_mapping[i].physbase;
|
||||
uint32 sect_vaddr = section_mapping[i].virtbase;
|
||||
uint32 mmuflags = section_mapping[i].mmuflags;
|
||||
uint32_t sect_paddr = section_mapping[i].physbase;
|
||||
uint32_t sect_vaddr = section_mapping[i].virtbase;
|
||||
uint32_t mmuflags = section_mapping[i].mmuflags;
|
||||
|
||||
for (j = 0; j < section_mapping[i].nsections; j++)
|
||||
{
|
||||
@ -178,9 +178,9 @@ static void up_copyvectorblock(void)
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_BOOT_RUNFROMFLASH) && !defined(CONFIG_BOOT_COPYTORAM)
|
||||
uint32 *src = (uint32*)&_vector_start;
|
||||
uint32 *end = (uint32*)&_vector_end;
|
||||
uint32 *dest = (uint32*)VECTOR_BASE;
|
||||
uint32_t *src = (uint32_t*)&_vector_start;
|
||||
uint32_t *end = (uint32_t*)&_vector_end;
|
||||
uint32_t *dest = (uint32_t*)VECTOR_BASE;
|
||||
|
||||
while (src < end)
|
||||
{
|
||||
|
@ -41,11 +41,13 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
# include <nuttx/spi.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* CSPI Register Offsets ************************************************************/
|
||||
@ -189,8 +191,8 @@ extern "C" {
|
||||
* for example, will bind the SPI driver to the SPI MMC/SD driver).
|
||||
*/
|
||||
|
||||
EXTERN void imx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected);
|
||||
EXTERN ubyte imx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
EXTERN void imx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
|
||||
EXTERN uint8_t imx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
@ -39,7 +39,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
@ -50,7 +51,7 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/********************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
@ -69,15 +70,15 @@
|
||||
* Public Funtions
|
||||
********************************************************************************/
|
||||
|
||||
void up_decodeirq(uint32* regs)
|
||||
void up_decodeirq(uint32_t* regs)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
lib_lowprintf("Unexpected IRQ\n");
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
#else
|
||||
uint32 regval;
|
||||
int irq;
|
||||
uint32_t regval;
|
||||
int irq;
|
||||
|
||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||
* current_regs is also used to manage interrupt level context switches.
|
||||
|
@ -39,13 +39,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "imx_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -41,10 +41,13 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include "up_arch.h" /* getreg32(), putreg32() */
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* GPIO Register Offsets ************************************************************/
|
||||
@ -197,14 +200,14 @@
|
||||
|
||||
static inline void imxgpio_dirout(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_DDIR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_DDIR(port));
|
||||
regval |= (1 << bit);
|
||||
putreg32(regval, IMX_GPIO_DDIR(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_dirin(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_DDIR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_DDIR(port));
|
||||
regval &= ~(1 << bit);
|
||||
putreg32(regval, IMX_GPIO_DDIR(port));
|
||||
}
|
||||
@ -213,9 +216,9 @@ static inline void imxgpio_dirin(int port, int bit)
|
||||
|
||||
static inline void imxgpio_ocrain(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -235,9 +238,9 @@ static inline void imxgpio_ocrain(int port, int bit)
|
||||
|
||||
static inline void imxgpio_ocrbin(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -258,9 +261,9 @@ static inline void imxgpio_ocrbin(int port, int bit)
|
||||
|
||||
static inline void imxgpio_ocrcin(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -281,9 +284,9 @@ static inline void imxgpio_ocrcin(int port, int bit)
|
||||
|
||||
static inline void imxgpio_ocrodrin(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -305,9 +308,9 @@ static inline void imxgpio_ocrodrin(int port, int bit)
|
||||
|
||||
static inline void imxgpio_aoutgpio(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -327,9 +330,9 @@ static inline void imxgpio_aoutgpio(int port, int bit)
|
||||
|
||||
static inline void imxgpio_aoutisr(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -350,9 +353,9 @@ static inline void imxgpio_aoutisr(int port, int bit)
|
||||
|
||||
static inline void imxgpio_aout0(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -373,9 +376,9 @@ static inline void imxgpio_aout0(int port, int bit)
|
||||
|
||||
static inline void imxgpio_aout1(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -395,9 +398,9 @@ static inline void imxgpio_aout1(int port, int bit)
|
||||
|
||||
static inline void imxgpio_boutgpio(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -417,9 +420,9 @@ static inline void imxgpio_boutgpio(int port, int bit)
|
||||
|
||||
static inline void imxgpio_boutisr(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -440,9 +443,9 @@ static inline void imxgpio_boutisr(int port, int bit)
|
||||
|
||||
static inline void imxgpio_bout0(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -463,9 +466,9 @@ static inline void imxgpio_bout0(int port, int bit)
|
||||
|
||||
static inline void imxgpio_bout1(int port, int bit)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32 regaddr;
|
||||
int shift;
|
||||
uint32_t regval;
|
||||
uint32_t regaddr;
|
||||
int shift;
|
||||
|
||||
if (bit < 16)
|
||||
{
|
||||
@ -490,28 +493,28 @@ static inline void imxgpio_bout1(int port, int bit)
|
||||
|
||||
static inline void imxgpio_gpiofunc(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_GIUS(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_GIUS(port));
|
||||
regval |= (1 << bit);
|
||||
putreg32(regval, IMX_GPIO_GIUS(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_peripheralfunc(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_GIUS(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_GIUS(port));
|
||||
regval &= ~(1 << bit);
|
||||
putreg32(regval, IMX_GPIO_GIUS(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_altperipheralfunc(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_GPR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_GPR(port));
|
||||
regval |= (1 << bit);
|
||||
putreg32(regval, IMX_GPIO_GPR(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_primaryperipheralfunc(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_GPR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_GPR(port));
|
||||
regval &= ~(1 << bit);
|
||||
putreg32(regval, IMX_GPIO_GPR(port));
|
||||
}
|
||||
@ -520,28 +523,28 @@ static inline void imxgpio_primaryperipheralfunc(int port, int bit)
|
||||
|
||||
static inline void imxgpio_pullupenable(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_PUEN(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_PUEN(port));
|
||||
regval |= (1 << bit);
|
||||
putreg32(regval, IMX_GPIO_PUEN(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_pullupdisable(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_PUEN(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_PUEN(port));
|
||||
regval &= ~(1 << bit);
|
||||
putreg32(regval, IMX_GPIO_PUEN(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_setoutput(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_DR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_DR(port));
|
||||
regval |= (1 << bit);
|
||||
putreg32(regval, IMX_GPIO_DR(port));
|
||||
}
|
||||
|
||||
static inline void imxgpio_clroutput(int port, int bit)
|
||||
{
|
||||
uint32 regval = getreg32(IMX_GPIO_DR(port));
|
||||
uint32_t regval = getreg32(IMX_GPIO_DR(port));
|
||||
regval &= ~(1 << bit);
|
||||
putreg32(regval, IMX_GPIO_DR(port));
|
||||
}
|
||||
|
@ -39,7 +39,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
@ -47,14 +48,14 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
uint32 *current_regs;
|
||||
uint32_t *current_regs;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
@ -60,7 +62,7 @@
|
||||
#ifdef CONFIG_USE_SERIALDRIVER
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
@ -77,46 +79,46 @@
|
||||
|
||||
struct up_dev_s
|
||||
{
|
||||
uint32 uartbase; /* Base address of UART registers */
|
||||
uint32 baud; /* Configured baud */
|
||||
uint32 ucr1; /* Saved UCR1 value */
|
||||
uint32_t uartbase; /* Base address of UART registers */
|
||||
uint32_t baud; /* Configured baud */
|
||||
uint32_t ucr1; /* Saved UCR1 value */
|
||||
#if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL)
|
||||
ubyte rxirq; /* Rx IRQ associated with this UART */
|
||||
ubyte txirq; /* Tx IRQ associated with this UART */
|
||||
uint8_t rxirq; /* Rx IRQ associated with this UART */
|
||||
uint8_t txirq; /* Tx IRQ associated with this UART */
|
||||
#else
|
||||
ubyte irq; /* IRQ associated with this UART */
|
||||
uint8_t irq; /* IRQ associated with this UART */
|
||||
#endif
|
||||
ubyte parity; /* 0=none, 1=odd, 2=even */
|
||||
ubyte bits; /* Number of bits (7 or 8) */
|
||||
ubyte stopbits2:1; /* 1: Configure with 2 stop bits vs 1 */
|
||||
ubyte hwfc:1; /* 1: Hardware flow control */
|
||||
ubyte reserved:6;
|
||||
uint8_t parity; /* 0=none, 1=odd, 2=even */
|
||||
uint8_t bits; /* Number of bits (7 or 8) */
|
||||
uint8_t stopbits2:1; /* 1: Configure with 2 stop bits vs 1 */
|
||||
uint8_t hwfc:1; /* 1: Hardware flow control */
|
||||
uint8_t reserved:6;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset);
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 value);
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1);
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint32 ucr1);
|
||||
static inline uint32_t up_serialin(struct up_dev_s *priv, uint32_t offset);
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint32_t value);
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ucr1);
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ucr1);
|
||||
static inline void up_waittxready(struct up_dev_s *priv);
|
||||
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static int up_setup(struct uart_dev_s *dev);
|
||||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static inline struct uart_dev_s *up_mapirq(int irq);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, uint32 *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable);
|
||||
static boolean up_txready(struct uart_dev_s *dev);
|
||||
static boolean up_txempty(struct uart_dev_s *dev);
|
||||
static int up_interrupt(int irq, void *context);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, uint32_t *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_rxavailable(struct uart_dev_s *dev);
|
||||
static void up_send(struct uart_dev_s *dev, int ch);
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable);
|
||||
static bool up_txready(struct uart_dev_s *dev);
|
||||
static bool up_txempty(struct uart_dev_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
@ -372,7 +374,7 @@ static uart_dev_t g_uart3port =
|
||||
* Name: up_serialin
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset)
|
||||
static inline uint32_t up_serialin(struct up_dev_s *priv, uint32_t offset)
|
||||
{
|
||||
return getreg32(priv->uartbase + offset);
|
||||
}
|
||||
@ -381,7 +383,7 @@ static inline uint32 up_serialin(struct up_dev_s *priv, uint32 offset)
|
||||
* Name: up_serialout
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 value)
|
||||
static inline void up_serialout(struct up_dev_s *priv, uint32_t offset, uint32_t value)
|
||||
{
|
||||
putreg32(value, priv->uartbase + offset);
|
||||
}
|
||||
@ -390,7 +392,7 @@ static inline void up_serialout(struct up_dev_s *priv, uint32 offset, uint32 val
|
||||
* Name: up_disableuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1)
|
||||
static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ucr1)
|
||||
{
|
||||
/* Return the current Rx and Tx interrupt state */
|
||||
|
||||
@ -409,7 +411,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32 *ucr1)
|
||||
* Name: up_restoreuartint
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint32 ucr1)
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ucr1)
|
||||
{
|
||||
/* Enable/disable any interrupts that are currently disabled but should be
|
||||
* enabled/disabled.
|
||||
@ -451,11 +453,11 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint32 regval;
|
||||
uint32 ucr2;
|
||||
uint32 div;
|
||||
uint32 num;
|
||||
uint32 den;
|
||||
uint32_t regval;
|
||||
uint32_t ucr2;
|
||||
uint32_t div;
|
||||
uint32_t num;
|
||||
uint32_t den;
|
||||
|
||||
/* Disable the UART */
|
||||
|
||||
@ -564,7 +566,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
/* b16 is a scale such that b16*num = 0x10000 * 2**16 */
|
||||
|
||||
uint32 b16 = 0x100000000LL / num;
|
||||
uint32_t b16 = 0x100000000LL / num;
|
||||
num = 0x00010000;
|
||||
den = (b16 * den) >> 16;
|
||||
}
|
||||
@ -575,7 +577,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
/* b16 is a scale such that b16*den = 0x10000 * 2**16 */
|
||||
|
||||
uint32 b16 = 0x100000000LL / den;
|
||||
uint32_t b16 = 0x100000000LL / den;
|
||||
num = (b16 * num) >> 16;
|
||||
den = 0x00010000;
|
||||
}
|
||||
@ -818,7 +820,7 @@ static int up_interrupt(int irq, void *context)
|
||||
{
|
||||
struct uart_dev_s *dev;
|
||||
struct up_dev_s *priv;
|
||||
uint32 usr1;
|
||||
uint32_t usr1;
|
||||
int passes = 0;
|
||||
|
||||
dev = up_mapirq(irq);
|
||||
@ -915,10 +917,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int up_receive(struct uart_dev_s *dev, uint32 *status)
|
||||
static int up_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint32 rxd0;
|
||||
uint32_t rxd0;
|
||||
|
||||
rxd0 = up_serialin(priv, UART_RXD0);
|
||||
*status = rxd0;
|
||||
@ -933,7 +935,7 @@ static int up_receive(struct uart_dev_s *dev, uint32 *status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
|
||||
@ -956,11 +958,11 @@ static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_rxavailable
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the receive fifo is not empty
|
||||
* Return true if the receive fifo is not empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static bool up_rxavailable(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
|
||||
@ -980,7 +982,7 @@ static boolean up_rxavailable(struct uart_dev_s *dev)
|
||||
static void up_send(struct uart_dev_s *dev, int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
up_serialout(priv, UART_TXD0, (uint32)ch);
|
||||
up_serialout(priv, UART_TXD0, (uint32_t)ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -991,7 +993,7 @@ static void up_send(struct uart_dev_s *dev, int ch)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
|
||||
@ -1016,11 +1018,11 @@ static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
* Name: up_txready
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the tranmsit fifo is not full
|
||||
* Return true if the tranmsit fifo is not full
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txready(struct uart_dev_s *dev)
|
||||
static bool up_txready(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
|
||||
@ -1033,11 +1035,11 @@ static boolean up_txready(struct uart_dev_s *dev)
|
||||
* Name: up_txempty
|
||||
*
|
||||
* Description:
|
||||
* Return TRUE if the transmit fifo is empty
|
||||
* Return true if the transmit fifo is empty
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static boolean up_txempty(struct uart_dev_s *dev)
|
||||
static bool up_txempty(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
|
||||
@ -1113,7 +1115,7 @@ void up_earlyserialinit(void)
|
||||
*/
|
||||
|
||||
#ifdef CONSOLE_DEV
|
||||
CONSOLE_DEV.isconsole = TRUE;
|
||||
CONSOLE_DEV.isconsole = true;
|
||||
up_setup(&CONSOLE_DEV);
|
||||
#endif
|
||||
}
|
||||
@ -1156,7 +1158,7 @@ void up_serialinit(void)
|
||||
int up_putc(int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||
uint32 ier;
|
||||
uint32_t ier;
|
||||
|
||||
up_disableuartint(priv, &ier);
|
||||
up_waittxready(priv);
|
||||
@ -1167,11 +1169,11 @@ int up_putc(int ch)
|
||||
{
|
||||
/* Add CR */
|
||||
|
||||
up_serialout(priv, UART_TXD0, (uint32)'\r');
|
||||
up_serialout(priv, UART_TXD0, (uint32_t)'\r');
|
||||
up_waittxready(priv);
|
||||
}
|
||||
|
||||
up_serialout(priv, UART_TXD0, (uint32)ch);
|
||||
up_serialout(priv, UART_TXD0, (uint32_t)ch);
|
||||
up_waittxready(priv);
|
||||
up_restoreuartint(priv, ier);
|
||||
return ch;
|
||||
@ -1227,11 +1229,11 @@ int up_putc(int ch)
|
||||
{
|
||||
/* Add CR */
|
||||
|
||||
putreg32((uint16)'\r', IMX_REGISTER_BASE + UART_TXD0);
|
||||
putreg32((uint16_t)'\r', IMX_REGISTER_BASE + UART_TXD0);
|
||||
up_waittxready();
|
||||
}
|
||||
|
||||
putreg32((uint16)ch, IMX_REGISTER_BASE + UART_TXD0);
|
||||
putreg32((uint16_t)ch, IMX_REGISTER_BASE + UART_TXD0);
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -56,7 +58,7 @@
|
||||
#include "imx_cspi.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The i.MX1/L supports 2 SPI interfaces. Which have been enabled? */
|
||||
@ -101,8 +103,8 @@ struct imx_spidev_s
|
||||
|
||||
/* These following are the source and destination buffers of the transfer.
|
||||
* they are retained in this structure so that they will be accessible
|
||||
* from an interrupt handler. The actual type of the buffer is ubyte is
|
||||
* nbits <=8 and uint16 is nbits >8.
|
||||
* from an interrupt handler. The actual type of the buffer is uint8_t is
|
||||
* nbits <=8 and uint16_t is nbits >8.
|
||||
*/
|
||||
|
||||
void *txbuffer; /* Source buffer */
|
||||
@ -118,18 +120,18 @@ struct imx_spidev_s
|
||||
void (*txword)(struct imx_spidev_s *priv);
|
||||
void (*rxword)(struct imx_spidev_s *priv);
|
||||
|
||||
uint32 base; /* SPI register base address */
|
||||
uint32 frequency; /* Current desired SCLK frequency */
|
||||
uint32 actual; /* Current actual SCLK frequency */
|
||||
uint32_t base; /* SPI register base address */
|
||||
uint32_t frequency; /* Current desired SCLK frequency */
|
||||
uint32_t actual; /* Current actual SCLK frequency */
|
||||
|
||||
int ntxwords; /* Number of words left to transfer on the Tx FIFO */
|
||||
int nrxwords; /* Number of words received on the Rx FIFO */
|
||||
int nwords; /* Number of words to be exchanged */
|
||||
|
||||
ubyte mode; /* Current mode */
|
||||
ubyte nbits; /* Current number of bits per word */
|
||||
uint8_t mode; /* Current mode */
|
||||
uint8_t nbits; /* Current number of bits per word */
|
||||
#ifndef CONFIG_SPI_POLLWAIT
|
||||
ubyte irq; /* SPI IRQ number */
|
||||
uint8_t irq; /* SPI IRQ number */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -139,17 +141,17 @@ struct imx_spidev_s
|
||||
|
||||
/* SPI register access */
|
||||
|
||||
static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset);
|
||||
static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32 value);
|
||||
static inline uint32_t spi_getreg(struct imx_spidev_s *priv, unsigned int offset);
|
||||
static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32_t value);
|
||||
|
||||
/* SPI data transfer */
|
||||
|
||||
static void spi_txnull(struct imx_spidev_s *priv);
|
||||
static void spi_txuint16(struct imx_spidev_s *priv);
|
||||
static void spi_txubyte(struct imx_spidev_s *priv);
|
||||
static void spi_txuint8(struct imx_spidev_s *priv);
|
||||
static void spi_rxnull(struct imx_spidev_s *priv);
|
||||
static void spi_rxuint16(struct imx_spidev_s *priv);
|
||||
static void spi_rxubyte(struct imx_spidev_s *priv);
|
||||
static void spi_rxuint16(struct imx_spidev_s *priv);
|
||||
static void spi_rxuint8(struct imx_spidev_s *priv);
|
||||
static int spi_performtx(struct imx_spidev_s *priv);
|
||||
static inline void spi_performrx(struct imx_spidev_s *priv);
|
||||
static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer,
|
||||
@ -164,10 +166,10 @@ static int spi_interrupt(int irq, void *context);
|
||||
|
||||
/* SPI methods */
|
||||
|
||||
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency);
|
||||
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
|
||||
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
|
||||
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
|
||||
static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd);
|
||||
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd);
|
||||
#ifdef CONFIG_SPI_EXCHANGE
|
||||
static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
|
||||
FAR void *rxbuffer, size_t nwords);
|
||||
@ -246,7 +248,7 @@ static struct imx_spidev_s g_spidev[] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset)
|
||||
static inline uint32_t spi_getreg(struct imx_spidev_s *priv, unsigned int offset)
|
||||
{
|
||||
return getreg32(priv->base + offset);
|
||||
}
|
||||
@ -267,16 +269,16 @@ static inline uint32 spi_getreg(struct imx_spidev_s *priv, unsigned int offset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32 value)
|
||||
static inline void spi_putreg(struct imx_spidev_s *priv, unsigned int offset, uint32_t value)
|
||||
{
|
||||
putreg32(value, priv->base + offset);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: spi_txnull, spi_txuint16, and spi_txubyte
|
||||
* Name: spi_txnull, spi_txuint16, and spi_txuint8
|
||||
*
|
||||
* Description:
|
||||
* Transfer all ones, a ubyte, or uint16 to Tx FIFO and update the txbuffer
|
||||
* Transfer all ones, a uint8_t, or uint16_t to Tx FIFO and update the txbuffer
|
||||
* pointer appropriately. The selected function dependes on (1) if there
|
||||
* is a source txbuffer provided, and (2) if the number of bits per
|
||||
* word is <=8 or >8.
|
||||
@ -296,23 +298,23 @@ static void spi_txnull(struct imx_spidev_s *priv)
|
||||
|
||||
static void spi_txuint16(struct imx_spidev_s *priv)
|
||||
{
|
||||
uint16 *ptr = (uint16*)priv->txbuffer;
|
||||
uint16_t *ptr = (uint16_t*)priv->txbuffer;
|
||||
spi_putreg(priv, CSPI_TXD_OFFSET, *ptr++);
|
||||
priv->txbuffer = (void*)ptr;
|
||||
}
|
||||
|
||||
static void spi_txubyte(struct imx_spidev_s *priv)
|
||||
static void spi_txuint8(struct imx_spidev_s *priv)
|
||||
{
|
||||
ubyte *ptr = (ubyte*)priv->txbuffer;
|
||||
uint8_t *ptr = (uint8_t*)priv->txbuffer;
|
||||
spi_putreg(priv, CSPI_TXD_OFFSET, *ptr++);
|
||||
priv->txbuffer = (void*)ptr;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: spi_rxnull, spi_rxuint16, and spi_rxubyte
|
||||
* Name: spi_rxnull,spi_rxuint16, and spi_rxuint8
|
||||
*
|
||||
* Description:
|
||||
* Discard input, save a ubyte, or or save a uint16 from Tx FIFO in the
|
||||
* Discard input, save a uint8_t, or or save a uint16_t from Tx FIFO in the
|
||||
* user rxvbuffer and update the rxbuffer pointer appropriately. The
|
||||
* selected function dependes on (1) if there is a desination rxbuffer
|
||||
* provided, and (2) if the number of bits per word is <=8 or >8.
|
||||
@ -330,17 +332,17 @@ static void spi_rxnull(struct imx_spidev_s *priv)
|
||||
(void)spi_getreg(priv, CSPI_RXD_OFFSET);
|
||||
}
|
||||
|
||||
static void spi_rxuint16(struct imx_spidev_s *priv)
|
||||
static voidspi_rxuint16(struct imx_spidev_s *priv)
|
||||
{
|
||||
uint16 *ptr = (uint16*)priv->rxbuffer;
|
||||
*ptr++ = (uint16)spi_getreg(priv, CSPI_TXD_OFFSET);
|
||||
uint16_t *ptr = (uint16_t*)priv->rxbuffer;
|
||||
*ptr++ = (uint16_t)spi_getreg(priv, CSPI_TXD_OFFSET);
|
||||
priv->rxbuffer = (void*)ptr;
|
||||
}
|
||||
|
||||
static void spi_rxubyte(struct imx_spidev_s *priv)
|
||||
static void spi_rxuint8(struct imx_spidev_s *priv)
|
||||
{
|
||||
ubyte *ptr = (ubyte*)priv->rxbuffer;
|
||||
*ptr++ = (ubyte)spi_getreg(priv, CSPI_TXD_OFFSET);
|
||||
uint8_t *ptr = (uint8_t*)priv->rxbuffer;
|
||||
*ptr++ = (uint8_t)spi_getreg(priv, CSPI_TXD_OFFSET);
|
||||
priv->rxbuffer = (void*)ptr;
|
||||
}
|
||||
|
||||
@ -362,7 +364,7 @@ static void spi_rxubyte(struct imx_spidev_s *priv)
|
||||
|
||||
static int spi_performtx(struct imx_spidev_s *priv)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
int ntxd = 0; /* Number of words written to Tx FIFO */
|
||||
|
||||
/* Check if the Tx FIFO is empty */
|
||||
@ -448,7 +450,7 @@ static inline void spi_performrx(struct imx_spidev_s *priv)
|
||||
|
||||
static void spi_startxfr(struct imx_spidev_s *priv, int ntxd)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
|
||||
/* The XCH bit initiates an exchange in master mode. It remains set
|
||||
* remains set while the exchange is in progress but is automatically
|
||||
@ -476,9 +478,9 @@ static void spi_startxfr(struct imx_spidev_s *priv, int ntxd)
|
||||
* txbuffer - The buffer of data to send to the device (may be NULL).
|
||||
* rxbuffer - The buffer to receive data from the device (may be NULL).
|
||||
* nwords - The total number of words to be exchanged. If the interface
|
||||
* uses <= 8 bits per word, then this is the number of ubytes;
|
||||
* uses <= 8 bits per word, then this is the number of uint8_t's;
|
||||
* if the interface uses >8 bits per word, then this is the
|
||||
* number of uint16's
|
||||
* number of uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* 0: success, <0:Negated error number on failure
|
||||
@ -491,14 +493,14 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer,
|
||||
#ifndef CONFIG_SPI_POLLWAIT
|
||||
irqstate_t flags;
|
||||
#endif
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
int ntxd;
|
||||
int ret;
|
||||
|
||||
/* Set up to perform the transfer */
|
||||
|
||||
priv->txbuffer = (ubyte*)txbuffer; /* Source buffer */
|
||||
priv->rxbuffer = (ubyte*)rxbuffer; /* Destination buffer */
|
||||
priv->txbuffer = (uint8_t*)txbuffer; /* Source buffer */
|
||||
priv->rxbuffer = (uint8_t*)rxbuffer; /* Destination buffer */
|
||||
priv->ntxwords = nwords; /* Number of words left to send */
|
||||
priv->nrxwords = 0; /* Number of words received */
|
||||
priv->nwords = nwords; /* Total number of exchanges */
|
||||
@ -508,12 +510,12 @@ static int spi_transfer(struct imx_spidev_s *priv, const void *txbuffer,
|
||||
if (priv->nbits > 8)
|
||||
{
|
||||
priv->txword = spi_txuint16;
|
||||
priv->rxword = spi_rxuint16;
|
||||
priv->rxword =spi_rxuint16;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->txword = spi_txubyte;
|
||||
priv->rxword = spi_rxubyte;
|
||||
priv->txword = spi_txuint8;
|
||||
priv->rxword = spi_rxuint8;
|
||||
}
|
||||
|
||||
if (!txbuffer)
|
||||
@ -629,9 +631,9 @@ static inline struct imx_spidev_s *spi_mapirq(int irq)
|
||||
* txbuffer - The buffer of data to send to the device (may be NULL).
|
||||
* rxbuffer - The buffer to receive data from the device (may be NULL).
|
||||
* nwords - The total number of words to be exchanged. If the interface
|
||||
* uses <= 8 bits per word, then this is the number of ubytes;
|
||||
* uses <= 8 bits per word, then this is the number of uint8_t's;
|
||||
* if the interface uses >8 bits per word, then this is the
|
||||
* number of uint16's
|
||||
* number of uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* 0: success, <0:Negated error number on failure
|
||||
@ -685,15 +687,15 @@ static int spi_interrupt(int irq, void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency)
|
||||
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
|
||||
{
|
||||
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
|
||||
uint32 actual = priv->actual;
|
||||
uint32_t actual = priv->actual;
|
||||
|
||||
if (priv && frequency != priv->frequency)
|
||||
{
|
||||
uint32 freqbits;
|
||||
uint32 regval;
|
||||
uint32_t freqbits;
|
||||
uint32_t regval;
|
||||
|
||||
if (frequency >= IMX_PERCLK2_FREQ / 4)
|
||||
{
|
||||
@ -770,8 +772,8 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
|
||||
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
|
||||
if (priv && mode != priv->mode)
|
||||
{
|
||||
uint32 modebits;
|
||||
uint32 regval;
|
||||
uint32_t modebits;
|
||||
uint32_t regval;
|
||||
|
||||
/* Select the CTL register bits based on the selected mode */
|
||||
|
||||
@ -826,7 +828,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
|
||||
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
|
||||
if (priv && nbits != priv->nbits && nbits > 0 && nbits <= 16)
|
||||
{
|
||||
uint32 regval = spi_getreg(priv, CSPI_CTRL_OFFSET);
|
||||
uint32_t regval = spi_getreg(priv, CSPI_CTRL_OFFSET);
|
||||
regval &= ~CSPI_CTRL_BITCOUNT_MASK;
|
||||
regval |= ((nbits - 1) << CSPI_CTRL_BITCOUNT_SHIFT);
|
||||
spi_putreg(priv, CSPI_CTRL_OFFSET, regval);
|
||||
@ -850,10 +852,10 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd)
|
||||
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
|
||||
{
|
||||
struct imx_spidev_s *priv = (struct imx_spidev_s*)dev;
|
||||
uint16 response = 0;
|
||||
uint16_t response = 0;
|
||||
|
||||
(void)spi_transfer(priv, &wd, &response, 1);
|
||||
return response;
|
||||
@ -872,7 +874,7 @@ static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd)
|
||||
* nwords - the length of data that to be exchanged in units of words.
|
||||
* The wordsize is determined by the number of bits-per-word
|
||||
* selected for the SPI interface. If nbits <= 8, the data is
|
||||
* packed into ubytes; if nbits >8, the data is packed into uint16's
|
||||
* packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@ -900,7 +902,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
|
||||
* nwords - the length of data to send from the buffer in number of words.
|
||||
* The wordsize is determined by the number of bits-per-word
|
||||
* selected for the SPI interface. If nbits <= 8, the data is
|
||||
* packed into ubytes; if nbits >8, the data is packed into uint16's
|
||||
* packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@ -927,7 +929,7 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
|
||||
* nwords - the length of data that can be received in the buffer in number
|
||||
* of words. The wordsize is determined by the number of bits-per-word
|
||||
* selected for the SPI interface. If nbits <= 8, the data is
|
||||
* packed into ubytes; if nbits >8, the data is packed into uint16's
|
||||
* packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@ -971,7 +973,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
|
||||
FAR struct spi_dev_s *up_spiinitialize(int port)
|
||||
{
|
||||
struct imx_spidev_s *priv;
|
||||
ubyte regval;
|
||||
uint8_t regval;
|
||||
|
||||
/* Only the SPI1 interface is supported */
|
||||
|
||||
|
@ -39,7 +39,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
#include <nuttx/arch.h>
|
||||
@ -49,7 +50,7 @@
|
||||
#include "up_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -73,9 +74,9 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_timerisr(int irq, uint32 *regs)
|
||||
int up_timerisr(int irq, uint32_t *regs)
|
||||
{
|
||||
uint32 tstat;
|
||||
uint32_t tstat;
|
||||
int ret = -EIO;
|
||||
|
||||
/* Get and clear the interrupt status */
|
||||
@ -107,7 +108,7 @@ int up_timerisr(int irq, uint32 *regs)
|
||||
|
||||
void up_timerinit(void)
|
||||
{
|
||||
uint32 tctl;
|
||||
uint32_t tctl;
|
||||
|
||||
/* Make sure the timer interrupts are disabled */
|
||||
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Get customizations for each supported chip (only the LM3S6918 right now) */
|
||||
|
@ -38,8 +38,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
@ -50,7 +51,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -59,7 +60,7 @@
|
||||
|
||||
/* NOTE: this is duplicated in lm3s_gpio.c */
|
||||
|
||||
static const uint32 g_gpiobase[8] =
|
||||
static const uint32_t g_gpiobase[8] =
|
||||
{
|
||||
LM3S_GPIOA_BASE, LM3S_GPIOB_BASE, LM3S_GPIOC_BASE, LM3S_GPIOD_BASE,
|
||||
LM3S_GPIOE_BASE, LM3S_GPIOF_BASE, LM3S_GPIOG_BASE, LM3S_GPIOH_BASE,
|
||||
@ -80,7 +81,7 @@ static const char g_portchar[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 lm3s_gpiobaseaddress(int port)
|
||||
static inline uint32_t lm3s_gpiobaseaddress(int port)
|
||||
{
|
||||
return g_gpiobase[port & 7];
|
||||
}
|
||||
@ -94,7 +95,7 @@ static inline uint32 lm3s_gpiobaseaddress(int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline ubyte lm3s_gpioport(int port)
|
||||
static inline uint8_t lm3s_gpioport(int port)
|
||||
{
|
||||
return g_portchar[port & 7];
|
||||
}
|
||||
@ -111,13 +112,13 @@ static inline ubyte lm3s_gpioport(int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lm3s_dumpgpio(uint32 pinset, const char *msg)
|
||||
int lm3s_dumpgpio(uint32_t pinset, const char *msg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
unsigned int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
||||
uint32 base;
|
||||
uint32 rcgc2;
|
||||
boolean enabled;
|
||||
uint32_t base;
|
||||
uint32_t rcgc2;
|
||||
bool enabled;
|
||||
|
||||
/* Get the base address associated with the GPIO port */
|
||||
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_LM3S_ETHERNET)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
@ -58,7 +60,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Half duplex can be forced if CONFIG_LM3S_ETHHDUPLEX is defined. */
|
||||
@ -159,18 +161,18 @@
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct ez80mac_statistics_s
|
||||
{
|
||||
uint32 rx_int; /* Number of Rx interrupts received */
|
||||
uint32 rx_packets; /* Number of packets received (sum of the following): */
|
||||
uint32 rx_ip; /* Number of Rx IP packets received */
|
||||
uint32 rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32 rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32 rx_pktsize; /* Number of dropped, too small or too bigr */
|
||||
uint32 rx_errors; /* Number of Rx errors (reception error) */
|
||||
uint32 rx_ovrerrors; /* Number of Rx FIFO overrun errors */
|
||||
uint32 tx_int; /* Number of Tx interrupts received */
|
||||
uint32 tx_packets; /* Number of Tx packets queued */
|
||||
uint32 tx_errors; /* Number of Tx errors (transmission error)*/
|
||||
uint32 tx_timeouts; /* Number of Tx timeout errors */
|
||||
uint32_t rx_int; /* Number of Rx interrupts received */
|
||||
uint32_t rx_packets; /* Number of packets received (sum of the following): */
|
||||
uint32_t rx_ip; /* Number of Rx IP packets received */
|
||||
uint32_t rx_arp; /* Number of Rx ARP packets received */
|
||||
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
|
||||
uint32_t rx_pktsize; /* Number of dropped, too small or too bigr */
|
||||
uint32_t rx_errors; /* Number of Rx errors (reception error) */
|
||||
uint32_t rx_ovrerrors; /* Number of Rx FIFO overrun errors */
|
||||
uint32_t tx_int; /* Number of Tx interrupts received */
|
||||
uint32_t tx_packets; /* Number of Tx packets queued */
|
||||
uint32_t tx_errors; /* Number of Tx errors (transmission error)*/
|
||||
uint32_t tx_timeouts; /* Number of Tx timeout errors */
|
||||
};
|
||||
# define EMAC_STAT(priv,name) priv->ld_stat.name++
|
||||
#else
|
||||
@ -188,13 +190,13 @@ struct lm3s_driver_s
|
||||
*/
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
uint32 ld_base; /* Ethernet controller base address */
|
||||
int ld-irq; /* Ethernet controller IRQ */
|
||||
uint32_t ld_base; /* Ethernet controller base address */
|
||||
int ld-irq; /* Ethernet controller IRQ */
|
||||
#endif
|
||||
|
||||
boolean ld_bifup; /* TRUE:ifup FALSE:ifdown */
|
||||
WDOG_ID ld_txpoll; /* TX poll timer */
|
||||
WDOG_ID ld_txtimeout; /* TX timeout timer */
|
||||
bool ld_bifup; /* true:ifup false:ifdown */
|
||||
WDOG_ID ld_txpoll; /* TX poll timer */
|
||||
WDOG_ID ld_txtimeout; /* TX timeout timer */
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
|
||||
struct ez80mac_statistics_s ld_stat;
|
||||
@ -218,39 +220,39 @@ static struct lm3s_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS];
|
||||
/* Miscellaneous low level helpers */
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
static uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset);
|
||||
static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value);
|
||||
static uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset);
|
||||
static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value);
|
||||
#else
|
||||
static inline uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset);
|
||||
static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value);
|
||||
static inline uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset);
|
||||
static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value);
|
||||
#endif
|
||||
static void lm3s_ethreset(struct lm3s_driver_s *priv);
|
||||
static void lm3s_ethreset(struct lm3s_driver_s *priv);
|
||||
#if 0 /* Not used */
|
||||
static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16 value);
|
||||
static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16_t value);
|
||||
#endif
|
||||
static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr);
|
||||
static uint16_t lm3s_phyread(struct lm3s_driver_s *priv, int regaddr);
|
||||
|
||||
/* Common TX logic */
|
||||
|
||||
static int lm3s_transmit(struct lm3s_driver_s *priv);
|
||||
static int lm3s_uiptxpoll(struct uip_driver_s *dev);
|
||||
static int lm3s_transmit(struct lm3s_driver_s *priv);
|
||||
static int lm3s_uiptxpoll(struct uip_driver_s *dev);
|
||||
|
||||
/* Interrupt handling */
|
||||
|
||||
static void lm3s_receive(struct lm3s_driver_s *priv);
|
||||
static void lm3s_txdone(struct lm3s_driver_s *priv);
|
||||
static int lm3s_interrupt(int irq, FAR void *context);
|
||||
static void lm3s_receive(struct lm3s_driver_s *priv);
|
||||
static void lm3s_txdone(struct lm3s_driver_s *priv);
|
||||
static int lm3s_interrupt(int irq, FAR void *context);
|
||||
|
||||
/* Watchdog timer expirations */
|
||||
|
||||
static void lm3s_polltimer(int argc, uint32 arg, ...);
|
||||
static void lm3s_txtimeout(int argc, uint32 arg, ...);
|
||||
static void lm3s_polltimer(int argc, uint32_t arg, ...);
|
||||
static void lm3s_txtimeout(int argc, uint32_t arg, ...);
|
||||
|
||||
/* NuttX callback functions */
|
||||
|
||||
static int lm3s_ifup(struct uip_driver_s *dev);
|
||||
static int lm3s_ifdown(struct uip_driver_s *dev);
|
||||
static int lm3s_txavail(struct uip_driver_s *dev);
|
||||
static int lm3s_ifup(struct uip_driver_s *dev);
|
||||
static int lm3s_ifdown(struct uip_driver_s *dev);
|
||||
static int lm3s_txavail(struct uip_driver_s *dev);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@ -272,12 +274,12 @@ static int lm3s_txavail(struct uip_driver_s *dev);
|
||||
****************************************************************************/
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
static uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset)
|
||||
static uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset)
|
||||
{
|
||||
return getreg32(priv->ld_base + offset);
|
||||
}
|
||||
#else
|
||||
static inline uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset)
|
||||
static inline uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset)
|
||||
{
|
||||
return getreg32(LM3S_ETHCON_BASE + offset);
|
||||
}
|
||||
@ -300,12 +302,12 @@ static inline uint32 lm3s_ethin(struct lm3s_driver_s *priv, int offset)
|
||||
****************************************************************************/
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value)
|
||||
static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value)
|
||||
{
|
||||
putreg32(value, priv->ld_base + offset);
|
||||
}
|
||||
#else
|
||||
static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 value)
|
||||
static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value)
|
||||
{
|
||||
putreg32(value, LM3S_ETHCON_BASE + offset);
|
||||
}
|
||||
@ -330,7 +332,7 @@ static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32 va
|
||||
static void lm3s_ethreset(struct lm3s_driver_s *priv)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
# error "If multiple interfaces are supported, this function would have to be redesigned"
|
||||
@ -399,7 +401,7 @@ static void lm3s_ethreset(struct lm3s_driver_s *priv)
|
||||
****************************************************************************/
|
||||
|
||||
#if 0 /* Not used */
|
||||
static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16 value)
|
||||
static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16_t value)
|
||||
{
|
||||
/* Wait for any MII transactions in progress to complete */
|
||||
|
||||
@ -438,7 +440,7 @@ static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16 value)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr)
|
||||
static uint16_t lm3s_phyread(struct lm3s_driver_s *priv, int regaddr)
|
||||
{
|
||||
/* Wait for any MII transactions in progress to complete */
|
||||
|
||||
@ -456,7 +458,7 @@ static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr)
|
||||
|
||||
/* Read and return the PHY data */
|
||||
|
||||
return (uint16)(lm3s_ethin(priv, LM3S_MAC_MRXD_OFFSET) & MAC_MTRD_MASK);
|
||||
return (uint16_t)(lm3s_ethin(priv, LM3S_MAC_MRXD_OFFSET) & MAC_MTRD_MASK);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -477,8 +479,8 @@ static uint16 lm3s_phyread(struct lm3s_driver_s *priv, int regaddr)
|
||||
static int lm3s_transmit(struct lm3s_driver_s *priv)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint32 regval;
|
||||
ubyte *dbuf;
|
||||
uint32_t regval;
|
||||
uint8_t *dbuf;
|
||||
int pktlen;
|
||||
int bytesleft;
|
||||
int ret = -EBUSY;
|
||||
@ -504,9 +506,9 @@ static int lm3s_transmit(struct lm3s_driver_s *priv)
|
||||
DEBUGASSERT(pktlen > UIP_LLH_LEN);
|
||||
|
||||
dbuf = priv->ld_dev.d_buf;
|
||||
regval = (uint32)(pktlen - 14);
|
||||
regval |= ((uint32)(*dbuf++) << 16);
|
||||
regval |= ((uint32)(*dbuf++) << 24);
|
||||
regval = (uint32_t)(pktlen - 14);
|
||||
regval |= ((uint32_t)(*dbuf++) << 16);
|
||||
regval |= ((uint32_t)(*dbuf++) << 24);
|
||||
lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, regval);
|
||||
|
||||
/* Write all of the whole, 32-bit values in the middle of the packet */
|
||||
@ -517,7 +519,7 @@ static int lm3s_transmit(struct lm3s_driver_s *priv)
|
||||
* buffer may be un-aligned.
|
||||
*/
|
||||
|
||||
lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, *(uint32*)dbuf);
|
||||
lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, *(uint32_t*)dbuf);
|
||||
}
|
||||
|
||||
/* Write the last, partial word in the FIFO */
|
||||
@ -534,11 +536,11 @@ static int lm3s_transmit(struct lm3s_driver_s *priv)
|
||||
break;
|
||||
|
||||
case 3:
|
||||
regval |= ((uint32)dbuf[2] << 16);
|
||||
regval |= ((uint32_t)dbuf[2] << 16);
|
||||
case 2:
|
||||
regval |= ((uint32)dbuf[1] << 8);
|
||||
regval |= ((uint32_t)dbuf[1] << 8);
|
||||
case 1:
|
||||
regval |= (uint32)dbuf[0];
|
||||
regval |= (uint32_t)dbuf[0];
|
||||
break;
|
||||
}
|
||||
lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, regval);
|
||||
@ -550,7 +552,7 @@ static int lm3s_transmit(struct lm3s_driver_s *priv)
|
||||
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
|
||||
(void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm3s_txtimeout, 1, (uint32)priv);
|
||||
(void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm3s_txtimeout, 1, (uint32_t)priv);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
@ -625,10 +627,10 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev)
|
||||
|
||||
static void lm3s_receive(struct lm3s_driver_s *priv)
|
||||
{
|
||||
uint32 regval;
|
||||
ubyte *dbuf;
|
||||
int pktlen;
|
||||
int bytesleft;
|
||||
uint32_t regval;
|
||||
uint8_t *dbuf;
|
||||
int pktlen;
|
||||
int bytesleft;
|
||||
|
||||
/* Loop while there are incoming packets to be processed */
|
||||
|
||||
@ -690,8 +692,8 @@ static void lm3s_receive(struct lm3s_driver_s *priv)
|
||||
|
||||
/* Save the first two bytes from the first word */
|
||||
|
||||
*dbuf++ = (ubyte)((regval >> 16) & 0xff);
|
||||
*dbuf++ = (ubyte)((regval >> 24) & 0xff);
|
||||
*dbuf++ = (uint8_t)((regval >> 16) & 0xff);
|
||||
*dbuf++ = (uint8_t)((regval >> 24) & 0xff);
|
||||
|
||||
/* Read all of the whole, 32-bit values in the middle of the packet.
|
||||
* We've already read the length (2 bytes) plus the first two bytes
|
||||
@ -704,7 +706,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv)
|
||||
* buffer may be un-aligned.
|
||||
*/
|
||||
|
||||
*(uint32*)dbuf = lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET);
|
||||
*(uint32_t*)dbuf = lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET);
|
||||
}
|
||||
|
||||
/* Handle the last, partial word in the FIFO */
|
||||
@ -845,7 +847,7 @@ static void lm3s_txdone(struct lm3s_driver_s *priv)
|
||||
static int lm3s_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
register struct lm3s_driver_s *priv;
|
||||
uint32 ris;
|
||||
uint32_t ris;
|
||||
|
||||
#if LM3S_NETHCONTROLLERS > 1
|
||||
# error "A mechanism to associate and interface with an IRQ is needed"
|
||||
@ -929,7 +931,7 @@ static int lm3s_interrupt(int irq, FAR void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void lm3s_txtimeout(int argc, uint32 arg, ...)
|
||||
static void lm3s_txtimeout(int argc, uint32_t arg, ...)
|
||||
{
|
||||
struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg;
|
||||
|
||||
@ -966,7 +968,7 @@ static void lm3s_txtimeout(int argc, uint32 arg, ...)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void lm3s_polltimer(int argc, uint32 arg, ...)
|
||||
static void lm3s_polltimer(int argc, uint32_t arg, ...)
|
||||
{
|
||||
struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg;
|
||||
|
||||
@ -1011,9 +1013,9 @@ static int lm3s_ifup(struct uip_driver_s *dev)
|
||||
{
|
||||
struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
uint32 regval;
|
||||
uint32 div;
|
||||
uint16 phyreg;
|
||||
uint32_t regval;
|
||||
uint32_t div;
|
||||
uint16_t phyreg;
|
||||
|
||||
nlldbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
@ -1127,21 +1129,21 @@ static int lm3s_ifup(struct uip_driver_s *dev)
|
||||
|
||||
/* Program the hardware with it's MAC address (for filtering) */
|
||||
|
||||
regval = (uint32)priv->ld_dev.d_mac.ether_addr_octet[3] << 24 |
|
||||
(uint32)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 |
|
||||
(uint32)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 |
|
||||
(uint32)priv->ld_dev.d_mac.ether_addr_octet[0];
|
||||
regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[3] << 24 |
|
||||
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 |
|
||||
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 |
|
||||
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[0];
|
||||
lm3s_ethout(priv, LM3S_MAC_IA0_OFFSET, regval);
|
||||
|
||||
regval = (uint32)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 |
|
||||
(uint32)priv->ld_dev.d_mac.ether_addr_octet[4];
|
||||
regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 |
|
||||
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[4];
|
||||
lm3s_ethout(priv, LM3S_MAC_IA1_OFFSET, regval);
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
(void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, (uint32)priv);
|
||||
(void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, (uint32_t)priv);
|
||||
|
||||
priv->ld_bifup = TRUE;
|
||||
priv->ld_bifup = true;
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
@ -1167,7 +1169,7 @@ static int lm3s_ifdown(struct uip_driver_s *dev)
|
||||
{
|
||||
struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
|
||||
nlldbg("Taking down: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
@ -1224,7 +1226,7 @@ static int lm3s_ifdown(struct uip_driver_s *dev)
|
||||
|
||||
/* The interface is now DOWN */
|
||||
|
||||
priv->ld_bifup = FALSE;
|
||||
priv->ld_bifup = false;
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
|
@ -41,11 +41,10 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/mii.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Ethernet Controller Register Offsets *********************************************/
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* FLASH register offsets ***********************************************************/
|
||||
|
@ -39,8 +39,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -52,7 +53,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* These definitions are part of the implementation of the GPIO pad
|
||||
@ -119,8 +120,8 @@
|
||||
|
||||
struct gpio_func_s
|
||||
{
|
||||
ubyte setbits; /* A set of GPIO register bits to set */
|
||||
ubyte clrbits; /* A set of GPIO register bits to clear */
|
||||
uint8_t setbits; /* A set of GPIO register bits to set */
|
||||
uint8_t clrbits; /* A set of GPIO register bits to clear */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -139,7 +140,7 @@ static const struct gpio_func_s g_funcbits[] =
|
||||
{GPIO_INTERRUPT_SETBITS, GPIO_INTERRUPT_CLRBITS}, /* GPIO_FUNC_INTERRUPT */
|
||||
};
|
||||
|
||||
static const uint32 g_gpiobase[] =
|
||||
static const uint32_t g_gpiobase[] =
|
||||
{
|
||||
LM3S_GPIOA_BASE, LM3S_GPIOB_BASE, LM3S_GPIOC_BASE, LM3S_GPIOD_BASE,
|
||||
LM3S_GPIOE_BASE, LM3S_GPIOF_BASE, LM3S_GPIOG_BASE, LM3S_GPIOH_BASE,
|
||||
@ -162,7 +163,7 @@ static const uint32 g_gpiobase[] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 lm3s_gpiobaseaddress(unsigned int port)
|
||||
static inline uint32_t lm3s_gpiobaseaddress(unsigned int port)
|
||||
{
|
||||
return g_gpiobase[port & 7];
|
||||
}
|
||||
@ -175,11 +176,11 @@ static inline uint32 lm3s_gpiobaseaddress(unsigned int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *func)
|
||||
static void lm3s_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s *func)
|
||||
{
|
||||
uint32 setbit;
|
||||
uint32 clrbit;
|
||||
uint32 regval;
|
||||
uint32_t setbit;
|
||||
uint32_t clrbit;
|
||||
uint32_t regval;
|
||||
|
||||
/* Set/clear/ignore the GPIO ODR bit. "The GPIO ODR register is the open drain
|
||||
* control register. Setting a bit in this register enables the open drain
|
||||
@ -192,8 +193,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* drain output when set to 1."
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> ODR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> ODR_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> ODR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> ODR_SHIFT) & 1) << pinno;
|
||||
|
||||
regval = getreg32(base + LM3S_GPIO_ODR_OFFSET);
|
||||
regval &= ~clrbit;
|
||||
@ -206,8 +207,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* corresponding bit in the GPIO Pull-Down Select (GPIOPDR) register ..."
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> PUR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> PUR_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> PUR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> PUR_SHIFT) & 1) << pinno;
|
||||
|
||||
if (setbit || clrbit)
|
||||
{
|
||||
@ -223,8 +224,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* the corresponding bit in the GPIO Pull-Up Select (GPIOPUR) register ..."
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> PDR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> PDR_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> PDR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> PDR_SHIFT) & 1) << pinno;
|
||||
|
||||
if (setbit || clrbit)
|
||||
{
|
||||
@ -243,8 +244,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* corresponding GPIODEN bit must be set."
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> DEN_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> DEN_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> DEN_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> DEN_SHIFT) & 1) << pinno;
|
||||
|
||||
regval = getreg32(base + LM3S_GPIO_DEN_OFFSET);
|
||||
regval &= ~clrbit;
|
||||
@ -258,8 +259,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* pins are inputs by default.
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> DIR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> DIR_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> DIR_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> DIR_SHIFT) & 1) << pinno;
|
||||
|
||||
regval = getreg32(base + LM3S_GPIO_DIR_OFFSET);
|
||||
regval &= ~clrbit;
|
||||
@ -275,8 +276,8 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
* and unlock the GPIO. That is not implemented here.
|
||||
*/
|
||||
|
||||
setbit = (((uint32)func->setbits >> AFSEL_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32)func->clrbits >> AFSEL_SHIFT) & 1) << pinno;
|
||||
setbit = (((uint32_t)func->setbits >> AFSEL_SHIFT) & 1) << pinno;
|
||||
clrbit = (((uint32_t)func->clrbits >> AFSEL_SHIFT) & 1) << pinno;
|
||||
|
||||
regval = getreg32(base + LM3S_GPIO_AFSEL_OFFSET);
|
||||
regval &= ~clrbit;
|
||||
@ -292,13 +293,13 @@ static void lm3s_gpiofunc(uint32 base, uint32 pinno, const struct gpio_func_s *f
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void lm3s_gpiopadstrength(uint32 base, uint32 pin, uint32 cfgset)
|
||||
static inline void lm3s_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgset)
|
||||
{
|
||||
int strength = (cfgset & GPIO_STRENGTH_MASK) >> GPIO_STRENGTH_SHIFT;
|
||||
uint32 regoffset;
|
||||
uint32 regval;
|
||||
uint32 slrset;
|
||||
uint32 slrclr;
|
||||
uint32_t regoffset;
|
||||
uint32_t regval;
|
||||
uint32_t slrset;
|
||||
uint32_t slrclr;
|
||||
|
||||
/* Prepare bits to disable slew */
|
||||
|
||||
@ -381,22 +382,22 @@ static inline void lm3s_gpiopadstrength(uint32 base, uint32 pin, uint32 cfgset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void lm3s_gpiopadtype(uint32 base, uint32 pin, uint32 cfgset)
|
||||
static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset)
|
||||
{
|
||||
int padtype = (cfgset & GPIO_PADTYPE_MASK) >> GPIO_PADTYPE_SHIFT;
|
||||
#if 0 /* always overwritten by lm3s_gpiofunc */
|
||||
uint32 odrset;
|
||||
uint32 odrclr;
|
||||
uint32_t odrset;
|
||||
uint32_t odrclr;
|
||||
#endif
|
||||
uint32 purset;
|
||||
uint32 purclr;
|
||||
uint32 pdrset;
|
||||
uint32 pdrclr;
|
||||
uint32_t purset;
|
||||
uint32_t purclr;
|
||||
uint32_t pdrset;
|
||||
uint32_t pdrclr;
|
||||
#if 0 /* always overwritten by lm3s_gpiofunc */
|
||||
uint32 denset;
|
||||
uint32 denclr;
|
||||
uint32_t denset;
|
||||
uint32_t denclr;
|
||||
#endif
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
|
||||
/* Assume digital GPIO function, push-pull with no pull-up or pull-down */
|
||||
|
||||
@ -536,9 +537,9 @@ static inline void lm3s_gpiopadtype(uint32 base, uint32 pin, uint32 cfgset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void lm3s_initoutput(uint32 cfgset)
|
||||
static inline void lm3s_initoutput(uint32_t cfgset)
|
||||
{
|
||||
boolean value = ((cfgset & GPIO_VALUE_MASK) != GPIO_VALUE_ZERO);
|
||||
bool value = ((cfgset & GPIO_VALUE_MASK) != GPIO_VALUE_ZERO);
|
||||
lm3s_gpiowrite(cfgset, value);
|
||||
}
|
||||
|
||||
@ -550,16 +551,16 @@ static inline void lm3s_initoutput(uint32 cfgset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void lm3s_interrupt(uint32 base, uint32 pin, uint32 cfgset)
|
||||
static inline void lm3s_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset)
|
||||
{
|
||||
int inttype = (cfgset & GPIO_INT_MASK) >> GPIO_INT_SHIFT;
|
||||
uint32 regval;
|
||||
uint32 isset;
|
||||
uint32 isclr;
|
||||
uint32 ibeset;
|
||||
uint32 ibeclr;
|
||||
uint32 iveset;
|
||||
uint32 iveclr;
|
||||
uint32_t regval;
|
||||
uint32_t isset;
|
||||
uint32_t isclr;
|
||||
uint32_t ibeset;
|
||||
uint32_t ibeclr;
|
||||
uint32_t iveset;
|
||||
uint32_t iveclr;
|
||||
|
||||
/* Mask and clear the GPIO interrupt
|
||||
*
|
||||
@ -681,15 +682,15 @@ static inline void lm3s_interrupt(uint32 base, uint32 pin, uint32 cfgset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lm3s_configgpio(uint32 cfgset)
|
||||
int lm3s_configgpio(uint32_t cfgset)
|
||||
{
|
||||
irqstate_t flags;
|
||||
unsigned int func;
|
||||
unsigned int port;
|
||||
unsigned int pinno;
|
||||
uint32 pin;
|
||||
uint32 base;
|
||||
uint32 regval;
|
||||
uint32_t pin;
|
||||
uint32_t base;
|
||||
uint32_t regval;
|
||||
|
||||
/* Decode the basics */
|
||||
|
||||
@ -762,11 +763,11 @@ int lm3s_configgpio(uint32 cfgset)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lm3s_gpiowrite(uint32 pinset, boolean value)
|
||||
void lm3s_gpiowrite(uint32_t pinset, bool value)
|
||||
{
|
||||
unsigned int port;
|
||||
unsigned int pinno;
|
||||
uint32 base;
|
||||
uint32_t base;
|
||||
|
||||
/* Decode the basics */
|
||||
|
||||
@ -789,7 +790,7 @@ void lm3s_gpiowrite(uint32 pinset, boolean value)
|
||||
* "... All bits are cleared by a reset."
|
||||
*/
|
||||
|
||||
putreg32((uint32)value << pinno, base + LM3S_GPIO_DATA_OFFSET + (1 << (pinno + 2)));
|
||||
putreg32((uint32_t)value << pinno, base + LM3S_GPIO_DATA_OFFSET + (1 << (pinno + 2)));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -800,11 +801,11 @@ void lm3s_gpiowrite(uint32 pinset, boolean value)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
boolean lm3s_gpioread(uint32 pinset, boolean value)
|
||||
bool lm3s_gpioread(uint32_t pinset, bool value)
|
||||
{
|
||||
unsigned int port;
|
||||
unsigned int pinno;
|
||||
uint32 base;
|
||||
uint32_t base;
|
||||
|
||||
/* Decode the basics */
|
||||
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* GPIO Register Offsets ************************************************************/
|
||||
|
@ -39,8 +39,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@ -53,7 +53,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@ -68,7 +68,7 @@ static FAR xcpt_t g_gpioirqvector[NR_GPIO_IRQS];
|
||||
* be we support disabling interrupt support for arbitrary ports
|
||||
*/
|
||||
|
||||
static const uint32 g_gpiobase[] =
|
||||
static const uint32_t g_gpiobase[] =
|
||||
{
|
||||
#ifndef CONFIG_LM3S_DISABLE_GPIOA_IRQS
|
||||
LM3S_GPIOA_BASE,
|
||||
@ -113,7 +113,7 @@ static const uint32 g_gpiobase[] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32 lm3s_gpiobaseaddress(unsigned int port)
|
||||
static inline uint32_t lm3s_gpiobaseaddress(unsigned int port)
|
||||
{
|
||||
return g_gpiobase[port >> 3];
|
||||
}
|
||||
@ -126,9 +126,9 @@ static inline uint32 lm3s_gpiobaseaddress(unsigned int port)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int lm3s_gpiohandler(uint32 regbase, int irqbase, void *context)
|
||||
static int lm3s_gpiohandler(uint32_t regbase, int irqbase, void *context)
|
||||
{
|
||||
uint32 mis;
|
||||
uint32_t mis;
|
||||
int irq;
|
||||
int pin;
|
||||
|
||||
@ -322,8 +322,8 @@ void gpio_irqenable(int irq)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int gpioirq = irq - NR_IRQS;
|
||||
uint32 base;
|
||||
uint32 regval;
|
||||
uint32_t base;
|
||||
uint32_t regval;
|
||||
int pin;
|
||||
int ret = ERROR;
|
||||
|
||||
@ -363,8 +363,8 @@ void gpio_irqdisable(int irq)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int gpioirq = irq - NR_IRQS;
|
||||
uint32 base;
|
||||
uint32 regval;
|
||||
uint32_t base;
|
||||
uint32_t regval;
|
||||
int pin;
|
||||
int ret = ERROR;
|
||||
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* I2C Register Offsets *************************************************************/
|
||||
|
@ -41,13 +41,14 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "chip.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* The LM3S6918 only supports 8 priority levels. The hardware priority mechanism
|
||||
@ -236,7 +237,7 @@ EXTERN void up_lowsetup(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void lm3s_clockconfig(uint32 newrcc, uint32 newrcc2);
|
||||
EXTERN void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_clockconfig
|
||||
@ -257,7 +258,7 @@ EXTERN void up_clockconfig(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int lm3s_configgpio(uint32 cfgset);
|
||||
EXTERN int lm3s_configgpio(uint32_t cfgset);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lm3s_gpiowrite
|
||||
@ -267,7 +268,7 @@ EXTERN int lm3s_configgpio(uint32 cfgset);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void lm3s_gpiowrite(uint32 pinset, boolean value);
|
||||
EXTERN void lm3s_gpiowrite(uint32_t pinset, bool value);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lm3s_gpioread
|
||||
@ -277,7 +278,7 @@ EXTERN void lm3s_gpiowrite(uint32 pinset, boolean value);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN boolean lm3s_gpioread(uint32 pinset, boolean value);
|
||||
EXTERN bool lm3s_gpioread(uint32_t pinset, bool value);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: lm3s_dumpgpio
|
||||
@ -287,7 +288,7 @@ EXTERN boolean lm3s_gpioread(uint32 pinset, boolean value);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int lm3s_dumpgpio(uint32 pinset, const char *msg);
|
||||
EXTERN int lm3s_dumpgpio(uint32_t pinset, const char *msg);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gpio_irqinitialize
|
||||
@ -345,8 +346,8 @@ EXTERN int lm3s_ethinitialize(int intf);
|
||||
|
||||
struct spi_dev_s;
|
||||
enum spi_dev_e;
|
||||
EXTERN void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected);
|
||||
EXTERN ubyte lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
EXTERN void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
|
||||
EXTERN uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -39,8 +39,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
@ -54,7 +54,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Enable NVIC debug features that are probably only desireable during
|
||||
@ -75,7 +75,7 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
uint32 *current_regs;
|
||||
uint32_t *current_regs;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -205,7 +205,7 @@ static int lm3s_reserved(int irq, FAR void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int lm3s_irqinfo(int irq, uint32 *regaddr, uint32 *bit)
|
||||
static int lm3s_irqinfo(int irq, uint32_t *regaddr, uint32_t *bit)
|
||||
{
|
||||
DEBUGASSERT(irq >= LM3S_IRQ_NMI && irq < NR_IRQS);
|
||||
|
||||
@ -363,9 +363,9 @@ void up_irqinitialize(void)
|
||||
|
||||
void up_disable_irq(int irq)
|
||||
{
|
||||
uint32 regaddr;
|
||||
uint32 regval;
|
||||
uint32 bit;
|
||||
uint32_t regaddr;
|
||||
uint32_t regval;
|
||||
uint32_t bit;
|
||||
|
||||
if (lm3s_irqinfo(irq, ®addr, &bit) == 0)
|
||||
{
|
||||
@ -388,9 +388,9 @@ void up_disable_irq(int irq)
|
||||
|
||||
void up_enable_irq(int irq)
|
||||
{
|
||||
uint32 regaddr;
|
||||
uint32 regval;
|
||||
uint32 bit;
|
||||
uint32_t regaddr;
|
||||
uint32_t regval;
|
||||
uint32_t bit;
|
||||
|
||||
if (lm3s_irqinfo(irq, ®addr, &bit) == 0)
|
||||
{
|
||||
@ -430,8 +430,8 @@ void up_maskack_irq(int irq)
|
||||
#ifdef CONFIG_ARCH_IRQPRIO
|
||||
int up_prioritize_irq(int irq, int priority)
|
||||
{
|
||||
uint32 regaddr;
|
||||
uint32 regval;
|
||||
uint32_t regaddr;
|
||||
uint32_t regval;
|
||||
int shift;
|
||||
|
||||
DEBUGASSERT(irq >= LM3S_IRQ_MPU && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN);
|
||||
|
@ -38,7 +38,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "up_arch.h"
|
||||
@ -47,7 +47,7 @@
|
||||
#include "lm3s_internal.h"
|
||||
|
||||
/**************************************************************************
|
||||
* Private Definitions
|
||||
* Pre-processor Definitions
|
||||
**************************************************************************/
|
||||
|
||||
/* Configuration **********************************************************/
|
||||
@ -204,7 +204,7 @@ void up_lowputc(char ch)
|
||||
|
||||
/* Then send the character */
|
||||
|
||||
putreg32((uint32)ch, LM3S_CONSOLE_BASE+LM3S_UART_DR_OFFSET);
|
||||
putreg32((uint32_t)ch, LM3S_CONSOLE_BASE+LM3S_UART_DR_OFFSET);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -220,9 +220,9 @@ void up_lowputc(char ch)
|
||||
|
||||
void up_lowsetup(void)
|
||||
{
|
||||
uint32 regval;
|
||||
uint32_t regval;
|
||||
#if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
|
||||
uint32 ctl;
|
||||
uint32_t ctl;
|
||||
#endif
|
||||
|
||||
/* Enable the selected UARTs and configure GPIO pins to need by the
|
||||
|
@ -41,10 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Memory map ***********************************************************************/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user