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 |
|---|---|---|---|---|---|---|---|
/* @nvmeq: The queue to use @cmd: The command to send */ | static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd) | /* @nvmeq: The queue to use @cmd: The command to send */
static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd) | {
u16 tail = nvmeq->sq_tail;
memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
flush_dcache_range((ulong)&nvmeq->sq_cmds[tail],
(ulong)&nvmeq->sq_cmds[tail] + sizeof(*cmd));
if (++tail == nvmeq->q_depth)
tail = 0;
writel(tail, nvmeq->q_db);
nvmeq->sq_tail = tail;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* aes_128_cbc_decrypt - AES-128 CBC decryption @key: Decryption key @iv: Decryption IV for CBC mode (16 bytes) @data: Data to decrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */ | int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) | /* aes_128_cbc_decrypt - AES-128 CBC decryption @key: Decryption key @iv: Decryption IV for CBC mode (16 bytes) @data: Data to decrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */
int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data... | {
void *ctx;
u8 cbc[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE];
u8 *pos = data;
int i, j, blocks;
ctx = aes_decrypt_init(key, 16);
if (ctx == NULL)
return -1;
os_memcpy(cbc, iv, AES_BLOCK_SIZE);
blocks = data_len / AES_BLOCK_SIZE;
for (i = 0; i < blocks; i++) {
os_memcpy(tmp, pos, AES_BLOCK_SIZE);
aes_decrypt(... | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Transfer bytes between the config space of a given PCI device and a memory buffer. */ | STATIC EFI_STATUS ProtoDevTransferConfig(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_PCI_IO_PROTOCOL_CONFIG TransferFunction, IN UINT16 ConfigOffset, IN OUT UINT8 *Buffer, IN UINT16 Size) | /* Transfer bytes between the config space of a given PCI device and a memory buffer. */
STATIC EFI_STATUS ProtoDevTransferConfig(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_PCI_IO_PROTOCOL_CONFIG TransferFunction, IN UINT16 ConfigOffset, IN OUT UINT8 *Buffer, IN UINT16 Size) | {
while (Size > 0) {
EFI_PCI_IO_PROTOCOL_WIDTH Width;
UINT16 Count;
EFI_STATUS Status;
UINT16 Progress;
if ((Size >= 4) && ((ConfigOffset & 3) == 0)) {
Width = EfiPciIoWidthUint32;
Count = Size >> Width;
} else if ((Size >= 2... | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power */ | void adc_disable_regulator(uint32_t adc) | /* Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power */
void adc_disable_regulator(uint32_t adc) | {
ADC_CR(adc) &= ~ADC_CR_ADVREGEN;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */ | unsigned long long sched_clock(void) | /* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */
unsigned long long sched_clock(void) | {
unsigned long long v = cnt32_to_63(readl(__io_address(VEXPRESS_SYS_24MHz)));
v *= 125<<1;
do_div(v, 3<<1);
return v;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the peripheral clock speed for the USART at base specified. */ | uint32_t rcc_get_usart_clk_freq(uint32_t usart) | /* Get the peripheral clock speed for the USART at base specified. */
uint32_t rcc_get_usart_clk_freq(uint32_t usart) | {
if (usart == USART1_BASE) {
return rcc_apb2_frequency;
} else {
return rcc_apb1_frequency;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Unregisters the Exec OSM from the I2O core. */ | void i2o_exec_exit(void) | /* Unregisters the Exec OSM from the I2O core. */
void i2o_exec_exit(void) | {
i2o_driver_unregister(&i2o_exec_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function periodically polls the Serial MUX to check for new data. */ | static void mux_poll(unsigned long unused) | /* This function periodically polls the Serial MUX to check for new data. */
static void mux_poll(unsigned long unused) | {
int i;
for(i = 0; i < port_cnt; ++i) {
if(!mux_ports[i].enabled)
continue;
mux_read(&mux_ports[i].port);
mux_write(&mux_ports[i].port);
}
mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth) | /* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth) | {
if(heth->Instance==ETH)
{
__HAL_RCC_ETH_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_2);
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_14|GPIO_PIN_13|GPIO_PIN_11);
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_7|GPIO_PIN_6);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_3|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_4
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Update the GIC Distributor Information in the MADT Table. */ | STATIC VOID AddGICD(EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE *CONST Gicd, CONST CM_ARM_GICD_INFO *CONST GicDInfo) | /* Update the GIC Distributor Information in the MADT Table. */
STATIC VOID AddGICD(EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE *CONST Gicd, CONST CM_ARM_GICD_INFO *CONST GicDInfo) | {
ASSERT (Gicd != NULL);
ASSERT (GicDInfo != NULL);
Gicd->Type = EFI_ACPI_6_5_GICD;
Gicd->Length = sizeof (EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE);
Gicd->Reserved1 = EFI_ACPI_RESERVED_WORD;
Gicd->GicId = 0;
Gicd->PhysicalBaseAddress = GicDInfo->PhysicalBaseAddress;
Gicd->SystemVectorBase = EFI_ACPI_RESE... | tianocore/edk2 | C++ | Other | 4,240 |
/* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 dr... | static unsigned int zs_tx_empty(struct uart_port *uport) | /* Purpose: Let user call ioctl() to get info when the UART physically is emptied. On bus types like RS485, the transmitter must release the bus after transmitting. This must be done when the transmit shift register is empty, not be done when the transmit holding register is empty. This functionality allows an RS485 dr... | {
struct zs_port *zport = to_zport(uport);
struct zs_scc *scc = zport->scc;
unsigned long flags;
u8 status;
spin_lock_irqsave(&scc->zlock, flags);
status = read_zsreg(zport, R1);
spin_unlock_irqrestore(&scc->zlock, flags);
return status & ALL_SNT ? TIOCSER_TEMT : 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details. */ | EFI_STATUS SdPeimHcInitPowerVoltage(IN UINTN Bar) | /* Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details. */
EFI_STATUS SdPeimHcInitPowerVoltage(IN UINTN Bar) | {
EFI_STATUS Status;
SD_HC_SLOT_CAP Capability;
UINT8 MaxVoltage;
UINT8 HostCtrl2;
Status = SdPeimHcGetCapability (Bar, &Capability);
if (EFI_ERROR (Status)) {
return Status;
}
if (Capability.Voltage33 != 0) {
MaxVoltage = 0x0E;
} else if (Capability.Voltage30 != 0) {... | tianocore/edk2 | C++ | Other | 4,240 |
/* Read the next element as an ASCII string. 0 is success, < 0 is failure. */ | static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) | /* Read the next element as an ASCII string. 0 is success, < 0 is failure. */
static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) | {
av_free(*str);
if (!(*str = av_malloc(size + 1)))
return AVERROR(ENOMEM);
if (get_buffer(pb, (uint8_t *) *str, size) != size) {
av_free(*str);
return AVERROR(EIO);
}
(*str)[size] = '\0';
return 0;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* ld_usb_abort_transfers aborts transfers and frees associated data structures */ | static void ld_usb_abort_transfers(struct ld_usb *dev) | /* ld_usb_abort_transfers aborts transfers and frees associated data structures */
static void ld_usb_abort_transfers(struct ld_usb *dev) | {
if (dev->interrupt_in_running) {
dev->interrupt_in_running = 0;
if (dev->intf)
usb_kill_urb(dev->interrupt_in_urb);
}
if (dev->interrupt_out_busy)
if (dev->intf)
usb_kill_urb(dev->interrupt_out_urb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Call the NetLabel mechanism to get the security attributes of the given packet and use those attributes to determine the correct context/SID to assign to the packet. Returns zero on success, negative values on failure. */ | int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u16 family, u32 *type, u32 *sid) | /* Description: Call the NetLabel mechanism to get the security attributes of the given packet and use those attributes to determine the correct context/SID to assign to the packet. Returns zero on success, negative values on failure. */
int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u16 family, u32 *type, u32 ... | {
int rc;
struct netlbl_lsm_secattr secattr;
if (!netlbl_enabled()) {
*sid = SECSID_NULL;
return 0;
}
netlbl_secattr_init(&secattr);
rc = netlbl_skbuff_getattr(skb, family, &secattr);
if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
rc = selinux_netlbl_sidlookup_cached(skb, &secattr, sid);
else
*sid... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Flushes all data associated with the file handle. */ | EFI_STATUS EFIAPI FatFlush(IN EFI_FILE_PROTOCOL *FHand) | /* Flushes all data associated with the file handle. */
EFI_STATUS EFIAPI FatFlush(IN EFI_FILE_PROTOCOL *FHand) | {
return FatFlushEx (FHand, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function used to save the WEP keys for a selected interface */ | void airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info) | /* Function used to save the WEP keys for a selected interface */
void airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info) | {
if (!if_info || !AirpcapLoaded) return;
if (if_info->keysCollection != NULL)
g_PAirpcapSetDeviceKeys(ad,if_info->keysCollection);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Turns off the display and puts it into sleep mode Does not turn off backlight. */ | EMSTATUS DMD_sleep(void) | /* Turns off the display and puts it into sleep mode Does not turn off backlight. */
EMSTATUS DMD_sleep(void) | {
uint16_t data;
if (!initialized)
{
return DMD_ERROR_DRIVER_NOT_INITIALIZED;
}
data = DMD_SSD2119_SLEEP_MODE_1_SLP;
DMDIF_writeReg(DMD_SSD2119_SLEEP_MODE_1, data);
data = 0;
DMDIF_writeReg(DMD_SSD2119_DISPLAY_CONTROL, 0x0000);
return DMD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the GMAC in loopback mode. When on GMAC operates in loop-back mode at GMII/MII. */ | void synopGMAC_loopback_on(synopGMACdevice *gmacdev) | /* Sets the GMAC in loopback mode. When on GMAC operates in loop-back mode at GMII/MII. */
void synopGMAC_loopback_on(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacLoopback);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Wrapper around bwrite() so that we can trap write errors, and act accordingly. */ | int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp) | /* Wrapper around bwrite() so that we can trap write errors, and act accordingly. */
int xfs_bwrite(struct xfs_mount *mp, struct xfs_buf *bp) | {
int error;
XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
bp->b_mount = mp;
XFS_BUF_WRITE(bp);
if ((error = XFS_bwrite(bp))) {
ASSERT(mp);
xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
}
return (error);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USART Transmitter DMA Enable.
DMA is available on: */ | void usart_enable_tx_dma(uint32_t usart) | /* USART Transmitter DMA Enable.
DMA is available on: */
void usart_enable_tx_dma(uint32_t usart) | {
USART_CR3(usart) |= USART_CR3_DMAT;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Callback when an address is assigned to the device. */ | static void address_assigned(const usbh_transfer *transfer, usbh_transfer_status status, usbh_urb_id urb_id) | /* Callback when an address is assigned to the device. */
static void address_assigned(const usbh_transfer *transfer, usbh_transfer_status status, usbh_urb_id urb_id) | {
(void) urb_id;
usbh_device *dev = transfer->device;
if (status != USBH_SUCCESS) {
LOG_LN("failed to set address to device");
enum_failed(dev);
return;
}
LOG_LN("succeeded in set address to device");
dev->address = transfer->setup.wValue;
LOG_LN("trying to read partial device descriptor from device");
us... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Internal function to add IO write opcode to the table. */ | EFI_STATUS BootScriptWriteIoWrite(IN VA_LIST Marker) | /* Internal function to add IO write opcode to the table. */
EFI_STATUS BootScriptWriteIoWrite(IN VA_LIST Marker) | {
S3_BOOT_SCRIPT_LIB_WIDTH Width;
UINT64 Address;
UINTN Count;
UINT8 *Buffer;
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
Count = VA_ARG (Marker, UINTN);
Buffer = VA_ARG (Marker, UINT8 *);
return... | tianocore/edk2 | C++ | Other | 4,240 |
/* Make sure any single step bits, etc. are not set */ | void ptrace_disable(struct task_struct *child) | /* Make sure any single step bits, etc. are not set */
void ptrace_disable(struct task_struct *child) | {
clear_tsk_thread_flag(child, TIF_SINGLE_STEP);
clear_tsk_thread_flag(child, TIF_BREAKPOINT);
ocd_disable(child);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ufshcd_get_req_rsp - returns the TR response transaction type */ | static int ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) | /* ufshcd_get_req_rsp - returns the TR response transaction type */
static int ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) | {
return be32_to_cpu(ucd_rsp_ptr->header.dword_0) >> 24;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Function for handling the Application's BLE Stack events. */ | static void on_ble_evt(ble_evt_t *p_ble_evt) | /* Function for handling the Application's BLE Stack events. */
static void on_ble_evt(ble_evt_t *p_ble_evt) | {
uint32_t err_code;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
break;
case BLE_G... | labapart/polymcu | C++ | null | 201 |
/* 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 mRunningOnQ35 ?
PciExpressOr32 (Address, OrData) :
PciCf8Or32 (Address, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Description: blk_start_queue() will clear the stop flag on the queue, and call the request_fn for the queue if it was in a stopped state when entered. Also see blk_stop_queue(). Queue lock must be held. */ | void blk_start_queue(struct request_queue *q) | /* Description: blk_start_queue() will clear the stop flag on the queue, and call the request_fn for the queue if it was in a stopped state when entered. Also see blk_stop_queue(). Queue lock must be held. */
void blk_start_queue(struct request_queue *q) | {
WARN_ON(!irqs_disabled());
queue_flag_clear(QUEUE_FLAG_STOPPED, q);
__blk_run_queue(q);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Changed callback for the channel combobox - common routine */ | static void airpcap_channel_changed_common(GtkWidget *channel_cb, gpointer channel_offset_cb, gboolean set) | /* Changed callback for the channel combobox - common routine */
static void airpcap_channel_changed_common(GtkWidget *channel_cb, gpointer channel_offset_cb, gboolean set) | {
gint cur_chan_idx;
if (channel_cb && channel_offset_cb && change_airpcap_settings && airpcap_if_active) {
cur_chan_idx = gtk_combo_box_get_active(GTK_COMBO_BOX(channel_cb));
if (cur_chan_idx >= 0 && cur_chan_idx < (gint) airpcap_if_active->numSupportedChannels) {
if (set) {
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* pci_disable_sriov - disable the SR-IOV capability @dev: the PCI device */ | void pci_disable_sriov(struct pci_dev *dev) | /* pci_disable_sriov - disable the SR-IOV capability @dev: the PCI device */
void pci_disable_sriov(struct pci_dev *dev) | {
might_sleep();
if (!dev->is_physfn)
return;
sriov_disable(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */ | void SNVS_HP_RTC_GetDatetime(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime) | /* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */
void SNVS_HP_RTC_GetDatetime(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime) | {
assert(datetime != NULL);
SNVS_HP_ConvertSecondsToDatetime(SNVS_HP_RTC_GetSeconds(base), datetime);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. The 16-bit value read from the SMBUS is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length... | UINT16 EFIAPI SmBusReadDataWord(IN UINTN SmBusAddress, OUT RETURN_STATUS *Status OPTIONAL) | /* Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. The 16-bit value read from the SMBUS is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length... | {
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
return 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieves attributes, insures positive polarity of attribute bits, returns resulting attributes in output parameter. */ | EFI_STATUS EFIAPI FvGetVolumeAttributes(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, OUT EFI_FV_ATTRIBUTES *Attributes) | /* Retrieves attributes, insures positive polarity of attribute bits, returns resulting attributes in output parameter. */
EFI_STATUS EFIAPI FvGetVolumeAttributes(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, OUT EFI_FV_ATTRIBUTES *Attributes) | {
EFI_STATUS Status;
FV_DEVICE *FvDevice;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
EFI_FVB_ATTRIBUTES_2 FvbAttributes;
FvDevice = FV_DEVICE_FROM_THIS (This);
Fvb = FvDevice->Fvb;
Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
Fv... | tianocore/edk2 | C++ | Other | 4,240 |
/* clocksource_change_rating - Change the rating of a registered clocksource */ | void clocksource_change_rating(struct clocksource *cs, int rating) | /* clocksource_change_rating - Change the rating of a registered clocksource */
void clocksource_change_rating(struct clocksource *cs, int rating) | {
mutex_lock(&clocksource_mutex);
__clocksource_change_rating(cs, rating);
mutex_unlock(&clocksource_mutex);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Change Logs: Date Author Notes flybreak the first version. */ | int __ARM_TPL_clock_realtime(__ARM_TPL_timespec_t *__ts) | /* Change Logs: Date Author Notes flybreak the first version. */
int __ARM_TPL_clock_realtime(__ARM_TPL_timespec_t *__ts) | {
unsigned int t = std::time(nullptr);
__ts->tv_sec = t;
__ts->tv_nsec = 0;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* SYSCTRL GPIOB Bus Clock Disable and Reset Assert. */ | void LL_SYSCTRL_GPIOB_ClkDisRstAssert(void) | /* SYSCTRL GPIOB Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_GPIOB_ClkDisRstAssert(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_GPIOBBusClk_Dis(SYSCTRL);
__LL_SYSCTRL_GPIOBSoftRst_Assert(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* tasklet_hrtimer The trampoline is called when the hrtimer expires. It schedules a tasklet to run __tasklet_hrtimer_trampoline() which in turn will call the intended hrtimer callback, but from softirq context. */ | static enum hrtimer_restart __hrtimer_tasklet_trampoline(struct hrtimer *timer) | /* tasklet_hrtimer The trampoline is called when the hrtimer expires. It schedules a tasklet to run __tasklet_hrtimer_trampoline() which in turn will call the intended hrtimer callback, but from softirq context. */
static enum hrtimer_restart __hrtimer_tasklet_trampoline(struct hrtimer *timer) | {
struct tasklet_hrtimer *ttimer =
container_of(timer, struct tasklet_hrtimer, timer);
tasklet_hi_schedule(&ttimer->tasklet);
return HRTIMER_NORESTART;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The TSC counting frequency is determined by using CPUID leaf 0x15. Frequency in MHz = Core XTAL frequency * EBX/EAX. In newer flavors of the CPU, core xtal frequency is returned in ECX or 0 if not supported. */ | UINT64 CpuidCoreClockCalculateTscFrequency(VOID) | /* The TSC counting frequency is determined by using CPUID leaf 0x15. Frequency in MHz = Core XTAL frequency * EBX/EAX. In newer flavors of the CPU, core xtal frequency is returned in ECX or 0 if not supported. */
UINT64 CpuidCoreClockCalculateTscFrequency(VOID) | {
UINT64 TscFrequency;
UINT64 CoreXtalFrequency;
UINT32 RegEax;
UINT32 RegEbx;
UINT32 RegEcx;
AsmCpuid (CPUID_TIME_STAMP_COUNTER, &RegEax, &RegEbx, &RegEcx, NULL);
if ((RegEax == 0) || (RegEbx == 0)) {
ASSERT (RegEax != 0);
ASSERT (RegEbx != 0);
return 0;
}
if (RegEcx == 0) {
Core... | tianocore/edk2 | C++ | Other | 4,240 |
/* Stop a timer.
Valid values for ui32TimerSegment are: */ | void am_hal_ctimer_stop(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment) | /* Stop a timer.
Valid values for ui32TimerSegment are: */
void am_hal_ctimer_stop(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment) | {
volatile uint32_t *pui32ConfigReg;
pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
(ui32TimerNumber * TIMER_OFFSET));
AM_CRITICAL_BEGIN_ASM
AM_REGVAL(pui32ConfigReg) &= ~(ui32TimerSegment &
(AM_REG_CTIMER_CT... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Searches the menu for menuitems that start with the key parameter. */ | static int menu_key_find(const menu_t *menu, const char *key) | /* Searches the menu for menuitems that start with the key parameter. */
static int menu_key_find(const menu_t *menu, const char *key) | {
int menuitem_found = MenuKeyFindNone;
int num_found = 0;
int menu_size = menu_get_size(menu);
int index = 0;
for (index = 0; index < menu_size; ++index)
{
if (menu->menuitems[index].key == NULL)
continue;
if (strncasecmp(key, menu->menuitems[index].key, strlen(key))... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* fills out function pointers in the net_device structure */ | static void spider_net_setup_netdev_ops(struct net_device *netdev) | /* fills out function pointers in the net_device structure */
static void spider_net_setup_netdev_ops(struct net_device *netdev) | {
netdev->netdev_ops = &spider_net_ops;
netdev->watchdog_timeo = SPIDER_NET_WATCHDOG_TIMEOUT;
netdev->ethtool_ops = &spider_net_ethtool_ops;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets interrupt status for the specified GPIO port. */ | unsigned long GPIOPinIntStatus(void) | /* Gets interrupt status for the specified GPIO port. */
unsigned long GPIOPinIntStatus(void) | {
return(xHWREG(EXTI_PR));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Confirm that local IP address exists using wildcards: */ | __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope) | /* Confirm that local IP address exists using wildcards: */
__be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope) | {
__be32 addr = 0;
struct net_device *dev;
struct net *net;
if (scope != RT_SCOPE_LINK)
return confirm_addr_indev(in_dev, dst, local, scope);
net = dev_net(in_dev->dev);
rcu_read_lock();
for_each_netdev_rcu(net, dev) {
in_dev = __in_dev_get_rcu(dev);
if (in_dev) {
addr = confirm_addr_indev(in_dev, dst, ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: (transfer none): #GIcon for the given @info. */ | GIcon* g_file_info_get_icon(GFileInfo *info) | /* Returns: (transfer none): #GIcon for the given @info. */
GIcon* g_file_info_get_icon(GFileInfo *info) | {
static guint32 attr = 0;
GFileAttributeValue *value;
GObject *obj;
g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
if (attr == 0)
attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_ICON);
value = g_file_info_find_value (info, attr);
obj = _g_file_attribute_value_get_object (value);
if (G_IS_IC... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clean up the assemble table: remove all the fragments and assemble entries. */ | VOID Ip4CleanAssembleTable(IN IP4_ASSEMBLE_TABLE *Table) | /* Clean up the assemble table: remove all the fragments and assemble entries. */
VOID Ip4CleanAssembleTable(IN IP4_ASSEMBLE_TABLE *Table) | {
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
IP4_ASSEMBLE_ENTRY *Assemble;
UINT32 Index;
for (Index = 0; Index < IP4_ASSEMLE_HASH_SIZE; Index++) {
NET_LIST_FOR_EACH_SAFE (Entry, Next, &Table->Bucket[Index]) {
Assemble = NET_LIST_USER_STRUCT (Entry, IP4_ASSEMBLE_ENTRY, Link)... | tianocore/edk2 | C++ | Other | 4,240 |
/* The STATUS_SPIAux register is read by the auxiliary SPI.. */ | int32_t lsm6dso_aux_status_reg_get(lsm6dso_ctx_t *ctx, lsm6dso_status_spiaux_t *val) | /* The STATUS_SPIAux register is read by the auxiliary SPI.. */
int32_t lsm6dso_aux_status_reg_get(lsm6dso_ctx_t *ctx, lsm6dso_status_spiaux_t *val) | {
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_STATUS_SPIAUX, (uint8_t*) val, 1);
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* see if there's a fixup handler available to deal with a kernel fault */ | unsigned long search_exception_table(unsigned long pc) | /* see if there's a fixup handler available to deal with a kernel fault */
unsigned long search_exception_table(unsigned long pc) | {
const struct exception_table_entry *extab;
if (__frame->lr == (unsigned long) &__memset_user_error_lr &&
(unsigned long) &memset <= pc && pc < (unsigned long) &__memset_end
) {
return (unsigned long) &__memset_user_error_handler;
}
if (__frame->lr == (unsigned long) &__memcpy_user_error_lr &&
(un... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clears or safeguards the OCREF5 signal on an external event. */ | void TIM_ClrOc5Ref(TIM_Module *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF5 signal on an external event. */
void TIM_ClrOc5Ref(TIM_Module *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr3 = 0;
assert_param(IsTimList1Module(TIMx));
assert_param(IsTimOcClrState(TIM_OCClear));
tmpccmr3 = TIMx->CCMOD3;
tmpccmr3 &= (uint16_t) ~((uint16_t)TIM_CCMOD3_OC5CEN);
tmpccmr3 |= (uint16_t)(TIM_OCClear);
TIMx->CCMOD3 = tmpccmr3;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* The low level system call upon which malloc is built.
If we run out of memory, a message is printed and abort() is called. */ | caddr_t _sbrk(int nbytes) | /* The low level system call upon which malloc is built.
If we run out of memory, a message is printed and abort() is called. */
caddr_t _sbrk(int nbytes) | {
static caddr_t heap_ptr = NULL;
caddr_t base;
if (heap_ptr == NULL)
{
heap_ptr = (caddr_t)&free_memory_start;
}
base = heap_ptr;
heap_ptr += nbytes;
if (heap_ptr > (caddr_t)&free_memory_end)
{
_write(1, "** Heap ran out of memory! **\n", 24);
abort();
}
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable the UART, RX, and TX.
This function enables the UART, RX, and TX. */ | void am_hal_uart_enable(uint32_t ui32Module) | /* Enable the UART, RX, and TX.
This function enables the UART, RX, and TX. */
void am_hal_uart_enable(uint32_t ui32Module) | {
AM_REGan_SET(UART, ui32Module, CR, (AM_REG_UART_CR_UARTEN_M |
AM_REG_UART_CR_RXE_M |
AM_REG_UART_CR_TXE_M) );
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @priv: private data of the video console @row: row @col: column */ | static void get_cursor_position(struct vidconsole_priv *priv, int *row, int *col) | /* @priv: private data of the video console @row: row @col: column */
static void get_cursor_position(struct vidconsole_priv *priv, int *row, int *col) | {
*row = priv->ycur / priv->y_charsize;
*col = VID_TO_PIXEL(priv->xcur_frac - priv->xstart_frac) /
priv->x_charsize;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The function returns 0 if the transfer has been successfully initiated. */ | int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb) | /* The function returns 0 if the transfer has been successfully initiated. */
int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb) | {
int r;
struct usb_device *udev = zd_usb_to_usbdev(usb);
struct urb *urb;
urb = alloc_tx_urb(usb);
if (!urb) {
r = -ENOMEM;
goto out;
}
usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
skb->data, skb->len, tx_urb_complete, skb);
r = usb_submit_urb(urb, GFP_ATOMIC);
if (r)
got... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base CSI peripheral base address. param fifo The FIFO to clear. */ | void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo) | /* param base CSI peripheral base address. param fifo The FIFO to clear. */
void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo) | {
uint32_t cr1;
uint32_t mask = 0U;
cr1 = base->CSICR1;
base->CSICR1 = (cr1 & ~CSI_CSICR1_FCC_MASK);
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_RxFifo))
{
mask |= CSI_CSICR1_CLR_RXFIFO_MASK;
}
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_StatFifo))
{
mask |= CS... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Initializes the CRYP Keys according to the specified parameters in the CRYP_KeyInitStruct. */ | void CRYP_KeyInit(CRYP_KeyInitTypeDef *CRYP_KeyInitStruct) | /* Initializes the CRYP Keys according to the specified parameters in the CRYP_KeyInitStruct. */
void CRYP_KeyInit(CRYP_KeyInitTypeDef *CRYP_KeyInitStruct) | {
CRYP->K0LR = CRYP_KeyInitStruct->CRYP_Key0Left;
CRYP->K0RR = CRYP_KeyInitStruct->CRYP_Key0Right;
CRYP->K1LR = CRYP_KeyInitStruct->CRYP_Key1Left;
CRYP->K1RR = CRYP_KeyInitStruct->CRYP_Key1Right;
CRYP->K2LR = CRYP_KeyInitStruct->CRYP_Key2Left;
CRYP->K2RR = CRYP_KeyInitStruct->CRYP_Key2Right;
CRYP->K3LR = ... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* We enforce only one user at a time here with the open/close. Also clear the previous interrupt data on an open, and clean up things on a close. */ | static int rtc_open(struct inode *inode, struct file *file) | /* We enforce only one user at a time here with the open/close. Also clear the previous interrupt data on an open, and clean up things on a close. */
static int rtc_open(struct inode *inode, struct file *file) | {
lock_kernel();
if(rtc_status) {
unlock_kernel();
return -EBUSY;
}
rtc_status = 1;
unlock_kernel();
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Called by rport to handle a remote device offline. */ | void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim) | /* Called by rport to handle a remote device offline. */
void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim) | {
itnim->stats.offlines++;
bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_OFFLINE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 8 bits to PPLC repetitive at the same address. */ | uint8_t pplc_if_write_rep(uint16_t us_addr, uint8_t uc_bytes_rep, uint8_t *ptr_buf, uint16_t us_len) | /* Write 8 bits to PPLC repetitive at the same address. */
uint8_t pplc_if_write_rep(uint16_t us_addr, uint8_t uc_bytes_rep, uint8_t *ptr_buf, uint16_t us_len) | {
return _pplc_cmd_op(PPLC_CMD_WRITE_REP, us_addr, us_len, ptr_buf,
uc_bytes_rep);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ | struct isl_vec* isl_pip_basic_set_sample(struct isl_basic_set *bset) | /* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
struct isl_vec* isl_pip_basic_set_sample(struct isl_basic_set *bset) | {
isl_basic_set_free(bset);
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base Pointer to the FLEXIO_SPI_Type structure. param baudRate_Bps Baud Rate needed in Hz. param srcClockHz SPI source clock frequency in Hz. */ | void FLEXIO_SPI_MasterSetBaudRate(FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz) | /* param base Pointer to the FLEXIO_SPI_Type structure. param baudRate_Bps Baud Rate needed in Hz. param srcClockHz SPI source clock frequency in Hz. */
void FLEXIO_SPI_MasterSetBaudRate(FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz) | {
uint16_t timerDiv = 0;
uint16_t timerCmp = 0;
FLEXIO_Type *flexioBase = base->flexioBase;
timerDiv = srcClockHz / baudRate_Bps;
timerDiv = timerDiv / 2 - 1U;
timerCmp = flexioBase->TIMCMP[base->timerIndex[0]];
timerCmp &= 0xFF00U;
timerCmp |= timerDiv;
flexioBase->TIMCMP[base->time... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns TRUE if 'headerline' contains the 'header' with given 'content'. Pass headers WITH the colon. */ | bool Curl_compareheader(const char *headerline, const char *header, const char *content) | /* Returns TRUE if 'headerline' contains the 'header' with given 'content'. Pass headers WITH the colon. */
bool Curl_compareheader(const char *headerline, const char *header, const char *content) | {
size_t hlen = strlen(header);
size_t clen;
size_t len;
const char *start;
const char *end;
if(!strncasecompare(headerline, header, hlen))
return FALSE;
start = &headerline[hlen];
while(*start && ISSPACE(*start))
start++;
end = strchr(start, '\r');
if(!end) {
end = strchr(start, '\n');
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Print all protocol names supported for a specific layer type. table_name contains the layer type name in which the search is performed. We send the output to the stream described by the handle output. */ | static void fprint_all_protocols_for_layer_types(FILE *output, gchar *table_name) | /* Print all protocol names supported for a specific layer type. table_name contains the layer type name in which the search is performed. We send the output to the stream described by the handle output. */
static void fprint_all_protocols_for_layer_types(FILE *output, gchar *table_name) | {
dissector_table_foreach_handle(table_name,
display_dissector_names,
(gpointer)output);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the number of pages in the entire device. */ | uint32_t nand_flash_model_get_device_size_in_pages(const struct nand_flash_model *model) | /* Returns the number of pages in the entire device. */
uint32_t nand_flash_model_get_device_size_in_pages(const struct nand_flash_model *model) | {
return (uint32_t) nand_flash_model_get_device_size_in_blocks(model) *
nand_flash_model_get_block_size_in_pages(model);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Hook functions that can get called by the kernel. The 'check' functionality is implemented within the tick hook. */ | void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) | /* Hook functions that can get called by the kernel. The 'check' functionality is implemented within the tick hook. */
void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) | {
( void ) pxTask;
( void ) pcTaskName;
for( ;; );
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Turns off the backlight.
Clears the respective GPIO and timer settings. */ | void halLcdShutDownBackLight(void) | /* Turns off the backlight.
Clears the respective GPIO and timer settings. */
void halLcdShutDownBackLight(void) | {
LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN;
LCD_BACKLT_OUT &= ~(LCD_BACKLIGHT_PIN);
LCD_BACKLT_SEL &= ~LCD_BACKLIGHT_PIN;
TA0CCTL3 = 0;
TA0CTL = 0;
backlight = 0;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Disable all endpoints (except control endpoint 0), aborting current transfers if necessary */ | static void UDP_DisableEndpoints(void) | /* Disable all endpoints (except control endpoint 0), aborting current transfers if necessary */
static void UDP_DisableEndpoints(void) | {
unsigned char bEndpoint;
for (bEndpoint = 1; bEndpoint < CHIP_USB_NUMENDPOINTS; bEndpoint++) {
UDP_EndOfTransfer(bEndpoint, USBD_STATUS_ABORTED);
endpoints[bEndpoint].state = UDP_ENDPOINT_DISABLED;
}
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* r e a d F r o m F i l e */ | returnValue qpOASES_readFromFileV(real_t *data, int n, const char *datafilename) | /* r e a d F r o m F i l e */
returnValue qpOASES_readFromFileV(real_t *data, int n, const char *datafilename) | {
return qpOASES_readFromFileM( data, n, 1, datafilename );
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* WARNING! Apply only if @dev is that of a wusbhc.usb_hcd.self->class_dev; otherwise, you loose. */ | static struct wusbhc* usbhc_dev_to_wusbhc(struct device *dev) | /* WARNING! Apply only if @dev is that of a wusbhc.usb_hcd.self->class_dev; otherwise, you loose. */
static struct wusbhc* usbhc_dev_to_wusbhc(struct device *dev) | {
struct usb_bus *usb_bus = dev_get_drvdata(dev);
struct usb_hcd *usb_hcd = bus_to_hcd(usb_bus);
return usb_hcd_to_wusbhc(usb_hcd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the number of memcg under hierarchy tree. Returns 1(self count) if no children. */ | static int mem_cgroup_count_children(struct mem_cgroup *mem) | /* This function returns the number of memcg under hierarchy tree. Returns 1(self count) if no children. */
static int mem_cgroup_count_children(struct mem_cgroup *mem) | {
int num = 0;
mem_cgroup_walk_tree(mem, &num, mem_cgroup_count_children_cb);
return num;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable an omap_hwomd @oh. Intended to be called by omap_device_enable(). Returns -EINVAL on error or passes along the return value from _enable(). */ | int omap_hwmod_enable(struct omap_hwmod *oh) | /* Enable an omap_hwomd @oh. Intended to be called by omap_device_enable(). Returns -EINVAL on error or passes along the return value from _enable(). */
int omap_hwmod_enable(struct omap_hwmod *oh) | {
int r;
if (!oh)
return -EINVAL;
mutex_lock(&omap_hwmod_mutex);
r = _enable(oh);
mutex_unlock(&omap_hwmod_mutex);
return r;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* early_platform_match @epdrv: early platform driver structure @id: id to match against */ | static __init struct platform_device* early_platform_match(struct early_platform_driver *epdrv, int id) | /* early_platform_match @epdrv: early platform driver structure @id: id to match against */
static __init struct platform_device* early_platform_match(struct early_platform_driver *epdrv, int id) | {
struct platform_device *pd;
list_for_each_entry(pd, &early_platform_device_list, dev.devres_head)
if (platform_match(&pd->dev, &epdrv->pdrv->driver))
if (pd->id == id)
return pd;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Remove a registered notification function from a particular keystroke. */ | EFI_STATUS EFIAPI USBKeyboardUnregisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle) | /* Remove a registered notification function from a particular keystroke. */
EFI_STATUS EFIAPI USBKeyboardUnregisterKeyNotify(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle) | {
USB_KB_DEV *UsbKeyboardDevice;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
if (NotificationHandle == NULL) {
return EFI_INVALID_PARAMETER;
}
UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS... | tianocore/edk2 | C++ | Other | 4,240 |
/* Handler to resume sending fcxp when space in available in cpe queue. */ | static void bfa_fcxp_qresume(void *cbarg) | /* Handler to resume sending fcxp when space in available in cpe queue. */
static void bfa_fcxp_qresume(void *cbarg) | {
struct bfa_fcxp_s *fcxp = cbarg;
struct bfa_s *bfa = fcxp->fcxp_mod->bfa;
struct bfi_fcxp_send_req_s *send_req;
fcxp->reqq_waiting = BFA_FALSE;
send_req = bfa_reqq_next(bfa, BFA_REQQ_FCXP);
bfa_fcxp_queue(fcxp, send_req);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: 0, Otherwise, VXGE_HW_ERR_WRONG_IRQ if the msix index is out of range status. See also: */ | void vxge_hw_vpath_msix_unmask(struct __vxge_hw_vpath_handle *vp, int msix_id) | /* Returns: 0, Otherwise, VXGE_HW_ERR_WRONG_IRQ if the msix index is out of range status. See also: */
void vxge_hw_vpath_msix_unmask(struct __vxge_hw_vpath_handle *vp, int msix_id) | {
struct __vxge_hw_device *hldev = vp->vpath->hldev;
__vxge_hw_pio_mem_write32_upper(
(u32)vxge_bVALn(vxge_mBIT(hldev->first_vp_id +
(msix_id/4)), 0, 32),
&hldev->common_reg->clear_msix_mask_vect[msix_id%4]);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Registers the event callback functions that should be called by the CAN module. */ | void CanRegisterEvents(tCanEvents const *events) | /* Registers the event callback functions that should be called by the CAN module. */
void CanRegisterEvents(tCanEvents const *events) | {
assert(canIfPtr != NULL);
if (canIfPtr != NULL)
{
canIfPtr->RegisterEvents(events);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Registers an interrupt handler for the uDMA controller. */ | void uDMAIntRegister(uint32_t ui32IntChannel, void(*pfnHandler)(void)) | /* Registers an interrupt handler for the uDMA controller. */
void uDMAIntRegister(uint32_t ui32IntChannel, void(*pfnHandler)(void)) | {
ASSERT(pfnHandler);
IntRegister(ui32IntChannel, pfnHandler);
IntEnable(ui32IntChannel);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears the IMU data ready flag. In case of ver 0.3.0 and older of the PIC firmware the interrupt register also needs to be cleared. */ | void IMU_clearDataReadyFlag(void) | /* Clears the IMU data ready flag. In case of ver 0.3.0 and older of the PIC firmware the interrupt register also needs to be cleared. */
void IMU_clearDataReadyFlag(void) | {
dataReady = false;
if( BOARD_picIsLegacyIntCtrl() ) {
BOARD_picWriteReg( BOARD_PIC_REG_INT_CLEAR, 0 );
}
return;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base WUU peripheral base address. param moduleIndex The selected internal module. See the Reference Manual for the details. param event Select interrupt or DMA/Trigger of the internal module as the wake up source. */ | void WUU_SetInternalWakeUpModulesConfig(WUU_Type *base, uint8_t moduleIndex, wuu_internal_wakeup_module_event_t event) | /* param base WUU peripheral base address. param moduleIndex The selected internal module. See the Reference Manual for the details. param event Select interrupt or DMA/Trigger of the internal module as the wake up source. */
void WUU_SetInternalWakeUpModulesConfig(WUU_Type *base, uint8_t moduleIndex, wuu_internal_wak... | {
switch (event)
{
case kWUU_InternalModuleInterrupt:
base->ME |= WUU_SET_BIT_FIELD_IN_REG(WUU_ME_REG_WUME_FIELD_MASK, moduleIndex);
break;
case kWUU_InternalModuleDMATrigger:
base->DE |= WUU_SET_BIT_FIELD_IN_REG(WUU_DE_REG_WUME_FIELD_MASK, moduleIndex);
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Tell if there is message waiting in receive FIFO. */ | bool fdcan_available_rx(uint32_t canport, uint8_t fifo) | /* Tell if there is message waiting in receive FIFO. */
bool fdcan_available_rx(uint32_t canport, uint8_t fifo) | {
unsigned pending_frames;
pending_frames = (FDCAN_RXFIS(canport, fifo) >> FDCAN_RXFIFO_FL_SHIFT)
& FDCAN_RXFIFO_FL_MASK;
return (pending_frames != 0);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Set the fields of structure stc_eth_pps_config_t to default values. */ | int32_t ETH_PPS_StructInit(stc_eth_pps_config_t *pstcPpsInit) | /* Set the fields of structure stc_eth_pps_config_t to default values. */
int32_t ETH_PPS_StructInit(stc_eth_pps_config_t *pstcPpsInit) | {
int32_t i32Ret = LL_OK;
if (NULL == pstcPpsInit) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
pstcPpsInit->u32TriggerFunc = ETH_PPS_TRIG_FUNC_INT_EVT;
pstcPpsInit->u32OutputMode = ETH_PPS_OUTPUT_MD_ONCE;
pstcPpsInit->u32OutputFreq = ETH_PPS_OUTPUT_ONE_PULSE;
pstcPpsInit... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USBH_USR_DeviceSpeedDetected Displays the message on LCD for device speed. */ | void USBH_USR_DeviceSpeedDetected(uint8_t DeviceSpeed) | /* USBH_USR_DeviceSpeedDetected Displays the message on LCD for device speed. */
void USBH_USR_DeviceSpeedDetected(uint8_t DeviceSpeed) | {
if ((DeviceSpeed != HPRT0_PRTSPD_FULL_SPEED)&&(DeviceSpeed != HPRT0_PRTSPD_LOW_SPEED))
{
Fail_Handler();
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function is meant to be called from the complete_type_info() function of a #GTypePlugin implementation, see the example for g_enum_complete_type_info() above. */ | void g_flags_complete_type_info(GType g_flags_type, GTypeInfo *info, const GFlagsValue *const_values) | /* This function is meant to be called from the complete_type_info() function of a #GTypePlugin implementation, see the example for g_enum_complete_type_info() above. */
void g_flags_complete_type_info(GType g_flags_type, GTypeInfo *info, const GFlagsValue *const_values) | {
g_return_if_fail (G_TYPE_IS_FLAGS (g_flags_type));
g_return_if_fail (info != NULL);
g_return_if_fail (const_values != NULL);
info->class_size = sizeof (GFlagsClass);
info->base_init = NULL;
info->base_finalize = NULL;
info->class_init = (GClassInitFunc) g_flags_class_init;
info->class_finalize = NULL;... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */ | BOOLEAN EFIAPI EcGroupGetCurve(IN CONST VOID *EcGroup, OUT VOID *BnPrime, OUT VOID *BnA, OUT VOID *BnB, IN VOID *BnCtx) | /* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
BOOLEAN EFIAPI EcGroupGetCurve(IN CONST VOID *E... | {
CALL_CRYPTO_SERVICE (EcGroupGetCurve, (EcGroup, BnPrime, BnA, BnB, BnCtx), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Release hardware semaphore used to access the PHY or NVM */ | static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) | /* Release hardware semaphore used to access the PHY or NVM */
static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) | {
u32 swsm;
swsm = er32(SWSM);
swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
ew32(SWSM, swsm);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base I2S base pointer. param handle pointer to handle structure. */ | void I2S_RxTransferAbort(I2S_Type *base, i2s_handle_t *handle) | /* param base I2S base pointer. param handle pointer to handle structure. */
void I2S_RxTransferAbort(I2S_Type *base, i2s_handle_t *handle) | {
assert(handle != NULL);
I2S_RxEnable(base, false);
handle->state = (uint32_t)kI2S_StateIdle;
(void)memset((void *)&handle->i2sQueue, 0, sizeof(i2s_transfer_t) * I2S_NUM_BUFFERS);
handle->queueDriver = 0U;
handle->queueUser = 0U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We implement the delay by converting the delay (the number of microseconds to wait) into a number of time base ticks; then we watch the time base until it has incremented by that amount. */ | void __udelay(unsigned long usec) | /* We implement the delay by converting the delay (the number of microseconds to wait) into a number of time base ticks; then we watch the time base until it has incremented by that amount. */
void __udelay(unsigned long usec) | {
ulong ticks = usec2ticks(usec);
wait_ticks(ticks);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Shutdown the TLS connection without releasing the resources, meaning a new connection can be started without calling TlsNew() and without setting certificates etc. */ | EFI_STATUS EFIAPI TlsShutdown(IN VOID *Tls) | /* Shutdown the TLS connection without releasing the resources, meaning a new connection can be started without calling TlsNew() and without setting certificates etc. */
EFI_STATUS EFIAPI TlsShutdown(IN VOID *Tls) | {
TLS_CONNECTION *TlsConn;
TlsConn = (TLS_CONNECTION *)Tls;
if ((TlsConn == NULL) || ((TlsConn->Ssl) == NULL)) {
return EFI_INVALID_PARAMETER;
}
SSL_set_quiet_shutdown (TlsConn->Ssl, 1);
SSL_shutdown (TlsConn->Ssl);
return SSL_clear (TlsConn->Ssl) == 1 ? EFI_SUCCESS : EFI_PROTOCOL_ERROR;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* IRQ Handler for the timer 0 of the MTU block. The irq is not shared as we are the only users of mtu0 by now. */ | static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id) | /* IRQ Handler for the timer 0 of the MTU block. The irq is not shared as we are the only users of mtu0 by now. */
static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id) | {
writel(1 << 0, mtu_base + MTU_ICR);
nmdk_count += nmdk_cycle;
nmdk_clkevt.event_handler(&nmdk_clkevt);
return IRQ_HANDLED;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The LED timer callback function. This does nothing but switch off the LED defined by the mainTIMER_CONTROLLED_LED constant. */ | static void vLEDTimerCallback(xTimerHandle xTimer) | /* The LED timer callback function. This does nothing but switch off the LED defined by the mainTIMER_CONTROLLED_LED constant. */
static void vLEDTimerCallback(xTimerHandle xTimer) | {
FM3_GPIO->PDOR1 |= mainTIMER_CONTROLLED_LED;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Emit a "load constant" instruction, using either 'OP_LOADK' (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' instruction with "extra argument". */ | int luaK_codek(FuncState *fs, int reg, int k) | /* Emit a "load constant" instruction, using either 'OP_LOADK' (if constant index 'k' fits in 18 bits) or an 'OP_LOADKX' instruction with "extra argument". */
int luaK_codek(FuncState *fs, int reg, int k) | {
int p = luaK_codeABx(fs, OP_LOADKX, reg, 0);
codeextraarg(fs, k);
return p;
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* hardware specific access to control-lines ctrl: NAND_CNE: bit 0 -> ! bit 0 & 4 NAND_CLE: bit 1 -> bit 1 NAND_ALE: bit 2 -> bit 2 */ | static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) | /* hardware specific access to control-lines ctrl: NAND_CNE: bit 0 -> ! bit 0 & 4 NAND_CLE: bit 1 -> bit 1 NAND_ALE: bit 2 -> bit 2 */
static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) | {
struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
struct nand_chip *chip = mtd->priv;
if (ctrl & NAND_CTRL_CHANGE) {
unsigned char bits = ctrl & 0x07;
bits |= (ctrl & 0x01) << 4;
bits ^= 0x11;
writeb((readb(sharpsl->io + FLASHCTL) & ~0x17) | bits, sharpsl->io + FLASHCTL);
}
if (cmd != NAND_CMD_NONE)
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets a data element from the SPI interface with block. This function gets received data from the interface of the specified SPI module with block. when the RX not empty flag is set, the data element can be transmitted, otherwise the data element will be blocked until can be transmitted. */ | void xSPIDataGet(unsigned long ulBase, unsigned long *pulData) | /* Gets a data element from the SPI interface with block. This function gets received data from the interface of the specified SPI module with block. when the RX not empty flag is set, the data element can be transmitted, otherwise the data element will be blocked until can be transmitted. */
void xSPIDataGet(unsigned... | {
xASSERT(ulBase == SPI0_BASE);
xASSERT(pulData != 0);
while(0 == (xHWREG(ulBase + S0SPSR) & S0SPSR_SPIF));
*pulData = xHWREG(ulBase + S0SPDR) & S0SPDR_DATA_M;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Wait until TFF is set in status register */ | static void smi_wait_xfer_finish(int timeout) | /* Wait until TFF is set in status register */
static void smi_wait_xfer_finish(int timeout) | {
while (timeout--) {
if (readl(&smicntl->smi_sr) & TFF)
break;
udelay(1000);
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* The function determines who owns the device by attempting to start a session with different credentials. If the SID PIN matches the MSID PIN, the no one owns the device. If the SID PIN matches the ourSidPin, then "Us" owns the device. Otherwise it is unknown. */ | OPAL_OWNER_SHIP EFIAPI OpalUtilDetermineOwnership(OPAL_SESSION *Session, UINT8 *Msid, UINT32 MsidLength) | /* The function determines who owns the device by attempting to start a session with different credentials. If the SID PIN matches the MSID PIN, the no one owns the device. If the SID PIN matches the ourSidPin, then "Us" owns the device. Otherwise it is unknown. */
OPAL_OWNER_SHIP EFIAPI OpalUtilDetermineOwnership(OPAL... | {
UINT8 MethodStatus;
TCG_RESULT Ret;
OPAL_OWNER_SHIP Owner;
if ((Session == NULL) || (Msid == NULL)) {
return OpalOwnershipUnknown;
}
Owner = OpalOwnershipUnknown;
Ret = OpalStartSession (
Session,
OPAL_UID_ADMIN_SP,
TRUE,
MsidLength,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* This routine releases @psb scsi buffer by adding it to tail of @phba lpfc_scsi_buf_list list. For SLI4 XRI's are tied to the scsi buffer and cannot be reused for at least RA_TOV amount of time if it was aborted. */ | static void lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | /* This routine releases @psb scsi buffer by adding it to tail of @phba lpfc_scsi_buf_list list. For SLI4 XRI's are tied to the scsi buffer and cannot be reused for at least RA_TOV amount of time if it was aborted. */
static void lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | {
unsigned long iflag = 0;
if (psb->status == IOSTAT_LOCAL_REJECT
&& psb->result == IOERR_ABORT_REQUESTED) {
spin_lock_irqsave(&phba->sli4_hba.abts_scsi_buf_list_lock,
iflag);
psb->pCmd = NULL;
list_add_tail(&psb->list,
&phba->sli4_hba.lpfc_abts_scsi_buf_list);
spin_unlock_irqrestore(&phba->sli4_hba... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return value: number of bytes printed to buffer */ | static ssize_t ipr_show_adapter_state(struct device *dev, struct device_attribute *attr, char *buf) | /* Return value: number of bytes printed to buffer */
static ssize_t ipr_show_adapter_state(struct device *dev, struct device_attribute *attr, char *buf) | {
struct Scsi_Host *shost = class_to_shost(dev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
unsigned long lock_flags = 0;
int len;
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
if (ioa_cfg->ioa_is_dead)
len = snprintf(buf, PAGE_SIZE, "offline\n");
else
len = snprintf(buf,... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Shift block pointers one index left/right inside a single btree block. */ | STATIC void xfs_btree_shift_ptrs(struct xfs_btree_cur *cur, union xfs_btree_ptr *ptr, int dir, int numptrs) | /* Shift block pointers one index left/right inside a single btree block. */
STATIC void xfs_btree_shift_ptrs(struct xfs_btree_cur *cur, union xfs_btree_ptr *ptr, int dir, int numptrs) | {
char *dst_ptr;
ASSERT(numptrs >= 0);
ASSERT(dir == 1 || dir == -1);
dst_ptr = (char *)ptr + (dir * xfs_btree_ptr_len(cur));
memmove(dst_ptr, ptr, numptrs * xfs_btree_ptr_len(cur));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get SWP Voltage Class @rmtoll OR CLASS LL_SWPMI_GetVoltageClass. */ | uint32_t LL_SWPMI_GetVoltageClass(SWPMI_TypeDef *SWPMIx) | /* Get SWP Voltage Class @rmtoll OR CLASS LL_SWPMI_GetVoltageClass. */
uint32_t LL_SWPMI_GetVoltageClass(SWPMI_TypeDef *SWPMIx) | {
return (uint32_t)(READ_BIT(SWPMIx->OR, SWPMI_OR_CLASS));
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Swap 16bit value - let compiler figure out the best way */ | static uint16_t swap16(uint16_t a) | /* Swap 16bit value - let compiler figure out the best way */
static uint16_t swap16(uint16_t a) | {
return ((a & 0x00ff) << 8) | ((a & 0xff00) >> 8);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Convert the mac address into a hexadecimal encoded ":" seperated string. */ | VOID WifiMgrMacAddrToStr(IN EFI_80211_MAC_ADDRESS *Mac, IN UINT32 StrSize, OUT CHAR16 *Str) | /* Convert the mac address into a hexadecimal encoded ":" seperated string. */
VOID WifiMgrMacAddrToStr(IN EFI_80211_MAC_ADDRESS *Mac, IN UINT32 StrSize, OUT CHAR16 *Str) | {
if ((Mac == NULL) || (Str == NULL)) {
return;
}
UnicodeSPrint (
Str,
StrSize,
L"%02X:%02X:%02X:%02X:%02X:%02X",
Mac->Addr[0],
Mac->Addr[1],
Mac->Addr[2],
Mac->Addr[3],
Mac->Addr[4],
Mac->Addr[5]
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Displays a maximum of 20 char on the LCD. */ | void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr) | /* Displays a maximum of 20 char on the LCD. */
void LCD_DisplayStringLine(uint8_t Line, uint8_t *ptr) | {
uint16_t refcolumn = LCD_PIXEL_WIDTH - 1;
while (*ptr != 0)
{
LCD_DisplayChar(Line, refcolumn, *ptr);
refcolumn -= LCD_Currentfonts->Width;
ptr++;
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.