docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* Attribute read call back for the Value V10 attribute. */
static ssize_t read_value_v10(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V10 attribute. */ static ssize_t read_value_v10(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(value_v10_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ADC Enable an External Trigger for Regular Channels. This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */
void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
/* ADC Enable an External Trigger for Regular Channels. This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */ void adc_enable_external_trigger_regular(uint32...
{ uint32_t reg32 = ADC_CFGR1(adc); reg32 &= ~(ADC_CFGR1_EXTSEL_MASK | ADC_CFGR1_EXTEN_MASK); reg32 |= (trigger | polarity); ADC_CFGR1(adc) = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* fcoe_flogi_resp() - FCoE specific FLOGI and FDISC response handler @seq: active sequence in the FLOGI or FDISC exchange @fp: response frame, or error encoded in a pointer (timeout) */
static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
/* fcoe_flogi_resp() - FCoE specific FLOGI and FDISC response handler @seq: active sequence in the FLOGI or FDISC exchange @fp: response frame, or error encoded in a pointer (timeout) */ static void fcoe_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
{ struct fcoe_ctlr *fip = arg; struct fc_exch *exch = fc_seq_exch(seq); struct fc_lport *lport = exch->lp; u8 *mac; if (IS_ERR(fp)) goto done; mac = fr_cb(fp)->granted_mac; if (is_zero_ether_addr(mac)) { if (fcoe_ctlr_recv_flogi(fip, lport, fp)) { fc_frame_free(fp); return; } } fcoe_update_src_mac(...
robutest/uclinux
C++
GPL-2.0
60
/* Triggers a pending transmit for the specified discover-all-characteristics proc. */
static int ble_gattc_disc_all_chrs_tx(struct ble_gattc_proc *proc)
/* Triggers a pending transmit for the specified discover-all-characteristics proc. */ static int ble_gattc_disc_all_chrs_tx(struct ble_gattc_proc *proc)
{ ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC); int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); rc = ble_att_clt_tx_read_type(proc->conn_handle, proc->disc_all_chrs.prev_handle + 1, proc->disc_all_chrs.end_hand...
Nicholas3388/LuaNode
C++
Other
1,055
/* Threshold for wakeup.1 LSB = FS_XL / 64.. */
int32_t lsm6dsl_wkup_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
/* Threshold for wakeup.1 LSB = FS_XL / 64.. */ int32_t lsm6dsl_wkup_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_wake_up_ths_t wake_up_ths; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_WAKE_UP_THS, (uint8_t*)&wake_up_ths, 1); if(ret == 0){ wake_up_ths.wk_ths = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_WAKE_UP_THS, (uint8_t*)&wake_up_ths, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* and add WWDGT_COUNTER_MIN to this as a offset value. */
static uint32_t gd32_wwdgt_calc_ticks(const struct device *dev, uint32_t timeout, uint32_t exp)
/* and add WWDGT_COUNTER_MIN to this as a offset value. */ static uint32_t gd32_wwdgt_calc_ticks(const struct device *dev, uint32_t timeout, uint32_t exp)
{ const struct gd32_wwdgt_config *config = dev->config; uint32_t pclk; (void)clock_control_get_rate(GD32_CLOCK_CONTROLLER, (clock_control_subsys_t)&config->clkid, &pclk); return ((timeout * pclk) / (WWDGT_INTERNAL_DIVIDER * (1 << exp) * MSEC_PER_SEC) - 1) + WWDGT_COUNTER_MIN; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Find parent formset menu(the first menu which has different formset) for current menu. If not find, just return to the first menu. */
VOID FindParentFormSet(IN OUT UI_MENU_SELECTION *Selection)
/* Find parent formset menu(the first menu which has different formset) for current menu. If not find, just return to the first menu. */ VOID FindParentFormSet(IN OUT UI_MENU_SELECTION *Selection)
{ FORM_ENTRY_INFO *CurrentMenu; FORM_ENTRY_INFO *ParentMenu; CurrentMenu = Selection->CurrentMenu; ParentMenu = UiFindParentMenu (CurrentMenu, FormSetLevel); if (ParentMenu != NULL) { CopyMem (&Selection->FormSetGuid, &ParentMenu->FormSetGuid, sizeof (EFI_GUID)); Selection->Handle = ParentMenu-...
tianocore/edk2
C++
Other
4,240
/* Sets the color ramps on behalf of fbcon */
void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, u16 blue, int regno)
/* Sets the color ramps on behalf of fbcon */ void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, u16 blue, int regno)
{ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); radeon_crtc->lut_r[regno] = red >> 6; radeon_crtc->lut_g[regno] = green >> 6; radeon_crtc->lut_b[regno] = blue >> 6; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the actual frequency of USCI_SPI bus clock. Only available in Master mode. */
uint32_t USPI_GetBusClock(USPI_T *uspi)
/* Get the actual frequency of USCI_SPI bus clock. Only available in Master mode. */ uint32_t USPI_GetBusClock(USPI_T *uspi)
{ uint32_t u32ClkDiv, u32BusClk; u32ClkDiv = (uspi->BRGEN & USPI_BRGEN_CLKDIV_Msk) >> USPI_BRGEN_CLKDIV_Pos; if((uspi == USPI0) || (uspi == USPI0_NS)) { u32BusClk = (CLK_GetPCLK0Freq() / ((u32ClkDiv + 1UL) << 1UL)); } else { u32BusClk = (CLK_GetPCLK1Freq() / ((u32ClkDiv + 1UL...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: ServiceURLStatV2Message Opcode: 0x0148 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */
static void handle_ServiceURLStatV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: ServiceURLStatV2Message Opcode: 0x0148 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */ static void handle_ServiceURLStatV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_serviceURLIndex, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* clock: device structure for driver sub_system: pointer to struct litex_clk_clkout casted to clock_control_subsys with all clkout parameters */
static int litex_clk_get_subsys_rate(const struct device *clock, clock_control_subsys_t sys, uint32_t *rate)
/* clock: device structure for driver sub_system: pointer to struct litex_clk_clkout casted to clock_control_subsys with all clkout parameters */ static int litex_clk_get_subsys_rate(const struct device *clock, clock_control_subsys_t sys, uint32_t *rate)
{ struct litex_clk_setup *setup = sys; struct litex_clk_clkout *lcko; lcko = &ldev->clkouts[setup->clkout_nr]; *rate = litex_clk_calc_rate(lcko); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The LDO failure control is only available on Sandstorm-class devices. */
void SysCtlLDOConfigSet(unsigned long ulConfig)
/* The LDO failure control is only available on Sandstorm-class devices. */ void SysCtlLDOConfigSet(unsigned long ulConfig)
{ ASSERT((ulConfig == SYSCTL_LDOCFG_ARST) || (ulConfig == SYSCTL_LDOCFG_NORST)); HWREG(SYSCTL_LDOARST) = ulConfig; }
watterott/WebRadio
C++
null
71
/* If Length is not aligned on a 64-bit boundary, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64* EFIAPI S3MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer)
/* If Length is not aligned on a 64-bit boundary, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */ UINT64* EFIAPI S3MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer)
{ UINT64 *ReturnBuffer; RETURN_STATUS Status; ReturnBuffer = MmioReadBuffer64 (StartAddress, Length, Buffer); Status = S3BootScriptSaveMemWrite ( S3BootScriptWidthUint64, StartAddress, Length / sizeof (UINT64), ReturnBuffer ); ASSERT (S...
tianocore/edk2
C++
Other
4,240
/* The controller does not check for bitflips in erased pages, therefore software must check instead. */
static int check_erased_page(struct nand_chip *chip, u8 *buf, struct mtd_info *mtd)
/* The controller does not check for bitflips in erased pages, therefore software must check instead. */ static int check_erased_page(struct nand_chip *chip, u8 *buf, struct mtd_info *mtd)
{ u8 *ecc = chip->oob_poi; const int ecc_size = chip->ecc.bytes; const int pkt_size = chip->ecc.size; int i, res, bitflips; ecc += 8; bitflips = 0; for (i = 0; i < chip->ecc.steps; i++) { res = nand_check_erased_ecc_chunk(buf, pkt_size, ecc, ecc_size, NULL, 0, chip->ecc.strength); if (res < 0) { p...
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: 0 on success or a negative value on failure */
static void __exit fcoe_exit(void)
/* Returns: 0 on success or a negative value on failure */ static void __exit fcoe_exit(void)
{ struct fcoe_interface *fcoe, *tmp; struct fcoe_port *port; unsigned int cpu; mutex_lock(&fcoe_config_mutex); fcoe_dev_cleanup(); rtnl_lock(); list_for_each_entry_safe(fcoe, tmp, &fcoe_hostlist, list) { list_del(&fcoe->list); port = lport_priv(fcoe->ctlr.lp); fcoe_interface_cleanup(fcoe); schedule_work(...
robutest/uclinux
C++
GPL-2.0
60
/* Read Length bytes from the position of Offset into Buffer, or write Length bytes from Buffer into the position of Offset. */
STATIC EFI_STATUS FatAccessUnalignedCachePage(IN FAT_VOLUME *Volume, IN CACHE_DATA_TYPE CacheDataType, IN IO_MODE IoMode, IN UINTN PageNo, IN UINTN Offset, IN UINTN Length, IN OUT VOID *Buffer)
/* Read Length bytes from the position of Offset into Buffer, or write Length bytes from Buffer into the position of Offset. */ STATIC EFI_STATUS FatAccessUnalignedCachePage(IN FAT_VOLUME *Volume, IN CACHE_DATA_TYPE CacheDataType, IN IO_MODE IoMode, IN UINTN PageNo, IN UINTN Offset, IN UINTN Length, IN OUT VOID *Buffer...
{ EFI_STATUS Status; VOID *Source; VOID *Destination; DISK_CACHE *DiskCache; CACHE_TAG *CacheTag; UINTN GroupNo; DiskCache = &Volume->DiskCache[CacheDataType]; GroupNo = PageNo & DiskCache->GroupMask; CacheTag = &DiskCache->CacheTag[GroupNo]; Status = FatGetCachePage (V...
tianocore/edk2
C++
Other
4,240
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
{ if(hsd->Instance==SDMMC1) { __HAL_RCC_SDMMC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_8 |GPIO_PIN_9); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2); HAL_NVIC_DisableIRQ(SDMMC1_IRQn); } else if(hsd->Instance==SDMMC2) { __HAL_RCC_SDM...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This code is run to initialize the driver. */
static int __init ultracam_init(void)
/* This code is run to initialize the driver. */ static int __init ultracam_init(void)
{ struct usbvideo_cb cbTbl; memset(&cbTbl, 0, sizeof(cbTbl)); cbTbl.probe = ultracam_probe; cbTbl.setupOnOpen = ultracam_setup_on_open; cbTbl.videoStart = ultracam_video_start; cbTbl.videoStop = ultracam_video_stop; cbTbl.processData = ultracam_ProcessIsocData; cbTbl.postProcess = usbvideo_DeinterlaceFrame; cb...
robutest/uclinux
C++
GPL-2.0
60
/* AmebaD don't support sleep api, please refer to AN400 power save Section. */
void sleep_ex(uint32_t wakeup_event, uint32_t sleep_duration)
/* AmebaD don't support sleep api, please refer to AN400 power save Section. */ void sleep_ex(uint32_t wakeup_event, uint32_t sleep_duration)
{ ( void ) wakeup_event; ( void ) sleep_duration; assert_param(0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Fills each I2S_Config_T member with its default value. */
void I2S_ConfigStructInit(I2S_Config_T *i2sConfig)
/* Fills each I2S_Config_T member with its default value. */ void I2S_ConfigStructInit(I2S_Config_T *i2sConfig)
{ i2sConfig->mode = I2S_MODE_SLAVE_TX; i2sConfig->standard = I2S_STANDARD_PHILLIPS; i2sConfig->length = I2S_DATA_LENGHT_16B; i2sConfig->MCLKOutput = I2S_MCLK_OUTPUT_DISABLE; i2sConfig->audioDiv = I2S_AUDIO_DIV_DEFAULT; i2sConfig->polarity = I2S_CLKPOL_LOW; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enables or disables delayed start of injected conversions. */
void SDADC_DelayStartInjectedConvCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
/* Enables or disables delayed start of injected conversions. */ void SDADC_DelayStartInjectedConvCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
{ assert_param(IS_SDADC_ALL_PERIPH(SDADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SDADCx->CR2 |= (uint32_t) (SDADC_CR2_JDS); } else { SDADCx->CR2 &= (uint32_t) ~(SDADC_CR2_JDS); } }
avem-labs/Avem
C++
MIT License
1,752
/* This function is used to get I2S source clock frequency. */
static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
/* This function is used to get I2S source clock frequency. */ static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
{ uint32_t u32Freq, u32ClkSrcSel; u32ClkSrcSel = CLK->CLKSEL3 & CLK_CLKSEL3_I2S0SEL_Msk; switch (u32ClkSrcSel) { case CLK_CLKSEL3_I2S0SEL_HXT: u32Freq = __HXT; break; case CLK_CLKSEL3_I2S0SEL_PLL: u32Freq = CLK_GetPLLClockFreq(); break; case CLK_CLKSEL3_I2S0SE...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called to do the PIO mode setup. Our timing registers are shared but we want to set the PIO timing by default. */
static void pdc202xx_set_piomode(struct ata_port *ap, struct ata_device *adev)
/* Called to do the PIO mode setup. Our timing registers are shared but we want to set the PIO timing by default. */ static void pdc202xx_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ pdc202xx_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Increase a index value in queue. This function increases the index value in the queue, if the index is out of the queue range, it is reset to 0. */
static uint32_t CSI_TransferIncreaseQueueIdx(uint32_t idx)
/* Increase a index value in queue. This function increases the index value in the queue, if the index is out of the queue range, it is reset to 0. */ static uint32_t CSI_TransferIncreaseQueueIdx(uint32_t idx)
{ uint32_t ret; ret = idx + 1; if (ret >= CSI_DRIVER_ACTUAL_QUEUE_SIZE) { ret = 0; } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If alen < 0, then we get this: S data ... P This is most likely NOT something that should be used. It doesn't send the chip address first, so in effect, the first byte of data will be used as the address. */
static int bus_i2c_write(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr, int alen, const u8 *buf, int len)
/* If alen < 0, then we get this: S data ... P This is most likely NOT something that should be used. It doesn't send the chip address first, so in effect, the first byte of data will be used as the address. */ static int bus_i2c_write(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr, int alen, const u8 *buf, int len)
{ int ret = 0; ret = i2c_init_transfer(i2c_bus, chip, addr, alen); if (ret < 0) return ret; ret = i2c_write_data(i2c_bus, chip, buf, len); i2c_imx_stop(i2c_bus); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function compares a given position with the drag origin prepared by the wtk_prepare_drag() function. If either the X or Y distance exceeds the WTK_DRAG_THRESHOLD value, this function returns true. That is when the widget event handler should call wtk_start_drag(). */
static bool wtk_is_drag_threshold_exceeded(struct win_point const *pos)
/* This function compares a given position with the drag origin prepared by the wtk_prepare_drag() function. If either the X or Y distance exceeds the WTK_DRAG_THRESHOLD value, this function returns true. That is when the widget event handler should call wtk_start_drag(). */ static bool wtk_is_drag_threshold_exceeded(s...
{ bool isExceeded = (pos->x < (wtk_drag_origin.x - WTK_DRAG_THRESHOLD)) || (pos->x > (wtk_drag_origin.x + WTK_DRAG_THRESHOLD)) || (pos->y < (wtk_drag_origin.y - WTK_DRAG_THRESHOLD)) || (pos->y > (wtk_drag_origin.y + WTK_DRAG_THRESHOLD)); return isExceeded; }
memfault/zero-to-main
C++
null
200
/* Enables or disables the SDADC standby mode when idle. */
void SDADC_StandbyCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
/* Enables or disables the SDADC standby mode when idle. */ void SDADC_StandbyCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
{ assert_param(IS_SDADC_ALL_PERIPH(SDADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SDADCx->CR1 |= SDADC_CR1_SBI; } else { SDADCx->CR1 &= (uint32_t)~SDADC_CR1_SBI; } }
avem-labs/Avem
C++
MIT License
1,752
/* DAC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac)
/* DAC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac)
{ if(hdac->Instance==DAC1) { __HAL_RCC_DAC12_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The check summ offload engine is enabled to do complete checksum computation. Hardware computes the tcp ip checksum including the pseudo header checksum. Here the tcp payload checksum field should be set to 0000. Ipv4 header checksum is also inserted. */
void synopGMAC_tx_checksum_offload_tcp_pseudo(synopGMACdevice *gmacdev, DmaDesc *desc)
/* The check summ offload engine is enabled to do complete checksum computation. Hardware computes the tcp ip checksum including the pseudo header checksum. Here the tcp payload checksum field should be set to 0000. Ipv4 header checksum is also inserted. */ void synopGMAC_tx_checksum_offload_tcp_pseudo(synopGMACdevice...
{ desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisTcpPseudoCs); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return nonzero if the file has byte-swapped data. */
int TIFFIsByteSwapped(TIFF *tif)
/* Return nonzero if the file has byte-swapped data. */ int TIFFIsByteSwapped(TIFF *tif)
{ return ((tif->tif_flags & TIFF_SWAB) != 0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Registers an interrupt handler for an Ethernet interrupt. */
void EMACIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* Registers an interrupt handler for an Ethernet interrupt. */ void EMACIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ ASSERT(pfnHandler != 0); IntRegister(INT_EMAC0, pfnHandler); IntEnable(INT_EMAC0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine registers the Section Extraction PPIs that have been registered with the Section Extraction Library. */
EFI_STATUS EFIAPI SectionExtractionPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
/* This routine registers the Section Extraction PPIs that have been registered with the Section Extraction Library. */ EFI_STATUS EFIAPI SectionExtractionPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
{ EFI_STATUS Status; EFI_GUID *ExtractHandlerGuidTable; UINTN ExtractHandlerNumber; EFI_PEI_PPI_DESCRIPTOR *GuidPpi; ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable); if (ExtractHandlerNumber > 0) { GuidPpi = (EFI_PEI_PPI_DE...
tianocore/edk2
C++
Other
4,240
/* tipc_disc_update_link_req - update frequency of periodic link setup requests @req: ptr to link request structure */
void tipc_disc_update_link_req(struct link_req *req)
/* tipc_disc_update_link_req - update frequency of periodic link setup requests @req: ptr to link request structure */ void tipc_disc_update_link_req(struct link_req *req)
{ if (!req) return; if (req->timer_intv == TIPC_LINK_REQ_SLOW) { if (!req->bearer->nodes.count) { req->timer_intv = TIPC_LINK_REQ_FAST; k_start_timer(&req->timer, req->timer_intv); } } else if (req->timer_intv == TIPC_LINK_REQ_FAST) { if (req->bearer->nodes.count) { req->timer_intv = TIPC_LINK_REQ_S...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Request the memory region(s) being used by 'port'. */
static int pnx8xxx_request_port(struct uart_port *port)
/* Request the memory region(s) being used by 'port'. */ static int pnx8xxx_request_port(struct uart_port *port)
{ struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; return request_mem_region(sport->port.mapbase, UART_PORT_SIZE, "pnx8xxx-uart") != NULL ? 0 : -EBUSY; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will compare two strings with specified maximum length */
rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count)
/* This function will compare two strings with specified maximum length */ rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count)
{ register signed char __res = 0; while (count) { if ((__res = *cs - *ct++) != 0 || !*cs++) break; count --; } return __res; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This API is used to get shadow dis in the register 0x13 bit 6. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_shadow_dis(u8 *shadow_dis_u8)
/* This API is used to get shadow dis in the register 0x13 bit 6. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_shadow_dis(u8 *shadow_dis_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data_u8 = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_DIS_SHADOW_PROC_REG,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The service() function provides an echo server to make it possible to verify that the IP address resolved by mDNS is the system that this code is running upon. */
int main(void)
/* The service() function provides an echo server to make it possible to verify that the IP address resolved by mDNS is the system that this code is running upon. */ int main(void)
{ LOG_INF("Waiting mDNS queries..."); init_vlan(); service(); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Initialization function for the Q7 sparse FIR filter. */
void arm_fir_sparse_init_q7(arm_fir_sparse_instance_q7 *S, uint16_t numTaps, const q7_t *pCoeffs, q7_t *pState, int32_t *pTapDelay, uint16_t maxDelay, uint32_t blockSize)
/* Initialization function for the Q7 sparse FIR filter. */ void arm_fir_sparse_init_q7(arm_fir_sparse_instance_q7 *S, uint16_t numTaps, const q7_t *pCoeffs, q7_t *pState, int32_t *pTapDelay, uint16_t maxDelay, uint32_t blockSize)
{ S->numTaps = numTaps; S->pCoeffs = pCoeffs; S->pTapDelay = pTapDelay; S->maxDelay = maxDelay; S->stateIndex = 0U; memset(pState, 0, (maxDelay + blockSize) * sizeof(q7_t)); S->pState = pState; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Gadget drivers could use this when constructing a config descriptor in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. */
int usb_gadget_config_buf(const struct usb_config_descriptor *config, void *buf, unsigned length, const struct usb_descriptor_header **desc)
/* Gadget drivers could use this when constructing a config descriptor in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. */ int usb_gadget_config_buf(const struct usb_config_descriptor *config, void *buf, unsigned length, const st...
{ struct usb_config_descriptor *cp = buf; int len; if (length < USB_DT_CONFIG_SIZE || !desc) return -EINVAL; *cp = *config; len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8*)buf, length - USB_DT_CONFIG_SIZE, desc); if (len < 0) return len; len += USB_DT_CONFIG_SIZE; if (len > 0xffff) return -...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: a #gint32 containing the value of the "standard::sort_order" attribute. */
gint32 g_file_info_get_sort_order(GFileInfo *info)
/* Returns: a #gint32 containing the value of the "standard::sort_order" attribute. */ gint32 g_file_info_get_sort_order(GFileInfo *info)
{ static guint32 attr = 0; GFileAttributeValue *value; g_return_val_if_fail (G_IS_FILE_INFO (info), 0); if (attr == 0) attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER); value = g_file_info_find_value (info, attr); return _g_file_attribute_value_get_int32 (value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Instruct the DMA to drop the packets fails tcp ip checksum. This is to instruct the receive DMA engine to drop the recevied packet if they fails the tcp/ip checksum in hardware. Valid only when full checksum offloading is enabled(type-2). */
void synopGMAC_rx_tcpip_chksum_drop_enable(synopGMACdevice *gmacdev)
/* Instruct the DMA to drop the packets fails tcp ip checksum. This is to instruct the receive DMA engine to drop the recevied packet if they fails the tcp/ip checksum in hardware. Valid only when full checksum offloading is enabled(type-2). */ void synopGMAC_rx_tcpip_chksum_drop_enable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->DmaBase,DmaControl,DmaDisableDropTcpCs); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reset the I2O controller, disable interrupts and remove all allocated resources. */
static void __devexit i2o_pci_remove(struct pci_dev *pdev)
/* Reset the I2O controller, disable interrupts and remove all allocated resources. */ static void __devexit i2o_pci_remove(struct pci_dev *pdev)
{ struct i2o_controller *c; c = pci_get_drvdata(pdev); i2o_iop_remove(c); i2o_pci_irq_disable(c); i2o_pci_free(c); pci_disable_device(pdev); printk(KERN_INFO "%s: Controller removed.\n", c->name); put_device(&c->device); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the firmware revision of the IO expander. */
uint32_t BOARD_picGetFwRevision(uint8_t *major, uint8_t *minor, uint8_t *patch)
/* Reads the firmware revision of the IO expander. */ uint32_t BOARD_picGetFwRevision(uint8_t *major, uint8_t *minor, uint8_t *patch)
{ uint32_t status; *major = 0; *minor = 0; *patch = 0; GPIO_IntDisable( 1 << BOARD_PIC_INT_WAKE_PIN ); GPIO_PinOutClear( BOARD_PIC_INT_WAKE_PORT, BOARD_PIC_INT_WAKE_PIN ); status = picReadReg( BOARD_PIC_REG_VERSION_MAJOR, major ); if( status != BOARD_OK ) { goto cleanup; } status = p...
remotemcu/remcu-chip-sdks
C++
null
436
/* This function set priority grouping field split point. */
int rt_hw_interrupt_set_prior_group_bits(unsigned int bits)
/* This function set priority grouping field split point. */ int rt_hw_interrupt_set_prior_group_bits(unsigned int bits)
{ int status; if (bits < 8) { arm_gic_set_binary_point(0, (7 - bits)); status = 0; } else { status = -1; } return (status); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This call is similar to hwconfig(), except that it takes additional argument @subopt. In this example: "dr_usb:mode=peripheral" "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its argument. */
int hwconfig_sub(const char *opt, const char *subopt)
/* This call is similar to hwconfig(), except that it takes additional argument @subopt. In this example: "dr_usb:mode=peripheral" "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its argument. */ int hwconfig_sub(const char *opt, const char *subopt)
{ size_t arglen; const char *arg; arg = __hwconfig(opt, &arglen); if (!arg) return 0; return !!hwconfig_parse(arg, arglen, subopt, ',', '=', NULL); }
EmcraftSystems/u-boot
C++
Other
181
/* Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX. */
u8_t pbuf_header_force(struct pbuf *p, s16_t header_size_increment)
/* Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX. */ u8_t pbuf_header_force(struct pbuf *p, s16_t header_size_increment)
{ return pbuf_header_impl(p, header_size_increment, 1); }
ua1arn/hftrx
C++
null
69
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */
uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */ uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
{ uint32_t index = 0; for(index = 0; index < BufferLength; index++) { CRC->DR = pBuffer[index]; } return (CRC->DR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USI UART get valid entry count in RX FIFO . */
u32 USI_UARTGetRxFifoValidCnt(USI_TypeDef *USIx)
/* USI UART get valid entry count in RX FIFO . */ u32 USI_UARTGetRxFifoValidCnt(USI_TypeDef *USIx)
{ assert_param(IS_ALL_USI_PERIPH(USIx)); return (u32)((USIx->RX_FIFO_STATUS & USI_RXFIFO_VALID_CNT)>>8); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Should work fine on interior and exterior nodes. */
int ocfs2_search_extent_list(struct ocfs2_extent_list *el, u32 v_cluster)
/* Should work fine on interior and exterior nodes. */ int ocfs2_search_extent_list(struct ocfs2_extent_list *el, u32 v_cluster)
{ int ret = -1; int i; struct ocfs2_extent_rec *rec; u32 rec_end, rec_start, clusters; for(i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { rec = &el->l_recs[i]; rec_start = le32_to_cpu(rec->e_cpos); clusters = ocfs2_rec_clusters(el, rec); rec_end = rec_start + clusters; if (v_cluster >= rec_start && ...
robutest/uclinux
C++
GPL-2.0
60
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
__sum16 ip_compute_csum(const void *buff, int len)
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ __sum16 ip_compute_csum(const void *buff, int len)
{ return (__force __sum16)~do_csum(buff, len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes. */
int32_t FMC_Erase_SPROM(void)
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes. */ int32_t FMC_Erase_SPROM(void)
{ int32_t ret = 0; FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE; FMC->ISPADDR = FMC_SPROM_BASE; FMC->ISPDAT = 0x0055AA03UL; FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk; while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { } if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) { FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk; ...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Check the device path node whether it's the Flow Control node or not. */
BOOLEAN IsUartFlowControlDevicePathNode(IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl)
/* Check the device path node whether it's the Flow Control node or not. */ BOOLEAN IsUartFlowControlDevicePathNode(IN UART_FLOW_CONTROL_DEVICE_PATH *FlowControl)
{ return (BOOLEAN)( (DevicePathType (FlowControl) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (FlowControl) == MSG_VENDOR_DP) && (CompareGuid (&FlowControl->Guid, &gEfiUartDevicePathGuid)) ); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the RTC clock to be output through the relative pin. */
void RTC_EnableCalibOutput(FunctionalState Cmd)
/* Enables or disables the RTC clock to be output through the relative pin. */ void RTC_EnableCalibOutput(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); RTC->WRP = 0xCA; RTC->WRP = 0x53; if (Cmd != DISABLE) { RTC->CTRL |= (uint32_t)RTC_CTRL_COEN; } else { RTC->CTRL &= (uint32_t)~RTC_CTRL_COEN; } RTC->WRP = 0xFF; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set grid/axis parameters. Refer to <gfx/wtk.h> for available configuration options. */
void wtk_plot_set_grid(struct wtk_plot *plot, uint8_t axis_option, uint8_t axis_spacing_x, uint8_t axis_offset_x, uint8_t axis_spacing_y, uint8_t axis_offset_y, gfx_color_t axis_color, gfx_color_t axis_zero_color)
/* Set grid/axis parameters. Refer to <gfx/wtk.h> for available configuration options. */ void wtk_plot_set_grid(struct wtk_plot *plot, uint8_t axis_option, uint8_t axis_spacing_x, uint8_t axis_offset_x, uint8_t axis_spacing_y, uint8_t axis_offset_y, gfx_color_t axis_color, gfx_color_t axis_zero_color)
{ Assert(plot); uint8_t height; struct win_area const *area; area = win_get_area(plot->container); height = area->size.y - 2; plot->axis_option = axis_option; plot->axis_spacing_x = axis_spacing_x; plot->axis_offset_x = axis_offset_x; plot->axis_spacing_y = wtk_rescale_value(axis_spacing_y, plot->maximum, h...
memfault/zero-to-main
C++
null
200
/* Compute the worst-case number of indirect blocks that will be used for ip's delayed extent of length "len". */
STATIC xfs_filblks_t xfs_bmap_worst_indlen(xfs_inode_t *ip, xfs_filblks_t len)
/* Compute the worst-case number of indirect blocks that will be used for ip's delayed extent of length "len". */ STATIC xfs_filblks_t xfs_bmap_worst_indlen(xfs_inode_t *ip, xfs_filblks_t len)
{ int level; int maxrecs; xfs_mount_t *mp; xfs_filblks_t rval; mp = ip->i_mount; maxrecs = mp->m_bmap_dmxr[0]; for (level = 0, rval = 0; level < XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK); level++) { len += maxrecs - 1; do_div(len, maxrecs); rval += len; if (len == 1) return rval + XFS_BM_MAXLE...
robutest/uclinux
C++
GPL-2.0
60
/* DMA LLP ENABLE or DISABLE for reconfig function. */
void DMA_ReconfigLlpCmd(CM_DMA_TypeDef *DMAx, uint8_t u8Ch, en_functional_state_t enNewState)
/* DMA LLP ENABLE or DISABLE for reconfig function. */ void DMA_ReconfigLlpCmd(CM_DMA_TypeDef *DMAx, uint8_t u8Ch, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_DMA_UNIT(DMAx)); DDL_ASSERT(IS_DMA_CH(u8Ch)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); MODIFY_REG32(DMAx->RCFGCTL, DMA_RCFGCTL_RCFGCHS | DMA_RCFGCTL_RCFGLLP, \ ((uint32_t)(u8Ch) << DMA_RCFGCTL_RCFGCHS_POS) | ((uint32_t)enNewState << DMA_RCFGCTL_RCFGLLP_POS)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* trace_parser_get_init - gets the buffer for trace parser */
int trace_parser_get_init(struct trace_parser *parser, int size)
/* trace_parser_get_init - gets the buffer for trace parser */ int trace_parser_get_init(struct trace_parser *parser, int size)
{ memset(parser, 0, sizeof(*parser)); parser->buffer = kmalloc(size, GFP_KERNEL); if (!parser->buffer) return 1; parser->size = size; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Version of ffs that only looks at bits 12..15. */
static unsigned int irq_ffs(unsigned int pending)
/* Version of ffs that only looks at bits 12..15. */ static unsigned int irq_ffs(unsigned int pending)
{ return fls(pending) - 1 + CAUSEB_IP; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* FDCAN MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan)
/* FDCAN MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan)
{ if(hfdcan->Instance==FDCAN1) { __HAL_RCC_FDCAN_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOH, GPIO_PIN_13); HAL_GPIO_DeInit(GPIOI, GPIO_PIN_9); HAL_NVIC_DisableIRQ(FDCAN1_IT0_IRQn); HAL_NVIC_DisableIRQ(FDCAN1_IT1_IRQn); HAL_NVIC_DisableIRQ(FDCAN_CAL_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */
EFI_STATUS EFIAPI AhciBlockIoReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */ EFI_STATUS EFIAPI AhciBlockIoReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN ...
{ PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private; if (This == NULL) { return EFI_INVALID_PARAMETER; } Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This); return AhciBlockIoReadBlocks ( PeiServices, &Private->BlkIoPpi, DeviceIndex, StartLBA, B...
tianocore/edk2
C++
Other
4,240
/* USB Device Interrupt enable Called by USBD_Init to enable the USB Interrupt Return Value: None */
void USBD_IntrEna(void)
/* USB Device Interrupt enable Called by USBD_Init to enable the USB Interrupt Return Value: None */ void USBD_IntrEna(void)
{ NVIC_EnableIRQ(USB_IRQn); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Sends data and read data in master mode through the USIx peripheral. */
void USI_I2C_MasterRepeatRead(USI_TypeDef *USIx, u8 *pWriteBuf, u8 Writelen, u8 *pReadBuf, u8 Readlen)
/* Sends data and read data in master mode through the USIx peripheral. */ void USI_I2C_MasterRepeatRead(USI_TypeDef *USIx, u8 *pWriteBuf, u8 Writelen, u8 *pReadBuf, u8 Readlen)
{ u8 cnt = 0; assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); for(cnt = 0; cnt < Writelen; cnt++) { while((USI_I2C_CheckTXFIFOState(USIx, USI_TXFIFO_ALMOST_EMPTY_COPY)) == 0); if(cnt >= Writelen - 1) { USIx->TX_FIFO_WRITE = (*pWriteBuf++) | (1 << 10); } else { USIx->TX_FIFO_WRITE = (*pWriteBuf++); } ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
UINT16 EFIAPI PciExpressBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
{ if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) { return (UINT16)-1; } return MmioBitFieldWrite16 ( GetPciExpressAddress (Address), StartBit, EndBit, Value ); }
tianocore/edk2
C++
Other
4,240
/* @pool: Pool to allocate an skbuff for @size: Size of the buffer needed for the pool @elements: Number of buffers to allocate */
static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
/* @pool: Pool to allocate an skbuff for @size: Size of the buffer needed for the pool @elements: Number of buffers to allocate */ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
{ int freed = elements; while (freed) { struct sk_buff *skb = dev_alloc_skb(size + 128); if (unlikely(skb == NULL)) { pr_warning ("Failed to allocate skb for hardware pool %d\n", pool); break; } skb_reserve(skb, 128 - (((unsigned long)skb->data) & 0x7f)); *(struct sk_buff **)(skb->data ...
robutest/uclinux
C++
GPL-2.0
60
/* USBH_BulkSendData Sends the Bulk Packet to the device. */
USBH_StatusTypeDef USBH_BulkSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num, uint8_t do_ping)
/* USBH_BulkSendData Sends the Bulk Packet to the device. */ USBH_StatusTypeDef USBH_BulkSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num, uint8_t do_ping)
{ if (phost->device.speed != USBH_SPEED_HIGH) { do_ping = 0U; } (void)USBH_LL_SubmitURB(phost, pipe_num, 0U, USBH_EP_BULK, USBH_PID_DATA, buff, length, ...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function gets the gyro ODR according to HZ */
static uint8_t drv_gyro_bosch_bmi160_hz2odr(uint32_t hz)
/* This function gets the gyro ODR according to HZ */ static uint8_t drv_gyro_bosch_bmi160_hz2odr(uint32_t hz)
{ if(hz > 1600) return BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ; else if(hz > 800) return BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ; else if(hz > 400) return BMI160_GYRO_OUTPUT_DATA_RATE_800HZ; else if(hz > 200) return BMI160_GYRO_OUTPUT_DATA_RATE_400HZ; else if(hz > 100) ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Returns true if the platfrom needs sk_buff unmapping. The compiler optimizes away unecessary code if this returns true. */
static int need_skb_unmap(void)
/* Returns true if the platfrom needs sk_buff unmapping. The compiler optimizes away unecessary code if this returns true. */ static int need_skb_unmap(void)
{ struct dummy { DECLARE_PCI_UNMAP_ADDR(addr); }; return sizeof(struct dummy) != 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the length of received data in RX ring buffer. @userData handle LPSCI handle pointer. */
static size_t LPSCI_TransferGetRxRingBufferLength(lpsci_handle_t *handle)
/* Get the length of received data in RX ring buffer. @userData handle LPSCI handle pointer. */ static size_t LPSCI_TransferGetRxRingBufferLength(lpsci_handle_t *handle)
{ assert(handle); size_t size; if (handle->rxRingBufferTail > handle->rxRingBufferHead) { size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail); } else { size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail); } ...
labapart/polymcu
C++
null
201
/* Writes an eddystone header to the global service data buffer. */
static void* ble_eddystone_set_svc_data_base(uint8_t frame_type)
/* Writes an eddystone header to the global service data buffer. */ static void* ble_eddystone_set_svc_data_base(uint8_t frame_type)
{ put_le16(ble_eddystone_svc_data, BLE_EDDYSTONE_SERVICE_UUID); ble_eddystone_svc_data[2] = frame_type; return ble_eddystone_svc_data + BLE_EDDYSTONE_SVC_DATA_BASE_SZ; }
Nicholas3388/LuaNode
C++
Other
1,055
/* atl1e_irq_reset - reset interrupt confiure on the NIC @adapter: board private structure */
static void atl1e_irq_reset(struct atl1e_adapter *adapter)
/* atl1e_irq_reset - reset interrupt confiure on the NIC @adapter: board private structure */ static void atl1e_irq_reset(struct atl1e_adapter *adapter)
{ atomic_set(&adapter->irq_sem, 0); AT_WRITE_REG(&adapter->hw, REG_ISR, 0); AT_WRITE_REG(&adapter->hw, REG_IMR, 0); AT_WRITE_FLUSH(&adapter->hw); }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
UINT32 EFIAPI PciBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ...
{ return mRunningOnQ35 ? PciExpressBitFieldWrite32 (Address, StartBit, EndBit, Value) : PciCf8BitFieldWrite32 (Address, StartBit, EndBit, Value); }
tianocore/edk2
C++
Other
4,240
/* 6.. FMS Reset (Confirmed Service Id = 22) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_reset_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Reset (Confirmed Service Id = 22) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_reset_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Reset Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_reset_req, NULL, "FMS Reset Request"); proto_tree_add_item(sub_tree, hf_ff_fms_reset_req_idx, tvb, offs...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* USB Device Suspend Function Called automatically on USB Device Suspend Return Value: None */
void USBD_Suspend(void)
/* USB Device Suspend Function Called automatically on USB Device Suspend Return Value: None */ void USBD_Suspend(void)
{ USB0->INTEN |= USB_INTEN_RESUMEEN_MASK; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Check if the specified programmable clock is enabled. */
uint32_t pmc_is_pck_enabled(uint32_t ul_id)
/* Check if the specified programmable clock is enabled. */ uint32_t pmc_is_pck_enabled(uint32_t ul_id)
{ if (ul_id > 2) { return 0; } return (PMC->PMC_SCSR & (PMC_SCSR_PCK0 << ul_id)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function determines the size of the flash on the Tiva device. */
uint32_t SysCtlFlashSizeGet(void)
/* This function determines the size of the flash on the Tiva device. */ uint32_t SysCtlFlashSizeGet(void)
{ if(CLASS_IS_TM4C123) { return(((HWREG(SYSCTL_DC0) & SYSCTL_DC0_FLASHSZ_M) << 11) + 0x800); } else { return(2048 * ((HWREG(FLASH_PP) & FLASH_PP_SIZE_M) + 1)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the current Thread Flags of current running thread. */
uint32_t osThreadFlagsGet(void)
/* Get the current Thread Flags of current running thread. */ uint32_t osThreadFlagsGet(void)
{ struct cv2_thread *tid; if (k_is_in_isr()) { return 0; } tid = (struct cv2_thread *)osThreadGetId(); if (tid == NULL) { return 0; } else { return tid->signal_results; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_PNX8XXX and PORT_UNKNOWN */
static int pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser)
/* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_PNX8XXX and PORT_UNKNOWN */ static int pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser)
{ struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; int ret = 0; if (ser->type != PORT_UNKNOWN && ser->type != PORT_PNX8XXX) ret = -EINVAL; if (sport->port.irq != ser->irq) ret = -EINVAL; if (ser->io_type != SERIAL_IO_MEM) ret = -EINVAL; if (sport->port.uartclk / 16 != ser->baud_base) ret = -EINVA...
robutest/uclinux
C++
GPL-2.0
60
/* Forces the TIMx output 3 waveform to active or inactive level. */
void TIM_ConfigForcedOc3(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 3 waveform to active or inactive level. */ void TIM_ConfigForcedOc3(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
{ uint16_t tmpccmr2 = 0; assert_param(IsTimList3Module(TIMx)); assert_param(IsTimForceActive(TIM_ForcedAction)); tmpccmr2 = TIMx->CCMOD2; tmpccmr2 &= (uint16_t) ~((uint16_t)TIM_CCMOD2_OC3MD); tmpccmr2 |= TIM_ForcedAction; TIMx->CCMOD2 = tmpccmr2; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */
void pinmux_init(void)
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */ void pinmux_init(void)
{ pinmux_config_pingrp_table(tegra114_pinmux_set_nontristate, ARRAY_SIZE(tegra114_pinmux_set_nontristate)); pinmux_config_pingrp_table(tegra114_pinmux_common, ARRAY_SIZE(tegra114_pinmux_common)); pinmux_config_pingrp_table(unused_pins_lowpower, ARRAY_SIZE(unused_pins_lowpower)); pinmux_config_drvgrp_table(dal...
4ms/stm32mp1-baremetal
C++
Other
137
/* Device enumeration step 2 Lets USB line in IDLE state during 20ms. */
static void uhc_enumeration_step2(void)
/* Device enumeration step 2 Lets USB line in IDLE state during 20ms. */ static void uhc_enumeration_step2(void)
{ uhc_enable_timeout_callback(20, uhc_enumeration_step3); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Function: MX25_NOP Arguments: None. Description: The NOP instruction is null operation of flash. Return Message: FlashOperationSuccess */
ReturnMsg MX25_NOP(void)
/* Function: MX25_NOP Arguments: None. Description: The NOP instruction is null operation of flash. Return Message: FlashOperationSuccess */ ReturnMsg MX25_NOP(void)
{ CS_Low(); SendByte( FLASH_CMD_NOP, SIO ); CS_High(); return FlashOperationSuccess; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read the specified PWR flag is set or not. */
uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag)
/* Read the specified PWR flag is set or not. */ uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag)
{ uint8_t BitStatus = BIT_RESET; if(flag == PMU_FLAG_WUE) { BitStatus = PMU->CSTS_B.WUEFLG; } else if(flag == PMU_FLAG_SB) { BitStatus = PMU->CSTS_B.SBFLG; } else if(flag == PMU_FLAG_PVDO) { BitStatus = PMU->CSTS_B.PVDOFLG; } return BitStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The newly created directory will not exist on the file till TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called. */
int TIFFCreateDirectory(TIFF *tif)
/* The newly created directory will not exist on the file till TIFFWriteDirectory(), TIFFFlush() or TIFFClose() is called. */ int TIFFCreateDirectory(TIFF *tif)
{ TIFFDefaultDirectory(tif); tif->tif_diroff = 0; tif->tif_nextdiroff = 0; tif->tif_curoff = 0; tif->tif_row = (uint32) -1; tif->tif_curstrip = (uint32) -1; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Notes: We don't want to use the normal command completion while we are are still handling errors - it may cause other commands to be queued, and that would disturb what we are doing. Thus we really want to keep a list of pending commands for final completion, and once we are ready to leave error handling we handle c...
void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q)
/* Notes: We don't want to use the normal command completion while we are are still handling errors - it may cause other commands to be queued, and that would disturb what we are doing. Thus we really want to keep a list of pending commands for final completion, and once we are ready to leave error handling we handle c...
{ scmd->device->host->host_failed--; scmd->eh_eflags = 0; list_move_tail(&scmd->eh_entry, done_q); }
robutest/uclinux
C++
GPL-2.0
60
/* This code checks if the FileSuffix is one of the possible DER-encoded certificate suffix. */
BOOLEAN IsDerEncodeCertificate(IN CONST CHAR16 *FileSuffix)
/* This code checks if the FileSuffix is one of the possible DER-encoded certificate suffix. */ BOOLEAN IsDerEncodeCertificate(IN CONST CHAR16 *FileSuffix)
{ UINTN Index; for (Index = 0; mDerEncodedSuffix[Index] != NULL; Index++) { if (StrCmp (FileSuffix, mDerEncodedSuffix[Index]) == 0) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* While EFIs cannot really be pinned, the unpin operation is the last place at which the EFI is manipulated during a transaction. Here we coordinate with xfs_efi_cancel() to determine who gets to free the EFI. */
STATIC void xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
/* While EFIs cannot really be pinned, the unpin operation is the last place at which the EFI is manipulated during a transaction. Here we coordinate with xfs_efi_cancel() to determine who gets to free the EFI. */ STATIC void xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
{ struct xfs_ail *ailp = efip->efi_item.li_ailp; spin_lock(&ailp->xa_lock); if (efip->efi_flags & XFS_EFI_CANCELED) { xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip); xfs_efi_item_free(efip); } else { efip->efi_flags |= XFS_EFI_COMMITTED; spin_unlock(&ailp->xa_lock); } }
robutest/uclinux
C++
GPL-2.0
60
/* Enable ECC logic and reset syndrome/parity bits previously calculated Syndrome/parity bits is cleared by setting the ECCEN bit to 0 */
static void stm32_fmc2_hwctl(struct mtd_info *mtd, int mode)
/* Enable ECC logic and reset syndrome/parity bits previously calculated Syndrome/parity bits is cleared by setting the ECCEN bit to 0 */ static void stm32_fmc2_hwctl(struct mtd_info *mtd, int mode)
{ struct nand_chip *chip = mtd_to_nand(mtd); struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller); stm32_fmc2_set_ecc(fmc2, false); if (chip->ecc.strength != FMC2_ECC_HAM) { u32 pcr = readl(fmc2->io_base + FMC2_PCR); if (mode == NAND_ECC_WRITE) pcr |= FMC2_PCR_WEN; else pcr &= ~FMC2_PCR_WEN; w...
4ms/stm32mp1-baremetal
C++
Other
137
/* Determine the amount of usable RAM below 4GiB, taking into account any carve-out that may be assigned. */
static ulong usable_ram_size_below_4g(void)
/* Determine the amount of usable RAM below 4GiB, taking into account any carve-out that may be assigned. */ static ulong usable_ram_size_below_4g(void)
{ ulong total_size_below_4g; ulong usable_size_below_4g; if (gd->ram_size < SZ_2G) total_size_below_4g = gd->ram_size; else total_size_below_4g = SZ_2G; usable_size_below_4g = total_size_below_4g - carveout_size(); return usable_size_below_4g; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Socket removal during an interrupt is now safe. */
static void rose_remove_socket(struct sock *sk)
/* Socket removal during an interrupt is now safe. */ static void rose_remove_socket(struct sock *sk)
{ spin_lock_bh(&rose_list_lock); sk_del_node_init(sk); spin_unlock_bh(&rose_list_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Receives a communication interface byte if one is present. */
static unsigned char Rs232ReceiveByte(unsigned char *data)
/* Receives a communication interface byte if one is present. */ static unsigned char Rs232ReceiveByte(unsigned char *data)
{ signed long result; result = UARTCharGetNonBlocking(UART0_BASE); if(result != -1) { *data = (unsigned char)result; return 1; } return 0; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* GetInfo gets raw data size and attribute of the input guided section. It first checks whether the input guid section is supported. If not, EFI_INVALID_PARAMETER will return. */
EFI_STATUS EFIAPI Crc32GuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute)
/* GetInfo gets raw data size and attribute of the input guided section. It first checks whether the input guid section is supported. If not, EFI_INVALID_PARAMETER will return. */ EFI_STATUS EFIAPI Crc32GuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UI...
{ if (IS_SECTION2 (InputSection)) { if (!CompareGuid ( &gEfiCrc32GuidedSectionExtractionGuid, &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid) )) { return EFI_INVALID_PARAMETER; } *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *)InputSectio...
tianocore/edk2
C++
Other
4,240
/* System calibration rtc get results. Use this function to get system calibration rtc results. */
void system_rtc_calibration_result(struct system_calibration_config *config)
/* System calibration rtc get results. Use this function to get system calibration rtc results. */ void system_rtc_calibration_result(struct system_calibration_config *config)
{ config->rtc_fractional_part = LP_CLK_CAL_REGS0->CALIB_RTC_COUNT_REG.bit.CAL_FRAC_COUNT; config->rtc_integer_part = LP_CLK_CAL_REGS0->CALIB_RTC_COUNT_REG.bit.CAL_INT_COUNT; }
memfault/zero-to-main
C++
null
200
/* Load a platform logo image and return its data and attributes. */
EFI_STATUS EFIAPI GetImage(IN EDKII_PLATFORM_LOGO_PROTOCOL *This, IN OUT UINT32 *Instance, OUT EFI_IMAGE_INPUT *Image, OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute, OUT INTN *OffsetX, OUT INTN *OffsetY)
/* Load a platform logo image and return its data and attributes. */ EFI_STATUS EFIAPI GetImage(IN EDKII_PLATFORM_LOGO_PROTOCOL *This, IN OUT UINT32 *Instance, OUT EFI_IMAGE_INPUT *Image, OUT EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE *Attribute, OUT INTN *OffsetX, OUT INTN *OffsetY)
{ UINT32 Current; if ((Instance == NULL) || (Image == NULL) || (Attribute == NULL) || (OffsetX == NULL) || (OffsetY == NULL)) { return EFI_INVALID_PARAMETER; } Current = *Instance; if (Current >= ARRAY_SIZE (mLogos)) { return EFI_NOT_FOUND; } (*Instance)++; *Attribute = mLogos[Current]....
tianocore/edk2
C++
Other
4,240
/* This function pads up to the next min_io_size boundary (if there is one) and sets empty space to all 0xff. @buf, @offs and @len are updated to the next */
static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, int *offs, int *len)
/* This function pads up to the next min_io_size boundary (if there is one) and sets empty space to all 0xff. @buf, @offs and @len are updated to the next */ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, int *offs, int *len)
{ int empty_offs, pad_len; lnum = lnum; dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs); ubifs_assert(!(*offs & 7)); empty_offs = ALIGN(*offs, c->min_io_size); pad_len = empty_offs - *offs; ubifs_pad(c, *buf, pad_len); *offs += pad_len; *buf += pad_len; *len -= pad_len; memset(*buf, 0xff, c->leb_size ...
robutest/uclinux
C++
GPL-2.0
60
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */
void SNVS_LP_SRTC_GetAlarm(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */ void SNVS_LP_SRTC_GetAlarm(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
{ assert(datetime); uint32_t alarmSeconds = 0U; alarmSeconds = base->LPTAR; SNVS_LP_ConvertSecondsToDatetime(alarmSeconds, datetime); }
nanoframework/nf-interpreter
C++
MIT License
293
/* dwarf_lookup_cie - locate the cie @cie_ptr: pointer to help with lookup */
static struct dwarf_cie* dwarf_lookup_cie(unsigned long cie_ptr)
/* dwarf_lookup_cie - locate the cie @cie_ptr: pointer to help with lookup */ static struct dwarf_cie* dwarf_lookup_cie(unsigned long cie_ptr)
{ struct dwarf_cie *cie; unsigned long flags; spin_lock_irqsave(&dwarf_cie_lock, flags); if (cached_cie && cached_cie->cie_pointer == cie_ptr) { cie = cached_cie; goto out; } list_for_each_entry(cie, &dwarf_cie_list, link) { if (cie->cie_pointer == cie_ptr) { cached_cie = cie; break; } } if (&cie-...
EmcraftSystems/linux-emcraft
C++
Other
266
/* set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports. @dev: pointer to root port's pci_dev data structure @enable: true = enable error reporting, false = disable error reporting. */
static void set_downstream_devices_error_reporting(struct pci_dev *dev, bool enable)
/* set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports. @dev: pointer to root port's pci_dev data structure @enable: true = enable error reporting, false = disable error reporting. */ static void set_downstream_devices_error_reporting(struct pci_de...
{ set_device_error_reporting(dev, &enable); if (!dev->subordinate) return; pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable); }
robutest/uclinux
C++
GPL-2.0
60
/* The interpretation of the PECI_DOMAIN_MnDm fields vary based on the mode value programed using the */
unsigned long PECIIntStatus(unsigned long ulBase, tBoolean bMasked)
/* The interpretation of the PECI_DOMAIN_MnDm fields vary based on the mode value programed using the */ unsigned long PECIIntStatus(unsigned long ulBase, tBoolean bMasked)
{ ASSERT(ulBase == PECI0_BASE); if(bMasked) { return(HWREG(ulBase + PECI_O_MIS)); } else { return(HWREG(ulBase + PECI_O_RIS)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Selects the clock source to output on MCO2 pin. */
void RCM_ConfigMCO2(RCM_MCO2_SEL_T mco2Select, RCM_MCO2_DIV_T mco2Div)
/* Selects the clock source to output on MCO2 pin. */ void RCM_ConfigMCO2(RCM_MCO2_SEL_T mco2Select, RCM_MCO2_DIV_T mco2Div)
{ RCM->CFG_B.MCO2SEL = mco2Select; RCM->CFG_B.MCO2PRE = mco2Div; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We don't support non-blocking mode. I'm not sure what we'd do to support it and, given that we don't support select()/ poll()/epoll_wait()/kevent() etc., it probably doesn't matter. */
static int septel_getnonblock(pcap_t *p)
/* We don't support non-blocking mode. I'm not sure what we'd do to support it and, given that we don't support select()/ poll()/epoll_wait()/kevent() etc., it probably doesn't matter. */ static int septel_getnonblock(pcap_t *p)
{ fprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Non-blocking mode not supported on Septel devices"); return (-1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330