refractor include chain with following policies
- header file only include what it needs for its declarations.
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "primitive_types.h"
|
||||
|
||||
/// n-th Bit
|
||||
#define BIT_(n) (1 << (n))
|
||||
|
||||
@@ -56,18 +56,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//------------- Standard Header -------------//
|
||||
#include "primitive_types.h"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//------------- TUSB Option Header -------------//
|
||||
#include "tusb_option.h"
|
||||
|
||||
//------------- General Header -------------//
|
||||
#include "compiler/compiler.h"
|
||||
#include "assertion.h"
|
||||
#include "binary.h"
|
||||
#include "errors.h"
|
||||
|
||||
#include "tusb_option.h"
|
||||
#include "hal/hal.h"
|
||||
//------------- TUSB Header -------------//
|
||||
//#include "hal/hal.h"
|
||||
#include "core/tusb_types.h"
|
||||
#include "core/std_descriptors.h"
|
||||
#include "core/std_request.h"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#ifndef _TUSB_ERRORS_H_
|
||||
#define _TUSB_ERRORS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "primitive_types.h"
|
||||
#include "../tusb_option.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
/**************************************************************************/
|
||||
static inline void mutex_lock (fifo_t* f)
|
||||
{
|
||||
if (f->irq > 0)
|
||||
NVIC_DisableIRQ(f->irq);
|
||||
// if (f->irq > 0)
|
||||
// NVIC_DisableIRQ(f->irq);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -62,8 +62,8 @@ static inline void mutex_lock (fifo_t* f)
|
||||
/**************************************************************************/
|
||||
static inline void mutex_unlock (fifo_t* f)
|
||||
{
|
||||
if (f->irq > 0)
|
||||
NVIC_EnableIRQ(f->irq);
|
||||
// if (f->irq > 0)
|
||||
// NVIC_EnableIRQ(f->irq);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -84,7 +84,7 @@ static inline void mutex_unlock (fifo_t* f)
|
||||
Set the -1 if not required.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQn_Type irq)
|
||||
bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable) //, IRQn_Type irq)
|
||||
{
|
||||
ASSERT(size > 0, false);
|
||||
|
||||
@@ -92,7 +92,7 @@ bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQ
|
||||
f->size = size;
|
||||
f->rd_ptr = f->wr_ptr = f->len = 0;
|
||||
f->overwritable = overwritable;
|
||||
f->irq = irq;
|
||||
// f->irq = irq;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ typedef struct _fifo_t
|
||||
volatile uint16_t wr_ptr ; ///< write pointer
|
||||
volatile uint16_t rd_ptr ; ///< read pointer
|
||||
bool overwritable ; ///< allow overwrite data when full
|
||||
IRQn_Type irq ; ///< TODO (abstract later) interrupt used to lock fifo
|
||||
// IRQn_Type irq ; ///< TODO (abstract later) interrupt used to lock fifo
|
||||
} fifo_t;
|
||||
|
||||
bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQn_Type irq);
|
||||
bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable); //, IRQn_Type irq);
|
||||
bool fifo_write(fifo_t* f, uint8_t data);
|
||||
bool fifo_read(fifo_t* f, uint8_t *data);
|
||||
uint16_t fifo_read_n(fifo_t* f, uint8_t * rx, uint16_t maxlen);
|
||||
|
||||
Reference in New Issue
Block a user