Switched sewly added files to stdint types, as the pull request was done before the switch.
This commit is contained in:
@@ -60,7 +60,7 @@ enum {
|
|||||||
PLL_DIV_16MHZ = 25,
|
PLL_DIV_16MHZ = 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 plldiv[] = {
|
static const uint8_t plldiv[] = {
|
||||||
PLL_DIV_80MHZ,
|
PLL_DIV_80MHZ,
|
||||||
PLL_DIV_57MHZ,
|
PLL_DIV_57MHZ,
|
||||||
PLL_DIV_40MHZ,
|
PLL_DIV_40MHZ,
|
||||||
@@ -176,8 +176,8 @@ static const struct usb_config_descriptor config_descr = {
|
|||||||
|
|
||||||
extern usbd_driver lm4f_usb_driver;
|
extern usbd_driver lm4f_usb_driver;
|
||||||
static usbd_device *bulk_dev;
|
static usbd_device *bulk_dev;
|
||||||
static u8 usbd_control_buffer[128];
|
static uint8_t usbd_control_buffer[128];
|
||||||
static u8 config_set = 0;
|
static uint8_t config_set = 0;
|
||||||
|
|
||||||
static const char *usb_strings[] = {
|
static const char *usb_strings[] = {
|
||||||
"libopencm3",
|
"libopencm3",
|
||||||
@@ -209,7 +209,7 @@ static void usb_setup(void)
|
|||||||
*/
|
*/
|
||||||
static void usb_ints_setup(void)
|
static void usb_ints_setup(void)
|
||||||
{
|
{
|
||||||
u8 usbints;
|
uint8_t usbints;
|
||||||
/* Gimme some interrupts */
|
/* Gimme some interrupts */
|
||||||
usbints = USB_INT_RESET | USB_INT_DISCON | USB_INT_RESUME |
|
usbints = USB_INT_RESET | USB_INT_DISCON | USB_INT_RESUME |
|
||||||
USB_INT_SUSPEND | USB_INT_SOF;
|
USB_INT_SUSPEND | USB_INT_SOF;
|
||||||
@@ -222,7 +222,7 @@ static void usb_ints_setup(void)
|
|||||||
*
|
*
|
||||||
* This gets called whenever a new OUT packet has arrived.
|
* This gets called whenever a new OUT packet has arrived.
|
||||||
*/
|
*/
|
||||||
static void bulk_rx_cb(usbd_device * usbd_dev, u8 ep)
|
static void bulk_rx_cb(usbd_device * usbd_dev, uint8_t ep)
|
||||||
{
|
{
|
||||||
char buf[64] __attribute__ ((aligned(4)));
|
char buf[64] __attribute__ ((aligned(4)));
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ static void bulk_rx_cb(usbd_device * usbd_dev, u8 ep)
|
|||||||
*
|
*
|
||||||
* This gets called whenever an IN packet has been successfully transmitted.
|
* This gets called whenever an IN packet has been successfully transmitted.
|
||||||
*/
|
*/
|
||||||
static void bulk_tx_cb(usbd_device * usbd_dev, u8 ep)
|
static void bulk_tx_cb(usbd_device * usbd_dev, uint8_t ep)
|
||||||
{
|
{
|
||||||
char buf[64] __attribute__ ((aligned(4)));
|
char buf[64] __attribute__ ((aligned(4)));
|
||||||
|
|
||||||
@@ -252,9 +252,9 @@ static void bulk_tx_cb(usbd_device * usbd_dev, u8 ep)
|
|||||||
*
|
*
|
||||||
* Called after the host issues a SetConfiguration request.
|
* Called after the host issues a SetConfiguration request.
|
||||||
*/
|
*/
|
||||||
static void set_config(usbd_device * usbd_dev, u16 wValue)
|
static void set_config(usbd_device * usbd_dev, uint16_t wValue)
|
||||||
{
|
{
|
||||||
u8 data[64] __attribute__ ((aligned(4)));
|
uint8_t data[64] __attribute__ ((aligned(4)));
|
||||||
|
|
||||||
(void)wValue;
|
(void)wValue;
|
||||||
printf("Configuring endpoints.\n\r");
|
printf("Configuring endpoints.\n\r");
|
||||||
@@ -295,7 +295,7 @@ static void button_setup(void)
|
|||||||
/*
|
/*
|
||||||
* Now take care of our buttons
|
* Now take care of our buttons
|
||||||
*/
|
*/
|
||||||
const u32 btnpins = USR_SW1 | USR_SW2;
|
const uint32_t btnpins = USR_SW1 | USR_SW2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PF0 is a locked by default. We need to unlock it before we can
|
* PF0 is a locked by default. We need to unlock it before we can
|
||||||
@@ -319,7 +319,7 @@ static void button_setup(void)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
u8 data[65] __attribute__ ((aligned(4)));
|
uint8_t data[65] __attribute__ ((aligned(4)));
|
||||||
|
|
||||||
gpio_enable_ahb_aperture();
|
gpio_enable_ahb_aperture();
|
||||||
rcc_sysclk_config(OSCSRC_MOSC, XTAL_16M, PLL_DIV_80MHZ);
|
rcc_sysclk_config(OSCSRC_MOSC, XTAL_16M, PLL_DIV_80MHZ);
|
||||||
@@ -376,7 +376,7 @@ void usb0_isr(void)
|
|||||||
|
|
||||||
void gpiof_isr(void)
|
void gpiof_isr(void)
|
||||||
{
|
{
|
||||||
u8 serviced_irqs = 0;
|
uint8_t serviced_irqs = 0;
|
||||||
|
|
||||||
if (gpio_is_interrupt_source(GPIOF, USR_SW1)) {
|
if (gpio_is_interrupt_source(GPIOF, USR_SW1)) {
|
||||||
/* SW1 was just depressed */
|
/* SW1 was just depressed */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
static void uart_ctl_line_setup(void)
|
static void uart_ctl_line_setup(void)
|
||||||
{
|
{
|
||||||
u32 inpins, outpins;
|
uint32_t inpins, outpins;
|
||||||
|
|
||||||
inpins = PIN_DCD | PIN_DSR | PIN_RI | PIN_CTS;
|
inpins = PIN_DCD | PIN_DSR | PIN_RI | PIN_CTS;
|
||||||
outpins = PIN_DTR | PIN_RTS;
|
outpins = PIN_DTR | PIN_RTS;
|
||||||
@@ -75,14 +75,14 @@ void uart_init(void)
|
|||||||
nvic_enable_irq(NVIC_UART1_IRQ);
|
nvic_enable_irq(NVIC_UART1_IRQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 uart_get_ctl_line_state(void)
|
uint8_t uart_get_ctl_line_state(void)
|
||||||
{
|
{
|
||||||
return gpio_read(GPIOA, PIN_RI | PIN_DSR | PIN_DCD);
|
return gpio_read(GPIOA, PIN_RI | PIN_DSR | PIN_DCD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart_set_ctl_line_state(u8 dtr, u8 rts)
|
void uart_set_ctl_line_state(uint8_t dtr, uint8_t rts)
|
||||||
{
|
{
|
||||||
u8 val = 0;
|
uint8_t val = 0;
|
||||||
|
|
||||||
val |= dtr ? PIN_DTR : 0;
|
val |= dtr ? PIN_DTR : 0;
|
||||||
val |= rts ? PIN_RTS : 0;
|
val |= rts ? PIN_RTS : 0;
|
||||||
@@ -92,7 +92,7 @@ void uart_set_ctl_line_state(u8 dtr, u8 rts)
|
|||||||
|
|
||||||
void uart1_isr(void)
|
void uart1_isr(void)
|
||||||
{
|
{
|
||||||
u8 rx;
|
uint8_t rx;
|
||||||
rx = uart_recv(UART1);
|
rx = uart_recv(UART1);
|
||||||
glue_data_recieved_cb(&rx, 1);
|
glue_data_recieved_cb(&rx, 1);
|
||||||
uart_clear_interrupt_flag(UART1, UART_INT_RX);
|
uart_clear_interrupt_flag(UART1, UART_INT_RX);
|
||||||
|
|||||||
@@ -170,17 +170,17 @@ static const char *usb_strings[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
usbd_device *acm_dev;
|
usbd_device *acm_dev;
|
||||||
u8 usbd_control_buffer[128];
|
uint8_t usbd_control_buffer[128];
|
||||||
extern usbd_driver lm4f_usb_driver;
|
extern usbd_driver lm4f_usb_driver;
|
||||||
|
|
||||||
static int cdcacm_control_request(usbd_device * usbd_dev,
|
static int cdcacm_control_request(usbd_device * usbd_dev,
|
||||||
struct usb_setup_data *req, u8 ** buf,
|
struct usb_setup_data *req, uint8_t ** buf,
|
||||||
u16 * len,
|
uint16_t * len,
|
||||||
void (**complete) (usbd_device * usbd_dev,
|
void (**complete) (usbd_device * usbd_dev,
|
||||||
struct usb_setup_data *
|
struct usb_setup_data *
|
||||||
req))
|
req))
|
||||||
{
|
{
|
||||||
u8 dtr, rts;
|
uint8_t dtr, rts;
|
||||||
|
|
||||||
(void)complete;
|
(void)complete;
|
||||||
(void)buf;
|
(void)buf;
|
||||||
@@ -217,9 +217,9 @@ static int cdcacm_control_request(usbd_device * usbd_dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cdcacm_data_rx_cb(usbd_device * usbd_dev, u8 ep)
|
static void cdcacm_data_rx_cb(usbd_device * usbd_dev, uint8_t ep)
|
||||||
{
|
{
|
||||||
u8 buf[64];
|
uint8_t buf[64];
|
||||||
|
|
||||||
(void)ep;
|
(void)ep;
|
||||||
|
|
||||||
@@ -227,12 +227,12 @@ static void cdcacm_data_rx_cb(usbd_device * usbd_dev, u8 ep)
|
|||||||
glue_send_data_cb(buf, len);
|
glue_send_data_cb(buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdcacm_send_data(u8 * buf, u16 len)
|
void cdcacm_send_data(uint8_t * buf, uint16_t len)
|
||||||
{
|
{
|
||||||
usbd_ep_write_packet(acm_dev, 0x82, buf, len);
|
usbd_ep_write_packet(acm_dev, 0x82, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cdcacm_set_config(usbd_device * usbd_dev, u16 wValue)
|
static void cdcacm_set_config(usbd_device * usbd_dev, uint16_t wValue)
|
||||||
{
|
{
|
||||||
(void)wValue;
|
(void)wValue;
|
||||||
|
|
||||||
@@ -249,10 +249,10 @@ static void cdcacm_set_config(usbd_device * usbd_dev, u16 wValue)
|
|||||||
cdcacm_control_request);
|
cdcacm_control_request);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdcacm_line_state_changed_cb(u8 linemask)
|
void cdcacm_line_state_changed_cb(uint8_t linemask)
|
||||||
{
|
{
|
||||||
const int size = sizeof(struct usb_cdc_notification) + 2;
|
const int size = sizeof(struct usb_cdc_notification) + 2;
|
||||||
u8 buf[size];
|
uint8_t buf[size];
|
||||||
|
|
||||||
struct usb_cdc_notification *notify = (void *)buf;
|
struct usb_cdc_notification *notify = (void *)buf;
|
||||||
notify->bmRequestType = 0xa1;
|
notify->bmRequestType = 0xa1;
|
||||||
@@ -260,7 +260,7 @@ void cdcacm_line_state_changed_cb(u8 linemask)
|
|||||||
notify->wValue = 0;
|
notify->wValue = 0;
|
||||||
notify->wIndex = 1;
|
notify->wIndex = 1;
|
||||||
notify->wLength = 2;
|
notify->wLength = 2;
|
||||||
u16 *data = (void *)&buf[sizeof(struct usb_cdc_notification)];
|
uint16_t *data = (void *)&buf[sizeof(struct usb_cdc_notification)];
|
||||||
*data = linemask;
|
*data = linemask;
|
||||||
|
|
||||||
while (usbd_ep_write_packet(acm_dev, 0x83, buf, size) == size) ;
|
while (usbd_ep_write_packet(acm_dev, 0x83, buf, size) == size) ;
|
||||||
@@ -276,7 +276,7 @@ static void usb_pins_setup(void)
|
|||||||
|
|
||||||
static void usb_ints_setup(void)
|
static void usb_ints_setup(void)
|
||||||
{
|
{
|
||||||
u8 usbints;
|
uint8_t usbints;
|
||||||
/* Gimme some interrupts */
|
/* Gimme some interrupts */
|
||||||
usbints = USB_INT_RESET | USB_INT_DISCON | USB_INT_RESUME | USB_INT_SUSPEND; //| USB_IM_SOF;
|
usbints = USB_INT_RESET | USB_INT_DISCON | USB_INT_RESUME | USB_INT_SUSPEND; //| USB_IM_SOF;
|
||||||
usb_enable_interrupts(usbints, 0xff, 0xff);
|
usb_enable_interrupts(usbints, 0xff, 0xff);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static void gpio_setup(void)
|
|||||||
* This port is used to control the RGB LED
|
* This port is used to control the RGB LED
|
||||||
*/
|
*/
|
||||||
periph_clock_enable(RCC_GPIOF);
|
periph_clock_enable(RCC_GPIOF);
|
||||||
const u32 opins = (LED_R | LED_G | LED_B);
|
const uint32_t opins = (LED_R | LED_G | LED_B);
|
||||||
|
|
||||||
gpio_mode_setup(RGB_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, opins);
|
gpio_mode_setup(RGB_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, opins);
|
||||||
gpio_set_output_config(RGB_PORT, GPIO_OTYPE_PP, GPIO_DRIVE_2MA, opins);
|
gpio_set_output_config(RGB_PORT, GPIO_OTYPE_PP, GPIO_DRIVE_2MA, opins);
|
||||||
@@ -85,7 +85,7 @@ static void cm4f_enable_fpu(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void glue_data_recieved_cb(u8 * buf, u16 len)
|
void glue_data_recieved_cb(uint8_t * buf, uint16_t len)
|
||||||
{
|
{
|
||||||
/* Blue LED indicates data coming in */
|
/* Blue LED indicates data coming in */
|
||||||
gpio_set(RGB_PORT, LED_B);
|
gpio_set(RGB_PORT, LED_B);
|
||||||
@@ -93,7 +93,7 @@ void glue_data_recieved_cb(u8 * buf, u16 len)
|
|||||||
gpio_clear(RGB_PORT, LED_B);
|
gpio_clear(RGB_PORT, LED_B);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glue_set_line_state_cb(u8 dtr, u8 rts)
|
void glue_set_line_state_cb(uint8_t dtr, uint8_t rts)
|
||||||
{
|
{
|
||||||
/* Green LED indicated one of the control lines are active */
|
/* Green LED indicated one of the control lines are active */
|
||||||
if (dtr || rts)
|
if (dtr || rts)
|
||||||
@@ -104,12 +104,12 @@ void glue_set_line_state_cb(u8 dtr, u8 rts)
|
|||||||
uart_set_ctl_line_state(dtr, rts);
|
uart_set_ctl_line_state(dtr, rts);
|
||||||
}
|
}
|
||||||
|
|
||||||
int glue_set_line_coding_cb(u32 baud, u8 databits,
|
int glue_set_line_coding_cb(uint32_t baud, uint8_t databits,
|
||||||
enum usb_cdc_line_coding_bParityType cdc_parity,
|
enum usb_cdc_line_coding_bParityType cdc_parity,
|
||||||
enum usb_cdc_line_coding_bCharFormat cdc_stopbits)
|
enum usb_cdc_line_coding_bCharFormat cdc_stopbits)
|
||||||
{
|
{
|
||||||
enum uart_parity parity;
|
enum uart_parity parity;
|
||||||
u8 uart_stopbits;
|
uint8_t uart_stopbits;
|
||||||
|
|
||||||
if (databits < 5 || databits > 8)
|
if (databits < 5 || databits > 8)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -152,7 +152,7 @@ int glue_set_line_coding_cb(u32 baud, u8 databits,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glue_send_data_cb(u8 * buf, u16 len)
|
void glue_send_data_cb(uint8_t * buf, uint16_t len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ void glue_send_data_cb(u8 * buf, u16 len)
|
|||||||
|
|
||||||
static void mainloop(void)
|
static void mainloop(void)
|
||||||
{
|
{
|
||||||
u8 linestate, cdcacmstate;
|
uint8_t linestate, cdcacmstate;
|
||||||
static u8 oldlinestate = 0;
|
static uint8_t oldlinestate = 0;
|
||||||
|
|
||||||
/* See if the state of control lines has changed */
|
/* See if the state of control lines has changed */
|
||||||
linestate = uart_get_ctl_line_state();
|
linestate = uart_get_ctl_line_state();
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ enum rs232pin {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void uart_init(void);
|
void uart_init(void);
|
||||||
u8 uart_get_ctl_line_state(void);
|
uint8_t uart_get_ctl_line_state(void);
|
||||||
void uart_set_ctl_line_state(u8 dtr, u8 rts);
|
void uart_set_ctl_line_state(uint8_t dtr, uint8_t rts);
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* CDCACM control
|
* CDCACM control
|
||||||
* ---------------------------------------------------------------------------*/
|
* ---------------------------------------------------------------------------*/
|
||||||
@@ -72,17 +72,17 @@ enum cdc_serial_state_line {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void cdcacm_init(void);
|
void cdcacm_init(void);
|
||||||
void cdcacm_line_state_changed_cb(u8 linemask);
|
void cdcacm_line_state_changed_cb(uint8_t linemask);
|
||||||
void cdcacm_send_data(u8 *buf, u16 len);
|
void cdcacm_send_data(uint8_t *buf, uint16_t len);
|
||||||
/* =============================================================================
|
/* =============================================================================
|
||||||
* CDCACM <-> UART glue
|
* CDCACM <-> UART glue
|
||||||
* ---------------------------------------------------------------------------*/
|
* ---------------------------------------------------------------------------*/
|
||||||
void glue_data_recieved_cb(u8 *buf, u16 len);
|
void glue_data_recieved_cb(uint8_t *buf, uint16_t len);
|
||||||
void glue_set_line_state_cb(u8 dtr, u8 rts);
|
void glue_set_line_state_cb(uint8_t dtr, uint8_t rts);
|
||||||
int glue_set_line_coding_cb(u32 baud, u8 databits,
|
int glue_set_line_coding_cb(uint32_t baud, uint8_t databits,
|
||||||
enum usb_cdc_line_coding_bParityType cdc_parity,
|
enum usb_cdc_line_coding_bParityType cdc_parity,
|
||||||
enum usb_cdc_line_coding_bCharFormat cdc_stopbits);
|
enum usb_cdc_line_coding_bCharFormat cdc_stopbits);
|
||||||
void glue_send_data_cb(u8 *buf, u16 len);
|
void glue_send_data_cb(uint8_t *buf, uint16_t len);
|
||||||
|
|
||||||
#endif /* __STELLARIS_EK_LM4F120XL_USB_TO_SERIAL_CDCACM_H */
|
#endif /* __STELLARIS_EK_LM4F120XL_USB_TO_SERIAL_CDCACM_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user