docstring stringlengths 22 576 | signature stringlengths 9 317 | prompt stringlengths 57 886 | code stringlengths 20 1.36k | repository stringclasses 49 values | language stringclasses 2 values | license stringclasses 9 values | stars int64 15 21.3k |
|---|---|---|---|---|---|---|---|
/* This routine allocates a new "struct lguest_device_desc" from descriptor table page just above the Guest's normal memory. It returns a pointer to that descriptor. */ | static struct lguest_device_desc* new_dev_desc(u16 type) | /* This routine allocates a new "struct lguest_device_desc" from descriptor table page just above the Guest's normal memory. It returns a pointer to that descriptor. */
static struct lguest_device_desc* new_dev_desc(u16 type) | {
struct lguest_device_desc d = { .type = type };
void *p;
if (devices.lastdev)
p = device_config(devices.lastdev)
+ devices.lastdev->desc->config_len;
else
p = devices.descpage;
if (p + sizeof(d) > (void *)devices.descpage + getpagesize())
errx(1, "Too many devices");
return memcpy(p, &d, sizeof(d));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Common USART1 TX interrupt handler.
This function handles USART1 TX complete interrupt request */ | void USART1_TX_IRQHandler(void) | /* Common USART1 TX interrupt handler.
This function handles USART1 TX complete interrupt request */
void USART1_TX_IRQHandler(void) | {
rt_interrupt_enter();
if (USART1->IF & USART_IF_TXC)
{
if (usartCbTable[2].cbFunc != RT_NULL)
{
(usartCbTable[2].cbFunc)(usartCbTable[2].userPtr);
}
BITBAND_Peripheral(&(USART1->IFC), _USART_IF_TXC_SHIFT, 0x1UL);
}
rt_interrupt_leave();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the tim peripheral Preload register on CCR5. */ | void TIM_OC5PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | /* Enables or disables the tim peripheral Preload register on CCR5. */
void TIM_OC5PreloadConfig(TIM_TypeDef *tim, TIMOCPE_Typedef preload) | {
MODIFY_REG(tim->CCMR3, TIM_CCMR3_OC5PEN, preload);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). */ | EFI_DEVICE_PATH_PROTOCOL* FileDevicePath(EFI_HANDLE Device, OPTIONAL CONST CHAR16 *FileName) | /* If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). */
EFI_DEVICE_PATH_PROTOCOL* FileDevicePath(EFI_HANDLE Device, OPTIONAL CONST CHAR16 *FileName) | {
UINTN Size;
FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL;
Size = StrSize (FileName);
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
if (FileDevicePath != NULL) {
FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
FilePath->Header.Type = MEDIA_DEVICE_PATH;
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
memcpy (&FilePath->PathName, FileName, Size);
SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
free (FileDevicePath);
}
return DevicePath;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the boot bank to the default bank */ | void cpld_set_defbank(void) | /* Set the boot bank to the default bank */
void cpld_set_defbank(void) | {
u8 val;
val = CPLD_DEFAULT_BANK;
CPLD_WRITE(global_reset, val);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* RETURN: >0 - OK, size of opened file <0 - ERROR -grub_error_t errnum */ | int reiserfs_open(char *filename) | /* RETURN: >0 - OK, size of opened file <0 - ERROR -grub_error_t errnum */
int reiserfs_open(char *filename) | {
errnum = 0;
print_possibilities = 0;
if (!reiserfs_dir (filename) || errnum) {
return -errnum;
}
return filemax;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function forces the Hibernation module to initiate a check of the battery voltage immediately rather than waiting for the next check interval to pass. After calling this function, the application should call the */ | void HibernateBatCheckStart(void) | /* This function forces the Hibernation module to initiate a check of the battery voltage immediately rather than waiting for the next check interval to pass. After calling this function, the application should call the */
void HibernateBatCheckStart(void) | {
HWREG(HIB_CTL) |= HIB_CTL_BATCHK;
_HibernateWriteComplete();
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Configure the default Udp6Io to receive all the DHCP6 traffic on this network interface. */ | EFI_STATUS EFIAPI Dhcp6ConfigureUdpIo(IN UDP_IO *UdpIo, IN VOID *Context) | /* Configure the default Udp6Io to receive all the DHCP6 traffic on this network interface. */
EFI_STATUS EFIAPI Dhcp6ConfigureUdpIo(IN UDP_IO *UdpIo, IN VOID *Context) | {
EFI_UDP6_PROTOCOL *Udp6;
EFI_UDP6_CONFIG_DATA *Config;
Udp6 = UdpIo->Protocol.Udp6;
Config = &(UdpIo->Config.Udp6);
ZeroMem (Config, sizeof (EFI_UDP6_CONFIG_DATA));
Config->AcceptPromiscuous = FALSE;
Config->AcceptAnyPort = FALSE;
Config->AllowDuplicatePort = FALSE;
Config->TrafficClass = 0;
Config->HopLimit = 128;
Config->ReceiveTimeout = 0;
Config->TransmitTimeout = 0;
Config->StationPort = DHCP6_PORT_CLIENT;
Config->RemotePort = 0;
return Udp6->Configure (Udp6, Config);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets this bit to mark the last descriptor in the transmit buffer descriptor list. */ | static void XEmacPs_BdSetTxWrap(UINTPTR BdPtr) | /* Sets this bit to mark the last descriptor in the transmit buffer descriptor list. */
static void XEmacPs_BdSetTxWrap(UINTPTR BdPtr) | {
u32 DataValueTx;
u32 *TempPtr;
BdPtr += (u32)(XEMACPS_BD_STAT_OFFSET);
TempPtr = (u32 *)BdPtr;
if(TempPtr != NULL) {
DataValueTx = *TempPtr;
DataValueTx |= XEMACPS_TXBUF_WRAP_MASK;
*TempPtr = DataValueTx;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* On success, returns 0 On failure, returns non-zero */ | int io_reserve_memtype(resource_size_t start, resource_size_t end, unsigned long *type) | /* On success, returns 0 On failure, returns non-zero */
int io_reserve_memtype(resource_size_t start, resource_size_t end, unsigned long *type) | {
resource_size_t size = end - start;
unsigned long req_type = *type;
unsigned long new_type;
int ret;
WARN_ON_ONCE(iomem_map_sanity_check(start, size));
ret = reserve_memtype(start, end, req_type, &new_type);
if (ret)
goto out_err;
if (!is_new_memtype_allowed(start, size, req_type, new_type))
goto out_free;
if (kernel_map_sync_memtype(start, size, new_type) < 0)
goto out_free;
*type = new_type;
return 0;
out_free:
free_memtype(start, end);
ret = -EBUSY;
out_err:
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* function to register callback to be called when device gets connected */ | void register_ble_connected_event_cb(ble_gap_event_callback_t connected_cb_fn) | /* function to register callback to be called when device gets connected */
void register_ble_connected_event_cb(ble_gap_event_callback_t connected_cb_fn) | {
ble_connected_cb = connected_cb_fn;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Read SFH5712 light level data.
This function reads the ambient light level data from the sensor and places it in the user-provided sensor_data_t structure. */ | static bool sfh5712_get_light(sensor_hal_t *hal, sensor_data_t *data) | /* Read SFH5712 light level data.
This function reads the ambient light level data from the sensor and places it in the user-provided sensor_data_t structure. */
static bool sfh5712_get_light(sensor_hal_t *hal, sensor_data_t *data) | {
struct {
uint8_t lsb;
uint8_t msb;
} light_data;
size_t const count = sensor_bus_read(hal, SFH5712_ALS_DATA_LSB,
(uint8_t *)&light_data, sizeof(light_data));
data->light.value = (uint32_t)((light_data.msb << 8) | light_data.lsb);
return (count == sizeof(light_data));
} | memfault/zero-to-main | C++ | null | 200 |
/* Get a segment starting from sequence Seq of a maximum length of Len. */ | NET_BUF* TcpGetSegment(IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len) | /* Get a segment starting from sequence Seq of a maximum length of Len. */
NET_BUF* TcpGetSegment(IN TCP_CB *Tcb, IN TCP_SEQNO Seq, IN UINT32 Len) | {
NET_BUF *Nbuf;
ASSERT (Tcb != NULL);
if ((Len != 0) && TCP_SEQ_LT (Seq, TcpGetMaxSndNxt (Tcb))) {
Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
} else {
Nbuf = TcpGetSegmentSock (Tcb, Seq, Len);
}
if (TcpVerifySegment (Nbuf) == 0) {
NetbufFree (Nbuf);
return NULL;
}
return Nbuf;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | {
return PciWrite16 (Address, (UINT16)((PciRead16 (Address) & AndData) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* install SMARTDMA firmware
Install a custom firmware for the smartDMA. This function allows the user to install a custom firmware into the smartDMA, which implements different API functions than the standard MCUX SDK firmware. */ | void dma_smartdma_install_fw(const struct device *dev, uint8_t *firmware, uint32_t len) | /* install SMARTDMA firmware
Install a custom firmware for the smartDMA. This function allows the user to install a custom firmware into the smartDMA, which implements different API functions than the standard MCUX SDK firmware. */
void dma_smartdma_install_fw(const struct device *dev, uint8_t *firmware, uint32_t len) | {
const struct dma_mcux_smartdma_config *config = dev->config;
SMARTDMA_InstallFirmware((uint32_t)config->smartdma_progs, firmware, len);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function handles External line 15_10 interrupt request. */ | void EXTI9_5_IRQHandler(void) | /* This function handles External line 15_10 interrupt request. */
void EXTI9_5_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(TS_INT_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function will compare two strings while ignoring differences in case. */ | rt_int32_t rt_strcasecmp(const char *a, const char *b) | /* This function will compare two strings while ignoring differences in case. */
rt_int32_t rt_strcasecmp(const char *a, const char *b) | {
int ca = 0, cb = 0;
do
{
ca = *a++ & 0xff;
cb = *b++ & 0xff;
if (ca >= 'A' && ca <= 'Z')
ca += 'a' - 'A';
if (cb >= 'A' && cb <= 'Z')
cb += 'a' - 'A';
}
while (ca == cb && ca != '\0');
return ca - cb;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ADC0 Interrupt Handler.
If users want to user the ADC0 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */ | void PWMLedControl(void) | /* ADC0 Interrupt Handler.
If users want to user the ADC0 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */
void PWMLedControl(void) | {
xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ);
SysCtlDelay(10000);
xSysCtlPeripheralEnable(xSYSCTL_PERIPH_PWMA);
xSysCtlPeripheralEnable(xSYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
xSPinTypeTimer(TIM1CH1(APP), PA8);
xPWMInitConfigure(xPWMA_BASE, xPWM_CHANNEL0, xPWM_OUTPUT_INVERTER_DIS|xPWM_DEAD_ZONE_DIS);
xPWMFrequencyConfig(xPWMA_BASE, xPWM_CHANNEL0, xPWM_FREQ_CONFIG(1,0x48,0x3E8));
xPWMDutySet(xPWMA_BASE, xPWM_CHANNEL0, 10);
xPWMOutputEnable(xPWMA_BASE, xPWM_CHANNEL0);
xPWMStart(xPWMA_BASE, xPWM_CHANNEL0);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Changes: YOSHIFUJI Hideaki @USAGI Split up af-specific portion */ | static int xfrm4_init_flags(struct xfrm_state *x) | /* Changes: YOSHIFUJI Hideaki @USAGI Split up af-specific portion */
static int xfrm4_init_flags(struct xfrm_state *x) | {
if (ipv4_config.no_pmtu_disc)
x->props.flags |= XFRM_STATE_NOPMTUDISC;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* HID class driver callback function for the processing of HID reports from the host. */ | void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize) | /* HID class driver callback function for the processing of HID reports from the host. */
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize) | {
if (HIDInterfaceInfo == &Keyboard_HID_Interface)
{
uint8_t LEDMask = LEDS_NO_LEDS;
uint8_t* LEDReport = (uint8_t*)ReportData;
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
LEDs_SetAllLEDs(LEDMask);
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Routine to get the next Handle, when you are searching for all handles. */ | IHANDLE * CoreGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | /* Routine to get the next Handle, when you are searching for all handles. */
IHANDLE * CoreGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | {
IHANDLE *Handle;
Position->Position = Position->Position->ForwardLink;
Handle = NULL;
*Interface = NULL;
if (Position->Position != &gHandleList) {
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
}
return Handle;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Check if the endpoint of given address is valid. */ | static bool is_ep_valid(uint8_t ep) | /* Check if the endpoint of given address is valid. */
static bool is_ep_valid(uint8_t ep) | {
const struct usb_ep_cfg_data *ep_data;
if (USB_EP_GET_IDX(ep) == 0) {
return true;
}
STRUCT_SECTION_FOREACH(usb_cfg_data, cfg_data) {
ep_data = cfg_data->endpoint;
for (uint8_t n = 0; n < cfg_data->num_endpoints; n++) {
if (ep_data[n].ep_addr == ep) {
return true;
}
}
}
return false;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Start specified slot in transfer list of a UFS device. */ | VOID UfsStartExecCmd(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot) | /* Start specified slot in transfer list of a UFS device. */
VOID UfsStartExecCmd(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot) | {
UINTN UfsHcBase;
UINTN Address;
UINT32 Data;
UfsHcBase = Private->UfsHcBase;
Address = UfsHcBase + UFS_HC_UTRLRSR_OFFSET;
Data = MmioRead32 (Address);
if ((Data & UFS_HC_UTRLRSR) != UFS_HC_UTRLRSR) {
MmioWrite32 (Address, UFS_HC_UTRLRSR);
}
Address = UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
MmioWrite32 (Address, BIT0 << Slot);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Determine whether the sequencer has halted code execution. Returns non-zero status if the sequencer is stopped. */ | int ahd_is_paused(struct ahd_softc *ahd) | /* Determine whether the sequencer has halted code execution. Returns non-zero status if the sequencer is stopped. */
int ahd_is_paused(struct ahd_softc *ahd) | {
return ((ahd_inb(ahd, HCNTRL) & PAUSE) != 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Message: ForwardStatReqMessage Opcode: 0x0009 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */ | static void handle_ForwardStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: ForwardStatReqMessage Opcode: 0x0009 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
static void handle_ForwardStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_lineNumber, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Releases ownership of an inbound mailbox resource. Returns 0 if the request has been satisfied. */ | int rio_release_outb_mbox(struct rio_mport *mport, int mbox) | /* Releases ownership of an inbound mailbox resource. Returns 0 if the request has been satisfied. */
int rio_release_outb_mbox(struct rio_mport *mport, int mbox) | {
rio_close_outb_mbox(mport, mbox);
return release_resource(mport->outb_msg[mbox].res);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Unregistering a kmmio fault page has three steps: */ | void unregister_kmmio_probe(struct kmmio_probe *p) | /* Unregistering a kmmio fault page has three steps: */
void unregister_kmmio_probe(struct kmmio_probe *p) | {
unsigned long flags;
unsigned long size = 0;
const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
struct kmmio_fault_page *release_list = NULL;
struct kmmio_delayed_release *drelease;
spin_lock_irqsave(&kmmio_lock, flags);
while (size < size_lim) {
release_kmmio_fault_page(p->addr + size, &release_list);
size += PAGE_SIZE;
}
list_del_rcu(&p->list);
kmmio_count--;
spin_unlock_irqrestore(&kmmio_lock, flags);
drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC);
if (!drelease) {
pr_crit("leaking kmmio_fault_page objects.\n");
return;
}
drelease->release_list = release_list;
call_rcu(&drelease->rcu, remove_kmmio_fault_pages);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ | void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortSend(LPUART_Type *base, lpuart_handle_t *handle) | {
assert(handle);
LPUART_DisableInterrupts(base, kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_TransmissionCompleteInterruptEnable);
handle->txDataSize = 0;
handle->txState = kLPUART_TxIdle;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* dump single bus's information, all devices, drivers connected to this bus is included */ | static int u_bus_dump(struct u_bus *bus) | /* dump single bus's information, all devices, drivers connected to this bus is included */
static int u_bus_dump(struct u_bus *bus) | {
ddkc_warn("bus[%s]'s device list is empty\r\n", bus->name);
} else {
dlist_for_each_entry_safe(&p->dev_list, next, dev_p, u_device_private_t, bus_node) {
dev = dev_p->dev;
u_device_dump(dev);
}
}
if (dlist_empty(&p->drv_list)) {
ddkc_warn("bus[%s]'s driver list is empty\r\n", bus->name);
} else {
dlist_for_each_entry_safe(&p->drv_list, next, drv_p, u_driver_private_t, bus_node) {
drv = drv_p->drv;
u_driver_dump(drv);
}
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* ECCxxxOther does ECC calcs on arbitrary n bytes of data */ | void yaffs_ECCCalculateOther(const unsigned char *data, unsigned nBytes, yaffs_ECCOther *eccOther) | /* ECCxxxOther does ECC calcs on arbitrary n bytes of data */
void yaffs_ECCCalculateOther(const unsigned char *data, unsigned nBytes, yaffs_ECCOther *eccOther) | {
unsigned int i;
unsigned char col_parity = 0;
unsigned line_parity = 0;
unsigned line_parity_prime = 0;
unsigned char b;
for (i = 0; i < nBytes; i++) {
b = column_parity_table[*data++];
col_parity ^= b;
if (b & 0x01) {
line_parity ^= i;
line_parity_prime ^= ~i;
}
}
eccOther->colParity = (col_parity >> 2) & 0x3f;
eccOther->lineParity = line_parity;
eccOther->lineParityPrime = line_parity_prime;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Returns: the value of the environment variable, or NULL if the environment variable is not found. The returned string may be overwritten by the next call to g_getenv(), g_setenv() or g_unsetenv(). */ | const gchar* g_getenv(const gchar *variable) | /* Returns: the value of the environment variable, or NULL if the environment variable is not found. The returned string may be overwritten by the next call to g_getenv(), g_setenv() or g_unsetenv(). */
const gchar* g_getenv(const gchar *variable) | {
g_return_val_if_fail (variable != NULL, NULL);
return getenv (variable);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function processes the results of changes in configuration. */ | EFI_STATUS EFIAPI DriverHealthManagerFakeRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress) | /* This function processes the results of changes in configuration. */
EFI_STATUS EFIAPI DriverHealthManagerFakeRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress) | {
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Looks and finds the function for the command string. */ | msUartCPFun Cli_FindCommandFunction(uint8_t *cmd) | /* Looks and finds the function for the command string. */
msUartCPFun Cli_FindCommandFunction(uint8_t *cmd) | {
msUartCPFun fp = NULL;
int32_t i;
i = 0;
while (urtMonCmdFun[i] != NULL) {
if (strncmp((const char*)cmd, (const char*)kwnUrtMonCmd[i], UART_CMD_LENGTH) == 0) {
fp = urtMonCmdFun[i];
break;
}
i++;
}
return fp;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Return: 0 on success, a negative error code otherwise. */ | int spinand_select_target(struct spinand_device *spinand, unsigned int target) | /* Return: 0 on success, a negative error code otherwise. */
int spinand_select_target(struct spinand_device *spinand, unsigned int target) | {
struct nand_device *nand = spinand_to_nand(spinand);
int ret;
if (WARN_ON(target >= nand->memorg.ntargets))
return -EINVAL;
if (spinand->cur_target == target)
return 0;
if (nand->memorg.ntargets == 1) {
spinand->cur_target = target;
return 0;
}
ret = spinand->select_target(spinand, target);
if (ret)
return ret;
spinand->cur_target = target;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Compute flags for 'lpcm' tag. See CoreAudioTypes and AudioStreamBasicDescription at Apple. */ | static int mov_get_lpcm_flags(enum CodecID codec_id) | /* Compute flags for 'lpcm' tag. See CoreAudioTypes and AudioStreamBasicDescription at Apple. */
static int mov_get_lpcm_flags(enum CodecID codec_id) | {
switch (codec_id) {
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_F64BE:
return 11;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_F64LE:
return 9;
case CODEC_ID_PCM_U8:
return 10;
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_S24BE:
case CODEC_ID_PCM_S32BE:
return 14;
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S24LE:
case CODEC_ID_PCM_S32LE:
return 12;
default:
return 0;
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Allocate a circular buffer and all associated memory. */ | static int gs_buf_alloc(struct gs_buf *gb, unsigned size) | /* Allocate a circular buffer and all associated memory. */
static int gs_buf_alloc(struct gs_buf *gb, unsigned size) | {
gb->buf_buf = kmalloc(size, GFP_KERNEL);
if (gb->buf_buf == NULL)
return -ENOMEM;
gb->buf_size = size;
gb->buf_put = gb->buf_buf;
gb->buf_get = gb->buf_buf;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Make sure SMIBusy bit cleared before another SMI operation can take place */ | static int mv88e61xx_busychk(char *name) | /* Make sure SMIBusy bit cleared before another SMI operation can take place */
static int mv88e61xx_busychk(char *name) | {
u16 reg = 0;
u32 timeout = MV88E61XX_PHY_TIMEOUT;
do {
RD_PHY(name, MV88E61XX_GLB2REG_DEVADR,
MV88E61XX_PHY_CMD, ®);
if (timeout-- == 0) {
printf("SMI busy timeout\n");
return -1;
}
} while (reg & 1 << 15);
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* initialize the parameters of DMA struct with the default values */ | void dma_struct_para_init(dma_parameter_struct *init_struct) | /* initialize the parameters of DMA struct with the default values */
void dma_struct_para_init(dma_parameter_struct *init_struct) | {
init_struct->periph_addr = 0U;
init_struct->periph_width = 0U;
init_struct->periph_inc = DMA_PERIPH_INCREASE_DISABLE;
init_struct->memory_addr = 0U;
init_struct->memory_width = 0U;
init_struct->memory_inc = DMA_MEMORY_INCREASE_DISABLE;
init_struct->number = 0U;
init_struct->direction = DMA_PERIPHERAL_TO_MEMORY;
init_struct->priority = DMA_PRIORITY_LOW;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI1)
{
__HAL_RCC_SPI1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_15);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while enumerating an attached USB device. */ | void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) | /* Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while enumerating an attached USB device. */
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode) | {
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* st33zp24_i2c_read8_reg Recv byte from the TIS register according to the ST33ZP24 I2C protocol. */ | static int st33zp24_i2c_read8_reg(struct udevice *dev, u8 tpm_register, u8 *tpm_data, size_t tpm_size) | /* st33zp24_i2c_read8_reg Recv byte from the TIS register according to the ST33ZP24 I2C protocol. */
static int st33zp24_i2c_read8_reg(struct udevice *dev, u8 tpm_register, u8 *tpm_data, size_t tpm_size) | {
int status;
u8 data;
data = TPM_DUMMY_BYTE;
status = st33zp24_i2c_write8_reg(dev, tpm_register, &data, 1);
if (status < 0)
return status;
return dm_i2c_read(dev, 0, tpm_data, tpm_size);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Get flash page count per region (plane) for the specified bank. */ | uint32_t flash_get_page_count_per_region(const uint32_t *pul_flash_descriptor) | /* Get flash page count per region (plane) for the specified bank. */
uint32_t flash_get_page_count_per_region(const uint32_t *pul_flash_descriptor) | {
return (pul_flash_descriptor[4] / pul_flash_descriptor[2]);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData) | {
return PciExpressOr32 (Address, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the current bit mask of the entire GPIO pin bank.
Reads the current bit mask of the entire bank from the read-only data register. This includes the current values of not just all input pins, but both the input and output pins within the bank. */ | static int gpio_xlnx_ps_bank_get(const struct device *dev, gpio_port_value_t *value) | /* Reads the current bit mask of the entire GPIO pin bank.
Reads the current bit mask of the entire bank from the read-only data register. This includes the current values of not just all input pins, but both the input and output pins within the bank. */
static int gpio_xlnx_ps_bank_get(const struct device *dev, gpio_port_value_t *value) | {
const struct gpio_xlnx_ps_bank_dev_cfg *dev_conf = dev->config;
*value = sys_read32(GPIO_XLNX_PS_BANK_DATA_REG);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Return an indication of whether there was an error in the cell header and, if so, where the error was, if it was correctable. */ | static int get_header_err(const guint8 *cell_header) | /* Return an indication of whether there was an error in the cell header and, if so, where the error was, if it was correctable. */
static int get_header_err(const guint8 *cell_header) | {
register guint8 syndrome;
register int i, err_posn;
syndrome = 0;
for (i = 0; i < 4; i++)
syndrome = syndrome_table[syndrome ^ cell_header[i]];
syndrome ^= cell_header[4] ^ COSET_LEADER;
err_posn = err_posn_table [syndrome];
if (err_posn < 0)
return NO_ERROR_DETECTED;
else if (err_posn < 40)
return err_posn;
else
return UNCORRECTIBLE_ERROR;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Given a 64-bit response, decode to our card SCR structure. */ | static int mmc_decode_scr(struct mmc_card *card) | /* Given a 64-bit response, decode to our card SCR structure. */
static int mmc_decode_scr(struct mmc_card *card) | {
struct sd_scr *scr = &card->scr;
unsigned int scr_struct;
u32 resp[4];
resp[3] = card->raw_scr[1];
resp[2] = card->raw_scr[0];
scr_struct = UNSTUFF_BITS(resp, 60, 4);
if (scr_struct != 0) {
printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
mmc_hostname(card->host), scr_struct);
return -EINVAL;
}
scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4);
scr->bus_widths = UNSTUFF_BITS(resp, 48, 4);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieve the organization name (O) string from one X.509 certificate. */ | RETURN_STATUS EFIAPI CryptoServiceX509GetOrganizationName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *NameBuffer OPTIONAL, IN OUT UINTN *NameBufferSize) | /* Retrieve the organization name (O) string from one X.509 certificate. */
RETURN_STATUS EFIAPI CryptoServiceX509GetOrganizationName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *NameBuffer OPTIONAL, IN OUT UINTN *NameBufferSize) | {
return CALL_BASECRYPTLIB (X509.Services.GetOrganizationName, X509GetOrganizationName, (Cert, CertSize, NameBuffer, NameBufferSize), RETURN_UNSUPPORTED);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set display parameters in IPU configuration structure according to your display panel name. There are only some displays are supported by this function. And you can set the display manually all by your self if the hardware is supported by IPU. */ | ips_dev_panel_t* search_panel(char *panel_name) | /* Set display parameters in IPU configuration structure according to your display panel name. There are only some displays are supported by this function. And you can set the display manually all by your self if the hardware is supported by IPU. */
ips_dev_panel_t* search_panel(char *panel_name) | {
ips_dev_panel_t *panel = &disp_dev_list[0];
int32_t index = 0;
while (index < num_of_panels) {
if (!strcmp(panel->panel_name, panel_name))
break;
else {
panel++;
index++;
}
}
if (index == num_of_panels) {
printf("The display panel %s is not supported!\n", panel_name);
return NULL;
}
return panel;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Find or possibly create a peer conversation object for the connection which is associated with the packet info. */ | static conversation_t * get_peer_conversation(packet_info *pinfo, jxta_stream_conversation_data *tpt_conv_data, gboolean create) | /* Find or possibly create a peer conversation object for the connection which is associated with the packet info. */
static conversation_t * get_peer_conversation(packet_info *pinfo, jxta_stream_conversation_data *tpt_conv_data, gboolean create) | {
conversation_t * peer_conversation = NULL;
if ((AT_NONE != tpt_conv_data->initiator_address.type) && (AT_NONE != tpt_conv_data->receiver_address.type)) {
peer_conversation = find_conversation(pinfo->num, &tpt_conv_data->initiator_address, &tpt_conv_data->receiver_address,
PT_NONE, 0, 0, NO_PORT_B);
if (create && (NULL == peer_conversation)) {
peer_conversation = conversation_new(pinfo->num, &tpt_conv_data->initiator_address,
&tpt_conv_data->receiver_address, PT_NONE, 0, 0, NO_PORT_B);
conversation_set_dissector(peer_conversation, stream_jxta_handle);
}
}
return peer_conversation;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Gets a whole set of accel data including data, accuracy and timestamp. */ | void inv_get_accel_set(long *data, int8_t *accuracy, inv_time_t *timestamp) | /* Gets a whole set of accel data including data, accuracy and timestamp. */
void inv_get_accel_set(long *data, int8_t *accuracy, inv_time_t *timestamp) | {
if (data != NULL) {
memcpy(data, sensors.accel.calibrated, sizeof(sensors.accel.calibrated));
}
if (timestamp != NULL) {
*timestamp = sensors.accel.timestamp;
}
if (accuracy != NULL) {
*accuracy = sensors.accel.accuracy;
}
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* kthread which checks for tasks stuck in D state */ | static int watchdog(void *dummy) | /* kthread which checks for tasks stuck in D state */
static int watchdog(void *dummy) | {
set_user_nice(current, 0);
for ( ; ; ) {
unsigned long timeout = sysctl_hung_task_timeout_secs;
while (schedule_timeout_interruptible(timeout_jiffies(timeout)))
timeout = sysctl_hung_task_timeout_secs;
check_hung_uninterruptible_tasks(timeout);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* A stall is forced by setting the appropriate bit in the end points control and status register. */ | static void prvSendStall(void) | /* A stall is forced by setting the appropriate bit in the end points control and status register. */
static void prvSendStall(void) | {
unsigned long ulStatus;
portENTER_CRITICAL();
{
ulStatus = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];
usbCSR_SET_BIT( &ulStatus, AT91C_UDP_FORCESTALL );
AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulStatus;
}
portEXIT_CRITICAL();
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* set DMA mode a specific channel for CY82C693 */ | static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | /* set DMA mode a specific channel for CY82C693 */
static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | {
ide_hwif_t *hwif = drive->hwif;
u8 single = (mode & 0x10) >> 4, index = 0, data = 0;
index = hwif->channel ? CY82_INDEX_CHANNEL1 : CY82_INDEX_CHANNEL0;
data = (mode & 3) | (single << 2);
outb(index, CY82_INDEX_PORT);
outb(data, CY82_DATA_PORT);
data = BUSMASTER_TIMEOUT;
outb(CY82_INDEX_TIMEOUT, CY82_INDEX_PORT);
outb(data, CY82_DATA_PORT);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send the data in communicate buffer to SMI handler and get response. */ | EFI_STATUS SendCommunicateBuffer(IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN UINTN DataSize) | /* Send the data in communicate buffer to SMI handler and get response. */
EFI_STATUS SendCommunicateBuffer(IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN UINTN DataSize) | {
EFI_STATUS Status;
UINTN CommSize;
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE;
Status = mMmCommunication2->Communicate (
mMmCommunication2,
SmmCommunicateHeader,
SmmCommunicateHeader,
&CommSize
);
ASSERT_EFI_ERROR (Status);
SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *)SmmCommunicateHeader->Data;
return SmmFtwFunctionHeader->ReturnStatus;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Receive a message from a message queue.
See IEEE 1003.1 */ | int mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio) | /* Receive a message from a message queue.
See IEEE 1003.1 */
int mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio) | {
mqueue_desc *mqd = (mqueue_desc *)mqdes;
return receive_message(mqd, msg_ptr, msg_len, K_FOREVER);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Locking: must be called with the lp_mutex held */ | void __fc_linkup(struct fc_lport *lport) | /* Locking: must be called with the lp_mutex held */
void __fc_linkup(struct fc_lport *lport) | {
if (!lport->link_up) {
lport->link_up = 1;
if (lport->state == LPORT_ST_RESET)
fc_lport_enter_flogi(lport);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is only for internal llist manipulation where we know the prev/next entries already! */ | void __llist_add(llist_head *p, llist_head *prev, llist_head *next) | /* This is only for internal llist manipulation where we know the prev/next entries already! */
void __llist_add(llist_head *p, llist_head *prev, llist_head *next) | {
next->prev = p;
p->next = next;
p->prev = prev;
prev->next = p;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure the controller for operation; caller holds the device mutex. */ | static int cafe_ctlr_configure(struct cafe_camera *cam) | /* Configure the controller for operation; caller holds the device mutex. */
static int cafe_ctlr_configure(struct cafe_camera *cam) | {
unsigned long flags;
spin_lock_irqsave(&cam->dev_lock, flags);
cafe_ctlr_dma(cam);
cafe_ctlr_image(cam);
cafe_set_config_needed(cam, 0);
spin_unlock_irqrestore(&cam->dev_lock, flags);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns LEB properties for an empty LEB or NULL if the function is unable to find an empty LEB quickly. */ | const struct ubifs_lprops* ubifs_fast_find_empty(struct ubifs_info *c) | /* This function returns LEB properties for an empty LEB or NULL if the function is unable to find an empty LEB quickly. */
const struct ubifs_lprops* ubifs_fast_find_empty(struct ubifs_info *c) | {
struct ubifs_lprops *lprops;
ubifs_assert(mutex_is_locked(&c->lp_mutex));
if (list_empty(&c->empty_list))
return NULL;
lprops = list_entry(c->empty_list.next, struct ubifs_lprops, list);
ubifs_assert(!(lprops->flags & LPROPS_TAKEN));
ubifs_assert(!(lprops->flags & LPROPS_INDEX));
ubifs_assert(lprops->free == c->leb_size);
return lprops;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters. */ | static void qt_set_parameters(void) | /* This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters. */
static void qt_set_parameters(void) | {
qt_config_data.qt_di = DEF_QT_DI;
qt_config_data.qt_neg_drift_rate = DEF_QT_NEG_DRIFT_RATE;
qt_config_data.qt_pos_drift_rate = DEF_QT_POS_DRIFT_RATE;
qt_config_data.qt_max_on_duration = DEF_QT_MAX_ON_DURATION;
qt_config_data.qt_drift_hold_time = DEF_QT_DRIFT_HOLD_TIME;
qt_config_data.qt_recal_threshold = DEF_QT_RECAL_THRESHOLD;
qt_config_data.qt_pos_recal_delay = DEF_QT_POS_RECAL_DELAY;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. This service may only be called from the BSP. */ | EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL) | /* Retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. This service may only be called from the BSP. */
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL) | {
CPU_MP_DATA *CpuMpData;
UINTN CallerNumber;
UINTN ProcessorNumber;
UINTN EnabledProcessorNumber;
UINTN Index;
CpuMpData = GetCpuMpData ();
if ((NumberOfProcessors == NULL) && (NumberOfEnabledProcessors == NULL)) {
return EFI_INVALID_PARAMETER;
}
MpInitLibWhoAmI (&CallerNumber);
if (CallerNumber != CpuMpData->BspNumber) {
return EFI_DEVICE_ERROR;
}
ProcessorNumber = CpuMpData->CpuCount;
EnabledProcessorNumber = 0;
for (Index = 0; Index < ProcessorNumber; Index++) {
if (GetApState (&CpuMpData->CpuData[Index]) != CpuStateDisabled) {
EnabledProcessorNumber++;
}
}
if (NumberOfProcessors != NULL) {
*NumberOfProcessors = ProcessorNumber;
}
if (NumberOfEnabledProcessors != NULL) {
*NumberOfEnabledProcessors = EnabledProcessorNumber;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the Internal High Speed oscillator (HSI). */ | void RCC_EnableHsi(FunctionalState Cmd) | /* Enables or disables the Internal High Speed oscillator (HSI). */
void RCC_EnableHsi(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
*(__IO uint32_t*)CTRL_HSIEN_BB = (uint32_t)Cmd;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Event handler for the CCID_PC_to_RDR_XfrBlock. This message is sent to the device whenever an application at the host wants to send a block of bytes to the device THe device reply back with an array of bytes */ | uint8_t CALLBACK_CCID_XfrBlock(USB_ClassInfo_CCID_Device_t *const CCIDInterfaceInfo, const uint8_t Slot, const uint8_t *ReceivedBuffer, const uint8_t ReceivedBufferSize, uint8_t *const SendBuffer, uint8_t *const SentBufferSize, uint8_t *const Error) | /* Event handler for the CCID_PC_to_RDR_XfrBlock. This message is sent to the device whenever an application at the host wants to send a block of bytes to the device THe device reply back with an array of bytes */
uint8_t CALLBACK_CCID_XfrBlock(USB_ClassInfo_CCID_Device_t *const CCIDInterfaceInfo, const uint8_t Slot, const uint8_t *ReceivedBuffer, const uint8_t ReceivedBufferSize, uint8_t *const SendBuffer, uint8_t *const SentBufferSize, uint8_t *const Error) | {
if (Slot < CCID_Interface.Config.TotalSlots)
{
uint8_t OkResponse[2] = {0x90, 0x00};
memcpy(SendBuffer, OkResponse, sizeof(OkResponse));
*SentBufferSize = sizeof(OkResponse);
*Error = CCID_ERROR_NO_ERROR;
return CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT;
}
else
{
*Error = CCID_ERROR_SLOT_NOT_FOUND;
return CCID_COMMANDSTATUS_FAILED | CCID_ICCSTATUS_NOICCPRESENT;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Pauses the audio DMA Stream/Channel playing from the Media. */ | HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s) | /* Pauses the audio DMA Stream/Channel playing from the Media. */
HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s) | {
__HAL_LOCK(hi2s);
if (hi2s->State == HAL_I2S_STATE_BUSY_TX)
{
CLEAR_BIT(hi2s->Instance->CR, I2S_CR_TXDMA_EN);
}
if (hi2s->State == HAL_I2S_STATE_BUSY_RX)
{
CLEAR_BIT(hi2s->Instance->CR, I2S_CR_RXDMA_EN);
}
__HAL_UNLOCK(hi2s);
return HAL_OK;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI PciSegmentBitFieldAnd16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciSegmentBitFieldAnd16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | {
return PciSegmentWrite16 (
Address,
BitFieldAnd16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return the thread ID of the current running thread. */ | osThreadId osThreadGetId(void) | /* Return the thread ID of the current running thread. */
osThreadId osThreadGetId(void) | {
if (k_is_in_isr()) {
return NULL;
}
return (osThreadId)k_current_get();
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Clear the 3-wire SPI start interrupt flag of the specified SPI port. */ | void SPI3WireStartIntFlagClear(unsigned long ulBase) | /* Clear the 3-wire SPI start interrupt flag of the specified SPI port. */
void SPI3WireStartIntFlagClear(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SLV_START_INTSTS;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Who-Has-Request ::= SEQUENCE { limits SEQUENCE { deviceInstanceRangeLowLimit Unsigned (0..4194303), deviceInstanceRangeHighLimit Unsigned (0..4194303) } OPTIONAL, object CHOICE { objectIdentifier BACnetObjectIdentifier, objectName CharacterString } } */ | static guint fWhoHas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* Who-Has-Request ::= SEQUENCE { limits SEQUENCE { deviceInstanceRangeLowLimit Unsigned (0..4194303), deviceInstanceRangeHighLimit Unsigned (0..4194303) } OPTIONAL, object CHOICE { objectIdentifier BACnetObjectIdentifier, objectName CharacterString } } */
static guint fWhoHas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
guint lastoffset = 0;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
lastoffset = offset;
switch (fTagNo(tvb, offset)) {
case 0:
offset = fUnsignedTag(tvb, pinfo, tree, offset, "device Instance Low Limit: ");
break;
case 1:
offset = fUnsignedTag(tvb, pinfo, tree, offset, "device Instance High Limit: ");
break;
case 2:
offset = fObjectIdentifier(tvb, pinfo, tree, offset);
break;
case 3:
offset = fCharacterString(tvb, pinfo, tree, offset, "Object Name: ");
break;
default:
return offset;
}
if (offset == lastoffset) break;
}
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns: If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise NULL and @error will be set. */ | gchar* g_convert(const gchar *str, gssize len, const gchar *to_codeset, const gchar *from_codeset, gsize *bytes_read, gsize *bytes_written, GError **error) | /* Returns: If the conversion was successful, a newly allocated nul-terminated string, which must be freed with g_free(). Otherwise NULL and @error will be set. */
gchar* g_convert(const gchar *str, gssize len, const gchar *to_codeset, const gchar *from_codeset, gsize *bytes_read, gsize *bytes_written, GError **error) | {
gchar *res;
GIConv cd;
g_return_val_if_fail (str != NULL, NULL);
g_return_val_if_fail (to_codeset != NULL, NULL);
g_return_val_if_fail (from_codeset != NULL, NULL);
cd = open_converter (to_codeset, from_codeset, error);
if (cd == (GIConv) -1)
{
if (bytes_read)
*bytes_read = 0;
if (bytes_written)
*bytes_written = 0;
return NULL;
}
res = g_convert_with_iconv (str, len, cd,
bytes_read, bytes_written,
error);
close_converter (cd);
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* unbind a net-interface (resets interface after an error) */ | static void isdn_net_unbind_channel(isdn_net_local *lp) | /* unbind a net-interface (resets interface after an error) */
static void isdn_net_unbind_channel(isdn_net_local *lp) | {
skb_queue_purge(&lp->super_tx_queue);
if (!lp->master) {
qdisc_reset_all_tx(lp->netdev->dev);
}
lp->dialstate = 0;
dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
if (lp->isdn_device != -1 && lp->isdn_channel != -1)
isdn_free_channel(lp->isdn_device, lp->isdn_channel,
ISDN_USAGE_NET);
lp->flags &= ~ISDN_NET_CONNECTED;
lp->isdn_device = -1;
lp->isdn_channel = -1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Because of the size limitation of struct boot_params, only first 128 E820 memory entries are passed to kernel via boot_params.e820_map, others are passed via SETUP_E820_EXT node of linked list of struct setup_data, which is parsed here. */ | void __init parse_e820_ext(struct setup_data *sdata, unsigned long pa_data) | /* Because of the size limitation of struct boot_params, only first 128 E820 memory entries are passed to kernel via boot_params.e820_map, others are passed via SETUP_E820_EXT node of linked list of struct setup_data, which is parsed here. */
void __init parse_e820_ext(struct setup_data *sdata, unsigned long pa_data) | {
u32 map_len;
int entries;
struct e820entry *extmap;
entries = sdata->len / sizeof(struct e820entry);
map_len = sdata->len + sizeof(struct setup_data);
if (map_len > PAGE_SIZE)
sdata = early_ioremap(pa_data, map_len);
extmap = (struct e820entry *)(sdata->data);
__append_e820_map(extmap, entries);
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
if (map_len > PAGE_SIZE)
early_iounmap(sdata, map_len);
printk(KERN_INFO "extended physical RAM map:\n");
e820_print_map("extended");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The GetModeData() function copies the current operational settings of this EFI UDPv4 Protocol instance into user-supplied buffers. This function is used optionally to retrieve the operational mode data of underlying networks or drivers. */ | EFI_STATUS EFIAPI Udp4GetModeData(IN EFI_UDP4_PROTOCOL *This, OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL) | /* The GetModeData() function copies the current operational settings of this EFI UDPv4 Protocol instance into user-supplied buffers. This function is used optionally to retrieve the operational mode data of underlying networks or drivers. */
EFI_STATUS EFIAPI Udp4GetModeData(IN EFI_UDP4_PROTOCOL *This, OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL) | {
UDP4_INSTANCE_DATA *Instance;
EFI_IP4_PROTOCOL *Ip;
EFI_TPL OldTpl;
EFI_STATUS Status;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Instance = UDP4_INSTANCE_DATA_FROM_THIS (This);
if (!Instance->Configured && (Udp4ConfigData != NULL)) {
return EFI_NOT_STARTED;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (Udp4ConfigData != NULL) {
CopyMem (Udp4ConfigData, &Instance->ConfigData, sizeof (*Udp4ConfigData));
}
Ip = Instance->IpInfo->Ip.Ip4;
Status = Ip->GetModeData (Ip, Ip4ModeData, MnpConfigData, SnpModeData);
gBS->RestoreTPL (OldTpl);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function handles USB-On-The-Go HS global interrupt request. */ | void OTG_HS_IRQHandler(void) | /* This function handles USB-On-The-Go HS global interrupt request. */
void OTG_HS_IRQHandler(void) | {
HAL_HCD_IRQHandler(&hhcd_HS);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Fill in the task's elfregs structure for a core dump. */ | int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs) | /* Fill in the task's elfregs structure for a core dump. */
int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs) | {
elf_core_copy_regs(elfregs, task_pt_regs(t));
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* INFO signature set.
Use this function to set the state of the 128 valid bits at the beginning of customer info space, if needed. */ | bool am_hal_flash_info_signature_set(void) | /* INFO signature set.
Use this function to set the state of the 128 valid bits at the beginning of customer info space, if needed. */
bool am_hal_flash_info_signature_set(void) | {
return customer_info_signature_set() ? false : true;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configures queue depth based on host's cmd_per_len. If not set then we use the libfc default. */ | int fc_slave_alloc(struct scsi_device *sdev) | /* Configures queue depth based on host's cmd_per_len. If not set then we use the libfc default. */
int fc_slave_alloc(struct scsi_device *sdev) | {
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
if (!rport || fc_remote_port_chkready(rport))
return -ENXIO;
if (sdev->tagged_supported)
scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
else
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
FC_FCP_DFLT_QUEUE_DEPTH);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Indicates on which output the signal was applied, in push-pull mode balanced fault mode or delayed idle mode, when the protection was triggered. */ | uint32_t HRTIM_GetIdlePushPullStatus(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx) | /* Indicates on which output the signal was applied, in push-pull mode balanced fault mode or delayed idle mode, when the protection was triggered. */
uint32_t HRTIM_GetIdlePushPullStatus(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx) | {
uint32_t idle_pushpull_status;
assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx));
idle_pushpull_status = (HRTIMx->HRTIM_TIMERx[TimerIdx].TIMxISR & HRTIM_TIMISR_IPPSTAT);
return idle_pushpull_status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This works OK both with and without CONFIG_PREEMPT. We do strange low-level operations here to prevent schedule() from being called twice (once via spin_unlock(), once by hand). */ | int __cond_resched_lock(spinlock_t *lock) | /* This works OK both with and without CONFIG_PREEMPT. We do strange low-level operations here to prevent schedule() from being called twice (once via spin_unlock(), once by hand). */
int __cond_resched_lock(spinlock_t *lock) | {
int resched = should_resched();
int ret = 0;
lockdep_assert_held(lock);
if (spin_needbreak(lock) || resched) {
spin_unlock(lock);
if (resched)
__cond_resched();
else
cpu_relax();
ret = 1;
spin_lock(lock);
}
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function takes a pointer to a string in the format "YYMMDDhhmmss" (2-digit year, 2-digit month, etc), converts it to a 6-byte BCD string, and stores it in the build date field of the EEPROM local copy. */ | static void set_date(const char *string) | /* This function takes a pointer to a string in the format "YYMMDDhhmmss" (2-digit year, 2-digit month, etc), converts it to a 6-byte BCD string, and stores it in the build date field of the EEPROM local copy. */
static void set_date(const char *string) | {
unsigned int i;
if (strlen(string) != 12) {
printf("Usage: mac date YYMMDDhhmmss\n");
return;
}
for (i = 0; i < 6; i++)
e.date[i] = h2i(string[2 * i]) << 4 | h2i(string[2 * i + 1]);
update_crc();
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Perform a blocking write of 64 bytes of data to the SHA/MD5 module. */ | void SHAMD5DataWrite(uint32_t ui32Base, uint8_t *pui8Src) | /* Perform a blocking write of 64 bytes of data to the SHA/MD5 module. */
void SHAMD5DataWrite(uint32_t ui32Base, uint8_t *pui8Src) | {
uint8_t ui8Counter;
ASSERT(ui32Base == SHAMD5_BASE);
while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_INPUT_READY) == 0)
{
}
for(ui8Counter = 0; ui8Counter < 64; ui8Counter += 4)
{
HWREG(ui32Base + SHAMD5_O_DATA0_IN + ui8Counter) =
*((uint32_t *) (pui8Src + ui8Counter));
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Returns the current speed of the USB controller in device mode. */ | uint32_t USBDevSpeedGet(uint32_t ui32Base) | /* Returns the current speed of the USB controller in device mode. */
uint32_t USBDevSpeedGet(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
if (HWREGB(ui32Base + USB_O_POWER) & USB_POWER_HSMODE)
{
return (USB_HIGH_SPEED);
}
return (USB_FULL_SPEED);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* zfcp_adapter_release - remove the adapter from the resource list pointer to struct kref locks: adapter list write lock is assumed to be held by caller */ | void zfcp_adapter_release(struct kref *ref) | /* zfcp_adapter_release - remove the adapter from the resource list pointer to struct kref locks: adapter list write lock is assumed to be held by caller */
void zfcp_adapter_release(struct kref *ref) | {
struct zfcp_adapter *adapter = container_of(ref, struct zfcp_adapter,
ref);
struct ccw_device *cdev = adapter->ccw_device;
dev_set_drvdata(&adapter->ccw_device->dev, NULL);
zfcp_fc_gs_destroy(adapter);
zfcp_free_low_mem_buffers(adapter);
kfree(adapter->req_list);
kfree(adapter->fc_stats);
kfree(adapter->stats_reset_data);
kfree(adapter);
put_device(&cdev->dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each SAI_InitStruct member with its default value. */ | void SAI_StructInit(SAI_InitTypeDef *SAI_InitStruct) | /* Fills each SAI_InitStruct member with its default value. */
void SAI_StructInit(SAI_InitTypeDef *SAI_InitStruct) | {
SAI_InitStruct->SAI_AudioMode = SAI_Mode_MasterTx;
SAI_InitStruct->SAI_Protocol = SAI_Free_Protocol;
SAI_InitStruct->SAI_DataSize = SAI_DataSize_8b;
SAI_InitStruct->SAI_FirstBit = SAI_FirstBit_MSB;
SAI_InitStruct->SAI_ClockStrobing = SAI_ClockStrobing_FallingEdge;
SAI_InitStruct->SAI_Synchro = SAI_Asynchronous;
SAI_InitStruct->SAI_OUTDRIV = SAI_OutputDrive_Disabled;
SAI_InitStruct->SAI_NoDivider = SAI_MasterDivider_Enabled;
SAI_InitStruct->SAI_MasterDivider = 0;
SAI_InitStruct->SAI_FIFOThreshold = SAI_Threshold_FIFOEmpty;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* pci_update_current_state - Read PCI power state of given device from its PCI PM registers and cache it @dev: PCI device to handle. @state: State to cache in case the device doesn't have the PM capability */ | void pci_update_current_state(struct pci_dev *dev, pci_power_t state) | /* pci_update_current_state - Read PCI power state of given device from its PCI PM registers and cache it @dev: PCI device to handle. @state: State to cache in case the device doesn't have the PM capability */
void pci_update_current_state(struct pci_dev *dev, pci_power_t state) | {
if (dev->pm_cap) {
u16 pmcsr;
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
} else {
dev->current_state = state;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the USART's Smart Card mode. */ | void USART_SmartCardCmd(USART_TypeDef *USARTx, FunctionalState NewState) | /* Enables or disables the USART's Smart Card mode. */
void USART_SmartCardCmd(USART_TypeDef *USARTx, FunctionalState NewState) | {
assert_param(IS_USART_1236_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR3 |= USART_CR3_SCEN;
}
else
{
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_SCEN);
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* gfs2_consist_i - Flag a filesystem consistency error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */ | int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function, char *file, unsigned int line) | /* gfs2_consist_i - Flag a filesystem consistency error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */
int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function, char *file, unsigned int line) | {
int rv;
rv = gfs2_lm_withdraw(sdp,
"GFS2: fsid=%s: fatal: filesystem consistency error\n"
"GFS2: fsid=%s: function = %s, file = %s, line = %u\n",
sdp->sd_fsname,
sdp->sd_fsname, function, file, line);
return rv;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Change Logs: Date Author Notes Please do not edit this file. It was generated using rpcgen. */ | bool_t xdr_fhandle3(register XDR *xdrs, fhandle3 *objp) | /* Change Logs: Date Author Notes Please do not edit this file. It was generated using rpcgen. */
bool_t xdr_fhandle3(register XDR *xdrs, fhandle3 *objp) | {
if (!xdr_bytes(xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, FHSIZE3))
return (FALSE);
return (TRUE);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Read data with special length in slave mode through the I2Cx peripheral. */ | void I2C_SlaveRead(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len) | /* Read data with special length in slave mode through the I2Cx peripheral. */
void I2C_SlaveRead(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len) | {
u8 cnt = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
for(cnt = 0; cnt < len; cnt++) {
while((I2C_CheckFlagState(I2Cx, (BIT_IC_STATUS_RFNE | BIT_IC_STATUS_RFF))) == 0);
*pBuf++ = (u8)I2Cx->IC_DATA_CMD;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The guest indicates if a page is shared using the Guest Physical Address (GPA) Shared (S) bit. If the GPA Width(GPAW) is 48, the S-bit is bit-47. If the GPAW is 52, the S-bit is bit-51. */ | UINT64 EFIAPI TdSharedPageMask(VOID) | /* The guest indicates if a page is shared using the Guest Physical Address (GPA) Shared (S) bit. If the GPA Width(GPAW) is 48, the S-bit is bit-47. If the GPAW is 52, the S-bit is bit-51. */
UINT64 EFIAPI TdSharedPageMask(VOID) | {
if (mTdDataReturned) {
return mTdSharedPageMask;
}
return GetTdInfo () ? mTdSharedPageMask : 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* function : de_rtmx_set_gld_reg_base(unsigned int sel, unsigned int base) description : set de reg base parameters : sel <rtmx select> base <reg base> return : success */ | int de_rtmx_set_gld_reg_base(unsigned int sel, void *base) | /* function : de_rtmx_set_gld_reg_base(unsigned int sel, unsigned int base) description : set de reg base parameters : sel <rtmx select> base <reg base> return : success */
int de_rtmx_set_gld_reg_base(unsigned int sel, void *base) | {
DE_INF("sel=0x%x, addr=0x%p\n", sel, base);
de200_rtmx[sel].glb_ctl = (struct __glb_reg_t *)base;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* One time initialization to let the world know the SBA was found. This is the only routine which is NOT static. Must be called exactly once before pci_init(). */ | void __init sba_init(void) | /* One time initialization to let the world know the SBA was found. This is the only routine which is NOT static. Must be called exactly once before pci_init(). */
void __init sba_init(void) | {
register_parisc_driver(&sba_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set up replicated mappings of the same region. */ | static void pflash_setup_mappings(pflash_t *pfl) | /* Set up replicated mappings of the same region. */
static void pflash_setup_mappings(pflash_t *pfl) | {
unsigned i;
hwaddr size = memory_region_size(&pfl->orig_mem);
memory_region_init(&pfl->mem, OBJECT(pfl), "pflash", pfl->mappings * size);
pfl->mem_mappings = g_new(MemoryRegion, pfl->mappings);
for (i = 0; i < pfl->mappings; ++i) {
memory_region_init_alias(&pfl->mem_mappings[i], OBJECT(pfl),
"pflash-alias", &pfl->orig_mem, 0, size);
memory_region_add_subregion(&pfl->mem, i * size, &pfl->mem_mappings[i]);
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* before qdev initialization(qdev_init()), this function sets bus_name and map_irq callback which are necessry for pci_bridge_initfn() to initialize bus. */ | void pci_bridge_map_irq(PCIBridge *br, const char *bus_name, pci_map_irq_fn map_irq) | /* before qdev initialization(qdev_init()), this function sets bus_name and map_irq callback which are necessry for pci_bridge_initfn() to initialize bus. */
void pci_bridge_map_irq(PCIBridge *br, const char *bus_name, pci_map_irq_fn map_irq) | {
br->map_irq = map_irq;
br->bus_name = bus_name;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Set the position of an area (width and height will be kept) */ | void _lv_area_set_pos(lv_area_t *area_p, lv_coord_t x, lv_coord_t y) | /* Set the position of an area (width and height will be kept) */
void _lv_area_set_pos(lv_area_t *area_p, lv_coord_t x, lv_coord_t y) | {
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
area_p->x1 = x;
area_p->y1 = y;
lv_area_set_width(area_p, w);
lv_area_set_height(area_p, h);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Determins if the specified Generic Clock Generator is enabled. */ | bool system_gclk_gen_is_enabled(const uint8_t generator) | /* Determins if the specified Generic Clock Generator is enabled. */
bool system_gclk_gen_is_enabled(const uint8_t generator) | {
bool enabled;
system_interrupt_enter_critical_section();
enabled = (GCLK->GENCTRL[generator].reg & GCLK_GENCTRL_GENEN);
system_interrupt_leave_critical_section();
return enabled;
} | memfault/zero-to-main | C++ | null | 200 |
/* USBH_SetFeature The command sets the device features (remote wakeup feature,..) */ | USBH_StatusTypeDef USBH_SetFeature(USBH_HandleTypeDef *phost, uint8_t wValue) | /* USBH_SetFeature The command sets the device features (remote wakeup feature,..) */
USBH_StatusTypeDef USBH_SetFeature(USBH_HandleTypeDef *phost, uint8_t wValue) | {
if (phost->RequestState == CMD_SEND)
{
phost->Control.setup.b.bmRequestType = USB_H2D | USB_REQ_RECIPIENT_DEVICE
| USB_REQ_TYPE_STANDARD;
phost->Control.setup.b.bRequest = USB_REQ_SET_FEATURE;
phost->Control.setup.b.wValue.w = wValue;
phost->Control.setup.b.wIndex.w = 0U;
phost->Control.setup.b.wLength.w = 0U;
}
return USBH_CtlReq(phost, NULL, 0U);
} | ua1arn/hftrx | C++ | null | 69 |
/* Get the MCG external reference clock frequency.
Get the current MCG external reference clock frequency in Hz. It is the frequency select by MCG_C7. This is an internal function. */ | static uint32_t CLOCK_GetMcgExtClkFreq(void) | /* Get the MCG external reference clock frequency.
Get the current MCG external reference clock frequency in Hz. It is the frequency select by MCG_C7. This is an internal function. */
static uint32_t CLOCK_GetMcgExtClkFreq(void) | {
assert(g_xtal0Freq);
return g_xtal0Freq;
} | labapart/polymcu | C++ | null | 201 |
/* Called when compression is completed to free memory previously allocated. */ | VOID FreeMemory(VOID) | /* Called when compression is completed to free memory previously allocated. */
VOID FreeMemory(VOID) | {
SHELL_FREE_NON_NULL (mText);
SHELL_FREE_NON_NULL (mLevel);
SHELL_FREE_NON_NULL (mChildCount);
SHELL_FREE_NON_NULL (mPosition);
SHELL_FREE_NON_NULL (mParent);
SHELL_FREE_NON_NULL (mPrev);
SHELL_FREE_NON_NULL (mNext);
SHELL_FREE_NON_NULL (mBuf);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable I2C interrupt of the specified I2C port.
The */ | void I2CIntDisable(unsigned long ulBase) | /* Disable I2C interrupt of the specified I2C port.
The */
void I2CIntDisable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE));
xHWREG(ulBase + I2C_O_CON) &= ~I2C_CON_EI;
xIntDisable(INT_I2C0);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.