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
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED5); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Sets the LPLU state according to the active flag. For PCH, if OEM write bit are disabled in the NVM, writing the LPLU bits in the MAC will not set the phy speed. This function will manually set the LPLU bit and restart auto-neg as hw would do. D3 and D0 LPLU will call the same function since it configures the same bit. */
static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
/* Sets the LPLU state according to the active flag. For PCH, if OEM write bit are disabled in the NVM, writing the LPLU bits in the MAC will not set the phy speed. This function will manually set the LPLU bit and restart auto-neg as hw would do. D3 and D0 LPLU will call the same function since it configures the same bit. */ static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active)
{ s32 ret_val = 0; u16 oem_reg; ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg); if (ret_val) goto out; if (active) oem_reg |= HV_OEM_BITS_LPLU; else oem_reg &= ~HV_OEM_BITS_LPLU; oem_reg |= HV_OEM_BITS_RESTART_AN; ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables and configures the edge detection for the wakeup pin. */
void SysCtlWakeupFilterConfig(unsigned long ulFilterIndex, unsigned long ulPinIndex, unsigned long ulEdge)
/* Enables and configures the edge detection for the wakeup pin. */ void SysCtlWakeupFilterConfig(unsigned long ulFilterIndex, unsigned long ulPinIndex, unsigned long ulEdge)
{ xASSERT((ulFilterIndex >= 1 && ulFilterIndex <= 2)); xASSERT((ulPinIndex >= 0 && ulPinIndex <= 15)); xASSERT((ulEdge == SYSCTL_WAKEUP_FILTER_DIS) || (ulEdge == SYSCTL_WAKEUP_FILTER_ANY) || (ulEdge == SYSCTL_WAKEUP_FILTER_RISING) || (ulEdge == SYSCTL_WAKEUP_FILTER_FALLING)); xHWREGB(LLWU_FILT1+ulFilterIndex/2) &= ~LLWU_FILT1_FILTE_M; xHWREGB(LLWU_FILT1+ulFilterIndex/2) |= ulEdge; xHWREGB(LLWU_FILT1+ulFilterIndex/2) &= ~LLWU_FILT1_FILTSEL_M; xHWREGB(LLWU_FILT1+ulFilterIndex/2) |= ulPinIndex; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Checks whether the specified UART interrupt has occurred or not. */
ITStatus UART_GetITStatus(UART_TypeDef *uart, u16 it)
/* Checks whether the specified UART interrupt has occurred or not. */ ITStatus UART_GetITStatus(UART_TypeDef *uart, u16 it)
{ return (uart->ISR & it) ? SET : RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The values returned from this function can be passed to the */
uint32_t SysCtlVoltageEventStatus(void)
/* The values returned from this function can be passed to the */ uint32_t SysCtlVoltageEventStatus(void)
{ return (HWREG(SYSCTL_PWRTC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Does intersection of PAT memory type and MTRR memory type and returns the resulting memory type as PAT understands it. (Type in pat and mtrr will not have same value) The intersection is based on "Effective Memory Type" tables in IA-32 SDM vol 3a */
static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
/* Does intersection of PAT memory type and MTRR memory type and returns the resulting memory type as PAT understands it. (Type in pat and mtrr will not have same value) The intersection is based on "Effective Memory Type" tables in IA-32 SDM vol 3a */ static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
{ if (req_type == _PAGE_CACHE_WB) { u8 mtrr_type; mtrr_type = mtrr_type_lookup(start, end); if (mtrr_type != MTRR_TYPE_WRBACK) return _PAGE_CACHE_UC_MINUS; return _PAGE_CACHE_WB; } return req_type; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the reservation window is outside the goal allocation group, return 0; grp_goal (given goal block) could be -1, which means no specific goal block. In this case, always return 1. If the goal block is within the reservation window, return 1; otherwise, return 0; */
static int goal_in_my_reservation(struct ext2_reserve_window *rsv, ext2_grpblk_t grp_goal, unsigned int group, struct super_block *sb)
/* If the reservation window is outside the goal allocation group, return 0; grp_goal (given goal block) could be -1, which means no specific goal block. In this case, always return 1. If the goal block is within the reservation window, return 1; otherwise, return 0; */ static int goal_in_my_reservation(struct ext2_reserve_window *rsv, ext2_grpblk_t grp_goal, unsigned int group, struct super_block *sb)
{ ext2_fsblk_t group_first_block, group_last_block; group_first_block = ext2_group_first_block_no(sb, group); group_last_block = group_first_block + EXT2_BLOCKS_PER_GROUP(sb) - 1; if ((rsv->_rsv_start > group_last_block) || (rsv->_rsv_end < group_first_block)) return 0; if ((grp_goal >= 0) && ((grp_goal + group_first_block < rsv->_rsv_start) || (grp_goal + group_first_block > rsv->_rsv_end))) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* s3c_hsotg_disable_gsint - disable one or more of the general interrupt @hsotg: The device state @ints: A bitmask of the interrupts to enable */
static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
/* s3c_hsotg_disable_gsint - disable one or more of the general interrupt @hsotg: The device state @ints: A bitmask of the interrupts to enable */ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
{ u32 gsintmsk = readl(hsotg->regs + GINTMSK); u32 new_gsintmsk; new_gsintmsk = gsintmsk & ~ints; if (new_gsintmsk != gsintmsk) writel(new_gsintmsk, hsotg->regs + GINTMSK); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
/* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */ null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{ register JSAMPROW inptr, outptr; register JDIMENSION count; register int num_components = cinfo->num_components; JDIMENSION num_cols = cinfo->output_width; int ci; while (--num_rows >= 0) { for (ci = 0; ci < num_components; ci++) { inptr = input_buf[ci][input_row]; outptr = output_buf[0] + ci; for (count = num_cols; count > 0; count--) { *outptr = *inptr++; outptr += num_components; } } input_row++; output_buf++; } }
nanoframework/nf-interpreter
C++
MIT License
293
/* Puts the processor into deep-sleep mode. This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. */
void SysCtlDeepSleep(void)
/* Puts the processor into deep-sleep mode. This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. */ void SysCtlDeepSleep(void)
{ xHWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP; SysCtlPowerDownEnable(1); SysCtlPowerDownWaitCPUSet(1); xCPUwfi(); xHWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); SysCtlPowerDownEnable(0); SysCtlPowerDownWaitCPUSet(0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enable latched interrupts. Any MPU register will clear the interrupt. */
int mpu_set_int_latched(unsigned char enable)
/* Enable latched interrupts. Any MPU register will clear the interrupt. */ int mpu_set_int_latched(unsigned char enable)
{ unsigned char tmp; if (st.chip_cfg.latched_int == enable) return 0; if (enable) tmp = BIT_LATCH_EN | BIT_ANY_RD_CLR; else tmp = 0; if (st.chip_cfg.bypass_mode) tmp |= BIT_BYPASS_EN; if (st.chip_cfg.active_low_int) tmp |= BIT_ACTL; if (i2c_write(st.hw->addr, st.reg->int_pin_cfg, 1, &tmp)) return -1; st.chip_cfg.latched_int = enable; return 0; }
Luos-io/luos_engine
C++
MIT License
496
/* Return the PPP unit number to which a channel is connected. */
int ppp_unit_number(struct ppp_channel *chan)
/* Return the PPP unit number to which a channel is connected. */ int ppp_unit_number(struct ppp_channel *chan)
{ struct channel *pch = chan->ppp; int unit = -1; if (pch) { read_lock_bh(&pch->upl); if (pch->ppp) unit = pch->ppp->file.index; read_unlock_bh(&pch->upl); } return unit; }
robutest/uclinux
C++
GPL-2.0
60
/* Remove an SCB from the on chip list of disconnected transactions. This is empty/unused if we are not performing SCB paging. */
static u_int ahc_rem_scb_from_disc_list(struct ahc_softc *ahc, u_int prev, u_int scbptr)
/* Remove an SCB from the on chip list of disconnected transactions. This is empty/unused if we are not performing SCB paging. */ static u_int ahc_rem_scb_from_disc_list(struct ahc_softc *ahc, u_int prev, u_int scbptr)
{ u_int next; ahc_outb(ahc, SCBPTR, scbptr); next = ahc_inb(ahc, SCB_NEXT); ahc_outb(ahc, SCB_CONTROL, 0); ahc_add_curscb_to_free_list(ahc); if (prev != SCB_LIST_NULL) { ahc_outb(ahc, SCBPTR, prev); ahc_outb(ahc, SCB_NEXT, next); } else ahc_outb(ahc, DISCONNECTED_SCBH, next); return (next); }
robutest/uclinux
C++
GPL-2.0
60
/* Notify an object about its style is modified */
void lv_obj_refresh_style(lv_obj_t *obj)
/* Notify an object about its style is modified */ void lv_obj_refresh_style(lv_obj_t *obj)
{ lv_obj_invalidate(obj); obj->signal_func(obj, LV_SIGNAL_STYLE_CHG, NULL); lv_obj_invalidate(obj); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Accessing ->real_parent is not SMP-safe, it could change from under us. However, we can use a stale value of ->real_parent under rcu_read_lock(), see release_task()->call_rcu(delayed_put_task_struct). */
SYSCALL_DEFINE0(getppid)
/* Accessing ->real_parent is not SMP-safe, it could change from under us. However, we can use a stale value of ->real_parent under rcu_read_lock(), see release_task()->call_rcu(delayed_put_task_struct). */ SYSCALL_DEFINE0(getppid)
{ int pid; rcu_read_lock(); pid = task_tgid_vnr(current->real_parent); rcu_read_unlock(); return pid; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ixgbe_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void ixgbe_tx_timeout(struct net_device *netdev)
/* ixgbe_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */ static void ixgbe_tx_timeout(struct net_device *netdev)
{ struct ixgbe_adapter *adapter = netdev_priv(netdev); schedule_work(&adapter->reset_task); }
robutest/uclinux
C++
GPL-2.0
60
/* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void)
/* Deinitializes the EXTI peripheral registers to their default reset values. */ void EXTI_DeInit(void)
{ EXTI->IMR = 0x0F940000; EXTI->EMR = 0x00000000; EXTI->RTSR = 0x00000000; EXTI->FTSR = 0x00000000; EXTI->PR = 0x006BFFFF; }
ajhc/demo-cortex-m3
C++
null
38
/* Enable/disable LEUART receiver and/or transmitter. Notice that this function does not do any configuration. Enabling should normally be done after initialization is done (if not enabled as part of init). */
void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
/* Enable/disable LEUART receiver and/or transmitter. Notice that this function does not do any configuration. Enabling should normally be done after initialization is done (if not enabled as part of init). */ void LEUART_Enable(LEUART_TypeDef *leuart, LEUART_Enable_TypeDef enable)
{ uint32_t tmp; EFM_ASSERT(LEUART_REF_VALID(leuart)); tmp = ~((uint32_t)(enable)); tmp &= (_LEUART_CMD_RXEN_MASK | _LEUART_CMD_TXEN_MASK); tmp <<= 1; tmp |= (uint32_t)(enable); LEUART_Sync(leuart, LEUART_SYNCBUSY_CMD); leuart->CMD = tmp; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */
void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */ void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_LIST6_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR2 |= TIM_CR2_CCPC; } else { TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_CCPC); } }
ajhc/demo-cortex-m3
C++
null
38
/* Setup the hardware prior to using the scheduler. Most of the Cygnal specific initialisation is performed here leaving standard 8052 setup only in the driver code. */
static void prvSetupHardware(void)
/* Setup the hardware prior to using the scheduler. Most of the Cygnal specific initialisation is performed here leaving standard 8052 setup only in the driver code. */ static void prvSetupHardware(void)
{ unsigned char ucOriginalSFRPage; ucOriginalSFRPage = SFRPAGE; SFRPAGE = CONFIG_PAGE; SFRPGCN = mainAUTO_SFR_OFF; WDTCN = mainDISABLE_BYTE_1; WDTCN = mainDISABLE_BYTE_2; P1MDOUT |= mainPORT_1_BIT_6; XBR0 |= mainENABLE_COMS; P0MDOUT |= mainCOMS_LINES_TO_PUSH_PULL; XBR2 = mainENABLE_CROSS_BAR; prvSetupSystemClock(); SFRPAGE = ucOriginalSFRPage; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enable Receive Buffer Full, Transmit Buffer Empty, and Error Interrupts in the NVIC. */
static void r_spi_nvic_config(spi_instance_ctrl_t *p_ctrl)
/* Enable Receive Buffer Full, Transmit Buffer Empty, and Error Interrupts in the NVIC. */ static void r_spi_nvic_config(spi_instance_ctrl_t *p_ctrl)
{ R_BSP_IrqCfgEnable(p_ctrl->p_cfg->txi_irq, p_ctrl->p_cfg->txi_ipl, p_ctrl); R_BSP_IrqCfgEnable(p_ctrl->p_cfg->rxi_irq, p_ctrl->p_cfg->rxi_ipl, p_ctrl); R_BSP_IrqCfgEnable(p_ctrl->p_cfg->eri_irq, p_ctrl->p_cfg->eri_ipl, p_ctrl); R_BSP_IrqCfg(p_ctrl->p_cfg->tei_irq, p_ctrl->p_cfg->tei_ipl, p_ctrl); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: StopAnnouncementMessage Opcode: 0x0123 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_StopAnnouncementMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: StopAnnouncementMessage Opcode: 0x0123 Type: IntraCCM Direction: pbx2pbx VarLength: no */ static void handle_StopAnnouncementMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The device has been disconnected. Remove all current transactions and signal the gadget driver that this has happened. */
static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
/* The device has been disconnected. Remove all current transactions and signal the gadget driver that this has happened. */ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
{ unsigned i; if (!hsotg->connected) return; hsotg->connected = 0; for (i = 0; i < hsotg->num_of_eps; i++) { if (hsotg->eps_in[i]) kill_all_requests(hsotg, hsotg->eps_in[i], -ESHUTDOWN); if (hsotg->eps_out[i]) kill_all_requests(hsotg, hsotg->eps_out[i], -ESHUTDOWN); } call_gadget(hsotg, disconnect); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check for an LLC SNAP packet with a given organization code and protocol type; we check the entire contents of the 802.2 LLC and snap headers, checking for DSAP and SSAP of SNAP and a control field of 0x03 in the LLC header, and for the specified organization code and protocol type in the SNAP header. */
static struct block * gen_snap(compiler_state_t *, bpf_u_int32, bpf_u_int32)
/* Check for an LLC SNAP packet with a given organization code and protocol type; we check the entire contents of the 802.2 LLC and snap headers, checking for DSAP and SSAP of SNAP and a control field of 0x03 in the LLC header, and for the specified organization code and protocol type in the SNAP header. */ static struct block * gen_snap(compiler_state_t *, bpf_u_int32, bpf_u_int32)
{ u_char snapblock[8]; snapblock[0] = LLCSAP_SNAP; snapblock[1] = LLCSAP_SNAP; snapblock[2] = 0x03; snapblock[3] = (u_char)(orgcode >> 16); snapblock[4] = (u_char)(orgcode >> 8); snapblock[5] = (u_char)(orgcode >> 0); snapblock[6] = (u_char)(ptype >> 8); snapblock[7] = (u_char)(ptype >> 0); return gen_bcmp(cstate, OR_LLC, 0, 8, snapblock); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Selects the data transfer direction in bi-directional mode for the specified SPI. */
void SPI_BiDirectionalLineConfig(SPI_TypeDef *spi, SPI_Direction_TypeDef direction)
/* Selects the data transfer direction in bi-directional mode for the specified SPI. */ void SPI_BiDirectionalLineConfig(SPI_TypeDef *spi, SPI_Direction_TypeDef direction)
{ switch (direction) { case SPI_Direction_Rx: SET_BIT(spi->GCR, SPI_GCR_RXEN); break; case SPI_Direction_Tx: SET_BIT(spi->GCR, SPI_GCR_TXEN); break; case SPI_Disable_Rx: CLEAR_BIT(spi->GCR, SPI_GCR_RXEN); break; case SPI_Disable_Tx: CLEAR_BIT(spi->GCR, SPI_GCR_TXEN); break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function to find out if a descriptor discovery is required. This function finds out if there is a possibility of existence of descriptors between current characteristic and the next characteristic. If so, this function will compute the handle range on which the descriptors may be present and will return it. If the current characteristic is the last known characteristic, then this function will use the service end handle to find out if the current characteristic can have descriptors. */
static bool is_desc_discovery_reqd(ble_db_discovery_t *p_db_discovery, ble_gatt_db_char_t *p_curr_char, ble_gatt_db_char_t *p_next_char, ble_gattc_handle_range_t *p_handle_range)
/* Function to find out if a descriptor discovery is required. This function finds out if there is a possibility of existence of descriptors between current characteristic and the next characteristic. If so, this function will compute the handle range on which the descriptors may be present and will return it. If the current characteristic is the last known characteristic, then this function will use the service end handle to find out if the current characteristic can have descriptors. */ static bool is_desc_discovery_reqd(ble_db_discovery_t *p_db_discovery, ble_gatt_db_char_t *p_curr_char, ble_gatt_db_char_t *p_next_char, ble_gattc_handle_range_t *p_handle_range)
{ if (p_next_char == NULL) { if ( p_curr_char->characteristic.handle_value == p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle ) { return false; } p_handle_range->start_handle = p_curr_char->characteristic.handle_value + 1; p_handle_range->end_handle = p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle; return true; } if ((p_curr_char->characteristic.handle_value + 1) == p_next_char->characteristic.handle_decl) { return false; } p_handle_range->start_handle = p_curr_char->characteristic.handle_value + 1; p_handle_range->end_handle = p_next_char->characteristic.handle_decl - 1; return true; }
labapart/polymcu
C++
null
201
/* Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */
EFI_STATUS EFIAPI CoreInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
/* Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */ EFI_STATUS EFIAPI CoreInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
{ return CoreInstallProtocolInterfaceNotify ( UserHandle, Protocol, InterfaceType, Interface, TRUE ); }
tianocore/edk2
C++
Other
4,240
/* This function is called with no lock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL. */
struct lpfc_iocbq* lpfc_sli_get_iocbq(struct lpfc_hba *phba)
/* This function is called with no lock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL. */ struct lpfc_iocbq* lpfc_sli_get_iocbq(struct lpfc_hba *phba)
{ struct lpfc_iocbq * iocbq = NULL; unsigned long iflags; spin_lock_irqsave(&phba->hbalock, iflags); iocbq = __lpfc_sli_get_iocbq(phba); spin_unlock_irqrestore(&phba->hbalock, iflags); return iocbq; }
robutest/uclinux
C++
GPL-2.0
60
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { HID_Device_USBTask(&Joystick_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Open LIN mode on the specified UART. The */
void UARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
/* Open LIN mode on the specified UART. The */ void UARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
{ xASSERT(UARTBaseValid(ulBase)); xASSERT((ulConfig&UART_CONFIG_BKFL_MASK)<16); UARTConfigSetExpClk(ulBase, ulBaud, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE); UARTEnableLIN(ulBase); xHWREG(ulBase + UART_ALT_CSR) = (ulConfig); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Function for performing the Local DB update procedure if it is pending on any connections. */
static void update_pending_flags_check(void)
/* Function for performing the Local DB update procedure if it is pending on any connections. */ static void update_pending_flags_check(void)
{ sdk_mapped_flags_t update_pending_flags; update_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_update_pending); if (sdk_mapped_flags_any_set(update_pending_flags)) { sdk_mapped_flags_key_list_t conn_handle_list; conn_handle_list = ble_conn_state_conn_handles(); for (uint32_t i = 0; i < conn_handle_list.len; i++) { if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_update_pending)) { local_db_update_in_evt(conn_handle_list.flag_keys[i]); } } } }
labapart/polymcu
C++
null
201
/* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= HID_Device_ConfigureEndpoints(&Generic_HID_Interface); ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns the absolute FIFO address for a given endpoint. */
unsigned long USBFIFOAddrGet(unsigned long ulBase, unsigned long ulEndpoint)
/* Returns the absolute FIFO address for a given endpoint. */ unsigned long USBFIFOAddrGet(unsigned long ulBase, unsigned long ulEndpoint)
{ return(ulBase + USB_O_FIFO0 + (ulEndpoint >> 2)); }
watterott/WebRadio
C++
null
71
/* Configure the transfer settings of the Cadence NAND controller. */
static int cdns_nand_transfer_config(uintptr_t base_address)
/* Configure the transfer settings of the Cadence NAND controller. */ static int cdns_nand_transfer_config(uintptr_t base_address)
{ int ret = 0; ret = cdns_nand_wait_idle(base_address); if (ret != 0) { LOG_ERR("Wait for controller to be in idle state Failed"); return ret; } sys_write32(ENABLE, CNF_CTRLCFG(base_address, TRANS_CFG0)); sys_write32(DISABLE, CNF_CTRLCFG(base_address, MULTIPLANE_CFG)); sys_write32(DISABLE, CNF_CTRLCFG(base_address, CACHE_CFG)); sys_write32(CLEAR_ALL_INTERRUPT, (base_address + INTR_STATUS)); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* It will return 0 if gpio value is low and other if high. */
static int msp71xx_exd_gpio_get(struct gpio_chip *chip, unsigned offset)
/* It will return 0 if gpio value is low and other if high. */ static int msp71xx_exd_gpio_get(struct gpio_chip *chip, unsigned offset)
{ struct msp71xx_exd_gpio_chip *msp71xx_chip = to_msp71xx_exd_gpio_chip(chip); const unsigned bit = MSP71XX_READ_OFFSET(offset); return __raw_readl(msp71xx_chip->reg) & (1 << bit); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if the day in the UEFI time is valid. */
BOOLEAN EFIAPI IsDayValid(IN EFI_TIME *Time)
/* Check if the day in the UEFI time is valid. */ BOOLEAN EFIAPI IsDayValid(IN EFI_TIME *Time)
{ STATIC CONST INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if ((Time->Day < 1) || (Time->Day > DayOfMonth[Time->Month - 1]) || ((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28))) ) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* USBH_MSC_UnitIsReady The function check whether a LUN is ready. */
uint8_t USBH_MSC_UnitIsReady(USBH_HandleTypeDef *phost, uint8_t lun)
/* USBH_MSC_UnitIsReady The function check whether a LUN is ready. */ uint8_t USBH_MSC_UnitIsReady(USBH_HandleTypeDef *phost, uint8_t lun)
{ MSC_HandleTypeDef *MSC_Handle = (MSC_HandleTypeDef *) phost->pActiveClass->pData; if(phost->gState == HOST_CLASS) { return (MSC_Handle->unit[lun].error == MSC_OK); } else { return 0; } }
labapart/polymcu
C++
null
201
/* This function should be used to verify the external oscillator is active and valid before attempting to recover from a */
bool HibernateTamperExtOscValid(void)
/* This function should be used to verify the external oscillator is active and valid before attempting to recover from a */ bool HibernateTamperExtOscValid(void)
{ if(HibernateTamperStatusGet() & (HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE | HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID)) { return(true); } return(false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Init interrupts callback for the specified I2C Port. */
void I2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
/* Init interrupts callback for the specified I2C Port. */ void I2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); if (ulBase == I2C0_BASE) { g_pfnI2CHandlerCallbacks[0] = xtI2CCallback; } else { g_pfnI2CHandlerCallbacks[1] = xtI2CCallback; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Derive SHA384 HMAC-based Extract key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
/* Derive SHA384 HMAC-based Extract key Derivation Function (HKDF). */ BOOLEAN EFIAPI HkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
{ return HkdfMdExtract ( EVP_sha384 (), Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize ); }
tianocore/edk2
C++
Other
4,240
/* Interrupt service routine for the analog regulator brownout. Determines which analog regulator is in brownout, then calls the installed brownout handler routine. */
void pmu_analog_brownout_isr(void)
/* Interrupt service routine for the analog regulator brownout. Determines which analog regulator is in brownout, then calls the installed brownout handler routine. */ void pmu_analog_brownout_isr(void)
{ if (s_pmu.ldo1p1.isInBrownout()) { s_pmu.ldo1p1.getBrownoutHandler()(kPMURegulator_1p1); } if (s_pmu.ldo2p5.isInBrownout()) { s_pmu.ldo2p5.getBrownoutHandler()(kPMURegulator_2p5); } if (s_pmu.ldo3p0.isInBrownout()) { s_pmu.ldo3p0.getBrownoutHandler()(kPMURegulator_3p0); } HW_PMU_MISC1_SET(BM_PMU_MISC1_IRQ_ANA_BO); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The value of jiffies is used for a fairly randomly cache tag. */
static int v9fs_random_cachetag(struct v9fs_session_info *v9ses)
/* The value of jiffies is used for a fairly randomly cache tag. */ static int v9fs_random_cachetag(struct v9fs_session_info *v9ses)
{ v9ses->cachetag = kmalloc(CACHETAG_LEN, GFP_KERNEL); if (!v9ses->cachetag) return -ENOMEM; return scnprintf(v9ses->cachetag, CACHETAG_LEN, "%lu", jiffies); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the collision distance to the default value and is used during link setup. Currently no func pointer exists and all implementations are handled in the generic version of this function. */
void igb_config_collision_dist(struct e1000_hw *hw)
/* Configures the collision distance to the default value and is used during link setup. Currently no func pointer exists and all implementations are handled in the generic version of this function. */ void igb_config_collision_dist(struct e1000_hw *hw)
{ u32 tctl; tctl = rd32(E1000_TCTL); tctl &= ~E1000_TCTL_COLD; tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; wr32(E1000_TCTL, tctl); wrfl(); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes yi.qiu first version */
int dlclose(void *handle)
/* Change Logs: Date Author Notes yi.qiu first version */ int dlclose(void *handle)
{ struct rt_dlmodule *module; RT_ASSERT(handle != RT_NULL); module = (struct rt_dlmodule *)handle; rt_enter_critical(); module->nref--; if (module->nref <= 0) { rt_exit_critical(); dlmodule_destroy(module); } else { rt_exit_critical(); } return RT_TRUE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* The Stop() function is used to stop the DHCP configuration process. After this function is called successfully, the EFI DHCPv4 Protocol driver is transferred into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called before DHCP configuration process can be started again. This function can be called when the EFI DHCPv4 Protocol driver is in any state. */
EFI_STATUS EFIAPI EfiDhcp4Stop(IN EFI_DHCP4_PROTOCOL *This)
/* The Stop() function is used to stop the DHCP configuration process. After this function is called successfully, the EFI DHCPv4 Protocol driver is transferred into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called before DHCP configuration process can be started again. This function can be called when the EFI DHCPv4 Protocol driver is in any state. */ EFI_STATUS EFIAPI EfiDhcp4Stop(IN EFI_DHCP4_PROTOCOL *This)
{ DHCP_PROTOCOL *Instance; DHCP_SERVICE *DhcpSb; EFI_TPL OldTpl; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = DHCP_INSTANCE_FROM_THIS (This); if (Instance->Signature != DHCP_PROTOCOL_SIGNATURE) { return EFI_INVALID_PARAMETER; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); DhcpSb = Instance->Service; DhcpCleanLease (DhcpSb); DhcpSb->DhcpState = Dhcp4Stopped; DhcpSb->ServiceState = DHCP_UNCONFIGED; gBS->RestoreTPL (OldTpl); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */
void synopGMAC_take_desc_ownership_rx(synopGMACdevice *gmacdev)
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */ void synopGMAC_take_desc_ownership_rx(synopGMACdevice *gmacdev)
{ s32 i; DmaDesc *desc; desc = gmacdev->RxDesc; for (i = 0; i < gmacdev->RxDescCount; i++) { synopGMAC_take_desc_ownership(desc + i); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Legacy PDC guarantees to set: Map Memory BAR's into PA IO space. Map Expansion ROM BAR into one common PA IO space per bus. Map IO BAR's into PCI IO space. Command (see below) Cache Line Size Latency Timer Interrupt Line PPB: secondary latency timer, io/mmio base/limit, bus numbers, bridge control */
void pcibios_set_master(struct pci_dev *dev)
/* Legacy PDC guarantees to set: Map Memory BAR's into PA IO space. Map Expansion ROM BAR into one common PA IO space per bus. Map IO BAR's into PCI IO space. Command (see below) Cache Line Size Latency Timer Interrupt Line PPB: secondary latency timer, io/mmio base/limit, bus numbers, bridge control */ void pcibios_set_master(struct pci_dev *dev)
{ u8 lat; pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); if (lat >= 16) return; pci_write_config_word(dev, PCI_CACHE_LINE_SIZE, (0x80 << 8) | pci_cache_line_size); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configure the interface. Note that we ignore the other parts of ifmap, since its mostly meaningless for this driver. */
static int etherh_set_config(struct net_device *dev, struct ifmap *map)
/* Configure the interface. Note that we ignore the other parts of ifmap, since its mostly meaningless for this driver. */ static int etherh_set_config(struct net_device *dev, struct ifmap *map)
{ switch (map->port) { case IF_PORT_10BASE2: case IF_PORT_10BASET: dev->flags &= ~IFF_AUTOMEDIA; dev->if_port = map->port; break; default: return -EINVAL; } etherh_setif(dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* s2io_ethtool_setpause_data - set/reset pause frame generation. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. @ep : pointer to the structure with pause parameters given by ethtool. Description: It can be used to set or reset Pause frame generation or reception support of the NIC. Return value: int, returns 0 on Success */
static int s2io_ethtool_setpause_data(struct net_device *dev, struct ethtool_pauseparam *ep)
/* s2io_ethtool_setpause_data - set/reset pause frame generation. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. @ep : pointer to the structure with pause parameters given by ethtool. Description: It can be used to set or reset Pause frame generation or reception support of the NIC. Return value: int, returns 0 on Success */ static int s2io_ethtool_setpause_data(struct net_device *dev, struct ethtool_pauseparam *ep)
{ u64 val64; struct s2io_nic *sp = netdev_priv(dev); struct XENA_dev_config __iomem *bar0 = sp->bar0; val64 = readq(&bar0->rmac_pause_cfg); if (ep->tx_pause) val64 |= RMAC_PAUSE_GEN_ENABLE; else val64 &= ~RMAC_PAUSE_GEN_ENABLE; if (ep->rx_pause) val64 |= RMAC_PAUSE_RX_ENABLE; else val64 &= ~RMAC_PAUSE_RX_ENABLE; writeq(val64, &bar0->rmac_pause_cfg); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED4); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Starts the specified timer instance and waits until it have the desired value. */
static void start_and_wait(struct timer_desc *timer, uint32_t value)
/* Starts the specified timer instance and waits until it have the desired value. */ static void start_and_wait(struct timer_desc *timer, uint32_t value)
{ uint32_t count; timer_counter_set(timer, 0); timer_start(timer); do { timer_counter_get(timer, &count); } while (count < value); timer_stop(timer); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* get the SSL verifying depth of the SSL context */
int SSL_CTX_get_verify_depth(const SSL_CTX *ctx)
/* get the SSL verifying depth of the SSL context */ int SSL_CTX_get_verify_depth(const SSL_CTX *ctx)
{ SSL_ASSERT1(ctx); return ctx->param.depth; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This file is part of the Simba project. */
int mock_write_mcp2515_init(struct spi_device_t *spi_p, struct pin_device_t *cs_p, struct exti_device_t *exti_p, void *chin_p, int mode, int speed, int res)
/* This file is part of the Simba project. */ int mock_write_mcp2515_init(struct spi_device_t *spi_p, struct pin_device_t *cs_p, struct exti_device_t *exti_p, void *chin_p, int mode, int speed, int res)
{ harness_mock_write("mcp2515_init(spi_p)", spi_p, sizeof(*spi_p)); harness_mock_write("mcp2515_init(cs_p)", cs_p, sizeof(*cs_p)); harness_mock_write("mcp2515_init(exti_p)", exti_p, sizeof(*exti_p)); harness_mock_write("mcp2515_init(chin_p)", chin_p, sizeof(chin_p)); harness_mock_write("mcp2515_init(mode)", &mode, sizeof(mode)); harness_mock_write("mcp2515_init(speed)", &speed, sizeof(speed)); harness_mock_write("mcp2515_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Enable access to the embedded functions/sensor hub configuration registers. */
int32_t lsm6dsl_mem_bank_get(stmdev_ctx_t *ctx, lsm6dsl_func_cfg_en_t *val)
/* Enable access to the embedded functions/sensor hub configuration registers. */ int32_t lsm6dsl_mem_bank_get(stmdev_ctx_t *ctx, lsm6dsl_func_cfg_en_t *val)
{ lsm6dsl_func_cfg_access_t func_cfg_access; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_FUNC_CFG_ACCESS, (uint8_t*)&func_cfg_access, 1); switch (func_cfg_access.func_cfg_en) { case LSM6DSL_USER_BANK: *val = LSM6DSL_USER_BANK; break; case LSM6DSL_BANK_B: *val = LSM6DSL_BANK_B; break; default: *val = LSM6DSL_BANK_ND; break; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* This function returns the first node (in sort order) of the tree. */
struct rb_node* rb_first(struct rb_root *root)
/* This function returns the first node (in sort order) of the tree. */ struct rb_node* rb_first(struct rb_root *root)
{ struct rb_node *n; n = root->rb_node; if (!n) return NULL; while (n->rb_left) n = n->rb_left; return n; }
EmcraftSystems/u-boot
C++
Other
181
/* Watchdog ETMer disable routine with update enabled. Disable watchdog but the watchdog can be enabled and updated later. */
void WDOG_DisableWDOGEnableUpdate(void)
/* Watchdog ETMer disable routine with update enabled. Disable watchdog but the watchdog can be enabled and updated later. */ void WDOG_DisableWDOGEnableUpdate(void)
{ uint8_t u8Cs1 = WDOG->CS1; uint8_t u8Cs2 = WDOG->CS2; uint16_t u16TOVAL = WDOG->TOVAL; uint16_t u16WIN = WDOG->WIN; u8Cs1 &= ~WDOG_CS1_EN_MASK; u8Cs1 |= WDOG_CS1_UPDATE_MASK; WDOG->CS2 = u8Cs2; WDOG->TOVAL = u16TOVAL; WDOG->WIN = u16WIN; WDOG->CS1 = u8Cs1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add the vlan id to the devices vlan id table */
static void vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
/* Add the vlan id to the devices vlan id table */ static void vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
{ struct vxgedev *vdev; struct vxge_vpath *vpath; int vp_id; vdev = (struct vxgedev *)netdev_priv(dev); for (vp_id = 0; vp_id < vdev->no_of_vpath; vp_id++) { vpath = &vdev->vpaths[vp_id]; if (!vpath->is_open) continue; vxge_hw_vpath_vid_add(vpath->handle, vid); } }
robutest/uclinux
C++
GPL-2.0
60
/* This function make DAC module be ready to convert. */
void DAC_Open(DAC_T *dac, uint32_t u32Ch, uint32_t u32TrgSrc)
/* This function make DAC module be ready to convert. */ void DAC_Open(DAC_T *dac, uint32_t u32Ch, uint32_t u32TrgSrc)
{ (void)u32Ch; dac->CTL &= ~(DAC_CTL_ETRGSEL_Msk | DAC_CTL_TRGSEL_Msk | DAC_CTL_TRGEN_Msk); dac->CTL |= (u32TrgSrc | DAC_CTL_DACEN_Msk); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We enter with non-exclusive mmap_sem (to exclude vma changes, but allow concurrent faults), and pte mapped but not yet locked. We return with mmap_sem still held, but pte unmapped and unlocked. */
static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, unsigned int flags, pte_t orig_pte)
/* We enter with non-exclusive mmap_sem (to exclude vma changes, but allow concurrent faults), and pte mapped but not yet locked. We return with mmap_sem still held, but pte unmapped and unlocked. */ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, unsigned int flags, pte_t orig_pte)
{ pgoff_t pgoff; flags |= FAULT_FLAG_NONLINEAR; if (!pte_unmap_same(mm, pmd, page_table, orig_pte)) return 0; if (unlikely(!(vma->vm_flags & VM_NONLINEAR))) { print_bad_pte(vma, address, orig_pte, NULL); return VM_FAULT_SIGBUS; } pgoff = pte_to_pgoff(orig_pte); return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); }
robutest/uclinux
C++
GPL-2.0
60
/* returns whether it has modified a pending timer (1) or not (0) */
int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
/* returns whether it has modified a pending timer (1) or not (0) */ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
{ return __mod_vtimer(timer, expires, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: pointer to handle if successful, else appropriate error value. */
const struct ti_sci_handle* ti_sci_get_by_phandle(struct udevice *dev, const char *property)
/* Return: pointer to handle if successful, else appropriate error value. */ const struct ti_sci_handle* ti_sci_get_by_phandle(struct udevice *dev, const char *property)
{ struct ti_sci_info *entry, *info = NULL; u32 phandle, err; ofnode node; err = ofnode_read_u32(dev_ofnode(dev), property, &phandle); if (err) return ERR_PTR(err); node = ofnode_get_by_phandle(phandle); if (!ofnode_valid(node)) return ERR_PTR(-EINVAL); list_for_each_entry(entry, &ti_sci_list, list) if (ofnode_equal(dev_ofnode(entry->dev), node)) { info = entry; break; } if (!info) return ERR_PTR(-ENODEV); return &info->handle; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Fills a target buffer with a 64-bit value, and returns the target buffer. */
VOID* EFIAPI InternalMemSetMem64(OUT VOID *Buffer, IN UINTN Length, IN UINT64 Value)
/* Fills a target buffer with a 64-bit value, and returns the target buffer. */ VOID* EFIAPI InternalMemSetMem64(OUT VOID *Buffer, IN UINTN Length, IN UINT64 Value)
{ for ( ; Length != 0; Length--) { ((UINT64 *)Buffer)[Length - 1] = Value; } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* param name The name of the selected body bias. Please see the enumeration pmu_body_bias_name_t for details. param setpointMap The map of setpoints that the specific body bias's wbias power switch will be turn on in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */
void PMU_GPCEnableBodyBiasStandbyMode(pmu_body_bias_name_t name, uint32_t setpointMap)
/* param name The name of the selected body bias. Please see the enumeration pmu_body_bias_name_t for details. param setpointMap The map of setpoints that the specific body bias's wbias power switch will be turn on in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */ void PMU_GPCEnableBodyBiasStandbyMode(pmu_body_bias_name_t name, uint32_t setpointMap)
{ uint32_t BBStandbyEnableRegArray[] = PMU_BODY_BIAS_STBY_EN_REGISTERS; (*(volatile uint32_t *)BBStandbyEnableRegArray[(uint8_t)name]) = setpointMap; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: Process a user generated REMOVEDEF message and remove */
static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info)
/* Description: Process a user generated REMOVEDEF message and remove */ static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info)
{ struct netlbl_audit audit_info; netlbl_netlink_auditinfo(skb, &audit_info); return netlbl_domhsh_remove_default(&audit_info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write consecutive bytes of data to the SL811H/SL11H buffer */
static void sl811_write_buf(__u8 offset, __u8 *buf, __u8 size)
/* Write consecutive bytes of data to the SL811H/SL11H buffer */ static void sl811_write_buf(__u8 offset, __u8 *buf, __u8 size)
{ *(volatile unsigned char *) (SL811_ADR) = offset; EIEIO; while (size--) { *(volatile unsigned char *) (SL811_DAT) = *buf++; EIEIO; } }
EmcraftSystems/u-boot
C++
Other
181
/* Called by setup_system after ppc_md->probe and ppc_md->early_init. Call it again after setting udbg_putc in ppc_md->setup_arch. */
void __init register_early_udbg_console(void)
/* Called by setup_system after ppc_md->probe and ppc_md->early_init. Call it again after setting udbg_putc in ppc_md->setup_arch. */ void __init register_early_udbg_console(void)
{ if (early_console_initialized) return; if (!udbg_putc) return; if (strstr(boot_command_line, "udbg-immortal")) { printk(KERN_INFO "early console immortal !\n"); udbg_console.flags &= ~CON_BOOT; } early_console_initialized = 1; register_console(&udbg_console); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Send data through an IPC channel and wait for the relpy. */
rt_err_t rt_raw_channel_send_recv(rt_channel_t ch, rt_channel_msg_t data, rt_channel_msg_t data_ret)
/* Send data through an IPC channel and wait for the relpy. */ rt_err_t rt_raw_channel_send_recv(rt_channel_t ch, rt_channel_msg_t data, rt_channel_msg_t data_ret)
{ return _send_recv_timeout(ch, data, 1, data_ret, RT_WAITING_FOREVER); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the same value as datetime('now'). */
static void ctimestampFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2)
/* This function returns the same value as datetime('now'). */ static void ctimestampFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2)
{ UNUSED_PARAMETER2(NotUsed, NotUsed2); datetimeFunc(context, 0, 0); }
DC-SWAT/DreamShell
C++
null
404
/* Enable selected GPIO Interrupts. Use this function to enable the GPIO interrupts. */
uint64_t am_hal_gpio_int_enable_get(void)
/* Enable selected GPIO Interrupts. Use this function to enable the GPIO interrupts. */ uint64_t am_hal_gpio_int_enable_get(void)
{ uint64_t ui64RetVal; ui64RetVal = ((uint64_t) AM_REGn(GPIO, 0, INT1EN)) << 32; ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, INT0EN)) << 0; return ui64RetVal; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert the D-PHY PLL CM to the value could be set to register. */
static uint8_t DSI_EncodeDphyPllCm(uint8_t cm)
/* Convert the D-PHY PLL CM to the value could be set to register. */ static uint8_t DSI_EncodeDphyPllCm(uint8_t cm)
{ assert(cm >= 16U); if (cm <= 31U) { return 0xE0U | cm; } else if (cm <= 63U) { return 0xC0U | (cm & 0x1FU); } else if (cm <= 127U) { return 0x80U | (cm & 0x3FU); } else { return cm & 0xCFU; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called via BASE_CUSTOM, and displays the login rejection reason code as a character like it is in the specification, rather than using BASE_DEC which show it as an integer value. */
static void format_reject_code(gchar *buf, guint32 value)
/* This function is called via BASE_CUSTOM, and displays the login rejection reason code as a character like it is in the specification, rather than using BASE_DEC which show it as an integer value. */ static void format_reject_code(gchar *buf, guint32 value)
{ gchar* tmp_str; tmp_str = val_to_str_wmem(NULL, value, reject_code_val, "Unknown reject code"); g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", tmp_str, (char)(value & 0xff)); wmem_free(NULL, tmp_str); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Again if you can't change the resolution you don't need this function. */
static int xxxfb_set_par(struct fb_info *info)
/* Again if you can't change the resolution you don't need this function. */ static int xxxfb_set_par(struct fb_info *info)
{ struct xxx_par *par = info->par; return 0;}
robutest/uclinux
C++
GPL-2.0
60
/* Only Special Function Registers (SFRs) can be read at byte level. */
int32_t can_ctrl_sfr_byte_read(struct can_ctrl_dev *dev, uint16_t address, uint8_t *data)
/* Only Special Function Registers (SFRs) can be read at byte level. */ int32_t can_ctrl_sfr_byte_read(struct can_ctrl_dev *dev, uint16_t address, uint8_t *data)
{ uint8_t spi_msg[] = {0, 0, 0}; int32_t ret; spi_msg[0] |= CAN_CTRL_CMD_MODE(CAN_CTRL_CMD_READ); spi_msg[0] |= CAN_CTRL_ADDR_UP_NIBBLE_MODE(address); spi_msg[1] |= CAN_CTRL_ADDR_DW_BYTE_MODE(address); ret = spi_write_and_read(dev->can_ctrl_spi, spi_msg, 3); if(ret != SUCCESS) return ret; *data = spi_msg[2]; return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
{ EFI_STATUS Status; VOID *Buffer; Status = PeiServicesAllocatePool (AllocationSize, &Buffer); if (EFI_ERROR (Status)) { Buffer = NULL; } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* Returns: the complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed */
gchar* g_module_build_path(const gchar *directory, const gchar *module_name)
/* Returns: the complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed */ gchar* g_module_build_path(const gchar *directory, const gchar *module_name)
{ g_return_val_if_fail (module_name != NULL, NULL); return _g_module_build_path (directory, module_name); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Build a IO descriptor according to an entry. */
VOID BuildIoDescriptor(IN EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor, IN EFI_GCD_MAP_ENTRY *Entry)
/* Build a IO descriptor according to an entry. */ VOID BuildIoDescriptor(IN EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor, IN EFI_GCD_MAP_ENTRY *Entry)
{ Descriptor->BaseAddress = Entry->BaseAddress; Descriptor->Length = Entry->EndAddress - Entry->BaseAddress + 1; Descriptor->GcdIoType = Entry->GcdIoType; Descriptor->ImageHandle = Entry->ImageHandle; Descriptor->DeviceHandle = Entry->DeviceHandle; }
tianocore/edk2
C++
Other
4,240
/* This is the main wrapper for mapping host physical pages to CA PCI space. The mapping mode used is based on the devices dma_mask. As a last resort use the GART mapped mode. */
static u64 tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
/* This is the main wrapper for mapping host physical pages to CA PCI space. The mapping mode used is based on the devices dma_mask. As a last resort use the GART mapped mode. */ static u64 tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
{ u64 mapaddr; if (dma_flags & SN_DMA_MSI) return 0; if (pdev->dma_mask == ~0UL) mapaddr = tioca_dma_d64(paddr); else if (pdev->dma_mask == 0xffffffffffffUL) mapaddr = tioca_dma_d48(pdev, paddr); else mapaddr = 0; if (mapaddr == 0) mapaddr = tioca_dma_mapped(pdev, paddr, byte_count); return mapaddr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Setup the clock for the watchdog timer. The default setting is 250kHz. */
static void wdtClockSetup(void)
/* Setup the clock for the watchdog timer. The default setting is 250kHz. */ static void wdtClockSetup(void)
{ SCB_WDTOSCCTRL = SCB_WDTOSCCTRL_FREQSEL_0_5MHZ | SCB_WDTOSCCTRL_DIVSEL_DIV2; SCB_WDTCLKSEL = SCB_WDTCLKSEL_SOURCE_WATCHDOGOSC; SCB_WDTCLKUEN = SCB_WDTCLKUEN_UPDATE; SCB_WDTCLKUEN = SCB_WDTCLKUEN_DISABLE; SCB_WDTCLKUEN = SCB_WDTCLKUEN_UPDATE; while (!(SCB_WDTCLKUEN & SCB_WDTCLKUEN_UPDATE)); SCB_WDTCLKDIV = SCB_WDTCLKDIV_DIV1; SCB_PDRUNCFG &= ~(SCB_PDRUNCFG_WDTOSC); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Enable the automatic slave select function of the specified SPI port. The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
/* Enable the automatic slave select function of the specified SPI port. The */ void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= SPI_AUTOSS; xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Verify that we can get a color of '0' from all pixels when after zeroing the buffer. */
ZTEST(display_read_write, test_clear)
/* Verify that we can get a color of '0' from all pixels when after zeroing the buffer. */ ZTEST(display_read_write, test_clear)
{ verify_background_color(0, 0, display_width, display_height, 0); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Close the watchdog device. If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also disabled. */
static int at91_wdt_close(struct inode *inode, struct file *file)
/* Close the watchdog device. If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also disabled. */ static int at91_wdt_close(struct inode *inode, struct file *file)
{ if (!nowayout) at91_wdt_stop(); clear_bit(0, &at91wdt_busy); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_EnableEP(U32 EPNum)
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_EnableEP(U32 EPNum)
{ ep_buffer_t *desc = get_desc(EPNum); EPNum &= EPNUM_MASK; MXC_USB->ep[EPNum] |= (MXC_F_USB_EP_INT_EN | ep_info[EPNum].type | MXC_F_USB_EP_DT); if (ep_info[EPNum].type == MXC_S_USB_EP_DIR_OUT) { desc = get_desc(EPNum); desc->buf0_address = (uint32_t)ep_buffer[EPNum]; desc->buf0_desc = sizeof(ep_buffer[EPNum]); MXC_USB->out_owner = (1 << EPNum); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* __vxge_hw_device_toc_get This routine sets the swapper and reads the toc pointer and returns the memory mapped address of the toc */
struct vxge_hw_toc_reg __iomem* __vxge_hw_device_toc_get(void __iomem *bar0)
/* __vxge_hw_device_toc_get This routine sets the swapper and reads the toc pointer and returns the memory mapped address of the toc */ struct vxge_hw_toc_reg __iomem* __vxge_hw_device_toc_get(void __iomem *bar0)
{ u64 val64; struct vxge_hw_toc_reg __iomem *toc = NULL; enum vxge_hw_status status; struct vxge_hw_legacy_reg __iomem *legacy_reg = (struct vxge_hw_legacy_reg __iomem *)bar0; status = __vxge_hw_legacy_swapper_set(legacy_reg); if (status != VXGE_HW_OK) goto exit; val64 = readq(&legacy_reg->toc_first_pointer); toc = (struct vxge_hw_toc_reg __iomem *)(bar0+val64); exit: return toc; }
robutest/uclinux
C++
GPL-2.0
60
/* This is necessary to prevent signal delivery starvation, when the result of the division would be rounded down to 0. */
static cputime_t cputime_div_non_zero(cputime_t time, unsigned long div)
/* This is necessary to prevent signal delivery starvation, when the result of the division would be rounded down to 0. */ static cputime_t cputime_div_non_zero(cputime_t time, unsigned long div)
{ cputime_t res = cputime_div(time, div); return max_t(cputime_t, res, 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToUint64(IN INT64 Operand, OUT UINT64 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt64ToUint64(IN INT64 Operand, OUT UINT64 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand >= 0) { *Result = (UINT64)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT64_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* USBH_HID_InterfaceDeInit The function DeInit the Pipes used for the HID class. */
static USBH_StatusTypeDef USBH_HID_InterfaceDeInit(USBH_HandleTypeDef *phost)
/* USBH_HID_InterfaceDeInit The function DeInit the Pipes used for the HID class. */ static USBH_StatusTypeDef USBH_HID_InterfaceDeInit(USBH_HandleTypeDef *phost)
{ HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData; if (HID_Handle->InPipe != 0x00U) { (void)USBH_ClosePipe(phost, HID_Handle->InPipe); (void)USBH_FreePipe(phost, HID_Handle->InPipe); HID_Handle->InPipe = 0U; } if (HID_Handle->OutPipe != 0x00U) { (void)USBH_ClosePipe(phost, HID_Handle->OutPipe); (void)USBH_FreePipe(phost, HID_Handle->OutPipe); HID_Handle->OutPipe = 0U; } if ((phost->pActiveClass->pData) != NULL) { USBH_free(phost->pActiveClass->pData); phost->pActiveClass->pData = 0U; } return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Serial transmit data routines, This function will transmit data by using blocking_nbuf. */
static rt_size_t _serial_fifo_tx_blocking_nbuf(struct rt_device *dev, rt_off_t pos, const void *buffer, rt_size_t size)
/* Serial transmit data routines, This function will transmit data by using blocking_nbuf. */ static rt_size_t _serial_fifo_tx_blocking_nbuf(struct rt_device *dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ struct rt_serial_device *serial; struct rt_serial_tx_fifo *tx_fifo = RT_NULL; RT_ASSERT(dev != RT_NULL); if (size == 0) return 0; serial = (struct rt_serial_device *)dev; RT_ASSERT((serial != RT_NULL) && (buffer != RT_NULL)); tx_fifo = (struct rt_serial_tx_fifo *) serial->serial_tx; RT_ASSERT(tx_fifo != RT_NULL); if (tx_fifo->activated == RT_TRUE) return 0; tx_fifo->activated = RT_TRUE; serial->ops->transmit(serial, (rt_uint8_t *)buffer, size, RT_SERIAL_TX_BLOCKING); rt_completion_wait(&(tx_fifo->tx_cpt), RT_WAITING_FOREVER); return size; }
pikasTech/PikaPython
C++
MIT License
1,403
/* @field: an initialized field @value: a space delimited string of byte values (i.e. "1 02 3 0x4") */
int eeprom_field_update_reserved(struct eeprom_field *field, char *value)
/* @field: an initialized field @value: a space delimited string of byte values (i.e. "1 02 3 0x4") */ int eeprom_field_update_reserved(struct eeprom_field *field, char *value)
{ return __eeprom_field_update_bin_delim(field, value, " "); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets the captured data for a sample sequence. */
int32_t ADCSequenceDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer)
/* Gets the captured data for a sample sequence. */ int32_t ADCSequenceDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer)
{ uint32_t ui32Count; ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 4); ui32Base += ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum); ui32Count = 0; while(!(HWREG(ui32Base + ADC_SSFSTAT) & ADC_SSFSTAT0_EMPTY) && (ui32Count < 8)) { *pui32Buffer++ = HWREG(ui32Base + ADC_SSFIFO); ui32Count++; } return(ui32Count); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* unlock the main FMC operation , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void fmc_unlock(void)
/* unlock the main FMC operation , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void fmc_unlock(void)
{ if((RESET != (FMC_CTL & FMC_CTL_LK))){ FMC_KEY = UNLOCK_KEY0; FMC_KEY = UNLOCK_KEY1; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* Please add a note about your changes to smbfs in the ChangeLog file. Force the next attempt to use the cache to be a timeout. If we can't find the page that's fine, it will cause a refresh. */
void smb_invalid_dir_cache(struct inode *dir)
/* Please add a note about your changes to smbfs in the ChangeLog file. Force the next attempt to use the cache to be a timeout. If we can't find the page that's fine, it will cause a refresh. */ void smb_invalid_dir_cache(struct inode *dir)
{ struct smb_sb_info *server = server_from_inode(dir); union smb_dir_cache *cache = NULL; struct page *page = NULL; page = grab_cache_page(&dir->i_data, 0); if (!page) goto out; if (!PageUptodate(page)) goto out_unlock; cache = kmap(page); cache->head.time = jiffies - SMB_MAX_AGE(server); kunmap(page); SetPageUptodate(page); out_unlock: unlock_page(page); page_cache_release(page); out: return; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets up Carrier-sense on Transmit and downshift values. */
s32 e1000_copper_link_setup_82577(struct e1000_hw *hw)
/* Sets up Carrier-sense on Transmit and downshift values. */ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw)
{ struct e1000_phy_info *phy = &hw->phy; s32 ret_val; u16 phy_data; ret_val = phy->ops.read_reg(hw, I82577_CFG_REG, &phy_data); if (ret_val) goto out; phy_data |= I82577_CFG_ASSERT_CRS_ON_TX; phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; ret_val = phy->ops.write_reg(hw, I82577_CFG_REG, phy_data); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Power off the power can be shut down in PDS0. */
BL_Err_Type ATTR_TCM_SECTION AON_LowPower_Enter_PDS0(void)
/* Power off the power can be shut down in PDS0. */ BL_Err_Type ATTR_TCM_SECTION AON_LowPower_Enter_PDS0(void)
{ uint32_t tmpVal = 0; tmpVal = BL_RD_REG(AON_BASE, AON_MISC); tmpVal = BL_CLR_REG_BIT(tmpVal, AON_SW_BZ_EN_AON); BL_WR_REG(AON_BASE, AON_MISC, tmpVal); tmpVal = BL_RD_REG(AON_BASE, AON_RF_TOP_AON); tmpVal = BL_CLR_REG_BIT(tmpVal, AON_PU_SFREG_AON); tmpVal = BL_CLR_REG_BIT(tmpVal, AON_PU_LDO15RF_AON); tmpVal = BL_CLR_REG_BIT(tmpVal, AON_PU_MBG_AON); BL_WR_REG(AON_BASE, AON_RF_TOP_AON, tmpVal); return SUCCESS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the CRC polynomial register of the specified SPI port. */
void SPICRCPolSet(unsigned long ulBase, unsigned long ulCRCPol)
/* Set the CRC polynomial register of the specified SPI port. */ void SPICRCPolSet(unsigned long ulBase, unsigned long ulCRCPol)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); xHWREG(ulBase + SPI_CRCPR) = ulCRCPol; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Override the default Active SSL ciphers in the SSL module with a certain combination selected by the caller in the form of a bitmap containing the required ciphers to be on. There is no need to call this function if the application will not change the default ciphersuites. */
m2m_ssl_set_active_ciphersuites(uint32 u32SslCsBMP)
/* Override the default Active SSL ciphers in the SSL module with a certain combination selected by the caller in the form of a bitmap containing the required ciphers to be on. There is no need to call this function if the application will not change the default ciphersuites. */ m2m_ssl_set_active_ciphersuites(uint32 u32SslCsBMP)
{ sint8 s8Ret = M2M_SUCCESS; tstrSslSetActiveCsList strCsList; strCsList.u32CsBMP = u32SslCsBMP; s8Ret = hif_send(M2M_REQ_GROUP_SSL, M2M_SSL_REQ_SET_CS_LIST, (uint8*)&strCsList, sizeof(tstrSslSetActiveCsList), NULL, 0, 0); return s8Ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set the physical compare value. param value: New physical timer compare value. */
void gtimer_set_physical_compare_value(rt_uint64_t value)
/* Set the physical compare value. param value: New physical timer compare value. */ void gtimer_set_physical_compare_value(rt_uint64_t value)
{ __set_cntp_cval(value); __asm__ volatile ("isb 0xF":::"memory"); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieve the tag and length of the tag. */
BOOLEAN EFIAPI CryptoServiceAsn1GetTag(IN OUT UINT8 **Ptr, IN CONST UINT8 *End, OUT UINTN *Length, IN UINT32 Tag)
/* Retrieve the tag and length of the tag. */ BOOLEAN EFIAPI CryptoServiceAsn1GetTag(IN OUT UINT8 **Ptr, IN CONST UINT8 *End, OUT UINTN *Length, IN UINT32 Tag)
{ return CALL_BASECRYPTLIB (X509.Services.Asn1GetTag, Asn1GetTag, (Ptr, End, Length, Tag), FALSE); }
tianocore/edk2
C++
Other
4,240
/* seq_file.start() implementation for gcov data files. Note that the gcov_iterator interface is designed to be more restrictive than seq_file (no start from arbitrary position, etc.), to simplify the iterator implementation. */
static void* gcov_seq_start(struct seq_file *seq, loff_t *pos)
/* seq_file.start() implementation for gcov data files. Note that the gcov_iterator interface is designed to be more restrictive than seq_file (no start from arbitrary position, etc.), to simplify the iterator implementation. */ static void* gcov_seq_start(struct seq_file *seq, loff_t *pos)
{ loff_t i; gcov_iter_start(seq->private); for (i = 0; i < *pos; i++) { if (gcov_iter_next(seq->private)) return NULL; } return seq->private; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
{ assert(handle != NULL); EDMA_AbortTransfer(handle->dmaHandle); base->RCR3 &= ~I2S_RCR3_RCE_MASK; SAI_RxEnableDMA(base, kSAI_FIFORequestDMAEnable, false); SAI_RxEnable(base, false); if ((base->RCSR & I2S_RCSR_RE_MASK) == 0UL) { base->RCSR |= (I2S_RCSR_FR_MASK | I2S_RCSR_SR_MASK); base->RCSR &= ~I2S_RCSR_SR_MASK; } (void)memset(&handle->saiQueue[handle->queueDriver], 0, sizeof(sai_transfer_t)); handle->queueDriver = (handle->queueDriver + 1U) % SAI_XFER_QUEUE_SIZE; handle->state = (uint32_t)kSAI_Idle; }
eclipse-threadx/getting-started
C++
Other
310
/* Writes the value of the specified register only when the device is ready to accept user requests. If the device ready flag is deactivated the write operation will be executed without checking the device state. */
int32_t ad7124_write_register(struct ad7124_dev *dev, struct ad7124_st_reg p_reg)
/* Writes the value of the specified register only when the device is ready to accept user requests. If the device ready flag is deactivated the write operation will be executed without checking the device state. */ int32_t ad7124_write_register(struct ad7124_dev *dev, struct ad7124_st_reg p_reg)
{ int32_t ret; if (dev->check_ready) { ret = ad7124_wait_for_spi_ready(dev, dev->spi_rdy_poll_cnt); if (ret < 0) return ret; } ret = ad7124_no_check_write_register(dev, p_reg); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36