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
/* A device has been removed, remove its links. */
void x25_link_device_down(struct net_device *dev)
/* A device has been removed, remove its links. */ void x25_link_device_down(struct net_device *dev)
{ struct x25_neigh *nb; struct list_head *entry, *tmp; write_lock_bh(&x25_neigh_list_lock); list_for_each_safe(entry, tmp, &x25_neigh_list) { nb = list_entry(entry, struct x25_neigh, node); if (nb->dev == dev) { __x25_remove_neigh(nb); dev_put(dev); } } write_unlock_bh(&x25_neigh_list_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Dump the registers on an exception we don't know how to process. */
u8 cortex_m3_irq_vec_get(void)
/* Dump the registers on an exception we don't know how to process. */ u8 cortex_m3_irq_vec_get(void)
{ return CM3_SCB_REGS->icsr & CM3_ICSR_VECTACT_MSK; }
EmcraftSystems/u-boot
C++
Other
181
/* Check if the device instance of the selected address is already registered and return its index */
static uint8_t stmpe811_GetInstance(uint16_t DeviceAddr)
/* Check if the device instance of the selected address is already registered and return its index */ static uint8_t stmpe811_GetInstance(uint16_t DeviceAddr)
{ uint8_t idx = 0; for(idx = 0; idx < STMPE811_MAX_INSTANCE ; idx ++) { if(stmpe811[idx] == DeviceAddr) { return idx; } } return 0xFF; }
eclipse-threadx/getting-started
C++
Other
310
/* Initializes the SPI Flash module. Initializes the SPI Flash module */
void spi_flash_init(void)
/* Initializes the SPI Flash module. Initializes the SPI Flash module */ void spi_flash_init(void)
{ LPMCU_MISC_REGS0->PINMUX_SEL_3.reg = \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_0_SEL_SPI_FLASH0_SCK | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_1_SEL_SPI_FLASH0_TXD | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_2_SEL_SPI_FLASH0_SSN | \ LPMCU_MISC_REGS_PINMUX_SEL_3_LP_SIP_3_SEL_SPI_FLASH0_RXD; SPI_FLASH0->MODE_CTRL.reg = SPI_FLASH_MODE_CTRL_RESETVALUE; spi_flash_leave_low_power_mode(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Usually queues have static limitations on the max sectors or segments that we can put in a request. Stacking drivers may have some settings that are dynamic, and thus we have to query the queue whether it is ok to add a new bio_vec to a bio at a given offset or not. If the block device has such limitations, it needs to register a merge_bvec_fn to control the size of bio's sent to it. Note that a block device */
void blk_queue_merge_bvec(struct request_queue *q, merge_bvec_fn *mbfn)
/* Usually queues have static limitations on the max sectors or segments that we can put in a request. Stacking drivers may have some settings that are dynamic, and thus we have to query the queue whether it is ok to add a new bio_vec to a bio at a given offset or not. If the block device has such limitations, it needs to register a merge_bvec_fn to control the size of bio's sent to it. Note that a block device */ void blk_queue_merge_bvec(struct request_queue *q, merge_bvec_fn *mbfn)
{ q->merge_bvec_fn = mbfn; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Verify if the string is end with the sub string. */
BOOLEAN EFIAPI StrEndWith(IN CHAR16 *Str, IN CHAR16 *SubStr)
/* Verify if the string is end with the sub string. */ BOOLEAN EFIAPI StrEndWith(IN CHAR16 *Str, IN CHAR16 *SubStr)
{ CHAR16 *Temp; if ((Str == NULL) || (SubStr == NULL) || (StrLen (Str) < StrLen (SubStr))) { return FALSE; } Temp = Str + StrLen (Str) - StrLen (SubStr); if (StriCmp (Temp, SubStr) == 0) { return TRUE; } else { return FALSE; } }
tianocore/edk2
C++
Other
4,240
/* param base LPUART peripheral base address. return LPUART instance. */
uint32_t LPUART_GetInstance(LPUART_Type *base)
/* param base LPUART peripheral base address. return LPUART instance. */ uint32_t LPUART_GetInstance(LPUART_Type *base)
{ uint32_t instance; for (instance = 0; instance < ARRAY_SIZE(s_lpuartBases); instance++) { if (s_lpuartBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_lpuartBases)); return instance; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Enqueues an incoming SMP request packet for processing. This function always consumes the supplied net_buf. */
WEAK void smp_rx_req(struct smp_transport *smpt, struct net_buf *nb)
/* Enqueues an incoming SMP request packet for processing. This function always consumes the supplied net_buf. */ WEAK void smp_rx_req(struct smp_transport *smpt, struct net_buf *nb)
{ net_buf_put(&smpt->fifo, nb); k_work_submit_to_queue(&smp_work_queue, &smpt->work); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function replaces the original SSIDataNonBlockingPut() API and performs the same actions. A macro is provided in */
long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
/* This function replaces the original SSIDataNonBlockingPut() API and performs the same actions. A macro is provided in */ long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
{ ASSERT(SSIBaseValid(ulBase)); ASSERT((ulData & (0xfffffffe << (HWREG(ulBase + SSI_O_CR0) & SSI_CR0_DSS_M))) == 0); if(HWREG(ulBase + SSI_O_SR) & SSI_SR_TNF) { HWREG(ulBase + SSI_O_DR) = ulData; return(1); } else { return(0); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function is similar to 'lnc_add()', but it does not create a copy of @node but inserts @node to TNC directly. */
static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
/* This function is similar to 'lnc_add()', but it does not create a copy of @node but inserts @node to TNC directly. */ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
{ int err; ubifs_assert(!zbr->leaf); ubifs_assert(zbr->len != 0); err = ubifs_validate_entry(c, node); if (err) { dump_stack(); ubifs_dump_node(c, node); return err; } zbr->leaf = node; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Write characters to LCD display. Note that the bytes for the first character is the last address. */
void sys_led_msg(char *msg)
/* Write characters to LCD display. Note that the bytes for the first character is the last address. */ void sys_led_msg(char *msg)
{ LED_REG(0) = msg[3]; LED_REG(1) = msg[2]; LED_REG(2) = msg[1]; LED_REG(3) = msg[0]; }
EmcraftSystems/u-boot
C++
Other
181
/* Converts a text device path node to Vendor defined PC-ANSI device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenPcAnsi(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Vendor defined PC-ANSI device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenPcAnsi(CHAR16 *TextDeviceNode)
{ VENDOR_DEVICE_PATH *Vendor; Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, (UINT16) sizeof (VENDOR_DEVICE_PATH)); CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid); return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; }
tianocore/edk2
C++
Other
4,240
/* ADC Off. Turn off the ADC to reduce power consumption to a few microamps. */
void adc_power_off(uint32_t adc)
/* ADC Off. Turn off the ADC to reduce power consumption to a few microamps. */ void adc_power_off(uint32_t adc)
{ ADC_CR2(adc) &= ~ADC_CR2_ADON; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* reset PMU register , 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 pmu_deinit(void)
/* reset PMU register , 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 pmu_deinit(void)
{ rcu_periph_reset_enable(RCU_PMURST); rcu_periph_reset_disable(RCU_PMURST); }
liuxuming/trochili
C++
Apache License 2.0
132
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ubifs_add_nnode_dirt - add dirty space to LPT LEB properties. */
void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode)
/* ubifs_add_nnode_dirt - add dirty space to LPT LEB properties. */ void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode)
{ struct ubifs_nnode *np = nnode->parent; if (np) ubifs_add_lpt_dirt(c, np->nbranch[nnode->iip].lnum, c->nnode_sz); else { ubifs_add_lpt_dirt(c, c->lpt_lnum, c->nnode_sz); if (!(c->lpt_drty_flgs & LTAB_DIRTY)) { c->lpt_drty_flgs |= LTAB_DIRTY; ubifs_add_lpt_dirt(c, c->ltab_lnum, c->ltab_sz); } } }
EmcraftSystems/u-boot
C++
Other
181
/* sht15_send_bit() - send an individual bit to the device @data: device state data @val: value of bit to be sent */
static void sht15_send_bit(struct sht15_data *data, int val)
/* sht15_send_bit() - send an individual bit to the device @data: device state data @val: value of bit to be sent */ static void sht15_send_bit(struct sht15_data *data, int val)
{ gpio_set_value(data->pdata->gpio_data, val); ndelay(SHT15_TSU); gpio_set_value(data->pdata->gpio_sck, 1); ndelay(SHT15_TSCKH); gpio_set_value(data->pdata->gpio_sck, 0); ndelay(SHT15_TSCKL); }
robutest/uclinux
C++
GPL-2.0
60
/* This block type provides information for resetting external devices (chips) through the General Purpose Register. */
static int type5_infoblock(struct net_device *dev, u_char count, u_char *p)
/* This block type provides information for resetting external devices (chips) through the General Purpose Register. */ static int type5_infoblock(struct net_device *dev, u_char count, u_char *p)
{ struct de4x5_private *lp = netdev_priv(dev); u_char len = (*p & BLOCK_LEN)+1; if (--count > lp->tcount) { if (*(p+len) < 128) { return dc_infoblock[COMPACT](dev, count, p+len); } else { return dc_infoblock[*(p+len+1)](dev, count, p+len); } } if ((lp->state == INITIALISED) || (lp->media == INIT)) { p+=2; lp->rst = p; srom_exec(dev, lp->rst); } return DE4X5_AUTOSENSE_MS; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute write call back for the Long descriptor V2D1 attribute. */
static ssize_t write_long_des_v2d1(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Long descriptor V2D1 attribute. */ static ssize_t write_long_des_v2d1(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint8_t *value = attr->user_data; if (offset >= sizeof(long_des_v2d1_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(long_des_v2d1_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The ISR processes done list entries and level 3 error handling. */
irqreturn_t asd_hw_isr(int irq, void *dev_id)
/* The ISR processes done list entries and level 3 error handling. */ irqreturn_t asd_hw_isr(int irq, void *dev_id)
{ struct asd_ha_struct *asd_ha = dev_id; u32 chimint = asd_read_reg_dword(asd_ha, CHIMINT); if (!chimint) return IRQ_NONE; asd_write_reg_dword(asd_ha, CHIMINT, chimint); (void) asd_read_reg_dword(asd_ha, CHIMINT); if (chimint & DLAVAIL) asd_process_donelist_isr(asd_ha); if (chimint & COMINT) asd_com_sas_isr(asd_ha); if (chimint & DEVINT) asd_dch_sas_isr(asd_ha); if (chimint & INITERR) asd_rbi_exsi_isr(asd_ha); if (chimint & HOSTERR) asd_hst_pcix_isr(asd_ha); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Return and update the access record in entry. */
UINT64 GetAndUpdateAccNum(IN OUT UINT64 *Entry)
/* Return and update the access record in entry. */ UINT64 GetAndUpdateAccNum(IN OUT UINT64 *Entry)
{ UINT64 Acc; Acc = GetAccNum (Entry); if ((*Entry & IA32_PG_A) != 0) { *Entry &= ~(UINT64)(UINTN)IA32_PG_A; SetAccNum (Entry, 0x7); return (0x7 + ACC_MAX_BIT); } else { if (Acc != 0) { SetAccNum (Entry, Acc - 1); } } return Acc; }
tianocore/edk2
C++
Other
4,240
/* Get integer from char-pointer, set pointer to end of number */
int isdn_getnum(char **p)
/* Get integer from char-pointer, set pointer to end of number */ int isdn_getnum(char **p)
{ int v = -1; while (*p[0] >= '0' && *p[0] <= '9') v = ((v < 0) ? 0 : (v * 10)) + (int) ((*p[0]++) - '0'); return v; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves a pointer to the system configuration table from the SMM System Table based on a specified GUID. */
EFI_STATUS EFIAPI SmmGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
/* Retrieves a pointer to the system configuration table from the SMM System Table based on a specified GUID. */ EFI_STATUS EFIAPI SmmGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
{ UINTN Index; ASSERT (TableGuid != NULL); ASSERT (Table != NULL); *Table = NULL; for (Index = 0; Index < gSmst->NumberOfTableEntries; Index++) { if (CompareGuid (TableGuid, &(gSmst->SmmConfigurationTable[Index].VendorGuid))) { *Table = gSmst->SmmConfigurationTable[Index].VendorTable; return EFI_SUCCESS; } } return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* Timer Enable the Output Compare Fast Mode. When this is enabled, the output compare signal is forced to the compare state by a trigger input, independently of the compare match. This speeds up the setting of the output compare to 3 clock cycles as opposed to at least 5 in the slow mode. This works in the PWM1 and PWM2 modes only. */
void timer_set_oc_fast_mode(uint32_t timer_peripheral, enum tim_oc_id oc_id)
/* Timer Enable the Output Compare Fast Mode. When this is enabled, the output compare signal is forced to the compare state by a trigger input, independently of the compare match. This speeds up the setting of the output compare to 3 clock cycles as opposed to at least 5 in the slow mode. This works in the PWM1 and PWM2 modes only. */ void timer_set_oc_fast_mode(uint32_t timer_peripheral, enum tim_oc_id oc_id)
{ switch (oc_id) { case TIM_OC1: TIM_CCMR1(timer_peripheral) |= TIM_CCMR1_OC1FE; break; case TIM_OC2: TIM_CCMR1(timer_peripheral) |= TIM_CCMR1_OC2FE; break; case TIM_OC3: TIM_CCMR2(timer_peripheral) |= TIM_CCMR2_OC3FE; break; case TIM_OC4: TIM_CCMR2(timer_peripheral) |= TIM_CCMR2_OC4FE; break; case TIM_OC1N: case TIM_OC2N: case TIM_OC3N: break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Check if any values in buffer were set after expected samples. */
static void check_empty_samples(int expected_count)
/* Check if any values in buffer were set after expected samples. */ static void check_empty_samples(int expected_count)
{ int i; for (i = expected_count; i < BUFFER_SIZE; i++) { zassert_equal(INVALID_ADC_VALUE, m_sample_buffer[i], "[%u] should be empty", i); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Report the given negative errno into the store, along with the given formatted message. */
void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,...)
/* Report the given negative errno into the store, along with the given formatted message. */ void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,...)
{ va_list ap; va_start(ap, fmt); xenbus_va_dev_error(dev, err, fmt, ap); va_end(ap); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the driver and device index for an API device index This should be called while the joystick lock is held, to prevent another thread from updating the list */
SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriver **driver, int *driver_index)
/* Get the driver and device index for an API device index This should be called while the joystick lock is held, to prevent another thread from updating the list */ SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriver **driver, int *driver_index)
{ int i, num_joysticks, total_joysticks = 0; if (device_index >= 0) { for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { num_joysticks = SDL_joystick_drivers[i]->GetCount(); if (device_index < num_joysticks) { *driver = SDL_joystick_drivers[i]; *driver_index = device_index; return SDL_TRUE; } device_index -= num_joysticks; total_joysticks += num_joysticks; } } SDL_SetError("There are %d joysticks available", total_joysticks); return SDL_FALSE; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* brief DMA instance 1, channel 4 IRQ handler. */
void EDMA_1_CH4_DriverIRQHandler(void)
/* brief DMA instance 1, channel 4 IRQ handler. */ void EDMA_1_CH4_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(1U, 4U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Invoked when AER service unloaded on a specific Root Port */
void aer_delete_rootport(struct aer_rpc *rpc)
/* Invoked when AER service unloaded on a specific Root Port */ void aer_delete_rootport(struct aer_rpc *rpc)
{ disable_root_aer(rpc); kfree(rpc); }
robutest/uclinux
C++
GPL-2.0
60
/* cdns3_gadget_ep_free_request Free memory occupied by request @ep: endpoint object associated with request @request: request to free memory */
void cdns3_gadget_ep_free_request(struct usb_ep *ep, struct usb_request *request)
/* cdns3_gadget_ep_free_request Free memory occupied by request @ep: endpoint object associated with request @request: request to free memory */ void cdns3_gadget_ep_free_request(struct usb_ep *ep, struct usb_request *request)
{ struct cdns3_request *priv_req = to_cdns3_request(request); if (priv_req->aligned_buf) priv_req->aligned_buf->in_use = 0; trace_cdns3_free_request(priv_req); kfree(priv_req); }
4ms/stm32mp1-baremetal
C++
Other
137
/* ic3_get_mctrl - get control line info @port: port to operate on */
static unsigned int ic3_get_mctrl(struct uart_port *the_port)
/* ic3_get_mctrl - get control line info @port: port to operate on */ static unsigned int ic3_get_mctrl(struct uart_port *the_port)
{ struct ioc3_port *port = get_ioc3_port(the_port); uint32_t shadow; unsigned int ret = 0; if (!port) return 0; shadow = readl(&port->ip_serial_regs->shadow); if (shadow & SHADOW_DCD) ret |= TIOCM_CD; if (shadow & SHADOW_DR) ret |= TIOCM_DSR; if (shadow & SHADOW_CTS) ret |= TIOCM_CTS; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Read the End-of-Conversion Flag. This flag is set after all channels of a regular or injected group have been converted. */
bool adc_eoc(uint32_t adc)
/* ADC Read the End-of-Conversion Flag. This flag is set after all channels of a regular or injected group have been converted. */ bool adc_eoc(uint32_t adc)
{ return (ADC_SR(adc) & ADC_SR_EOC) != 0; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */
void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */ void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
{ assert(handle && dmaHandle); uint32_t instance = SAI_GetInstance(base); memset(handle, 0, sizeof(*handle)); handle->dmaHandle = dmaHandle; handle->callback = callback; handle->userData = userData; handle->state = kSAI_Idle; s_edmaPrivateHandle[instance][0].base = base; s_edmaPrivateHandle[instance][0].handle = handle; EDMA_InstallTCDMemory(dmaHandle, (edma_tcd_t *)(STCD_ADDR(handle->tcd)), SAI_XFER_QUEUE_SIZE); EDMA_SetCallback(dmaHandle, SAI_TxEDMACallback, &s_edmaPrivateHandle[instance][0]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note, the delays are in there as a caution to ensure that the reset has time to take effect and then complete. Since the datasheet does not currently specify the exact sequence, we have chosen something that seems to work with our device. */
static void ks_soft_reset(struct ks_net *ks, unsigned op)
/* Note, the delays are in there as a caution to ensure that the reset has time to take effect and then complete. Since the datasheet does not currently specify the exact sequence, we have chosen something that seems to work with our device. */ static void ks_soft_reset(struct ks_net *ks, unsigned op)
{ ks_wrreg16(ks, KS_IER, 0x0000); ks_wrreg16(ks, KS_GRR, op); mdelay(10); ks_wrreg16(ks, KS_GRR, 0); mdelay(1); }
robutest/uclinux
C++
GPL-2.0
60
/* If Count is greater than 63, then ASSERT(). */
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
/* If Count is greater than 63, then ASSERT(). */ UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
{ ASSERT (Count < 64); return InternalMathLShiftU64 (Operand, Count); }
tianocore/edk2
C++
Other
4,240
/* This routine will update the HBA index of a queue to reflect consumption of Work Queue Entries by the HBA. When the HBA indicates that it has consumed an entry the host calls this function to update the queue's internal pointers. This routine returns the number of entries that were consumed by the HBA. */
static uint32_t lpfc_sli4_wq_release(struct lpfc_queue *q, uint32_t index)
/* This routine will update the HBA index of a queue to reflect consumption of Work Queue Entries by the HBA. When the HBA indicates that it has consumed an entry the host calls this function to update the queue's internal pointers. This routine returns the number of entries that were consumed by the HBA. */ static uint32_t lpfc_sli4_wq_release(struct lpfc_queue *q, uint32_t index)
{ uint32_t released = 0; if (q->hba_index == index) return 0; do { q->hba_index = ((q->hba_index + 1) % q->entry_count); released++; } while (q->hba_index != index); return released; }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int list_init(struct list_t *self_p)
/* This file is part of the Simba project. */ int list_init(struct list_t *self_p)
{ ASSERTN(self_p != NULL, EINVAL); self_p->head_p = NULL; self_p->tail_p = NULL; return (0); }
eerimoq/simba
C++
Other
337
/* Atomically swap in the new signal mask, and wait for a signal. */
asmlinkage int do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw)
/* Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw)
{ mask &= _BLOCKABLE; spin_lock_irq(&current->sighand->siglock); current->saved_sigmask = current->blocked; siginitset(&current->blocked, mask); recalc_sigpending(); spin_unlock_irq(&current->sighand->siglock); regs->r0 = EINTR; regs->r19 = 1; current->state = TASK_INTERRUPTIBLE; schedule(); set_thread_flag(TIF_RESTORE_SIGMASK); return -ERESTARTNOHAND; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
void USBD_Connect(BOOL con)
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */ void USBD_Connect(BOOL con)
{ if (con) { MXC_USB->dev_intfl = 0xFFFF; MXC_USB->dev_inten |= CONNECT_INTS; MXC_USB->ep[0] |= MXC_F_USB_EP_INT_EN; MXC_USB->dev_cn |= (MXC_F_USB_DEV_CN_CONNECT | MXC_F_USB_DEV_CN_FIFO_MODE); } else { MXC_USB->dev_inten &= ~CONNECT_INTS; MXC_USB->ep[0] &= ~MXC_F_USB_EP_INT_EN; MXC_USB->dev_cn &= ~MXC_F_USB_DEV_CN_CONNECT; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Strip the trailing slash from the parser's output buffer, unless the trailing slash stands for the root directory. */
STATIC VOID ParserStripSlash(IN CHAR8 *Buffer, IN OUT UINTN *Position)
/* Strip the trailing slash from the parser's output buffer, unless the trailing slash stands for the root directory. */ STATIC VOID ParserStripSlash(IN CHAR8 *Buffer, IN OUT UINTN *Position)
{ ASSERT (*Position >= 1); ASSERT (Buffer[*Position - 1] == '/'); if (*Position == 1) { return; } (*Position)--; }
tianocore/edk2
C++
Other
4,240
/* Check whether the module is connected to an access point. */
uint8_t ES_WIFI_IsConnected(ES_WIFIObject_t *Obj)
/* Check whether the module is connected to an access point. */ uint8_t ES_WIFI_IsConnected(ES_WIFIObject_t *Obj)
{ ES_WIFI_Status_t ret ; LOCK_WIFI(); sprintf((char*)Obj->CmdData,"CS\r"); ret = AT_ExecuteCommand(Obj, Obj->CmdData, Obj->CmdData); if(ret == ES_WIFI_STATUS_OK) { AT_ParseIsConnected((char *)Obj->CmdData, &(Obj->NetSettings.IsConnected)); } UNLOCK_WIFI(); return Obj->NetSettings.IsConnected; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns: return value of flic_get_all_irqs Note: Retry and increase buffer size until flic_get_all_irqs either returns a value >= 0 or a negative error code. -ENOMEM is an exception, which means the buffer is too small and we should try again. Other negative error codes can be -EFAULT and -EINVAL which we ignore at this point */
static int __get_all_irqs(KVMS390FLICState *flic, void **buf, int len)
/* Returns: return value of flic_get_all_irqs Note: Retry and increase buffer size until flic_get_all_irqs either returns a value >= 0 or a negative error code. -ENOMEM is an exception, which means the buffer is too small and we should try again. Other negative error codes can be -EFAULT and -EINVAL which we ignore at this point */ static int __get_all_irqs(KVMS390FLICState *flic, void **buf, int len)
{ int r; do { r = flic_get_all_irqs(flic, *buf, len); if (r >= 0) { break; } len *= 2; *buf = g_try_realloc(*buf, len); if (!buf) { return -ENOMEM; } } while (r == -ENOMEM && len <= KVM_S390_FLIC_MAX_BUFFER); return r; }
ve3wwg/teensy3_qemu
C++
Other
15
/* unhash a timewait socket from bind hash, if hashed. bind hash lock must be held by caller. Returns 1 if caller should call inet_twsk_put() after lock release. */
int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, struct inet_hashinfo *hashinfo)
/* unhash a timewait socket from bind hash, if hashed. bind hash lock must be held by caller. Returns 1 if caller should call inet_twsk_put() after lock release. */ int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, struct inet_hashinfo *hashinfo)
{ struct inet_bind_bucket *tb = tw->tw_tb; if (!tb) return 0; __hlist_del(&tw->tw_bind_node); tw->tw_tb = NULL; inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free previously allocated EC group object using EcGroupInit(). */
VOID EFIAPI CryptoServiceEcGroupFree(IN VOID *EcGroup)
/* Free previously allocated EC group object using EcGroupInit(). */ VOID EFIAPI CryptoServiceEcGroupFree(IN VOID *EcGroup)
{ CALL_VOID_BASECRYPTLIB (Ec.Services.GroupFree, EcGroupFree, (EcGroup)); }
tianocore/edk2
C++
Other
4,240
/* Disables simultaneously the two DAC channels software triggers. */
void DAC_DisableDualSoftwareTrigger(void)
/* Disables simultaneously the two DAC channels software triggers. */ void DAC_DisableDualSoftwareTrigger(void)
{ DAC->SWTRG &= DUAL_SWTRIG_RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* a r e B o u n d s C o n s i s t e n t */
returnValue QProblem_areBoundsConsistent(QProblem *_THIS, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new)
/* a r e B o u n d s C o n s i s t e n t */ returnValue QProblem_areBoundsConsistent(QProblem *_THIS, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new)
{ int i; if (lb_new && ub_new) { for (i = 0; i < QProblem_getNV(_THIS); ++i) { if (lb_new[i] > ub_new[i]+QPOASES_EPS) { return RET_QP_INFEASIBLE; } } } if (lbA_new && ubA_new) { for (i = 0; i < QProblem_getNC(_THIS); ++i) { if (lbA_new[i] > ubA_new[i]+QPOASES_EPS) { return RET_QP_INFEASIBLE; } } } return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Reads and returns the current value of GS. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadGs(VOID)
/* Reads and returns the current value of GS. This function is only available on IA-32 and X64. */ UINT16 EFIAPI AsmReadGs(VOID)
{ UINT16 Data; __asm__ __volatile__ ( "mov %%gs, %0" :"=a" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Prepare and configure most of the parts, if the controller has a way of detecting VBUS activity it should be enabled here. Only udc_skeleton_enable() makes device visible to the host. */
static int udc_skeleton_init(const struct device *dev)
/* Prepare and configure most of the parts, if the controller has a way of detecting VBUS activity it should be enabled here. Only udc_skeleton_enable() makes device visible to the host. */ static int udc_skeleton_init(const struct device *dev)
{ if (udc_ep_enable_internal(dev, USB_CONTROL_EP_OUT, USB_EP_TYPE_CONTROL, 64, 0)) { LOG_ERR("Failed to enable control endpoint"); return -EIO; } if (udc_ep_enable_internal(dev, USB_CONTROL_EP_IN, USB_EP_TYPE_CONTROL, 64, 0)) { LOG_ERR("Failed to enable control endpoint"); return -EIO; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* sw_print_packet() prints the contents of a SideWinder packet. */
static void sw_print_packet(char *name, int length, unsigned char *buf, char bits)
/* sw_print_packet() prints the contents of a SideWinder packet. */ static void sw_print_packet(char *name, int length, unsigned char *buf, char bits)
{ int i; printk(KERN_INFO "sidewinder.c: %s packet, %d bits. [", name, length); for (i = (((length + 3) >> 2) - 1); i >= 0; i--) printk("%x", (int)sw_get_bits(buf, i << 2, 4, bits)); printk("]\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* Backup function for HDiskImage. Only a few fields need to be backup. This is for making the Disk buffer refresh as few as possible. */
EFI_STATUS HMemImageBackup(VOID)
/* Backup function for HDiskImage. Only a few fields need to be backup. This is for making the Disk buffer refresh as few as possible. */ EFI_STATUS HMemImageBackup(VOID)
{ HMemImageBackupVar.Offset = HMemImage.Offset; HMemImageBackupVar.Size = HMemImage.Size; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Disable an individual interrupt (IRQ) The irq_disable() routine is provided by the interrupt controller driver due to the IRQ virtualization that is performed by this platform. See the comments in _interrupt_vector_allocate() for more information regarding IRQ virtualization. */
__pinned_func void arch_irq_disable(unsigned int irq)
/* Disable an individual interrupt (IRQ) The irq_disable() routine is provided by the interrupt controller driver due to the IRQ virtualization that is performed by this platform. See the comments in _interrupt_vector_allocate() for more information regarding IRQ virtualization. */ __pinned_func void arch_irq_disable(unsigned int irq)
{ if (IS_IOAPIC_IRQ(irq)) { z_ioapic_irq_disable(irq); } else { z_loapic_irq_disable(irq - z_loapic_irq_base()); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed return UNZ_OK if there is no problem. */
int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info)
/* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed return UNZ_OK if there is no problem. */ int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info)
{ unz64_s* s; if (file==NULL) return UNZ_PARAMERROR; s=(unz64_s*)file; *pglobal_info=s->gi; return UNZ_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function inserts command node to cmdfreeq after cleans it. Requires priv->driver_lock held. */
static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode)
/* This function inserts command node to cmdfreeq after cleans it. Requires priv->driver_lock held. */ static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode)
{ lbs_deb_enter(LBS_DEB_HOST); if (!cmdnode) goto out; cmdnode->callback = NULL; cmdnode->callback_arg = 0; memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); list_add_tail(&cmdnode->list, &priv->cmdfreeq); out: lbs_deb_leave(LBS_DEB_HOST); }
robutest/uclinux
C++
GPL-2.0
60
/* If Sm3Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sm3Final(IN OUT VOID *Sm3Context, OUT UINT8 *HashValue)
/* If Sm3Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ BOOLEAN EFIAPI Sm3Final(IN OUT VOID *Sm3Context, OUT UINT8 *HashValue)
{ if ((Sm3Context == NULL) || (HashValue == NULL)) { return FALSE; } ossl_sm3_final (HashValue, (SM3_CTX *)Sm3Context); return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if the class ids of the driver match the class id of the device, otherwise 0. */
static int i2o_bus_match(struct device *dev, struct device_driver *drv)
/* Returns 1 if the class ids of the driver match the class id of the device, otherwise 0. */ static int i2o_bus_match(struct device *dev, struct device_driver *drv)
{ struct i2o_device *i2o_dev = to_i2o_device(dev); struct i2o_driver *i2o_drv = to_i2o_driver(drv); struct i2o_class_id *ids = i2o_drv->classes; if (ids) while (ids->class_id != I2O_CLASS_END) { if (ids->class_id == i2o_dev->lct_data.class_id) return 1; ids++; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Maximum drive strength is 24mA. This value can be lowered using DRVCTRLx registers, some pins have 8 steps (3 bits size encoded) some have 4 steps (2 bits size encoded). */
static int pfc_rcar_set_drive_strength(uintptr_t pfc_base, uint16_t pin, uint8_t strength)
/* Maximum drive strength is 24mA. This value can be lowered using DRVCTRLx registers, some pins have 8 steps (3 bits size encoded) some have 4 steps (2 bits size encoded). */ static int pfc_rcar_set_drive_strength(uintptr_t pfc_base, uint16_t pin, uint8_t strength)
{ uint8_t offset, size, step; uint32_t reg, val; reg = pfc_rcar_get_drive_reg(pin, &offset, &size); if (reg == 0U) { return -EINVAL; } step = PFC_RCAR_DRIVE_STEP(size); if ((strength < step) || (strength > PFC_RCAR_DRIVE_MAX)) { return -EINVAL; } strength = (strength / step) - 1U; val = sys_read32(pfc_base + reg); val &= ~GENMASK(offset + size - 1U, offset); val |= strength << offset; pfc_rcar_write(pfc_base, reg, val); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* register a pointer to a descriptor block This function registers a pointer to a descriptor block containing all descriptors for the device. */
static void usb_register_descriptors(const uint8_t *usb_descriptors)
/* register a pointer to a descriptor block This function registers a pointer to a descriptor block containing all descriptors for the device. */ static void usb_register_descriptors(const uint8_t *usb_descriptors)
{ usb_dev.descriptors = usb_descriptors; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Pat the watchdog whenever device is written to. */
static ssize_t pikawdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
/* Pat the watchdog whenever device is written to. */ static ssize_t pikawdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
{ if (!len) return 0; if (!nowayout) { size_t i; pikawdt_private.expect_close = 0; for (i = 0; i < len; i++) { char c; if (get_user(c, data + i)) return -EFAULT; if (c == 'V') { pikawdt_private.expect_close = 42; break; } } } pikawdt_keepalive(); return len; }
robutest/uclinux
C++
GPL-2.0
60
/* About: Purpose Implementation of the HIDReportRequest methods. Indicates the type of report targetted by a SET_REPORT or GET_REPORT request. */
unsigned char HIDReportRequest_GetReportType(const USBGenericRequest *request)
/* About: Purpose Implementation of the HIDReportRequest methods. Indicates the type of report targetted by a SET_REPORT or GET_REPORT request. */ unsigned char HIDReportRequest_GetReportType(const USBGenericRequest *request)
{ return ((USBGenericRequest_GetValue(request) >> 8) & 0xFF); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns 0 on success, negative value on error. */
int gpio_direction_input(unsigned gpio)
/* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns 0 on success, negative value on error. */ int gpio_direction_input(unsigned gpio)
{ struct gpio_desc desc; int ret; ret = gpio_to_device(gpio, &desc); if (ret) return ret; ret = check_reserved(&desc, "dir_input"); if (ret) return ret; return gpio_get_ops(desc.dev)->direction_input(desc.dev, desc.offset); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Converts a text device path node to Hardware Vendor device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmuThread(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Hardware Vendor device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmuThread(IN CHAR16 *TextDeviceNode)
{ CHAR16 *Str; VENDOR_DEVICE_PATH *Vendor; Str = GetNextParamStr (&TextDeviceNode); Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode ( HARDWARE_DEVICE_PATH, HW_VENDOR_DP, (UINT16)sizeof (VENDOR_DEVICE_PATH) ); CopyGuid (&Vendor->Guid, &gEmuThreadThunkProtocolGuid); return (EFI_DEVICE_PATH_PROTOCOL *)Vendor; }
tianocore/edk2
C++
Other
4,240
/* If JumpBuffer is NULL, then ASSERT(). For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). */
RETURNS_TWICE UINTN EFIAPI SetJump(OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer)
/* If JumpBuffer is NULL, then ASSERT(). For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT(). */ RETURNS_TWICE UINTN EFIAPI SetJump(OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer)
{ InternalAssertJumpBuffer (JumpBuffer); return 0; }
tianocore/edk2
C++
Other
4,240
/* Wraps given time within the range of 0 to ISOAL_TIME_WRAPPING_POINT_US. */
uint32_t isoal_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us)
/* Wraps given time within the range of 0 to ISOAL_TIME_WRAPPING_POINT_US. */ uint32_t isoal_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us)
{ LL_ASSERT(time_now_us <= ISOAL_TIME_WRAPPING_POINT_US); uint32_t result = ((uint64_t)time_now_us + ISOAL_TIME_SPAN_FULL_US + time_diff_us) % ((uint64_t)ISOAL_TIME_SPAN_FULL_US); return result; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* dump midi data return 0 : enqueued non-zero : invalid - ignored */
int snd_seq_oss_midi_putc(struct seq_oss_devinfo *dp, int dev, unsigned char c, struct snd_seq_event *ev)
/* dump midi data return 0 : enqueued non-zero : invalid - ignored */ int snd_seq_oss_midi_putc(struct seq_oss_devinfo *dp, int dev, unsigned char c, struct snd_seq_event *ev)
{ struct seq_oss_midi *mdev; if ((mdev = get_mididev(dp, dev)) == NULL) return -ENODEV; if (snd_midi_event_encode_byte(mdev->coder, c, ev) > 0) { snd_seq_oss_fill_addr(dp, ev, mdev->client, mdev->port); snd_use_lock_free(&mdev->use_lock); return 0; } snd_use_lock_free(&mdev->use_lock); return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks to make sure that a complete, valid BER-encoded length is in the buffer. */
static gboolean ber_len_ok(tvbuff_t *tvb, int offset)
/* Checks to make sure that a complete, valid BER-encoded length is in the buffer. */ static gboolean ber_len_ok(tvbuff_t *tvb, int offset)
{ guint8 ch; if (tvb_offset_exists(tvb, offset)) { ch = tvb_get_guint8(tvb, offset); offset++; if (!(ch & 0x80)) { return TRUE; } else if (tvb_offset_exists(tvb, offset)) { ch = tvb_get_guint8(tvb, offset); offset++; if (!(ch & 0x80)) { return TRUE; } else if (tvb_offset_exists(tvb, offset)) { ch = tvb_get_guint8(tvb, offset); offset++; if (!(ch & 0x80)) { return TRUE; } else if (tvb_offset_exists(tvb, offset)) { ch = tvb_get_guint8(tvb, offset); if (!(ch & 0x80)) { return TRUE; } } } } } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the threshold for activity detection for all 3-axis */
int32_t adxl372_set_activity_threshold(adxl372_dev *dev, adxl372_th_activity act, uint16_t thresh, bool referenced, bool enable)
/* Set the threshold for activity detection for all 3-axis */ int32_t adxl372_set_activity_threshold(adxl372_dev *dev, adxl372_th_activity act, uint16_t thresh, bool referenced, bool enable)
{ uint8_t th_val_h, th_val_l, i; int32_t ret = 0; th_val_h = (thresh >> 3); th_val_l = (thresh << 5) | (referenced << 1) | enable; for (i = 0; i < 3; i++) { ret |= adxl372_spi_reg_write(dev, adxl372_th_reg_addr_h[act][i], th_val_h); ret |= adxl372_spi_reg_write(dev, adxl372_th_reg_addr_l[act][i], th_val_l); } return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Loosely based on generic HAVE_PCI_MMAP implementation in drivers/pci/pci-sysfs.c */
static int hose_mmap_page_range(struct pci_controller *hose, struct vm_area_struct *vma, enum pci_mmap_state mmap_type, int sparse)
/* Loosely based on generic HAVE_PCI_MMAP implementation in drivers/pci/pci-sysfs.c */ static int hose_mmap_page_range(struct pci_controller *hose, struct vm_area_struct *vma, enum pci_mmap_state mmap_type, int sparse)
{ unsigned long base; if (mmap_type == pci_mmap_mem) base = sparse ? hose->sparse_mem_base : hose->dense_mem_base; else base = sparse ? hose->sparse_io_base : hose->dense_io_base; vma->vm_pgoff += base >> PAGE_SHIFT; vma->vm_flags |= (VM_IO | VM_RESERVED); return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get low 32 bits of Redirection Table entry. This routine reads the low-order 32 bits of a Redirection Table entry. */
static __pinned_func uint32_t ioApicRedGetLo(unsigned int irq)
/* Get low 32 bits of Redirection Table entry. This routine reads the low-order 32 bits of a Redirection Table entry. */ static __pinned_func uint32_t ioApicRedGetLo(unsigned int irq)
{ int32_t offset = IOAPIC_REDTBL + (irq << 1); return __IoApicGet(offset); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Create a cancellation point in the calling thread. See IEEE 1003.1 */
void pthread_testcancel(void)
/* Create a cancellation point in the calling thread. See IEEE 1003.1 */ void pthread_testcancel(void)
{ struct posix_thread *t; bool cancel_pended = false; K_SPINLOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); if (t == NULL) { K_SPINLOCK_BREAK; } if (t->attr.cancelstate != PTHREAD_CANCEL_ENABLE) { K_SPINLOCK_BREAK; } if (t->attr.cancelpending) { cancel_pended = true; t->attr.cancelstate = PTHREAD_CANCEL_DISABLE; } } if (cancel_pended) { posix_thread_finalize(t, PTHREAD_CANCELED); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Obtains the base address of the flash memory available to the user program. This is basically the first address in the flashLayout table. */
blt_addr FlashGetUserProgBaseAddress(void)
/* Obtains the base address of the flash memory available to the user program. This is basically the first address in the flashLayout table. */ blt_addr FlashGetUserProgBaseAddress(void)
{ blt_addr result; result = flashLayout[0].sector_start; return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Remove Text Input Device from Consplitter Text Input list. */
EFI_STATUS ConSplitterTextInDeleteDevice(IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn)
/* Remove Text Input Device from Consplitter Text Input list. */ EFI_STATUS ConSplitterTextInDeleteDevice(IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn)
{ UINTN Index; for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) { if (Private->TextInList[Index] == TextIn) { for ( ; Index < Private->CurrentNumberOfConsoles - 1; Index++) { Private->TextInList[Index] = Private->TextInList[Index + 1]; } Private->CurrentNumberOfConsoles--; return EFI_SUCCESS; } } return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* USB Device Set Address Function Parameters: adr: USB Device Address Return Value: None */
void USBD_SetAddress(uint32_t adr, uint32_t setup)
/* USB Device Set Address Function Parameters: adr: USB Device Address Return Value: None */ void USBD_SetAddress(uint32_t adr, uint32_t setup)
{ if (!setup) { USBHSD->DEVCMDSTAT &= ~USBHSD_DEVCMDSTAT_DEV_ADDR_MASK; USBHSD->DEVCMDSTAT |= adr | USBHSD_DEVCMDSTAT_DEV_EN_MASK; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* atl1e_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */
static void atl1e_irq_disable(struct atl1e_adapter *adapter)
/* atl1e_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */ static void atl1e_irq_disable(struct atl1e_adapter *adapter)
{ atomic_inc(&adapter->irq_sem); AT_WRITE_REG(&adapter->hw, REG_IMR, 0); AT_WRITE_FLUSH(&adapter->hw); synchronize_irq(adapter->pdev->irq); }
robutest/uclinux
C++
GPL-2.0
60
/* If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address, except when the originator is one of the endpoints of a point-to-point link with a 31-bit mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network environment (e.g. PPP link). */
BOOLEAN EFIAPI NetIp4IsUnicast(IN IP4_ADDR Ip, IN IP4_ADDR NetMask)
/* If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address, except when the originator is one of the endpoints of a point-to-point link with a 31-bit mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network environment (e.g. PPP link). */ BOOLEAN EFIAPI NetIp4IsUnicast(IN IP4_ADDR Ip, IN IP4_ADDR NetMask)
{ INTN MaskLength; ASSERT (NetMask != 0); if ((Ip == 0) || IP4_IS_LOCAL_BROADCAST (Ip)) { return FALSE; } MaskLength = NetGetMaskLength (NetMask); ASSERT ((MaskLength >= 0) && (MaskLength <= IP4_MASK_NUM)); if (MaskLength < 31) { if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) { return FALSE; } } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Returns a pointer to the start of the keydata array of the node pointed to by the node header */
static char * befs_bt_keydata(befs_btree_node *node)
/* Returns a pointer to the start of the keydata array of the node pointed to by the node header */ static char * befs_bt_keydata(befs_btree_node *node)
{ return (char *) ((void *) node->od_node + sizeof (befs_btree_nodehead)); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified PMU flag is set or not. */
uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag)
/* Checks whether the specified PMU flag is set or not. */ uint8_t PMU_ReadStatusFlag(PMU_FLAG_T flag)
{ uint8_t bit; if ((PMU->CSTS & flag) != (uint32_t)RESET) { bit = SET; } else { bit = RESET; } return bit; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Set specified feature to a given hub port. */
EFI_STATUS PeiHubSetPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
/* Set specified feature to a given hub port. */ EFI_STATUS PeiHubSetPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
{ EFI_USB_DEVICE_REQUEST DeviceRequest; ZeroMem (&DeviceRequest, sizeof (EFI_USB_DEVICE_REQUEST)); DeviceRequest.RequestType = USB_HUB_SET_PORT_FEATURE_REQ_TYPE; DeviceRequest.Request = USB_HUB_SET_PORT_FEATURE; DeviceRequest.Value = Value; DeviceRequest.Index = Port; return UsbIoPpi->UsbControlTransfer ( PeiServices, UsbIoPpi, &DeviceRequest, EfiUsbNoData, PcdGet32 (PcdUsbTransferTimeoutValue), NULL, 0 ); }
tianocore/edk2
C++
Other
4,240
/* The details are implementation specific, but it can go as far as powering off UDC completely and disable its data line pullups. */
static void usb_gadget_udc_stop(struct usb_udc *udc)
/* The details are implementation specific, but it can go as far as powering off UDC completely and disable its data line pullups. */ static void usb_gadget_udc_stop(struct usb_udc *udc)
{ udc->gadget->ops->udc_stop(udc->gadget); }
4ms/stm32mp1-baremetal
C++
Other
137
/* At some point in the boot process, we get asked to set up our timing infrastructure. The kernel doesn't expect timer interrupts before this, but we cleverly initialized the "blocked_interrupts" field of "struct lguest_data" so that timer interrupts were blocked until now. */
static void lguest_time_init(void)
/* At some point in the boot process, we get asked to set up our timing infrastructure. The kernel doesn't expect timer interrupts before this, but we cleverly initialized the "blocked_interrupts" field of "struct lguest_data" so that timer interrupts were blocked until now. */ static void lguest_time_init(void)
{ set_irq_handler(0, lguest_time_irq); clocksource_register(&lguest_clock); lguest_clockevent.cpumask = cpumask_of(0); clockevents_register_device(&lguest_clockevent); enable_lguest_irq(0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* asd_read_ocm - read on chip memory (OCM) @asd_ha: pointer to the host adapter structure */
int asd_read_ocm(struct asd_ha_struct *asd_ha)
/* asd_read_ocm - read on chip memory (OCM) @asd_ha: pointer to the host adapter structure */ int asd_read_ocm(struct asd_ha_struct *asd_ha)
{ int err; struct asd_ocm_dir *dir; if (asd_hwi_check_ocm_access(asd_ha)) return -1; dir = kmalloc(sizeof(*dir), GFP_KERNEL); if (!dir) { asd_printk("no memory for ocm dir\n"); return -ENOMEM; } err = asd_read_ocm_dir(asd_ha, dir, 0); if (err) goto out; err = asd_get_bios_chim(asd_ha, dir); out: kfree(dir); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* This function deletes Image package from a package list node. This is a internal function. */
EFI_STATUS RemoveImagePackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
/* This function deletes Image package from a package list node. This is a internal function. */ EFI_STATUS RemoveImagePackages(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList)
{ HII_IMAGE_PACKAGE_INSTANCE *Package; EFI_STATUS Status; Package = PackageList->ImagePkg; if (Package == NULL) { return EFI_SUCCESS; } Status = InvokeRegisteredFunction ( Private, EFI_HII_DATABASE_NOTIFY_REMOVE_PACK, (VOID *)Package, EFI_HII_PACKAGE_IMAGES, Handle ); if (EFI_ERROR (Status)) { return Status; } PackageList->PackageListHdr.PackageLength -= Package->ImagePkgHdr.Header.Length; FreePool (Package->ImageBlock); if (Package->PaletteBlock != NULL) { FreePool (Package->PaletteBlock); } FreePool (Package); PackageList->ImagePkg = NULL; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This helper function allocates and initializes UBIFS write-buffers. Returns zero in case of success and %-ENOMEM in case of failure. */
static int alloc_wbufs(struct ubifs_info *c)
/* This helper function allocates and initializes UBIFS write-buffers. Returns zero in case of success and %-ENOMEM in case of failure. */ static int alloc_wbufs(struct ubifs_info *c)
{ int i, err; c->jheads = kzalloc(c->jhead_cnt * sizeof(struct ubifs_jhead), GFP_KERNEL); if (!c->jheads) return -ENOMEM; for (i = 0; i < c->jhead_cnt; i++) { INIT_LIST_HEAD(&c->jheads[i].buds_list); err = ubifs_wbuf_init(c, &c->jheads[i].wbuf); if (err) return err; c->jheads[i].wbuf.sync_callback = &bud_wbuf_callback; c->jheads[i].wbuf.jhead = i; } c->jheads[BASEHD].wbuf.dtype = UBI_SHORTTERM; c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; c->jheads[GCHD].wbuf.no_timer = 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Print torture statistics. Caller must ensure that there is only one call to this function at a given time!!! This is normally accomplished by relying on the module system to only have one copy of the module loaded, and then by giving the rcu_torture_stats kthread full control (or the init/cleanup functions when rcu_torture_stats thread is not running). */
static void rcu_torture_stats_print(void)
/* Print torture statistics. Caller must ensure that there is only one call to this function at a given time!!! This is normally accomplished by relying on the module system to only have one copy of the module loaded, and then by giving the rcu_torture_stats kthread full control (or the init/cleanup functions when rcu_torture_stats thread is not running). */ static void rcu_torture_stats_print(void)
{ int cnt; cnt = rcu_torture_printk(printk_buf); printk(KERN_ALERT "%s", printk_buf); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the size of the PPTT Processor Hierarchy Node (Type 0) given a Processor Hierarchy Info CM object. */
STATIC UINT32 GetProcHierarchyNodeSize(IN CONST CM_ARM_PROC_HIERARCHY_INFO *Node)
/* Returns the size of the PPTT Processor Hierarchy Node (Type 0) given a Processor Hierarchy Info CM object. */ STATIC UINT32 GetProcHierarchyNodeSize(IN CONST CM_ARM_PROC_HIERARCHY_INFO *Node)
{ ASSERT (Node != NULL); return sizeof (EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR) + (Node->NoOfPrivateResources * sizeof (UINT32)); }
tianocore/edk2
C++
Other
4,240
/* Fills buf with a zero terminated PnP ident string for the id1/id2 pair. For convenience the return is the passed in buffer pointer. */
static char* codec_id(u16 id1, u16 id2, char *buf)
/* Fills buf with a zero terminated PnP ident string for the id1/id2 pair. For convenience the return is the passed in buffer pointer. */ static char* codec_id(u16 id1, u16 id2, char *buf)
{ if(id1&0x8080) { snprintf(buf, CODEC_ID_BUFSZ, "0x%04x:0x%04x", id1, id2); } else { buf[0] = (id1 >> 8); buf[1] = (id1 & 0xFF); buf[2] = (id2 >> 8); snprintf(buf+3, CODEC_ID_BUFSZ - 3, "%d", id2&0xFF); } return buf; }
robutest/uclinux
C++
GPL-2.0
60
/* Fill the LCD buffer with the specified color. */
void ili9488_fill(ili9488_color_t ul_color)
/* Fill the LCD buffer with the specified color. */ void ili9488_fill(ili9488_color_t ul_color)
{ uint32_t dw; ili9488_set_cursor_position(0, 0); ili9488_write_ram_prepare(); for (dw = ILI9488_LCD_WIDTH * ILI9488_LCD_HEIGHT; dw > 0; dw--) { ili9488_write_ram(ul_color); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Determine the apicid of the first cpu on a blade. */
static int __init blade_to_first_apicid(int blade)
/* Determine the apicid of the first cpu on a blade. */ static int __init blade_to_first_apicid(int blade)
{ int cpu; for_each_present_cpu(cpu) if (blade == uv_cpu_to_blade_id(cpu)) return per_cpu(x86_cpu_to_apicid, cpu); return -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */
static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */ static uint32_t overlay_get_target_phandle(const void *fdto, int fragment)
{ const fdt32_t *val; int len; val = fdt_getprop(fdto, fragment, "target", &len); if (!val) return 0; if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1)) return (uint32_t)-1; return fdt32_to_cpu(*val); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup the microcontroller for communication with the PHY. */
static void prvResetMAC(void)
/* Setup the microcontroller for communication with the PHY. */ static void prvResetMAC(void)
{ SYSTEM.MSTPCRB.BIT.MSTPB15 = 0; vTaskDelay( 100 / portTICK_RATE_MS ); EDMAC.EDMR.BIT.SWR = 1; vTaskDelay( 500 / portTICK_RATE_MS );}
apopple/Pandaboard-FreeRTOS
C++
null
25
/* user_recovery_dirname is protected by the nfsd_mutex since it's only accessed when nfsd is starting. */
static void nfs4_set_recdir(char *recdir)
/* user_recovery_dirname is protected by the nfsd_mutex since it's only accessed when nfsd is starting. */ static void nfs4_set_recdir(char *recdir)
{ strcpy(user_recovery_dirname, recdir); }
robutest/uclinux
C++
GPL-2.0
60
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
{ GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_TIM2_CLK_ENABLE(); __HAL_RCC_TIM3_CLK_ENABLE(); __HAL_RCC_TIM4_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = GPIO_AF1_TIM2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Alternate = GPIO_AF2_TIM3; GPIO_InitStruct.Pin = GPIO_PIN_4; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); GPIO_InitStruct.Alternate = GPIO_AF2_TIM4; GPIO_InitStruct.Pin = GPIO_PIN_6; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Set the specified Signal Flags of an active thread. */
int32_t svcSignalSet(osThreadId thread_id, int32_t signals)
/* Set the specified Signal Flags of an active thread. */ int32_t svcSignalSet(osThreadId thread_id, int32_t signals)
{ return (int32_t)0x80000000U; } if ((uint32_t)signals & (0xFFFFFFFFU << osFeature_Signals)) { return (int32_t)0x80000000U; } sig = (int32_t)ptcb->events; rt_evt_set((uint16_t)signals, ptcb->task_id); return sig; }
labapart/polymcu
C++
null
201
/* Configure RTC interrupt mode. This function can be used to enable/disable rtc time/alarm interrupt. */
void RTCIntCfg(unsigned long ulCfg)
/* Configure RTC interrupt mode. This function can be used to enable/disable rtc time/alarm interrupt. */ void RTCIntCfg(unsigned long ulCfg)
{ unsigned long ulTmpReg = 0; xASSERT(ulCfg != 0); if(ulCfg & 0x0000FFFF) { ulTmpReg = xHWREG(RTC_BASE + RTC_CIIR); ulTmpReg &= ~((ulCfg >> 8) & 0xFF); ulTmpReg |= ((ulCfg >> 0) & 0xFF); xHWREG(RTC_BASE + RTC_CIIR) = ulTmpReg; } if(ulCfg & 0xFFFF0000) { ulTmpReg = xHWREG(RTC_BASE + RTC_AMR); ulTmpReg &= ~((ulCfg >> 24) & 0xFF); ulTmpReg |= ((ulCfg >> 16) & 0xFF); xHWREG(RTC_BASE + RTC_AMR) = ulTmpReg; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI S3PciSegmentBitFieldWrite16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI S3PciSegmentBitFieldWrite16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
{ return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldWrite16 (Address, StartBit, EndBit, Value)); }
tianocore/edk2
C++
Other
4,240
/* This function returns %0 on success and a negative error code on failure. */
static int unpack_lsave(const struct ubifs_info *c, void *buf)
/* This function returns %0 on success and a negative error code on failure. */ static int unpack_lsave(const struct ubifs_info *c, void *buf)
{ uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; int i, pos = 0, err; err = check_lpt_type(&addr, &pos, UBIFS_LPT_LSAVE); if (err) return err; for (i = 0; i < c->lsave_cnt; i++) { int lnum = ubifs_unpack_bits(&addr, &pos, c->lnum_bits); if (lnum < c->main_first || lnum >= c->leb_cnt) return -EINVAL; c->lsave[i] = lnum; } err = check_lpt_crc(buf, c->lsave_sz); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */
uint32_t CRC_CalculateBlockCRC(uint32_t *buf, uint32_t bufLen)
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */ uint32_t CRC_CalculateBlockCRC(uint32_t *buf, uint32_t bufLen)
{ while(bufLen--) { CRC->DATA = *buf++; } return (CRC->DATA); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Configures the TIMx event to be generate by software. */
void TIM_GenerateEvent(TIM_Module *TIMx, uint16_t TIM_EventSource)
/* Configures the TIMx event to be generate by software. */ void TIM_GenerateEvent(TIM_Module *TIMx, uint16_t TIM_EventSource)
{ assert_param(IsTimAllModule(TIMx)); assert_param(IsTimEvtSrc(TIM_EventSource)); TIMx->EVTGEN = TIM_EventSource; }
pikasTech/PikaPython
C++
MIT License
1,403
/* RETURN VALUES: 0 - success -ENOSPC - insufficient disk resources -EIO - i/o error */
int dbReAlloc(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks, s64 *results)
/* RETURN VALUES: 0 - success -ENOSPC - insufficient disk resources -EIO - i/o error */ int dbReAlloc(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks, s64 *results)
{ int rc; if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) { *results = blkno; return (0); } else { if (rc != -ENOSPC) return (rc); } return (dbAlloc (ip, blkno + nblocks - 1, addnblocks + nblocks, results)); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the SD I/O Mode Operation. */
void SDIO_EnableSdioOperation(FunctionalState Cmd)
/* Enables or disables the SD I/O Mode Operation. */ void SDIO_EnableSdioOperation(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); *(__IO uint32_t*)DCTRL_SDIOEN_BB = (uint32_t)Cmd; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns : OK if set source frequency succeeded, others if failed. */
s32 ccu_set_sclk_freq(u32 sclk, __maybe_unused u32 freq)
/* Returns : OK if set source frequency succeeded, others if failed. */ s32 ccu_set_sclk_freq(u32 sclk, __maybe_unused u32 freq)
{ switch (sclk) { case CCU_SYS_CLK_AUDIO0: return ccu_set_pll_audio0(freq); case CCU_SYS_CLK_AUDIO1: return ccu_set_pll_audio1(freq); default: pr_warning("invaid clock id (%d) when set freq(%d)\n", sclk); return -EINVAL; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535