Clean up and review of header files for conformance to standards

This commit is contained in:
Gregory Nutt 2015-06-12 19:17:42 -06:00
parent a0d55ca97b
commit c5b15d0b31
11 changed files with 222 additions and 180 deletions

View File

@ -2,7 +2,7 @@
* arch/arm/src/imx/imx_gpio.h
* arch/arm/src/chip/imx_gpio.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -551,11 +551,11 @@ static inline void imxgpio_clroutput(int port, int bit)
/* Useful functions for normal configurations */
extern void imxgpio_configoutput(int port, int bit, int value);
extern void imxgpio_configinput(int port, int bit);
void imxgpio_configoutput(int port, int bit, int value);
void imxgpio_configinput(int port, int bit);
extern void imxgpio_configpfoutput(int port, int bit);
extern void imxgpio_configpfinput(int port, int bit);
void imxgpio_configpfoutput(int port, int bit);
void imxgpio_configpfinput(int port, int bit);
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************************************
* arch/arm/src/lpc2378/chip.h
*
* Copyright (C) 2010 Rommel Marcelo. All rights reserved.
* Copyright (C) 2010, 2015 Rommel Marcelo. All rights reserved.
* Author: Rommel Marcelo
*
* This file is part of the NuttX RTOS and based on the lpc2148 port:
@ -61,8 +61,8 @@
#ifndef __ASSEMBLY__
#ifdef CONFIG_ARCH_LEDS
extern void lpc2378_statledoff(void);
extern void lpc2378_statledon(void);
void lpc2378_statledoff(void);
void lpc2378_statledon(void);
#endif
#endif

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/str71x/str71x_internal.h
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -105,7 +105,7 @@
********************************************************************************/
#ifdef CONFIG_STR71X_XTI
extern int str71x_xtiinitialize(void);
int str71x_xtiinitialize(void);
#else
# define str71x_xtiinitialize()
#endif /* CONFIG_STR71X_XTI */
@ -120,7 +120,7 @@ extern int str71x_xtiinitialize(void);
********************************************************************************/
#ifdef CONFIG_STR71X_XTI
extern int str71x_xticonfig(int irq, bool rising);
int str71x_xticonfig(int irq, bool rising);
#else
# define str71x_xticonfig(irq,rising)
#endif /* CONFIG_STR71X_XTI */
@ -134,7 +134,7 @@ extern int str71x_xticonfig(int irq, bool rising);
****************************************************************************/
#ifdef CONFIG_STR71X_XTI
extern void str71x_enable_xtiirq(int irq);
void str71x_enable_xtiirq(int irq);
#else
# define str71x_enable_xtiirq(irq)
#endif /* CONFIG_STR71X_XTI */
@ -148,7 +148,7 @@ extern void str71x_enable_xtiirq(int irq);
****************************************************************************/
#ifdef CONFIG_STR71X_XTI
extern void str71x_disable_xtiirq(int irq);
void str71x_disable_xtiirq(int irq);
#else
# define str71x_disable_xtiirq(irq)
#endif /* CONFIG_STR71X_XTI */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/common/up_internal.h
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2010-2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -182,7 +182,7 @@ void lowconsole_init(void);
/* Defined in chip/xxx_timerisr.c */
extern void up_timer_initialize(void);
void up_timer_initialize(void);
/* Defined in chip/xxx_ethernet.c */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/hc/src/common/up_internal.h
*
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -159,49 +159,49 @@ extern uint32_t g_intstackbase;
/* Start-up functions */
extern void up_boot(void);
void up_boot(void);
/* Context switching functions */
extern void up_copystate(uint8_t *dest, uint8_t *src);
extern void up_decodeirq(uint8_t *regs);
extern void up_irqinitialize(void);
extern int up_saveusercontext(uint8_t *saveregs);
extern void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
extern void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs);
void up_copystate(uint8_t *dest, uint8_t *src);
void up_decodeirq(uint8_t *regs);
void up_irqinitialize(void);
int up_saveusercontext(uint8_t *saveregs);
void up_fullcontextrestore(uint8_t *restoreregs) noreturn_function;
void up_switchcontext(uint8_t *saveregs, uint8_t *restoreregs);
/* Interrupt handling */
extern uint8_t *up_doirq(int irq, uint8_t *regs);
uint8_t *up_doirq(int irq, uint8_t *regs);
/* Signal handling */
extern void up_sigdeliver(void);
void up_sigdeliver(void);
/* System timer initialization */
extern void up_timer_initialize(void);
extern int up_timerisr(int irq, uint32_t *regs);
void up_timer_initialize(void);
int up_timerisr(int irq, uint32_t *regs);
/* Debug output */
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
void up_earlyserialinit(void);
void up_serialinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
#endif
#ifdef CONFIG_DEV_LOWCONSOLE
extern void lowconsole_init(void);
void lowconsole_init(void);
#else
# define lowconsole_init()
#endif
extern void up_lowputc(char ch);
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
void up_lowputc(char ch);
void up_puts(const char *str);
void up_lowputs(const char *str);
/* Memory configuration */
@ -214,20 +214,20 @@ void up_addregion(void);
/* Sub-system/driver initialization */
#ifdef CONFIG_ARCH_DMA
extern void weak_function up_dmainitialize(void);
void weak_function up_dmainitialize(void);
#endif
extern void up_wdtinit(void);
void up_wdtinit(void);
#ifdef CONFIG_NET
extern void up_netinitialize(void);
void up_netinitialize(void);
#else
# define up_netinitialize()
#endif
#ifdef CONFIG_USBDEV
extern void up_usbinitialize(void);
extern void up_usbuninitialize(void);
void up_usbinitialize(void);
void up_usbuninitialize(void);
#else
# define up_usbinitialize()
# define up_usbuninitialize()

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/mips/common/up_internal.h
*
* Copyright (C) 2011, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -193,17 +193,17 @@ extern uint32_t _bmxdupba_address; /* BMX register setting */
/* Context switching */
extern void up_copystate(uint32_t *dest, uint32_t *src);
void up_copystate(uint32_t *dest, uint32_t *src);
/* Serial output */
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
void up_puts(const char *str);
void up_lowputs(const char *str);
/* Defined in drivers/lowconsole.c */
#ifdef CONFIG_DEV_LOWCONSOLE
extern void lowconsole_init(void);
void lowconsole_init(void);
#else
# define lowconsole_init()
#endif
@ -211,7 +211,7 @@ extern void lowconsole_init(void);
/* Debug */
#ifdef CONFIG_ARCH_STACKDUMP
extern void up_dumpstate(void);
void up_dumpstate(void);
#else
# define up_dumpstate()
#endif
@ -219,28 +219,28 @@ extern void up_dumpstate(void);
/* Common MIPS32 functions defined in arch/mips/src/MIPS32 */
/* IRQs */
extern uint32_t *up_doirq(int irq, uint32_t *regs);
uint32_t *up_doirq(int irq, uint32_t *regs);
/* Software interrupt 0 handler */
extern int up_swint0(int irq, FAR void *context);
int up_swint0(int irq, FAR void *context);
/* Signals */
extern void up_sigdeliver(void);
void up_sigdeliver(void);
/* Chip-specific functions **************************************************/
/* Chip specific functions defined in arch/mips/src/<chip> */
/* IRQs */
extern void up_irqinitialize(void);
extern bool up_pending_irq(int irq);
extern void up_clrpend_irq(int irq);
void up_irqinitialize(void);
bool up_pending_irq(int irq);
void up_clrpend_irq(int irq);
/* DMA */
#ifdef CONFIG_ARCH_DMA
extern void weak_function up_dmainitialize(void);
void weak_function up_dmainitialize(void);
#endif
/* Memory management */
@ -253,10 +253,10 @@ void up_addregion(void);
/* Serial output */
extern void up_lowputc(char ch);
void up_lowputc(char ch);
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
void up_earlyserialinit(void);
void up_serialinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
@ -264,12 +264,12 @@ extern void up_serialinit(void);
/* System timer */
extern void up_timer_initialize(void);
void up_timer_initialize(void);
/* Network */
#ifdef CONFIG_NET
extern void up_netinitialize(void);
void up_netinitialize(void);
#else
# define up_netinitialize()
#endif
@ -277,8 +277,8 @@ extern void up_netinitialize(void);
/* USB */
#ifdef CONFIG_USBDEV
extern void up_usbinitialize(void);
extern void up_usbuninitialize(void);
void up_usbinitialize(void);
void up_usbuninitialize(void);
#else
# define up_usbinitialize()
# define up_usbuninitialize()

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/x86/src/common/up_internal.h
*
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -192,24 +192,24 @@ void x86_boardinitialize(void);
/* Defined in files with the same name as the function */
extern void up_boot(void);
extern void up_copystate(uint32_t *dest, uint32_t *src);
extern void up_savestate(uint32_t *regs);
extern void up_decodeirq(uint32_t *regs);
extern void up_irqinitialize(void);
void up_boot(void);
void up_copystate(uint32_t *dest, uint32_t *src);
void up_savestate(uint32_t *regs);
void up_decodeirq(uint32_t *regs);
void up_irqinitialize(void);
#ifdef CONFIG_ARCH_DMA
extern void weak_function up_dmainitialize(void);
void weak_function up_dmainitialize(void);
#endif
extern int up_saveusercontext(uint32_t *saveregs);
extern void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
extern void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
extern void up_sigdeliver(void);
extern void up_lowputc(char ch);
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
int up_saveusercontext(uint32_t *saveregs);
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
void up_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
void up_sigdeliver(void);
void up_lowputc(char ch);
void up_puts(const char *str);
void up_lowputs(const char *str);
extern void up_syscall(uint32_t *regs);
extern void up_registerdump(uint32_t *regs);
void up_syscall(uint32_t *regs);
void up_registerdump(uint32_t *regs);
/* Defined in up_allocateheap.c */
@ -222,8 +222,8 @@ void up_addregion(void);
/* Defined in up_serial.c */
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
void up_earlyserialinit(void);
void up_serialinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
@ -232,30 +232,30 @@ extern void up_serialinit(void);
/* Defined in drivers/lowconsole.c */
#ifdef CONFIG_DEV_LOWCONSOLE
extern void lowconsole_init(void);
void lowconsole_init(void);
#else
# define lowconsole_init()
#endif
/* Defined in up_watchdog.c */
extern void up_wdtinit(void);
void up_wdtinit(void);
/* Defined in up_timerisr.c */
extern void up_timer_initialize(void);
void up_timer_initialize(void);
/* Defined in board/up_network.c */
#ifdef CONFIG_NET
extern void up_netinitialize(void);
void up_netinitialize(void);
#else
# define up_netinitialize()
#endif
#ifdef CONFIG_USBDEV
extern void up_usbinitialize(void);
extern void up_usbuninitialize(void);
void up_usbinitialize(void);
void up_usbuninitialize(void);
#else
# define up_usbinitialize()
# define up_usbuninitialize()

View File

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_internal.h
*
* Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -143,16 +143,16 @@ extern volatile FAR chipreg_t *current_regs;
/* Defined in files with the same name as the function */
extern void up_copystate(FAR chipreg_t *dest, FAR chipreg_t *src);
extern FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs);
extern void up_restoreusercontext(FAR chipreg_t *regs);
extern void up_irqinitialize(void);
extern int up_saveusercontext(FAR chipreg_t *regs);
extern void up_sigdeliver(void);
extern int up_timerisr(int irq, FAR chipreg_t *regs);
void up_copystate(FAR chipreg_t *dest, FAR chipreg_t *src);
FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs);
void up_restoreusercontext(FAR chipreg_t *regs);
void up_irqinitialize(void);
int up_saveusercontext(FAR chipreg_t *regs);
void up_sigdeliver(void);
int up_timerisr(int irq, FAR chipreg_t *regs);
#if defined(CONFIG_Z16_LOWPUTC) || defined(CONFIG_Z16_LOWGETC)
extern void up_lowputc(char ch);
void up_lowputc(char ch);
#else
# define up_lowputc(ch)
#endif
@ -166,39 +166,39 @@ void up_addregion(void);
/* Defined in up_serial.c */
#ifdef USE_SERIALDRIVER
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
void up_earlyserialinit(void);
void up_serialinit(void);
#endif
#ifdef USE_LOWCONSOLE
extern void lowconsole_init(void);
void lowconsole_init(void);
#endif
/* Defined in up_timerisr.c */
extern void up_timer_initialize(void);
void up_timer_initialize(void);
/* Defined in up_irq.c */
extern void up_ack_irq(int irq);
void up_ack_irq(int irq);
/* Defined in board/up_network.c */
#ifdef CONFIG_NET
extern void up_netinitialize(void);
void up_netinitialize(void);
#else
# define up_netinitialize()
#endif
/* Return the current value of the stack pointer (used in stack dump logic) */
extern chipreg_t up_getsp(void);
chipreg_t up_getsp(void);
/* Dump stack and registers */
#ifdef CONFIG_ARCH_STACKDUMP
extern void up_stackdump(void);
extern void up_registerdump(void);
void up_stackdump(void);
void up_registerdump(void);
#else
# define up_stackdump()
# define up_registerdump()

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_internal.h
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -174,7 +174,7 @@ void lowconsole_init(void);
/* Defined in drivers/syslog_console.c */
#ifdef defined(CONFIG_SYSLOG_CONSOLE)
syslog_console_init();
void syslog_console_init();
#else
# define syslog_console_init()
#endif
@ -182,14 +182,14 @@ void lowconsole_init(void);
/* Defined in drivers/ramlog.c */
#ifdef CONFIG_RAMLOG_CONSOLE
extern void ramlog_consoleinit(void);
void ramlog_consoleinit(void);
#else
# define ramlog_consoleinit()
#endif
/* Low level string output */
extern void up_puts(const char *str);
void up_puts(const char *str);
/* Defined in up_timerisr.c */

View File

@ -1,7 +1,5 @@
#ifndef _MSGB_H
#define _MSGB_H
/* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
/**************************************************************************
* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
*
* This source code is derivated from Osmocom-BB project and was
* relicensed as BSD with permission from original authors.
@ -35,142 +33,186 @@
*
**************************************************************************/
#ifndef __INCLUDE_NUTTX_SERCOM_MSGB_H
#define __INCLUDE_NUTTX_SERCOM_MSGB_H
/**************************************************************************
* Included Files
**************************************************************************/
#include <osmocom/core/linuxlist.h>
#include <console.h>
struct msgb {
struct llist_head list;
/**************************************************************************
* Public Types
**************************************************************************/
/* the layer 1 header, if any */
unsigned char *l1h;
/* the A-bis layer 2 header: OML, RSL(RLL), NS */
unsigned char *l2h;
/* the layer 3 header. For OML: FOM; RSL: 04.08; GPRS: BSSGP */
unsigned char *l3h;
struct msgb
{
struct llist_head list;
uint16_t data_len;
uint16_t len;
/* the layer 1 header, if any */
unsigned char *head; /* start of buffer */
unsigned char *tail; /* end of message */
unsigned char *data; /* start of message */
unsigned char _data[0];
unsigned char *l1h;
/* the A-bis layer 2 header: OML, RSL(RLL), NS */
unsigned char *l2h;
/* the layer 3 header. For OML: FOM; RSL: 04.08; GPRS: BSSGP */
unsigned char *l3h;
uint16_t data_len;
uint16_t len;
unsigned char *head; /* start of buffer */
unsigned char *tail; /* end of message */
unsigned char *data; /* start of message */
unsigned char _data[0];
};
extern struct msgb *msgb_alloc(uint16_t size, const char *name);
extern void msgb_free(struct msgb *m);
extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg);
extern struct msgb *msgb_dequeue(struct llist_head *queue);
extern void msgb_reset(struct msgb *m);
/**************************************************************************
* Public Function Prototypes
**************************************************************************/
#define msgb_l1(m) ((void *)(m->l1h))
#define msgb_l2(m) ((void *)(m->l2h))
#define msgb_l3(m) ((void *)(m->l3h))
struct msgb *msgb_alloc(uint16_t size, const char *name);
void msgb_free(struct msgb *m);
void msgb_enqueue(struct llist_head *queue, struct msgb *msg);
struct msgb *msgb_dequeue(struct llist_head *queue);
void msgb_reset(struct msgb *m);
/**************************************************************************
* Inline Functions
**************************************************************************/
#define msgb_l1(m) ((void *)(m->l1h))
#define msgb_l2(m) ((void *)(m->l2h))
#define msgb_l3(m) ((void *)(m->l3h))
static inline unsigned int msgb_l1len(const struct msgb *msgb)
{
return msgb->tail - (uint8_t *)msgb_l1(msgb);
return msgb->tail - (uint8_t *)msgb_l1(msgb);
}
static inline unsigned int msgb_l2len(const struct msgb *msgb)
{
return msgb->tail - (uint8_t *)msgb_l2(msgb);
return msgb->tail - (uint8_t *)msgb_l2(msgb);
}
static inline unsigned int msgb_l3len(const struct msgb *msgb)
{
return msgb->tail - (uint8_t *)msgb_l3(msgb);
return msgb->tail - (uint8_t *)msgb_l3(msgb);
}
static inline unsigned int msgb_headlen(const struct msgb *msgb)
{
return msgb->len - msgb->data_len;
return msgb->len - msgb->data_len;
}
static inline int msgb_tailroom(const struct msgb *msgb)
{
return (msgb->head + msgb->data_len) - msgb->tail;
return (msgb->head + msgb->data_len) - msgb->tail;
}
static inline unsigned char *msgb_put(struct msgb *msgb, unsigned int len)
{
unsigned char *tmp = msgb->tail;
unsigned char *tmp = msgb->tail;
/* we intentionally call cons_puts() here to display an allocation
* failure on the _other_ serial port (i.e. the one that doesn't
* have the HDLC layer on it */
if (msgb_tailroom(msgb) < len)
cons_puts("msgb_tailroom insufficient!\n");
/* we intentionally call cons_puts() here to display an allocation
* failure on the _other_ serial port (i.e. the one that doesn't
* have the HDLC layer on it
*/
msgb->tail += len;
msgb->len += len;
return tmp;
if (msgb_tailroom(msgb) < len)
{
cons_puts("msgb_tailroom insufficient!\n");
}
msgb->tail += len;
msgb->len += len;
return tmp;
}
static inline void msgb_put_u8(struct msgb *msgb, uint8_t word)
{
uint8_t *space = msgb_put(msgb, 1);
space[0] = word & 0xFF;
uint8_t *space = msgb_put(msgb, 1);
space[0] = word & 0xFF;
}
static inline void msgb_put_u16(struct msgb *msgb, uint16_t word)
{
uint8_t *space = msgb_put(msgb, 2);
space[0] = word >> 8 & 0xFF;
space[1] = word & 0xFF;
uint8_t *space = msgb_put(msgb, 2);
space[0] = word >> 8 & 0xFF;
space[1] = word & 0xFF;
}
static inline void msgb_put_u32(struct msgb *msgb, uint32_t word)
{
uint8_t *space = msgb_put(msgb, 4);
space[0] = word >> 24 & 0xFF;
space[1] = word >> 16 & 0xFF;
space[2] = word >> 8 & 0xFF;
space[3] = word & 0xFF;
uint8_t *space = msgb_put(msgb, 4);
space[0] = word >> 24 & 0xFF;
space[1] = word >> 16 & 0xFF;
space[2] = word >> 8 & 0xFF;
space[3] = word & 0xFF;
}
static inline unsigned char *msgb_get(struct msgb *msgb, unsigned int len)
{
unsigned char *tmp = msgb->data;
msgb->data += len;
msgb->len -= len;
return tmp;
unsigned char *tmp = msgb->data;
msgb->data += len;
msgb->len -= len;
return tmp;
}
static inline uint8_t msgb_get_u8(struct msgb *msgb)
{
uint8_t *space = msgb_get(msgb, 1);
return space[0];
uint8_t *space = msgb_get(msgb, 1);
return space[0];
}
static inline uint16_t msgb_get_u16(struct msgb *msgb)
{
uint8_t *space = msgb_get(msgb, 2);
return space[0] << 8 | space[1];
uint8_t *space = msgb_get(msgb, 2);
return space[0] << 8 | space[1];
}
static inline uint32_t msgb_get_u32(struct msgb *msgb)
{
uint8_t *space = msgb_get(msgb, 4);
return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3];
uint8_t *space = msgb_get(msgb, 4);
return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3];
}
static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len)
{
msgb->data -= len;
msgb->len += len;
return msgb->data;
msgb->data -= len;
msgb->len += len;
return msgb->data;
}
static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len)
{
msgb->len -= len;
return msgb->data += len;
msgb->len -= len;
return msgb->data += len;
}
/* increase the headroom of an empty msgb, reducing the tailroom */
static inline void msgb_reserve(struct msgb *msg, int len)
{
msg->data += len;
msg->tail += len;
msg->data += len;
msg->tail += len;
}
static inline struct msgb *msgb_alloc_headroom(int size, int headroom,
const char *name)
const char *name)
{
struct msgb *msg = msgb_alloc(size, name);
if (msg)
msgb_reserve(msg, headroom);
return msg;
struct msgb *msg = msgb_alloc(size, name);
if (msg)
{
msgb_reserve(msg, headroom);
}
return msg;
}
#endif /* _MSGB_H */
#endif /* __INCLUDE_NUTTX_SERCOM_MSGB_H */

View File

@ -2,7 +2,7 @@
* include/nuttx/serial/uart_16550.h
* Serial driver for 16550 UART
*
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -344,8 +344,8 @@ typedef uint32_t uart_addrwidth_t;
*
************************************************************************************/
extern uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
extern void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
#endif /* CONFIG_16550_UART */
#endif /* __INCLUDE_NUTTX_SERIAL_UART_16550_H */