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 |
|---|---|---|---|---|---|---|---|
/* Spill all the per-cpu pages from all CPUs back into the buddy allocator */ | void drain_all_pages(void) | /* Spill all the per-cpu pages from all CPUs back into the buddy allocator */
void drain_all_pages(void) | {
on_each_cpu(drain_local_pages, NULL, 1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the ball axis change since the last poll */ | int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy) | /* Get the ball axis change since the last poll */
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy) | {
int retval;
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
retval = 0;
if ( ball < joystick->nballs ) {
if ( dx ) {
*dx = joystick->balls[ball].dx;
}
if ( dy ) {
*dy = joystick->balls[ball].dy;
}
joystick->balls[ball].dx = 0;
joystick->balls[ball].dy = 0;
} else {
SDL_SetError("Joystick only has %d balls", joystick->nballs);
retval = -1;
}
return(retval);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* RCC Read the Clock Security System Interrupt Flag. */ | int rcc_css_int_flag(void) | /* RCC Read the Clock Security System Interrupt Flag. */
int rcc_css_int_flag(void) | {
return ((RCC_CIR & RCC_CIR_CSSF) != 0);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Name: ddr3_tip_pbs_tx. Desc: PBS TX Args: TBD Notes: Returns: OK if success, other error code if fail. */ | int ddr3_tip_pbs_tx(u32 uidev_num) | /* Name: ddr3_tip_pbs_tx. Desc: PBS TX Args: TBD Notes: Returns: OK if success, other error code if fail. */
int ddr3_tip_pbs_tx(u32 uidev_num) | {
return ddr3_tip_pbs(uidev_num, PBS_TX_MODE);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Change Logs: Date Author Notes Bernard first version Meco Man suuport pref_counter */ | static uint64_t cortexm_cputime_getres(void) | /* Change Logs: Date Author Notes Bernard first version Meco Man suuport pref_counter */
static uint64_t cortexm_cputime_getres(void) | {
uint64_t ret = 1000UL * 1000 * 1000;
ret = (ret * (1000UL * 1000)) / SystemCoreClock;
return ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes the data to PHY register at the offset. Assumes semaphore already acquired. */ | s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) | /* Writes the data to PHY register at the offset. Assumes semaphore already acquired. */
s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data) | {
return __e1000_write_phy_reg_hv(hw, offset, data, true);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The qualifier defined here is not the value that is masked, it defines conditions for the write to take place. The actual masked qualifier (and other related details) are defined beforehand with _set_shuttle_features(). */ | static int usbat_write_blocks(struct us_data *us, void *buffer, int len, int use_sg) | /* The qualifier defined here is not the value that is masked, it defines conditions for the write to take place. The actual masked qualifier (and other related details) are defined beforehand with _set_shuttle_features(). */
static int usbat_write_blocks(struct us_data *us, void *buffer, int len, int use_sg) | {
int result;
unsigned char *command = us->iobuf;
command[0] = 0x40;
command[1] = USBAT_ATA | USBAT_CMD_COND_WRITE_BLOCK;
command[2] = USBAT_ATA_DATA;
command[3] = USBAT_ATA_STATUS;
command[4] = 0xFD;
command[5] = USBAT_QUAL_FCQ;
command[6] = LSB_of(len);
command[7] = MSB_of(len);
result = usbat_execute_command(us, command, 8);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_FAILED;
result = usbat_bulk_write(us, buffer, len, use_sg);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_FAILED;
return USB_STOR_TRANSPORT_GOOD;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note that some windows versions actually send multiword UTF-16 characters instead of straight UCS-2. The linux nls routines however aren't able to deal with those characters properly. In the event that we get some of those characters, they won't be translated properly. */ | int cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen, const struct nls_table *codepage, bool mapchar) | /* Note that some windows versions actually send multiword UTF-16 characters instead of straight UCS-2. The linux nls routines however aren't able to deal with those characters properly. In the event that we get some of those characters, they won't be translated properly. */
int cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen, const struct nls_table *codepage, bool mapchar) | {
int i, charlen, safelen;
int outlen = 0;
int nullsize = nls_nullsize(codepage);
int fromwords = fromlen / 2;
char tmp[NLS_MAX_CHARSET_SIZE];
safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize);
for (i = 0; i < fromwords && from[i]; i++) {
if (outlen >= safelen) {
charlen = cifs_mapchar(tmp, from[i], codepage, mapchar);
if ((outlen + charlen) > (tolen - nullsize))
break;
}
charlen = cifs_mapchar(&to[outlen], from[i], codepage, mapchar);
outlen += charlen;
}
for (i = 0; i < nullsize; i++)
to[outlen++] = 0;
return outlen;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the sync status of a given region. This function must not fail. */ | static void userspace_set_region_sync(struct dm_dirty_log *log, region_t region, int in_sync) | /* Set the sync status of a given region. This function must not fail. */
static void userspace_set_region_sync(struct dm_dirty_log *log, region_t region, int in_sync) | {
int r;
struct log_c *lc = log->context;
struct {
region_t r;
int64_t i;
} pkg;
pkg.r = region;
pkg.i = (int64_t)in_sync;
r = userspace_do_request(lc, lc->uuid, DM_ULOG_SET_REGION_SYNC,
(char *)&pkg, sizeof(pkg),
NULL, NULL);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Print out a character, filtering out the non-printable ones */ | void fn_print_char(netdissect_options *ndo, u_char c) | /* Print out a character, filtering out the non-printable ones */
void fn_print_char(netdissect_options *ndo, u_char c) | {
if (!ND_ISASCII(c)) {
c = ND_TOASCII(c);
ND_PRINT((ndo, "M-"));
}
if (!ND_ISPRINT(c)) {
c ^= 0x40;
ND_PRINT((ndo, "^"));
}
ND_PRINT((ndo, "%c", c));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* ide_do_reset() is the entry point to the drive/interface reset code. */ | ide_startstop_t ide_do_reset(ide_drive_t *drive) | /* ide_do_reset() is the entry point to the drive/interface reset code. */
ide_startstop_t ide_do_reset(ide_drive_t *drive) | {
return do_reset1(drive, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* FDCAN MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan) | /* FDCAN MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan) | {
if(hfdcan->Instance==FDCAN1)
{
__HAL_RCC_FDCAN_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Checks whether the date and time passed in is valid. */ | static bool RTC_CheckDatetimeFormat(const rtc_datetime_t *datetime) | /* Checks whether the date and time passed in is valid. */
static bool RTC_CheckDatetimeFormat(const rtc_datetime_t *datetime) | {
uint8_t daysPerMonth[] = {0U, 31U, 28U, 31U, 30U, 31U, 30U, 31U, 31U, 30U, 31U, 30U, 31U};
if ((datetime->year < YEAR_RANGE_START) || (datetime->year > YEAR_RANGE_END) || (datetime->month > 12U) ||
(datetime->month < 1U) || (datetime->hour >= 24U) || (datetime->minute >= 60U) || (datetime->second >= 60U))
{
return false;
}
if (!(datetime->year & 3U))
{
daysPerMonth[2] = 29U;
}
if (datetime->day > daysPerMonth[datetime->month])
{
return false;
}
return true;
} | labapart/polymcu | C++ | null | 201 |
/* Enable the specified ADC start of the injected. */ | void ADC_EnableSoftwareStartInjectedConv(ADC_T *adc) | /* Enable the specified ADC start of the injected. */
void ADC_EnableSoftwareStartInjectedConv(ADC_T *adc) | {
adc->CTRL2_B.INJEXTTRGEN = BIT_SET;
adc->CTRL2_B.INJSWSC = BIT_SET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Record SSC clock dividers for use in hw_params(). */ | static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, int div_id, int div) | /* Record SSC clock dividers for use in hw_params(). */
static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, int div_id, int div) | {
struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id];
switch (div_id) {
case ATMEL_SSC_CMR_DIV:
if (ssc_p->cmr_div == 0)
ssc_p->cmr_div = div;
else
if (div != ssc_p->cmr_div)
return -EBUSY;
break;
case ATMEL_SSC_TCMR_PERIOD:
ssc_p->tcmr_period = div;
break;
case ATMEL_SSC_RCMR_PERIOD:
ssc_p->rcmr_period = div;
break;
default:
return -EINVAL;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send by for particular services on particular PCB. */ | static void _mdns_pcb_send_bye(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, mdns_srv_item_t **services, size_t len, bool include_ip) | /* Send by for particular services on particular PCB. */
static void _mdns_pcb_send_bye(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, mdns_srv_item_t **services, size_t len, bool include_ip) | {
mdns_tx_packet_t * packet = _mdns_alloc_packet_default(tcpip_if, ip_protocol);
if (!packet) {
return;
}
packet->flags = MDNS_FLAGS_AUTHORITATIVE;
size_t i;
for (i=0; i<len; i++) {
if (!_mdns_alloc_answer(&packet->answers, MDNS_TYPE_PTR, services[i]->service, true, true)) {
_mdns_free_tx_packet(packet);
return;
}
}
if (include_ip && (!_mdns_alloc_answer(&packet->answers, MDNS_TYPE_A, NULL, true, true) || !_mdns_alloc_answer(&packet->answers, MDNS_TYPE_AAAA, NULL, true, true))) {
_mdns_free_tx_packet(packet);
return;
}
_mdns_dispatch_tx_packet(packet);
_mdns_free_tx_packet(packet);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Enables reception of all the frames to application. GMAC passes all the frames received to application irrespective of whether they pass SA/DA address filtering or not. */ | void synopGMAC_frame_filter_disable(synopGMACdevice *gmacdev) | /* Enables reception of all the frames to application. GMAC passes all the frames received to application irrespective of whether they pass SA/DA address filtering or not. */
void synopGMAC_frame_filter_disable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev -> MacBase, GmacFrameFilter, GmacFilter);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocate new Big Number and assign the provided value to it. */ | VOID* EFIAPI BigNumFromBin(IN CONST UINT8 *Buf, IN UINTN Len) | /* Allocate new Big Number and assign the provided value to it. */
VOID* EFIAPI BigNumFromBin(IN CONST UINT8 *Buf, IN UINTN Len) | {
CALL_CRYPTO_SERVICE (BigNumFromBin, (Buf, Len), NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Print the decimal UINTN immediate data to instruction content. */ | UINTN EdbPrintImmDatan(IN UINTN Data) | /* Print the decimal UINTN immediate data to instruction content. */
UINTN EdbPrintImmDatan(IN UINTN Data) | {
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
mInstructionContentOffset,
L"(%d)",
(UINTN)Data
);
mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data);
return mInstructionContentOffset;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Switches the SD card voltage from 3v3 to 1v8. */ | s32 XSdPs_Switch_Voltage(XSdPs *InstancePtr) | /* Switches the SD card voltage from 3v3 to 1v8. */
s32 XSdPs_Switch_Voltage(XSdPs *InstancePtr) | {
s32 Status;
Status = XSdPs_SetupVoltageSwitch(InstancePtr);
if (Status != XST_SUCCESS) {
Status = XST_FAILURE;
goto RETURN_PATH;
}
Status = XSdPs_CardSetVoltage18(InstancePtr);
if (Status != XST_SUCCESS) {
Status = XST_FAILURE;
goto RETURN_PATH;
}
Status = XSdPs_CheckBusHigh(InstancePtr);
if (Status != XST_SUCCESS) {
Status = XST_FAILURE;
}
RETURN_PATH:
return Status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* get MAC's output Port return : PA or PB */ | int cfm_get_mac_output(struct s_smc *smc) | /* get MAC's output Port return : PA or PB */
int cfm_get_mac_output(struct s_smc *smc) | {
return((smc->mib.fddiSMTCF_State == SC10_C_WRAP_B ||
smc->mib.fddiSMTCF_State == SC4_THRU_A) ? PB : PA) ;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This service allocates memory from the Hand-Off Block (HOB) heap. */ | EFI_STATUS EFIAPI PeiServicesAllocatePool(IN UINTN Size, OUT VOID **Buffer) | /* This service allocates memory from the Hand-Off Block (HOB) heap. */
EFI_STATUS EFIAPI PeiServicesAllocatePool(IN UINTN Size, OUT VOID **Buffer) | {
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the value for dynamic clock enable bit. */ | void EMC_DynCtrlClockEnable(uint32_t clock_enable) | /* Set the value for dynamic clock enable bit. */
void EMC_DynCtrlClockEnable(uint32_t clock_enable) | {
LPC_EMC->DynamicControl = ((LPC_EMC->DynamicControl) |clock_enable);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Finds the next free page in the given row if one is available. */ | static bool _eeprom_emulator_is_page_free_on_row(const uint8_t start_physical_page, uint8_t *const free_physical_page) | /* Finds the next free page in the given row if one is available. */
static bool _eeprom_emulator_is_page_free_on_row(const uint8_t start_physical_page, uint8_t *const free_physical_page) | {
uint8_t row = (start_physical_page / NVMCTRL_ROW_PAGES);
uint8_t page_in_row = (start_physical_page % NVMCTRL_ROW_PAGES);
for (uint8_t c = page_in_row; c < NVMCTRL_ROW_PAGES; c++) {
uint8_t page = (row * NVMCTRL_ROW_PAGES) + c;
if (_eeprom_instance.flash[page].header.logical_page ==
EEPROM_INVALID_PAGE_NUMBER) {
*free_physical_page = page;
return true;
}
}
return false;
} | memfault/zero-to-main | C++ | null | 200 |
/* Get TC77 temperature value and handle data in float. */ | float TC77TemperReadFloat(void) | /* Get TC77 temperature value and handle data in float. */
float TC77TemperReadFloat(void) | {
float fTemReturn;
short sTempValue;
sTempValue = TC77TemperRead();
sTempValue = sTempValue >> 3;
fTemReturn = (float)sTempValue * 0.0625;
return fTemReturn;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI UsbEcmComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI UsbEcmComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
gUsbEcmDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUsbEcmComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disables the inbound message unit, free all buffers, and frees the inbound message interrupt. */ | void rio_close_inb_mbox(struct rio_mport *mport, int mbox) | /* Disables the inbound message unit, free all buffers, and frees the inbound message interrupt. */
void rio_close_inb_mbox(struct rio_mport *mport, int mbox) | {
struct rio_priv *priv = mport->priv;
out_be32(&priv->msg_regs->imr, 0);
dma_free_coherent(priv->dev, priv->msg_rx_ring.size * RIO_MAX_MSG_SIZE,
priv->msg_rx_ring.virt, priv->msg_rx_ring.phys);
free_irq(IRQ_RIO_RX(mport), (void *)mport);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write a byte to the given SERCOM USART instance. */ | void _usart_sync_write_byte(struct _usart_sync_device *const device, uint8_t data) | /* Write a byte to the given SERCOM USART instance. */
void _usart_sync_write_byte(struct _usart_sync_device *const device, uint8_t data) | {
hri_sercomusart_write_DATA_reg(device->hw, data);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4|GPIO_PIN_5);
}
else if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
}
else if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_11);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_2);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ioc_set_batching sets ioc to be a new "batcher" if it is not one. This will cause the process to be a "batcher" on all queues in the system. This is the behaviour we want though - once it gets a wakeup it should be given a nice run. */ | static void ioc_set_batching(struct request_queue *q, struct io_context *ioc) | /* ioc_set_batching sets ioc to be a new "batcher" if it is not one. This will cause the process to be a "batcher" on all queues in the system. This is the behaviour we want though - once it gets a wakeup it should be given a nice run. */
static void ioc_set_batching(struct request_queue *q, struct io_context *ioc) | {
if (!ioc || ioc_batching(q, ioc))
return;
ioc->nr_batch_requests = q->nr_batching;
ioc->last_waited = jiffies;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Worker function to check if the compared CPU feature set in the CPU feature supported bits mask buffer. */ | BOOLEAN IsBitMaskMatch(IN UINT8 *SupportedFeatureMask, IN UINT8 *ComparedFeatureBitMask, IN UINT32 BitMaskSize) | /* Worker function to check if the compared CPU feature set in the CPU feature supported bits mask buffer. */
BOOLEAN IsBitMaskMatch(IN UINT8 *SupportedFeatureMask, IN UINT8 *ComparedFeatureBitMask, IN UINT32 BitMaskSize) | {
UINTN Index;
UINT8 *Data1;
UINT8 *Data2;
Data1 = SupportedFeatureMask;
Data2 = ComparedFeatureBitMask;
for (Index = 0; Index < BitMaskSize; Index++) {
if (((*(Data1++)) & (*(Data2++))) != 0) {
return TRUE;
}
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Localbus setup: CS0: Flash; CS1: MediaQ chip, select 16-bit bus and vlio; CS5: SAMCOP. */ | static void fix_msc(void) | /* Localbus setup: CS0: Flash; CS1: MediaQ chip, select 16-bit bus and vlio; CS5: SAMCOP. */
static void fix_msc(void) | {
MSC0 = 0x129c24f2;
MSC1 = 0x7ff424fa;
MSC2 = 0x7ff47ff4;
MDREFR |= 0x02080000;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* if failed, give up and free the control instance. */ | static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl) | /* if failed, give up and free the control instance. */
static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl) | {
struct usb_mixer_elem_info *cval = kctl->private_data;
int err;
while (snd_ctl_find_id(state->chip->card, &kctl->id))
kctl->id.index++;
if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) {
snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
return err;
}
cval->elem_id = &kctl->id;
cval->next_id_elem = state->mixer->id_elems[cval->id];
state->mixer->id_elems[cval->id] = cval;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to Bluetooth LE device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBluetoothLE(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to Bluetooth LE device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBluetoothLE(IN CHAR16 *TextDeviceNode) | {
CHAR16 *BluetoothLeAddrStr;
CHAR16 *BluetoothLeAddrTypeStr;
BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;
BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode);
BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);
BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_BLUETOOTH_LE_DP,
(UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)
);
BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);
StrHexToBytes (
BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
);
return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Compares two 8-bit buffers and returns the comparison result. */ | uint8_t Buffercmp8(uint8_t *pBuffer1, uint8_t *pBuffer2, uint8_t BufferLength) | /* Compares two 8-bit buffers and returns the comparison result. */
uint8_t Buffercmp8(uint8_t *pBuffer1, uint8_t *pBuffer2, uint8_t BufferLength) | {
while (BufferLength--)
{
if (*pBuffer1 != *pBuffer2)
{
return 1;
}
pBuffer1++;
pBuffer2++;
}
return 0;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* agp_rebind_emmory - Rewrite the entire GATT, useful on resume */ | int agp_rebind_memory(void) | /* agp_rebind_emmory - Rewrite the entire GATT, useful on resume */
int agp_rebind_memory(void) | {
struct agp_memory *curr;
int ret_val = 0;
spin_lock(&agp_bridge->mapped_lock);
list_for_each_entry(curr, &agp_bridge->mapped_list, mapped_list) {
ret_val = curr->bridge->driver->insert_memory(curr,
curr->pg_start,
curr->type);
if (ret_val != 0)
break;
}
spin_unlock(&agp_bridge->mapped_lock);
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Register callback function upon VariableLockProtocol to lock EFI_CAPSULE_LONG_MODE_BUFFER_NAME variable to avoid malicious code to update it. */ | VOID EFIAPI VariableLockCapsuleLongModeBufferVariable(IN EFI_EVENT Event, IN VOID *Context) | /* Register callback function upon VariableLockProtocol to lock EFI_CAPSULE_LONG_MODE_BUFFER_NAME variable to avoid malicious code to update it. */
VOID EFIAPI VariableLockCapsuleLongModeBufferVariable(IN EFI_EVENT Event, IN VOID *Context) | {
EFI_STATUS Status;
EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLock);
if (!EFI_ERROR (Status)) {
Status = VariableLock->RequestToLock (VariableLock, EFI_CAPSULE_LONG_MODE_BUFFER_NAME, &gEfiCapsuleVendorGuid);
ASSERT_EFI_ERROR (Status);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* HIGH is XOR'ed with the corresponding bit in the software-pulse and the PRS input signal to generate. */ | void prs_software_level_high(enum prs_ch ch) | /* HIGH is XOR'ed with the corresponding bit in the software-pulse and the PRS input signal to generate. */
void prs_software_level_high(enum prs_ch ch) | {
PRS_SWLEVEL |= PRS_SWLEVEL_CHxLEVEL(ch);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Main entry point for an SMM handler dispatch or communicate-based callback. */ | EFI_STATUS EFIAPI SmmS3EntryCallBack(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL) | /* Main entry point for an SMM handler dispatch or communicate-based callback. */
EFI_STATUS EFIAPI SmmS3EntryCallBack(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL) | {
mDuringS3Resume = TRUE;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This is a helper function which notifies all subscribers about a volume change event (creation, removal, re-sizing, re-naming, updating). Returns zero in case of success and a negative error code in case of failure. */ | int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype) | /* This is a helper function which notifies all subscribers about a volume change event (creation, removal, re-sizing, re-naming, updating). Returns zero in case of success and a negative error code in case of failure. */
int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype) | {
struct ubi_notification nt;
ubi_do_get_device_info(ubi, &nt.di);
ubi_do_get_volume_info(ubi, vol, &nt.vi);
return blocking_notifier_call_chain(&ubi_notifiers, ntype, &nt);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parses the non urc C(E)REG and updates registration status. */ | MODEM_CMD_DEFINE(on_cmd_cereg) | /* Parses the non urc C(E)REG and updates registration status. */
MODEM_CMD_DEFINE(on_cmd_cereg) | {
mdata.mdm_registration = atoi(argv[1]);
LOG_INF("CREG: %u", mdata.mdm_registration);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Convert the multibyte field in IP header's byter order. In spite of its name, it can also be used to convert from host to network byte order. */ | EFI_IP6_HEADER* Ip6NtohHead(IN OUT EFI_IP6_HEADER *Head) | /* Convert the multibyte field in IP header's byter order. In spite of its name, it can also be used to convert from host to network byte order. */
EFI_IP6_HEADER* Ip6NtohHead(IN OUT EFI_IP6_HEADER *Head) | {
Head->FlowLabelL = NTOHS (Head->FlowLabelL);
Head->PayloadLength = NTOHS (Head->PayloadLength);
return Head;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Time period register for step detection on delta time (r/w).. */ | int32_t lsm6dso_pedo_steps_period_get(stmdev_ctx_t *ctx, uint16_t *val) | /* Time period register for step detection on delta time (r/w).. */
int32_t lsm6dso_pedo_steps_period_get(stmdev_ctx_t *ctx, uint16_t *val) | {
uint8_t buff[2];
int32_t ret;
ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_L,
&buff[0]);
if (ret == 0) {
ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_H,
&buff[1]);
*val = buff[1];
*val = (*val * 256U) + buff[0];
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function will set an address to the usb device. */ | rt_err_t rt_usbh_set_address(uinst_t device) | /* This function will set an address to the usb device. */
rt_err_t rt_usbh_set_address(uinst_t device) | {
struct urequest setup;
int timeout = USB_TIMEOUT_BASIC;
RT_ASSERT(device != RT_NULL);
LOG_D("rt_usb_set_address");
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD |
USB_REQ_TYPE_DEVICE;
setup.bRequest = USB_REQ_SET_ADDRESS;
setup.wIndex = 0;
setup.wLength = 0;
setup.wValue = device->index;
if(rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) != 8)
{
return -RT_ERROR;
}
if(rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, RT_NULL, 0, timeout) == 0)
{
device->address = device->index;
}
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This routine compare the fcf record's mac address with HBA's FCF mac address. If the mac addresses are identical this function returns 1 else return 0. */ | static uint32_t lpfc_mac_addr_match(struct lpfc_hba *phba, struct fcf_record *new_fcf_record) | /* This routine compare the fcf record's mac address with HBA's FCF mac address. If the mac addresses are identical this function returns 1 else return 0. */
static uint32_t lpfc_mac_addr_match(struct lpfc_hba *phba, struct fcf_record *new_fcf_record) | {
if ((phba->fcf.mac_addr[0] ==
bf_get(lpfc_fcf_record_mac_0, new_fcf_record)) &&
(phba->fcf.mac_addr[1] ==
bf_get(lpfc_fcf_record_mac_1, new_fcf_record)) &&
(phba->fcf.mac_addr[2] ==
bf_get(lpfc_fcf_record_mac_2, new_fcf_record)) &&
(phba->fcf.mac_addr[3] ==
bf_get(lpfc_fcf_record_mac_3, new_fcf_record)) &&
(phba->fcf.mac_addr[4] ==
bf_get(lpfc_fcf_record_mac_4, new_fcf_record)) &&
(phba->fcf.mac_addr[5] ==
bf_get(lpfc_fcf_record_mac_5, new_fcf_record)))
return 1;
else
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the first vlan id in the list for this vpath. see also: vxge_hw_vpath_vid_get_next */ | enum vxge_hw_status vxge_hw_vpath_vid_get(struct __vxge_hw_vpath_handle *vp, u64 *vid) | /* Returns the first vlan id in the list for this vpath. see also: vxge_hw_vpath_vid_get_next */
enum vxge_hw_status vxge_hw_vpath_vid_get(struct __vxge_hw_vpath_handle *vp, u64 *vid) | {
u64 data;
enum vxge_hw_status status = VXGE_HW_OK;
if (vp == NULL) {
status = VXGE_HW_ERR_INVALID_HANDLE;
goto exit;
}
status = __vxge_hw_vpath_rts_table_get(vp,
VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_LIST_FIRST_ENTRY,
VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_VID,
0, vid, &data);
*vid = VXGE_HW_RTS_ACCESS_STEER_DATA0_GET_VLAN_ID(*vid);
exit:
return status;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculate the period of DDR clock from frequency value and set the denominator and numerator in global variables for easy access later */ | static void set_ddr_clk_period(u32 freq) | /* Calculate the period of DDR clock from frequency value and set the denominator and numerator in global variables for easy access later */
static void set_ddr_clk_period(u32 freq) | {
*T_num = 1000000000;
*T_den = freq;
cancel_out(T_num, T_den, 200);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* nand_resume - Resume the NAND flash @mtd: MTD device structure */ | static void nand_resume(struct mtd_info *mtd) | /* nand_resume - Resume the NAND flash @mtd: MTD device structure */
static void nand_resume(struct mtd_info *mtd) | {
struct nand_chip *chip = mtd->priv;
if (chip->state == FL_PM_SUSPENDED)
nand_release_device(mtd);
else
printk(KERN_ERR "%s called for a chip which is not "
"in suspended state\n", __func__);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the number of major loops finished, i.e. TCD_BITER - TCD_CITER, where BITER is the number of major loops (iterations) requested and CITER is the number of major loops left to perform. */ | int kinetis_dma_ch_iter_done(int ch) | /* Returns the number of major loops finished, i.e. TCD_BITER - TCD_CITER, where BITER is the number of major loops (iterations) requested and CITER is the number of major loops left to perform. */
int kinetis_dma_ch_iter_done(int ch) | {
return KINETIS_DMA->tcd[ch].biter - KINETIS_DMA->tcd[ch].citer;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The UNREG_VFI mailbox command causes the SLI Host to put a virtual fabric (logical NPort) into the inactive state. The SLI Host must have logged out and unregistered all remote N_Ports to abort any activity on the virtual fabric. The SLI Port posts the mailbox response after marking the virtual fabric inactive. */ | void lpfc_unreg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport) | /* The UNREG_VFI mailbox command causes the SLI Host to put a virtual fabric (logical NPort) into the inactive state. The SLI Host must have logged out and unregistered all remote N_Ports to abort any activity on the virtual fabric. The SLI Port posts the mailbox response after marking the virtual fabric inactive. */
void lpfc_unreg_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport) | {
memset(mbox, 0, sizeof(*mbox));
bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_VFI);
bf_set(lpfc_unreg_vfi_vfi, &mbox->u.mqe.un.unreg_vfi,
vport->vfi + vport->phba->vfi_base);
} | 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->bi.page_budget : 0;
if (req->dirtied_ino)
dd_growth += c->bi.inode_budget << (req->dirtied_ino - 1);
if (req->mod_dent)
dd_growth += c->bi.dent_budget;
dd_growth += req->dirtied_ino_d;
return dd_growth;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function use to reset FMI eMMC function. */ | void eMMC_Open(void) | /* This function use to reset FMI eMMC function. */
void eMMC_Open(void) | {
outpw(REG_FMI_DMACTL, FMI_DMACTL_DMARST_Msk);
while (inpw(REG_FMI_DMACTL) & FMI_DMACTL_DMARST_Msk);
outpw(REG_FMI_DMACTL, FMI_DMACTL_DMAEN_Msk);
outpw(REG_FMI_CTL, FMI_CTL_CTLRST_Msk);
while (inpw(REG_FMI_CTL) & FMI_CTL_CTLRST_Msk);
outpw(REG_FMI_CTL, FMI_CTL_EMMCEN_Msk);
outpw(REG_FMI_EMMCCTL, inpw(REG_FMI_EMMCCTL) | FMI_EMMCCTL_CTLRST_Msk);
while (inpw(REG_FMI_EMMCCTL) & FMI_EMMCCTL_CTLRST_Msk);
memset(&eMMC, 0, sizeof(EMMC_INFO_T));
eMMC.IsCardInsert = 1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write string to c42048a lcd glass numeric field.
This function will write the input string to the numeric field of the lcd glass. */ | static void c42364a_write_num_packet(const uint8_t *data) | /* Write string to c42048a lcd glass numeric field.
This function will write the input string to the numeric field of the lcd glass. */
static void c42364a_write_num_packet(const uint8_t *data) | {
lcdca_write_packet(LCDCA_TDG_7SEG4COM, FIRST_7SEG_4C, data, \
WIDTH_7SEG_4C, DIR_7SEG_4C);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Activate or deactivate the channel monitor. When area is NULL, the monitor is deactivated. The channel monitor needs to be active in order to measure subchannels, which also need to be enabled. */ | static void cmf_activate(void *area, unsigned int onoff) | /* Activate or deactivate the channel monitor. When area is NULL, the monitor is deactivated. The channel monitor needs to be active in order to measure subchannels, which also need to be enabled. */
static void cmf_activate(void *area, unsigned int onoff) | {
register void * __gpr2 asm("2");
register long __gpr1 asm("1");
__gpr2 = area;
__gpr1 = onoff ? 2 : 0;
asm("schm" : : "d" (__gpr2), "d" (__gpr1) );
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the features supported by the link layer */ | uint64_t ble_ll_read_supp_features(void) | /* Returns the features supported by the link layer */
uint64_t ble_ll_read_supp_features(void) | {
return g_ble_ll_data.ll_supp_features;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* stmmac_dvr_remove @pdev: platform device pointer Description: this function resets the TX/RX processes, disables the MAC RX/TX changes the link status, releases the DMA descriptor rings, unregisters the MDIO bus and unmaps the allocated memory. */ | static int stmmac_dvr_remove(struct platform_device *pdev) | /* stmmac_dvr_remove @pdev: platform device pointer Description: this function resets the TX/RX processes, disables the MAC RX/TX changes the link status, releases the DMA descriptor rings, unregisters the MDIO bus and unmaps the allocated memory. */
static int stmmac_dvr_remove(struct platform_device *pdev) | {
struct net_device *ndev = platform_get_drvdata(pdev);
struct resource *res;
pr_info("%s:\n\tremoving driver", __func__);
stmmac_dma_stop_rx(ndev->base_addr);
stmmac_dma_stop_tx(ndev->base_addr);
stmmac_mac_disable_rx(ndev->base_addr);
stmmac_mac_disable_tx(ndev->base_addr);
netif_carrier_off(ndev);
stmmac_mdio_unregister(ndev);
platform_set_drvdata(pdev, NULL);
unregister_netdev(ndev);
iounmap((void *)ndev->base_addr);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, (res->end - res->start));
free_netdev(ndev);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset sdio peripheral registers to their default reset values. */ | void SDIO_Reset(void) | /* Reset sdio peripheral registers to their default reset values. */
void SDIO_Reset(void) | {
SDIO->PWRCTRL = 0x00000000;
SDIO->CLKCTRL = 0x00000000;
SDIO->ARG = 0x00000000;
SDIO->CMD = 0x00000000;
SDIO->DATATIME = 0x00000000;
SDIO->DATALEN = 0x00000000;
SDIO->DCTRL = 0x00000000;
SDIO->ICF = 0x00C007FF;
SDIO->MASK = 0x00000000;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Before you start, select your target, on the right of the "Load" button */ | void SendString(void) | /* Before you start, select your target, on the right of the "Load" button */
void SendString(void) | {
TM_USART_Puts(USART2, "Called from interrupt\n");
} else {
TM_USART_Puts(USART2, "Normal call, no interrupt called\n");
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* This API configure the source of data(filter & pre-filter) for low-g interrupt. */ | static int8_t config_low_g_data_src(const struct bmi160_acc_low_g_int_cfg *low_g_int, const struct bmi160_dev *dev) | /* This API configure the source of data(filter & pre-filter) for low-g interrupt. */
static int8_t config_low_g_data_src(const struct bmi160_acc_low_g_int_cfg *low_g_int, const struct bmi160_dev *dev) | {
int8_t rslt;
uint8_t data = 0;
uint8_t temp = 0;
rslt = bmi160_get_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev);
if (rslt == BMI160_OK)
{
temp = data & ~BMI160_LOW_HIGH_SRC_INT_MASK;
data = temp | ((low_g_int->low_data_src << 7) & BMI160_LOW_HIGH_SRC_INT_MASK);
rslt = bmi160_set_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev);
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ | void * dlcalloc(size_t, size_t) | /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */
void * dlcalloc(size_t, size_t) | {
void *mem;
size_t req = 0;
if (n_elements != 0) {
req = n_elements * elem_size;
if (((n_elements | elem_size) & ~(size_t) 0xffff) &&
(req / n_elements != elem_size))
req = MAX_SIZE_T;
}
mem = dlmalloc(req);
if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
memset(mem, 0, req);
return mem;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Copy the cpu registers which have been saved in the IP27prom format into the eframe format for the node under consideration. */ | void nmi_node_eframe_save(cnodeid_t cnode) | /* Copy the cpu registers which have been saved in the IP27prom format into the eframe format for the node under consideration. */
void nmi_node_eframe_save(cnodeid_t cnode) | {
nasid_t nasid;
int slice;
if (cnode == CNODEID_NONE)
return;
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == INVALID_NASID)
return;
for (slice = 0; slice < NODE_NUM_CPUS(slice); slice++) {
nmi_cpu_eframe_save(nasid, slice);
nmi_dump_hub_irq(nasid, slice);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* transfer the SELinux data to a blank set of creds */ | static void selinux_cred_transfer(struct cred *new, const struct cred *old) | /* transfer the SELinux data to a blank set of creds */
static void selinux_cred_transfer(struct cred *new, const struct cred *old) | {
const struct task_security_struct *old_tsec = old->security;
struct task_security_struct *tsec = new->security;
*tsec = *old_tsec;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* A callback function to changed a dissector_handle if matched This is used when iterating a dissector table */ | static void change_dissector_if_matched(gpointer item, gpointer user_data) | /* A callback function to changed a dissector_handle if matched This is used when iterating a dissector table */
static void change_dissector_if_matched(gpointer item, gpointer user_data) | {
dissector_handle_t handle = (dissector_handle_t)item;
lookup_entry_t * lookup = (lookup_entry_t *)user_data;
const gchar *proto_short_name = dissector_handle_get_short_name(handle);
if (proto_short_name && strcmp(lookup->dissector_short_name, proto_short_name) == 0) {
lookup->handle = handle;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* IDL typedef struct { IDL short delta_type; IDL DELTA_ID_UNION delta_id_union; IDL DELTA_UNION delta_union; IDL } DELTA_ENUM; */ | static int netlogon_dissect_DELTA_ENUM(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep) | /* IDL typedef struct { IDL short delta_type; IDL DELTA_ID_UNION delta_id_union; IDL DELTA_UNION delta_union; IDL } DELTA_ENUM; */
static int netlogon_dissect_DELTA_ENUM(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep) | {
proto_item *item=NULL;
proto_tree *tree=NULL;
int old_offset=offset;
guint16 type;
if(parent_tree){
tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0,
ett_DELTA_ENUM, &item, "DELTA_ENUM:");
}
offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, di, drep,
hf_netlogon_delta_type, &type);
proto_item_append_text(item, "%s", val_to_str(
type, delta_type_vals, "Unknown"));
offset = netlogon_dissect_DELTA_ID_UNION(tvb, offset,
pinfo, tree, di, drep);
offset = netlogon_dissect_DELTA_UNION(tvb, offset,
pinfo, tree, di, drep);
proto_item_set_len(item, offset-old_offset);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set the DMA destination address of the specified DMA Channel. */ | void dmac_channel_set_destination_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_addr) | /* Set the DMA destination address of the specified DMA Channel. */
void dmac_channel_set_destination_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_addr) | {
Assert(p_dmac);
Assert(ul_num<=3);
p_dmac->DMAC_CH_NUM[ul_num].DMAC_DADDR = ul_addr;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns: the found #GSList element, or NULL if it is not found */ | GSList* g_slist_find_custom(GSList *list, gconstpointer data, GCompareFunc func) | /* Returns: the found #GSList element, or NULL if it is not found */
GSList* g_slist_find_custom(GSList *list, gconstpointer data, GCompareFunc func) | {
g_return_val_if_fail (func != NULL, list);
while (list)
{
if (! func (list->data, data))
return list;
list = list->next;
}
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Caller must hold hashbucket lock for this tb with local BH disabled */ | void inet_bind_bucket_destroy(struct kmem_cache *cachep, struct inet_bind_bucket *tb) | /* Caller must hold hashbucket lock for this tb with local BH disabled */
void inet_bind_bucket_destroy(struct kmem_cache *cachep, struct inet_bind_bucket *tb) | {
if (hlist_empty(&tb->owners)) {
__hlist_del(&tb->node);
release_net(ib_net(tb));
kmem_cache_free(cachep, tb);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Append an indication that we were not compiled with libpcap to a GString. Don't even bother mentioning the other libraries. */ | void get_compiled_caplibs_version(GString *str) | /* Append an indication that we were not compiled with libpcap to a GString. Don't even bother mentioning the other libraries. */
void get_compiled_caplibs_version(GString *str) | {
g_string_append(str, "without libpcap");
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI RsaGenerateKey(IN OUT VOID *RsaContext, IN UINTN ModulusLength, IN CONST UINT8 *PublicExponent, IN UINTN PublicExponentSize) | /* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaGenerateKey(IN OUT VOID *RsaContext, IN UINTN ModulusLength, IN CONST UINT8 *PublicExponent, IN UINTN PublicExponentSize) | {
CALL_CRYPTO_SERVICE (RsaGenerateKey, (RsaContext, ModulusLength, PublicExponent, PublicExponentSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI HmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize) | /* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize) | {
CALL_CRYPTO_SERVICE (HmacSha256Update, (HmacSha256Context, Data, DataSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base TDET peripheral base address param activeTamperConfig Pointer to structure with active tamper register parameters param activeTamperRegisterSelect Bit mask for active tamper registers to be configured. The passed value is combination of tdet_active_tamper_register_t values (OR'ed). return kStatus_Fail when writing to TDET Active Tamper Register(s) is not allowed return kStatus_Success when operation completes successfully */ | status_t TDET_ActiveTamperSetConfig(DIGTMP_Type *base, const tdet_active_tamper_config_t *activeTamperConfig, uint32_t activeTamperRegisterSelect) | /* param base TDET peripheral base address param activeTamperConfig Pointer to structure with active tamper register parameters param activeTamperRegisterSelect Bit mask for active tamper registers to be configured. The passed value is combination of tdet_active_tamper_register_t values (OR'ed). return kStatus_Fail when writing to TDET Active Tamper Register(s) is not allowed return kStatus_Success when operation completes successfully */
status_t TDET_ActiveTamperSetConfig(DIGTMP_Type *base, const tdet_active_tamper_config_t *activeTamperConfig, uint32_t activeTamperRegisterSelect) | {
uint32_t mask;
status_t status;
uint32_t i, j;
mask = 1u;
status = kStatus_Success;
j = ARRAY_SIZE(base->ATR);
for (i = 0; i < j; i++)
{
if ((activeTamperRegisterSelect & mask) != 0U)
{
status = tdet_ActiveTamperConfigure(base, activeTamperConfig, i);
if (status != kStatus_Success)
{
break;
}
}
mask = mask << 1u;
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* When writing 8 bits of data, ensure the data is in the least signficant byte position. The remaining bytes should be written with zero. For example, when writing 0xAB, */ | void CRCDataWrite(uint32_t ui32Base, uint32_t ui32Data) | /* When writing 8 bits of data, ensure the data is in the least signficant byte position. The remaining bytes should be written with zero. For example, when writing 0xAB, */
void CRCDataWrite(uint32_t ui32Base, uint32_t ui32Data) | {
ASSERT(ui32Base == DTHE_BASE);
HWREG(DTHE_BASE + DTHE_O_CRC_DIN) = ui32Data;
} | micropython/micropython | C++ | Other | 18,334 |
/* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit. */ | void destroy_old_idx(struct ubifs_info *c) | /* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit. */
void destroy_old_idx(struct ubifs_info *c) | {
struct ubifs_old_idx *old_idx, *n;
rbtree_postorder_for_each_entry_safe(old_idx, n, &c->old_idx, rb)
kfree(old_idx);
c->old_idx = RB_ROOT;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* : Select the Sleep mode or not in Peli workmode */ | void CAN_Peli_SleepMode_Cmd(CAN_TypeDef *CANx, FunctionalState NewState) | /* : Select the Sleep mode or not in Peli workmode */
void CAN_Peli_SleepMode_Cmd(CAN_TypeDef *CANx, FunctionalState NewState) | {
switch (*(uint32_t*)&CANx)
{
case CAN1_BASE:
if(NewState == ENABLE)
CAN1_PELI->MOD |= CAN_SleepMode;
else
CAN1_PELI->MOD &= ~CAN_SleepMode;
break;
case CAN2_BASE:
if(NewState == ENABLE)
CAN2_PELI->MOD |= CAN_SleepMode;
else
CAN2_PELI->MOD &= ~CAN_SleepMode;
break;
default:
break;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified TIM flag is set or not. */ | FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG) | /* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG) | {
ITStatus bitstatus = RESET;
assert_param(IS_TIM_ALL_PERIPH(TIMx));
assert_param(IS_TIM_GET_FLAG(TIM_FLAG));
assert_param(IS_TIM_PERIPH_FLAG(TIMx, TIM_FLAG));
if ((TIMx->SR & TIM_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes the Mailbox watchdog coefficient delay.
Needs the I2C Password presentation to be effective. */ | int32_t BSP_NFCTAG_WriteMBWDG(uint32_t Instance, const uint8_t WdgDelay) | /* Writes the Mailbox watchdog coefficient delay.
Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteMBWDG(uint32_t Instance, const uint8_t WdgDelay) | {
UNUSED(Instance);
return ST25DV_WriteMBWDG(&NfcTagObj, WdgDelay);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* And for microcontrollers that have a USB peripheral: */ | void uDMAChannelDisable(unsigned long ulChannel) | /* And for microcontrollers that have a USB peripheral: */
void uDMAChannelDisable(unsigned long ulChannel) | {
ASSERT(ulChannel < 32);
HWREG(UDMA_ENACLR) = 1 << ulChannel;
} | watterott/WebRadio | C++ | null | 71 |
/* UART MSP De-Initialization This function frees the hardware resources used in this example: */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
USARTx_FORCE_RESET();
USARTx_RELEASE_RESET();
HAL_GPIO_DeInit(USARTx_TX_GPIO_PORT, USARTx_TX_PIN);
HAL_GPIO_DeInit(USARTx_RX_GPIO_PORT, USARTx_RX_PIN);
HAL_NVIC_DisableIRQ(USARTx_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Find the variable in HOB and Non-Volatile variable storages. */ | EFI_STATUS FindVariable(IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack, OUT VARIABLE_STORE_INFO *StoreInfo) | /* Find the variable in HOB and Non-Volatile variable storages. */
EFI_STATUS FindVariable(IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack, OUT VARIABLE_STORE_INFO *StoreInfo) | {
EFI_STATUS Status;
VARIABLE_STORE_TYPE Type;
if ((VariableName[0] != 0) && (VendorGuid == NULL)) {
return EFI_INVALID_PARAMETER;
}
for (Type = (VARIABLE_STORE_TYPE)0; Type < VariableStoreTypeMax; Type++) {
GetVariableStore (Type, StoreInfo);
Status = FindVariableEx (
StoreInfo,
VariableName,
VendorGuid,
PtrTrack
);
if (!EFI_ERROR (Status)) {
return Status;
}
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the touch screen X and Y positions values Manage multi touch thanks to touch Index global variable 'cy8c4014lqi_handle.currActiveTouchIdx'. */ | void cy8c4014lqi_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y) | /* Get the touch screen X and Y positions values Manage multi touch thanks to touch Index global variable 'cy8c4014lqi_handle.currActiveTouchIdx'. */
void cy8c4014lqi_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y) | {
*X = TS_IO_Read(CY8C4014LQI_ADDR, CY8C4014LQI_POS_X);
*Y = TS_IO_Read(CY8C4014LQI_ADDR, CY8C4014LQI_POS_Y);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Checks if the power on a specified port is ready. */ | USBPD_StatusTypeDef USBPD_PWR_IF_SupplyReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe) | /* Checks if the power on a specified port is ready. */
USBPD_StatusTypeDef USBPD_PWR_IF_SupplyReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe) | {
USBPD_StatusTypeDef status = USBPD_ERROR;
if (!USBPD_PORT_IsValid(PortNum))
{
return USBPD_ERROR;
}
if (USBPD_VSAFE_0V == Vsafe)
{
status = USBPD_TCPM_VBUS_IsVsafe0V(PortNum);
}
else
{
status = USBPD_TCPM_VBUS_IsVsafe5V(PortNum);
}
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Linux-compatible syscon-to-regmap The syscon node can be bound to another driver, but still works as a syscon provider. */ | struct regmap* syscon_node_to_regmap(ofnode node) | /* Linux-compatible syscon-to-regmap The syscon node can be bound to another driver, but still works as a syscon provider. */
struct regmap* syscon_node_to_regmap(ofnode node) | {
struct udevice *dev;
struct regmap *r;
if (uclass_get_device_by_ofnode(UCLASS_SYSCON, node, &dev))
if (syscon_probe_by_ofnode(node, &dev))
return ERR_PTR(-ENODEV);
r = syscon_get_regmap(dev);
if (!r) {
dev_dbg(dev, "unable to find regmap\n");
return ERR_PTR(-ENODEV);
}
return r;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_PCD_EP_ClrStall(pdev->pData, ep_addr);
return USBD_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Set the specified data holding register value for dual channel DAC. */ | void DAC_SetDualChannelData(emDACALIGN_TypeDef alignement, u16 data2, u16 data1) | /* Set the specified data holding register value for dual channel DAC. */
void DAC_SetDualChannelData(emDACALIGN_TypeDef alignement, u16 data2, u16 data1) | {
u32 data = ((alignement == DAC_Align_8b_R) ? ((data2 << 8) | data1) : ((data2 << 16) | data1));
*((u32*)(DAC_BASE + DHR12RD_Offset + alignement)) = data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set respective fields in the channel's TCD: DADDR, DOFF, ATTR, DLAST. These fields configure the DMA channel destination. */ | int kinetis_dma_ch_set_dest(int ch, u32 daddr, s16 doff, u8 bitwidth, s32 dlast) | /* Set respective fields in the channel's TCD: DADDR, DOFF, ATTR, DLAST. These fields configure the DMA channel destination. */
int kinetis_dma_ch_set_dest(int ch, u32 daddr, s16 doff, u8 bitwidth, s32 dlast) | {
DMAAPI_LOCKED_BEGIN
KINETIS_DMA->tcd[ch].attr =
(KINETIS_DMA->tcd[ch].attr & ~KINETIS_TCD_ATTR_DSIZE_MSK) |
(bitwidth << KINETIS_TCD_ATTR_DSIZE_BITS);
KINETIS_DMA->tcd[ch].daddr = daddr;
KINETIS_DMA->tcd[ch].doff = doff;
KINETIS_DMA->tcd[ch].dlast_sga = dlast;
DMAAPI_LOCKED_END
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* I2C Set the 10 bit Slave Address for the Peripheral.
This sets an address for Slave mode operation, in 10 bit form. */ | void i2c_set_own_10bit_slave_address(uint32_t i2c, uint16_t slave) | /* I2C Set the 10 bit Slave Address for the Peripheral.
This sets an address for Slave mode operation, in 10 bit form. */
void i2c_set_own_10bit_slave_address(uint32_t i2c, uint16_t slave) | {
I2C_OAR1(i2c) = (uint16_t)(I2C_OAR1_OA1MODE | slave);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ | static void format_display(char *buf, guint32 value) | /* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_display(char *buf, guint32 value) | {
g_snprintf(buf, ITEM_LABEL_LENGTH,
"%s (%c)",
val_to_str_const(value, ouch_display_val, "Unknown"),
value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* seek to the next image specified in *imageSpec returns 1 if success, 0 if no more images to process imageSpec=NULL if subsequent images should be processed in sequence */ | static int nextSrcImage(TIFF *tif, char **imageSpec) | /* seek to the next image specified in *imageSpec returns 1 if success, 0 if no more images to process imageSpec=NULL if subsequent images should be processed in sequence */
static int nextSrcImage(TIFF *tif, char **imageSpec) | {
if (**imageSpec == comma) {
char *start = *imageSpec + 1;
tdir_t nextImage = (tdir_t)strtol(start, imageSpec, 0);
if (start == *imageSpec) nextImage = TIFFCurrentDirectory (tif);
if (**imageSpec)
{
if (**imageSpec == comma) {
if ((*imageSpec)[1] == '\0') *imageSpec = NULL;
}else{
fprintf (stderr,
"Expected a %c separated image # list after %s\n",
comma, TIFFFileName (tif));
exit (-4);
}
}
if (TIFFSetDirectory (tif, nextImage)) return 1;
fprintf (stderr, "%s%c%d not found!\n",
TIFFFileName(tif), comma, (int) nextImage);
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This API is used to get the status of nvm program remain in the register 0x33 bit from 4 to 7. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_nvm_remain(u8 *v_nvm_remain_u8) | /* This API is used to get the status of nvm program remain in the register 0x33 bit from 4 to 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_nvm_remain(u8 *v_nvm_remain_u8) | {
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_TRIM_NVM_CTRL_ADDR_NVM_REMAIN__REG,
&v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_nvm_remain_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_TRIM_NVM_CTRL_ADDR_NVM_REMAIN);
}
return comres;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Separate data from status in case they are read together. */ | static int32_t cn0414_filter_status(struct cn0414_dev *dev, uint32_t data_status, uint32_t *data_only) | /* Separate data from status in case they are read together. */
static int32_t cn0414_filter_status(struct cn0414_dev *dev, uint32_t data_status, uint32_t *data_only) | {
ad717x_st_reg *reg;
reg = AD717X_GetReg(dev->ad4111_device, AD717X_IFMODE_REG);
if(!reg)
return -1;
*data_only = data_status >> 8;
if(reg->value & AD717X_IFMODE_REG_DATA_WL16)
*data_only &= 0xffff;
else
*data_only &= 0xffffff;
return 0;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function transfers the USB MSC data to the memory */ | Ctrl_status virtual_usb_write_10(uint32_t addr, uint16_t nb_sector) | /* This function transfers the USB MSC data to the memory */
Ctrl_status virtual_usb_write_10(uint32_t addr, uint16_t nb_sector) | {
return virtual_usb_trans(addr, nb_sector, false);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Saves the tag registers to a user-defined location. */ | void AESTagRead(uint32_t ui32Base, uint32_t *pui32TagData) | /* Saves the tag registers to a user-defined location. */
void AESTagRead(uint32_t ui32Base, uint32_t *pui32TagData) | {
ASSERT(ui32Base == AES_BASE);
while((AES_CTRL_SVCTXTRDY & (HWREG(ui32Base + AES_O_CTRL))) == 0)
{
}
pui32TagData[0] = HWREG((ui32Base + AES_O_TAG_OUT_0));
pui32TagData[1] = HWREG((ui32Base + AES_O_TAG_OUT_1));
pui32TagData[2] = HWREG((ui32Base + AES_O_TAG_OUT_2));
pui32TagData[3] = HWREG((ui32Base + AES_O_TAG_OUT_3));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the SD I/O Mode suspend command sending. */ | void SDIO_EnableSendSdioSuspend(FunctionalState Cmd) | /* Enables or disables the SD I/O Mode suspend command sending. */
void SDIO_EnableSendSdioSuspend(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
*(__IO uint32_t*)CMD_SDIO_SUSPEND_BB = (uint32_t)Cmd;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The libata core provides separate functions for handling PIO and DMA programming. The architecture of the Firestar makes it easier for us to have a common function so we provide wrappers */ | static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev) | /* The libata core provides separate functions for handling PIO and DMA programming. The architecture of the Firestar makes it easier for us to have a common function so we provide wrappers */
static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev) | {
optiplus_mode_setup(ap, adev, adev->dma_mode);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Delete URB (previously enqueued) from the device queue */ | int khci_hc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | /* Delete URB (previously enqueued) from the device queue */
int khci_hc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | {
struct khci_hcd *khci = hcd_to_khci(hcd);
struct khci_urb *kurb;
unsigned long flags;
int rv;
dbg(1, "%s URB:%p(%d),EP:%p,Type:%d\n", __func__, urb, status, urb->ep,
usb_endpoint_type(&urb->ep->desc));
spin_lock_irqsave(&khci->lock, flags);
rv = usb_hcd_check_unlink_urb(hcd, urb, status);
if (rv)
goto out;
kurb = urb->hcpriv;
if (kurb) {
kurb->status = status;
khci_urb_free(kurb);
}
out:
spin_unlock_irqrestore(&khci->lock, flags);
return rv;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable DAC Channel Waveform Generation.
Disable a digital to analog converter channel superimposed waveform generation. */ | void dac_disable_waveform_generation(data_channel dac_channel) | /* Disable DAC Channel Waveform Generation.
Disable a digital to analog converter channel superimposed waveform generation. */
void dac_disable_waveform_generation(data_channel dac_channel) | {
switch (dac_channel) {
case CHANNEL_1:
DAC_CR &= ~DAC_CR_WAVE1_DIS;
break;
case CHANNEL_2:
DAC_CR &= ~DAC_CR_WAVE2_DIS;
break;
case CHANNEL_D:
DAC_CR &= ~(DAC_CR_WAVE1_DIS | DAC_CR_WAVE2_DIS);
break;
}
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Disable address filters module uses the MAC address for perfect filtering. */ | void ETH_DisableMACAddressPerfectFilter(ETH_MAC_ADDRESS_T macAddr) | /* Disable address filters module uses the MAC address for perfect filtering. */
void ETH_DisableMACAddressPerfectFilter(ETH_MAC_ADDRESS_T macAddr) | {
__IO uint32_t temp = 0;
(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) &= (~BIT31);
ETH_Delay(ETH_REG_WRITE_DELAY);
(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) = temp;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* brief Return Frequency of SCTimer Clock return Frequency of SCTimer Clock. */ | uint32_t CLOCK_GetSctClkFreq(void) | /* brief Return Frequency of SCTimer Clock return Frequency of SCTimer Clock. */
uint32_t CLOCK_GetSctClkFreq(void) | {
uint32_t freq = 0U;
switch (SYSCON->SCTCLKSEL)
{
case 0U:
freq = CLOCK_GetCoreSysClkFreq();
break;
case 1U:
freq = CLOCK_GetPll0OutFreq();
break;
case 2U:
freq = CLOCK_GetExtClkFreq();
break;
case 3U:
freq = CLOCK_GetFroHfFreq();
break;
case 5U:
freq = CLOCK_GetI2SMClkFreq();
break;
case 7U:
freq = 0U;
break;
default:
assert(false);
break;
}
return freq / ((SYSCON->SCTCLKDIV & 0xffU) + 1U);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* This comparator searches for the next Interface descriptor of the correct CDC data Class, Subclass and Protocol values. */ | uint8_t DComp_NextCDCDataInterface(void *CurrentDescriptor) | /* This comparator searches for the next Interface descriptor of the correct CDC data Class, Subclass and Protocol values. */
uint8_t DComp_NextCDCDataInterface(void *CurrentDescriptor) | {
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Interface)
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
if ((Interface->Class == CDC_CSCP_CDCDataClass) &&
(Interface->SubClass == CDC_CSCP_NoDataSubclass) &&
(Interface->Protocol == CDC_CSCP_NoDataProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI IScsiComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI IScsiComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mIScsiDriverNameTable,
DriverName,
(BOOLEAN)(This == &gIScsiComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.