mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Merge pull request #412 from hathach/fix-net-cast-align
suppress cast-align warnings for net device driver
This commit is contained in:
commit
78f1576e93
@ -6,9 +6,6 @@ CFLAGS += \
|
||||
-DTCP_WND=2*TCP_MSS \
|
||||
-DHTTPD_USE_CUSTOM_FSDATA=0
|
||||
|
||||
# TODO rndis_reports.c and net_device cause cast algin warnings
|
||||
CFLAGS += -Wno-error=cast-align
|
||||
|
||||
INC += \
|
||||
src \
|
||||
$(TOP)/hw \
|
||||
|
@ -74,7 +74,7 @@ static const uint32_t OIDSupportedList[] =
|
||||
#define OID_LIST_LENGTH TU_ARRAY_SIZE(OIDSupportedList)
|
||||
#define ENC_BUF_SIZE (OID_LIST_LENGTH * 4 + 32)
|
||||
|
||||
static uint8_t *encapsulated_buffer;
|
||||
static void *encapsulated_buffer;
|
||||
|
||||
static void rndis_report(void)
|
||||
{
|
||||
@ -152,7 +152,7 @@ static void rndis_query(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define INFBUF ((uint32_t *)((uint8_t *)&(m->RequestId) + m->InformationBufferOffset))
|
||||
#define INFBUF ((uint8_t *)&(m->RequestId) + m->InformationBufferOffset)
|
||||
|
||||
static void rndis_handle_config_parm(const char *data, int keyoffset, int valoffset, int keylen, int vallen)
|
||||
{
|
||||
@ -191,14 +191,14 @@ static void rndis_handle_set_msg(void)
|
||||
char *ptr = (char *)m;
|
||||
ptr += sizeof(rndis_generic_msg_t);
|
||||
ptr += m->InformationBufferOffset;
|
||||
p = (rndis_config_parameter_t *)ptr;
|
||||
p = (rndis_config_parameter_t *) ((void*) ptr);
|
||||
rndis_handle_config_parm(ptr, p->ParameterNameOffset, p->ParameterValueOffset, p->ParameterNameLength, p->ParameterValueLength);
|
||||
}
|
||||
break;
|
||||
|
||||
/* Mandatory general OIDs */
|
||||
case OID_GEN_CURRENT_PACKET_FILTER:
|
||||
oid_packet_filter = *INFBUF;
|
||||
memcpy(&oid_packet_filter, INFBUF, 4);
|
||||
if (oid_packet_filter)
|
||||
{
|
||||
rndis_packetFilter(oid_packet_filter);
|
||||
@ -239,7 +239,7 @@ void rndis_class_set_handler(uint8_t *data, int size)
|
||||
encapsulated_buffer = data;
|
||||
(void)size;
|
||||
|
||||
switch (((rndis_generic_msg_t *)data)->MessageType)
|
||||
switch (((rndis_generic_msg_t *)encapsulated_buffer)->MessageType)
|
||||
{
|
||||
case REMOTE_NDIS_INITIALIZE_MSG:
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ bool netd_control_request(uint8_t rhport, tusb_control_request_t const * request
|
||||
{
|
||||
if (request->bmRequestType_bit.direction == TUSB_DIR_IN)
|
||||
{
|
||||
rndis_generic_msg_t *rndis_msg = (rndis_generic_msg_t *)notify.rndis_buf;
|
||||
rndis_generic_msg_t *rndis_msg = (rndis_generic_msg_t *) ((void*) notify.rndis_buf);
|
||||
uint32_t msglen = tu_le32toh(rndis_msg->MessageLength);
|
||||
TU_ASSERT(msglen <= sizeof(notify.rndis_buf));
|
||||
tud_control_xfer(rhport, request, notify.rndis_buf, msglen);
|
||||
@ -356,7 +356,7 @@ static void handle_incoming_packet(uint32_t len)
|
||||
}
|
||||
else
|
||||
{
|
||||
rndis_data_packet_t *r = (rndis_data_packet_t *)pnt;
|
||||
rndis_data_packet_t *r = (rndis_data_packet_t *) ((void*) pnt);
|
||||
if (len >= sizeof(rndis_data_packet_t))
|
||||
if ( (r->MessageType == REMOTE_NDIS_PACKET_MSG) && (r->MessageLength <= len))
|
||||
if ( (r->DataOffset + offsetof(rndis_data_packet_t, DataOffset) + r->DataLength) <= len)
|
||||
@ -450,7 +450,7 @@ void tud_network_xmit(struct pbuf *p)
|
||||
|
||||
if (!_netd_itf.ecm_mode)
|
||||
{
|
||||
rndis_data_packet_t *hdr = (rndis_data_packet_t *)transmitted;
|
||||
rndis_data_packet_t *hdr = (rndis_data_packet_t *) ((void*) transmitted);
|
||||
memset(hdr, 0, sizeof(rndis_data_packet_t));
|
||||
hdr->MessageType = REMOTE_NDIS_PACKET_MSG;
|
||||
hdr->MessageLength = len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user