Merging pull request #63 Improvements to STM32F1 I2C, CAN, RCC, and USB (f107)
Merge remote-tracking branch 'icd/master'
This commit is contained in:
@@ -439,6 +439,7 @@ LGPL License Terms @ref lgpl_license
|
||||
#define CAN_BTR_SJW_3TQ (0x2 << 24)
|
||||
#define CAN_BTR_SJW_4TQ (0x3 << 24)
|
||||
#define CAN_BTR_SJW_MASK (0x3 << 24)
|
||||
#define CAN_BTR_SJW_SHIFT 24
|
||||
|
||||
/* 23 Reserved, forced by hardware to 0 */
|
||||
|
||||
@@ -452,6 +453,7 @@ LGPL License Terms @ref lgpl_license
|
||||
#define CAN_BTR_TS2_7TQ (0x6 << 20)
|
||||
#define CAN_BTR_TS2_8TQ (0x7 << 20)
|
||||
#define CAN_BTR_TS2_MASK (0x7 << 20)
|
||||
#define CAN_BTR_TS2_SHIFT 20
|
||||
|
||||
/* TS1[3:0]: Time segment 1 */
|
||||
#define CAN_BTR_TS1_1TQ (0x0 << 16)
|
||||
@@ -471,6 +473,7 @@ LGPL License Terms @ref lgpl_license
|
||||
#define CAN_BTR_TS1_15TQ (0xE << 16)
|
||||
#define CAN_BTR_TS1_16TQ (0xF << 16)
|
||||
#define CAN_BTR_TS1_MASK (0xF << 16)
|
||||
#define CAN_BTR_TS1_SHIFT 16
|
||||
|
||||
/* 15:10 Reserved, forced by hardware to 0 */
|
||||
|
||||
@@ -641,7 +644,8 @@ BEGIN_DECLS
|
||||
|
||||
void can_reset(u32 canport);
|
||||
int can_init(u32 canport, bool ttcm, bool abom, bool awum, bool nart,
|
||||
bool rflm, bool txfp, u32 sjw, u32 ts1, u32 ts2, u32 brp);
|
||||
bool rflm, bool txfp, u32 sjw, u32 ts1, u32 ts2, u32 brp,
|
||||
bool loopback, bool silent);
|
||||
|
||||
void can_filter_init(u32 canport, u32 nr, bool scale_32bit, bool id_list_mode,
|
||||
u32 fr1, u32 fr2, u32 fifo, bool enable);
|
||||
@@ -662,7 +666,7 @@ void can_receive(u32 canport, u8 fifo, bool release, u32 *id, bool *ext,
|
||||
bool *rtr, u32 *fmi, u8 *length, u8 *data);
|
||||
|
||||
void can_fifo_release(u32 canport, u8 fifo);
|
||||
|
||||
bool can_available_mailbox(u32 canport);
|
||||
END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,6 +51,15 @@ u16 desig_get_flash_size(void);
|
||||
*/
|
||||
void desig_get_unique_id(u32 result[]);
|
||||
|
||||
/**
|
||||
* Read the full 96 bit unique identifier and return it as a
|
||||
* zero-terminated string
|
||||
* @param string memory region to write the result to
|
||||
8 @param string_len the size of string in bytes
|
||||
*/
|
||||
void desig_get_unique_id_as_string(char *string,
|
||||
unsigned int string_len);
|
||||
|
||||
END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -394,6 +394,7 @@ void dma_disable_channel(u32 dma, u8 channel);
|
||||
void dma_set_peripheral_address(u32 dma, u8 channel, u32 address);
|
||||
void dma_set_memory_address(u32 dma, u8 channel, u32 address);
|
||||
void dma_set_number_of_data(u32 dma, u8 channel, u16 number);
|
||||
void dma_clear_flag(u32 dma, u32 flag);
|
||||
|
||||
END_DECLS
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ LGPL License Terms @ref lgpl_license
|
||||
#define RCC_CFGR_MCO_SYSCLK 0x4
|
||||
#define RCC_CFGR_MCO_HSICLK 0x5
|
||||
#define RCC_CFGR_MCO_HSECLK 0x6
|
||||
#define RCC_CFGR_RMCO_PLLCLK_DIV2 0x7
|
||||
#define RCC_CFGR_MCO_PLLCLK_DIV2 0x7
|
||||
#define RCC_CFGR_MCO_PLL2CLK 0x8 /* (**) */
|
||||
#define RCC_CFGR_MCO_PLL3CLK_DIV2 0x9 /* (**) */
|
||||
#define RCC_CFGR_MCO_XT1 0xa /* (**) */
|
||||
@@ -448,6 +448,24 @@ LGPL License Terms @ref lgpl_license
|
||||
#define RCC_CFGR2_PLL2MUL_PLL2_CLK_MUL16 0xe
|
||||
#define RCC_CFGR2_PLL2MUL_PLL2_CLK_MUL20 0xf
|
||||
|
||||
/* PREDIV: PREDIV division factor */
|
||||
#define RCC_CFGR2_PREDIV_NODIV 0x0
|
||||
#define RCC_CFGR2_PREDIV_DIV2 0x1
|
||||
#define RCC_CFGR2_PREDIV_DIV3 0x2
|
||||
#define RCC_CFGR2_PREDIV_DIV4 0x3
|
||||
#define RCC_CFGR2_PREDIV_DIV5 0x4
|
||||
#define RCC_CFGR2_PREDIV_DIV6 0x5
|
||||
#define RCC_CFGR2_PREDIV_DIV7 0x6
|
||||
#define RCC_CFGR2_PREDIV_DIV8 0x7
|
||||
#define RCC_CFGR2_PREDIV_DIV9 0x8
|
||||
#define RCC_CFGR2_PREDIV_DIV10 0x9
|
||||
#define RCC_CFGR2_PREDIV_DIV11 0xa
|
||||
#define RCC_CFGR2_PREDIV_DIV12 0xb
|
||||
#define RCC_CFGR2_PREDIV_DIV13 0xc
|
||||
#define RCC_CFGR2_PREDIV_DIV14 0xd
|
||||
#define RCC_CFGR2_PREDIV_DIV15 0xe
|
||||
#define RCC_CFGR2_PREDIV_DIV16 0xf
|
||||
|
||||
/* PREDIV2: PREDIV2 division factor */
|
||||
#define RCC_CFGR2_PREDIV2_NODIV 0x0
|
||||
#define RCC_CFGR2_PREDIV2_DIV2 0x1
|
||||
@@ -473,7 +491,7 @@ extern u32 rcc_ppre2_frequency;
|
||||
/* --- Function prototypes ------------------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
PLL, HSE, HSI, LSE, LSI
|
||||
PLL, PLL2, PLL3, HSE, HSI, LSE, LSI
|
||||
} osc_t;
|
||||
|
||||
BEGIN_DECLS
|
||||
@@ -489,6 +507,7 @@ void rcc_osc_on(osc_t osc);
|
||||
void rcc_osc_off(osc_t osc);
|
||||
void rcc_css_enable(void);
|
||||
void rcc_css_disable(void);
|
||||
void rcc_set_mco(u32 mcosrc);
|
||||
void rcc_osc_bypass_enable(osc_t osc);
|
||||
void rcc_osc_bypass_disable(osc_t osc);
|
||||
void rcc_peripheral_enable_clock(volatile u32 *reg, u32 en);
|
||||
@@ -497,6 +516,7 @@ void rcc_peripheral_reset(volatile u32 *reg, u32 reset);
|
||||
void rcc_peripheral_clear_reset(volatile u32 *reg, u32 clear_reset);
|
||||
void rcc_set_sysclk_source(u32 clk);
|
||||
void rcc_set_pll_multiplication_factor(u32 mul);
|
||||
void rcc_set_pll2_multiplication_factor(u32 mul);
|
||||
void rcc_set_pll_source(u32 pllsrc);
|
||||
void rcc_set_pllxtpre(u32 pllxtpre);
|
||||
void rcc_set_adcpre(u32 adcpre);
|
||||
@@ -512,6 +532,7 @@ void rcc_clock_setup_in_hse_8mhz_out_24mhz(void);
|
||||
void rcc_clock_setup_in_hse_8mhz_out_72mhz(void);
|
||||
void rcc_clock_setup_in_hse_12mhz_out_72mhz(void);
|
||||
void rcc_clock_setup_in_hse_16mhz_out_72mhz(void);
|
||||
void rcc_clock_setup_in_hse_25mhz_out_72mhz(void);
|
||||
void rcc_backupdomain_reset(void);
|
||||
|
||||
END_DECLS
|
||||
|
||||
@@ -321,7 +321,14 @@ LGPL License Terms @ref lgpl_license
|
||||
#define I2C_CCR_FS (1 << 15)
|
||||
|
||||
/* DUTY: Fast Mode Duty Cycle */
|
||||
/** @defgroup i2c_duty_cycle I2C peripheral clock duty cycles
|
||||
@ingroup i2c_defines
|
||||
|
||||
@{*/
|
||||
#define I2C_CCR_DUTY (1 << 14)
|
||||
#define I2C_CCR_DUTY_DIV2 0
|
||||
#define I2C_CCR_DUTY_16_DIV_9 1
|
||||
/**@}*/
|
||||
|
||||
/* Note: Bits [13:12] are reserved, and forced to 0 by hardware. */
|
||||
|
||||
@@ -359,6 +366,7 @@ void i2c_peripheral_enable(u32 i2c);
|
||||
void i2c_peripheral_disable(u32 i2c);
|
||||
void i2c_send_start(u32 i2c);
|
||||
void i2c_send_stop(u32 i2c);
|
||||
void i2c_clear_stop(u32 i2c);
|
||||
void i2c_set_own_7bit_slave_address(u32 i2c, u8 slave);
|
||||
void i2c_set_own_10bit_slave_address(u32 i2c, u16 slave);
|
||||
void i2c_set_fast_mode(u32 i2c);
|
||||
@@ -368,6 +376,18 @@ void i2c_set_ccr(u32 i2c, u16 freq);
|
||||
void i2c_set_trise(u32 i2c, u16 trise);
|
||||
void i2c_send_7bit_address(u32 i2c, u8 slave, u8 readwrite);
|
||||
void i2c_send_data(u32 i2c, u8 data);
|
||||
uint8_t i2c_get_data(u32 i2c);
|
||||
void i2c_enable_interrupt(u32 i2c, u32 interrupt);
|
||||
void i2c_disable_interrupt(u32 i2c, u32 interrupt);
|
||||
void i2c_enable_ack(u32 i2c);
|
||||
void i2c_disable_ack(u32 i2c);
|
||||
void i2c_nack_next(u32 i2c);
|
||||
void i2c_nack_current(u32 i2c);
|
||||
void i2c_set_dutycycle(u32 i2c, u32 dutycycle);
|
||||
void i2c_enable_dma(u32 i2c);
|
||||
void i2c_disable_dma(u32 i2c);
|
||||
void i2c_set_dma_last_transfer(u32 i2c);
|
||||
void i2c_clear_dma_last_transfer(u32 i2c);
|
||||
|
||||
END_DECLS
|
||||
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
|
||||
enum usbd_request_return_codes {
|
||||
USBD_REQ_NOTSUPP = 0,
|
||||
USBD_REQ_HANDLED = 1,
|
||||
USBD_REQ_NEXT_CALLBACK = 2,
|
||||
};
|
||||
|
||||
typedef struct _usbd_driver usbd_driver;
|
||||
typedef struct _usbd_device usbd_device;
|
||||
|
||||
@@ -40,9 +47,10 @@ extern u8 usbd_control_buffer[];
|
||||
|
||||
/* <usb.c> */
|
||||
extern usbd_device *usbd_init(const usbd_driver *driver,
|
||||
const struct usb_device_descriptor *dev,
|
||||
const struct usb_config_descriptor *conf,
|
||||
const char **strings);
|
||||
const struct usb_device_descriptor *dev,
|
||||
const struct usb_config_descriptor *conf,
|
||||
const char **strings, int num_strings);
|
||||
|
||||
extern void usbd_set_control_buffer_size(usbd_device *usbd_dev, u16 size);
|
||||
|
||||
extern void usbd_register_reset_callback(usbd_device *usbd_dev,
|
||||
|
||||
@@ -223,4 +223,7 @@ struct usb_iface_assoc_descriptor {
|
||||
#define USB_DT_INTERFACE_ASSOCIATION_SIZE \
|
||||
sizeof(struct usb_iface_assoc_descriptor)
|
||||
|
||||
enum usb_language_id {
|
||||
USB_LANGID_ENGLISH_US = 0x409,
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user