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 |
|---|---|---|---|---|---|---|---|
/* Helper function to turn off all LEDs connected to the driver. */ | static int turn_off_all_leds(const struct device *dev) | /* Helper function to turn off all LEDs connected to the driver. */
static int turn_off_all_leds(const struct device *dev) | {
for (int i = 0; i < NUM_LEDS; i++) {
int ret = led_off(dev, i);
if (ret) {
return ret;
}
}
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Write a double word in data memory without erase. */ | __RAM_FUNC DATA_EEPROM_ProgramDoubleWord(uint32_t Address, uint64_t Data) | /* Write a double word in data memory without erase. */
__RAM_FUNC DATA_EEPROM_ProgramDoubleWord(uint32_t Address, uint64_t Data) | {
FLASH_Status status = FLASH_COMPLETE;
SCnSCB->ACTLR |= SCnSCB_ACTLR_DISMCYCINT_Msk;
status = WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
FLASH->PECR |= FLASH_PECR_FPRG;
FLASH->PECR |= FLASH_PECR_DATA;
*(__IO uint32_t *)Address = (uint32_t) Data;
Address += ... | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Returns the UART hardware flow control mode currently in use. */ | unsigned long UARTFlowControlGet(unsigned long ulBase) | /* Returns the UART hardware flow control mode currently in use. */
unsigned long UARTFlowControlGet(unsigned long ulBase) | {
xASSERT((ulBase == UART0_BASE));
return(xHWREG(ulBase + UART_IER) & (UART_FLOWCONTROL_TX |
UART_FLOWCONTROL_RX));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Adjust the speed of the clock source by a multiplicative factor */ | void native_rtc_adjust_clock(double clock_correction) | /* Adjust the speed of the clock source by a multiplicative factor */
void native_rtc_adjust_clock(double clock_correction) | {
hwtimer_adjust_rt_ratio(clock_correction);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* class 0 is constructed constructed == 2 for indefinite length constructed */ | void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, int xclass) | /* class 0 is constructed constructed == 2 for indefinite length constructed */
void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, int xclass) | {
unsigned char *p = *pp;
int i, ttag;
i = (constructed) ? V_ASN1_CONSTRUCTED : 0;
i |= (xclass & V_ASN1_PRIVATE);
if (tag < 31)
*(p++) = i | (tag & V_ASN1_PRIMITIVE_TAG);
else {
*(p++) = i | V_ASN1_PRIMITIVE_TAG;
for (i = 0, ttag = tag; ttag > 0; i++)
ttag >>... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param enableBypass Used to control whether to bypass the turn logic. */ | void CLOCK_OSC_BypassOscRc400MTuneLogic(bool enableBypass) | /* param enableBypass Used to control whether to bypass the turn logic. */
void CLOCK_OSC_BypassOscRc400MTuneLogic(bool enableBypass) | {
if (enableBypass)
{
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL2_SET, AI_RCOSC400M_CTRL2_TUNE_BYP_MASK);
}
else
{
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL2_CLR, AI_RCOSC400M_CTRL2_TUNE_BYP_MASK);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Shutdown everything and perform a clean system halt. */ | void kernel_halt(void) | /* Shutdown everything and perform a clean system halt. */
void kernel_halt(void) | {
kernel_shutdown_prepare(SYSTEM_HALT);
sysdev_shutdown();
printk(KERN_EMERG "System halted.\n");
machine_halt();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* VmbusCreateChildDevice - Creates the child device on the bus that represents the channel offer */ | struct hv_device* VmbusChildDeviceCreate(struct hv_guid *DeviceType, struct hv_guid *DeviceInstance, void *Context) | /* VmbusCreateChildDevice - Creates the child device on the bus that represents the channel offer */
struct hv_device* VmbusChildDeviceCreate(struct hv_guid *DeviceType, struct hv_guid *DeviceInstance, void *Context) | {
struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
Context);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the adc conversion through external trigger. */ | void ADC_ExternalTrigConvCmd(ADC_TypeDef *adc, FunctionalState state) | /* Enables or disables the adc conversion through external trigger. */
void ADC_ExternalTrigConvCmd(ADC_TypeDef *adc, FunctionalState state) | {
(state) ? (adc->ADCR |= ADC_CR_TRGEN) : (adc->ADCR &= ~ADC_CR_TRGEN);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified PWR flag is set or not. */ | FlagStatus PWR_GetFlagStatus(u32 flag) | /* Checks whether the specified PWR flag is set or not. */
FlagStatus PWR_GetFlagStatus(u32 flag) | {
return (FlagStatus)(PWR->CSR & flag);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets interrupt status for the specified GPIO port. */ | unsigned long GPIOPinIntStatus(unsigned long ulPort) | /* Gets interrupt status for the specified GPIO port. */
unsigned long GPIOPinIntStatus(unsigned long ulPort) | {
unsigned long ulPortBase;
xASSERT(GPIOBaseValid(ulPort));
ulPortBase = GPIOToPortGet(ulPort);
return(xHWREG(ulPortBase + PORT_ISFR));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns 0 for no error, otherwise a negative error code (in which case the enqueue() method must fail). If no error occurs but enqueue() fails anyway, it must call usb_hcd_unlink_urb_from_ep() before releasing the private spinlock and returning. */ | int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb) | /* Returns 0 for no error, otherwise a negative error code (in which case the enqueue() method must fail). If no error occurs but enqueue() fails anyway, it must call usb_hcd_unlink_urb_from_ep() before releasing the private spinlock and returning. */
int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb) | {
int rc = 0;
spin_lock(&hcd_urb_list_lock);
if (unlikely(atomic_read(&urb->reject))) {
rc = -EPERM;
goto done;
}
if (unlikely(!urb->ep->enabled)) {
rc = -ENOENT;
goto done;
}
if (unlikely(!urb->dev->can_submit)) {
rc = -EHOSTUNREACH;
goto done;
}
switch (hcd->state) {
case HC_STATE_RUNNING:
cas... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Receive a piece of data in non-blocking way. */ | static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | /* Receive a piece of data in non-blocking way. */
static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | {
uint32_t i = 0;
uint8_t j = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
data = base->RDR[channel];
for (j = 0; j < bytesPerWord; j++)
{
*buffer = (data >> (8U * j)) & 0xFF;
buffer++;
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes the current value of MM3. This function is only available on IA32 and x64. */ | VOID EFIAPI AsmWriteMm3(IN UINT64 Value) | /* Writes the current value of MM3. This function is only available on IA32 and x64. */
VOID EFIAPI AsmWriteMm3(IN UINT64 Value) | {
_asm {
movq mm3, qword ptr [Value]
emms
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the interrupt number for a given EPI base address. */ | static uint32_t _EPIIntNumberGet(uint32_t ui32Base) | /* Returns the interrupt number for a given EPI base address. */
static uint32_t _EPIIntNumberGet(uint32_t ui32Base) | {
uint32_t ui32Int;
ASSERT(ui32Base == EPI0_BASE);
ui32Int = INT_EPI0;
return (ui32Int);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Abort when the target/lun does not match or when our SCB is not busy. Used by untagged commands. */ | static int initio_msgout_abort_targ(struct initio_host *host) | /* Abort when the target/lun does not match or when our SCB is not busy. Used by untagged commands. */
static int initio_msgout_abort_targ(struct initio_host *host) | {
outb(((inb(host->addr + TUL_SSignal) & (TSC_SET_ACK | 7)) | TSC_SET_ATN), host->addr + TUL_SSignal);
if (initio_msgin_accept(host) == -1)
return -1;
if (host->phase != MSG_OUT)
return initio_bad_seq(host);
outb(MSG_ABORT, host->addr + TUL_SFifo);
outb(TSC_XF_FIFO_OUT, host->addr + TUL_SCmd);
return initio_w... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Wait for one or more Thread Flags of the current running thread to become signaled. */ | uint32_t osThreadFlagsWait(uint32_t flags, uint32_t options, uint32_t timeout) | /* Wait for one or more Thread Flags of the current running thread to become signaled. */
uint32_t osThreadFlagsWait(uint32_t flags, uint32_t options, uint32_t timeout) | {
EvrRtxThreadFlagsError(NULL, (int32_t)osErrorISR);
thread_flags = (uint32_t)osErrorISR;
} else {
thread_flags = __svcThreadFlagsWait(flags, options, timeout);
}
return thread_flags;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* kset_register - initialize and add a kset. @k: kset. */ | int kset_register(struct kset *k) | /* kset_register - initialize and add a kset. @k: kset. */
int kset_register(struct kset *k) | {
int err;
if (!k)
return -EINVAL;
kset_init(k);
err = kobject_add_internal(&k->kobj);
if (err)
return err;
kobject_uevent(&k->kobj, KOBJ_ADD);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function prepares for a drag operation. No drag is started yet, but the drag origin is stored. To start a drag operation, one would repeatedly check if the drag threshold is exceeded, then call the wtk_start_drag() function. */ | static void wtk_prepare_drag(struct win_point const *pos) | /* This function prepares for a drag operation. No drag is started yet, but the drag origin is stored. To start a drag operation, one would repeatedly check if the drag threshold is exceeded, then call the wtk_start_drag() function. */
static void wtk_prepare_drag(struct win_point const *pos) | {
wtk_drag_origin = *pos;
} | memfault/zero-to-main | C++ | null | 200 |
/* Get software reset status function Check status of SWR bit in DMA Controller Bus_Mode Register. */ | int eth_cyclonev_get_software_reset_status(uint32_t instance, struct eth_cyclonev_priv *p) | /* Get software reset status function Check status of SWR bit in DMA Controller Bus_Mode Register. */
int eth_cyclonev_get_software_reset_status(uint32_t instance, struct eth_cyclonev_priv *p) | {
if (instance > 1) {
return -1;
}
return EMAC_DMA_MODE_SWR_GET(sys_read32(EMAC_DMAGRP_BUS_MODE_ADDR(p->base_addr)));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Asynchronous endpoint 0 request (async version of usb_control_msg). The request will be queued up in a FIFO if the endpoint is busy. */ | static void usb_ctrl_msg(struct st5481_adapter *adapter, u8 request, u8 requesttype, u16 value, u16 index, ctrl_complete_t complete, void *context) | /* Asynchronous endpoint 0 request (async version of usb_control_msg). The request will be queued up in a FIFO if the endpoint is busy. */
static void usb_ctrl_msg(struct st5481_adapter *adapter, u8 request, u8 requesttype, u16 value, u16 index, ctrl_complete_t complete, void *context) | {
struct st5481_ctrl *ctrl = &adapter->ctrl;
int w_index;
struct ctrl_msg *ctrl_msg;
if ((w_index = fifo_add(&ctrl->msg_fifo.f)) < 0) {
WARNING("control msg FIFO full");
return;
}
ctrl_msg = &ctrl->msg_fifo.data[w_index];
ctrl_msg->dr.bRequestType = requesttype;
ctrl_msg->dr.bRequest = request;
ctrl_msg->... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The device must be stopped before setting the interframe gap. */ | XStatus XEmac_SetInterframeGap(XEmac *InstancePtr, u8 Part1, u8 Part2) | /* The device must be stopped before setting the interframe gap. */
XStatus XEmac_SetInterframeGap(XEmac *InstancePtr, u8 Part1, u8 Part2) | {
u32 Ifg;
XASSERT_NONVOID(InstancePtr != NULL);
XASSERT_NONVOID(Part1 < XEM_MAX_IFG);
XASSERT_NONVOID(Part2 < XEM_MAX_IFG);
XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
if (InstancePtr->IsStarted == XCOMPONENT_IS_STARTED) {
return XST_DEVICE_IS_STARTED;
}
Ifg = Part1 << XEM_IFGP_PART1_SHIFT;... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Returns: (element-type GUnixMountEntry) (transfer full): a #GList of the UNIX mounts. */ | GList* g_unix_mounts_get(guint64 *time_read) | /* Returns: (element-type GUnixMountEntry) (transfer full): a #GList of the UNIX mounts. */
GList* g_unix_mounts_get(guint64 *time_read) | {
if (time_read)
*time_read = get_mounts_timestamp ();
return _g_get_unix_mounts ();
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This routine writes the 3 pages allocated for Key store data, Used during manufacturing. Should write pages when 'customer factory page' is not in sealed state. */ | status_t FFR_KeystoreWrite(flash_config_t *config, ffr_key_store_t *pKeyStore) | /* This routine writes the 3 pages allocated for Key store data, Used during manufacturing. Should write pages when 'customer factory page' is not in sealed state. */
status_t FFR_KeystoreWrite(flash_config_t *config, ffr_key_store_t *pKeyStore) | {
if (get_rom_api_version() == 0u)
{
assert(VERSION0_FLASH_API_TREE);
return VERSION0_FLASH_API_TREE->ffr_keystore_write(config, pKeyStore);
}
else
{
assert(VERSION1_FLASH_API_TREE);
return VERSION1_FLASH_API_TREE->ffr_keystore_write(config, pKeyStore);
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Disable interrupts. We only disable the top-level interrupt concentrator and the SGE data interrupts. */ | void t3_intr_disable(struct adapter *adapter) | /* Disable interrupts. We only disable the top-level interrupt concentrator and the SGE data interrupts. */
void t3_intr_disable(struct adapter *adapter) | {
t3_write_reg(adapter, A_PL_INT_ENABLE0, 0);
t3_read_reg(adapter, A_PL_INT_ENABLE0);
adapter->slow_intr_mask = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* passed tables_size covers whole StateTable, including kern fmt1 header */ | static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Validator gxvalid) | /* passed tables_size covers whole StateTable, including kern fmt1 header */
static void gxv_kern_subtable_fmt1_subtable_setup(FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort *classTable_length_p, FT_UShort *stateArray_length_p, FT_UShort *entryTable_length_p, GXV_Vali... | {
FT_UShort o[4];
FT_UShort *l[4];
FT_UShort buff[5];
GXV_kern_fmt1_StateOptRecData optdata =
(GXV_kern_fmt1_StateOptRecData)gxvalid->statetable.optdata;
o[0] = classTable;
o[1] = stateArray;
o[2] = entryTable;
o[3] = optdata->valueTable;
l[0] = classTable_length_p;
l[1... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Sends queued pdus to MAC layer for transmission. */ | static void llc_conn_send_pdus(struct sock *sk) | /* Sends queued pdus to MAC layer for transmission. */
static void llc_conn_send_pdus(struct sock *sk) | {
struct sk_buff *skb;
while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) {
struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
if (LLC_PDU_TYPE_IS_I(pdu) &&
!(skb->dev->flags & IFF_LOOPBACK)) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb);
if (!s... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Change the direction of a GPIO pin to input */ | static int lpc178x_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | /* Change the direction of a GPIO pin to input */
static int lpc178x_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | {
LPC178X_GPIO(LPC178X_GPIO_GETPORT(gpio))->fiodir &=
~(1 << LPC178X_GPIO_GETPIN(gpio));
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calculate prescaler value used to determine ADC clock.
The ADC clock is given by: HFPERCLK / (prescale + 1). */ | uint8_t ADC_PrescaleCalc(uint32_t adcFreq, uint32_t hfperFreq) | /* Calculate prescaler value used to determine ADC clock.
The ADC clock is given by: HFPERCLK / (prescale + 1). */
uint8_t ADC_PrescaleCalc(uint32_t adcFreq, uint32_t hfperFreq) | {
uint32_t ret;
if (adcFreq > ADC_MAX_CLOCK)
{
adcFreq = ADC_MAX_CLOCK;
}
else if (adcFreq < ADC_MIN_CLOCK)
{
adcFreq = ADC_MIN_CLOCK;
}
if (!hfperFreq)
{
hfperFreq = CMU_ClockFreqGet(cmuClock_HFPER);
}
ret = (hfperFreq + adcFreq - 1) / adcFreq;
if (ret)
{
ret--;
}
return (... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Shifts the contents of the frame buffer up the specified number of pixels. */ | void ssd1306ShiftFrameBuffer(uint8_t height) | /* Shifts the contents of the frame buffer up the specified number of pixels. */
void ssd1306ShiftFrameBuffer(uint8_t height) | {
uint8_t y, x;
if (height == 0) return;
if (height >= SSD1306_LCDHEIGHT)
{
ssd1306ClearScreen();
return;
}
for (y = 0; y < SSD1306_LCDHEIGHT; y++)
{
for (x = 0; x < SSD1306_LCDWIDTH; x++)
{
if ((SSD1306_LCDHEIGHT - 1) - y > height)
{
ssd1306GetPixel(x, y + height) ? ss... | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Get current setting for a GPIO port data out register. */ | uint32_t GPIO_PortOutGet(GPIO_Port_TypeDef port) | /* Get current setting for a GPIO port data out register. */
uint32_t GPIO_PortOutGet(GPIO_Port_TypeDef port) | {
EFM_ASSERT(GPIO_PORT_VALID(port));
return(GPIO->P[port].DOUT & _GPIO_P_DOUT_DOUT_MASK);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function to call the memory de-allocation function of the FREERTOS. */ | void* mem_Malloc(unsigned long Size) | /* This function to call the memory de-allocation function of the FREERTOS. */
void* mem_Malloc(unsigned long Size) | {
return ( void * ) pvPortMalloc( (size_t)Size );
} | micropython/micropython | C++ | Other | 18,334 |
/* param base SPI base pointer param data needs to be write. param configFlags transfer configuration options ref spi_xfer_option_t */ | void SPI_WriteData(SPI_Type *base, uint16_t data, uint32_t configFlags) | /* param base SPI base pointer param data needs to be write. param configFlags transfer configuration options ref spi_xfer_option_t */
void SPI_WriteData(SPI_Type *base, uint16_t data, uint32_t configFlags) | {
uint32_t control = 0U;
uint32_t instance;
assert(NULL != base);
instance = SPI_GetInstance(base);
control |= (uint32_t)SPI_FIFOWR_LEN((g_configs[instance].dataWidth));
control |= (SPI_DEASSERT_ALL & (~SPI_DEASSERTNUM_SSEL((uint32_t)(g_configs[instance].sselNum))));
control |= (configFlags ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function for invalidating records with a BLE_CONN_STATUS_DISCONNECTED connection status. */ | static void record_purge_disconnected() | /* Function for invalidating records with a BLE_CONN_STATUS_DISCONNECTED connection status. */
static void record_purge_disconnected() | {
sdk_mapped_flags_key_list_t disconnected_list;
disconnected_list = sdk_mapped_flags_key_list_get(
m_bcs.valid_conn_handles,
(~m_bcs.flags.connected_flags) & (m_bcs.flags.valid_flags));
for (uint32_t i = 0; i < disconnected_list.len; i++)
... | labapart/polymcu | C++ | null | 201 |
/* param base SAI base pointer param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function */ | void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData) | /* param base SAI base pointer param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function */
void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData) | {
assert(handle != NULL);
(void)memset(handle, 0, sizeof(*handle));
s_saiHandle[SAI_GetInstance(base)][0] = handle;
handle->callback = callback;
handle->userData = userData;
handle->base = base;
s_saiTxIsr = SAI_TransferTxHandleIRQ;
(void)EnableIRQ(s_saiTxIRQ[SAI_GetInstance(base)]);... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Register a static text 'preference'. It can be used to add explanatory text inline with other preferences in the GUI. Note: Static preferences are not saved to the preferences file. */ | void prefs_register_static_text_preference(module_t *module, const char *name, const char *title, const char *description) | /* Register a static text 'preference'. It can be used to add explanatory text inline with other preferences in the GUI. Note: Static preferences are not saved to the preferences file. */
void prefs_register_static_text_preference(module_t *module, const char *name, const char *title, const char *description) | {
register_preference(module, name, title, description, PREF_STATIC_TEXT);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This API gets the power mode of the sensor. */ | int8_t bme280_get_sensor_mode(uint8_t *sensor_mode, struct bme280_dev *dev) | /* This API gets the power mode of the sensor. */
int8_t bme280_get_sensor_mode(uint8_t *sensor_mode, struct bme280_dev *dev) | {
int8_t rslt;
rslt = null_ptr_check(dev);
if ((rslt == BME280_OK) && (sensor_mode != NULL))
{
rslt = bme280_get_regs(BME280_PWR_CTRL_ADDR, sensor_mode, 1, dev);
*sensor_mode = BME280_GET_BITS_POS_0(*sensor_mode, BME280_SENSOR_MODE);
}
else
{
rslt = BME280_E_NULL_PTR;... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Checks for changes in the position of the board joystick, sending strings to the host upon each change through the first of the CDC interfaces. */ | void CheckJoystickMovement(void) | /* Checks for changes in the position of the board joystick, sending strings to the host upon each change through the first of the CDC interfaces. */
void CheckJoystickMovement(void) | {
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
ReportString = "Joystick Down\r\n";
else if (JoyStatus_LCL & JOY_LEFT)
ReportString = "Joy... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Advanced decoding functions : _usingDict() : These decoding functions work the same as "_continue" ones, the dictionary must be explicitly provided within parameters */ | int LZ4_decompress_safe_usingDict(const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize) | /* Advanced decoding functions : _usingDict() : These decoding functions work the same as "_continue" ones, the dictionary must be explicitly provided within parameters */
int LZ4_decompress_safe_usingDict(const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize) | {
if (dictSize==0)
return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
if (dictStart+dictSize == dest) {
if (dictSize >= 64 KB - 1) {
return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
}
assert(dictSize >= 0);
... | xboot/xboot | C++ | MIT License | 779 |
/* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ | BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue) | /* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue) | {
INT32 Ret;
if ((Sha1Context == NULL) || (HashValue == NULL)) {
return FALSE;
}
Ret = mbedtls_sha1_finish_ret (Sha1Context, HashValue);
mbedtls_sha1_free (Sha1Context);
if (Ret != 0) {
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function sets the Analog input mode for the specified channels in the ADC Channel Analog-Input Mode Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */ | int XAdcPs_SetSeqInputMode(XAdcPs *InstancePtr, u32 InputModeChMask) | /* This function sets the Analog input mode for the specified channels in the ADC Channel Analog-Input Mode Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */
int XAdcPs_SetSeqInputMode(XAdcPs *InstancePtr, u32 InputModeChMask) | {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
if ((XAdcPs_GetSequencerMode(InstancePtr) != XADCPS_SEQ_MODE_SAFE)) {
return XST_FAILURE;
}
XAdcPs_WriteInternalReg(InstancePtr,
XADCPS_SEQ04_OFFSET,
(InputModeChMask & XADCPS_SEQ04_CH_VALID_MASK)... | ua1arn/hftrx | C++ | null | 69 |
/* Reads the values present of the specified Port. */ | unsigned long xGPIOPortRead(unsigned long ulPort) | /* Reads the values present of the specified Port. */
unsigned long xGPIOPortRead(unsigned long ulPort) | {
xASSERT(GPIOBaseValid(ulPort));
return (xHWREG(ulPort + GPIO_PIN) & 0xffff);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Detect if SD card is correctly plugged in the memory slot. */ | uint8_t SD_Detect(void) | /* Detect if SD card is correctly plugged in the memory slot. */
uint8_t SD_Detect(void) | {
__IO uint8_t status = SD_PRESENT;
if (GPIO_ReadInputData(SD_DETECT_GPIO_PORT) & SD_DETECT_PIN)
{
status = SD_NOT_PRESENT;
}
return status;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Attempt to reallocate p. If the reallocation fails, then free p and set the mallocFailed flag in the database connection. */ | SQLITE_PRIVATE void * sqlite3DbReallocOrFree(sqlite3 *, void *, int) | /* Attempt to reallocate p. If the reallocation fails, then free p and set the mallocFailed flag in the database connection. */
SQLITE_PRIVATE void * sqlite3DbReallocOrFree(sqlite3 *, void *, int) | {
void *pNew;
pNew = sqlite3DbRealloc(db, p, n);
if( !pNew ){
sqlite3DbFree(db, p);
}
return pNew;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Configure the specified MCU pin. Returns 0 on success, -EINVAL otherwise. */ | int lpc18xx_pin_config(const struct lpc18xx_iomux_dsc *dsc, u32 regval) | /* Configure the specified MCU pin. Returns 0 on success, -EINVAL otherwise. */
int lpc18xx_pin_config(const struct lpc18xx_iomux_dsc *dsc, u32 regval) | {
int rv;
rv = lpc18xx_validate_pin(dsc);
if (rv == 0)
LPC18XX_PIN(dsc->group, dsc->pin) = regval;
return rv;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* wait the command done function and check error status */ | static status_t SDIF_WaitCommandDone(SDIF_Type *base, sdif_command_t *command) | /* wait the command done function and check error status */
static status_t SDIF_WaitCommandDone(SDIF_Type *base, sdif_command_t *command) | {
uint32_t status = 0U;
do
{
status = SDIF_GetInterruptStatus(base);
if ((status &
(kSDIF_ResponseError | kSDIF_ResponseCRCError | kSDIF_ResponseTimeout | kSDIF_HardwareLockError)) != 0u)
{
SDIF_ClearInterruptStatus(base, status & (kSDIF_ResponseError | kSDIF... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: The pointer to the buffer with the converted string. */ | gchar* g_ascii_dtostr(gchar *buffer, gint buf_len, gdouble d) | /* Returns: The pointer to the buffer with the converted string. */
gchar* g_ascii_dtostr(gchar *buffer, gint buf_len, gdouble d) | {
return g_ascii_formatd (buffer, buf_len, "%.17g", d);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* All direct or indirect allocated resource for this node will be freed. */ | VOID FreePciDevice(IN PCI_IO_DEVICE *PciIoDevice) | /* All direct or indirect allocated resource for this node will be freed. */
VOID FreePciDevice(IN PCI_IO_DEVICE *PciIoDevice) | {
ASSERT (PciIoDevice != NULL);
if (PciIoDevice->ResourcePaddingDescriptors != NULL) {
FreePool (PciIoDevice->ResourcePaddingDescriptors);
}
if (PciIoDevice->DevicePath != NULL) {
FreePool (PciIoDevice->DevicePath);
}
if (PciIoDevice->BusNumberRanges != NULL) {
FreePool (PciIoDevice->BusNumberRa... | tianocore/edk2 | C++ | Other | 4,240 |
/* Once the @skb is given to this function, who will own it and will release it when done (unless it returns error). */ | int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name, const void *buf, size_t size, gfp_t gfp_flags) | /* Once the @skb is given to this function, who will own it and will release it when done (unless it returns error). */
int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name, const void *buf, size_t size, gfp_t gfp_flags) | {
int result = -ENOMEM;
struct sk_buff *skb;
skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags);
if (IS_ERR(skb))
result = PTR_ERR(skb);
else
result = wimax_msg_send(wimax_dev, skb);
return result;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get number of memory blocks available in a Memory Pool. */ | uint32_t osMemoryPoolGetSpace(osMemoryPoolId_t mp_id) | /* Get number of memory blocks available in a Memory Pool. */
uint32_t osMemoryPoolGetSpace(osMemoryPoolId_t mp_id) | {
struct cv2_mslab *mslab = (struct cv2_mslab *)mp_id;
if (mslab == NULL) {
return 0;
} else {
return k_mem_slab_num_free_get(&mslab->z_mslab);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param base SPI base pointer param enable True means enable DMA, false means disable DMA */ | void SPI_EnableTxDMA(SPI_Type *base, bool enable) | /* param base SPI base pointer param enable True means enable DMA, false means disable DMA */
void SPI_EnableTxDMA(SPI_Type *base, bool enable) | {
if (enable)
{
base->FIFOCFG |= SPI_FIFOCFG_DMATX_MASK;
}
else
{
base->FIFOCFG &= ~SPI_FIFOCFG_DMATX_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return an SCB resource to the free list. */ | void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb) | /* Return an SCB resource to the free list. */
void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb) | {
struct hardware_scb *hscb;
hscb = scb->hscb;
ahc->scb_data->scbindex[hscb->tag] = NULL;
scb->flags = SCB_FREE;
hscb->control = 0;
SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, scb, links.sle);
ahc_platform_scb_free(ahc, scb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check whether the RX ring buffer is full.
@userData handle LPUART handle pointer. */ | static bool LPUART_TransferIsRxRingBufferFull(LPUART_Type *base, lpuart_handle_t *handle) | /* Check whether the RX ring buffer is full.
@userData handle LPUART handle pointer. */
static bool LPUART_TransferIsRxRingBufferFull(LPUART_Type *base, lpuart_handle_t *handle) | {
assert(handle);
bool full;
if (LPUART_TransferGetRxRingBufferLength(base, handle) == (handle->rxRingBufferSize - 1U))
{
full = true;
}
else
{
full = false;
}
return full;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Command that requests one or all of the PPCs to try exiting the dead battery mode. */ | static int cmd_ppc_exit_db(const struct shell *sh, size_t argc, char **argv) | /* Command that requests one or all of the PPCs to try exiting the dead battery mode. */
static int cmd_ppc_exit_db(const struct shell *sh, size_t argc, char **argv) | {
int ret = 0;
if (argc <= 1) {
DT_FOREACH_STATUS_OKAY_VARGS(usb_c_connector, CALL_IF_HAS_PPC,
ppc_exit_dead_battery_mode);
} else {
const struct device *dev = device_get_binding(argv[1]);
ret = ppc_exit_dead_battery_mode(dev);
}
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function updates lprops dirty space and the new size of the index. */ | static int add_idx_dirt(struct ubifs_info *c, int lnum, int dirt) | /* This function updates lprops dirty space and the new size of the index. */
static int add_idx_dirt(struct ubifs_info *c, int lnum, int dirt) | {
c->calc_idx_sz -= ALIGN(dirt, 8);
return ubifs_add_dirt(c, lnum, dirt);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* return true if the refcount is greater than count */ | static int do_refcount_check(struct vfsmount *mnt, int count) | /* return true if the refcount is greater than count */
static int do_refcount_check(struct vfsmount *mnt, int count) | {
int mycount = atomic_read(&mnt->mnt_count) - mnt->mnt_ghosts;
return (mycount > count);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: This function attempts to steal the &struct page attached to @buf. If successful, this function returns 0 and returns with the page locked. The caller may then reuse the page for whatever he wishes; the typical use is insertion into a different file page cache. */ | int generic_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *buf) | /* Description: This function attempts to steal the &struct page attached to @buf. If successful, this function returns 0 and returns with the page locked. The caller may then reuse the page for whatever he wishes; the typical use is insertion into a different file page cache. */
int generic_pipe_buf_steal(struct pipe... | {
struct page *page = buf->page;
if (page_count(page) == 1) {
lock_page(page);
return 0;
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return 0 if the current subject can write to the destination host. This is only a question if the destination is a single label host. */ | static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) | /* Return 0 if the current subject can write to the destination host. This is only a question if the destination is a single label host. */
static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) | {
struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name;
if (sip == NULL || sip->sin_family != AF_INET)
return 0;
return smack_netlabel_send(sock->sk, sip);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Writes the MMIO registers specified by Address with registers width and value specified by Width and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */ | UINT64 EFIAPI MmioWriteWorker(IN UINTN Address, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Data) | /* Writes the MMIO registers specified by Address with registers width and value specified by Width and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */
UINT64 EFIAPI MmioWriteWorker(IN UINTN... | {
EFI_STATUS Status;
Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* For a fragment hash table entry, free the associated fragments. The entry value (fd_chain) is freed herein and the entry is freed when the key freeing routine is called (as a consequence of returning TRUE from this function). */ | static gboolean free_all_fragments(gpointer key_arg _U_, gpointer value, gpointer user_data _U_) | /* For a fragment hash table entry, free the associated fragments. The entry value (fd_chain) is freed herein and the entry is freed when the key freeing routine is called (as a consequence of returning TRUE from this function). */
static gboolean free_all_fragments(gpointer key_arg _U_, gpointer value, gpointer user_... | {
fragment_head *fd_head;
fragment_item *tmp_fd;
for (fd_head = (fragment_head *)value; fd_head != NULL; fd_head = tmp_fd) {
tmp_fd=fd_head->next;
if(fd_head->tvb_data && !(fd_head->flags&FD_SUBSET_TVB))
tvb_free(fd_head->tvb_data);
g_slice_free(fragment_item, fd_head);
}
return TRUE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI5)
{
__HAL_RCC_SPI5_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7|GPIO_PIN_9|GPIO_PIN_8);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set vIFA & vITIR & vIHA, when vPSR.ic =1 Parameter: set_ifa: if true, set vIFA set_itir: if true, set vITIR set_iha: if true, set vIHA */ | void set_ifa_itir_iha(struct kvm_vcpu *vcpu, u64 vadr, int set_ifa, int set_itir, int set_iha) | /* Set vIFA & vITIR & vIHA, when vPSR.ic =1 Parameter: set_ifa: if true, set vIFA set_itir: if true, set vITIR set_iha: if true, set vIHA */
void set_ifa_itir_iha(struct kvm_vcpu *vcpu, u64 vadr, int set_ifa, int set_itir, int set_iha) | {
long vpsr;
u64 value;
vpsr = VCPU(vcpu, vpsr);
if (vpsr & IA64_PSR_IC) {
if (set_ifa)
vcpu_set_ifa(vcpu, vadr);
if (set_itir) {
value = vcpu_get_itir_on_fault(vcpu, vadr);
vcpu_set_itir(vcpu, value);
}
if (set_iha) {
value = vcpu_thash(vcpu, vadr);
vcpu_set_iha(vcpu, value);
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function returns the delegation without reclaiming opens or protecting against delegation reclaims. It is therefore really only safe to be called from nfs4_clear_inode() */ | void nfs_inode_return_delegation_noreclaim(struct inode *inode) | /* This function returns the delegation without reclaiming opens or protecting against delegation reclaims. It is therefore really only safe to be called from nfs4_clear_inode() */
void nfs_inode_return_delegation_noreclaim(struct inode *inode) | {
struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs_delegation *delegation;
if (rcu_access_pointer(nfsi->delegation) != NULL) {
spin_lock(&clp->cl_lock);
delegation = nfs_detach_delegation_locked(nfsi, NULL, clp);
spin_unlock(&clp->cl_lock);
if (delega... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function enables power to PUF block and waits until the block initializes. */ | status_t PUF_Init(PUF_Type *base, puf_config_t *conf) | /* This function enables power to PUF block and waits until the block initializes. */
status_t PUF_Init(PUF_Type *base, puf_config_t *conf) | {
status_t status = kStatus_Fail;
CLOCK_EnableClock(kCLOCK_Puf);
RESET_PeripheralReset(kPUF_RST_SHIFT_RSTn);
base->SRAM_CFG |= PUF_SRAM_CFG_CKGATING(conf->CKGATING);
puf_powerOn(base, conf);
status = puf_waitForInit(base);
if ((status != kStatus_Success) || ((PUF_AR_ALLOW_ENROLL_MASK | PUF_A... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable UART system clock.
This function enables or disables the UART system clock. */ | void am_hal_clkgen_uarten_set(uint32_t ui32Module, uint32_t ui32UartEn) | /* Enable UART system clock.
This function enables or disables the UART system clock. */
void am_hal_clkgen_uarten_set(uint32_t ui32Module, uint32_t ui32UartEn) | {
uint32_t ui32Mask;
if ( (ui32Module >= AM_REG_UART_NUM_MODULES) ||
(ui32UartEn > AM_HAL_CLKGEN_UARTEN_EN_POWER_SAV) )
{
return;
}
ui32UartEn <<= (ui32Module * AM_HAL_CLKGEN_UARTEN_UARTENn_S(ui32Module));
ui32Mask = ~(AM_HAL_CLKGEN_UARTEN_UARTENn_M(ui32Module));
AM_C... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear the PendSV pending.
This function will Clear the PendSV pending. */ | void xPendSVPendClr(void) | /* Clear the PendSV pending.
This function will Clear the PendSV pending. */
void xPendSVPendClr(void) | {
xHWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_UNPEND_SV;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Sets a Stall condition on an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Sets a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr);
switch (hal_status) {
case HAL_OK :
usb_status = USBD_OK;
break;
case HAL_ERROR :
usb_status = USBD_FAIL;
break;
case HAL_BUSY :
usb_sta... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Increment the usage count of the device and resume it or submit a resume request for it, depending on the value of @sync. */ | int __pm_runtime_get(struct device *dev, bool sync) | /* Increment the usage count of the device and resume it or submit a resume request for it, depending on the value of @sync. */
int __pm_runtime_get(struct device *dev, bool sync) | {
int retval;
atomic_inc(&dev->power.usage_count);
retval = sync ? pm_runtime_resume(dev) : pm_request_resume(dev);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads the status word from an LPC Channel. */ | unsigned long LPCChannelStatusGet(unsigned long ulBase, unsigned long ulChannel) | /* Reads the status word from an LPC Channel. */
unsigned long LPCChannelStatusGet(unsigned long ulBase, unsigned long ulChannel) | {
ASSERT(ulBase == LPC0_BASE);
ASSERT(LPCChannelValid(ulChannel));
return (HWREG(ulBase + LPC_O_CH0ST + (ulChannel * 0x10)));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData) | {
return PciExpressAndThenOr32 (Address, AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This interrupt occurs when the non-periodic Tx FIFO is half-empty. More data packets may be written to the FIFO for OUT transfers. More requests may be written to the non-periodic request queue for IN transfers. This interrupt is enabled only in Slave mode. */ | static void dwc2_np_tx_fifo_empty_intr(struct dwc2_hsotg *hsotg) | /* This interrupt occurs when the non-periodic Tx FIFO is half-empty. More data packets may be written to the FIFO for OUT transfers. More requests may be written to the non-periodic request queue for IN transfers. This interrupt is enabled only in Slave mode. */
static void dwc2_np_tx_fifo_empty_intr(struct dwc2_hsot... | {
dev_vdbg(hsotg->dev, "--Non-Periodic TxFIFO Empty Interrupt--\n");
dwc2_hcd_queue_transactions(hsotg, DWC2_TRANSACTION_NON_PERIODIC);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Ensures that a module will never be unloaded. Any future g_module_close() calls on the module will be ignored. */ | void g_module_make_resident(GModule *module) | /* Ensures that a module will never be unloaded. Any future g_module_close() calls on the module will be ignored. */
void g_module_make_resident(GModule *module) | {
g_return_if_fail (module != NULL);
module->is_resident = TRUE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Routine: init_omap_tags Description: Initialize pointers to values in tag_omap */ | static void init_omap_tags(void) | /* Routine: init_omap_tags Description: Initialize pointers to values in tag_omap */
static void init_omap_tags(void) | {
char *component;
char *version;
int i = 0;
while (omap[i].hdr.tag) {
switch (omap[i].hdr.tag) {
case OMAP_TAG_BOOT_REASON:
boot_reason_ptr = omap[i].u.boot_reason.reason_str;
break;
case OMAP_TAG_VERSION_STR:
component = omap[i].u.version.component;
version = omap[i].u.version.version;
if (st... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: TRUE if monitor is canceled. FALSE otherwise. */ | gboolean g_file_monitor_is_cancelled(GFileMonitor *monitor) | /* Returns: TRUE if monitor is canceled. FALSE otherwise. */
gboolean g_file_monitor_is_cancelled(GFileMonitor *monitor) | {
gboolean res;
g_return_val_if_fail (G_IS_FILE_MONITOR (monitor), FALSE);
res = monitor->priv->cancelled;
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Since we cannot read the PHY and get accurate link info, we must rely upon the status register's data which is often stale and inaccurate. */ | static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, u16 *duplex) | /* Since we cannot read the PHY and get accurate link info, we must rely upon the status register's data which is often stale and inaccurate. */
static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed, u16 *duplex) | {
s32 status;
status = er32(STATUS);
if (status & E1000_STATUS_SPEED_1000)
*speed = SPEED_1000;
else if (status & E1000_STATUS_SPEED_100)
*speed = SPEED_100;
else
*speed = SPEED_10;
if (status & E1000_STATUS_FD)
*duplex = FULL_DUPLEX;
else
*duplex = HALF_DUPLEX;
return E1000_SUCCESS;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* note Colorkey operations are higher priority than alpha or ROP operations */ | void PXP_SetAlphaSurfaceOverlayColorKey(PXP_Type *base, uint32_t colorKeyLow, uint32_t colorKeyHigh) | /* note Colorkey operations are higher priority than alpha or ROP operations */
void PXP_SetAlphaSurfaceOverlayColorKey(PXP_Type *base, uint32_t colorKeyLow, uint32_t colorKeyHigh) | {
base->AS_CLRKEYLOW = colorKeyLow;
base->AS_CLRKEYHIGH = colorKeyHigh;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the specified ADC Voltage Regulator. */ | void ADC_VoltageRegulatorCmd(ADC_TypeDef *ADCx, FunctionalState NewState) | /* Enables or disables the specified ADC Voltage Regulator. */
void ADC_VoltageRegulatorCmd(ADC_TypeDef *ADCx, FunctionalState NewState) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
ADCx->CR &= ~(ADC_CR_ADVREGEN);
if (NewState != DISABLE)
{
ADCx->CR |= ADC_CR_ADVREGEN_0;
}
else
{
ADCx->CR |=ADC_CR_ADVREGEN_1;
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* USB Device MSC Bulk In/Out Endpoint Event Callback Parameters: event: USB Device Event USBD_EVT_OUT: Output Event USBD_EVT_IN: Input Event Return Value: None */ | void USBD_MSC_EP_BULK_Event(U32 event) | /* USB Device MSC Bulk In/Out Endpoint Event Callback Parameters: event: USB Device Event USBD_EVT_OUT: Output Event USBD_EVT_IN: Input Event Return Value: None */
void USBD_MSC_EP_BULK_Event(U32 event) | {
if (event & USBD_EVT_OUT) {
USBD_MSC_EP_BULKOUT_Event(0);
}
if (event & USBD_EVT_IN) {
USBD_MSC_EP_BULKIN_Event(0);
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Set the De-bounce sampling cycle.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIODebounceTimeSet(unsigned long ulClockSource, unsigned long ulDebounceClk) | /* Set the De-bounce sampling cycle.
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIODebounceTimeSet(unsigned long ulClockSource, unsigned lon... | {
xASSERT((ulClockSource == GPIO_DBCLKSRC_HCLK) ||
(ulClockSource == GPIO_DBCLKSRC_10K));
xASSERT(ulDebounceClk<=15);
xHWREG(GPIO_DBNCECON) = ((ulClockSource & 1) ?
(xHWREG(GPIO_DBNCECON) | GPIO_DBNCECON_DBCLKSRC) :
(xHWREG(GPIO_DBNCEC... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* ccid_get_builtin_ccids - Populate a list of built-in CCIDs @ccid_array: pointer to copy into @array_len: value to return length into This function allocates memory - caller must see that it is freed after use. */ | int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len) | /* ccid_get_builtin_ccids - Populate a list of built-in CCIDs @ccid_array: pointer to copy into @array_len: value to return length into This function allocates memory - caller must see that it is freed after use. */
int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len) | {
*ccid_array = kmalloc(ARRAY_SIZE(ccids), gfp_any());
if (*ccid_array == NULL)
return -ENOBUFS;
for (*array_len = 0; *array_len < ARRAY_SIZE(ccids); *array_len += 1)
(*ccid_array)[*array_len] = ccids[*array_len]->ccid_id;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the state of a GPIO output pin */ | static void a2f_gpio_set_value_locked(struct a2f_gpio_chip *a2f_chip, unsigned gpio, int value) | /* Set the state of a GPIO output pin */
static void a2f_gpio_set_value_locked(struct a2f_gpio_chip *a2f_chip, unsigned gpio, int value) | {
u32 gpio_out = readl(a2f_chip->gpio_out);
if (value) {
gpio_out |= 1 << gpio;
} else {
gpio_out &= ~(1 << gpio);
}
writel(gpio_out, a2f_chip->gpio_out);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Called after dropping swapcache to decrease refcnt to swap entries. */ | void swapcache_free(swp_entry_t entry, struct page *page) | /* Called after dropping swapcache to decrease refcnt to swap entries. */
void swapcache_free(swp_entry_t entry, struct page *page) | {
struct swap_info_struct *p;
unsigned char count;
p = swap_info_get(entry);
if (p) {
count = swap_entry_free(p, entry, SWAP_HAS_CACHE);
if (page)
mem_cgroup_uncharge_swapcache(page, entry, count != 0);
spin_unlock(&swap_lock);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Remove an association between an inode and a filestream object. Typically this is done on last close of an unlinked file. */ | void xfs_filestream_deassociate(xfs_inode_t *ip) | /* Remove an association between an inode and a filestream object. Typically this is done on last close of an unlinked file. */
void xfs_filestream_deassociate(xfs_inode_t *ip) | {
xfs_mru_cache_t *cache = ip->i_mount->m_filestream;
xfs_mru_cache_delete(cache, ip->i_ino);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the drag parent attribute of an object */ | bool lv_obj_get_drag_parent(const lv_obj_t *obj) | /* Get the drag parent attribute of an object */
bool lv_obj_get_drag_parent(const lv_obj_t *obj) | {
return obj->drag_parent == 0 ? false : true;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Decrements the channel refcount, as the filesystem is no longer using it. */ | static int relay_file_release(struct inode *inode, struct file *filp) | /* Decrements the channel refcount, as the filesystem is no longer using it. */
static int relay_file_release(struct inode *inode, struct file *filp) | {
struct rchan_buf *buf = filp->private_data;
kref_put(&buf->kref, relay_remove_buf);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Modify PDP context accept (MS to network direction) Direction: MS to network */ | static void dtap_sm_mod_pdp_acc_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) | /* Modify PDP context accept (MS to network direction) Direction: MS to network */
static void dtap_sm_mod_pdp_acc_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) | {
guint32 curr_offset;
guint32 consumed;
guint curr_len;
curr_offset = offset;
curr_len = len;
pinfo->p2p_dir = P2P_DIR_UNKNOWN;
pinfo->link_dir = P2P_DIR_UL;
ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
EXTRANEOUS_DATA_CHECK(cu... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enables or disables the RTC registers write protection. */ | void RTC_WriteProtectionCmd(FunctionalState NewState) | /* Enables or disables the RTC registers write protection. */
void RTC_WriteProtectionCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RTC->WPR = 0xFF;
}
else
{
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Conversation specific initialization code that deletes any unused memory that might need to be freed, and allocates the memory for the various conversation hash tables. */ | static void rsvp_init_protocol(void) | /* Conversation specific initialization code that deletes any unused memory that might need to be freed, and allocates the memory for the various conversation hash tables. */
static void rsvp_init_protocol(void) | {
rsvp_request_hash = g_hash_table_new(rsvp_hash, rsvp_equal);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set the USCI_SPI bus clock. Only available in Master mode. */ | uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock) | /* Set the USCI_SPI bus clock. Only available in Master mode. */
uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock) | {
uint32_t u32ClkDiv;
uint32_t u32Pclk = 0UL;
if (uspi == USPI0)
{
u32Pclk = CLK_GetPCLK0Freq();
}
u32ClkDiv = (uint32_t)((((((u32Pclk / 2ul) * 10ul) / (u32BusClock)) + 5ul) / 10ul) - 1ul);
uspi->BRGEN &= ~USPI_BRGEN_CLKDIV_Msk;
uspi->BRGEN |= (u32ClkDiv << USPI_BRGEN_CLKDIV_Pos)... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Retrieves the parameters of the EEPROM Emulator memory layout.
Retrieves the configuration parameters of the EEPROM Emulator, after it has been initialized. */ | enum status_code eeprom_emulator_get_parameters(struct eeprom_emulator_parameters *const parameters) | /* Retrieves the parameters of the EEPROM Emulator memory layout.
Retrieves the configuration parameters of the EEPROM Emulator, after it has been initialized. */
enum status_code eeprom_emulator_get_parameters(struct eeprom_emulator_parameters *const parameters) | {
if (_eeprom_instance.initialized == false) {
return STATUS_ERR_NOT_INITIALIZED;
}
parameters->page_size = EEPROM_PAGE_SIZE;
parameters->eeprom_number_of_pages = _eeprom_instance.logical_pages;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* For compatibility reasons, the NameOpNode must initially contain an integer. */ | EFI_STATUS EFIAPI AmlNameOpUpdateInteger(IN AML_OBJECT_NODE_HANDLE NameOpNode, IN UINT64 NewInt) | /* For compatibility reasons, the NameOpNode must initially contain an integer. */
EFI_STATUS EFIAPI AmlNameOpUpdateInteger(IN AML_OBJECT_NODE_HANDLE NameOpNode, IN UINT64 NewInt) | {
EFI_STATUS Status;
AML_OBJECT_NODE_HANDLE IntegerOpNode;
if ((NameOpNode == NULL) ||
(AmlGetNodeType ((AML_NODE_HANDLE)NameOpNode) != EAmlNodeObject) ||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0)))
{
ASSERT (0);
return EFI_INVA... | tianocore/edk2 | C++ | Other | 4,240 |
/* Allocate memory from the heap.
The current heap implementation is very rudimentary, it is only able to allocate memory. But it does not */ | void* _sbrk_r(struct _reent *r, ptrdiff_t incr) | /* Allocate memory from the heap.
The current heap implementation is very rudimentary, it is only able to allocate memory. But it does not */
void* _sbrk_r(struct _reent *r, ptrdiff_t incr) | {
unsigned int state = disableIRQ();
void *res = heap_top;
if ((heap_top + incr > &_eheap) || (heap_top + incr < &_sheap)) {
r->_errno = ENOMEM;
res = (void *)-1;
}
else {
heap_top += incr;
}
restoreIRQ(state);
return res;
} | labapart/polymcu | C++ | null | 201 |
/* Checks whether the ETHERNET flow control busy bit is set or not. */ | FlagStatus ETH_GetFlowCtrlBusyStatus(void) | /* Checks whether the ETHERNET flow control busy bit is set or not. */
FlagStatus ETH_GetFlowCtrlBusyStatus(void) | {
FlagStatus bitstatus = RESET;
if ((ETH->MACFLWCTRL & ETH_MACFLWCTRL_FCB_BPA) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* One of the following to select the tachometer pulses per revolution: */ | void FanChannelConfigAuto(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig) | /* One of the following to select the tachometer pulses per revolution: */
void FanChannelConfigAuto(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig) | {
ASSERT(ulBase == FAN0_BASE);
ASSERT(ulChannel <= 5);
HWREG(ulBase + FAN_O_CH0 + (ulChannel * 0x10)) = ~FAN_CH0_MAN & ulConfig;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | /* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | {
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(hrtc->Instance==RTC)
{
if (IS_ENGINEERING_BOOT_MODE())
{
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the ball axis change since the last poll */ | int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy) | /* Get the ball axis change since the last poll */
int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy) | {
int retval;
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
retval = 0;
if (ball < joystick->nballs) {
if (dx) {
*dx = joystick->balls[ball].dx;
}
if (dy) {
*dy = joystick->balls[ball].dy;
}
joystick->balls[ball].dx = ... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Initializes the RTC device, include clock, RTC registers and function. */ | int32_t hal_rtc_init(rtc_dev_t *rtc) | /* Initializes the RTC device, include clock, RTC registers and function. */
int32_t hal_rtc_init(rtc_dev_t *rtc) | {
RTC_InitTypeDef RTC_InitStruct;
RCC_PeriphClockSource_RTC(0);
RTC_StructInit(&RTC_InitStruct);
RTC_InitStruct.RTC_HourFormat = RTC_HourFormat_24;
RTC_Init(&RTC_InitStruct);
rtc_en = 1;
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Allocate a buffer of the DMA program buffer from the pool. */ | static void * XDmaPs_BufPool_Allocate(XDmaPs_ProgBuf *Pool) | /* Allocate a buffer of the DMA program buffer from the pool. */
static void * XDmaPs_BufPool_Allocate(XDmaPs_ProgBuf *Pool) | {
int Index;
Xil_AssertNonvoid(Pool != NULL);
for (Index = 0; Index < XDMAPS_MAX_CHAN_BUFS; Index++) {
if (!Pool[Index].Allocated) {
Pool[Index].Allocated = 1;
return Pool[Index].Buf;
}
}
return NULL;
} | ua1arn/hftrx | C++ | null | 69 |
/* Older SiS900 and friends, use EEPROM to store MAC address. MAC address is read from read_eeprom() into @net_dev->dev_addr. */ | static int __devinit sis900_get_mac_addr(struct pci_dev *pci_dev, struct net_device *net_dev) | /* Older SiS900 and friends, use EEPROM to store MAC address. MAC address is read from read_eeprom() into @net_dev->dev_addr. */
static int __devinit sis900_get_mac_addr(struct pci_dev *pci_dev, struct net_device *net_dev) | {
long ioaddr = pci_resource_start(pci_dev, 0);
u16 signature;
int i;
signature = (u16) read_eeprom(ioaddr, EEPROMSignature);
if (signature == 0xffff || signature == 0x0000) {
printk (KERN_WARNING "%s: Error EERPOM read %x\n",
pci_name(pci_dev), signature);
return 0;
}
for (i = 0; i < 3; i++)
((u... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initializes the Low Level portion of the Host driver. */ | USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | /* Initializes the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | {
hhcd.Instance = USB_OTG_HS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_HIGH;
hhcd.Init.use_external_vbus = 1;
hhcd.pData = phost;
phost->pData = &hhcd;
if ... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.