1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

atusb/fw/: convert functions returning "int" to "bool"

Firmware size is down from 5612 to 3590 bytes. Wow !
This commit is contained in:
Werner Almesberger
2013-03-29 19:14:11 -03:00
parent c9ab070ffd
commit a8db238cbb
15 changed files with 74 additions and 61 deletions

View File

@@ -1,8 +1,8 @@
/*
* fw/usb/usb.c - USB hardware setup and standard device requests
*
* Written 2008-2011 by Werner Almesberger
* Copyright 2008-2011 Werner Almesberger
* Written 2008-2011, 2013 by Werner Almesberger
* Copyright 2008-2011, 2013 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
* - should support EP clearing and stalling
*/
#include <stdbool.h>
#include <stdint.h>
#include "usb.h"
@@ -33,9 +34,9 @@ extern void panic(void);
#define BUG_ON(cond)
#endif
int (*user_setup)(const struct setup_request *setup);
bool (*user_setup)(const struct setup_request *setup);
void (*user_set_interface)(int nth);
int (*user_get_descriptor)(uint8_t type, uint8_t index,
bool (*user_get_descriptor)(uint8_t type, uint8_t index,
const uint8_t **reply, uint8_t *size);
void (*user_reset)(void);
@@ -53,7 +54,7 @@ void usb_io(struct ep_descr *ep, enum ep_state state, uint8_t *buf,
}
static int get_descriptor(uint8_t type, uint8_t index, uint16_t length)
static bool get_descriptor(uint8_t type, uint8_t index, uint16_t length)
{
const uint8_t *reply;
uint8_t size;
@@ -82,7 +83,7 @@ static int get_descriptor(uint8_t type, uint8_t index, uint16_t length)
}
int handle_setup(const struct setup_request *setup)
bool handle_setup(const struct setup_request *setup)
{
switch (setup->bmRequestType | setup->bRequest << 8) {