hal_interface_api.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __HAL_INTERFACE_API_H__
  2. #define __HAL_INTERFACE_API_H__
  3. #include <linux/types.h>
  4. #include "stm32f429xx.h"
  5. #include "com_gpio.h"
  6. /* GPIO Interface */
  7. void stm32_gpio_init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init);
  8. void stm32_gpio_write(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
  9. GPIO_PinState stm32_gpio_read(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
  10. /* I2C Interface */
  11. int stm32_i2c_master_write(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
  12. int stm32_i2c_master_read(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
  13. int stm32_i2c_set_addr(int fd, uint8_t OwnAddress);
  14. int stm32_i2c_slave_recv(int fd, uint8_t *pBuf);
  15. int stm32_i2c_master_write_read(int fd, uint8_t address, uint8_t *pWrBuf, uint8_t writeLen, uint8_t *pRdBuf, uint8_t readLen);
  16. /* FMC Interface */
  17. int fmc_write_8bit(uint32_t address, uint8_t *buf, uint32_t len);
  18. int fmc_read_8bit(uint32_t address, uint8_t *buf, uint32_t len);
  19. int fmc_write_16bit(uint32_t address, uint16_t *buf, uint32_t len);
  20. int fmc_read_16bit(uint32_t address, uint16_t *buf, uint32_t len);
  21. int fmc_write_32bit(uint32_t address, uint32_t *buf, uint32_t len);
  22. int fmc_read_32bit(uint32_t address, uint32_t *buf, uint32_t len);
  23. int fmc_set_bus_width(uint8_t bus_is16bit);
  24. /* SPI Interface */
  25. int stm32_spi_master_read(uint8_t spi, uint8_t *pBuf, uint32_t size);
  26. int stm32_spi_master_write(uint8_t spi, uint8_t *pBuf, uint32_t size);
  27. int stm32_spi_master_write_read(uint8_t spi, uint8_t *txBuf, uint32_t txSize, uint8_t *rxBuf, uint32_t rxSize);
  28. int sf_get_id(uint8_t spi, uint8_t *id);
  29. int sf_sector_erase(uint8_t spi, uint32_t Address);
  30. int sf_read(uint8_t spi, uint32_t Address, uint8_t *buf, uint32_t size);
  31. int sf_write(uint8_t spi, uint32_t Address, uint8_t *buf, uint32_t size);
  32. int sf_chip_erase(uint8_t spi);
  33. /* ADC Interface */
  34. int stm32_adc_get_value(uint8_t channel, uint16_t *value);
  35. /* UART Interface */
  36. /* Platform Interface */
  37. int stm32_reset_mcu(void);
  38. uint32_t stm32_generate_random32bit(void);
  39. /* gpio i2c */
  40. int stm32_gpio_i2c_master_write(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
  41. int stm32_gpio_i2c_master_read(int fd, uint8_t address, uint8_t *pBuf, uint16_t size);
  42. #endif /* __HAL_INTERFACE_API_H__ */