Skip to content

Commit 621953c

Browse files
committed
Additional missing-prototypes fixes
I think this correctly enables missing-prototypes in atmel-samd and raspberrypi ports.
1 parent 4a1ce64 commit 621953c

File tree

73 files changed

+123
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+123
-242
lines changed

devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "shared-bindings/_bleio/__init__.h"
3535
#include "shared-bindings/_bleio/Connection.h"
36+
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
3637
#include "supervisor/shared/tick.h"
3738
#include "common-hal/_bleio/CharacteristicBuffer.h"
3839

devices/ble_hci/common-hal/_bleio/Connection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ typedef struct {
8585
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self);
8686
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection);
8787
bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle);
88+
void bleio_connection_clear(bleio_connection_internal_t *self);
8889

8990
#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H

devices/ble_hci/common-hal/_bleio/att.c

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -857,20 +857,6 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
857857
}
858858
}
859859

860-
int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) {
861-
struct __packed req {
862-
struct bt_att_hdr h;
863-
struct bt_att_find_info_req r;
864-
} req = { {
865-
.code = BT_ATT_OP_FIND_INFO_REQ,
866-
}, {
867-
.start_handle = start_handle,
868-
.end_handle = end_handle,
869-
}};
870-
871-
return send_req_wait_for_rsp(conn_handle, sizeof(req), (uint8_t *)&req, response_buffer);
872-
}
873-
874860
STATIC void process_find_info_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
875861
if (dlen < 2) {
876862
return; // invalid, drop
@@ -925,7 +911,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
925911
}
926912
}
927913

928-
void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
914+
STATIC void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
929915
struct bt_att_read_group_req *req = (struct bt_att_read_group_req *)data;
930916
uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8);
931917

@@ -1009,25 +995,6 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
1009995
}
1010996
}
1011997

1012-
int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
1013-
1014-
typedef struct __packed {
1015-
struct bt_att_hdr h;
1016-
struct bt_att_read_group_req r;
1017-
} req_t;
1018-
1019-
uint8_t req_bytes[sizeof(req_t) + sizeof(uuid)];
1020-
req_t *req = (req_t *)req_bytes;
1021-
1022-
req->h.code = BT_ATT_OP_READ_GROUP_REQ;
1023-
req->r.start_handle = start_handle;
1024-
req->r.end_handle = end_handle;
1025-
req->r.uuid[0] = uuid & 0xff;
1026-
req->r.uuid[1] = uuid >> 8;
1027-
1028-
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
1029-
}
1030-
1031998
STATIC void process_read_group_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
1032999
if (dlen < 2) {
10331000
return; // invalid, drop
@@ -1305,24 +1272,6 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
13051272
}
13061273
}
13071274

1308-
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
1309-
typedef struct __packed {
1310-
struct bt_att_hdr h;
1311-
struct bt_att_read_type_req r;
1312-
} req_t;
1313-
1314-
uint8_t req_bytes[sizeof(req_t) + sizeof(type)];
1315-
req_t *req = (req_t *)req_bytes;
1316-
1317-
req->h.code = BT_ATT_OP_READ_TYPE_REQ;
1318-
req->r.start_handle = start_handle;
1319-
req->r.end_handle = end_handle;
1320-
req->r.uuid[0] = type & 0xff;
1321-
req->r.uuid[1] = type >> 8;
1322-
1323-
return send_req_wait_for_rsp(conn_handle, sizeof(req_bytes), req_bytes, response_buffer);
1324-
}
1325-
13261275
STATIC void process_read_type_rsp(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
13271276
if (dlen < 1) {
13281277
return; // invalid, drop
@@ -1713,77 +1662,3 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
17131662
break;
17141663
}
17151664
}
1716-
1717-
// FIX Do we need all of these?
1718-
void check_att_err(uint8_t err) {
1719-
const compressed_string_t *msg = NULL;
1720-
switch (err) {
1721-
case 0:
1722-
return;
1723-
case BT_ATT_ERR_INVALID_HANDLE:
1724-
msg = translate("Invalid handle");
1725-
break;
1726-
case BT_ATT_ERR_READ_NOT_PERMITTED:
1727-
msg = translate("Read not permitted");
1728-
break;
1729-
case BT_ATT_ERR_WRITE_NOT_PERMITTED:
1730-
msg = translate("Write not permitted");
1731-
break;
1732-
case BT_ATT_ERR_INVALID_PDU:
1733-
msg = translate("Invalid PDU");
1734-
break;
1735-
case BT_ATT_ERR_NOT_SUPPORTED:
1736-
msg = translate("Not supported");
1737-
break;
1738-
case BT_ATT_ERR_INVALID_OFFSET:
1739-
msg = translate("Invalid offset");
1740-
break;
1741-
case BT_ATT_ERR_PREPARE_QUEUE_FULL:
1742-
msg = translate("Prepare queue full");
1743-
break;
1744-
case BT_ATT_ERR_ATTRIBUTE_NOT_FOUND:
1745-
msg = translate("Attribute not found");
1746-
break;
1747-
case BT_ATT_ERR_ATTRIBUTE_NOT_LONG:
1748-
msg = translate("Attribute not long");
1749-
break;
1750-
case BT_ATT_ERR_ENCRYPTION_KEY_SIZE:
1751-
msg = translate("Encryption key size");
1752-
break;
1753-
case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN:
1754-
msg = translate("Invalid attribute length");
1755-
break;
1756-
case BT_ATT_ERR_UNLIKELY:
1757-
msg = translate("Unlikely");
1758-
break;
1759-
case BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE:
1760-
msg = translate("Unsupported group type");
1761-
break;
1762-
case BT_ATT_ERR_INSUFFICIENT_RESOURCES:
1763-
msg = translate("Insufficient resources");
1764-
break;
1765-
case BT_ATT_ERR_DB_OUT_OF_SYNC:
1766-
msg = translate("DB out of sync");
1767-
break;
1768-
case BT_ATT_ERR_VALUE_NOT_ALLOWED:
1769-
msg = translate("Value not allowed");
1770-
break;
1771-
}
1772-
if (msg) {
1773-
mp_raise_bleio_BluetoothError(msg);
1774-
}
1775-
1776-
switch (err) {
1777-
case BT_ATT_ERR_AUTHENTICATION:
1778-
msg = translate("Insufficient authentication");
1779-
break;
1780-
case BT_ATT_ERR_INSUFFICIENT_ENCRYPTION:
1781-
msg = translate("Insufficient encryption");
1782-
break;
1783-
}
1784-
if (msg) {
1785-
mp_raise_bleio_SecurityError(msg);
1786-
}
1787-
1788-
mp_raise_bleio_BluetoothError(translate("Unknown ATT error: 0x%02x"), err);
1789-
}

ports/atmel-samd/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ $(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno
291291
endif
292292

293293
SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF))
294-
$(patsubst $(SRC_ASF),%.c,%.o): CFLAGS += -Wno-missing-prototypes
294+
$(patsubst %.c,$(BUILD)/%.o,$(SRC_ASF)): CFLAGS += -Wno-missing-prototypes
295295

296296
SRC_PERIPHERALS := \
297297
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
@@ -310,7 +310,7 @@ SRC_PERIPHERALS := \
310310
peripherals/samd/sercom.c \
311311
peripherals/samd/timers.c \
312312

313-
$(patsubst $(SRC_PERIPHERALS),%.c,%.o): CFLAGS += -Wno-missing-prototypes
313+
$(patsubst %.c,$(BUILD)/%.o,$(SRC_PERIPHERALS)): CFLAGS += -Wno-missing-prototypes
314314

315315
SRC_C += \
316316
audio_dma.c \

ports/atmel-samd/common-hal/audiobusio/PDMIn.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
485485

486486
return values_output;
487487
}
488-
489-
void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t* self, uint8_t* buffer, uint32_t length) {
490-
}

ports/atmel-samd/common-hal/busio/__init__.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "samd/sercom.h"
28+
#include "common-hal/busio/__init__.h"
2829

2930
static bool never_reset_sercoms[SERCOM_INST_NUM];
3031

ports/atmel-samd/common-hal/countio/Counter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
#include "common-hal/countio/Counter.h"
3+
#include "shared-bindings/countio/Counter.h"
34

45
#include "atmel_start_pins.h"
56

ports/atmel-samd/common-hal/microcontroller/Processor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
#include "py/mphal.h"
6767
#include "common-hal/microcontroller/Processor.h"
68+
#include "shared-bindings/microcontroller/Processor.h"
6869
#include "shared-bindings/microcontroller/ResetReason.h"
6970

7071
#include "samd/adc.h"

ports/atmel-samd/common-hal/nvm/ByteArray.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "common-hal/nvm/ByteArray.h"
28+
#include "shared-bindings/nvm/ByteArray.h"
2829

2930
#include "hal_flash.h"
3031

@@ -33,11 +34,11 @@
3334
#include <stdint.h>
3435
#include <string.h>
3536

36-
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
37+
uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
3738
return self->len;
3839
}
3940

40-
bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
41+
bool common_hal_nvm_bytearray_set_bytes(const nvm_bytearray_obj_t *self,
4142
uint32_t start_index, uint8_t *values, uint32_t len) {
4243
// We don't use features that use any advanced NVMCTRL features so we can fake the descriptor
4344
// whenever we need it instead of storing it long term.
@@ -49,7 +50,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
4950
}
5051

5152
// NVM memory is memory mapped so reading it is easy.
52-
void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
53+
void common_hal_nvm_bytearray_get_bytes(const nvm_bytearray_obj_t *self,
5354
uint32_t start_index, uint32_t len, uint8_t *values) {
5455
memcpy(values, self->start_address + start_index, len);
5556
}

ports/atmel-samd/common-hal/os/__init__.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "py/objtuple.h"
3131
#include "py/qstr.h"
3232

33+
#include "shared-bindings/os/__init__.h"
34+
3335
#ifdef SAM_D5X_E5X
3436
#include "hal/include/hal_rand_sync.h"
3537
#endif
@@ -66,7 +68,7 @@ mp_obj_t common_hal_os_uname(void) {
6668
return (mp_obj_t)&os_uname_info_obj;
6769
}
6870

69-
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
71+
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
7072
#ifdef SAM_D5X_E5X
7173
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
7274
struct rand_sync_desc random;

0 commit comments

Comments
 (0)