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
/* dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. @str: Case sensitive Name */
int dmi_name_in_vendors(const char *str)
/* dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. @str: Case sensitive Name */ int dmi_name_in_vendors(const char *str)
{ static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR, DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR, DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_NONE }; int i; for (i = 0; fields[i] != DMI_NONE; i++) { int f = fields[i]; if (dmi_ident[f] && strstr(dmi_ident[f], str)) return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2(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 Value V2 attribute. */ static ssize_t write_value_v2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ char *value = attr->user_data; if (offset >= sizeof(value_v2_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_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
/* Disables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */
void PMC_DisablePeripheral(unsigned int id)
/* Disables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */ void PMC_DisablePeripheral(unsigned int id)
{ SANITY_CHECK(id < 32); if ((AT91C_BASE_PMC->PMC_PCSR & (1 << id)) != (1 << id)) { TRACE_INFO("PMC_DisablePeripheral: clock of peripheral" " %u is not enabled\n\r", id); } else { AT91C_BASE_PMC->PMC_PCDR = 1 << id; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Sum to data a periodic peak of a given period, width and shape. */
static void add_peak(int period, int width, const float *shape, float ppc_gain, float *speech, int len)
/* Sum to data a periodic peak of a given period, width and shape. */ static void add_peak(int period, int width, const float *shape, float ppc_gain, float *speech, int len)
{ int i, j; const float *shape_end = shape + len; int center; for (i = 0; i < width/2; i++) speech[i] += ppc_gain * *shape++; for (i = 1; i < ROUNDED_DIV(len,width) ; i++) { center = very_broken_op(period, i); for (j = -width/2; j < (width+1)/2; j++) speech[j+center] += ppc_gain * *shape++; } center = very_broken_op(period, i); for (j = -width/2; j < (width + 1)/2 && shape < shape_end; j++) speech[j+center] += ppc_gain * *shape++; }
DC-SWAT/DreamShell
C++
null
404
/* Send GET_CID command to get CID from card. */
static status_t SD_AllSendCid(sd_card_t *card)
/* Send GET_CID command to get CID from card. */ static status_t SD_AllSendCid(sd_card_t *card)
{ assert(card); SDMMCHOST_TRANSFER content = {0}; SDMMCHOST_COMMAND command = {0}; command.index = kSDMMC_AllSendCid; command.argument = 0U; command.responseType = kCARD_ResponseTypeR2; content.command = &command; content.data = NULL; if (kStatus_Success == card->host.transfer(card->host.base, &content)) { memcpy(card->rawCid, command.response, sizeof(card->rawCid)); SD_DecodeCid(card, command.response); return kStatus_Success; } return kStatus_SDMMC_TransferFailed; }
nanoframework/nf-interpreter
C++
MIT License
293
/* I2C Reset. The I2C peripheral and all its associated configuration registers are placed in the reset condition. The reset is effected via the RCC peripheral reset system. */
void i2c_reset(uint32_t i2c)
/* I2C Reset. The I2C peripheral and all its associated configuration registers are placed in the reset condition. The reset is effected via the RCC peripheral reset system. */ void i2c_reset(uint32_t i2c)
{ switch (i2c) { case I2C1: rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_I2C1RST); rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_I2C1RST); break; case I2C2: rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_I2C2RST); rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_I2C2RST); break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Detect whether we have a MAC coprocessor (40 bit register) or an iWMMXt coprocessor (64 bit registers) by loading 00000100:00000000 into a coprocessor register and reading it back, and checking whether the upper word survived intact. */
static int __init cpu_has_iwmmxt(void)
/* Detect whether we have a MAC coprocessor (40 bit register) or an iWMMXt coprocessor (64 bit registers) by loading 00000100:00000000 into a coprocessor register and reading it back, and checking whether the upper word survived intact. */ static int __init cpu_has_iwmmxt(void)
{ u32 lo; u32 hi; __asm__ __volatile__ ( "mcrr p0, 0, %2, %3, c0\n" "mrrc p0, 0, %0, %1, c0\n" : "=r" (lo), "=r" (hi) : "r" (0), "r" (0x100)); return !!hi; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnMult(IN INTN Multiplicand, IN INTN Multiplier, OUT INTN *Result)
{ if (sizeof (UINTN) == sizeof (UINT32)) { return SafeInt64ToIntn (((INT64)Multiplicand) *((INT64)Multiplier), Result); } return SafeInt64Mult ((INT64)Multiplicand, (INT64)Multiplier, (INT64 *)Result); }
tianocore/edk2
C++
Other
4,240
/* Decode a scanline and apply the predictor routine. */
static int PredictorDecodeRow(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s)
/* Decode a scanline and apply the predictor routine. */ static int PredictorDecodeRow(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s)
{ TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->decoderow != NULL); assert(sp->decodepfunc != NULL); if ((*sp->decoderow)(tif, op0, occ0, s)) { return (*sp->decodepfunc)(tif, op0, occ0); } else return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Gets the error status of the I2C Master. */
uint32_t I2CMasterErr(uint32_t ui32Base)
/* Gets the error status of the I2C Master. */ uint32_t I2CMasterErr(uint32_t ui32Base)
{ uint32_t ui32Err; ASSERT(_I2CBaseValid(ui32Base)); ui32Err = HWREG(ui32Base + I2C_O_MCS); if (ui32Err & I2C_MCS_BUSY) { return (I2C_MASTER_ERR_NONE); } if (ui32Err & (I2C_MCS_ERROR | I2C_MCS_ARBLST)) { return (ui32Err & (I2C_MCS_ARBLST | I2C_MCS_DATACK | I2C_MCS_ADRACK)); } else { return (I2C_MASTER_ERR_NONE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* uwb_radio_force_channel - force a specific channel to be used @rc: the radio controller. @channel: the channel to use; -1 to force the radio to stop; 0 to use the default channel selection algorithm. */
int uwb_radio_force_channel(struct uwb_rc *rc, int channel)
/* uwb_radio_force_channel - force a specific channel to be used @rc: the radio controller. @channel: the channel to use; -1 to force the radio to stop; 0 to use the default channel selection algorithm. */ int uwb_radio_force_channel(struct uwb_rc *rc, int channel)
{ int ret = 0; mutex_lock(&rc->uwb_dev.mutex); rc->beaconing_forced = channel; ret = uwb_radio_change_channel(rc, uwb_radio_select_channel(rc)); mutex_unlock(&rc->uwb_dev.mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is the entrypoint of RNDIS Driver. It installs Driver Binding Protocols together with Component Name Protocols. */
EFI_STATUS EFIAPI UsbRndisEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This function is the entrypoint of RNDIS Driver. It installs Driver Binding Protocols together with Component Name Protocols. */ EFI_STATUS EFIAPI UsbRndisEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ gUsbRndisDriverBinding.DriverBindingHandle = ImageHandle; gUsbRndisDriverBinding.ImageHandle = ImageHandle; return gBS->InstallMultipleProtocolInterfaces ( &gUsbRndisDriverBinding.DriverBindingHandle, &gEfiDriverBindingProtocolGuid, &gUsbRndisDriverBinding, &gEfiComponentName2ProtocolGuid, &gUsbRndisComponentName2, NULL ); }
tianocore/edk2
C++
Other
4,240
/* The types, for the purpose of this naming convention, are encoded, subids, string and resolved, both, struct. */
static void oids_test_2subids_encoded(void)
/* The types, for the purpose of this naming convention, are encoded, subids, string and resolved, both, struct. */ static void oids_test_2subids_encoded(void)
{ guint32 *subids = NULL; guint len; guint i; len = oid_encoded2subid(NULL, ex1.encoded, ex1.encoded_len, &subids); g_assert(len == ex1.subids_len); for (i=0; i < len; i++) g_assert(subids[i] == ex1.subids[i]); wmem_free(NULL, subids); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Scan the alternatives table for a match and return the index into the alternatives table if found, else -1. */
static int find_alternative(u32 event)
/* Scan the alternatives table for a match and return the index into the alternatives table if found, else -1. */ static int find_alternative(u32 event)
{ int i, j; for (i = 0; i < ARRAY_SIZE(event_alternatives); ++i) { if (event < event_alternatives[i][0]) break; for (j = 0; j < MAX_ALT && event_alternatives[i][j]; ++j) if (event == event_alternatives[i][j]) return i; } return -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine places a MPT request frame back on the MPT adapter's FreeQ. */
static void mpt_add_sge_64bit(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
/* This routine places a MPT request frame back on the MPT adapter's FreeQ. */ static void mpt_add_sge_64bit(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
{ SGESimple64_t *pSge = (SGESimple64_t *) pAddr; pSge->Address.Low = cpu_to_le32 (lower_32_bits(dma_addr)); pSge->Address.High = cpu_to_le32 (upper_32_bits(dma_addr)); pSge->FlagsLength = cpu_to_le32 ((flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING)); }
robutest/uclinux
C++
GPL-2.0
60
/* If the nrblocks are discontiguous, they could cause the whole tree split more than once, but this is really rare. */
int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
/* If the nrblocks are discontiguous, they could cause the whole tree split more than once, but this is really rare. */ int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
{ int index; int depth = ext_depth(inode); if (chunk) index = depth * 2; else index = depth * 3; return index; }
robutest/uclinux
C++
GPL-2.0
60
/* RETURNS: @plba: the LBA @plen: the transfer length */
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
/* RETURNS: @plba: the LBA @plen: the transfer length */ static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{ u64 lba = 0; u32 len; VPRINTK("six-byte command\n"); lba |= ((u64)(cdb[1] & 0x1f)) << 16; lba |= ((u64)cdb[2]) << 8; lba |= ((u64)cdb[3]); len = cdb[4]; *plba = lba; *plen = len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the wake conditions for the Hibernation module. */
void HibernateWakeSet(unsigned long ulWakeFlags)
/* Configures the wake conditions for the Hibernation module. */ void HibernateWakeSet(unsigned long ulWakeFlags)
{ ASSERT(!(ulWakeFlags & ~(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT))); HWREG(HIB_CTL) = (ulWakeFlags | (HWREG(HIB_CTL) & ~(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT))); HibernateWriteComplete(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* : send HCI commands to perform BLE advertising; */
void bleAdvtTask(void *pvParameters)
/* : send HCI commands to perform BLE advertising; */ void bleAdvtTask(void *pvParameters)
{ int cmd_cnt = 0; bool send_avail = false; esp_vhci_host_register_callback(&vhci_host_cb); printf("BLE advt task start\n"); while (1) { vTaskDelay(1000 / portTICK_PERIOD_MS); send_avail = esp_vhci_host_check_send_available(); if (send_avail) { switch (cmd_cnt) { case 0: hci_cmd_send_reset(); ++cmd_cnt; break; case 1: hci_cmd_send_ble_set_adv_param(); ++cmd_cnt; break; case 2: hci_cmd_send_ble_set_adv_data(); ++cmd_cnt; break; case 3: hci_cmd_send_ble_adv_start(); ++cmd_cnt; break; } } printf("BLE Advertise, flag_send_avail: %d, cmd_sent: %d\n", send_avail, cmd_cnt); } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* The callback function for Ip6SetAddr. The prototype is defined as IP6_DAD_CALLBACK. It is called after Duplicate Address Detection is performed on the tentative address by DHCPv6 in */
VOID Ip6ConfigSetStatefulAddrCallback(IN BOOLEAN IsDadPassed, IN EFI_IPv6_ADDRESS *TargetAddress, IN VOID *Context)
/* The callback function for Ip6SetAddr. The prototype is defined as IP6_DAD_CALLBACK. It is called after Duplicate Address Detection is performed on the tentative address by DHCPv6 in */ VOID Ip6ConfigSetStatefulAddrCallback(IN BOOLEAN IsDadPassed, IN EFI_IPv6_ADDRESS *TargetAddress, IN VOID *Context)
{ IP6_CONFIG_INSTANCE *Instance; Instance = (IP6_CONFIG_INSTANCE *)Context; NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE); if (IsDadPassed) { if (Instance->FailedIaAddressCount > 0 ) { Instance->FailedIaAddressCount--; } } else { IP6_COPY_ADDRESS (Instance->DeclineAddress + Instance->DeclineAddressCount, TargetAddress); Instance->DeclineAddressCount++; } if (Instance->FailedIaAddressCount == Instance->DeclineAddressCount) { if (Instance->DeclineAddressCount != 0) { if (Instance->Dhcp6 != NULL) { Instance->Dhcp6->Decline ( Instance->Dhcp6, Instance->DeclineAddressCount, Instance->DeclineAddress ); } } if (Instance->DeclineAddress != NULL) { FreePool (Instance->DeclineAddress); } Instance->DeclineAddress = NULL; Instance->DeclineAddressCount = 0; } }
tianocore/edk2
C++
Other
4,240
/* This API checks whether the Accel FIFO data is set for filtered or unfiltered mode. */
uint16_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev)
/* This API checks whether the Accel FIFO data is set for filtered or unfiltered mode. */ uint16_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_FIFO_DOWN_ADDR, &data, 1, dev); if (rslt == BMA4_OK) *accel_fifo_filter = BMA4_GET_BITSLICE(data, BMA4_FIFO_FILTER_ACCEL); } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Writes a data byte to the I2C transmit FIFO. */
uint32_t I2CFIFODataPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data)
/* Writes a data byte to the I2C transmit FIFO. */ uint32_t I2CFIFODataPutNonBlocking(uint32_t ui32Base, uint8_t ui8Data)
{ ASSERT(_I2CBaseValid(ui32Base)); if(HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_TXFF) { return(0); } else { HWREG(ui32Base + I2C_O_FIFODATA) = ui8Data; return(1); } }
micropython/micropython
C++
Other
18,334
/* Displays a PIMA command error via the device's serial port. */
void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError)
/* Displays a PIMA command error via the device's serial port. */ void ShowCommandError(uint8_t ErrorCode, bool ResponseCodeError)
{ const char* FailureType = ((ResponseCodeError) ? PSTR("Response Code != OK") : PSTR("Transaction Fail")); printf_P(PSTR(ESC_FG_RED "Command Error (%S).\r\n" " -- Error Code %d\r\n" ESC_FG_WHITE), FailureType, ErrorCode); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Forces or releases High Speed APB (APB2) peripheral reset. */
void exRCC_APB2PeriphReset(u32 apb2_periph)
/* Forces or releases High Speed APB (APB2) peripheral reset. */ void exRCC_APB2PeriphReset(u32 apb2_periph)
{ RCC->APB2RSTR |= apb2_periph; RCC->APB2RSTR &= ~apb2_periph; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks to see whether we have already mapped a certain zone If we haven't, the map is generated */
static void alauda_ensure_map_for_zone(struct us_data *us, unsigned int zone)
/* Checks to see whether we have already mapped a certain zone If we haven't, the map is generated */ static void alauda_ensure_map_for_zone(struct us_data *us, unsigned int zone)
{ if (MEDIA_INFO(us).lba_to_pba[zone] == NULL || MEDIA_INFO(us).pba_to_lba[zone] == NULL) alauda_read_map(us, zone); }
robutest/uclinux
C++
GPL-2.0
60
/* Sensor synchronization time frame with the step of 500 ms and full range of 5s. Unsigned 8-bit.. */
int32_t lsm6dsl_sh_sync_sens_frame_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Sensor synchronization time frame with the step of 500 ms and full range of 5s. Unsigned 8-bit.. */ int32_t lsm6dsl_sh_sync_sens_frame_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dsl_sensor_sync_time_frame_t sensor_sync_time_frame; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_SENSOR_SYNC_TIME_FRAME, (uint8_t*)&sensor_sync_time_frame, 1); *val = sensor_sync_time_frame.tph; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Some section permission faults need to be handled gracefully. They can happen due to a __{get,put}_user during an oops. */
static int do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
/* Some section permission faults need to be handled gracefully. They can happen due to a __{get,put}_user during an oops. */ static int do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{ do_bad_area(addr, fsr, regs); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Registers an interrupt handler for the timer interrupt. */
void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
/* Registers an interrupt handler for the timer interrupt. */ void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
{ uint32_t ui32Int; ASSERT(_TimerBaseValid(ui32Base)); ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) || (ui32Timer == TIMER_BOTH)); ui32Int = _TimerIntNumberGet(ui32Base, ui32Timer); ASSERT(ui32Int != 0); IntRegister(ui32Int, pfnHandler); IntEnable(ui32Int); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* configure the length of routine sequence or inserted sequence */
void adc_channel_length_config(uint32_t adc_periph, uint8_t adc_sequence, uint32_t length)
/* configure the length of routine sequence or inserted sequence */ void adc_channel_length_config(uint32_t adc_periph, uint8_t adc_sequence, uint32_t length)
{ switch(adc_sequence) { case ADC_ROUTINE_CHANNEL: if((length >= 1U) && (length <= 16U)) { ADC_RSQ0(adc_periph) &= ~((uint32_t)ADC_RSQ0_RL); ADC_RSQ0(adc_periph) |= RSQ0_RL((uint32_t)(length - ADC_CHANNEL_LENGTH_SUBTRACT_ONE)); } break; case ADC_INSERTED_CHANNEL: if((length >= 1U) && (length <= 4U)) { ADC_ISQ(adc_periph) &= ~((uint32_t)ADC_ISQ_IL); ADC_ISQ(adc_periph) |= ISQ_IL((uint32_t)(length - ADC_CHANNEL_LENGTH_SUBTRACT_ONE)); } break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read the ethernet address string from the on board rom. This is an ascii string!!! */
static int __devinit ether3_addr(char *addr, struct expansion_card *ec)
/* Read the ethernet address string from the on board rom. This is an ascii string!!! */ static int __devinit ether3_addr(char *addr, struct expansion_card *ec)
{ struct in_chunk_dir cd; char *s; if (ecard_readchunk(&cd, ec, 0xf5, 0) && (s = strchr(cd.d.string, '('))) { int i; for (i = 0; i<6; i++) { addr[i] = simple_strtoul(s + 1, &s, 0x10); if (*s != (i==5?')' : ':' )) break; } if (i == 6) return 0; } printk(KERN_ERR "ether3: Couldn't read a valid MAC address from card.\n"); return -ENODEV; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the data size for the selected SPI. */
void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
/* Configures the data size for the selected SPI. */ void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_DATASIZE(SPI_DataSize)); SPIx->GCTL &= SPI_DataSize_Mask; SPIx->GCTL |= SPI_DataSize; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Remove serial ports registered against a platform device. */
static int __devexit serial8250_remove(struct platform_device *dev)
/* Remove serial ports registered against a platform device. */ static int __devexit serial8250_remove(struct platform_device *dev)
{ int i; for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; if (up->port.dev == &dev->dev) serial8250_unregister_port(i); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
{ assert(handle); SAI_TransferAbortReceiveEDMA(base, handle); memset(handle->tcd, 0U, sizeof(handle->tcd)); memset(handle->saiQueue, 0U, sizeof(handle->saiQueue)); memset(handle->transferSize, 0U, sizeof(handle->transferSize)); handle->queueUser = 0U; handle->queueDriver = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the empty frame buffer count in queue. */
static uint32_t CSI_TransferGetEmptyBufferCount(CSI_Type *base, csi_handle_t *handle)
/* Get the empty frame buffer count in queue. */ static uint32_t CSI_TransferGetEmptyBufferCount(CSI_Type *base, csi_handle_t *handle)
{ return CSI_TransferGetQueueDelta(handle->queueDrvReadIdx, handle->queueUserWriteIdx); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wake up CPU 1 from another CPU, this is platform specific. */
void wakeup_cpu1(void)
/* Wake up CPU 1 from another CPU, this is platform specific. */ void wakeup_cpu1(void)
{ *(uint32_t *)(SSE_200_SYSTEM_CTRL_INITSVTOR1) = (uint32_t)_vector_start + CPU1_FLASH_ADDRESS - CPU1_FLASH_OFFSET; *(uint32_t *)(SSE_200_SYSTEM_CTRL_CPU_WAIT) = 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Periodically retrigger timeout process. After managing the lwIP timers. trigger corresponding ethernet process. */
void ethernet_task(void)
/* Periodically retrigger timeout process. After managing the lwIP timers. trigger corresponding ethernet process. */ void ethernet_task(void)
{ ethernetif_input(&gs_net_if); timers_update(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Sends the contents of buffer through a SPI peripheral, using the PDC to take care of the transfer. */
unsigned char SPI_WriteBuffer(AT91S_SPI *spi, void *buffer, unsigned int length)
/* Sends the contents of buffer through a SPI peripheral, using the PDC to take care of the transfer. */ unsigned char SPI_WriteBuffer(AT91S_SPI *spi, void *buffer, unsigned int length)
{ if (spi->SPI_TCR == 0) { spi->SPI_TPR = (unsigned int) buffer; spi->SPI_TCR = length; spi->SPI_PTCR = AT91C_PDC_TXTEN; return 1; } else if (spi->SPI_TNCR == 0) { spi->SPI_TNPR = (unsigned int) buffer; spi->SPI_TNCR = length; return 1; } return 0; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This routine is invoked to remove all memory resources allocated to support rpis. This routine presumes the caller has released all rpis consumed by fabric or port logins and is prepared to have the header pages removed. */
void lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba)
/* This routine is invoked to remove all memory resources allocated to support rpis. This routine presumes the caller has released all rpis consumed by fabric or port logins and is prepared to have the header pages removed. */ void lpfc_sli4_remove_rpi_hdrs(struct lpfc_hba *phba)
{ struct lpfc_rpi_hdr *rpi_hdr, *next_rpi_hdr; list_for_each_entry_safe(rpi_hdr, next_rpi_hdr, &phba->sli4_hba.lpfc_rpi_hdr_list, list) { list_del(&rpi_hdr->list); dma_free_coherent(&phba->pcidev->dev, rpi_hdr->len, rpi_hdr->dmabuf->virt, rpi_hdr->dmabuf->phys); kfree(rpi_hdr->dmabuf); kfree(rpi_hdr); } phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.rpi_base; memset(phba->sli4_hba.rpi_bmask, 0, sizeof(*phba->sli4_hba.rpi_bmask)); }
robutest/uclinux
C++
GPL-2.0
60
/* Function to convert a given Unicode encoded string to ASCII. This function will only work correctly on Unicode strings which contain ASCII printable characters only. */
void UnicodeToASCII(uint8_t *UnicodeString, char *Buffer)
/* Function to convert a given Unicode encoded string to ASCII. This function will only work correctly on Unicode strings which contain ASCII printable characters only. */ void UnicodeToASCII(uint8_t *UnicodeString, char *Buffer)
{ uint8_t CharactersRemaining = *(UnicodeString++); while (CharactersRemaining--) { *(Buffer++) = *UnicodeString; UnicodeString += 2; } *Buffer = 0; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Calculate checksum according to CCITT CRC16. This functionality is also present internally in the API, but is duplicated here to allow for much more efficient calculations specific to the hardware. */
void NVMHAL_Checksum(uint16_t *pChecksum, void *pMemory, uint16_t len)
/* Calculate checksum according to CCITT CRC16. This functionality is also present internally in the API, but is duplicated here to allow for much more efficient calculations specific to the hardware. */ void NVMHAL_Checksum(uint16_t *pChecksum, void *pMemory, uint16_t len)
{ uint8_t *pointer = (uint8_t *) pMemory; uint16_t crc = *pChecksum; while(len--) { crc = (crc >> 8) | (crc << 8); crc ^= *pointer++; crc ^= (crc & 0xf0) >> 4; crc ^= (crc & 0x0f) << 12; crc ^= (crc & 0xff) << 5; } *pChecksum = crc; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Reads and returns the current value of DR6. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadDr6(VOID)
/* Reads and returns the current value of DR6. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmReadDr6(VOID)
{ __asm { mov eax, dr6 } }
tianocore/edk2
C++
Other
4,240
/* AFAVLAB uses a different mixture of BARs and offsets Not that ugly ;) */
static int afavlab_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
/* AFAVLAB uses a different mixture of BARs and offsets Not that ugly ;) */ static int afavlab_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
{ unsigned int bar, offset = board->first_offset; bar = FL_GET_BASE(board->flags); if (idx < 4) bar += idx; else { bar = 4; offset += (idx - 4) * board->uart_offset; } return setup_port(priv, port, bar, offset, board->reg_shift); }
robutest/uclinux
C++
GPL-2.0
60
/* If Vector is not in range 0x10..0xFE, then ASSERT(). If DeliveryMode is not supported, then ASSERT(). */
UINT64 EFIAPI GetApicMsiValue(IN UINT8 Vector, IN UINTN DeliveryMode, IN BOOLEAN LevelTriggered, IN BOOLEAN AssertionLevel)
/* If Vector is not in range 0x10..0xFE, then ASSERT(). If DeliveryMode is not supported, then ASSERT(). */ UINT64 EFIAPI GetApicMsiValue(IN UINT8 Vector, IN UINTN DeliveryMode, IN BOOLEAN LevelTriggered, IN BOOLEAN AssertionLevel)
{ LOCAL_APIC_MSI_DATA MsiData; ASSERT (Vector >= 0x10 && Vector <= 0xFE); ASSERT (DeliveryMode < 8 && DeliveryMode != 6 && DeliveryMode != 3); MsiData.Uint64 = 0; MsiData.Bits.Vector = Vector; MsiData.Bits.DeliveryMode = (UINT32)DeliveryMode; if (LevelTriggered) { MsiData.Bits.TriggerMode = 1; if (AssertionLevel) { MsiData.Bits.Level = 1; } } return MsiData.Uint64; }
tianocore/edk2
C++
Other
4,240
/* @node_type node type @node_sub_type node sub type @node_length node length */
static struct efi_device_path* EFIAPI create_device_node(uint8_t node_type, uint8_t node_sub_type, uint16_t node_length)
/* @node_type node type @node_sub_type node sub type @node_length node length */ static struct efi_device_path* EFIAPI create_device_node(uint8_t node_type, uint8_t node_sub_type, uint16_t node_length)
{ EFI_ENTRY("%u, %u, %u", node_type, node_sub_type, node_length); return EFI_EXIT(efi_dp_create_device_node(node_type, node_sub_type, node_length)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return the powerdomain associated with the first underlying omap_hwmod for this omap_device. Intended for use by core OMAP PM code. Returns NULL on error or a struct powerdomain * upon success. */
struct powerdomain* omap_device_get_pwrdm(struct omap_device *od)
/* Return the powerdomain associated with the first underlying omap_hwmod for this omap_device. Intended for use by core OMAP PM code. Returns NULL on error or a struct powerdomain * upon success. */ struct powerdomain* omap_device_get_pwrdm(struct omap_device *od)
{ if (!od->hwmods_cnt) return NULL; return omap_hwmod_get_pwrdm(od->hwmods[0]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 1 if the DMA cannot be performed, zero on success. */
static int ali_dma_check(ide_drive_t *drive, struct ide_cmd *cmd)
/* Returns 1 if the DMA cannot be performed, zero on success. */ static int ali_dma_check(ide_drive_t *drive, struct ide_cmd *cmd)
{ if (m5229_revision < 0xC2 && drive->media != ide_disk) { if (cmd->tf_flags & IDE_TFLAG_WRITE) return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Look for a given value in a given guid dissector table and, if found, return the current dissector handle for that value. */
dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
/* Look for a given value in a given guid dissector table and, if found, return the current dissector handle for that value. */ dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
{ dtbl_entry_t *dtbl_entry; dtbl_entry = (dtbl_entry_t *)g_hash_table_lookup(sub_dissectors->hash_table, guid_val); if (dtbl_entry != NULL) return dtbl_entry->current; else return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Certain control registers are protected against overwriting by the lock register and use a shared write address. This function allows writing of these registers. Lock must be held. */
static int sca3000_write_ctrl_reg(struct sca3000_state *st, uint8_t sel, uint8_t val)
/* Certain control registers are protected against overwriting by the lock register and use a shared write address. This function allows writing of these registers. Lock must be held. */ static int sca3000_write_ctrl_reg(struct sca3000_state *st, uint8_t sel, uint8_t val)
{ int ret; ret = sca3000_reg_lock_on(st); if (ret < 0) goto error_ret; if (ret) { ret = __sca3000_unlock_reg_lock(st); if (ret) goto error_ret; } ret = sca3000_write_reg(st, SCA3000_REG_ADDR_CTRL_SEL, sel); if (ret) goto error_ret; ret = sca3000_write_reg(st, SCA3000_REG_ADDR_CTRL_DATA, val); error_ret: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* XICS Common class - parent for emulated XICS and KVM-XICS */
static void xics_common_reset(DeviceState *d)
/* XICS Common class - parent for emulated XICS and KVM-XICS */ static void xics_common_reset(DeviceState *d)
{ XICSState *icp = XICS_COMMON(d); int i; for (i = 0; i < icp->nr_servers; i++) { device_reset(DEVICE(&icp->ss[i])); } device_reset(DEVICE(icp->ics)); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Sets the UART hardware flow control mode to be used. */
void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode)
/* Sets the UART hardware flow control mode to be used. */ void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode)
{ xASSERT((ulBase == UART0_BASE)); xASSERT((ulMode & ~(UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)) == 0); xHWREG(ulBase + UART_IER) = ((xHWREG(ulBase + UART_IER) & ~(UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)) | ulMode); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enable or disable DMA Tx descriptor replace CRC. */
int32_t ETH_DMA_TxDescReplaceCrcCmd(stc_eth_dma_desc_t *pstcTxDesc, en_functional_state_t enNewState)
/* Enable or disable DMA Tx descriptor replace CRC. */ int32_t ETH_DMA_TxDescReplaceCrcCmd(stc_eth_dma_desc_t *pstcTxDesc, en_functional_state_t enNewState)
{ int32_t i32Ret = LL_OK; if (NULL == pstcTxDesc) { i32Ret = LL_ERR_INVD_PARAM; } else { DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (DISABLE != enNewState) { SET_REG32_BIT(pstcTxDesc->u32ControlStatus, ETH_DMA_TXDESC_CRCR); } else { CLR_REG32_BIT(pstcTxDesc->u32ControlStatus, ETH_DMA_TXDESC_CRCR); } } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set LCD into standby In deep standby: LCD has lower power consumption. */
void hx8347d_Standby(bool deep)
/* Set LCD into standby In deep standby: LCD has lower power consumption. */ void hx8347d_Standby(bool deep)
{ displayOffFlow(); lcd_cmd(Power_Control_6 , Power_Control_6_STB); if(deep) { lcd_cmd(Display_Mode_Control,Display_Mode_Control_DP_STB_S); lcd_cmd(Display_Mode_Control, Display_Mode_Control_DP_STB); } lcd_cmd(OSC_Control_2, ~OSC_Control_2_OSC_EN); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Change Logs: Date Author Notes Dystopia the first version */
void rt_init_thread_entry(void *parameter)
/* Change Logs: Date Author Notes Dystopia the first version */ void rt_init_thread_entry(void *parameter)
{ rt_kprintf("hello rt-thread\n"); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Cert is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceRsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
/* If Cert is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceRsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
{ return CALL_BASECRYPTLIB (Rsa.Services.GetPublicKeyFromX509, RsaGetPublicKeyFromX509, (Cert, CertSize, RsaContext), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Find a match for 'any network' - ie any of our interfaces with that node number will do just nicely. */
static struct atalk_iface* atalk_find_anynet(int node, struct net_device *dev)
/* Find a match for 'any network' - ie any of our interfaces with that node number will do just nicely. */ static struct atalk_iface* atalk_find_anynet(int node, struct net_device *dev)
{ struct atalk_iface *iface = dev->atalk_ptr; if (!iface || iface->status & ATIF_PROBE) goto out_err; if (node != ATADDR_BCAST && iface->address.s_node != node && node != ATADDR_ANYNODE) goto out_err; out: return iface; out_err: iface = NULL; goto out; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes an ADC configuration structure to defaults. The default configuration is as follows: */
void adc_get_config_defaults(struct adc_config *const config)
/* Initializes an ADC configuration structure to defaults. The default configuration is as follows: */ void adc_get_config_defaults(struct adc_config *const config)
{ Assert(config); config->reference = ADC_REFERENCE_VBATT_2; config->internal_vref = ADC_INTERNAL_BUF_1_5; config->input_channel = ADC_INPUT_CH_GPIO_MS1; config->channel_mode = ADC_CH_MODE_ASSIGN; config->input_dynamic_range = ADC_INPUT_DYNAMIC_RANGE_3; config->bias_current = ADC_BIAS_CURRENT_3; config->invert_clock = false; config->frac_part = 0; config->int_part = 0x12; }
memfault/zero-to-main
C++
null
200
/* Reverses the effect of usb_hcd_lh7a404_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
void usb_hcd_lh7a404_remove(struct usb_hcd *hcd, struct platform_device *dev)
/* Reverses the effect of usb_hcd_lh7a404_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ void usb_hcd_lh7a404_remove(struct usb_hcd *hcd, struct platform_device *dev)
{ usb_remove_hcd(hcd); lh7a404_stop_hc(dev); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); }
robutest/uclinux
C++
GPL-2.0
60
/* Created on: 16 feb. 2019 Author: Daniel Mårtensson Take the power values of every element of matrix A, size row x column MATLAB code A.^n, where n is the double value */
void power(double *A, int row, int column, double value)
/* Created on: 16 feb. 2019 Author: Daniel Mårtensson Take the power values of every element of matrix A, size row x column MATLAB code A.^n, where n is the double value */ void power(double *A, int row, int column, double value)
{ *A = powf(*(A), value); A++; } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* This routine is called when a Restart Request is needed */
static void rose_transmit_restart_request(struct rose_neigh *neigh)
/* This routine is called when a Restart Request is needed */ static void rose_transmit_restart_request(struct rose_neigh *neigh)
{ struct sk_buff *skb; unsigned char *dptr; int len; len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3; if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) return; skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN); dptr = skb_put(skb, ROSE_MIN_LEN + 3); *dptr++ = AX25_P_ROSE; *dptr++ = ROSE_GFI; *dptr++ = 0x00; *dptr++ = ROSE_RESTART_REQUEST; *dptr++ = ROSE_DTE_ORIGINATED; *dptr++ = 0; if (!rose_send_frame(skb, neigh)) kfree_skb(skb); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This may get called early from board specific init for boards that have interrupts routed via FPGA. */
int __init omap_gpio_init(void)
/* This may get called early from board specific init for boards that have interrupts routed via FPGA. */ int __init omap_gpio_init(void)
{ if (!initialized) return _omap_gpio_init(); else return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns zero if the driver registered and bound to a device, else returns a negative error code and with the driver not registered. */
int __init_or_module platform_driver_probe(struct platform_driver *drv, int(*probe)(struct platform_device *))
/* Returns zero if the driver registered and bound to a device, else returns a negative error code and with the driver not registered. */ int __init_or_module platform_driver_probe(struct platform_driver *drv, int(*probe)(struct platform_device *))
{ int retval, code; drv->driver.suppress_bind_attrs = true; drv->probe = probe; retval = code = platform_driver_register(drv); spin_lock(&platform_bus_type.p->klist_drivers.k_lock); drv->probe = NULL; if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list)) retval = -ENODEV; drv->driver.probe = platform_drv_probe_fail; spin_unlock(&platform_bus_type.p->klist_drivers.k_lock); if (code != retval) platform_driver_unregister(drv); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* It installs DriverBinding, ComponentName and ComponentName2 protocol if there is GraphicsInfo HOB passed from Graphics PEIM. */
EFI_STATUS EFIAPI InitializeGraphicsOutput(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* It installs DriverBinding, ComponentName and ComponentName2 protocol if there is GraphicsInfo HOB passed from Graphics PEIM. */ EFI_STATUS EFIAPI InitializeGraphicsOutput(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; VOID *HobStart; HobStart = GetFirstGuidHob (&gEfiGraphicsInfoHobGuid); if ((HobStart == NULL) || (GET_GUID_HOB_DATA_SIZE (HobStart) < sizeof (EFI_PEI_GRAPHICS_INFO_HOB))) { return EFI_NOT_FOUND; } Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &mGraphicsOutputDriverBinding, ImageHandle, &mGraphicsOutputComponentName, &mGraphicsOutputComponentName2 ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Returns negative errno on error, or zero on success. */
static int s1d13xxxfb_blank(int blank_mode, struct fb_info *info)
/* Returns negative errno on error, or zero on success. */ static int s1d13xxxfb_blank(int blank_mode, struct fb_info *info)
{ struct s1d13xxxfb_par *par = info->par; dbg("s1d13xxxfb_blank: blank=%d, info=%p\n", blank_mode, info); switch (blank_mode) { case FB_BLANK_UNBLANK: case FB_BLANK_NORMAL: if ((par->display & 0x01) != 0) lcd_enable(par, 1); if ((par->display & 0x02) != 0) crt_enable(par, 1); break; case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: break; case FB_BLANK_POWERDOWN: lcd_enable(par, 0); crt_enable(par, 0); break; default: return -EINVAL; } return ((blank_mode == FB_BLANK_NORMAL) ? 1 : 0); }
robutest/uclinux
C++
GPL-2.0
60
/* BAR write: write value to the n BAR */
void pci_isa_write_bar(int n, u32 value)
/* BAR write: write value to the n BAR */ void pci_isa_write_bar(int n, u32 value)
{ u32 hi = 0, lo = value; if (value == PCI_BAR_RANGE_MASK) { _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo); lo |= soft_bar_flag[n]; _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo); } else if (value & 0x01) { hi = 0x0000f001; lo &= bar_space_range[n]; _wrmsr(divil_msr_reg[n], hi, lo); hi = ((value & 0x000ffffc) << 12) | ((bar_space_len[n] - 4) << 12) | 0x01; lo = ((value & 0x000ffffc) << 12) | 0x01; _wrmsr(sb_msr_reg[n], hi, lo); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API validates the bandwidth and perfmode value set by the user. param bandwidth : bandwidth value set by the user. param perf_mode : perf_mode value set by the user. */
static uint16_t validate_bandwidth_perfmode(uint8_t bandwidth, uint8_t perf_mode)
/* This API validates the bandwidth and perfmode value set by the user. param bandwidth : bandwidth value set by the user. param perf_mode : perf_mode value set by the user. */ static uint16_t validate_bandwidth_perfmode(uint8_t bandwidth, uint8_t perf_mode)
{ uint16_t rslt = BMA4_OK; if (perf_mode == BMA4_CONTINUOUS_MODE) { if (bandwidth > BMA4_ACCEL_NORMAL_AVG4) { rslt = BMA4_E_OUT_OF_RANGE; } } else if (perf_mode == BMA4_CIC_AVG_MODE) { if (bandwidth > BMA4_ACCEL_RES_AVG128) { rslt = BMA4_E_OUT_OF_RANGE; } } else { rslt = BMA4_E_OUT_OF_RANGE; } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */
void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ucVal)
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */ void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ucVal)
{ if(ucVal) { xHWREG(ulPort +GPIO_DOUT ) |= ulPins; } else { xHWREG(ulPort +GPIO_DOUT ) &= ~ulPins; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reads and returns the current value of DR7. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadDr7(VOID)
/* Reads and returns the current value of DR7. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmReadDr7(VOID)
{ __asm { mov eax, dr7 } }
tianocore/edk2
C++
Other
4,240
/* Print out which flash was booted from and if booting from the 2nd flash, swap flash chip selects to maintain consistent flash numbering/addresses. */
static void flash_cs_fixup(void)
/* Print out which flash was booted from and if booting from the 2nd flash, swap flash chip selects to maintain consistent flash numbering/addresses. */ static void flash_cs_fixup(void)
{ immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; ccsr_lbc_t *lbc = &immap->im_lbc; int flash_sel; flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) & CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS)); printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1); if (flash_sel) { out_be32(&lbc->br0, CONFIG_SYS_BR1_PRELIM); out_be32(&lbc->or0, CONFIG_SYS_OR1_PRELIM); out_be32(&lbc->br1, CONFIG_SYS_BR0_PRELIM); out_be32(&lbc->or1, CONFIG_SYS_OR0_PRELIM); } }
EmcraftSystems/u-boot
C++
Other
181
/* Set the SGPIO MULMRx register for group 0. */
void SGPIO_MULMRxGP0ValConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_MULMR0GP0, u32 SGPIO_MULMR1GP0, u32 SGPIO_MULMR2GP0, u32 SGPIO_MULMR3GP0)
/* Set the SGPIO MULMRx register for group 0. */ void SGPIO_MULMRxGP0ValConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_MULMR0GP0, u32 SGPIO_MULMR1GP0, u32 SGPIO_MULMR2GP0, u32 SGPIO_MULMR3GP0)
{ assert_param(IS_SGPIO_ALL_PERIPH(SGPIOx)); assert_param(SGPIO_MULMR0GP0 <= 0xffff); assert_param(SGPIO_MULMR1GP0 <= 0xffff); assert_param(SGPIO_MULMR2GP0 <= 0xffff); assert_param(SGPIO_MULMR3GP0 <= 0xffff); SGPIOx->SGPIO_MULMR01GP0 = (SGPIO_MULMR1GP0 << 16) | SGPIO_MULMR0GP0; SGPIOx->SGPIO_MULMR23GP0 = (SGPIO_MULMR3GP0 << 16) | SGPIO_MULMR2GP0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Common code to handle map devices which are simple ROM (C) 2000 Red Hat. GPL'd. */
static int maprom_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *)
/* Common code to handle map devices which are simple ROM (C) 2000 Red Hat. GPL'd. */ static int maprom_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *)
{ struct map_info *map = mtd->priv; map_copy_from(map, buf, from, len); *retlen = len; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns zero on no error; non-zero on error */
static int ecryptfs_find_auth_tok_for_sig(struct ecryptfs_auth_tok **auth_tok, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig)
/* Returns zero on no error; non-zero on error */ static int ecryptfs_find_auth_tok_for_sig(struct ecryptfs_auth_tok **auth_tok, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig)
{ struct ecryptfs_global_auth_tok *global_auth_tok; int rc = 0; (*auth_tok) = NULL; if (ecryptfs_find_global_auth_tok_for_sig(&global_auth_tok, mount_crypt_stat, sig)) { struct key *auth_tok_key; rc = ecryptfs_keyring_auth_tok_for_sig(&auth_tok_key, auth_tok, sig); } else (*auth_tok) = global_auth_tok->global_auth_tok; return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param address LPUART slave address. */
void LPUART_SendAddress(LPUART_Type *base, uint8_t address)
/* param base LPUART peripheral base address. param address LPUART slave address. */ void LPUART_SendAddress(LPUART_Type *base, uint8_t address)
{ assert(base != NULL); uint32_t temp = base->DATA & 0xFFFFFC00UL; temp |= ((uint32_t)address | (1UL << LPUART_DATA_R8T8_SHIFT)); base->DATA = temp; }
eclipse-threadx/getting-started
C++
Other
310
/* Writes N bytes of data in the Mailbox, starting from first Mailbox Address. */
int32_t ST25DV_WriteMailboxData(ST25DV_Object_t *pObj, const uint8_t *const pData, const uint16_t NbByte)
/* Writes N bytes of data in the Mailbox, starting from first Mailbox Address. */ int32_t ST25DV_WriteMailboxData(ST25DV_Object_t *pObj, const uint8_t *const pData, const uint16_t NbByte)
{ int32_t status = ST25DV_ERROR; if( NbByte <= ST25DV_MAX_MAILBOX_LENGTH ) { status = pObj->IO.Write( ST25DV_ADDR_DATA_I2C, ST25DV_MAILBOX_RAM_REG, pData, NbByte ); } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* Open EQEI in specified mode and enable input. */
void EQEI_Open(EQEI_T *eqei, uint32_t u32Mode, uint32_t u32Value)
/* Open EQEI in specified mode and enable input. */ void EQEI_Open(EQEI_T *eqei, uint32_t u32Mode, uint32_t u32Value)
{ eqei->CTL = (eqei->CTL & (~EQEI_CTL_MODE_Msk)) | ((u32Mode) | EQEI_CTL_CHAEN_Msk | EQEI_CTL_CHBEN_Msk | EQEI_CTL_IDXEN_Msk); eqei->CNTMAX = u32Value; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(handle); if (handle->rxState == kLPUART_RxIdle) { LPUART_DisableInterrupts(base, kLPUART_RxDataRegFullInterruptEnable | kLPUART_RxOverrunInterruptEnable); } handle->rxRingBuffer = NULL; handle->rxRingBufferSize = 0U; handle->rxRingBufferHead = 0U; handle->rxRingBufferTail = 0U; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Check if an address matches a certain family. */
int nl_addr_valid(char *addr, int family)
/* Check if an address matches a certain family. */ int nl_addr_valid(char *addr, int family)
{ int ret; char buf[32]; switch (family) { case AF_INET: case AF_INET6: ret = inet_pton(family, addr, buf); if (ret <= 0) return 0; break; case AF_DECnet: ret = dnet_pton(addr, buf); if (ret <= 0) return 0; break; case AF_LLC: if (sscanf(addr, "%*02x:%*02x:%*02x:%*02x:%*02x:%*02x") != 6) return 0; break; } return 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configure the Number of valid bits in last word of the message. */
void HASH_ConfigLastWordValidBitsNbr(uint16_t validNumber)
/* Configure the Number of valid bits in last word of the message. */ void HASH_ConfigLastWordValidBitsNbr(uint16_t validNumber)
{ HASH->START_B.LWNUM = RESET; HASH->START_B.LWNUM = validNumber; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* uwb_rc_neh_put - release reference to a neh @neh: the neh */
void uwb_rc_neh_put(struct uwb_rc_neh *neh)
/* uwb_rc_neh_put - release reference to a neh @neh: the neh */ void uwb_rc_neh_put(struct uwb_rc_neh *neh)
{ kref_put(&neh->kref, uwb_rc_neh_release); }
robutest/uclinux
C++
GPL-2.0
60
/* The constructor function gets the pointer of the WinNT thunk functions It will ASSERT() if Unix thunk protocol is not installed. */
EFI_STATUS EFIAPI DxeEmuPeCoffLibExtraActionConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function gets the pointer of the WinNT thunk functions It will ASSERT() if Unix thunk protocol is not installed. */ EFI_STATUS EFIAPI DxeEmuPeCoffLibExtraActionConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_HOB_GUID_TYPE *GuidHob; GuidHob = GetFirstGuidHob (&gEmuThunkProtocolGuid); ASSERT (GuidHob != NULL); mThunk = (EMU_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob))); ASSERT (mThunk != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Adjusts the Internal Multi Speed oscillator (MSI) calibration value. */
void RCC_AdjustMSICalibrationValue(uint8_t MSICalibrationValue)
/* Adjusts the Internal Multi Speed oscillator (MSI) calibration value. */ void RCC_AdjustMSICalibrationValue(uint8_t MSICalibrationValue)
{ assert_param(IS_RCC_MSI_CALIBRATION_VALUE(MSICalibrationValue)); *(__IO uint8_t *) ICSCR_BYTE4_ADDRESS = MSICalibrationValue; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Wait for I/O to driver to complete and unregister PPP channel. This is already done by the close routine, so just call that. */
static int ppp_asynctty_hangup(struct tty_struct *tty)
/* Wait for I/O to driver to complete and unregister PPP channel. This is already done by the close routine, so just call that. */ static int ppp_asynctty_hangup(struct tty_struct *tty)
{ ppp_asynctty_close(tty); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate SDRAM device size based on SDRAM controller parameters. Size is specified in bytes. */
static phys_size_t sdram_calculate_size(struct altera_sdram_platdata *plat)
/* Calculate SDRAM device size based on SDRAM controller parameters. Size is specified in bytes. */ static phys_size_t sdram_calculate_size(struct altera_sdram_platdata *plat)
{ u32 dramaddrw = hmc_readl(plat, DRAMADDRW); phys_size_t size = 1 << (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) + DRAMADDRW_CFG_BANK_GRP_ADDR_WIDTH(dramaddrw) + DRAMADDRW_CFG_BANK_ADDR_WIDTH(dramaddrw) + DRAMADDRW_CFG_ROW_ADDR_WIDTH(dramaddrw) + DRAMADDRW_CFG_COL_ADDR_WIDTH(dramaddrw)); size *= (2 << (hmc_ecc_readl(plat, DDRIOCTRL) & DDR_HMC_DDRIOCTRL_IOSIZE_MSK)); return size; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Writes the RF Zone Security Status (defining the allowed RF accesses) Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteRFZxSS(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, const ST25DV_RF_PROT_ZONE RfProtZone)
/* Writes the RF Zone Security Status (defining the allowed RF accesses) Needs the I2C Password presentation to be effective. */ int32_t BSP_NFCTAG_WriteRFZxSS(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, const ST25DV_RF_PROT_ZONE RfProtZone)
{ UNUSED(Instance); return ST25DV_WriteRFZxSS(&NfcTagObj, Zone, RfProtZone); }
eclipse-threadx/getting-started
C++
Other
310
/* This function computes and updates the ACPI table checksum. */
EFI_STATUS EFIAPI AcpiPlatformChecksum(IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable)
/* This function computes and updates the ACPI table checksum. */ EFI_STATUS EFIAPI AcpiPlatformChecksum(IN EFI_ACPI_DESCRIPTION_HEADER *AcpiTable)
{ UINT8 *Ptr; UINT8 Sum; UINT32 Size; if (AcpiTable == NULL) { ASSERT (0); return EFI_INVALID_PARAMETER; } Ptr = (UINT8 *)AcpiTable; Size = AcpiTable->Length; Sum = 0; AcpiTable->Checksum = 0; while ((Size--) != 0) { Sum = (UINT8)(Sum + (*Ptr++)); } AcpiTable->Checksum = (UINT8)(0xFF - Sum + 1); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This function transfers the memory data to the USB MSC interface */
Ctrl_status virtual_usb_read_10(uint32_t addr, uint16_t nb_sector)
/* This function transfers the memory data to the USB MSC interface */ Ctrl_status virtual_usb_read_10(uint32_t addr, uint16_t nb_sector)
{ return virtual_usb_trans(addr, nb_sector, true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Serializes the "static part" of a call message header. The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. The rm_xid is not really static, but the user can easily munge on the fly. */
bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
/* Serializes the "static part" of a call message header. The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. The rm_xid is not really static, but the user can easily munge on the fly. */ bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
{ cmsg->rm_direction = CALL; cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION; if ( (xdrs->x_op == XDR_ENCODE) && xdr_u_long(xdrs, &(cmsg->rm_xid)) && xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog))) return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers))); return (FALSE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Common Timer1 interrupt handler. This function handles Timer1 counter overflow interrupt request */
void TIMER1_IRQHandler(void)
/* Common Timer1 interrupt handler. This function handles Timer1 counter overflow interrupt request */ void TIMER1_IRQHandler(void)
{ if (TIMER1->IF & TIMER_IF_OF) { if (timerCbTable[1].cbFunc != RT_NULL) { (timerCbTable[1].cbFunc)(timerCbTable[1].userPtr); } BITBAND_Peripheral(&(TIMER1->IFC), _TIMER_IF_OF_SHIFT, 0x1UL); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* qla2x00_nv_deselect() - Deselect NVRAM operations. @ha: HA context */
static void qla2x00_nv_deselect(struct qla_hw_data *ha)
/* qla2x00_nv_deselect() - Deselect NVRAM operations. @ha: HA context */ static void qla2x00_nv_deselect(struct qla_hw_data *ha)
{ struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; WRT_REG_WORD(&reg->nvram, NVR_DESELECT); RD_REG_WORD(&reg->nvram); NVRAM_DELAY(); }
robutest/uclinux
C++
GPL-2.0
60
/* calc_dd_growth - calculate approximate amount of data which makes other data dirty from budgeting request. */
static int calc_dd_growth(const struct ubifs_info *c, const struct ubifs_budget_req *req)
/* calc_dd_growth - calculate approximate amount of data which makes other data dirty from budgeting request. */ static int calc_dd_growth(const struct ubifs_info *c, const struct ubifs_budget_req *req)
{ int dd_growth; dd_growth = req->dirtied_page ? c->page_budget : 0; if (req->dirtied_ino) dd_growth += c->inode_budget << (req->dirtied_ino - 1); if (req->mod_dent) dd_growth += c->dent_budget; dd_growth += req->dirtied_ino_d; return dd_growth; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in StartAddress are set, then ASSERT(). If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). */
UINTN EFIAPI S3PciSegmentWriteBuffer(IN UINT64 StartAddress, IN UINTN Size, IN VOID *Buffer)
/* If any reserved bits in StartAddress are set, then ASSERT(). If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). */ UINTN EFIAPI S3PciSegmentWriteBuffer(IN UINT64 StartAddress, IN UINTN Size, IN VOID *Buffer)
{ RETURN_STATUS Status; Status = S3BootScriptSavePciCfg2Write ( S3BootScriptWidthUint8, RShiftU64 (StartAddress, 32) & 0xffff, PCI_SEGMENT_LIB_ADDRESS_TO_S3_BOOT_SCRIPT_PCI_ADDRESS (StartAddress), PciSegmentWriteBuffer (StartAddress, Size, Buffer), Buffer ); ASSERT_RETURN_ERROR (Status); return Size; }
tianocore/edk2
C++
Other
4,240
/* Get the current information about the video hardware */
const SDL_VideoInfo* SDL_GetVideoInfo(void)
/* Get the current information about the video hardware */ const SDL_VideoInfo* SDL_GetVideoInfo(void)
{ const SDL_VideoInfo *info; info = NULL; if ( current_video ) { info = &current_video->info; } return(info); }
DC-SWAT/DreamShell
C++
null
404
/* Some touchscreens need hsync information from the video driver to function correctly. We export it here. Note that 'hsync_time' and the value returned from pxafb_get_hsync_time() is the */
static void set_hsync_time(struct pxafb_info *fbi, unsigned int pcd)
/* Some touchscreens need hsync information from the video driver to function correctly. We export it here. Note that 'hsync_time' and the value returned from pxafb_get_hsync_time() is the */ static void set_hsync_time(struct pxafb_info *fbi, unsigned int pcd)
{ unsigned long htime; if ((pcd == 0) || (fbi->fb.var.hsync_len == 0)) { fbi->hsync_time = 0; return; } htime = clk_get_rate(fbi->clk) / (pcd * fbi->fb.var.hsync_len); fbi->hsync_time = htime; }
robutest/uclinux
C++
GPL-2.0
60
/* Comparator 0 Interrupt Handler. If users want to user the ACMP Interrupt Callback feature, Users should promise that the ACMP Handle in the vector table is ACMPIntHandler. */
void ACMPIntHandler(void)
/* Comparator 0 Interrupt Handler. If users want to user the ACMP Interrupt Callback feature, Users should promise that the ACMP Handle in the vector table is ACMPIntHandler. */ void ACMPIntHandler(void)
{ unsigned long ulBase = ACMP_BASE; unsigned long ulIntFlags; ulIntFlags = xHWREG(ulBase + ACMP_SR); xHWREG(ulBase + ACMP_SR) = ulIntFlags; if((ulIntFlags & ACMP_SR_CMPF0) && g_pfnACMPHandlerCallbacks[0]) { g_pfnACMPHandlerCallbacks[0](0, 0, 0, 0); } if((ulIntFlags & ACMP_SR_CMPF1) && g_pfnACMPHandlerCallbacks[1]) { g_pfnACMPHandlerCallbacks[1](0, 0, 0, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* return explanation code if login request is rejected */
u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps)
/* return explanation code if login request is rejected */ u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps)
{ return lps->lsrjt_expl; }
robutest/uclinux
C++
GPL-2.0
60
/* __enable_port - enable the port's slave, if it's up @port: the port we're looking at */
static void __enable_port(struct port *port)
/* __enable_port - enable the port's slave, if it's up @port: the port we're looking at */ static void __enable_port(struct port *port)
{ struct slave *slave = port->slave; if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) { bond_set_slave_active_flags(slave); } }
robutest/uclinux
C++
GPL-2.0
60
/* The PZL must be valid (e.g., all entries in the list should have the T bit set). */
void pzl_start(struct whc *whc)
/* The PZL must be valid (e.g., all entries in the list should have the T bit set). */ void pzl_start(struct whc *whc)
{ le_writeq(whc->pz_list_dma, whc->base + WUSBPERIODICLISTBASE); whc_write_wusbcmd(whc, WUSBCMD_PERIODIC_EN, WUSBCMD_PERIODIC_EN); whci_wait_for(&whc->umc->dev, whc->base + WUSBSTS, WUSBSTS_PERIODIC_SCHED, WUSBSTS_PERIODIC_SCHED, 1000, "start PZL"); }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether one IP address is filled with ZERO. */
BOOLEAN TcpIsIpZero(IN EFI_IP_ADDRESS *Ip, IN UINT8 Version)
/* Check whether one IP address is filled with ZERO. */ BOOLEAN TcpIsIpZero(IN EFI_IP_ADDRESS *Ip, IN UINT8 Version)
{ ASSERT ((Version == IP_VERSION_4) || (Version == IP_VERSION_6)); if (Version == IP_VERSION_4) { return (BOOLEAN)(Ip->Addr[0] == 0); } else { return (BOOLEAN)((Ip->Addr[0] == 0) && (Ip->Addr[1] == 0) && (Ip->Addr[2] == 0) && (Ip->Addr[3] == 0)); } }
tianocore/edk2
C++
Other
4,240
/* param base eDMA peripheral base address. param channel eDMA channel number. param config A pointer to the minor offset configuration structure. */
void EDMA_SetMinorOffsetConfig(DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config)
/* param base eDMA peripheral base address. param channel eDMA channel number. param config A pointer to the minor offset configuration structure. */ void EDMA_SetMinorOffsetConfig(DMA_Type *base, uint32_t channel, const edma_minor_offset_config_t *config)
{ assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL); assert(config != NULL); uint32_t tmpreg; tmpreg = base->TCD[channel].NBYTES_MLOFFYES; tmpreg &= ~(DMA_NBYTES_MLOFFYES_SMLOE_MASK | DMA_NBYTES_MLOFFYES_DMLOE_MASK | DMA_NBYTES_MLOFFYES_MLOFF_MASK); tmpreg |= (DMA_NBYTES_MLOFFYES_SMLOE(config->enableSrcMinorOffset) | DMA_NBYTES_MLOFFYES_DMLOE(config->enableDestMinorOffset) | DMA_NBYTES_MLOFFYES_MLOFF(config->minorOffset)); base->TCD[channel].NBYTES_MLOFFYES = tmpreg; }
eclipse-threadx/getting-started
C++
Other
310
/* Set the PWM frequency of the PWM module. The */
unsigned long PWMFrequencyConfig(unsigned long ulBase, unsigned long ulConfig)
/* Set the PWM frequency of the PWM module. The */ unsigned long PWMFrequencyConfig(unsigned long ulBase, unsigned long ulConfig)
{ unsigned char ulPreScale; unsigned short usMODValue; xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE) || (ulBase == PWMC_BASE)); ulPreScale = ulConfig & 0x07; usMODValue = ((ulConfig & 0xFFFF0000) >> 16); xHWREG(ulBase + TPM_SC) &= ~TPM_SC_PS_M; xHWREG(ulBase + TPM_SC) |= ulPreScale; xHWREG(ulBase + TPM_MOD) = usMODValue; return(SysCtlPWMAndUART0ClkGet() / usMODValue / ulPreScale); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104