clean up helper func
This commit is contained in:
@@ -185,7 +185,7 @@ bool tud_cdc_n_write_flush (uint8_t itf)
|
||||
//--------------------------------------------------------------------+
|
||||
void cdcd_init(void)
|
||||
{
|
||||
arrclr_( _cdcd_itf );
|
||||
tu_memclr(_cdcd_itf, sizeof(_cdcd_itf));
|
||||
|
||||
for(uint8_t i=0; i<CFG_TUD_CDC; i++)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ void cdcd_reset(uint8_t rhport)
|
||||
|
||||
for(uint8_t i=0; i<CFG_TUD_CDC; i++)
|
||||
{
|
||||
memclr_(&_cdcd_itf[i], ITF_BUS_RESET_SZ);
|
||||
tu_memclr(&_cdcd_itf[i], ITF_BUS_RESET_SZ);
|
||||
tu_fifo_clear(&_cdcd_itf[i].rx_ff);
|
||||
tu_fifo_clear(&_cdcd_itf[i].tx_ff);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ tusb_error_t tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length,
|
||||
//--------------------------------------------------------------------+
|
||||
void cdch_init(void)
|
||||
{
|
||||
memclr_(cdch_data, sizeof(cdch_data_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(cdch_data, sizeof(cdch_data_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
}
|
||||
|
||||
tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
|
||||
@@ -234,7 +234,7 @@ void cdch_close(uint8_t dev_addr)
|
||||
(void) hcd_pipe_close(p_cdc->pipe_in);
|
||||
(void) hcd_pipe_close(p_cdc->pipe_out);
|
||||
|
||||
memclr_(p_cdc, sizeof(cdch_data_t));
|
||||
tu_memclr(p_cdc, sizeof(cdch_data_t));
|
||||
|
||||
tuh_cdc_unmounted_cb(dev_addr);
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ static tusb_error_t rndis_body_subtask(void)
|
||||
//--------------------------------------------------------------------+
|
||||
void rndish_init(void)
|
||||
{
|
||||
memclr_(rndish_data, sizeof(rndish_data_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(rndish_data, sizeof(rndish_data_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
|
||||
//------------- Task creation -------------//
|
||||
|
||||
@@ -131,7 +131,7 @@ void rndish_init(void)
|
||||
void rndish_close(uint8_t dev_addr)
|
||||
{
|
||||
osal_semaphore_reset( rndish_data[dev_addr-1].sem_notification_hdl );
|
||||
// memclr_(&rndish_data[dev_addr-1], sizeof(rndish_data_t)); TODO need to move semaphore & its handle out before memclr
|
||||
// tu_memclr(&rndish_data[dev_addr-1], sizeof(rndish_data_t)); TODO need to move semaphore & its handle out before memclr
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ tusb_error_t rndish_open_subtask(uint8_t dev_addr, cdch_data_t *p_cdc)
|
||||
|
||||
//------------- Message Query 802.3 Permanent Address -------------//
|
||||
memcpy(msg_payload, &msg_query_permanent_addr, sizeof(rndis_msg_query_t));
|
||||
memclr_(msg_payload + sizeof(rndis_msg_query_t), 6); // 6 bytes for MAC address
|
||||
tu_memclr(msg_payload + sizeof(rndis_msg_query_t), 6); // 6 bytes for MAC address
|
||||
|
||||
STASK_INVOKE(
|
||||
send_message_get_response_subtask( dev_addr, p_cdc,
|
||||
@@ -205,7 +205,7 @@ tusb_error_t rndish_open_subtask(uint8_t dev_addr, cdch_data_t *p_cdc)
|
||||
|
||||
//------------- Set OID_GEN_CURRENT_PACKET_FILTER to (DIRECTED | MULTICAST | BROADCAST) -------------//
|
||||
memcpy(msg_payload, &msg_set_packet_filter, sizeof(rndis_msg_set_t));
|
||||
memclr_(msg_payload + sizeof(rndis_msg_set_t), 4); // 4 bytes for filter flags
|
||||
tu_memclr(msg_payload + sizeof(rndis_msg_set_t), 4); // 4 bytes for filter flags
|
||||
((rndis_msg_set_t*) msg_payload)->oid_buffer[0] = (RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_MULTICAST | RNDIS_PACKET_TYPE_BROADCAST);
|
||||
|
||||
STASK_INVOKE(
|
||||
|
||||
@@ -68,7 +68,7 @@ static cusd_interface_t _cusd_itf;
|
||||
*------------------------------------------------------------------*/
|
||||
void cusd_init(void)
|
||||
{
|
||||
varclr_(&_cusd_itf);
|
||||
tu_varclr(&_cusd_itf);
|
||||
}
|
||||
|
||||
tusb_error_t cusd_open(uint8_t rhport, tusb_desc_interface_t const * p_desc_itf, uint16_t *p_len)
|
||||
|
||||
@@ -104,7 +104,7 @@ tusb_error_t tusbh_custom_write(uint8_t dev_addr, uint16_t vendor_id, uint16_t p
|
||||
//--------------------------------------------------------------------+
|
||||
void cush_init(void)
|
||||
{
|
||||
memclr_(&custom_interface, sizeof(custom_interface_info_t) * CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(&custom_interface, sizeof(custom_interface_info_t) * CFG_TUSB_HOST_DEVICE_MAX);
|
||||
}
|
||||
|
||||
tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length)
|
||||
@@ -152,7 +152,7 @@ void cush_close(uint8_t dev_addr)
|
||||
err2 = hcd_pipe_close( p_interface->pipe_out );
|
||||
}
|
||||
|
||||
memclr_(p_interface, sizeof(custom_interface_info_t));
|
||||
tu_memclr(p_interface, sizeof(custom_interface_info_t));
|
||||
|
||||
TU_ASSERT(err1 == TUSB_ERROR_NONE && err2 == TUSB_ERROR_NONE, (void) 0 );
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ bool tud_hid_keyboard_keycode(uint8_t modifier, uint8_t keycode[6])
|
||||
memcpy(report.keycode, keycode, 6);
|
||||
}else
|
||||
{
|
||||
memclr_(report.keycode, 6);
|
||||
tu_memclr(report.keycode, 6);
|
||||
}
|
||||
|
||||
return hidd_kbd_report(&report);
|
||||
@@ -307,14 +307,14 @@ void hidd_init(void)
|
||||
|
||||
void hidd_reset(uint8_t rhport)
|
||||
{
|
||||
arrclr_(_hidd_itf);
|
||||
tu_memclr(_hidd_itf, sizeof(_hidd_itf));
|
||||
|
||||
#if CFG_TUD_HID_KEYBOARD
|
||||
varclr_(&_kbd_rpt);
|
||||
tu_varclr(&_kbd_rpt);
|
||||
#endif
|
||||
|
||||
#if CFG_TUD_HID_MOUSE
|
||||
varclr_(&_mse_rpt);
|
||||
tu_varclr(&_mse_rpt);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interfa
|
||||
static inline void hidh_interface_close(hidh_interface_info_t *p_hid)
|
||||
{
|
||||
(void) hcd_pipe_close(p_hid->pipe_hdl);
|
||||
memclr_(p_hid, sizeof(hidh_interface_info_t));
|
||||
tu_memclr(p_hid, sizeof(hidh_interface_info_t));
|
||||
}
|
||||
|
||||
// called from public API need to validate parameters
|
||||
@@ -164,11 +164,11 @@ tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void * report)
|
||||
void hidh_init(void)
|
||||
{
|
||||
#if CFG_TUSB_HOST_HID_KEYBOARD
|
||||
memclr_(&keyboardh_data, sizeof(hidh_interface_info_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(&keyboardh_data, sizeof(hidh_interface_info_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
#endif
|
||||
|
||||
#if CFG_TUSB_HOST_HID_MOUSE
|
||||
memclr_(&mouseh_data, sizeof(hidh_interface_info_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(&mouseh_data, sizeof(hidh_interface_info_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
#endif
|
||||
|
||||
#if CFG_TUSB_HOST_HID_GENERIC
|
||||
|
||||
@@ -62,9 +62,9 @@ enum
|
||||
typedef struct {
|
||||
CFG_TUSB_MEM_ALIGN msc_cbw_t cbw;
|
||||
|
||||
#if defined (__ICCARM__) && (CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX)
|
||||
uint8_t padding1[64-sizeof(msc_cbw_t)]; // IAR cannot align struct's member
|
||||
#endif
|
||||
//#if defined (__ICCARM__) && (CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX)
|
||||
// uint8_t padding1[64-sizeof(msc_cbw_t)]; // IAR cannot align struct's member
|
||||
//#endif
|
||||
|
||||
CFG_TUSB_MEM_ALIGN msc_csw_t csw;
|
||||
|
||||
@@ -141,12 +141,12 @@ bool tud_msc_set_sense(uint8_t lun, uint8_t sense_key, uint8_t add_sense_code, u
|
||||
//--------------------------------------------------------------------+
|
||||
void mscd_init(void)
|
||||
{
|
||||
memclr_(&_mscd_itf, sizeof(mscd_interface_t));
|
||||
tu_memclr(&_mscd_itf, sizeof(mscd_interface_t));
|
||||
}
|
||||
|
||||
void mscd_reset(uint8_t rhport)
|
||||
{
|
||||
memclr_(&_mscd_itf, sizeof(mscd_interface_t));
|
||||
tu_memclr(&_mscd_itf, sizeof(mscd_interface_t));
|
||||
}
|
||||
|
||||
tusb_error_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * p_desc_itf, uint16_t *p_len)
|
||||
@@ -302,7 +302,6 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
||||
{
|
||||
case MSC_STAGE_CMD:
|
||||
//------------- new CBW received -------------//
|
||||
|
||||
// Complete IN while waiting for CMD is usually Status of previous SCSI op, ignore it
|
||||
if(ep_addr != p_msc->ep_out) return TUSB_ERROR_NONE;
|
||||
|
||||
@@ -332,7 +331,6 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
||||
// 1. Zero : Invoke app callback, skip DATA and move to STATUS stage
|
||||
// 2. OUT : queue transfer (invoke app callback after done)
|
||||
// 3. IN : invoke app callback to get response
|
||||
|
||||
if ( p_cbw->xfer_bytes == 0)
|
||||
{
|
||||
int32_t const cb_result = tud_msc_scsi_cb(p_cbw->lun, p_cbw->command, NULL, 0);
|
||||
|
||||
@@ -288,7 +288,7 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe
|
||||
//--------------------------------------------------------------------+
|
||||
void msch_init(void)
|
||||
{
|
||||
memclr_(msch_data, sizeof(msch_interface_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
tu_memclr(msch_data, sizeof(msch_interface_t)*CFG_TUSB_HOST_DEVICE_MAX);
|
||||
msch_sem_hdl = osal_semaphore_create(1, 0);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ void msch_close(uint8_t dev_addr)
|
||||
(void) hcd_pipe_close(msch_data[dev_addr-1].bulk_in);
|
||||
(void) hcd_pipe_close(msch_data[dev_addr-1].bulk_out);
|
||||
|
||||
memclr_(&msch_data[dev_addr-1], sizeof(msch_interface_t));
|
||||
tu_memclr(&msch_data[dev_addr-1], sizeof(msch_interface_t));
|
||||
osal_semaphore_reset(msch_sem_hdl);
|
||||
|
||||
tuh_msc_unmounted_cb(dev_addr); // invoke Application Callback
|
||||
|
||||
Reference in New Issue
Block a user