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
|
|---|---|---|---|---|---|---|---|
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
|
void rt_hw_trap_udef(struct rt_hw_register *regs)
|
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_register *regs)
|
{
rt_hw_show_register(regs);
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->parent.name);
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
rt_hw_cpu_shutdown();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The higher a thread's priority, the bigger timeslices it gets during one round of execution. But even the lowest priority thread gets MIN_TIMESLICE worth of execution time. */
|
void spu_set_timeslice(struct spu_context *ctx)
|
/* The higher a thread's priority, the bigger timeslices it gets during one round of execution. But even the lowest priority thread gets MIN_TIMESLICE worth of execution time. */
void spu_set_timeslice(struct spu_context *ctx)
|
{
if (ctx->prio < NORMAL_PRIO)
ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE * 4, ctx->prio);
else
ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function is used to read the v2p mailbox without losing the read to clear status bits. */
|
static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
|
/* This function is used to read the v2p mailbox without losing the read to clear status bits. */
static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw)
|
{
u32 v2p_mailbox = er32(V2PMAILBOX(0));
v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox;
hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS;
return v2p_mailbox;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* deactive the 7816 device obey the 7816-3 timing */
|
void wm_sc_deactive(void)
|
/* deactive the 7816 device obey the 7816-3 timing */
void wm_sc_deactive(void)
|
{
wm_sc_rst_low();
wm_sc_io_clk_config(0);
wm_sc_clk_enable(0);
wm_sc_io_clk_config(1);
tls_gpio_write(sc_io.clk_pin_num, 0);
tls_gpio_write(sc_io.io_pin_num, 0);
wm_sc_poweroff();
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* reverse of qh_urb_transaction: free a list of TDs. used for cleanup after errors, before HC sees an URB's TDs. */
|
static void qtd_list_free(struct ehci_hcd *ehci, struct urb *urb, struct list_head *qtd_list)
|
/* reverse of qh_urb_transaction: free a list of TDs. used for cleanup after errors, before HC sees an URB's TDs. */
static void qtd_list_free(struct ehci_hcd *ehci, struct urb *urb, struct list_head *qtd_list)
|
{
struct list_head *entry, *temp;
list_for_each_safe (entry, temp, qtd_list) {
struct ehci_qtd *qtd;
qtd = list_entry (entry, struct ehci_qtd, qtd_list);
list_del (&qtd->qtd_list);
ehci_qtd_free (ehci, qtd);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Adds a new value to the wma_u16_t instances. */
|
void wma_u16_add(wma_u16_t *wma, uint16_t x)
|
/* Adds a new value to the wma_u16_t instances. */
void wma_u16_add(wma_u16_t *wma, uint16_t x)
|
{
uint16_t *pSource = wma->buffer + wma->k % wma->size;
*pSource = x;
wma->k++;
if (wma->k < wma->size)
return;
uint32_t total = 0;
uint16_t current_pos = wma->k % wma->size;
for (uint16_t i = 0; i < wma->size; i++)
{
total += wma->buffer[(i + current_pos) % wma->size] * wma->weight[i];
}
wma->avg = (uint16_t)(total / wma->sum_weight);
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Fills each USART_InitStruct member with its default value. */
|
void USART_StructInit(USART_InitType *USART_InitStruct)
|
/* Fills each USART_InitStruct member with its default value. */
void USART_StructInit(USART_InitType *USART_InitStruct)
|
{
USART_InitStruct->BaudRate = 9600;
USART_InitStruct->WordLength = USART_WL_8B;
USART_InitStruct->StopBits = USART_STPB_1;
USART_InitStruct->Parity = USART_PE_NO;
USART_InitStruct->Mode = USART_MODE_RX | USART_MODE_TX;
USART_InitStruct->HardwareFlowControl = USART_HFCTRL_NONE;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Manange the device ids to have an appropraite mapping between the kernel scsi addresses and megaraid scsi and logical drive addresses. We export scsi devices on their actual addresses, whereas the logical drives are exported on a virtual scsi channel. */
|
static void megaraid_mbox_setup_device_map(adapter_t *)
|
/* Manange the device ids to have an appropraite mapping between the kernel scsi addresses and megaraid scsi and logical drive addresses. We export scsi devices on their actual addresses, whereas the logical drives are exported on a virtual scsi channel. */
static void megaraid_mbox_setup_device_map(adapter_t *)
|
{
uint8_t c;
uint8_t t;
for (t = 0; t < LSI_MAX_LOGICAL_DRIVES_64LD; t++)
adapter->device_ids[adapter->max_channel][t] =
(t < adapter->init_id) ? t : t - 1;
adapter->device_ids[adapter->max_channel][adapter->init_id] = 0xFF;
for (c = 0; c < adapter->max_channel; c++)
for (t = 0; t < LSI_MAX_LOGICAL_DRIVES_64LD; t++)
adapter->device_ids[c][t] = (c << 8) | t;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable the PLL bypass and use the oscillator clock.
USERCC2 must have been set by a call to */
|
void rcc_pll_bypass_enable(void)
|
/* Enable the PLL bypass and use the oscillator clock.
USERCC2 must have been set by a call to */
void rcc_pll_bypass_enable(void)
|
{
SYSCTL_RCC2 |= SYSCTL_RCC2_BYPASS2;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Given a content type string that may contain optional parameters, return the parameter string, if any, otherwise return NULL. This also has the side effect of null terminating the content type part of the original string. */
|
static gchar* spdy_parse_content_type(gchar *content_type)
|
/* Given a content type string that may contain optional parameters, return the parameter string, if any, otherwise return NULL. This also has the side effect of null terminating the content type part of the original string. */
static gchar* spdy_parse_content_type(gchar *content_type)
|
{
*cp = g_ascii_tolower(*cp);
++cp;
}
if (*cp == '\0') {
cp = NULL;
}
if (cp != NULL) {
*cp++ = '\0';
while (*cp == ';' || g_ascii_isspace(*cp)) {
++cp;
}
if (*cp != '\0') {
return cp;
}
}
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enabling interrupts for the entire performance monitoring unit. Enables the interrupt bits in the pm_status register. */
|
void ps3_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask)
|
/* Enabling interrupts for the entire performance monitoring unit. Enables the interrupt bits in the pm_status register. */
void ps3_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask)
|
{
if (mask)
ps3_write_pm(cpu, pm_status, mask);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1)
After the master obtained control of the bus, and haven't release it, users can call xI2CMasterReadS2() to continue receive data from slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */
|
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned long ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
|
/* Read a data from a slave when the bus is idle, and waiting for all bus transmiton complete.(Read Step1)
After the master obtained control of the bus, and haven't release it, users can call xI2CMasterReadS2() to continue receive data from slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */
unsigned long I2CMasterReadS1(unsigned long ulBase, unsigned long ucSlaveAddr, unsigned char *pucData, xtBoolean bEndTransmition)
|
{
*pucData = I2CMasterReadRequestS1(ulBase, ucSlaveAddr, bEndTransmition);
return (0);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Draw a string in the currently set font. */
|
int stringRGBA(SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
/* Draw a string in the currently set font. */
int stringRGBA(SDL_Surface *dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
{
return (stringColor(dst, x, y, s, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* SYSCTRL GPIOB Bus Clock Enable and Reset Release. */
|
void LL_SYSCTRL_GPIOB_ClkEnRstRelease(void)
|
/* SYSCTRL GPIOB Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_GPIOB_ClkEnRstRelease(void)
|
{
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_GPIOBBusClk_En(SYSCTRL);
__LL_SYSCTRL_GPIOBSoftRst_Release(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base MU peripheral base address. param mask Bit mask of the interrupts to trigger. See _mu_interrupt_trigger. retval kStatus_Success Interrupts have been triggered successfully. retval kStatus_Fail Previous interrupts have not been accepted. */
|
status_t MU_TriggerInterrupts(MU_Type *base, uint32_t mask)
|
/* param base MU peripheral base address. param mask Bit mask of the interrupts to trigger. See _mu_interrupt_trigger. retval kStatus_Success Interrupts have been triggered successfully. retval kStatus_Fail Previous interrupts have not been accepted. */
status_t MU_TriggerInterrupts(MU_Type *base, uint32_t mask)
|
{
status_t status = kStatus_Success;
uint32_t reg = base->CR;
if (0U == (reg & mask))
{
reg = (reg & ~(MU_CR_GIRn_MASK | MU_CR_NMI_MASK)) | mask;
base->CR = reg;
status = kStatus_Success;
}
else
{
status = kStatus_Fail;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The "mon_id" argument specifies the non-private arguments of an NSMPROC_MON or NSMPROC_UNMON call. */
|
static int encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp)
|
/* The "mon_id" argument specifies the non-private arguments of an NSMPROC_MON or NSMPROC_UNMON call. */
static int encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp)
|
{
int status;
status = encode_mon_name(xdr, argp);
if (unlikely(status != 0))
return status;
return encode_my_id(xdr, argp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* HDMI phy registers read through internal I2C bus. */
|
static uint16_t hdmi_phy_i2c_read(uint8_t addr)
|
/* HDMI phy registers read through internal I2C bus. */
static uint16_t hdmi_phy_i2c_read(uint8_t addr)
|
{
uint16_t data;
uint8_t msb = 0, lsb = 0;
HW_HDMI_IH_I2CMPHY_STAT0.U = 0xFF;
HW_HDMI_PHY_I2CM_ADDRESS_ADDR.U = addr;
HW_HDMI_PHY_I2CM_OPERATION_ADDR.B.READ = 1;
hdmi_phy_wait_i2c_done(1000);
msb = HW_HDMI_PHY_I2CM_DATAI_1_ADDR.U;
lsb = HW_HDMI_PHY_I2CM_DATAI_0_ADDR.U;
data = (msb << 8) | lsb;
return data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base TDET peripheral base address param mask Bit mask for the lock bits to be cleared. Use tdet_register_t values to encode (OR'ed) which TDET Registers shall be locked. */
|
void TDET_LockRegisters(DIGTMP_Type *base, uint32_t mask)
|
/* param base TDET peripheral base address param mask Bit mask for the lock bits to be cleared. Use tdet_register_t values to encode (OR'ed) which TDET Registers shall be locked. */
void TDET_LockRegisters(DIGTMP_Type *base, uint32_t mask)
|
{
mask &= (uint32_t)kTDET_AllRegisters;
base->LR &= ~mask;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Writes a data in a specified RTC Backup data register. */
|
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
|
/* Writes a data in a specified RTC Backup data register. */
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
|
{
__IO uint32_t tmp = 0;
assert_param(IS_RTC_BKP(RTC_BKP_DR));
tmp = RTC_BASE + 0x50;
tmp += (RTC_BKP_DR * 4);
*(__IO uint32_t *)tmp = (uint32_t)Data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If the original value at <target> does not equal <oldValue>, then the target will not be updated and return 0. */
|
int rhino_atomic_cas(atomic_t *target, atomic_val_t old_value, atomic_val_t new_value)
|
/* If the original value at <target> does not equal <oldValue>, then the target will not be updated and return 0. */
int rhino_atomic_cas(atomic_t *target, atomic_val_t old_value, atomic_val_t new_value)
|
{
CPSR_ALLOC();
int ret = 0;
RHINO_CPU_INTRPT_DISABLE();
if (*target == old_value){
*target = new_value;
ret = 1;
}
RHINO_CPU_INTRPT_ENABLE();
return ret;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Function to enable the Accessory Mode on Android Devices. */
|
void uhi_aoa_mode_enable_step1(uhc_device_t *)
|
/* Function to enable the Accessory Mode on Android Devices. */
void uhi_aoa_mode_enable_step1(uhc_device_t *)
|
{
uhi_aoa_dev.dev = dev;
usb_setup_req_t req;
req.bmRequestType = USB_REQ_RECIP_DEVICE | USB_REQ_TYPE_VENDOR |
USB_REQ_DIR_IN;
req.bRequest = (uint8_t)USB_REQ_AOA_GET_PROTOCOL;
req.wValue = 0;
req.wIndex = 0;
req.wLength = 0x02;
uhd_setup_request(dev->address, &req, (uint8_t *)&uhi_aoa_protocol, 2,
NULL, uhi_aoa_mode_enable_step2);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Return: 0 if request was submitted successfully, -ve on error */
|
static int aux_request(struct udevice *dev, struct aux_transaction *request)
|
/* Return: 0 if request was submitted successfully, -ve on error */
static int aux_request(struct udevice *dev, struct aux_transaction *request)
|
{
u32 defer_count = 0;
u32 timeout_count = 0;
while ((defer_count < AUX_MAX_DEFER_COUNT) &&
(timeout_count < AUX_MAX_TIMEOUT_COUNT)) {
int status = aux_wait_ready(dev);
if (status) {
timeout_count++;
continue;
}
status = aux_request_send(dev, request);
if (status == -EAGAIN) {
defer_count++;
} else if (status == -ETIMEDOUT) {
timeout_count++;
} else {
return status;
}
udelay(100);
}
return -ETIMEDOUT;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Enable interrupt from SUTRO. (i.e. SUTRO can interrupt the HOST) Return: 1 if interrupt is originally enabled */
|
static int wl3501_unblock_interrupt(struct wl3501_card *this)
|
/* Enable interrupt from SUTRO. (i.e. SUTRO can interrupt the HOST) Return: 1 if interrupt is originally enabled */
static int wl3501_unblock_interrupt(struct wl3501_card *this)
|
{
u8 old = inb(this->base_addr + WL3501_NIC_GCR);
u8 new = (old & ~(WL3501_GCR_ECINT | WL3501_GCR_INT2EC)) |
WL3501_GCR_ENECINT;
wl3501_outb(new, this->base_addr + WL3501_NIC_GCR);
return old & WL3501_GCR_ENECINT;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Separate initcall needed for semaphore initialization since crw_handle_channel_report might be called before crw_machine_check_init. */
|
static int __init crw_init_semaphore(void)
|
/* Separate initcall needed for semaphore initialization since crw_handle_channel_report might be called before crw_machine_check_init. */
static int __init crw_init_semaphore(void)
|
{
init_MUTEX_LOCKED(&crw_semaphore);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Find a field with a specific usage within a report */
|
static struct hid_field* pidff_find_special_field(struct hid_report *report, int usage, int enforce_min)
|
/* Find a field with a specific usage within a report */
static struct hid_field* pidff_find_special_field(struct hid_report *report, int usage, int enforce_min)
|
{
int i;
for (i = 0; i < report->maxfield; i++) {
if (report->field[i]->logical == (HID_UP_PID | usage) &&
report->field[i]->report_count > 0) {
if (!enforce_min ||
report->field[i]->logical_minimum == 1)
return report->field[i];
else {
printk(KERN_ERR "hid-pidff: logical_minimum "
"is not 1 as it should be\n");
return NULL;
}
}
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns positive resulting integer in case of success and a negative error code in case of failure. */
|
static int __init bytes_str_to_int(const char *str)
|
/* This function returns positive resulting integer in case of success and a negative error code in case of failure. */
static int __init bytes_str_to_int(const char *str)
|
{
char *endp;
unsigned long result;
result = simple_strtoul(str, &endp, 0);
if (str == endp || result < 0) {
printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
str);
return -EINVAL;
}
switch (*endp) {
case 'G':
result *= 1024;
case 'M':
result *= 1024;
case 'K':
result *= 1024;
if (endp[1] == 'i' && endp[2] == 'B')
endp += 2;
case '\0':
break;
default:
printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
str);
return -EINVAL;
}
return result;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Registers user callback for given pin number.
Use this function to register a callback which shall be called upon interrupt generated from given pin number (port is irrelevant). Interrupt itself must be configured externally. Function overwrites previously registered callback. */
|
void GPIOINT_CallbackRegister(uint8_t pin, GPIOINT_IrqCallbackPtr_t callbackPtr)
|
/* Registers user callback for given pin number.
Use this function to register a callback which shall be called upon interrupt generated from given pin number (port is irrelevant). Interrupt itself must be configured externally. Function overwrites previously registered callback. */
void GPIOINT_CallbackRegister(uint8_t pin, GPIOINT_IrqCallbackPtr_t callbackPtr)
|
{
CORE_ATOMIC_SECTION(
gpioCallbacks[pin] = callbackPtr;
)
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Could get this from ring bps, but only after starting the ring which is a bit late for it to be useful */
|
int size_from_scanmode(int numVals, int timestamp)
|
/* Could get this from ring bps, but only after starting the ring which is a bit late for it to be useful */
int size_from_scanmode(int numVals, int timestamp)
|
{
if (numVals && timestamp)
return 16;
else if (timestamp)
return 8;
else
return numVals*2;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Generate a new private address.
This function is used by the application to generate a new private address in order to use as the local device private address in an advertising process, a scanning process or a connection process */
|
ADI_BLER_RESULT adi_radio_GenerateAndSetRandomAddr(const ADI_BLE_RANDOM_ADDR_TYPE eAddrType)
|
/* Generate a new private address.
This function is used by the application to generate a new private address in order to use as the local device private address in an advertising process, a scanning process or a connection process */
ADI_BLER_RESULT adi_radio_GenerateAndSetRandomAddr(const ADI_BLE_RANDOM_ADDR_TYPE eAddrType)
|
{
ADI_BLER_RESULT bleResult = ADI_BLER_SUCCESS;
ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_SET_RANDOM_ADDRESS);
ADI_BLE_RADIO_CMD_START(CMD_BLESMP_SET_RANDOM_ADDRESS);
memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], &eAddrType, 1u);
bleResult = bler_process_cmd(CMD_BLESMP_SET_RANDOM_ADDRESS, 1u, NULL, 0u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_EVENT_COMPLETE,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If the return value is less than NumberOfBytes, then the rest operation failed. If NumberOfBytes is zero, then return 0. */
|
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
|
/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If the return value is less than NumberOfBytes, then the rest operation failed. If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
|
{
UINTN Index;
Index = 0;
while ((Index < NumberOfBytes) && SerialPortPoll ()) {
Buffer[Index++] = (UINT8)mLastGetChar;
mLastGetChar = -1;
}
return Index;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* \method irq_no() Return the irq_no number that the pin is mapped to. */
|
STATIC mp_obj_t extint_obj_irq_no(mp_obj_t self_in)
|
/* \method irq_no() Return the irq_no number that the pin is mapped to. */
STATIC mp_obj_t extint_obj_irq_no(mp_obj_t self_in)
|
{
return MP_OBJ_NEW_SMALL_INT(self->irq_no);
} else {
return mp_const_none;
}
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* If the message is NULL, pretend it didn't happen. */
|
static int wimax_gnl_re_state_change_send(struct wimax_dev *wimax_dev, struct sk_buff *report_skb, void *header)
|
/* If the message is NULL, pretend it didn't happen. */
static int wimax_gnl_re_state_change_send(struct wimax_dev *wimax_dev, struct sk_buff *report_skb, void *header)
|
{
int result = 0;
struct device *dev = wimax_dev_to_dev(wimax_dev);
d_fnstart(3, dev, "(wimax_dev %p report_skb %p)\n",
wimax_dev, report_skb);
if (report_skb == NULL) {
result = -ENOMEM;
goto out;
}
genlmsg_end(report_skb, header);
genlmsg_multicast(report_skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
out:
d_fnend(3, dev, "(wimax_dev %p report_skb %p) = %d\n",
wimax_dev, report_skb, result);
return result;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This API used to get the functional state in the register 0x4C bit 1 and 2. */
|
BMM050_RETURN_FUNCTION_TYPE bmm050_get_functional_state(u8 *v_functional_state_u8)
|
/* This API used to get the functional state in the register 0x4C bit 1 and 2. */
BMM050_RETURN_FUNCTION_TYPE bmm050_get_functional_state(u8 *v_functional_state_u8)
|
{
BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR;
u8 v_data_u8 = BMM050_INIT_VALUE;
if (p_bmm050 == BMM050_NULL)
{
return E_BMM050_NULL_PTR;
}
else
{
com_rslt = p_bmm050->BMM050_BUS_READ_FUNC(
p_bmm050->dev_addr,
BMM050_CONTROL_OPERATION_MODE__REG,
&v_data_u8, BMM050_GEN_READ_WRITE_DATA_LENGTH);
*v_functional_state_u8 = BMM050_GET_BITSLICE(
v_data_u8, BMM050_CONTROL_OPERATION_MODE);
}
return com_rslt;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Wait for normal group conversion to be completed. */
|
ald_status_t ald_adc_normal_poll_for_conversion(ald_adc_handle_t *hperh, uint32_t timeout)
|
/* Wait for normal group conversion to be completed. */
ald_status_t ald_adc_normal_poll_for_conversion(ald_adc_handle_t *hperh, uint32_t timeout)
|
{
uint32_t _tick;
assert_param(IS_ADC_TYPE(hperh->perh));
_tick = ald_get_tick();
while (!(READ_BIT(hperh->perh->STAT, ADC_STAT_NCHE_MSK))) {
if (timeout != ALD_MAX_DELAY ) {
if ((timeout == 0) || ((ald_get_tick() - _tick) > timeout)) {
hperh->state = ALD_ADC_STATE_TIMEOUT;
return ALD_TIMEOUT;
}
}
}
WRITE_REG(hperh->perh->CLR, ALD_ADC_FLAG_NCHS | ALD_ADC_FLAG_NCH);
return ALD_OK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: */
|
static void kf_bfly2(kiss_fft_cpx *Fout, const size_t fstride, const kiss_fft_cfg st, int m)
|
/* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: */
static void kf_bfly2(kiss_fft_cpx *Fout, const size_t fstride, const kiss_fft_cfg st, int m)
|
{
kiss_fft_cpx * Fout2;
kiss_fft_cpx * tw1 = st->twiddles;
kiss_fft_cpx t;
Fout2 = Fout + m;
do{
C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2);
C_MUL (t, *Fout2 , *tw1);
tw1 += fstride;
C_SUB( *Fout2 , *Fout , t );
C_ADDTO( *Fout , t );
++Fout2;
++Fout;
}while (--m);
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* If watchdogs are enabled, the panic handler runs the risk of getting aborted pre-emptively because an overzealous watchdog decides to reset it. On the other hand, if we disable all watchdogs, we run the risk of somehow halting in the panic handler and not resetting. That is why this routine kills all watchdogs except the timer group 0 watchdog, and it reconfigures that to reset the chip after one second. */
|
static void reconfigureAllWdts()
|
/* If watchdogs are enabled, the panic handler runs the risk of getting aborted pre-emptively because an overzealous watchdog decides to reset it. On the other hand, if we disable all watchdogs, we run the risk of somehow halting in the panic handler and not resetting. That is why this routine kills all watchdogs except the timer group 0 watchdog, and it reconfigures that to reset the chip after one second. */
static void reconfigureAllWdts()
|
{
TIMERG0.wdt_wprotect = TIMG_WDT_WKEY_VALUE;
TIMERG0.wdt_feed = 1;
TIMERG0.wdt_config0.sys_reset_length = 7;
TIMERG0.wdt_config0.cpu_reset_length = 7;
TIMERG0.wdt_config0.stg0 = TIMG_WDT_STG_SEL_RESET_SYSTEM;
TIMERG0.wdt_config1.clk_prescale = 80 * 500;
TIMERG0.wdt_config2 = 2000;
TIMERG0.wdt_config0.en = 1;
TIMERG0.wdt_wprotect = 0;
TIMERG1.wdt_wprotect = TIMG_WDT_WKEY_VALUE;
TIMERG1.wdt_config0.en = 0;
TIMERG1.wdt_wprotect = 0;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* This function handles DMA2 Stream 6 interrupt request. */
|
void DMA2_Stream6_IRQHandler(void)
|
/* This function handles DMA2 Stream 6 interrupt request. */
void DMA2_Stream6_IRQHandler(void)
|
{
BSP_SD_DMA_Tx_IRQHandler();
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Trim down the number of pages in the quicklist */
|
void quicklist_trim(int nr, void(*dtor)(void *), unsigned long min_pages, unsigned long max_free)
|
/* Trim down the number of pages in the quicklist */
void quicklist_trim(int nr, void(*dtor)(void *), unsigned long min_pages, unsigned long max_free)
|
{
long pages_to_free;
struct quicklist *q;
q = &get_cpu_var(quicklist)[nr];
if (q->nr_pages > min_pages) {
pages_to_free = min_pages_to_free(q, min_pages, max_free);
while (pages_to_free > 0) {
void *p = quicklist_alloc(nr, 0, NULL);
if (dtor)
dtor(p);
free_page((unsigned long)p);
pages_to_free--;
}
}
put_cpu_var(quicklist);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Optimize the current operator based on opacity of source or destination The output operator should be mathematically equivalent to the source. */
|
static pixman_op_t optimize_operator(pixman_op_t op, uint32_t src_flags, uint32_t mask_flags, uint32_t dst_flags)
|
/* Optimize the current operator based on opacity of source or destination The output operator should be mathematically equivalent to the source. */
static pixman_op_t optimize_operator(pixman_op_t op, uint32_t src_flags, uint32_t mask_flags, uint32_t dst_flags)
|
{
pixman_bool_t is_source_opaque, is_dest_opaque;
#define OPAQUE_SHIFT 13
COMPILE_TIME_ASSERT (FAST_PATH_IS_OPAQUE == (1 << OPAQUE_SHIFT));
is_dest_opaque = (dst_flags & FAST_PATH_IS_OPAQUE);
is_source_opaque = ((src_flags & mask_flags) & FAST_PATH_IS_OPAQUE);
is_dest_opaque >>= OPAQUE_SHIFT - 1;
is_source_opaque >>= OPAQUE_SHIFT;
return operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Returns: TRUE if the #GHook was found in the #GHookList and destroyed */
|
gboolean g_hook_destroy(GHookList *hook_list, gulong hook_id)
|
/* Returns: TRUE if the #GHook was found in the #GHookList and destroyed */
gboolean g_hook_destroy(GHookList *hook_list, gulong hook_id)
|
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, FALSE);
g_return_val_if_fail (hook_id > 0, FALSE);
hook = g_hook_get (hook_list, hook_id);
if (hook)
{
g_hook_destroy_link (hook_list, hook);
return TRUE;
}
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Selects the trigger for the internal counter of batching events between XL and gyro.. */
|
int32_t lsm6dso_fifo_cnt_event_batch_set(stmdev_ctx_t *ctx, lsm6dso_trig_counter_bdr_t val)
|
/* Selects the trigger for the internal counter of batching events between XL and gyro.. */
int32_t lsm6dso_fifo_cnt_event_batch_set(stmdev_ctx_t *ctx, lsm6dso_trig_counter_bdr_t val)
|
{
lsm6dso_counter_bdr_reg1_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_COUNTER_BDR_REG1, (uint8_t *)®,
1);
if (ret == 0) {
reg.trig_counter_bdr = (uint8_t)val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_COUNTER_BDR_REG1,
(uint8_t *)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Checks whether the specified DMAy Channelx interrupt has occurred or not. */
|
ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
|
/* Checks whether the specified DMAy Channelx interrupt has occurred or not. */
ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
|
{
ITStatus bitstatus = RESET;
uint32_t tmpreg = 0;
assert_param(IS_DMA_GET_IT(DMAy_IT));
if ((DMAy_IT & FLAG_Mask) == (uint32_t)RESET)
{
tmpreg = DMA1->ISR;
}
if ((tmpreg & DMAy_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read the next element as binary data. 0 is success, < 0 is failure. */
|
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
|
/* Read the next element as binary data. 0 is success, < 0 is failure. */
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
|
{
av_free(bin->data);
if (!(bin->data = av_malloc(length)))
return AVERROR(ENOMEM);
bin->size = length;
bin->pos = url_ftell(pb);
if (get_buffer(pb, bin->data, length) != length)
return AVERROR(EIO);
return 0;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Get the value string by the key name from the key-value list. If found, the key-value entry will be removed from the list. */
|
CHAR8* IScsiGetValueByKeyFromList(IN OUT LIST_ENTRY *KeyValueList, IN CHAR8 *Key)
|
/* Get the value string by the key name from the key-value list. If found, the key-value entry will be removed from the list. */
CHAR8* IScsiGetValueByKeyFromList(IN OUT LIST_ENTRY *KeyValueList, IN CHAR8 *Key)
|
{
LIST_ENTRY *Entry;
ISCSI_KEY_VALUE_PAIR *KeyValuePair;
CHAR8 *Value;
Value = NULL;
NET_LIST_FOR_EACH (Entry, KeyValueList) {
KeyValuePair = NET_LIST_USER_STRUCT (Entry, ISCSI_KEY_VALUE_PAIR, List);
if (AsciiStrCmp (KeyValuePair->Key, Key) == 0) {
Value = KeyValuePair->Value;
RemoveEntryList (&KeyValuePair->List);
FreePool (KeyValuePair);
break;
}
}
return Value;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Detemines whether USI-SPI transmit FIFO is full or not. */
|
u32 USI_SSI_Writeable(USI_TypeDef *usi_dev)
|
/* Detemines whether USI-SPI transmit FIFO is full or not. */
u32 USI_SSI_Writeable(USI_TypeDef *usi_dev)
|
{
u32 Status = USI_SSI_GetTxFIFOStatus(usi_dev);
u32 Writeable = (((Status & USI_TXFIFO_FULL) == 0) ? 1 : 0);
return Writeable;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Construct a dummy mapping that only returns zeros */
|
static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
/* Construct a dummy mapping that only returns zeros */
static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
{
if (argc != 0) {
ti->error = "No arguments required";
return -EINVAL;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_UID, One) */
|
EFI_STATUS EFIAPI AmlCodeGenNameInteger(IN CONST CHAR8 *NameString, IN UINT64 Integer, IN AML_NODE_HEADER *ParentNode OPTIONAL, OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL)
|
/* AmlCodeGenNameInteger ("_UID", 1, ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_UID, One) */
EFI_STATUS EFIAPI AmlCodeGenNameInteger(IN CONST CHAR8 *NameString, IN UINT64 Integer, IN AML_NODE_HEADER *ParentNode OPTIONAL, OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL)
|
{
EFI_STATUS Status;
AML_OBJECT_NODE *ObjectNode;
if ((NameString == NULL) ||
((ParentNode == NULL) && (NewObjectNode == NULL)))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlCodeGenInteger (Integer, &ObjectNode);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
Status = AmlCodeGenName (
NameString,
ObjectNode,
ParentNode,
NewObjectNode
);
if (EFI_ERROR (Status)) {
ASSERT (0);
AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* 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(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* setup rate table in uCode return rate_n_flags as used in the table */
|
static u32 rs_update_rate_tbl(struct iwl_priv *priv, struct iwl_lq_sta *lq_sta, struct iwl_scale_tbl_info *tbl, int index, u8 is_green)
|
/* setup rate table in uCode return rate_n_flags as used in the table */
static u32 rs_update_rate_tbl(struct iwl_priv *priv, struct iwl_lq_sta *lq_sta, struct iwl_scale_tbl_info *tbl, int index, u8 is_green)
|
{
u32 rate;
rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
rs_fill_link_cmd(priv, lq_sta, rate);
iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
return rate;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI PciExpressBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI PciExpressBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
|
{
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT32)-1;
}
return MmioBitFieldOr32 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
OrData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */
|
int kfifo_to_user(struct kfifo *fifo, void __user *to, unsigned int len, unsigned *lenout)
|
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */
int kfifo_to_user(struct kfifo *fifo, void __user *to, unsigned int len, unsigned *lenout)
|
{
int ret;
len = min(kfifo_len(fifo), len);
ret = __kfifo_to_user_data(fifo, to, len, 0, lenout);
__kfifo_add_out(fifo, *lenout);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base SRC peripheral base address. param sliceName The selected reset slice. See src_reset_slice_name_t for more details. */
|
void SRC_LockSliceMode(SRC_Type *base, src_reset_slice_name_t sliceName)
|
/* param base SRC peripheral base address. param sliceName The selected reset slice. See src_reset_slice_name_t for more details. */
void SRC_LockSliceMode(SRC_Type *base, src_reset_slice_name_t sliceName)
|
{
uint32_t authenticationRegAddress;
authenticationRegAddress =
SRC_GET_SLICE_REGISTER_ADDRESS(base, sliceName, SRC_SLICE_AUTHENTICATION_REGISTER_OFFSET);
*(volatile uint32_t *)authenticationRegAddress |= SRC_SLICE_AUTHEN_LOCK_MODE_MASK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ps2_is_keyboard_id() checks received ID byte against the list of known keyboard IDs. */
|
int ps2_is_keyboard_id(char id_byte)
|
/* ps2_is_keyboard_id() checks received ID byte against the list of known keyboard IDs. */
int ps2_is_keyboard_id(char id_byte)
|
{
static const char keyboard_ids[] = {
0xab,
0xac,
0x2b,
0x5d,
0x60,
0x47,
};
return memchr(keyboard_ids, id_byte, sizeof(keyboard_ids)) != NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Increment the pin count of the given dquot. */
|
STATIC void xfs_qm_dquot_logitem_pin(xfs_dq_logitem_t *logitem)
|
/* Increment the pin count of the given dquot. */
STATIC void xfs_qm_dquot_logitem_pin(xfs_dq_logitem_t *logitem)
|
{
xfs_dquot_t *dqp = logitem->qli_dquot;
ASSERT(XFS_DQ_IS_LOCKED(dqp));
atomic_inc(&dqp->q_pincount);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return 0 if the CPU is sleeping (or terminated) and !=0 if the CPU is running */
|
int nce_is_cpu_running(void *this_arg)
|
/* Return 0 if the CPU is sleeping (or terminated) and !=0 if the CPU is running */
int nce_is_cpu_running(void *this_arg)
|
{
struct nce_status_t *this = (struct nce_status_t *)this_arg;
if (this != NULL) {
return !this->cpu_halted;
} else {
return false;
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function is used by rt_kprintf to display a string on console. */
|
void rt_hw_console_output(const char *str)
|
/* This function is used by rt_kprintf to display a string on console. */
void rt_hw_console_output(const char *str)
|
{
while (*str)
{
rt_hw_serial_putc(*str++);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Return true if the buffer is up-to-date and false, with the buffer locked, if not. */
|
int bh_uptodate_or_lock(struct buffer_head *bh)
|
/* Return true if the buffer is up-to-date and false, with the buffer locked, if not. */
int bh_uptodate_or_lock(struct buffer_head *bh)
|
{
if (!buffer_uptodate(bh)) {
lock_buffer(bh);
if (!buffer_uptodate(bh))
return 0;
unlock_buffer(bh);
}
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The cheapest way to do this is by looking for the memory-mapped flag. This is faster than sending a new-style 'hello' command and seeing whether the EC sets the EC_HOST_ARGS_FLAG_FROM_HOST flag in args when it responds. */
|
static int cros_ec_lpc_check_version(struct udevice *dev)
|
/* The cheapest way to do this is by looking for the memory-mapped flag. This is faster than sending a new-style 'hello' command and seeing whether the EC sets the EC_HOST_ARGS_FLAG_FROM_HOST flag in args when it responds. */
static int cros_ec_lpc_check_version(struct udevice *dev)
|
{
if (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID) == 'E' &&
inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID + 1)
== 'C' &&
(inb(EC_LPC_ADDR_MEMMAP +
EC_MEMMAP_HOST_CMD_FLAGS) &
EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED)) {
return 0;
}
printf("%s: ERROR: old EC interface not supported\n", __func__);
return -1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Clear TX fifo. Needed to avoid BABBLE errors. */
|
static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
|
/* Clear TX fifo. Needed to avoid BABBLE errors. */
static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
|
{
void __iomem *epio = ep->regs;
u16 csr;
u16 lastcsr = 0;
int retries = 1000;
csr = musb_readw(epio, MUSB_TXCSR);
while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
if (csr != lastcsr)
DBG(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
lastcsr = csr;
csr |= MUSB_TXCSR_FLUSHFIFO;
musb_writew(epio, MUSB_TXCSR, csr);
csr = musb_readw(epio, MUSB_TXCSR);
if (WARN(retries-- < 1,
"Could not flush host TX%d fifo: csr: %04x\n",
ep->epnum, csr))
return;
mdelay(1);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable Snapshot for Event messages. When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */
|
void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
|
/* Disable Snapshot for Event messages. When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The end result is supposed to be a fixed-point number with FRAC_BITS bits of a fractional part, so we keep everything in the numerator shifted by that much as we compute */
|
static int pcr_to_cbricg(const struct atm_qos *qos)
|
/* The end result is supposed to be a fixed-point number with FRAC_BITS bits of a fractional part, so we keep everything in the numerator shifted by that much as we compute */
static int pcr_to_cbricg(const struct atm_qos *qos)
|
{
int rounddown = 0;
int x, icg, pcr = atm_pcr_goal(&qos->txtp);
if (pcr == 0)
return 0;
if (pcr < 0) {
rounddown = 1;
pcr = -pcr;
}
x = pcr * 27;
icg = (3125 << (9 + CBRICG_FRAC_BITS)) - (x << CBRICG_FRAC_BITS);
if (rounddown)
icg += x - 1;
icg /= x;
if (icg > CBRICG_MAX)
icg = CBRICG_MAX;
DPRINTK("pcr_to_cbricg: pcr=%d rounddown=%c icg=%d\n",
pcr, rounddown ? 'Y' : 'N', icg);
return icg;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read the fixed header of a MQTT message from the server. */
|
static int read_fixed_header(struct mqtt_client_t *self_p, int *type_p, int *flags_p, size_t *size_p)
|
/* Read the fixed header of a MQTT message from the server. */
static int read_fixed_header(struct mqtt_client_t *self_p, int *type_p, int *flags_p, size_t *size_p)
|
{
uint8_t byte;
long multiplier;
if (chan_read(self_p->transport.in_p, &byte, 1) != 1) {
return (-EIO);
}
*type_p = ((byte >> 4) & 0xf);
*flags_p = (byte & 0xf);
multiplier = 1;
*size_p = 0;
do {
if (chan_read(self_p->transport.in_p, &byte, 1) != 1) {
return (-EIO);
}
*size_p += (byte & 0x7f) * multiplier;
multiplier *= 128;
if (multiplier > 128L * 128L * 128L) {
return (-1);
}
} while ((byte & 0x80) != 0);
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI S3PciSegmentBitFieldWrite8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
|
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3PciSegmentBitFieldWrite8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
|
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldWrite8 (Address, StartBit, EndBit, Value));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* finish_erasing - complete erase @tty: tty doing the erase */
|
static void finish_erasing(struct tty_struct *tty)
|
/* finish_erasing - complete erase @tty: tty doing the erase */
static void finish_erasing(struct tty_struct *tty)
|
{
if (tty->erasing) {
echo_char_raw('/', tty);
tty->erasing = 0;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function can be used to save the configuration of a region for later use with the */
|
void MPURegionGet(uint32_t ui32Region, uint32_t *pui32Addr, uint32_t *pui32Flags)
|
/* This function can be used to save the configuration of a region for later use with the */
void MPURegionGet(uint32_t ui32Region, uint32_t *pui32Addr, uint32_t *pui32Flags)
|
{
ASSERT(ui32Region < 8);
ASSERT(pui32Addr);
ASSERT(pui32Flags);
HWREG(NVIC_MPU_NUMBER) = ui32Region;
*pui32Addr = HWREG(NVIC_MPU_BASE) & NVIC_MPU_BASE_ADDR_M;
*pui32Flags = HWREG(NVIC_MPU_ATTR);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Turns on context switch tracing for a tracer. */
|
void tracing_start_sched_switch_record(void)
|
/* Turns on context switch tracing for a tracer. */
void tracing_start_sched_switch_record(void)
|
{
if (unlikely(!ctx_trace)) {
WARN_ON(1);
return;
}
tracing_start_sched_switch();
mutex_lock(&sched_register_mutex);
tracer_enabled++;
mutex_unlock(&sched_register_mutex);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function is needed especially for the cleanup situation after sending TPM_READY */
|
static int tpm_tis_i2c_write_long(struct udevice *dev, u8 addr, u8 *buffer, size_t len)
|
/* This function is needed especially for the cleanup situation after sending TPM_READY */
static int tpm_tis_i2c_write_long(struct udevice *dev, u8 addr, u8 *buffer, size_t len)
|
{
return tpm_tis_i2c_write_generic(dev, addr, buffer, len,
SLEEP_DURATION_LONG_US,
MAX_COUNT_LONG);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Enables or disables the USART's DMA interface when reception error occurs. */
|
void USART_DMAReceptionErrorConfig(USART_TypeDef *USARTx, uint32_t USART_DMAOnError)
|
/* Enables or disables the USART's DMA interface when reception error occurs. */
void USART_DMAReceptionErrorConfig(USART_TypeDef *USARTx, uint32_t USART_DMAOnError)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_DMAONERROR(USART_DMAOnError));
USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DDRE);
USARTx->CR3 |= USART_DMAOnError;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configures the specified ADC analog watchdog guarded single channel. */
|
void ADC_ConfigAnalogWatchdogSingleChannel(ADC_T *adc, uint8_t channel)
|
/* Configures the specified ADC analog watchdog guarded single channel. */
void ADC_ConfigAnalogWatchdogSingleChannel(ADC_T *adc, uint8_t channel)
|
{
adc->CTRL1_B.AWDCHSEL = channel;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Implementation of handler named in startup code.
Passes 0 to generic PWM IRQ handler. */
|
void PWMA_RELOAD0_IRQHandler(void)
|
/* Implementation of handler named in startup code.
Passes 0 to generic PWM IRQ handler. */
void PWMA_RELOAD0_IRQHandler(void)
|
{
PWM_Reload0();
PWM_HAL_ClearReloadFlag(g_pwmBase[0], 0U);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Callback function called when a command is received from the cloud. */
|
int Leds_Controll(const char *str)
|
/* Callback function called when a command is received from the cloud. */
int Leds_Controll(const char *str)
|
{
DBG("cmd: [%s]", str);
JsonNode *_main = json_decode(str);
JsonNode *red = json_find_member(_main, "red");
JsonNode *blue = json_find_member(_main, "blue");
JsonNode *green = json_find_member(_main, "green");
cn0410->Controll((float)red->number_, (float)blue->number_, (float)green->number_);
json_delete(_main);
return 0;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* We do not support this, because we assume that all clock rates are fixed. */
|
int clk_set_rate(struct clk *clk, unsigned long rate)
|
/* We do not support this, because we assume that all clock rates are fixed. */
int clk_set_rate(struct clk *clk, unsigned long rate)
|
{
int ret = -EINVAL;
if (clk->clk_set_rate)
ret = clk->clk_set_rate(clk, rate);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Callback for SDP disconnection.
Gets called when an SDP connection is terminated */
|
static void bt_sdp_disconnected(struct bt_l2cap_chan *chan)
|
/* Callback for SDP disconnection.
Gets called when an SDP connection is terminated */
static void bt_sdp_disconnected(struct bt_l2cap_chan *chan)
|
{
struct bt_l2cap_br_chan *ch = CONTAINER_OF(chan,
struct bt_l2cap_br_chan,
chan);
struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan);
LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid);
(void)memset(sdp, 0, sizeof(*sdp));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Read the SX8651 device ID, pre initialize I2C in case of need to be able to read the SX8651 device ID, and verify this is an SX8651. */
|
int32_t SX8651_ReadID(SX8651_Object_t *pObj, uint32_t *Id)
|
/* Read the SX8651 device ID, pre initialize I2C in case of need to be able to read the SX8651 device ID, and verify this is an SX8651. */
int32_t SX8651_ReadID(SX8651_Object_t *pObj, uint32_t *Id)
|
{
int32_t ret = SX8651_OK;
uint8_t data = 0;
if (sx8651_read_reg(&pObj->Ctx, SX8651_READ_ADDR | SX8651_REG_CHAN_MSK, &data, 1) != SX8651_OK)
{
ret = SX8651_ERROR;
}
*Id = (uint32_t)data;
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Call @cache_callback for each entry in the cache, in a non-specified order. */
|
void _cairo_cache_foreach(cairo_cache_t *cache, cairo_cache_callback_func_t cache_callback, void *closure)
|
/* Call @cache_callback for each entry in the cache, in a non-specified order. */
void _cairo_cache_foreach(cairo_cache_t *cache, cairo_cache_callback_func_t cache_callback, void *closure)
|
{
_cairo_hash_table_foreach (cache->hash_table,
cache_callback,
closure);
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Reset interrupt service routine. Configures the stack, initializes RAM and jumps to function main. */
|
void reset_handler(void)
|
/* Reset interrupt service routine. Configures the stack, initializes RAM and jumps to function main. */
void reset_handler(void)
|
{
blt_int32u *pSrc, *pDest;
__asm(" ldr r1, =_estack\n"
" mov sp, r1");
pSrc = &_etext;
for (pDest = &_data; pDest < &_edata;)
{
*pDest++ = *pSrc++;
}
__asm(" ldr r0, =_bss\n"
" ldr r1, =_ebss\n"
" mov r2, #0\n"
" .thumb_func\n"
"zero_loop:\n"
" cmp r0, r1\n"
" it lt\n"
" strlt r2, [r0], #4\n"
" blt zero_loop");
main();
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Select the RTC output source to output on the Tamper pin. */
|
void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource)
|
/* Select the RTC output source to output on the Tamper pin. */
void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource)
|
{
uint16_t tmpreg = 0;
assert_param(IS_BKP_RTC_OUTPUT_SOURCE(BKP_RTCOutputSource));
tmpreg = BKP->RTCCR;
tmpreg &= RTCCR_Mask;
tmpreg |= BKP_RTCOutputSource;
BKP->RTCCR = tmpreg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Helper function to both transmit a request packet and receive the reponse packet, if applicable (unicast). */
|
static uint8_t TbxMbClientTransceive(tTbxMbClientCtx *clientCtx, uint8_t isBroadcast)
|
/* Helper function to both transmit a request packet and receive the reponse packet, if applicable (unicast). */
static uint8_t TbxMbClientTransceive(tTbxMbClientCtx *clientCtx, uint8_t isBroadcast)
|
{
uint8_t result = TBX_ERROR;
uint16_t waitTimeout = clientCtx->responseTimeout;
if (isBroadcast == TBX_TRUE)
{
waitTimeout = clientCtx->turnaroundDelay;
}
result = clientCtx->tpCtx->transmitFcn(clientCtx->tpCtx);
if (result == TBX_OK)
{
if (TbxMbOsalSemTake(clientCtx->transceiveSem, clientCtx->responseTimeout)
== TBX_FALSE)
{
result = TBX_ERROR;
}
if (result == TBX_OK)
{
if (TbxMbOsalSemTake(clientCtx->transceiveSem, waitTimeout) == TBX_FALSE)
{
if (isBroadcast == TBX_FALSE)
{
result = TBX_ERROR;
}
}
}
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Erase the user flash.
Erases the entire 0.5k user flash area. Must be performed only when the system clock is 18Mhz. */
|
uint32_t flash_erase(void)
|
/* Erase the user flash.
Erases the entire 0.5k user flash area. Must be performed only when the system clock is 18Mhz. */
uint32_t flash_erase(void)
|
{
return iap_erase();
}
/**@}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Returns 0 on success or negative error code on failure. */
|
static int i2o_bus_scan(struct i2o_device *dev)
|
/* Returns 0 on success or negative error code on failure. */
static int i2o_bus_scan(struct i2o_device *dev)
|
{
struct i2o_message *msg;
msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
if (IS_ERR(msg))
return -ETIMEDOUT;
msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
msg->u.head[1] =
cpu_to_le32(I2O_CMD_BUS_SCAN << 24 | HOST_TID << 12 | dev->lct_data.
tid);
return i2o_msg_post_wait(dev->iop, msg, 60);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if CRC error in reception has been detected @rmtoll ISR RXBERF LL_SWPMI_IsActiveFlag_RXBER. */
|
uint32_t LL_SWPMI_IsActiveFlag_RXBER(SWPMI_TypeDef *SWPMIx)
|
/* Check if CRC error in reception has been detected @rmtoll ISR RXBERF LL_SWPMI_IsActiveFlag_RXBER. */
uint32_t LL_SWPMI_IsActiveFlag_RXBER(SWPMI_TypeDef *SWPMIx)
|
{
return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXBERF) == (SWPMI_ISR_RXBERF)) ? 1UL : 0UL);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Search a character in the given string. Returns a pointer to the character location. */
|
char* strchr(const char *pString, int character)
|
/* Search a character in the given string. Returns a pointer to the character location. */
char* strchr(const char *pString, int character)
|
{
char * p = (char *)pString;
char c = character & 0xFF;
while(*p != c) {
if (*p == 0) {
return 0;
}
p++;
}
return p;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* swsusp_swap_check - check if the resume device is a swap device and get its index (if so) */
|
static int swsusp_swap_check(void)
|
/* swsusp_swap_check - check if the resume device is a swap device and get its index (if so) */
static int swsusp_swap_check(void)
|
{
int res;
res = swap_type_of(swsusp_resume_device, swsusp_resume_block,
&resume_bdev);
if (res < 0)
return res;
root_swap = res;
res = blkdev_get(resume_bdev, FMODE_WRITE);
if (res)
return res;
res = set_blocksize(resume_bdev, PAGE_SIZE);
if (res < 0)
blkdev_put(resume_bdev, FMODE_WRITE);
return res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Checks whether the specified CRS flag is set or not. */
|
uint8_t CRS_ReadStatusFlag(CRS_FLAG_T flag)
|
/* Checks whether the specified CRS flag is set or not. */
uint8_t CRS_ReadStatusFlag(CRS_FLAG_T flag)
|
{
uint32_t status;
status = (uint32_t)(CRS->INTSTS & flag);
if (status == flag)
{
return SET;
}
return RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function close the previously opened IP protocol and destroy the IP child. */
|
EFI_STATUS IpIoCloseProtocolDestroyIpChild(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ChildHandle, IN UINT8 IpVersion)
|
/* This function close the previously opened IP protocol and destroy the IP child. */
EFI_STATUS IpIoCloseProtocolDestroyIpChild(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ChildHandle, IN UINT8 IpVersion)
|
{
EFI_STATUS Status;
EFI_GUID *ServiceBindingGuid;
EFI_GUID *IpProtocolGuid;
if (IpVersion == IP_VERSION_4) {
ServiceBindingGuid = &gEfiIp4ServiceBindingProtocolGuid;
IpProtocolGuid = &gEfiIp4ProtocolGuid;
} else if (IpVersion == IP_VERSION_6) {
ServiceBindingGuid = &gEfiIp6ServiceBindingProtocolGuid;
IpProtocolGuid = &gEfiIp6ProtocolGuid;
} else {
return EFI_UNSUPPORTED;
}
Status = gBS->CloseProtocol (
ChildHandle,
IpProtocolGuid,
ImageHandle,
ControllerHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
return NetLibDestroyServiceChild (
ControllerHandle,
ImageHandle,
ServiceBindingGuid,
ChildHandle
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* USART Set Word Length.
The word length is set to 8 or 9 bits. Note that the last bit will be a parity bit if parity is enabled, in which case the data length will be 7 or 8 bits respectively. */
|
void usart_set_databits(uint32_t usart, uint32_t bits)
|
/* USART Set Word Length.
The word length is set to 8 or 9 bits. Note that the last bit will be a parity bit if parity is enabled, in which case the data length will be 7 or 8 bits respectively. */
void usart_set_databits(uint32_t usart, uint32_t bits)
|
{
if (bits == 8) {
USART_CR1(usart) &= ~USART_CR1_M;
} else {
USART_CR1(usart) |= USART_CR1_M;
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Enables or disables I2C Idle Clock Timeout (Bus idle SCL and SDA high detection). */
|
void I2C_IdleClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
/* Enables or disables I2C Idle Clock Timeout (Bus idle SCL and SDA high detection). */
void I2C_IdleClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
{
assert_param(IS_I2C_1_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->TIMEOUTR |= I2C_TIMEOUTR_TIDLE;
}
else
{
I2Cx->TIMEOUTR &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TIDLE);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* 16-bit registers on the ADT7470 are low-byte first. The data sheet says that the low byte must be read before the high byte. */
|
static int adt7470_read_word_data(struct i2c_client *client, u8 reg)
|
/* 16-bit registers on the ADT7470 are low-byte first. The data sheet says that the low byte must be read before the high byte. */
static int adt7470_read_word_data(struct i2c_client *client, u8 reg)
|
{
u16 foo;
foo = i2c_smbus_read_byte_data(client, reg);
foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8);
return foo;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param selection The clock source to be output, please refer to clock_output2_selection_t. param divider The divider of the output clock signal, please refer to clock_output_divider_t. */
|
void CLOCK_SetClockOutput2(clock_output2_selection_t selection, clock_output_divider_t divider)
|
/* param selection The clock source to be output, please refer to clock_output2_selection_t. param divider The divider of the output clock signal, please refer to clock_output_divider_t. */
void CLOCK_SetClockOutput2(clock_output2_selection_t selection, clock_output_divider_t divider)
|
{
uint32_t tmp32;
tmp32 = CCM->CCOSR;
if (selection == kCLOCK_DisableClockOutput2)
{
tmp32 &= CCM_CCOSR_CLKO2_EN_MASK;
}
else
{
tmp32 |= CCM_CCOSR_CLKO2_EN_MASK;
tmp32 &= ~(CCM_CCOSR_CLKO2_SEL_MASK | CCM_CCOSR_CLKO2_DIV_MASK);
tmp32 |= CCM_CCOSR_CLKO2_SEL(selection) | CCM_CCOSR_CLKO2_DIV(divider);
}
CCM->CCOSR = tmp32;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Update the packets statusbar to the current values */
|
void profile_bar_update(void)
|
/* Update the packets statusbar to the current values */
void profile_bar_update(void)
|
{
if (profile_bar) {
if(profile_str) {
g_free(profile_str);
gtk_statusbar_pop(GTK_STATUSBAR(profile_bar), profile_ctx);
}
profile_str = g_strdup_printf (" Profile: %s", get_profile_name ());
gtk_statusbar_push(GTK_STATUSBAR(profile_bar), profile_ctx, profile_str);
set_menus_for_profiles(is_default_profile());
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get peak rate bucket size of TBF qdisc. */
|
int rtnl_qdisc_tbf_get_peakrate_bucket(struct rtnl_qdisc *qdisc)
|
/* Get peak rate bucket size of TBF qdisc. */
int rtnl_qdisc_tbf_get_peakrate_bucket(struct rtnl_qdisc *qdisc)
|
{
struct rtnl_tbf *tbf;
tbf = tbf_qdisc(qdisc);
if (tbf && (tbf->qt_mask & TBF_ATTR_PEAKRATE))
return tbf->qt_peakrate_bucket;
else
return -1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* DESCRIPTION: return SOC device index INPUT: None OUTPUT: None RETURN: return SOC device index */
|
u32 sys_env_id_index_get(u32 ctrl_model)
|
/* DESCRIPTION: return SOC device index INPUT: None OUTPUT: None RETURN: return SOC device index */
u32 sys_env_id_index_get(u32 ctrl_model)
|
{
switch (ctrl_model) {
case MV_6820_DEV_ID:
return MV_6820_INDEX;
case MV_6810_DEV_ID:
return MV_6810_INDEX;
case MV_6811_DEV_ID:
return MV_6811_INDEX;
case MV_6828_DEV_ID:
return MV_6828_INDEX;
case MV_6920_DEV_ID:
return MV_6920_INDEX;
case MV_6928_DEV_ID:
return MV_6928_INDEX;
default:
return MV_6820_INDEX;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* The clock_cpu_gettime() function shall return the current value of cpu time tick. */
|
uint64_t clock_cpu_gettime(void)
|
/* The clock_cpu_gettime() function shall return the current value of cpu time tick. */
uint64_t clock_cpu_gettime(void)
|
{
if (_cputime_ops)
return _cputime_ops->cputime_gettime();
rt_set_errno(ENOSYS);
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function handles External lines 9 to 5 interrupt request. */
|
void EXTI9_5_IRQHandler(void)
|
/* This function handles External lines 9 to 5 interrupt request. */
void EXTI9_5_IRQHandler(void)
|
{
if(EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET)
{
EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
STM_EVAL_LEDToggle(LED2);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* SM_NOTIFY: private callback from statd (not part of official NLM proto) */
|
static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, void *resp)
|
/* SM_NOTIFY: private callback from statd (not part of official NLM proto) */
static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, void *resp)
|
{
dprintk("lockd: SM_NOTIFY called\n");
if (!nlm_privileged_requester(rqstp)) {
char buf[RPC_MAX_ADDRBUFLEN];
printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
svc_print_addr(rqstp, buf, sizeof(buf)));
return rpc_system_err;
}
nlm_host_rebooted(argp);
return rpc_success;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified RNG interrupt has occurred or not. */
|
ITStatus RNG_GetITStatus(uint8_t RNG_IT)
|
/* Checks whether the specified RNG interrupt has occurred or not. */
ITStatus RNG_GetITStatus(uint8_t RNG_IT)
|
{
ITStatus bitstatus = RESET;
assert_param(IS_RNG_GET_IT(RNG_IT));
if ((RNG->SR & RNG_IT) != (uint8_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Initializes fields of a freshly allocated @wimax_dev instance. This function assumes that after allocation, the memory occupied by @wimax_dev was zeroed. */
|
void wimax_dev_init(struct wimax_dev *wimax_dev)
|
/* Initializes fields of a freshly allocated @wimax_dev instance. This function assumes that after allocation, the memory occupied by @wimax_dev was zeroed. */
void wimax_dev_init(struct wimax_dev *wimax_dev)
|
{
INIT_LIST_HEAD(&wimax_dev->id_table_node);
__wimax_state_set(wimax_dev, __WIMAX_ST_NULL);
mutex_init(&wimax_dev->mutex);
mutex_init(&wimax_dev->mutex_reset);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns the newly built instance of #CRDeclaration, or NULL in case of error. */
|
CRDeclaration* cr_declaration_new(CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
|
/* Returns the newly built instance of #CRDeclaration, or NULL in case of error. */
CRDeclaration* cr_declaration_new(CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
|
{
CRDeclaration *result = NULL;
g_return_val_if_fail (a_property, NULL);
if (a_statement)
g_return_val_if_fail (a_statement
&& ((a_statement->type == RULESET_STMT)
|| (a_statement->type
== AT_FONT_FACE_RULE_STMT)
|| (a_statement->type
== AT_PAGE_RULE_STMT)), NULL);
result = g_try_malloc (sizeof (CRDeclaration));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
}
memset (result, 0, sizeof (CRDeclaration));
result->property = a_property;
result->value = a_value;
if (a_value) {
cr_term_ref (a_value);
}
result->parent_statement = a_statement;
return result;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* STUSB1602 checks the VCONN power switch RVP Fault Transition (bit2 0x12 */
|
VCONN_SW_RVP_Fault_Trans_TypeDef STUSB1602_VCONN_SW_RVP_Fault_Trans_Get(uint8_t Addr)
|
/* STUSB1602 checks the VCONN power switch RVP Fault Transition (bit2 0x12 */
VCONN_SW_RVP_Fault_Trans_TypeDef STUSB1602_VCONN_SW_RVP_Fault_Trans_Get(uint8_t Addr)
|
{
STUSB1602_HW_FAULT_STATUS_TRANS_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_HW_FAULT_STATUS_TRANS_REG, 1);
return (VCONN_SW_RVP_Fault_Trans_TypeDef)(reg.b.VCONN_SW_RVP_FAULT_TRANS);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Block our completion routine from starting the next untagged transaction for this target or target lun. */
|
static void ahc_freeze_untagged_queues(struct ahc_softc *ahc)
|
/* Block our completion routine from starting the next untagged transaction for this target or target lun. */
static void ahc_freeze_untagged_queues(struct ahc_softc *ahc)
|
{
if ((ahc->flags & AHC_SCB_BTT) == 0)
ahc->untagged_queue_lock++;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.