1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

pios: common PIOS header guards

This commit is contained in:
Oleg Semyonov 2013-03-15 13:09:19 +02:00
parent fc6024d23e
commit e96f717b94
30 changed files with 67 additions and 71 deletions

View File

@ -75,7 +75,7 @@ uint8_t PIOS_ADXL345_Read(struct pios_adxl345_data * data);
int32_t PIOS_ADXL345_FifoElements(); int32_t PIOS_ADXL345_FifoElements();
int32_t PIOS_ADXL345_Test(); int32_t PIOS_ADXL345_Test();
#endif #endif /* PIOS_ADXL345_H */
/** /**
* @} * @}

View File

@ -28,8 +28,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_BL_HELPER_H_ #ifndef PIOS_BL_HELPER_H
#define PIOS_BL_HELPER_H_ #define PIOS_BL_HELPER_H
extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress); extern uint8_t *PIOS_BL_HELPER_FLASH_If_Read(uint32_t SectorAddress);
@ -43,4 +43,4 @@ extern uint8_t PIOS_BL_HELPER_FLASH_Start();
extern void PIOS_BL_HELPER_CRC_Ini(); extern void PIOS_BL_HELPER_CRC_Ini();
#endif /* PIOS_BL_HELPER_H_ */ #endif /* PIOS_BL_HELPER_H */

View File

@ -29,11 +29,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "fifo_buffer.h"
#ifndef PIOS_BMA180_H #ifndef PIOS_BMA180_H
#define PIOS_BMA180_H #define PIOS_BMA180_H
#include "fifo_buffer.h"
#include <pios.h> #include <pios.h>
/* BMA180 Addresses */ /* BMA180 Addresses */

View File

@ -27,6 +27,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_CRC_H
#define PIOS_CRC_H
uint8_t PIOS_CRC_updateByte(uint8_t crc, const uint8_t data); uint8_t PIOS_CRC_updateByte(uint8_t crc, const uint8_t data);
uint8_t PIOS_CRC_updateCRC(uint8_t crc, const uint8_t* data, int32_t length); uint8_t PIOS_CRC_updateCRC(uint8_t crc, const uint8_t* data, int32_t length);
@ -35,3 +38,5 @@ uint16_t PIOS_CRC16_updateCRC(uint16_t crc, const uint8_t* data, int32_t length)
uint32_t PIOS_CRC32_updateByte(uint32_t crc, const uint8_t data); uint32_t PIOS_CRC32_updateByte(uint32_t crc, const uint8_t data);
uint32_t PIOS_CRC32_updateCRC(uint32_t crc, const uint8_t* data, int32_t length); uint32_t PIOS_CRC32_updateCRC(uint32_t crc, const uint8_t* data, int32_t length);
#endif /* PIOS_CRC_H */

View File

@ -37,9 +37,9 @@ extern const char *PIOS_DEBUG_AssertMsg;
void PIOS_DEBUG_Init(void); void PIOS_DEBUG_Init(void);
#else #else
#include <pios_tim_priv.h> #include <pios_tim_priv.h>
void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_channels); void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_channels);
#endif #endif
void PIOS_DEBUG_PinHigh(uint8_t pin); void PIOS_DEBUG_PinHigh(uint8_t pin);
void PIOS_DEBUG_PinLow(uint8_t pin); void PIOS_DEBUG_PinLow(uint8_t pin);
void PIOS_DEBUG_PinValue8Bit(uint8_t value); void PIOS_DEBUG_PinValue8Bit(uint8_t value);

View File

@ -28,7 +28,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_ETASV3_H
#define PIOS_ETASV3_H
#define ETASV3_I2C_ADDR 0x75 #define ETASV3_I2C_ADDR 0x75
int16_t PIOS_ETASV3_ReadAirspeed (void); int16_t PIOS_ETASV3_ReadAirspeed (void);
#endif /* PIOS_ETASV3_H */

View File

@ -24,8 +24,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_FLASH_H_ #ifndef PIOS_FLASH_H
#define PIOS_FLASH_H_ #define PIOS_FLASH_H
#include <stdint.h> #include <stdint.h>
@ -44,4 +44,4 @@ struct pios_flash_driver {
int32_t (*read_data)(uintptr_t flash_id, uint32_t addr, uint8_t * data, uint16_t len); int32_t (*read_data)(uintptr_t flash_id, uint32_t addr, uint8_t * data, uint16_t len);
}; };
#endif /* PIOS_FLASH_H_ */ #endif /* PIOS_FLASH_H */

View File

@ -24,8 +24,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_FLASH_INTERNAL_H_ #ifndef PIOS_FLASH_INTERNAL_H
#define PIOS_FLASH_INTERNAL_H_ #define PIOS_FLASH_INTERNAL_H
#include "pios_flash.h" /* API definition for flash drivers */ #include "pios_flash.h" /* API definition for flash drivers */
@ -37,4 +37,4 @@ struct pios_flash_internal_cfg {
extern int32_t PIOS_Flash_Internal_Init(uintptr_t * flash_id, const struct pios_flash_internal_cfg * cfg); extern int32_t PIOS_Flash_Internal_Init(uintptr_t * flash_id, const struct pios_flash_internal_cfg * cfg);
#endif /* PIOS_FLASH_INTERNAL_H_ */ #endif /* PIOS_FLASH_INTERNAL_H */

View File

@ -28,8 +28,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_FLASH_JEDEC_H_ #ifndef PIOS_FLASH_JEDEC_H
#define PIOS_FLASH_JEDEC_H_ #define PIOS_FLASH_JEDEC_H
#include "pios_flash.h" /* API definition for flash drivers */ #include "pios_flash.h" /* API definition for flash drivers */
@ -49,4 +49,4 @@ struct pios_flash_jedec_cfg {
int32_t PIOS_Flash_Jedec_Init(uintptr_t * flash_id, uint32_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg * cfg); int32_t PIOS_Flash_Jedec_Init(uintptr_t * flash_id, uint32_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg * cfg);
#endif /* PIOS_FLASH_JEDEC_H_ */ #endif /* PIOS_FLASH_JEDEC_H */

View File

@ -24,8 +24,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_FLASHFS_H_ #ifndef PIOS_FLASHFS_H
#define PIOS_FLASHFS_H_ #define PIOS_FLASHFS_H
#include <stdint.h> #include <stdint.h>
@ -34,4 +34,4 @@ int32_t PIOS_FLASHFS_ObjSave(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_
int32_t PIOS_FLASHFS_ObjLoad(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t * obj_data, uint16_t obj_size); int32_t PIOS_FLASHFS_ObjLoad(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t * obj_data, uint16_t obj_size);
int32_t PIOS_FLASHFS_ObjDelete(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id); int32_t PIOS_FLASHFS_ObjDelete(uint32_t fs_id, uint32_t obj_id, uint16_t obj_inst_id);
#endif /* PIOS_FLASHFS_H_ */ #endif /* PIOS_FLASHFS_H */

View File

@ -24,8 +24,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_FLASHFS_LOGFS_PRIV_H_ #ifndef PIOS_FLASHFS_LOGFS_PRIV_H
#define PIOS_FLASHFS_LOGFS_PRIV_H_ #define PIOS_FLASHFS_LOGFS_PRIV_H
#include <stdint.h> #include <stdint.h>
#include "pios_flash.h" /* struct pios_flash_driver */ #include "pios_flash.h" /* struct pios_flash_driver */
@ -43,4 +43,4 @@ struct flashfs_logfs_cfg {
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uintptr_t flash_id); int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t * fs_id, const struct flashfs_logfs_cfg * cfg, const struct pios_flash_driver * driver, uintptr_t flash_id);
#endif /* PIOS_FLASHFS_LOGFS_PRIV_H_ */ #endif /* PIOS_FLASHFS_LOGFS_PRIV_H */

View File

@ -31,8 +31,6 @@
#ifndef PIOS_HMC5883_H #ifndef PIOS_HMC5883_H
#define PIOS_HMC5883_H #define PIOS_HMC5883_H
#include <pios.h>
/* HMC5883 Addresses */ /* HMC5883 Addresses */
#define PIOS_HMC5883_I2C_ADDR 0x1E #define PIOS_HMC5883_I2C_ADDR 0x1E
#define PIOS_HMC5883_I2C_READ_ADDR 0x3D #define PIOS_HMC5883_I2C_READ_ADDR 0x3D
@ -110,6 +108,7 @@ extern int32_t PIOS_HMC5883_ReadMag(int16_t out[3]);
extern uint8_t PIOS_HMC5883_ReadID(uint8_t out[4]); extern uint8_t PIOS_HMC5883_ReadID(uint8_t out[4]);
extern int32_t PIOS_HMC5883_Test(void); extern int32_t PIOS_HMC5883_Test(void);
extern bool PIOS_HMC5883_IRQHandler(); extern bool PIOS_HMC5883_IRQHandler();
#endif /* PIOS_HMC5883_H */ #endif /* PIOS_HMC5883_H */
/** /**

View File

@ -6,8 +6,8 @@
* Author: joe * Author: joe
*/ */
#ifndef PIOS_IAP_H_ #ifndef PIOS_IAP_H
#define PIOS_IAP_H_ #define PIOS_IAP_H
/**************************************************************************************** /****************************************************************************************
@ -42,4 +42,4 @@ void PIOS_IAP_WriteBootCount(uint16_t);
* Public Data * Public Data
****************************************************************************************/ ****************************************************************************************/
#endif /* PIOS_IAP_H_ */ #endif /* PIOS_IAP_H */

View File

@ -98,6 +98,7 @@ extern void StartModules();
(fn->fn_tinit)(); } (fn->fn_tinit)(); }
#endif /* USE_SIM_POSIX */ #endif /* USE_SIM_POSIX */
#endif /* PIOS_INITCALL_H */ #endif /* PIOS_INITCALL_H */
/** /**

View File

@ -32,8 +32,6 @@
#ifndef PIOS_L3GD20_H #ifndef PIOS_L3GD20_H
#define PIOS_L3GD20_H #define PIOS_L3GD20_H
#include "pios.h"
/* L3GD20 Addresses */ /* L3GD20 Addresses */
#define PIOS_L3GD20_WHOAMI 0x0F #define PIOS_L3GD20_WHOAMI 0x0F
#define PIOS_L3GD20_CTRL_REG1 0X20 #define PIOS_L3GD20_CTRL_REG1 0X20

View File

@ -32,8 +32,6 @@
#ifndef PIOS_MPU6000_H #ifndef PIOS_MPU6000_H
#define PIOS_MPU6000_H #define PIOS_MPU6000_H
#include "pios.h"
/* MPU6000 Addresses */ /* MPU6000 Addresses */
#define PIOS_MPU6000_SMPLRT_DIV_REG 0X19 #define PIOS_MPU6000_SMPLRT_DIV_REG 0X19
#define PIOS_MPU6000_DLPF_CFG_REG 0X1A #define PIOS_MPU6000_DLPF_CFG_REG 0X1A

View File

@ -28,8 +28,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_MPXV_H__ #ifndef PIOS_MPXV_H
#define PIOS_MPXV_H__ #define PIOS_MPXV_H
typedef enum{ PIOS_MPXV_UNKNOWN,PIOS_MPXV_5004,PIOS_MPXV_7002 } PIOS_MPXV_sensortype; typedef enum{ PIOS_MPXV_UNKNOWN,PIOS_MPXV_5004,PIOS_MPXV_7002 } PIOS_MPXV_sensortype;
typedef struct{ typedef struct{
@ -63,4 +63,4 @@ uint16_t PIOS_MPXV_Measure(PIOS_MPXV_descriptor *desc);
uint16_t PIOS_MPXV_Calibrate(PIOS_MPXV_descriptor *desc, uint16_t measurement); uint16_t PIOS_MPXV_Calibrate(PIOS_MPXV_descriptor *desc, uint16_t measurement);
float PIOS_MPXV_CalcAirspeed (PIOS_MPXV_descriptor *desc,uint16_t measurement); float PIOS_MPXV_CalcAirspeed (PIOS_MPXV_descriptor *desc,uint16_t measurement);
#endif // PIOS_MPXV_H__ #endif /* PIOS_MPXV_H */

View File

@ -31,8 +31,6 @@
#ifndef PIOS_MS5611_H #ifndef PIOS_MS5611_H
#define PIOS_MS5611_H #define PIOS_MS5611_H
#include <pios.h>
/* BMP085 Addresses */ /* BMP085 Addresses */
#define MS5611_I2C_ADDR 0x77 #define MS5611_I2C_ADDR 0x77
#define MS5611_RESET 0x1E #define MS5611_RESET 0x1E

View File

@ -40,5 +40,4 @@ typedef enum {FALSE = 0, TRUE = !FALSE} bool;
//#define PIOS_SERVO_NUM_OUTPUTS 8 //#define PIOS_SERVO_NUM_OUTPUTS 8
//#define PIOS_SERVO_NUM_TIMERS PIOS_SERVO_NUM_OUTPUTS //#define PIOS_SERVO_NUM_TIMERS PIOS_SERVO_NUM_OUTPUTS
#endif #endif /* PIOS_POSIX_H */

View File

@ -31,8 +31,6 @@
#ifndef PIOS_SDCARD_H #ifndef PIOS_SDCARD_H
#define PIOS_SDCARD_H #define PIOS_SDCARD_H
#if defined(PIOS_INCLUDE_SDCARD)
/* Public Functions */ /* Public Functions */
typedef struct { typedef struct {
uint8_t CSDStruct; /* CSD structure */ uint8_t CSDStruct; /* CSD structure */
@ -113,6 +111,4 @@ extern int32_t PIOS_SDCARD_ReadLine(PFILEINFO fileinfo, uint8_t * buffer, uint32
extern int32_t PIOS_SDCARD_FileCopy(char *Source, char *Destination); extern int32_t PIOS_SDCARD_FileCopy(char *Source, char *Destination);
extern int32_t PIOS_SDCARD_FileDelete(char *Filename); extern int32_t PIOS_SDCARD_FileDelete(char *Filename);
#endif
#endif /* PIOS_SDCARD_H */ #endif /* PIOS_SDCARD_H */

View File

@ -60,6 +60,7 @@ struct pios_spi_dev {
}; };
extern int32_t PIOS_SPI_Init(uint32_t * spi_id, const struct pios_spi_cfg * cfg); extern int32_t PIOS_SPI_Init(uint32_t * spi_id, const struct pios_spi_cfg * cfg);
#endif /* PIOS_SPI_PRIV_H */ #endif /* PIOS_SPI_PRIV_H */
/** /**

View File

@ -7,6 +7,12 @@
* @member: the name of the member within the struct. * @member: the name of the member within the struct.
* *
*/ */
#ifndef PIOS_STRUCT_HELPER_H
#define PIOS_STRUCT_HELPER_H
#define container_of(ptr, type, member) ({ \ #define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );}) (type *)( (char *)__mptr - offsetof(type,member) );})
#endif /* PIOS_STRUCT_HELPER_H */

View File

@ -31,8 +31,6 @@
#ifndef PIOS_USART_H #ifndef PIOS_USART_H
#define PIOS_USART_H #define PIOS_USART_H
#include <pios_stm32.h>
/* Global Types */ /* Global Types */
/* Public Functions */ /* Public Functions */

View File

@ -47,4 +47,3 @@ extern int32_t PIOS_USB_Init(uint32_t * usb_id, const struct pios_usb_cfg * cfg)
* @} * @}
* @} * @}
*/ */

View File

@ -1,3 +1,8 @@
#ifndef PIOS_USB_RCTX_H
#define PIOS_USB_RCTX_H
extern uint32_t pios_usb_rctx_id; extern uint32_t pios_usb_rctx_id;
extern void PIOS_USB_RCTX_Update(uint32_t usbrctx_id, const uint16_t channel[], const int16_t channel_min[], const int16_t channel_max[], uint8_t num_channels); extern void PIOS_USB_RCTX_Update(uint32_t usbrctx_id, const uint16_t channel[], const int16_t channel_min[], const int16_t channel_max[], uint8_t num_channels);
#endif /* PIOS_USB_RCTX_H */

View File

@ -32,11 +32,6 @@
#ifndef PIOS_VIDEO_H #ifndef PIOS_VIDEO_H
#define PIOS_VIDEO_H #define PIOS_VIDEO_H
#include <pios.h>
// *****************************************************************************
#if defined(PIOS_INCLUDE_VIDEO)
#include <pios_stm32.h> #include <pios_stm32.h>
#include <pios_spi_priv.h> #include <pios_spi_priv.h>
@ -107,5 +102,4 @@ extern bool PIOS_Vsync_ISR();
// Macro to swap buffers given a temporary pointer. // Macro to swap buffers given a temporary pointer.
#define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; } #define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; }
#endif
#endif /* PIOS_VIDEO_H */ #endif /* PIOS_VIDEO_H */

View File

@ -32,12 +32,8 @@
#ifndef PIOS_WAVPLAY_H #ifndef PIOS_WAVPLAY_H
#define PIOS_WAVPLAY_H #define PIOS_WAVPLAY_H
#include <pios.h>
// *****************************************************************************
#if defined(PIOS_INCLUDE_WAVE)
#include <pios_stm32.h> #include <pios_stm32.h>
#define BUFFERSIZE 512 //Defines the buffer size to hold data from the SD card. #define BUFFERSIZE 512 //Defines the buffer size to hold data from the SD card.
struct pios_dac_cfg { struct pios_dac_cfg {
@ -53,5 +49,4 @@ struct pios_dac_cfg {
extern void PIOS_WavPlay_Init(const struct pios_dac_cfg * cfg); extern void PIOS_WavPlay_Init(const struct pios_dac_cfg * cfg);
extern uint8_t WavePlayer_Start(void); extern uint8_t WavePlayer_Start(void);
#endif #endif /* PIOS_WAVPLAY_H */
#endif /* PIOS_VIDEO_H */

View File

@ -28,8 +28,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef PIOS_WDG #ifndef PIOS_WDG_H
#define PIOS_WDG #define PIOS_WDG_H
uint16_t PIOS_WDG_Init(); uint16_t PIOS_WDG_Init();
bool PIOS_WDG_RegisterFlag(uint16_t flag_requested); bool PIOS_WDG_RegisterFlag(uint16_t flag_requested);
@ -38,4 +38,4 @@ uint16_t PIOS_WDG_GetBootupFlags();
uint16_t PIOS_WDG_GetActiveFlags(); uint16_t PIOS_WDG_GetActiveFlags();
void PIOS_WDG_Clear(void); void PIOS_WDG_Clear(void);
#endif #endif /* PIOS_WDG_H */