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
/* param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param isEnable Enable or disable flag. param ringId The ring index or ring number. retval kStatus_Success Succeed to enable/disable Tx reclaim. retval kStatus_Fail Fail to enable/disable Tx reclaim. */
status_t ENET_SetTxReclaim(enet_handle_t *handle, bool isEnable, uint8_t ringId)
/* param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param isEnable Enable or disable flag. param ringId The ring index or ring number. retval kStatus_Success Succeed to enable/disable Tx reclaim. retval kStatus_Fail Fail to enable/disable Tx reclaim. */ status_t ENET_SetTxReclaim(enet_handle_t *handle, bool isEnable, uint8_t ringId)
{ assert(handle != NULL); assert(ringId < (uint8_t)FSL_FEATURE_ENET_QUEUE); enet_tx_bd_ring_t *txBdRing = &handle->txBdRing[ringId]; enet_tx_dirty_ring_t *txDirtyRing = &handle->txDirtyRing[ringId]; status_t result = kStatus_Success; if ((txDirtyRing->txGenIdx == txDirtyRing->txConsumIdx) && ENET_TxDirtyRingAvailable(txDirtyRing)) { if (isEnable) { handle->TxReclaimEnable[ringId] = true; txBdRing->txConsumIdx = txBdRing->txGenIdx; } else { handle->TxReclaimEnable[ringId] = false; } } else { result = kStatus_Fail; } return result; }
eclipse-threadx/getting-started
C++
Other
310
/* Resets the kevents object and frees all the associated memory. */
void kevents_free(kevents *kv)
/* Resets the kevents object and frees all the associated memory. */ void kevents_free(kevents *kv)
{ g_assert (kv != NULL); g_free (kv->memory); memset (kv, 0, sizeof (kevents)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enter Sleep mode with co-operated instruction by the Cortex-M3. */
void CLKPWR_Sleep(void)
/* Enter Sleep mode with co-operated instruction by the Cortex-M3. */ void CLKPWR_Sleep(void)
{ LPC_SC->PCON = 0x00; __WFI(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This api used to reads the interrupt status of high_rate sign, high_rate first_z, high_rate first_x and high_rate first_y in the register 0x0C. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr_stat_reg_three(u8 *v_stat3_data_u8)
/* This api used to reads the interrupt status of high_rate sign, high_rate first_z, high_rate first_x and high_rate first_y in the register 0x0C. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr_stat_reg_three(u8 *v_stat3_data_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC (p_bmg160->dev_addr, BMG160_INTR_STAT_THREE__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_stat3_data_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_INTR_STAT_THREE); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @dev_addr: index to EDA cache @eda_entry: pointer to where contents of EDA cache will be copied */
int wlp_copy_eda_node(struct wlp_eda *eda, struct uwb_dev_addr *dev_addr, struct wlp_eda_node *eda_entry)
/* @dev_addr: index to EDA cache @eda_entry: pointer to where contents of EDA cache will be copied */ int wlp_copy_eda_node(struct wlp_eda *eda, struct uwb_dev_addr *dev_addr, struct wlp_eda_node *eda_entry)
{ int result = -ENOENT; struct wlp_eda_node *itr; unsigned long flags; spin_lock_irqsave(&eda->lock, flags); list_for_each_entry(itr, &eda->cache, list_node) { if (!memcmp(&itr->dev_addr, dev_addr, sizeof(itr->dev_addr))) { *eda_entry = *itr; result = 0; goto out_unlock; } } out_unlock: spin_unlock_irqrestore(&eda->lock, flags); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns after the IPI has been accepted by the target processors. */
VOID EFIAPI SendInitIpiAllExcludingSelf(VOID)
/* This function returns after the IPI has been accepted by the target processors. */ VOID EFIAPI SendInitIpiAllExcludingSelf(VOID)
{ LOCAL_APIC_ICR_LOW IcrLow; IcrLow.Uint32 = 0; IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_INIT; IcrLow.Bits.Level = 1; IcrLow.Bits.DestinationShorthand = LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF; SendIpi (IcrLow.Uint32, 0); }
tianocore/edk2
C++
Other
4,240
/* The function is used to Enable BOD reset function or interrupt function. */
void SysCtlBODRstEnable(xtBoolean bEnable)
/* The function is used to Enable BOD reset function or interrupt function. */ void SysCtlBODRstEnable(xtBoolean bEnable)
{ SysCtlKeyAddrUnlock(); if(bEnable) { xHWREG(GCR_BODCR) |= GCR_BODCR_BOD_RSTEN; } else { xHWREG(GCR_BODCR) &= ~GCR_BODCR_BOD_RSTEN; } SysCtlKeyAddrLock(); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This code gets the size of data of variable. */
UINTN DataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag)
/* This code gets the size of data of variable. */ UINTN DataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag)
{ AUTHENTICATED_VARIABLE_HEADER *AuthVariable; AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable; if (AuthFlag) { if ((AuthVariable->State == (UINT8)(-1)) || (AuthVariable->DataSize == (UINT32)(-1)) || (AuthVariable->NameSize == (UINT32)(-1)) || (AuthVariable->Attributes == (UINT32)(-1))) { return 0; } return (UINTN)AuthVariable->DataSize; } else { if ((Variable->State == (UINT8)(-1)) || (Variable->DataSize == (UINT32)(-1)) || (Variable->NameSize == (UINT32)(-1)) || (Variable->Attributes == (UINT32)(-1))) { return 0; } return (UINTN)Variable->DataSize; } }
tianocore/edk2
C++
Other
4,240
/* The bram offset register holds the starting bram address to transfer data from during configuration or write data to during readback. */
static void buffer_icap_set_offset(void __iomem *base_address, u32 data)
/* The bram offset register holds the starting bram address to transfer data from during configuration or write data to during readback. */ static void buffer_icap_set_offset(void __iomem *base_address, u32 data)
{ out_be32(base_address + XHI_BRAM_OFFSET_REG_OFFSET, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Caution: The caller need validate the input firmware volume to follow PI specification. DxeCore will trust the input data and process firmware volume directly. */
EFI_STATUS EFIAPI CoreProcessFirmwareVolume(IN VOID *FvHeader, IN UINTN Size, OUT EFI_HANDLE *FVProtocolHandle)
/* Caution: The caller need validate the input firmware volume to follow PI specification. DxeCore will trust the input data and process firmware volume directly. */ EFI_STATUS EFIAPI CoreProcessFirmwareVolume(IN VOID *FvHeader, IN UINTN Size, OUT EFI_HANDLE *FVProtocolHandle)
{ VOID *Ptr; EFI_STATUS Status; *FVProtocolHandle = NULL; Status = ProduceFVBProtocolOnBuffer ( (EFI_PHYSICAL_ADDRESS)(UINTN)FvHeader, (UINT64)Size, NULL, 0, FVProtocolHandle ); if (!EFI_ERROR (Status)) { ASSERT (*FVProtocolHandle != NULL); Ptr = NULL; Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Ptr); if (EFI_ERROR (Status) || (Ptr == NULL)) { return EFI_VOLUME_CORRUPTED; } return EFI_SUCCESS; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Copy bytes from an SDIO card. Copies bytes from an SDIO card, starting from provided address. */
int sdio_read_addr(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t len)
/* Copy bytes from an SDIO card. Copies bytes from an SDIO card, starting from provided address. */ int sdio_read_addr(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t len)
{ int ret; if ((func->card->type != CARD_SDIO) && (func->card->type != CARD_COMBO)) { LOG_WRN("Card does not support SDIO commands"); return -ENOTSUP; } ret = k_mutex_lock(&func->card->lock, K_MSEC(CONFIG_SD_DATA_TIMEOUT)); if (ret) { LOG_WRN("Could not get SD card mutex"); return -EBUSY; } ret = sdio_io_rw_extended_helper(func, SDIO_IO_READ, reg, true, data, len); k_mutex_unlock(&func->card->lock); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Offline state - awaiting ONLINE event from fabric SM. */
static void bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport, enum bfa_fcs_vport_event event)
/* Offline state - awaiting ONLINE event from fabric SM. */ static void bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport, enum bfa_fcs_vport_event event)
{ bfa_trc(__vport_fcs(vport), __vport_pwwn(vport)); bfa_trc(__vport_fcs(vport), event); switch (event) { case BFA_FCS_VPORT_SM_DELETE: bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); bfa_fcs_port_delete(&vport->lport); break; case BFA_FCS_VPORT_SM_ONLINE: bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); vport->fdisc_retries = 0; bfa_fcs_vport_do_fdisc(vport); break; case BFA_FCS_VPORT_SM_OFFLINE: break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* Sends an LPM request to a device at a specified address and endpoint number. */
void USBHostLPMSend(uint32_t ui32Base, uint32_t ui32Address, uint32_t ui32Endpoint)
/* Sends an LPM request to a device at a specified address and endpoint number. */ void USBHostLPMSend(uint32_t ui32Base, uint32_t ui32Address, uint32_t ui32Endpoint)
{ uint32_t ui32Reg; ASSERT(ui32Base == USB0_BASE); ASSERT(ui32Address < 127); HWREGB(ui32Base + USB_O_LPMFADDR) = ui32Address; ui32Reg = HWREGH(ui32Base + USB_O_LPMATTR) & ~USB_LPMATTR_ENDPT_M; ui32Reg |= (USBEPToIndex(ui32Endpoint) << USB_LPMATTR_ENDPT_S); HWREGH(ui32Base + USB_O_LPMATTR) = ui32Reg; HWREGB(ui32Base + USB_O_LPMCNTRL) |= USB_LPMCNTRL_TXLPM; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The CMD640x chip does not support DWORD config write cycles, but some of the BIOSes use them to implement the config services. Therefore, we must use direct IO instead. */
static void put_cmd640_reg_pci1(u16 reg, u8 val)
/* The CMD640x chip does not support DWORD config write cycles, but some of the BIOSes use them to implement the config services. Therefore, we must use direct IO instead. */ static void put_cmd640_reg_pci1(u16 reg, u8 val)
{ outl_p((reg & 0xfc) | cmd640_key, 0xcf8); outb_p(val, (reg & 3) | 0xcfc); }
robutest/uclinux
C++
GPL-2.0
60
/* Read data from Rx registers. This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
/* Read data from Rx registers. This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */ unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
{ unsigned long i; xASSERT(ulBase == SPI0_BASE); xASSERT(ulCount < 2); for (i=0; i<ulCount; i++) { pulData[i] = xHWREG(ulBase + SPI_RX0 + 4*i); } return ulCount; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* get a Lilliputian unsigned integer from a tvb */
WSLUA_METHOD TvbRange_le_uint(lua_State *L)
/* get a Lilliputian unsigned integer from a tvb */ WSLUA_METHOD TvbRange_le_uint(lua_State *L)
{ luaL_error(L,"expired tvb"); return 0; } switch (tvbr->len) { case 1: lua_pushnumber(L,(lua_Number)(guint)tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 2: lua_pushnumber(L,tvb_get_letohs(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 3: lua_pushnumber(L,tvb_get_letoh24(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 4: lua_pushnumber(L,tvb_get_letohl(tvbr->tvb->ws_tvb,tvbr->offset)); WSLUA_RETURN(1); default: luaL_error(L,"TvbRange:le_uint() does not handle %d byte integers",tvbr->len); return 0; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Re-enable Backup Domain Write Protection. This protects backup domain registers from inadvertent change. */
void pwr_enable_backup_domain_write_protect(void)
/* Re-enable Backup Domain Write Protection. This protects backup domain registers from inadvertent change. */ void pwr_enable_backup_domain_write_protect(void)
{ PWR_CR &= ~PWR_CR_DBP; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* How many free bytes are available on the buffer. Needs to be called with bufferlock held. */
static int dasd_eer_get_free_bytes(struct eerbuffer *eerb)
/* How many free bytes are available on the buffer. Needs to be called with bufferlock held. */ static int dasd_eer_get_free_bytes(struct eerbuffer *eerb)
{ if (eerb->head < eerb->tail) return eerb->tail - eerb->head - 1; return eerb->buffersize - eerb->head + eerb->tail -1; }
robutest/uclinux
C++
GPL-2.0
60
/* Send the data in communicate buffer to SMM. */
EFI_STATUS SendCommunicateBuffer(IN UINTN DataSize)
/* Send the data in communicate buffer to SMM. */ EFI_STATUS SendCommunicateBuffer(IN UINTN DataSize)
{ EFI_STATUS Status; UINTN CommSize; EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; Status = mMmCommunication2->Communicate ( mMmCommunication2, mVariableBufferPhysical, mVariableBuffer, &CommSize ); ASSERT_EFI_ERROR (Status); SmmCommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mVariableBuffer; SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data; return SmmVariableFunctionHeader->ReturnStatus; }
tianocore/edk2
C++
Other
4,240
/* The API is used for getting the customer key store data from the customer key store region(0x3e400 �C 0x3e600), and the API should be called after the FLASH_Init and FFR_Init. */
status_t FFR_GetCustKeystoreData(flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len)
/* The API is used for getting the customer key store data from the customer key store region(0x3e400 �C 0x3e600), and the API should be called after the FLASH_Init and FFR_Init. */ status_t FFR_GetCustKeystoreData(flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_get_cust_keystore(config, pData, offset, len); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will set an usb controller driver to a device. */
rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd)
/* This function will set an usb controller driver to a device. */ rt_err_t rt_usbd_device_set_controller(udevice_t device, udcd_t dcd)
{ RT_ASSERT(device != RT_NULL); RT_ASSERT(dcd != RT_NULL); device->dcd = dcd; return RT_EOK; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Registers a callback. Registers and enable a callback function which is implemented by the user. */
void dualtimer_register_callback(enum dualtimer_timer timer, dualtimer_callback_t fun)
/* Registers a callback. Registers and enable a callback function which is implemented by the user. */ void dualtimer_register_callback(enum dualtimer_timer timer, dualtimer_callback_t fun)
{ if (timer == DUALTIMER_TIMER1) { dualtimer_callback_timer1 = fun; } else { dualtimer_callback_timer2 = fun; } }
memfault/zero-to-main
C++
null
200
/* Return TRUE is we are currently receiving a frame */
static int w83977af_is_receiving(struct w83977af_ir *self)
/* Return TRUE is we are currently receiving a frame */ static int w83977af_is_receiving(struct w83977af_ir *self)
{ int status = FALSE; int iobase; __u8 set; IRDA_ASSERT(self != NULL, return FALSE;); if (self->io.speed > 115200) { iobase = self->io.fir_base; set = inb(iobase+SSR); switch_bank(iobase, SET2); if ((inb(iobase+RXFDTH) & 0x3f) != 0) { status = TRUE; } outb(set, iobase+SSR); } else status = (self->rx_buff.state != OUTSIDE_FRAME); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Refresh the style of all children of an object. (Called recursively) */
static void report_style_change_core(void *style, lv_obj_t *obj)
/* Refresh the style of all children of an object. (Called recursively) */ static void report_style_change_core(void *style, lv_obj_t *obj)
{ uint32_t i; for(i = 0; i < obj->style_cnt; i++) { if(style == NULL || obj->styles[i].style == style) { full_cache_refresh(obj, lv_obj_style_get_selector_part(obj->styles[i].selector)); lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); break; } } uint32_t child_cnt = lv_obj_get_child_count(obj); for(i = 0; i < child_cnt; i++) { report_style_change_core(style, obj->spec_attr->children[i]); } }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on the LockState and OpenState fields being up-to-date on entry, and they need to restore the same invariant on exit, if they touch the bits in question. */
VOID GetStates(OUT BOOLEAN *LockState, OUT BOOLEAN *OpenState)
/* PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on the LockState and OpenState fields being up-to-date on entry, and they need to restore the same invariant on exit, if they touch the bits in question. */ VOID GetStates(OUT BOOLEAN *LockState, OUT BOOLEAN *OpenState)
{ UINT8 SmramVal, EsmramcVal; SmramVal = PciRead8 (DRAMC_REGISTER_Q35 (MCH_SMRAM)); EsmramcVal = PciRead8 (DRAMC_REGISTER_Q35 (MCH_ESMRAMC)); *LockState = !!(SmramVal & MCH_SMRAM_D_LCK); *OpenState = !(EsmramcVal & MCH_ESMRAMC_T_EN); }
tianocore/edk2
C++
Other
4,240
/* Returns: NULL if the string does not contain the character, otherwise, a pointer to the start of the rightmost occurrence of the character in the string. */
gchar* g_utf8_strrchr(const char *p, gssize len, gunichar c)
/* Returns: NULL if the string does not contain the character, otherwise, a pointer to the start of the rightmost occurrence of the character in the string. */ gchar* g_utf8_strrchr(const char *p, gssize len, gunichar c)
{ gchar ch[10]; gint charlen = g_unichar_to_utf8 (c, ch); ch[charlen] = '\0'; return g_strrstr_len (p, len, ch); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the link status changed (previous != current), call netif_carrier_on() if current link status is Up or call netif_carrier_off() if current link status is Down. */
void mii_check_link(struct mii_if_info *mii)
/* If the link status changed (previous != current), call netif_carrier_on() if current link status is Up or call netif_carrier_off() if current link status is Down. */ void mii_check_link(struct mii_if_info *mii)
{ int cur_link = mii_link_ok(mii); int prev_link = netif_carrier_ok(mii->dev); if (cur_link && !prev_link) netif_carrier_on(mii->dev); else if (prev_link && !cur_link) netif_carrier_off(mii->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks and adjusts current CPU features per dependency relationship. */
BOOLEAN InsertToBeforeEntry(IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask)
/* Checks and adjusts current CPU features per dependency relationship. */ BOOLEAN InsertToBeforeEntry(IN LIST_ENTRY *FeatureList, IN LIST_ENTRY *CurrentEntry, IN UINT8 *FeatureMask)
{ LIST_ENTRY *CheckEntry; CPU_FEATURES_ENTRY *CheckFeature; BOOLEAN Swapped; Swapped = FALSE; CheckEntry = GetFirstNode (FeatureList); while (CheckEntry != CurrentEntry) { CheckFeature = CPU_FEATURE_ENTRY_FROM_LINK (CheckEntry); if (IsBitMaskMatchCheck (CheckFeature->FeatureMask, FeatureMask)) { AdjustEntry (FeatureList, CheckEntry, CurrentEntry, TRUE); Swapped = TRUE; break; } CheckEntry = CheckEntry->ForwardLink; } return Swapped; }
tianocore/edk2
C++
Other
4,240
/* If this function returns, it means that the system does not support shut down reset. */
VOID EFIAPI ResetShutdown(VOID)
/* If this function returns, it means that the system does not support shut down reset. */ VOID EFIAPI ResetShutdown(VOID)
{ PeiServicesResetSystem2 (EfiResetShutdown, EFI_SUCCESS, 0, NULL); }
tianocore/edk2
C++
Other
4,240
/* The pthread_cancel(), pthread_setcancelstate(), and pthread_setcanceltype() functions are defined to be async-cancel safe. */
int pthread_setcancelstate(int state, int *oldstate)
/* The pthread_cancel(), pthread_setcancelstate(), and pthread_setcanceltype() functions are defined to be async-cancel safe. */ int pthread_setcancelstate(int state, int *oldstate)
{ _pthread_data_t *ptd; ptd = _pthread_get_data(rt_thread_self()); RT_ASSERT(ptd != RT_NULL); if ((state == PTHREAD_CANCEL_ENABLE) || (state == PTHREAD_CANCEL_DISABLE)) { if (oldstate) *oldstate = ptd->cancelstate; ptd->cancelstate = state; return 0; } return EINVAL; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting. */
s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
/* Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting. */ s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
{ s32 ret_val = 0; if (!(hw->phy.ops.acquire)) goto out; ret_val = hw->phy.ops.acquire(hw); if (ret_val) goto out; if (offset > MAX_PHY_MULTI_PAGE_REG) { ret_val = igb_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, (u16)offset); if (ret_val) { hw->phy.ops.release(hw); goto out; } } ret_val = igb_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); hw->phy.ops.release(hw); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Prepends a term to the list of terms represented by a_this. */
CRTerm* cr_term_prepend_term(CRTerm *a_this, CRTerm *a_new_term)
/* Prepends a term to the list of terms represented by a_this. */ CRTerm* cr_term_prepend_term(CRTerm *a_this, CRTerm *a_new_term)
{ g_return_val_if_fail (a_this && a_new_term, NULL); a_new_term->next = a_this; a_this->prev = a_new_term; return a_new_term; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Our timers have to work without interrupts, so we check whenever keyboard input or disk accesses happen if enough time elapsed for them to fire. */
void efi_timer_check(void)
/* Our timers have to work without interrupts, so we check whenever keyboard input or disk accesses happen if enough time elapsed for them to fire. */ void efi_timer_check(void)
{ struct efi_event *evt; u64 now = timer_get_us(); list_for_each_entry(evt, &efi_events, link) { if (!timers_enabled) continue; if (!(evt->type & EVT_TIMER) || now < evt->trigger_next) continue; switch (evt->trigger_type) { case EFI_TIMER_RELATIVE: evt->trigger_type = EFI_TIMER_STOP; break; case EFI_TIMER_PERIODIC: evt->trigger_next += evt->trigger_time; break; default: continue; } evt->is_signaled = false; efi_signal_event(evt); } efi_process_event_queue(); WATCHDOG_RESET(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Create the GArray from the static table if it hasn't already been created. */
static void init_file_types_subtypes_garray(void)
/* Create the GArray from the static table if it hasn't already been created. */ static void init_file_types_subtypes_garray(void)
{ if (dump_open_table_arr) return; dump_open_table_arr = g_array_new(FALSE,TRUE,sizeof(struct file_type_subtype_info)); g_array_append_vals(dump_open_table_arr,dump_open_table_base,wtap_num_file_types_subtypes); dump_open_table = (const struct file_type_subtype_info*)(void *)dump_open_table_arr->data; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_base() gives you, use parport_put_port(). */
struct parport* parport_find_base(unsigned long base)
/* There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_base() gives you, use parport_put_port(). */ struct parport* parport_find_base(unsigned long base)
{ struct parport *port, *result = NULL; if (list_empty(&portlist)) get_lowlevel_driver (); spin_lock (&parportlist_lock); list_for_each_entry(port, &portlist, list) { if (port->base == base) { result = parport_get_port (port); break; } } spin_unlock (&parportlist_lock); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Descriptor configuration change call back for the Value V6 attribute. */
static void value_v6_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
/* Descriptor configuration change call back for the Value V6 attribute. */ static void value_v6_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
{ value_v6_ntf_active = value == BT_GATT_CCC_NOTIFY; value_v6_ind_active = value == BT_GATT_CCC_INDICATE; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Wake up users waiting for IO so they can disconnect from dead device. */
static void mousedev_hangup(struct mousedev *mousedev)
/* Wake up users waiting for IO so they can disconnect from dead device. */ static void mousedev_hangup(struct mousedev *mousedev)
{ struct mousedev_client *client; spin_lock(&mousedev->client_lock); list_for_each_entry(client, &mousedev->client_list, node) kill_fasync(&client->fasync, SIGIO, POLL_HUP); spin_unlock(&mousedev->client_lock); wake_up_interruptible(&mousedev->wait); }
robutest/uclinux
C++
GPL-2.0
60
/* Handler to perform various actions from within an ISR context. This routine is the ISR handler for isr_handler_trigger(). It performs the command requested in <isr_info.command>. */
static void isr_handler(const void *data)
/* Handler to perform various actions from within an ISR context. This routine is the ISR handler for isr_handler_trigger(). It performs the command requested in <isr_info.command>. */ static void isr_handler(const void *data)
{ ARG_UNUSED(data); if (k_can_yield()) { isr_info.error = INVALID_BEHAVIOUR; } switch (isr_info.command) { case THREAD_SELF_CMD: isr_info.data = (void *)k_current_get(); break; case EXEC_CTX_TYPE_CMD: if (k_is_in_isr()) { isr_info.value = K_ISR; break; } if (_current->base.prio < 0) { isr_info.value = K_COOP_THREAD; break; } isr_info.value = K_PREEMPT_THREAD; break; default: isr_info.error = UNKNOWN_COMMAND; break; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Selects the data transfer direction in bidirectional mode for the specified SPI. */
void SPI_BiDirectionalLineConfig(SPI_TypeDef *SPIx, uint16_t SPI_Direction)
/* Selects the data transfer direction in bidirectional mode for the specified SPI. */ void SPI_BiDirectionalLineConfig(SPI_TypeDef *SPIx, uint16_t SPI_Direction)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_DIRECTION(SPI_Direction)); if (SPI_Direction == SPI_Direction_Tx) { SPIx->CR1 |= SPI_Direction_Tx; } else { SPIx->CR1 &= SPI_Direction_Rx; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* mark_ate: Mark the ate as either free or inuse. */
static void mark_ate(struct ate_resource *ate_resource, int start, int number, u64 value)
/* mark_ate: Mark the ate as either free or inuse. */ static void mark_ate(struct ate_resource *ate_resource, int start, int number, u64 value)
{ u64 *ate = ate_resource->ate; int index; int length = 0; for (index = start; length < number; index++, length++) ate[index] = value; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retire a per-inode cookie, destroying the data attached to it. */
void nfs_fscache_zap_inode_cookie(struct inode *inode)
/* Retire a per-inode cookie, destroying the data attached to it. */ void nfs_fscache_zap_inode_cookie(struct inode *inode)
{ struct nfs_inode *nfsi = NFS_I(inode); dfprintk(FSCACHE, "NFS: zapping cookie (0x%p/0x%p)\n", nfsi, nfsi->fscache); fscache_relinquish_cookie(nfsi->fscache, 1); nfsi->fscache = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* If ImageHandle is NULL, then ASSERT (); If failed to locate a EFI_LOADED_IMAGE_PROTOCOL on ImageHandle, then ASSERT (); */
EFI_HANDLE InternalImageHandleToFvHandle(EFI_HANDLE ImageHandle)
/* If ImageHandle is NULL, then ASSERT (); If failed to locate a EFI_LOADED_IMAGE_PROTOCOL on ImageHandle, then ASSERT (); */ EFI_HANDLE InternalImageHandleToFvHandle(EFI_HANDLE ImageHandle)
{ EFI_STATUS Status; EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; ASSERT (ImageHandle != NULL); Status = gBS->HandleProtocol ( ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImage ); ASSERT_EFI_ERROR (Status); return LoadedImage->DeviceHandle; }
tianocore/edk2
C++
Other
4,240
/* memstick_add_host - start request processing on memstick host @host - host to use */
int memstick_add_host(struct memstick_host *host)
/* memstick_add_host - start request processing on memstick host @host - host to use */ int memstick_add_host(struct memstick_host *host)
{ int rc; if (!idr_pre_get(&memstick_host_idr, GFP_KERNEL)) return -ENOMEM; spin_lock(&memstick_host_lock); rc = idr_get_new(&memstick_host_idr, host, &host->id); spin_unlock(&memstick_host_lock); if (rc) return rc; dev_set_name(&host->dev, "memstick%u", host->id); rc = device_add(&host->dev); if (rc) { spin_lock(&memstick_host_lock); idr_remove(&memstick_host_idr, host->id); spin_unlock(&memstick_host_lock); return rc; } host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); memstick_detect_change(host); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
void isl_seq_cpy_to_pip(Entier *dst, isl_int *src, unsigned len)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ void isl_seq_cpy_to_pip(Entier *dst, isl_int *src, unsigned len)
{ int i; for (i = 0; i < len; ++i) entier_assign(dst[i], src[i]); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function provides a minimum delay based on Tick counter. */
static void LSM6DSO_Delay(LSM6DSO_Object_t *pObj, uint32_t msDelay)
/* This function provides a minimum delay based on Tick counter. */ static void LSM6DSO_Delay(LSM6DSO_Object_t *pObj, uint32_t msDelay)
{ uint32_t tickstart = pObj->IO.GetTick(); while((pObj->IO.GetTick() - tickstart) < msDelay) { } }
eclipse-threadx/getting-started
C++
Other
310
/* Description: This function will wake up pipe writers if necessary. It should be called after a loop containing splice_from_pipe_next() and splice_from_pipe_feed(). */
void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc *sd)
/* Description: This function will wake up pipe writers if necessary. It should be called after a loop containing splice_from_pipe_next() and splice_from_pipe_feed(). */ void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc *sd)
{ if (sd->need_wakeup) wakeup_pipe_writers(pipe); }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); if (NULL == handle->rxRingBuffer) { LPUART_DisableInterrupts(base, (uint32_t)kLPUART_RxDataRegFullInterruptEnable | (uint32_t)kLPUART_RxOverrunInterruptEnable | (uint32_t)kLPUART_IdleLineInterruptEnable); } handle->rxDataSize = 0U; handle->rxState = (uint8_t)kLPUART_RxIdle; }
eclipse-threadx/getting-started
C++
Other
310
/* Reads data from the specified Data Backup Register. */
u16 UTIL_ReadBackupRegister(u16 BKP_DR)
/* Reads data from the specified Data Backup Register. */ u16 UTIL_ReadBackupRegister(u16 BKP_DR)
{ return (*(vu16 *)( BKP_BASE + 4 * BKP_DR ) ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* handle a control-IN request, the end0 buffer contains the current request that is supposed to be a standard control request. Assumes the fifo to be at least 2 bytes long. */
static int service_in_request(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
/* handle a control-IN request, the end0 buffer contains the current request that is supposed to be a standard control request. Assumes the fifo to be at least 2 bytes long. */ static int service_in_request(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
{ int handled = 0; if ((ctrlrequest->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrlrequest->bRequest) { case USB_REQ_GET_STATUS: handled = service_tx_status_request(musb, ctrlrequest); break; default: break; } } return handled; }
robutest/uclinux
C++
GPL-2.0
60
/* This function disables USB HS PHY PLL clock. */
void CLOCK_DisableUsbhs1PhyPllClock(void)
/* This function disables USB HS PHY PLL clock. */ void CLOCK_DisableUsbhs1PhyPllClock(void)
{ USBPHY2->PLL_SIC_CLR = (USBPHY_PLL_SIC_PLL_EN_USB_CLKS_MASK); USBPHY2->CTRL |= USBPHY_CTRL_CLKGATE_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */
static int gt64xxx_pci0_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */ static int gt64xxx_pci0_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{ u32 data = 0; if (gt64xxx_pci0_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) return PCIBIOS_DEVICE_NOT_FOUND; if (size == 1) *val = (data >> ((where & 3) << 3)) & 0xff; else if (size == 2) *val = (data >> ((where & 3) << 3)) & 0xffff; else *val = data; return PCIBIOS_SUCCESSFUL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { USB_USBTask(); uint8_t ReceivedData[VENDOR_IO_EPSIZE]; memset(ReceivedData, 0x00, sizeof(ReceivedData)); Endpoint_SelectEndpoint(VENDOR_OUT_EPADDR); if (Endpoint_IsOUTReceived()) { Endpoint_Read_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL); Endpoint_ClearOUT(); Endpoint_SelectEndpoint(VENDOR_IN_EPADDR); Endpoint_Write_Stream_LE(ReceivedData, VENDOR_IO_EPSIZE, NULL); Endpoint_ClearIN(); } } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Enables or disables the specified I2C DMA requests. */
void I2C_DMACmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the specified I2C DMA requests. */ void I2C_DMACmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { if(I2C_DMA_DIR==TDMAE_SET) { I2Cx->IC_DMA_CR |= TDMAE_SET; } else if(I2C_DMA_DIR==RDMAE_SET) { I2Cx->IC_DMA_CR |= RDMAE_SET; } } else { I2Cx->IC_DMA_CR &= DMA_CR_TDMAE_RDMAE_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Determine if src contains one or more non-zero bytes. */
uint8_t mem_nz(uint8_t *src, uint16_t len)
/* Determine if src contains one or more non-zero bytes. */ uint8_t mem_nz(uint8_t *src, uint16_t len)
{ while (len--) { if (*src++) { return 1; } } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* We need to use a sequential number; if we use the pointer or the hash of the pointer, it can repeat over sequential transfers and then it will confuse the HWA....wonder why in hell they put a 32 bit handle in there then. */
static void wa_xfer_id_init(struct wa_xfer *xfer)
/* We need to use a sequential number; if we use the pointer or the hash of the pointer, it can repeat over sequential transfers and then it will confuse the HWA....wonder why in hell they put a 32 bit handle in there then. */ static void wa_xfer_id_init(struct wa_xfer *xfer)
{ xfer->id = atomic_add_return(1, &xfer->wa->xfer_id_count); }
robutest/uclinux
C++
GPL-2.0
60
/* See "mss_ace.h" for details of how to use this function. */
void ACE_clear_comp_fall_irq(comparator_id_t comp_id)
/* See "mss_ace.h" for details of how to use this function. */ void ACE_clear_comp_fall_irq(comparator_id_t comp_id)
{ ASSERT( comp_id < NB_OF_COMPARATORS ); ACE->COMP_IRQ_CLR |= (FIRST_FALL_IRQ_MASK << (uint32_t)comp_id); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Requests the target to upload the specified range from memory and store its contents in the specified data buffer. */
LIBOPENBLT_EXPORT uint32_t BltSessionReadData(uint32_t address, uint32_t len, uint8_t *data)
/* Requests the target to upload the specified range from memory and store its contents in the specified data buffer. */ LIBOPENBLT_EXPORT uint32_t BltSessionReadData(uint32_t address, uint32_t len, uint8_t *data)
{ uint32_t result = BLT_RESULT_ERROR_GENERIC; assert(data != NULL); assert(len > 0); if ( (data != NULL) && (len > 0) ) { if (SessionReadData(address, len, data)) { result = BLT_RESULT_OK; } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function returns next sequence number to use, which is just the current global sequence counter value. It also increases the global sequence counter. */
unsigned long long ubi_next_sqnum(struct ubi_device *ubi)
/* This function returns next sequence number to use, which is just the current global sequence counter value. It also increases the global sequence counter. */ unsigned long long ubi_next_sqnum(struct ubi_device *ubi)
{ unsigned long long sqnum; spin_lock(&ubi->ltree_lock); sqnum = ubi->global_sqnum++; spin_unlock(&ubi->ltree_lock); return sqnum; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function latches and reads the internal RTC running at 32.768 Khz */
unsigned long long PRCMSlowClkCtrGet(void)
/* This function latches and reads the internal RTC running at 32.768 Khz */ unsigned long long PRCMSlowClkCtrGet(void)
{ unsigned long long ullRTCVal; MAP_PRCMHIBRegWrite(HIB3P3_BASE+HIB3P3_O_MEM_HIB_RTC_TIMER_READ, 0x1); ullRTCVal = MAP_PRCMHIBRegRead(HIB3P3_BASE + HIB3P3_O_MEM_HIB_RTC_TIMER_MSW); ullRTCVal = ullRTCVal << 32; ullRTCVal |= MAP_PRCMHIBRegRead(HIB3P3_BASE+HIB3P3_O_MEM_HIB_RTC_TIMER_LSW); return ullRTCVal; }
micropython/micropython
C++
Other
18,334
/* The SETUP packet can be kept in on-chip memory or in system memory. */
static bool cdns3_check_new_setup(struct cdns3_device *priv_dev)
/* The SETUP packet can be kept in on-chip memory or in system memory. */ static bool cdns3_check_new_setup(struct cdns3_device *priv_dev)
{ u32 ep_sts_reg; cdns3_select_ep(priv_dev, 0 | USB_DIR_OUT); ep_sts_reg = readl(&priv_dev->regs->ep_sts); return !!(ep_sts_reg & (EP_STS_SETUP | EP_STS_STPWAIT)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* mmap2() is like mmap() except that the offset is expressed in units of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces of) files that are larger than the address space of the CPU. */
asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
/* mmap2() is like mmap() except that the offset is expressed in units of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces of) files that are larger than the address space of the CPU. */ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
{ addr = sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); if (!IS_ERR((void *) addr)) force_successful_syscall_return(); return addr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int SDL_SendClipboardUpdate(void)
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ int SDL_SendClipboardUpdate(void)
{ int posted; posted = 0; if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CLIPBOARDUPDATE; posted = (SDL_PushEvent(&event) > 0); } return (posted); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells */
static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
/* open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells */ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
{ struct afs_cell *cell; struct seq_file *m; int ret; cell = PDE(inode)->data; if (!cell) return -ENOENT; ret = seq_open(file, &afs_proc_cell_volumes_ops); if (ret < 0) return ret; m = file->private_data; m->private = cell; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Peek the status register, lock not held by caller */
static u8 pmz_peek_status(struct uart_pmac_port *uap)
/* Peek the status register, lock not held by caller */ static u8 pmz_peek_status(struct uart_pmac_port *uap)
{ unsigned long flags; u8 status; spin_lock_irqsave(&uap->port.lock, flags); status = read_zsreg(uap, R0); spin_unlock_irqrestore(&uap->port.lock, flags); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified FLASH flag is set or not. */
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
/* Checks whether the specified FLASH flag is set or not. */ FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)); if((FLASH->SR & FLASH_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call PnP BIOS with function 0x40, "get isa pnp configuration structure" */
static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
/* Call PnP BIOS with function 0x40, "get isa pnp configuration structure" */ static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
{ u16 status; if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, data, sizeof(struct pnp_isa_config_struc), NULL, 0); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset endpoint state. Resets the internal logic state for a given endpoint. */
static void ep_ctx_reset(struct nrf_usbd_ep_ctx *ep_ctx)
/* Reset endpoint state. Resets the internal logic state for a given endpoint. */ static void ep_ctx_reset(struct nrf_usbd_ep_ctx *ep_ctx)
{ ep_ctx->buf.data = ep_ctx->buf.block.data; ep_ctx->buf.curr = ep_ctx->buf.data; ep_ctx->buf.len = 0U; if (ep_ctx->write_in_progress) { nrf_usbd_common_ep_abort(ep_addr_to_nrfx(ep_ctx->cfg.addr)); } ep_ctx->read_complete = true; ep_ctx->read_pending = false; ep_ctx->write_in_progress = false; ep_ctx->trans_zlp = false; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function validates the TRBE Interrupt in the GICC. */
STATIC VOID EFIAPI ValidateTrbeInterrupt(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates the TRBE Interrupt in the GICC. */ STATIC VOID EFIAPI ValidateTrbeInterrupt(IN UINT8 *Ptr, IN VOID *Context)
{ UINT16 TrbeInterrupt; TrbeInterrupt = *(UINT16 *)Ptr; if (TrbeInterrupt == 0) { return; } if ((TrbeInterrupt < ARM_PPI_ID_MIN) || ((TrbeInterrupt > ARM_PPI_ID_MAX) && (TrbeInterrupt < ARM_PPI_ID_EXTENDED_MIN)) || (TrbeInterrupt > ARM_PPI_ID_EXTENDED_MAX)) { IncrementErrorCount (); Print ( L"\nERROR: TRBE Interrupt ID of %d is not in the allowed PPI ID " L"ranges of %d-%d or %d-%d (for GICv3.1 or later).", TrbeInterrupt, ARM_PPI_ID_MIN, ARM_PPI_ID_MAX, ARM_PPI_ID_EXTENDED_MIN, ARM_PPI_ID_EXTENDED_MAX ); } }
tianocore/edk2
C++
Other
4,240
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_master_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */
void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_master_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */ void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
{ assert(handle != NULL); assert(edmaRxRegToRxDataHandle != NULL); assert(edmaTxDataToTxRegHandle != NULL); (void)memset(handle, 0, sizeof(*handle)); uint32_t instance = LPSPI_GetInstance(base); s_lpspiMasterEdmaPrivateHandle[instance].base = base; s_lpspiMasterEdmaPrivateHandle[instance].handle = handle; handle->callback = callback; handle->userData = userData; handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle; handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle; }
eclipse-threadx/getting-started
C++
Other
310
/* If the IO is asynchronous (i.e. it has notify.fn), you must either unplug the queue with blk_unplug() some time later or set the BIO_RW_SYNC bit in io_req->bi_rw. If you fail to do one of these, the IO will be submitted to the disk after q->unplug_delay, which defaults to 3ms in blk-settings.c. */
int dm_io(struct dm_io_request *io_req, unsigned num_regions, struct dm_io_region *where, unsigned long *sync_error_bits)
/* If the IO is asynchronous (i.e. it has notify.fn), you must either unplug the queue with blk_unplug() some time later or set the BIO_RW_SYNC bit in io_req->bi_rw. If you fail to do one of these, the IO will be submitted to the disk after q->unplug_delay, which defaults to 3ms in blk-settings.c. */ int dm_io(struct dm_io_request *io_req, unsigned num_regions, struct dm_io_region *where, unsigned long *sync_error_bits)
{ int r; struct dpages dp; r = dp_init(io_req, &dp); if (r) return r; if (!io_req->notify.fn) return sync_io(io_req->client, num_regions, where, io_req->bi_rw, &dp, sync_error_bits); return async_io(io_req->client, num_regions, where, io_req->bi_rw, &dp, io_req->notify.fn, io_req->notify.context); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the TWHIS master to be used with the AT30TSE75X device. */
void at30tse_init(void)
/* Configures the TWHIS master to be used with the AT30TSE75X device. */ void at30tse_init(void)
{ twihs_options_t opt; pmc_enable_periph_clk(BOARD_AT30TSE_ID_TWIHS); opt.master_clk = sysclk_get_cpu_hz(); opt.speed = TWIHS_CLK; if (twihs_master_init(BOARD_AT30TSE_TWIHS, &opt) != TWIHS_SUCCESS) { while (1) { } } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Fills each SPI_InitStruct member with its default value. */
void SPI_StructInit(SPI_InitTypeDef *SPI_InitStruct)
/* Fills each SPI_InitStruct member with its default value. */ void SPI_StructInit(SPI_InitTypeDef *SPI_InitStruct)
{ SPI_InitStruct->SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStruct->SPI_Mode = SPI_Mode_Slave; SPI_InitStruct->SPI_DataSize = SPI_DataSize_8b; SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low; SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStruct->SPI_NSS = SPI_NSS_Hard; SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStruct->SPI_CRCPolynomial = 7; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function gets the video mode currently reported by the detector in the VTC core. If the video mode is unknown or not recognized, then 0 will be returned. */
u16 XVtc_GetDetectorVideoMode(XVtc *InstancePtr)
/* This function gets the video mode currently reported by the detector in the VTC core. If the video mode is unknown or not recognized, then 0 will be returned. */ u16 XVtc_GetDetectorVideoMode(XVtc *InstancePtr)
{ u16 mode; XVtc_Timing Timing; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); XVtc_GetDetectorTiming(InstancePtr, &Timing); mode = XVtc_ConvTiming2VideoMode(InstancePtr, &Timing); return mode; }
ua1arn/hftrx
C++
null
69
/* Unregisters callback for the specified callback type. When called, the currently registered callback for the given callback type will be removed. */
enum status_code rtc_calendar_unregister_callback(struct rtc_module *const module, enum rtc_calendar_callback callback_type)
/* Unregisters callback for the specified callback type. When called, the currently registered callback for the given callback type will be removed. */ enum status_code rtc_calendar_unregister_callback(struct rtc_module *const module, enum rtc_calendar_callback callback_type)
{ enum status_code status = STATUS_OK; if (callback_type == RTC_CALENDAR_CALLBACK_OVERFLOW) { status = STATUS_OK; } else if (callback_type > RTC_NUM_OF_ALARMS) { status = STATUS_ERR_INVALID_ARG; } if (status == STATUS_OK) { module->callbacks[callback_type] = NULL; module->registered_callback &= ~(1 << callback_type); } return status; }
memfault/zero-to-main
C++
null
200
/* The functions for inserting/removing us as a module. */
static int __init zhenhua_init(void)
/* The functions for inserting/removing us as a module. */ static int __init zhenhua_init(void)
{ return serio_register_driver(&zhenhua_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt8ToUint8(IN INT8 Operand, OUT UINT8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt8ToUint8(IN INT8 Operand, OUT UINT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand >= 0) { *Result = (UINT8)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* CAN MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
/* CAN MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
{ CANx_FORCE_RESET(); CANx_RELEASE_RESET(); HAL_GPIO_DeInit(CANx_TX_GPIO_PORT, CANx_TX_PIN); HAL_GPIO_DeInit(CANx_RX_GPIO_PORT, CANx_RX_PIN); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocateRuntimePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ VOID* EFIAPI ReallocateRuntimePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
{ return ReallocatePool (OldSize, NewSize, OldBuffer); }
tianocore/edk2
C++
Other
4,240
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". */
void GPC_CM_RequestStandbyMode(GPC_CPU_MODE_CTRL_Type *base, const gpc_cpu_mode_t mode)
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". */ void GPC_CM_RequestStandbyMode(GPC_CPU_MODE_CTRL_Type *base, const gpc_cpu_mode_t mode)
{ assert(mode != kGPC_RunMode); switch (mode) { case kGPC_WaitMode: base->CM_STBY_CTRL |= GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_WAIT_MASK; break; case kGPC_StopMode: base->CM_STBY_CTRL |= GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_STOP_MASK; break; case kGPC_SuspendMode: base->CM_STBY_CTRL |= GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_SUSPEND_MASK; break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calls an mtu-exchange proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_mtu_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, uint16_t mtu)
/* Calls an mtu-exchange proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ static int ble_gattc_mtu_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, uint16_t mtu)
{ int rc; BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task()); ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0 && status != BLE_HS_EDONE) { STATS_INC(ble_gattc_stats, mtu_fail); } if (proc->mtu.cb == NULL) { rc = 0; } else { rc = proc->mtu.cb(proc->conn_handle, ble_gattc_error(status, att_handle), mtu, proc->mtu.cb_arg); } return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI PciExpressBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI PciExpressBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
{ if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) { return (UINT32)-1; } return MmioBitFieldAnd32 ( GetPciExpressAddress (Address), StartBit, EndBit, AndData ); }
tianocore/edk2
C++
Other
4,240
/* Suspend pages are alocated before the atomic copy is made, so we need to release them after the resume. */
void swsusp_free(void)
/* Suspend pages are alocated before the atomic copy is made, so we need to release them after the resume. */ void swsusp_free(void)
{ struct zone *zone; unsigned long pfn, max_zone_pfn; for_each_populated_zone(zone) { max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages; for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) if (pfn_valid(pfn)) { struct page *page = pfn_to_page(pfn); if (swsusp_page_is_forbidden(page) && swsusp_page_is_free(page)) { swsusp_unset_page_forbidden(page); swsusp_unset_page_free(page); __free_page(page); } } } nr_copy_pages = 0; nr_meta_pages = 0; restore_pblist = NULL; buffer = NULL; alloc_normal = 0; alloc_highmem = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is the same as 'ubifs_change_one_lp()' but @dirty is added to current dirty space, not substitutes it. */
int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, int flags_set, int flags_clean)
/* This function is the same as 'ubifs_change_one_lp()' but @dirty is added to current dirty space, not substitutes it. */ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, int flags_set, int flags_clean)
{ int err = 0, flags; const struct ubifs_lprops *lp; ubifs_get_lprops(c); lp = ubifs_lpt_lookup_dirty(c, lnum); if (IS_ERR(lp)) { err = PTR_ERR(lp); goto out; } flags = (lp->flags | flags_set) & ~flags_clean; lp = ubifs_change_lp(c, lp, free, lp->dirty + dirty, flags, 0); if (IS_ERR(lp)) err = PTR_ERR(lp); out: ubifs_release_lprops(c); if (err) ubifs_err(c, "cannot update properties of LEB %d, error %d", lnum, err); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Erase a Sector of FLASH This performs all operations necessary to erase a sector in FLASH memory. The page should be checked to ensure that it was properly erased. A sector must first be fully erased before attempting to program it. See the reference manual or the FLASH programming manual for details. */
void flash_erase_sector(uint8_t sector)
/* Erase a Sector of FLASH This performs all operations necessary to erase a sector in FLASH memory. The page should be checked to ensure that it was properly erased. A sector must first be fully erased before attempting to program it. See the reference manual or the FLASH programming manual for details. */ void flash_erase_sector(uint8_t sector)
{ flash_wait_for_last_operation(); FLASH_CR &= ~(FLASH_CR_PNB_MASK << FLASH_CR_PNB_SHIFT); FLASH_CR |= (sector & FLASH_CR_PNB_MASK) << FLASH_CR_PNB_SHIFT; FLASH_CR |= FLASH_CR_PER; FLASH_CR |= FLASH_CR_START; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PER; FLASH_CR &= ~(FLASH_CR_PNB_MASK << FLASH_CR_PNB_SHIFT); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Handles an incoming ATT error response for the specified write-reliable-characteristic-value proc. */
static void ble_gattc_write_reliable_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified write-reliable-characteristic-value proc. */ static void ble_gattc_write_reliable_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); ble_gattc_write_reliable_cb(proc, status, att_handle); if (proc->write_reliable.cur_attr < proc->write_reliable.num_attrs) { ble_att_clt_tx_exec_write(proc->conn_handle, BLE_ATT_EXEC_WRITE_F_CANCEL); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enables or disables the specified DMAy Channelx interrupts. */
void DMA_ITConfig(DMA_Channel_TypeDef *DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState)
/* Enables or disables the specified DMAy Channelx interrupts. */ void DMA_ITConfig(DMA_Channel_TypeDef *DMAy_Channelx, uint32_t DMA_IT, FunctionalState NewState)
{ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx)); assert_param(IS_DMA_CONFIG_IT(DMA_IT)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DMAy_Channelx->CCR |= DMA_IT; } else { DMAy_Channelx->CCR &= ~DMA_IT; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register address automatically incremented during a multiple byte access with a serial interface.. */
int32_t lps22hh_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Register address automatically incremented during a multiple byte access with a serial interface.. */ int32_t lps22hh_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lps22hh_ctrl_reg2_t reg; int32_t ret; ret = lps22hh_read_reg(ctx, LPS22HH_CTRL_REG2, (uint8_t *) &reg, 1); *val = reg.if_add_inc; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Finalize and output current packet to the output channel. */
static ssize_t packet_output(struct soam_t *self_p)
/* Finalize and output current packet to the output channel. */ static ssize_t packet_output(struct soam_t *self_p)
{ ssize_t size; size_t payload_crc_size; uint16_t crc; size = (self_p->tx.pos + 2); payload_crc_size = (size - 5); self_p->tx.buf_p[2] = self_p->transaction_id; self_p->tx.buf_p[3] = (payload_crc_size >> 8); self_p->tx.buf_p[4] = payload_crc_size; crc = crc_ccitt(0xffff, &self_p->tx.buf_p[0], size - 2); self_p->tx.buf_p[size - 2] = (crc >> 8); self_p->tx.buf_p[size - 1] = crc; if (chan_write(self_p->tx.chout_p, &self_p->tx.buf_p[0], size) != size) { return (-1); } return (size - 7); }
eerimoq/simba
C++
Other
337
/* \classmethod mapper() Get or set the pin mapper function. */
STATIC mp_obj_t pin_mapper(mp_uint_t n_args, const mp_obj_t *args)
/* \classmethod mapper() Get or set the pin mapper function. */ STATIC mp_obj_t pin_mapper(mp_uint_t n_args, const mp_obj_t *args)
{ MP_STATE_PORT(pin_class_mapper) = args[1]; return mp_const_none; } return MP_STATE_PORT(pin_class_mapper); }
labapart/polymcu
C++
null
201
/* param base SAI base pointer param type Reset type, FIFO reset or software reset */
void SAI_TxSoftwareReset(I2S_Type *base, sai_reset_type_t type)
/* param base SAI base pointer param type Reset type, FIFO reset or software reset */ void SAI_TxSoftwareReset(I2S_Type *base, sai_reset_type_t type)
{ base->TCSR |= (uint32_t)type; base->TCSR &= ~I2S_TCSR_SR_MASK; }
eclipse-threadx/getting-started
C++
Other
310
/* Convenience function to journal all components in a path. */
int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, handle_t *handle, struct ocfs2_path *path)
/* Convenience function to journal all components in a path. */ int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, handle_t *handle, struct ocfs2_path *path)
{ int i, ret = 0; if (!path) goto out; for(i = 0; i < path_num_items(path); i++) { ret = ocfs2_path_bh_journal_access(handle, ci, path, i); if (ret < 0) { mlog_errno(ret); goto out; } } out: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will fetch but retaining data in the data queue. */
rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size)
/* This function will fetch but retaining data in the data queue. */ rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size)
{ rt_base_t level; RT_ASSERT(queue != RT_NULL); RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); if (queue->is_empty) { return -RT_EEMPTY; } level = rt_spin_lock_irqsave(&(queue->spinlock)); *data_ptr = queue->queue[queue->get_index].data_ptr; *size = queue->queue[queue->get_index].data_size; rt_spin_unlock_irqrestore(&(queue->spinlock), level); return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup the channel. As the SAM0 has one fixed width channel, this validates the input and does nothing else. */
static int dac_sam0_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg)
/* Setup the channel. As the SAM0 has one fixed width channel, this validates the input and does nothing else. */ static int dac_sam0_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg)
{ if (channel_cfg->channel_id != 0) { return -EINVAL; } if (channel_cfg->resolution != 10) { return -ENOTSUP; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns: a #gssize containing the number of bytes written to the stream. */
gssize g_output_stream_write_bytes_finish(GOutputStream *stream, GAsyncResult *result, GError **error)
/* Returns: a #gssize containing the number of bytes written to the stream. */ gssize g_output_stream_write_bytes_finish(GOutputStream *stream, GAsyncResult *result, GError **error)
{ g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), -1); g_return_val_if_fail (g_task_is_valid (result, stream), -1); return g_task_propagate_int (G_TASK (result), error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* provide access to fpga gpios and controls (for I2C bitbang) (these may look all too simple but make iocon.h much more readable) */
void fpga_gpio_set(uint bus, int pin)
/* provide access to fpga gpios and controls (for I2C bitbang) (these may look all too simple but make iocon.h much more readable) */ void fpga_gpio_set(uint bus, int pin)
{ FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, gpio.set, pin); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets the period of the SysTick counter. This function returns the rate at which the SysTick counter wraps; this equates to the number of processor clocks between interrupts. */
unsigned long xSysTickPeriodGet(void)
/* Gets the period of the SysTick counter. This function returns the rate at which the SysTick counter wraps; this equates to the number of processor clocks between interrupts. */ unsigned long xSysTickPeriodGet(void)
{ return(xHWREG(NVIC_ST_RELOAD) + 1); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Device enumeration step 10 End of Set address request. Lets USB line in IDLE state during 20ms. */
static void uhc_enumeration_step10(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
/* Device enumeration step 10 End of Set address request. Lets USB line in IDLE state during 20ms. */ static void uhc_enumeration_step10(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
{ UNUSED(add); UNUSED(payload_trans); if (status != UHD_TRANS_NOERROR) { uhc_enumeration_error((status == UHD_TRANS_DISCONNECT) ? UHC_ENUM_DISCONNECT : UHC_ENUM_FAIL); return; } uhc_enable_timeout_callback(20, uhc_enumeration_step11); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Forces or releases Low Speed APB (APB1) peripheral reset. */
void RCC_EnableAPB1PeriphReset(uint32_t RCC_APB1Periph, FunctionalState Cmd)
/* Forces or releases Low Speed APB (APB1) peripheral reset. */ void RCC_EnableAPB1PeriphReset(uint32_t RCC_APB1Periph, FunctionalState Cmd)
{ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->APB1PRST |= RCC_APB1Periph; } else { RCC->APB1PRST &= ~RCC_APB1Periph; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @abstract Query the vectory path count of an EGO object. If the given object is an evo/ebo, the count is 0. */
uint32_t ElmGetVectorCount(ElmHandle handle)
/* @abstract Query the vectory path count of an EGO object. If the given object is an evo/ebo, the count is 0. */ uint32_t ElmGetVectorCount(ElmHandle handle)
{ el_Obj_Group *ego = (el_Obj_Group*) get_object(handle); if (ego->object.type != ELM_OBJECT_TYPE_EGO) { return 0; } else { return ego->group.count; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* s e t u p A l l U p p e r */
returnValue Bounds_setupAllUpper(Bounds *_THIS)
/* s e t u p A l l U p p e r */ returnValue Bounds_setupAllUpper(Bounds *_THIS)
{ return Bounds_setupAll( _THIS,ST_UPPER ); }
DanielMartensson/EmbeddedLapack
C++
MIT License
129