Fix a few errors concerning use of section block comments in .c files: (#95)

1. No .c file should include a "Public Types" section.  Only a header file can define a public type.  A .c file can only define a private type.  Several files contained private type definitions.  The section that they were defined in, however, was incorrectly named "Public Types."  Those were easilty changed to "Private Types" which is what they are.

2. No .c file should include a "Public Function Prototypes" section.  All global function prototypes should be provided via a header file and never declared with a .c file.

For No. 2, I corrected as many cases as was reasonable for the time that I had available.  But there are still a dozen or so .c files that declare "Public Function Prototypes" within a .c file.  This is bad programming style.  These declarations should all be moved to the proper header files.
This commit is contained in:
patacongo
2020-01-13 17:37:54 -06:00
committed by Abdelatif Guettouche
parent f8bcd58be2
commit f00569816f
33 changed files with 71 additions and 234 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ static int (*intc_handler[])(int irq, FAR void *context, FAR void *arg) = {
}; };
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This structure describes one DMA channel */ /* This structure describes one DMA channel */
+1 -1
View File
@@ -65,7 +65,7 @@
#define ALIGN_UP(v, m) (((v) + (m)) & ~m) #define ALIGN_UP(v, m) (((v) + (m)) & ~m)
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This structure describes one DMA channel */ /* This structure describes one DMA channel */
+2 -1
View File
@@ -63,8 +63,9 @@
#define ALIGN_UP(v,m) (((v) + (m)) & ~m) #define ALIGN_UP(v,m) (((v) + (m)) & ~m)
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This structure describes one DMA channel */ /* This structure describes one DMA channel */
struct dma_channel_s struct dma_channel_s
+1 -1
View File
@@ -152,7 +152,7 @@ static int efm32_odd_interrupt(int irq, void *context, FAR void *arg)
} }
/************************************************************************************ /************************************************************************************
* Public Function Prototypes * Public Functions
************************************************************************************/ ************************************************************************************/
/************************************************************************************ /************************************************************************************
+1 -1
View File
@@ -102,7 +102,7 @@ static const struct section_mapping_s section_mapping[] =
************************************************************************************/ ************************************************************************************/
/* All i.MX architectures must provide the following entry point. This entry point /* All i.MX architectures must provide the following entry point. This entry point
* is called early in the intitialization -- after all memory has been configured * is called early in the initialization -- after all memory has been configured
* and mapped but before any devices have been initialized. * and mapped but before any devices have been initialized.
*/ */
+1 -1
View File
@@ -51,7 +51,7 @@
struct mm_heap_s g_ccm_heap; struct mm_heap_s g_ccm_heap;
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Functions
****************************************************************************/ ****************************************************************************/
#endif /* HAVE_CCM_HEAP */ #endif /* HAVE_CCM_HEAP */
+1 -9
View File
@@ -43,14 +43,6 @@
#ifdef HAVE_DTCM_HEAP #ifdef HAVE_DTCM_HEAP
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
@@ -58,7 +50,7 @@
struct mm_heap_s g_dtcm_heap; struct mm_heap_s g_dtcm_heap;
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Functions
****************************************************************************/ ****************************************************************************/
#endif /* HAVE_DTCM_HEAP */ #endif /* HAVE_DTCM_HEAP */
+1 -1
View File
@@ -110,7 +110,7 @@
#define MEBIPORT_K 2 #define MEBIPORT_K 2
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
struct gpio_piminfo_s struct gpio_piminfo_s
+1 -1
View File
@@ -386,7 +386,7 @@
#define NX_ALIGN32 __attribute__((aligned(32))) #define NX_ALIGN32 __attribute__((aligned(32)))
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* Ethernet TX DMA Descriptor */ /* Ethernet TX DMA Descriptor */
+3 -1
View File
@@ -43,14 +43,16 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Must match definitions in arch/sim/include/spinlock.h */ /* Must match definitions in arch/sim/include/spinlock.h */
#define SP_UNLOCKED 0 /* The Un-locked state */ #define SP_UNLOCKED 0 /* The Un-locked state */
#define SP_LOCKED 1 /* The Locked state */ #define SP_LOCKED 1 /* The Locked state */
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* Must match definitions in arch/sim/include/spinlock.h */ /* Must match definitions in arch/sim/include/spinlock.h */
typedef uint8_t spinlock_t; typedef uint8_t spinlock_t;
@@ -66,10 +66,6 @@
#define AUDIO_DNC_ID_NUM (CXD56_AUDIO_DNC_ID_FF + 1) #define AUDIO_DNC_ID_NUM (CXD56_AUDIO_DNC_ID_FF + 1)
#define AUDIO_VOL_ID_NUM (CXD56_AUDIO_VOLID_MIXER_OUT + 1) #define AUDIO_VOL_ID_NUM (CXD56_AUDIO_VOLID_MIXER_OUT + 1)
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@@ -114,10 +114,6 @@
#define SRCIN_SEL_AU_DAT_SEL2 1 #define SRCIN_SEL_AU_DAT_SEL2 1
#define SRCIN_SEL_CODECDSP_MIX 3 #define SRCIN_SEL_CODECDSP_MIX 3
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@@ -449,10 +445,6 @@ const struct audio_ac_reg_s g_ac_reg[RI_REG_MAX_ENTRY] =
{0x0780, 0, 1, 0x00000000}, /* RAM_RW_EN (0x00) */ {0x0780, 0, 1, 0x00000000}, /* RAM_RW_EN (0x00) */
}; };
/****************************************************************************
* Public Data
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -356,14 +356,6 @@ typedef enum
extern uint32_t as_aca_control(uint8_t type, uint32_t param); extern uint32_t as_aca_control(uint8_t type, uint32_t param);
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -64,9 +64,9 @@
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div); inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
inline void cxd56_audio_clock_disable(void); inline void cxd56_audio_clock_disable(void);
inline bool cxd56_audio_clock_is_enabled(void); inline bool cxd56_audio_clock_is_enabled(void);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -70,14 +70,6 @@ enum dma_i2s_out_sel_e
#define BCA_REG_MAX_BIT 32 #define BCA_REG_MAX_BIT 32
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/***************************************************************************
* Private Data
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
@@ -63,10 +63,6 @@
#define VOL_MIN -90 #define VOL_MIN -90
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@@ -83,10 +79,6 @@ static const uint16_t g_beepfreqtable[] =
3840, 4085, 94 3840, 4085, 94
}; };
/***************************************************************************
* Public Data
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -47,10 +47,6 @@
#define MIC_CH_BITNUM 4 #define MIC_CH_BITNUM 4
#define MIC_CH_BITMAP 0xf #define MIC_CH_BITMAP 0xf
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@@ -64,6 +60,7 @@ struct cxd56_audio_cfg_s
cxd56_audio_clkmode_t clk_mode; cxd56_audio_clkmode_t clk_mode;
cxd56_audio_sp_drv_t sp_driver; cxd56_audio_sp_drv_t sp_driver;
}; };
static struct cxd56_audio_cfg_s g_audio_cfg = static struct cxd56_audio_cfg_s g_audio_cfg =
{ {
1, 1,
@@ -74,10 +71,6 @@ static struct cxd56_audio_cfg_s g_audio_cfg =
CXD56_AUDIO_CFG_SP_DRIVER CXD56_AUDIO_CFG_SP_DRIVER
}; };
/****************************************************************************
* Public Data
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -45,26 +45,6 @@
#include "cxd56_audio_bca_reg.h" #include "cxd56_audio_bca_reg.h"
#include "cxd56_audio_digital.h" #include "cxd56_audio_digital.h"
/***************************************************************************
* Pre-processor Definitions
****************************************************************************/
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/***************************************************************************
* Private Data
****************************************************************************/
/***************************************************************************
* Public Data
****************************************************************************/
/***************************************************************************
* Private Functions
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -92,9 +92,11 @@ enum audio_irq_reg_type_e
#define DMA_SMP_WAIT_HIRES 10 /* usec per sample. */ #define DMA_SMP_WAIT_HIRES 10 /* usec per sample. */
#define DMA_SMP_WAIT_NORMALT 40 /* usec per sample. */ #define DMA_SMP_WAIT_NORMALT 40 /* usec per sample. */
/*************************************************************************** /* Private Macros */
* Public Function Prototypes
****************************************************************************/ #define SET_DMA_ACT(_path_) g_dma_act_status |= (1 << _path_)
#define CLR_DMA_ACT(_path_) g_dma_act_status &= ~(1 << _path_)
#define IS_DMA_ACT(_path_) ((g_dma_act_status & (1 << _path_)) != 0)
/*************************************************************************** /***************************************************************************
* Private Data * Private Data
@@ -110,18 +112,6 @@ static bool s_work_arroud_dmac[DMA_HANDLE_MAX_NUM] =
true true
}; };
/***************************************************************************
* Private Macro
****************************************************************************/
#define SET_DMA_ACT(_path_) g_dma_act_status |= (1 << _path_)
#define CLR_DMA_ACT(_path_) g_dma_act_status &= ~(1 << _path_)
#define IS_DMA_ACT(_path_) ((g_dma_act_status & (1 << _path_)) != 0)
/***************************************************************************
* Public Data
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -43,26 +43,6 @@
#include "cxd56_audio_filter.h" #include "cxd56_audio_filter.h"
#include "cxd56_audio_ac_reg.h" #include "cxd56_audio_ac_reg.h"
/***************************************************************************
* Pre-processor Definitions
****************************************************************************/
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/***************************************************************************
* Private Data
****************************************************************************/
/***************************************************************************
* Public Data
****************************************************************************/
/***************************************************************************
* Private Functions
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -43,28 +43,12 @@
#include "cxd56_audio_irq.h" #include "cxd56_audio_irq.h"
/***************************************************************************
* Pre-processor Definitions
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
extern void cxd56_audio_dma_int_handler(void); extern void cxd56_audio_dma_int_handler(void);
/***************************************************************************
* Private Data
****************************************************************************/
/***************************************************************************
* Public Data
****************************************************************************/
/***************************************************************************
* Private Functions
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -54,22 +54,6 @@
#define MIC_CH_BITNUM 4 #define MIC_CH_BITNUM 4
#define MIC_CH_BITMAP 0xf #define MIC_CH_BITMAP 0xf
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/***************************************************************************
* Private Data
****************************************************************************/
/***************************************************************************
* Public Data
****************************************************************************/
/***************************************************************************
* Private Functions
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@@ -50,22 +50,6 @@
#include "cxd56_audio_ac_reg.h" #include "cxd56_audio_ac_reg.h"
#include "cxd56_audio_bca_reg.h" #include "cxd56_audio_bca_reg.h"
/***************************************************************************
* Pre-processor Definitions
****************************************************************************/
/***************************************************************************
* Public Function Prototypes
****************************************************************************/
/***************************************************************************
* Private Data
****************************************************************************/
/***************************************************************************
* Public Data
****************************************************************************/
/*************************************************************************** /***************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -75,10 +75,6 @@
#define VOL_MUTE_TIME(vol, n_cycle) \ #define VOL_MUTE_TIME(vol, n_cycle) \
(((VOL_TO_REG(vol) - MUTE_VOL_REG) & 0xff) * (n_cycle + 1) * 4 / 48 * 1000) (((VOL_TO_REG(vol) - MUTE_VOL_REG) & 0xff) * (n_cycle + 1) * 4 / 48 * 1000)
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Type * Private Type
****************************************************************************/ ****************************************************************************/
@@ -100,10 +96,6 @@ static struct set_vol_prm_s g_volparam[VOLUME_NUM] =
{VOLUME_MUTE, MUTE_BIT_API} {VOLUME_MUTE, MUTE_BIT_API}
}; };
/****************************************************************************
* Public Data
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -174,8 +174,6 @@ int imxrt_mmcsd_spi_initialize(int minor);
void imxrt_autoled_initialize(void); void imxrt_autoled_initialize(void);
#endif #endif
#ifdef CONFIG_DEV_GPIO
/**************************************************************************** /****************************************************************************
* Name: imxrt_gpio_initialize * Name: imxrt_gpio_initialize
* *
@@ -184,8 +182,20 @@ void imxrt_autoled_initialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_DEV_GPIO
int imxrt_gpio_initialize(void); int imxrt_gpio_initialize(void);
#endif #endif
/****************************************************************************
* Name: imxrt_usbhost_initialize
*
* Description:
*
****************************************************************************/
#ifdef CONFIG_USBHOST
int imxrt_usbhost_initialize(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_IMXRT_IMXRT1020_EVK_SRC_IMXRT1020_EVK_H */ #endif /* __BOARDS_ARM_IMXRT_IMXRT1020_EVK_SRC_IMXRT1020_EVK_H */
@@ -82,14 +82,6 @@
# define MMCSD_MINOR 0 # define MMCSD_MINOR 0
#endif #endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_USBHOST
int imxrt_usbhost_initialize(void);
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -51,7 +51,7 @@
#include "bambino-200e.h" #include "bambino-200e.h"
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
enum devid_e enum devid_e
@@ -210,5 +210,29 @@ int stm32_can_setup(void);
int stm32_timer_driver_setup(FAR const char *devpath, int timer); int stm32_timer_driver_setup(FAR const char *devpath, int timer);
#endif #endif
/****************************************************************************
* Name: stm32_mpu6000_initialize
*
* Description:
* Initialize the MPU6000 device.
*
****************************************************************************/
#ifdef CONFIG_SENSORS_MPU60X0
int stm32_mpu6000_initialize(void);
#endif
/****************************************************************************
* Name: stm32_max7456_initialize
*
* Description:
* Initialize the MAX7456 OSD device.
*
****************************************************************************/
#ifdef CONFIG_VIDEO_MAX7456
int stm32_max7456_initialize(void);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_STM32_OMNIBUSF4_SRC_OMNIBUSF4_H */ #endif /* __BOARDS_ARM_STM32_OMNIBUSF4_SRC_OMNIBUSF4_H */
@@ -78,22 +78,6 @@
# include "stm32_rtc.h" # include "stm32_rtc.h"
#endif #endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_SENSORS_MPU60X0
/* Initialize the MPU6000 device. */
int stm32_mpu6000_initialize(void);
#endif
#ifdef CONFIG_VIDEO_MAX7456
/* Initialize the MAX7456 OSD device. */
int stm32_max7456_initialize(void);
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
-16
View File
@@ -49,22 +49,6 @@
#include "nxffs.h" #include "nxffs.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
+1 -5
View File
@@ -52,11 +52,7 @@
#include "nxffs.h" #include "nxffs.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Private Types
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/ ****************************************************************************/
/* This structure supports access to one inode data stream */ /* This structure supports access to one inode data stream */
+10 -9
View File
@@ -54,15 +54,16 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* #if 0
#define VERBOSE # define VERBOSE
#define DBG # define DBG
*/ #endif
// BDF Specification Version 2.2: /* BDF Specification Version 2.2:
// This version lifts the restriction on line length. In this version, the new * This version lifts the restriction on line length. In this version, the new
// maximum length of a value of the type string is 65535 characters, and hence * maximum length of a value of the type string is 65535 characters, and hence
// lines may now be at least this long. * lines may now be at least this long.
*/
#define BDF_MAX_LINE_LENGTH 65535 #define BDF_MAX_LINE_LENGTH 65535
@@ -75,7 +76,7 @@
#define NXFONT_MAX8BIT 255 #define NXFONT_MAX8BIT 255
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* This structure holds information about a glyph */ /* This structure holds information about a glyph */
+1 -1
View File
@@ -59,7 +59,7 @@
#ifdef CONFIG_NETDEV_IOCTL /* Not optional! */ #ifdef CONFIG_NETDEV_IOCTL /* Not optional! */
/**************************************************************************** /****************************************************************************
* Public Types * Private Types
****************************************************************************/ ****************************************************************************/
/* These structures encapsulate all globals used by the IOCTL logic. */ /* These structures encapsulate all globals used by the IOCTL logic. */