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 |
|---|---|---|---|---|---|---|---|
/* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */ | void CLOCK_InitExternalClk(bool bypassXtalOsc) | /* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */
void CLOCK_InitExternalClk(bool bypassXtalOsc) | {
assert(!bypassXtalOsc);
CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK;
while ((XTALOSC24M->LOWPWR_CTRL & XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK) == 0UL)
{
}
CCM_ANALOG->MISC0_SET = (uint32_t)CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK;
while ((CCM_ANALOG->MISC0 & CCM_ANALOG_MISC0_OSC_XTALOK_MASK) == 0UL)
{
}
CCM_ANALOG->MISC0_CLR = (uint32_t)CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure the specified MCU pin. Returns 0 on success, -EINVAL otherwise. */ | int lpc18xx_pin_config(int group, int pin, u32 regval) | /* Configure the specified MCU pin. Returns 0 on success, -EINVAL otherwise. */
int lpc18xx_pin_config(int group, int pin, u32 regval) | {
int rv;
rv = lpc18xx_validate_pin(group, pin);
if (! rv) {
writel(0, &LPC18XX_PIN(group, pin));
writel(regval, &LPC18XX_PIN(group, pin));
}
return rv;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ | gboolean _g_freedesktop_dbus_call_name_has_owner_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, gboolean *out_has_owner, GCancellable *cancellable, GError **error) | /* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_name_has_owner_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, gboolean *out_has_owner, GCancellable *cancellable, GError **error) | {
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"NameHasOwner",
g_variant_new ("(s)",
arg_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(b)",
out_has_owner);
g_variant_unref (_ret);
_out:
return _ret != NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Checks whether the DCMI interface flag is set or not. */ | FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG) | /* Checks whether the DCMI interface flag is set or not. */
FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG) | {
FlagStatus bitstatus = RESET;
uint32_t dcmireg, tempreg = 0;
assert_param(IS_DCMI_GET_FLAG(DCMI_FLAG));
dcmireg = (((uint16_t)DCMI_FLAG) >> 12);
if (dcmireg == 0x00)
{
tempreg= DCMI->RISR;
}
else if (dcmireg == 0x02)
{
tempreg = DCMI->SR;
}
else
{
tempreg = DCMI->MISR;
}
if ((tempreg & DCMI_FLAG) != (uint16_t)RESET )
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* The STATUS_REG register is read by the primary interface.. */ | int32_t lsm6dso_status_reg_get(stmdev_ctx_t *ctx, lsm6dso_status_reg_t *val) | /* The STATUS_REG register is read by the primary interface.. */
int32_t lsm6dso_status_reg_get(stmdev_ctx_t *ctx, lsm6dso_status_reg_t *val) | {
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_STATUS_REG, (uint8_t *) val, 1);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function writes a data buffer in flash (data are 32-bit aligned). */ | uint32_t FLASH_If_Write(uint32_t FlashAddress, uint32_t *Data, uint32_t DataLength) | /* This function writes a data buffer in flash (data are 32-bit aligned). */
uint32_t FLASH_If_Write(uint32_t FlashAddress, uint32_t *Data, uint32_t DataLength) | {
uint32_t i = 0;
for (i = 0; (i < DataLength) && (FlashAddress <= (USER_FLASH_END_ADDRESS-4)); i++)
{
if (HAL_FLASH_Program(TYPEPROGRAM_WORD, FlashAddress, *(uint32_t*)(Data+i)) == HAL_OK)
{
if (*(uint32_t*)FlashAddress != *(uint32_t*)(Data+i))
{
return(FLASHIF_WRITINGCTRL_ERROR);
}
FlashAddress += 4;
}
else
{
return (FLASHIF_WRITING_ERROR);
}
}
return (FLASHIF_OK);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Helper function stating whether the compass is on or off. */ | int inv_get_compass_on() | /* Helper function stating whether the compass is on or off. */
int inv_get_compass_on() | {
return (sensors.compass.status & INV_SENSOR_ON) == INV_SENSOR_ON;
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Check if a GRU context is allowed to use a specific chiplet. By default a context is assigned to any blade-local chiplet. However, users can override this. Returns 1 if assignment allowed, 0 otherwise */ | static int gru_check_chiplet_assignment(struct gru_state *gru, struct gru_thread_state *gts) | /* Check if a GRU context is allowed to use a specific chiplet. By default a context is assigned to any blade-local chiplet. However, users can override this. Returns 1 if assignment allowed, 0 otherwise */
static int gru_check_chiplet_assignment(struct gru_state *gru, struct gru_thread_state *gts) | {
int blade_id;
int chiplet_id;
blade_id = gts->ts_user_blade_id;
if (blade_id < 0)
blade_id = uv_numa_blade_id();
chiplet_id = gts->ts_user_chiplet_id;
return gru->gs_blade_id == blade_id &&
(chiplet_id < 0 || chiplet_id == gru->gs_chiplet_id);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Requires j_list_lock Called under jbd_lock_bh_state(jh2bh(jh)), and drops it */ | static int __try_to_free_cp_buf(struct journal_head *jh) | /* Requires j_list_lock Called under jbd_lock_bh_state(jh2bh(jh)), and drops it */
static int __try_to_free_cp_buf(struct journal_head *jh) | {
int ret = 0;
struct buffer_head *bh = jh2bh(jh);
if (jh->b_jlist == BJ_None && !buffer_locked(bh) &&
!buffer_dirty(bh) && !buffer_write_io_error(bh)) {
JBUFFER_TRACE(jh, "remove from checkpoint list");
ret = __jbd2_journal_remove_checkpoint(jh) + 1;
jbd_unlock_bh_state(bh);
jbd2_journal_remove_journal_head(bh);
BUFFER_TRACE(bh, "release");
__brelse(bh);
} else {
jbd_unlock_bh_state(bh);
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* retrieves the VLAN tag (the lower 3 bytes are the PVID) from a database VLAN filtering record */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag) | /* retrieves the VLAN tag (the lower 3 bytes are the PVID) from a database VLAN filtering record */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag) | {
HashNode *searchResult;
MacDescriptor *descriptor;
IX_ETH_DB_CHECK_REFERENCE(macAddr);
IX_ETH_DB_CHECK_REFERENCE(vlanTag);
searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_FILTERING_VLAN_RECORD);
if (searchResult == NULL)
{
return IX_ETH_DB_NO_SUCH_ADDR;
}
descriptor = (MacDescriptor *) searchResult->data;
*vlanTag = descriptor->recordData.filteringVlanData.ieee802_1qTag;
ixEthDBReleaseHashNode(searchResult);
return IX_ETH_DB_SUCCESS;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */ | blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data) | /* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data) | {
blt_addr base_addr;
if ((len - 1) > (FLASH_END_ADDRESS - addr))
{
return BLT_FALSE;
}
if ((addr < FLASH_START_ADDRESS) || ((addr+len-1) > FLASH_END_ADDRESS))
{
return BLT_FALSE;
}
base_addr = (addr/FLASH_WRITE_BLOCK_SIZE)*FLASH_WRITE_BLOCK_SIZE;
if (base_addr == flashLayout[0].sector_start)
{
return FlashAddToBlock(&bootBlockInfo, addr, data, len);
}
return FlashAddToBlock(&blockInfo, addr, data, len);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function needs to be visible for bootloaders. */ | static int mtdpart_setup(char *s) | /* This function needs to be visible for bootloaders. */
static int mtdpart_setup(char *s) | {
cmdline = s;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set I2C frequency.
In addition to Standard (100kHz) and Fast (400kHz) modes this peripheral also supports 250kHz mode. */ | void i2c_set_frequency(uint32_t i2c, uint32_t freq) | /* Set I2C frequency.
In addition to Standard (100kHz) and Fast (400kHz) modes this peripheral also supports 250kHz mode. */
void i2c_set_frequency(uint32_t i2c, uint32_t freq) | {
I2C_FREQUENCY(i2c) = freq;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* ADC Clear Overrun Flags.
The overrun flag is cleared. Note that if an overrun occurs, DMA is terminated. The flag must be cleared and the DMA stream and ADC reinitialised to resume conversions (see the reference manual). */ | void adc_clear_overrun_flag(uint32_t adc) | /* ADC Clear Overrun Flags.
The overrun flag is cleared. Note that if an overrun occurs, DMA is terminated. The flag must be cleared and the DMA stream and ADC reinitialised to resume conversions (see the reference manual). */
void adc_clear_overrun_flag(uint32_t adc) | {
ADC_SR(adc) &= ~ADC_SR_OVR;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Common used function. Transfer a complete command via usb_stor_bulk_transfer_sglist() above. Set cmnd resid */ | int usb_stor_bulk_srb(struct us_data *us, unsigned int pipe, struct scsi_cmnd *srb) | /* Common used function. Transfer a complete command via usb_stor_bulk_transfer_sglist() above. Set cmnd resid */
int usb_stor_bulk_srb(struct us_data *us, unsigned int pipe, struct scsi_cmnd *srb) | {
unsigned int partial;
int result = usb_stor_bulk_transfer_sglist(us, pipe, scsi_sglist(srb),
scsi_sg_count(srb), scsi_bufflen(srb),
&partial);
scsi_set_resid(srb, scsi_bufflen(srb) - partial);
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Sha384Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ | BOOLEAN EFIAPI Sha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue) | /* If Sha384Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue) | {
if ((Sha384Context == NULL) || (HashValue == NULL)) {
return FALSE;
}
return (BOOLEAN)(SHA384_Final (HashValue, (SHA512_CTX *)Sha384Context));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* state 0: finish printing this string and return (matched!) state 1: no matching to be done; print everything state 2: continue searching for matched name */ | static int printenv(char *name, int state) | /* state 0: finish printing this string and return (matched!) state 1: no matching to be done; print everything state 2: continue searching for matched name */
static int printenv(char *name, int state) | {
int i, j;
char c, buf[17];
i = 0;
buf[16] = '\0';
while (state && env_get_char(i) != '\0') {
if (state == 2 && envmatch((uchar *)name, i) >= 0)
state = 0;
j = 0;
do {
buf[j++] = c = env_get_char(i++);
if (j == sizeof(buf) - 1) {
if (state <= 1)
puts(buf);
j = 0;
}
} while (c != '\0');
if (state <= 1) {
if (j)
puts(buf);
putc('\n');
}
if (ctrlc())
return -1;
}
if (state == 0)
i = 0;
return i;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* The co-routine that reads the ADC and sends messages for display on the bottom row of the LCD. */ | static void prvADCCoRoutine(xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex) | /* The co-routine that reads the ADC and sends messages for display on the bottom row of the LCD. */
static void prvADCCoRoutine(xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex) | {
static unsigned long ulADCValue;
static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ];
static char *pcMessage;
static xLCDMessage xMessageToSend;
crSTART( xHandle );
for( ;; )
{
ADCProcessorTrigger( ADC_BASE, 0 ); crDELAY( xHandle, mainADC_DELAY );
ADCSequenceDataGet( ADC_BASE, 0, &ulADCValue ); sprintf( cMessageBuffer, "ADC = %d ", ulADCValue );
pcMessage = cMessageBuffer;
xMessageToSend.ppcMessageToDisplay = ( char** ) &pcMessage;
xMessageToSend.xRow = mainBOTTOM_ROW;
if( !xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ) )
{
uxErrorStatus = pdFAIL;
} }
crEND();
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* bfin_pm_enter - Actually enter a sleep state. @state: State we're entering. */ | static int bfin_pm_enter(suspend_state_t state) | /* bfin_pm_enter - Actually enter a sleep state. @state: State we're entering. */
static int bfin_pm_enter(suspend_state_t state) | {
switch (state) {
case PM_SUSPEND_STANDBY:
bfin_pm_suspend_standby_enter();
break;
case PM_SUSPEND_MEM:
bfin_pm_suspend_mem_enter();
break;
default:
return -EINVAL;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Copies read-only constants from sysMemory to CAU3's DataMemory.
cau3_initialize_read_only_data_memory */ | static status_t cau3_initialize_read_only_data_memory(CAU3_Type *base, const uint32_t *cau3ReadOnlyConstants, size_t cau3ReadOnlyConstantsBytes, cau3_task_done_t taskDone) | /* Copies read-only constants from sysMemory to CAU3's DataMemory.
cau3_initialize_read_only_data_memory */
static status_t cau3_initialize_read_only_data_memory(CAU3_Type *base, const uint32_t *cau3ReadOnlyConstants, size_t cau3ReadOnlyConstantsBytes, cau3_task_done_t taskDone) | {
status_t completionStatus;
base->CC_R[16] = (uint32_t)s_cau3ReadOnlyConstants;
base->CC_R[17] = s_cau3ReadOnlyConstantsBytes;
base->CC_R[18] = CAU3_DMEM_AES_RCON;
base->CC_R30 = CAU3_DMEM_STK_BASE;
base->CC_R31 = 0U;
base->CC_PC = CAU3_TASK_BLKLD_DMEM;
base->CC_CMD = taskDone;
completionStatus = cau3_process_task_completion(base, taskDone);
return (completionStatus);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Description: Remove all the NetLabel labeling from @sk. The caller is responsible for ensuring that @sk is locked. */ | void netlbl_sock_delattr(struct sock *sk) | /* Description: Remove all the NetLabel labeling from @sk. The caller is responsible for ensuring that @sk is locked. */
void netlbl_sock_delattr(struct sock *sk) | {
cipso_v4_sock_delattr(sk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Function for storing GATT Server & Client context. */ | static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const *p_block_handle, dm_handle_t const *p_handle) | /* Function for storing GATT Server & Client context. */
static __INLINE ret_code_t gattsc_context_store(pstorage_handle_t const *p_block_handle, dm_handle_t const *p_handle) | {
DM_LOG("[DM]: --> gattsc_context_store\r\n");
ret_code_t err_code = gatts_context_store(p_block_handle, p_handle);
if (NRF_SUCCESS == err_code)
{
err_code = gattc_context_store(p_block_handle, p_handle);
}
return err_code;
} | labapart/polymcu | C++ | null | 201 |
/* Allow the next untagged transaction for this target or target lun to be executed. We use a counting semaphore to allow the lock to be acquired recursively. Once the count drops to zero, the transaction queues will be run. */ | static void ahc_release_untagged_queues(struct ahc_softc *ahc) | /* Allow the next untagged transaction for this target or target lun to be executed. We use a counting semaphore to allow the lock to be acquired recursively. Once the count drops to zero, the transaction queues will be run. */
static void ahc_release_untagged_queues(struct ahc_softc *ahc) | {
if ((ahc->flags & AHC_SCB_BTT) == 0) {
ahc->untagged_queue_lock--;
if (ahc->untagged_queue_lock == 0)
ahc_run_untagged_queues(ahc);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is an abstraction layer for implementation specific Mm buffer validation routine. */ | BOOLEAN IsBufferOutsideMmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length) | /* This function is an abstraction layer for implementation specific Mm buffer validation routine. */
BOOLEAN IsBufferOutsideMmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length) | {
return MmIsBufferOutsideMmValid (Buffer, Length);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure the GPIO for the S3C2410 system, where we have external FETs connected to the device (later systems such as the S3C2440 integrate these into the device). */ | static void s3c2410_ts_connect(void) | /* Configure the GPIO for the S3C2410 system, where we have external FETs connected to the device (later systems such as the S3C2440 integrate these into the device). */
static void s3c2410_ts_connect(void) | {
s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);
s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPG13_nXPON);
s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes a 32-bit value to the given ITM stimulus register. */ | void am_hal_itm_stimulus_reg_word_write(uint32_t ui32StimReg, uint32_t ui32Value) | /* Writes a 32-bit value to the given ITM stimulus register. */
void am_hal_itm_stimulus_reg_word_write(uint32_t ui32StimReg, uint32_t ui32Value) | {
uint32_t ui32StimAddr;
ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
while (!AM_REGVAL(ui32StimAddr));
AM_REGVAL(ui32StimAddr) = ui32Value;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the IMU3000 sample rate.
The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */ | static bool imu3000_set_sample_rate(sensor_hal_t *hal, int16_t rate) | /* Set the IMU3000 sample rate.
The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */
static bool imu3000_set_sample_rate(sensor_hal_t *hal, int16_t rate) | {
uint16_t const internal_rate = (hal->bandwidth == 256) ? 8000 : 1000;
uint8_t const divider = (internal_rate / rate) - 1;
sensor_bus_put(hal, IMU3000_SMPLRT_DIV, divider);
return true;
} | memfault/zero-to-main | C++ | null | 200 |
/* If DhContext is NULL, then return FALSE. If PublicKeySize is NULL, then return FALSE. If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. */ | BOOLEAN EFIAPI DhGenerateKey(IN OUT VOID *DhContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize) | /* If DhContext is NULL, then return FALSE. If PublicKeySize is NULL, then return FALSE. If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. */
BOOLEAN EFIAPI DhGenerateKey(IN OUT VOID *DhContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize) | {
BOOLEAN RetVal;
DH *Dh;
BIGNUM *DhPubKey;
INTN Size;
if ((DhContext == NULL) || (PublicKeySize == NULL)) {
return FALSE;
}
if ((PublicKey == NULL) && (*PublicKeySize != 0)) {
return FALSE;
}
Dh = (DH *)DhContext;
RetVal = (BOOLEAN)DH_generate_key (DhContext);
if (RetVal) {
DH_get0_key (Dh, (const BIGNUM **)&DhPubKey, NULL);
Size = BN_num_bytes (DhPubKey);
if ((Size > 0) && (*PublicKeySize < (UINTN)Size)) {
*PublicKeySize = Size;
return FALSE;
}
if (PublicKey != NULL) {
BN_bn2bin (DhPubKey, PublicKey);
}
*PublicKeySize = Size;
}
return RetVal;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stop the reader thread (if it is running) */ | static int stop_reader(struct tip_cygwin *priv) | /* Stop the reader thread (if it is running) */
static int stop_reader(struct tip_cygwin *priv) | {
if (priv->tc_running == 1) {
int tries = 3;
priv->tc_running = 0;
while ((priv->tc_running != -1) && tries--)
sleep(1);
if (tries <= 0)
return -1;
}
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* USART IRQ handler.
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true. */ | void USART_Handler(void) | /* USART IRQ handler.
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true. */
void USART_Handler(void) | {
uint32_t ul_status;
ul_status = usart_get_status(BOARD_USART);
if ((ul_status & US_CSR_RXBUFF) && (g_uc_state == STATE_READ)) {
g_ul_recv_done = true;
usart_disable_interrupt(BOARD_USART, US_IDR_RXBUFF);
}
if ((ul_status & US_CSR_TXBUFE) && (g_uc_state == STATE_WRITE)) {
g_ul_sent_done = true;
usart_disable_interrupt(BOARD_USART, US_IDR_TXBUFE);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Called during start commit so locks are not needed. */ | int ubifs_get_idx_gc_leb(struct ubifs_info *c) | /* Called during start commit so locks are not needed. */
int ubifs_get_idx_gc_leb(struct ubifs_info *c) | {
struct ubifs_gced_idx_leb *idx_gc;
int lnum;
if (list_empty(&c->idx_gc))
return -ENOSPC;
idx_gc = list_entry(c->idx_gc.next, struct ubifs_gced_idx_leb, list);
lnum = idx_gc->lnum;
list_del(&idx_gc->list);
kfree(idx_gc);
return lnum;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 if invalid in the specified regulatory domain, non-zero if valid. */ | static int iw_valid_channel(int reg_domain, int channel) | /* Returns 0 if invalid in the specified regulatory domain, non-zero if valid. */
static int iw_valid_channel(int reg_domain, int channel) | {
int i, rc = 0;
for (i = 0; i < ARRAY_SIZE(iw_channel_table); i++)
if (reg_domain == iw_channel_table[i].reg_domain) {
rc = channel >= iw_channel_table[i].min &&
channel <= iw_channel_table[i].max;
break;
}
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Initializes the domain hash table, should be called only by netlbl_user_init() during initialization. Returns zero on success, non-zero values on error. */ | int __init netlbl_domhsh_init(u32 size) | /* Description: Initializes the domain hash table, should be called only by netlbl_user_init() during initialization. Returns zero on success, non-zero values on error. */
int __init netlbl_domhsh_init(u32 size) | {
u32 iter;
struct netlbl_domhsh_tbl *hsh_tbl;
if (size == 0)
return -EINVAL;
hsh_tbl = kmalloc(sizeof(*hsh_tbl), GFP_KERNEL);
if (hsh_tbl == NULL)
return -ENOMEM;
hsh_tbl->size = 1 << size;
hsh_tbl->tbl = kcalloc(hsh_tbl->size,
sizeof(struct list_head),
GFP_KERNEL);
if (hsh_tbl->tbl == NULL) {
kfree(hsh_tbl);
return -ENOMEM;
}
for (iter = 0; iter < hsh_tbl->size; iter++)
INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
spin_lock(&netlbl_domhsh_lock);
rcu_assign_pointer(netlbl_domhsh, hsh_tbl);
spin_unlock(&netlbl_domhsh_lock);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */ | status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count) | /* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */
status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count) | {
assert(handle != NULL);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->state != (uint8_t)kLPSPI_Busy)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
size_t remainingByte;
if (handle->rxData != NULL)
{
remainingByte = handle->rxRemainingByteCount;
}
else
{
remainingByte = handle->txRemainingByteCount;
}
*count = handle->totalByteCount - remainingByte;
return kStatus_Success;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function returns the CBFC status data for each of the Traffic Classes. */ | s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count) | /* This function returns the CBFC status data for each of the Traffic Classes. */
s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count) | {
s32 ret = 0;
if (hw->mac.type == ixgbe_mac_82598EB)
ret = ixgbe_dcb_get_pfc_stats_82598(hw, stats, tc_count);
else if (hw->mac.type == ixgbe_mac_82599EB)
ret = ixgbe_dcb_get_pfc_stats_82599(hw, stats, tc_count);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable interrupts in I2O controller and then free interrupt. */ | static void i2o_pci_irq_disable(struct i2o_controller *c) | /* Disable interrupts in I2O controller and then free interrupt. */
static void i2o_pci_irq_disable(struct i2o_controller *c) | {
writel(0xffffffff, c->irq_mask);
if (c->pdev->irq > 0)
free_irq(c->pdev->irq, c);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the MAC address set by this function is currently enabled, it remains enabled following this call. Similarly, any filter configured for the MAC address remains unaffected by a change in the address. */ | void EMACAddrSet(uint32_t ui32Base, uint32_t ui32Index, const uint8_t *pui8MACAddr) | /* If the MAC address set by this function is currently enabled, it remains enabled following this call. Similarly, any filter configured for the MAC address remains unaffected by a change in the address. */
void EMACAddrSet(uint32_t ui32Base, uint32_t ui32Index, const uint8_t *pui8MACAddr) | {
ASSERT(ui32Index < NUM_MAC_ADDR);
ASSERT(pui8MACAddr);
HWREG(ui32Base + EMAC_O_ADDRH(ui32Index)) =
((HWREG(ui32Base + EMAC_O_ADDRH(ui32Index)) & 0xFFFF0000) |
pui8MACAddr[4] | (pui8MACAddr[5] << 8));
HWREG(ui32Base + EMAC_O_ADDRL(ui32Index)) =
(pui8MACAddr[0] | (pui8MACAddr[1] << 8) | (pui8MACAddr[2] << 16) |
(pui8MACAddr[3] << 24));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered. */ | int register_pernet_subsys(struct pernet_operations *ops) | /* When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered. */
int register_pernet_subsys(struct pernet_operations *ops) | {
int error;
mutex_lock(&net_mutex);
error = register_pernet_operations(first_device, ops);
mutex_unlock(&net_mutex);
return error;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable I2C module of the specified I2C port.
The */ | void I2CEnable(unsigned long ulBase) | /* Enable I2C module of the specified I2C port.
The */
void I2CEnable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_O_CON) |= I2C_CON_ENS1;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Description: Reads the first sector from the device and returns %0x42 bytes starting at offset %0x1be. Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error. */ | unsigned char* scsi_bios_ptable(struct block_device *dev) | /* Description: Reads the first sector from the device and returns %0x42 bytes starting at offset %0x1be. Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error. */
unsigned char* scsi_bios_ptable(struct block_device *dev) | {
unsigned char *res = kmalloc(66, GFP_KERNEL);
if (res) {
struct block_device *bdev = dev->bd_contains;
Sector sect;
void *data = read_dev_sector(bdev, 0, §);
if (data) {
memcpy(res, data + 0x1be, 66);
put_dev_sector(sect);
} else {
kfree(res);
res = NULL;
}
}
return res;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables an usb device interface (UDI) This routine calls the UDI corresponding to the interface and setting number. */ | static bool udc_iface_enable(void) | /* Enables an usb device interface (UDI) This routine calls the UDI corresponding to the interface and setting number. */
static bool udc_iface_enable(void) | {
return udi_dfu_atmel_enable();
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Set DAC Channel Waveform Generation mode for one or both channels. These signals are superimposed on existing output values in the DAC output registers. Waveform can be disabled, noise, triangular, or sawtooth, depending on family. */ | void dac_set_waveform_generation(uint32_t dac, int channel, enum dac_wave wave) | /* Set DAC Channel Waveform Generation mode for one or both channels. These signals are superimposed on existing output values in the DAC output registers. Waveform can be disabled, noise, triangular, or sawtooth, depending on family. */
void dac_set_waveform_generation(uint32_t dac, int channel, enum dac_wave wave) | {
uint32_t reg = DAC_CR(dac);
switch(channel) {
case DAC_CHANNEL1:
reg &= ~(DAC_CR_WAVEx_MASK << DAC_CR_WAVE1_SHIFT);
reg |= wave << DAC_CR_WAVE1_SHIFT;
break;
case DAC_CHANNEL2:
reg &= ~(DAC_CR_WAVEx_MASK << DAC_CR_WAVE2_SHIFT);
reg |= wave << DAC_CR_WAVE2_SHIFT;
break;
case DAC_CHANNEL_BOTH:
reg &= ~(DAC_CR_WAVEx_MASK << DAC_CR_WAVE1_SHIFT)
| ~(DAC_CR_WAVEx_MASK << DAC_CR_WAVE2_SHIFT);
reg |= wave << DAC_CR_WAVE1_SHIFT;
reg |= wave << DAC_CR_WAVE2_SHIFT;
break;
default:
break;
}
DAC_CR(dac) = reg;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Send a master receive request when the bus is idle.(Read Step1)
For this function returns immediately, it is always using in the interrupt hander. */ | void xI2CMasterReadRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, xtBoolean bEndTransmition) | /* Send a master receive request when the bus is idle.(Read Step1)
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_CON) |= I2C_CON_AA;
ulStatus = I2CStartSend(ulBase);
if(!((ulStatus == I2C_I2STAT_M_TX_START) ||
(ulStatus == I2C_I2STAT_M_TX_RESTART)))
{
I2CStopSend(ulBase);
return ;
}
ulStatus = I2CByteSend(ulBase, (ucSlaveAddr << 1) | 1) ;
if(!(ulStatus == I2C_I2STAT_M_RX_SLAR_ACK))
{
I2CStopSend(ulBase);
return ;
}
if(bEndTransmition)
{
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_AA;
I2CStopSend(ulBase);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Note: This is slightly racy. It is possible that if the user requests the addition of another device then the target won't be removed. */ | void scsi_remove_target(struct device *dev) | /* Note: This is slightly racy. It is possible that if the user requests the addition of another device then the target won't be removed. */
void scsi_remove_target(struct device *dev) | {
struct device *rdev;
if (scsi_is_target_device(dev)) {
__scsi_remove_target(to_scsi_target(dev));
return;
}
rdev = get_device(dev);
device_for_each_child(dev, NULL, __remove_child);
put_device(rdev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* configure the free watchdog timer counter reload value */ | ErrStatus fwdgt_reload_value_config(uint16_t reload_value) | /* configure the free watchdog timer counter reload value */
ErrStatus fwdgt_reload_value_config(uint16_t reload_value) | {
uint32_t timeout = FWDGT_RLD_TIMEOUT;
uint32_t flag_status = RESET;
FWDGT_CTL = FWDGT_WRITEACCESS_ENABLE;
do{
flag_status = FWDGT_STAT & FWDGT_STAT_RUD;
}while((--timeout > 0U) && ((uint32_t)RESET != flag_status));
if ((uint32_t)RESET != flag_status){
return ERROR;
}
FWDGT_RLD = RLD_RLD(reload_value);
return SUCCESS;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the FLASH Prefetch Buffer status is set or not. */ | FlagStatus FLASH_GetPrefetchBufferStatus(void) | /* Checks whether the FLASH Prefetch Buffer status is set or not. */
FlagStatus FLASH_GetPrefetchBufferStatus(void) | {
FlagStatus bitstatus = RESET;
if ((FLASH->ACR & ACR_PRFTBS_Mask) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Retrieve the common name (CN) string from one X.509 certificate. */ | RETURN_STATUS EFIAPI X509GetCommonName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *CommonName OPTIONAL, IN OUT UINTN *CommonNameSize) | /* Retrieve the common name (CN) string from one X.509 certificate. */
RETURN_STATUS EFIAPI X509GetCommonName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *CommonName OPTIONAL, IN OUT UINTN *CommonNameSize) | {
CALL_CRYPTO_SERVICE (X509GetCommonName, (Cert, CertSize, CommonName, CommonNameSize), RETURN_UNSUPPORTED);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Indication from FS-Cache that the cookie is no longer cached */ | static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) | /* Indication from FS-Cache that the cookie is no longer cached */
static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) | {
struct nfs_inode *nfsi = cookie_netfs_data;
struct pagevec pvec;
pgoff_t first;
int loop, nr_pages;
pagevec_init(&pvec, 0);
first = 0;
dprintk("NFS: nfs_inode_now_uncached: nfs_inode 0x%p\n", nfsi);
for (;;) {
nr_pages = pagevec_lookup(&pvec,
nfsi->vfs_inode.i_mapping,
first,
PAGEVEC_SIZE - pagevec_count(&pvec));
if (!nr_pages)
break;
for (loop = 0; loop < nr_pages; loop++)
ClearPageFsCache(pvec.pages[loop]);
first = pvec.pages[nr_pages - 1]->index + 1;
pvec.nr = nr_pages;
pagevec_release(&pvec);
cond_resched();
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Output: void, will modify proto_tree if not null. */ | static void dissect_lsp_instance_identifier_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length) | /* Output: void, will modify proto_tree if not null. */
static void dissect_lsp_instance_identifier_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length) | {
isis_dissect_instance_identifier_clv(tree, pinfo, tvb, &ei_isis_lsp_short_packet, hf_isis_lsp_instance_identifier, hf_isis_lsp_supported_itid, offset, length);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* USB Device HID Configure Callback Parameters: None Return Value: None */ | void USBD_HID_Configure_Event(void) | /* USB Device HID Configure Callback Parameters: None Return Value: None */
void USBD_HID_Configure_Event(void) | {
USBD_HID_Protocol = 0;
DataOutAsyncReq = __FALSE;
DataOutUpdateReqMask = __FALSE;
ptrDataOut = NULL;
DataOutToSendLen = 0;
DataOutSentLen = 0;
DataOutEndWithShortPacket = __FALSE;
ptrDataIn = NULL;
DataInReceMax = 0;
DataInReceLen = 0;
ptrDataFeat = NULL;
DataFeatReceLen = 0;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Trim the leading and trailing spaces for a give Unicode string. */ | CHAR16* TrimString(IN CHAR16 *String) | /* Trim the leading and trailing spaces for a give Unicode string. */
CHAR16* TrimString(IN CHAR16 *String) | {
CHAR16 *TempString;
for ( ; *String != L'\0' && *String == L' '; String++) {
}
TempString = String + StrLen (String) - 1;
while ((TempString >= String) && (*TempString == L' ')) {
TempString--;
}
*(TempString + 1) = L'\0';
return String;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This should be called with a NULL @procfn when a module unregisters, thus preventing kernel crashes and other such nastiness. */ | void mca_set_adapter_procfn(int slot, MCA_ProcFn procfn, void *proc_dev) | /* This should be called with a NULL @procfn when a module unregisters, thus preventing kernel crashes and other such nastiness. */
void mca_set_adapter_procfn(int slot, MCA_ProcFn procfn, void *proc_dev) | {
struct mca_device *mca_dev = mca_find_device_by_slot(slot);
if(!mca_dev)
return;
mca_dev->procfn = procfn;
mca_dev->proc_dev = proc_dev;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */ | void PMC_EnablePeripheral(unsigned int id) | /* Enables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */
void PMC_EnablePeripheral(unsigned int id) | {
SANITY_CHECK(id < 32);
if ((AT91C_BASE_PMC->PMC_PCSR & (1 << id)) == (1 << id)) {
TRACE_INFO("PMC_EnablePeripheral: clock of peripheral"
" %u is already enabled\n\r",
id);
}
else {
AT91C_BASE_PMC->PMC_PCER = 1 << id;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* rport_api.c Remote port implementation. fcs_rport_api FCS rport API. Direct API to add a target by port wwn. This interface is used, for example, by bios when target pwwn is known from boot lun configuration. */ | bfa_status_t bfa_fcs_rport_add(struct bfa_fcs_port_s *port, wwn_t *pwwn, struct bfa_fcs_rport_s *rport, struct bfad_rport_s *rport_drv) | /* rport_api.c Remote port implementation. fcs_rport_api FCS rport API. Direct API to add a target by port wwn. This interface is used, for example, by bios when target pwwn is known from boot lun configuration. */
bfa_status_t bfa_fcs_rport_add(struct bfa_fcs_port_s *port, wwn_t *pwwn, struct bfa_fcs_rport_s *rport, struct bfad_rport_s *rport_drv) | {
bfa_trc(port->fcs, *pwwn);
return BFA_STATUS_OK;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector22_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector22_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (22 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Init interrupts callback for the PWM Fault Brake. */ | void FBIntCallbackInit(unsigned long ulBase, xtEventCallback xtFBCallback) | /* Init interrupts callback for the PWM Fault Brake. */
void FBIntCallbackInit(unsigned long ulBase, xtEventCallback xtFBCallback) | {
xASSERT(ulBase == PWMA_BASE);
if (xtFBCallback != 0)
{
g_pfnFBHandlerCallbacks[0] = xtFBCallback;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function returns true if the icon button is the one currently selected within its icon button group. */ | bool wtk_icon_button_is_selected(struct wtk_icon_button const *icon_button) | /* This function returns true if the icon button is the one currently selected within its icon button group. */
bool wtk_icon_button_is_selected(struct wtk_icon_button const *icon_button) | {
Assert(icon_button);
return (icon_button->group->selected == icon_button);
} | memfault/zero-to-main | C++ | null | 200 |
/* Forces the TIMx output 1 waveform to active or inactive level. */ | void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | /* Forces the TIMx output 1 waveform to active or inactive level. */
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= CCMR_OC13M_Mask;
tmpccmr1 |= TIM_ForcedAction;
TIMx->CCMR1 = tmpccmr1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Only use DMI information to set this if nothing was passed on the kernel command line (which was parsed earlier). */ | static int __devinit set_bf_sort(const struct dmi_system_id *d) | /* Only use DMI information to set this if nothing was passed on the kernel command line (which was parsed earlier). */
static int __devinit set_bf_sort(const struct dmi_system_id *d) | {
if (pci_bf_sort == pci_bf_sort_default) {
pci_bf_sort = pci_dmi_bf;
printk(KERN_INFO "PCI: %s detected, enabling pci=bfsort.\n", d->ident);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ | uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt) | /* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt) | {
uint32_t i;
volatile uint32_t *ptr;
uint32_t *dataptr;
ptr = GetEpCmdStatPtr(EPNum);
EPNum &= ~USB_IN_MASK;
while (*ptr & EP_BUF_ACTIVE);
uint32_t cmdstat = *ptr;
cmdstat &= ~(EP_NBYTES_MASK | EP_BUF_OFFSET_MASK);
cmdstat |= BUF_ADDR(EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr) | N_BYTES(cnt);
*ptr = cmdstat;
dataptr = (uint32_t *)EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr;
memcpy(dataptr, pData, cnt);
if (EPNum && (*ptr & EP_STALL)) {
return (0);
}
*ptr |= EP_BUF_ACTIVE;
return (cnt);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Cleans up the connector but doesn't free the object. */ | void drm_connector_cleanup(struct drm_connector *connector) | /* Cleans up the connector but doesn't free the object. */
void drm_connector_cleanup(struct drm_connector *connector) | {
struct drm_device *dev = connector->dev;
struct drm_display_mode *mode, *t;
list_for_each_entry_safe(mode, t, &connector->probed_modes, head)
drm_mode_remove(connector, mode);
list_for_each_entry_safe(mode, t, &connector->modes, head)
drm_mode_remove(connector, mode);
list_for_each_entry_safe(mode, t, &connector->user_modes, head)
drm_mode_remove(connector, mode);
kfree(connector->fb_helper_private);
mutex_lock(&dev->mode_config.mutex);
drm_mode_object_put(dev, &connector->base);
list_del(&connector->head);
mutex_unlock(&dev->mode_config.mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* TLS Extensions (in Client Hello and Server Hello). }}} */ | gboolean ssl_is_valid_content_type(guint8 type) | /* TLS Extensions (in Client Hello and Server Hello). }}} */
gboolean ssl_is_valid_content_type(guint8 type) | {
switch ((ContentType) type) {
case SSL_ID_CHG_CIPHER_SPEC:
case SSL_ID_ALERT:
case SSL_ID_HANDSHAKE:
case SSL_ID_APP_DATA:
case SSL_ID_HEARTBEAT:
return TRUE;
}
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Register a new SDIO function with the driver model. */ | int sdio_add_func(struct sdio_func *func) | /* Register a new SDIO function with the driver model. */
int sdio_add_func(struct sdio_func *func) | {
int ret;
dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num);
ret = device_add(&func->dev);
if (ret == 0)
sdio_func_set_present(func);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */ | static int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | /* Big-endian to little-endian byte-swapping/bitmaps by David S. Miller ( */
static int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | {
int err = ufs_add_link(dentry, inode);
if (!err) {
d_instantiate(dentry, inode);
return 0;
}
inode_dec_link_count(inode);
iput(inode);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset the long press state of an input device */ | void lv_indev_reset_long_press(lv_indev_t *indev) | /* Reset the long press state of an input device */
void lv_indev_reset_long_press(lv_indev_t *indev) | {
indev->proc.long_pr_sent = 0;
indev->proc.longpr_rep_timestamp = lv_tick_get();
indev->proc.pr_timestamp = lv_tick_get();
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Message: UnSubscribeDtmfPayloadResMessage Opcode: 0x012d Type: CallControl Direction: pbx2dev VarLength: no */ | static void handle_UnSubscribeDtmfPayloadResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: UnSubscribeDtmfPayloadResMessage Opcode: 0x012d Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_UnSubscribeDtmfPayloadResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_payloadDtmf, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_passthruPartyID, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clear whether the specified DMA flag is set or not. */ | void DMA_ClearStatusFlag(uint32_t flag) | /* Clear whether the specified DMA flag is set or not. */
void DMA_ClearStatusFlag(uint32_t flag) | {
if ((flag & 0x10000000) == SET)
{
DMA2->INTFCLR |= (uint32_t)(flag & 0x000FFFFF);
}
else
{
DMA1->INTFCLR |= (uint32_t)(flag & 0x0FFFFFFF);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RNG MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng) | /* RNG MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng) | {
if(hrng->Instance==RNG)
{
__HAL_RCC_RNG_CLK_DISABLE();
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Initializes the RTC used to display the help message. */ | static void ui_display_init_rtc(void) | /* Initializes the RTC used to display the help message. */
static void ui_display_init_rtc(void) | {
irq_register_handler(display_rtc_irq, DISPLAY_RTC_IRQ,
DISPLAY_RTC_IRQ_PRIORITY);
rtc_init(&AVR32_RTC, RTC_OSC_32KHZ, RTC_PSEL_32KHZ_1HZ - 1);
rtc_enable_wake_up(&AVR32_RTC);
rtc_set_top_value(&AVR32_RTC, 0);
rtc_enable_interrupt(&AVR32_RTC);
rtc_enable(&AVR32_RTC);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* 64-bit file support on 64-bit platforms by Jakub Jelinek ( */ | static int ext3_release_file(struct inode *inode, struct file *filp) | /* 64-bit file support on 64-bit platforms by Jakub Jelinek ( */
static int ext3_release_file(struct inode *inode, struct file *filp) | {
if (EXT3_I(inode)->i_state & EXT3_STATE_FLUSH_ON_CLOSE) {
filemap_flush(inode->i_mapping);
EXT3_I(inode)->i_state &= ~EXT3_STATE_FLUSH_ON_CLOSE;
}
if ((filp->f_mode & FMODE_WRITE) &&
(atomic_read(&inode->i_writecount) == 1))
{
mutex_lock(&EXT3_I(inode)->truncate_mutex);
ext3_discard_reservation(inode);
mutex_unlock(&EXT3_I(inode)->truncate_mutex);
}
if (is_dx(inode) && filp->private_data)
ext3_htree_free_dir_info(filp->private_data);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A packet has just been enqueued on the empty class. cbq_activate_class adds it to the tail of active class list of its priority band. */ | static __inline__ void cbq_activate_class(struct cbq_class *cl) | /* A packet has just been enqueued on the empty class. cbq_activate_class adds it to the tail of active class list of its priority band. */
static __inline__ void cbq_activate_class(struct cbq_class *cl) | {
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
int prio = cl->cpriority;
struct cbq_class *cl_tail;
cl_tail = q->active[prio];
q->active[prio] = cl;
if (cl_tail != NULL) {
cl->next_alive = cl_tail->next_alive;
cl_tail->next_alive = cl;
} else {
cl->next_alive = cl;
q->activemask |= (1<<prio);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable the interrupt mode for the selected IO pin(s). */ | void stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin) | /* Enable the interrupt mode for the selected IO pin(s). */
void stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin) | {
uint8_t tmpData[2] = {0 , 0};
stmpe1600_EnableGlobalIT(DeviceAddr);
IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, tmpData, 2);
tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
tmp |= (uint16_t)IO_Pin;
IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, (uint8_t *)&tmp, 2);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get packet duplication correlation probability of netem qdisc. */ | int rtnl_netem_get_duplicate_correlation(struct rtnl_qdisc *qdisc) | /* Get packet duplication correlation probability of netem qdisc. */
int rtnl_netem_get_duplicate_correlation(struct rtnl_qdisc *qdisc) | {
struct rtnl_netem *netem;
netem = netem_qdisc(qdisc);
if (netem && (netem->qnm_mask & SCH_NETEM_ATTR_DUP_CORR))
return netem->qnm_corr.nmc_duplicate;
else
return -NLE_NOATTR;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* +CSQ: <rssi>,<ber> rssi: 0,-115dBm; 1,-111dBm; 2...30,-110...-54dBm; 31,-52dBm or greater. 99, ukn ber: Not used. */ | MODEM_CMD_DEFINE(on_cmd_csq) | /* +CSQ: <rssi>,<ber> rssi: 0,-115dBm; 1,-111dBm; 2...30,-110...-54dBm; 31,-52dBm or greater. 99, ukn ber: Not used. */
MODEM_CMD_DEFINE(on_cmd_csq) | {
int rssi = atoi(argv[0]);
if (rssi == 0) {
mdata.mdm_rssi = -115;
} else if (rssi == 1) {
mdata.mdm_rssi = -111;
} else if (rssi > 1 && rssi < 31) {
mdata.mdm_rssi = -114 + 2 * rssi;
} else if (rssi == 31) {
mdata.mdm_rssi = -52;
} else {
mdata.mdm_rssi = -1000;
}
LOG_INF("RSSI: %d", mdata.mdm_rssi);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* A pointer to the device with the incremented reference counter is returned. */ | struct usb_device* usb_get_dev(struct usb_device *dev) | /* A pointer to the device with the incremented reference counter is returned. */
struct usb_device* usb_get_dev(struct usb_device *dev) | {
if (dev)
get_device(&dev->dev);
return dev;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Derive SHA256 HMAC-based Extract key Derivation Function (HKDF). */ | BOOLEAN EFIAPI CryptoServiceHkdfSha256Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize) | /* Derive SHA256 HMAC-based Extract key Derivation Function (HKDF). */
BOOLEAN EFIAPI CryptoServiceHkdfSha256Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize) | {
return CALL_BASECRYPTLIB (Hkdf.Services.Sha256Extract, HkdfSha256Extract, (Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Calculate the week number for the given date (9 January = week 2) */ | err_t rtcGetWeekNumber(rtcTime_t *t, uint8_t *weekNumber) | /* Calculate the week number for the given date (9 January = week 2) */
err_t rtcGetWeekNumber(rtcTime_t *t, uint8_t *weekNumber) | {
uint32_t NrOfDay = rtcGetEpochDate(t->years, 1, 1);
uint8_t nextMondayDay = 8 - NrOfDay;
if ((t->months == 1) && (t->days < nextMondayDay))
{
*weekNumber = 1;
}
else
{
*weekNumber = (rtcGetEpochDate(t->years, t->months, t->days)
- rtcGetEpochDate(t->years, 1, nextMondayDay)) / 7 + 2;
}
return ERROR_NONE;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* wait until HXTAL stabilization flag is SET, or HXTAL startup is timeout */ | ErrStatus rcu_hxtal_stab_wait(void) | /* wait until HXTAL stabilization flag is SET, or HXTAL startup is timeout */
ErrStatus rcu_hxtal_stab_wait(void) | {
FlagStatus hxtal_stat = RESET;
uint32_t stb_cnt = 0;
while((RESET == hxtal_stat) && (HXTAL_STARTUP_TIMEOUT != stb_cnt++)){
hxtal_stat = rcu_flag_get(RCU_FLAG_HXTALSTB);
}
if(RESET != rcu_flag_get(RCU_FLAG_HXTALSTB)){
return SUCCESS;
}else{
return ERROR;
}
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Selects the clock source to output on MCO pin (PA8). */ | void RCC_MCOConfig(uint8_t RCC_MCOSource) | /* Selects the clock source to output on MCO pin (PA8). */
void RCC_MCOConfig(uint8_t RCC_MCOSource) | {
assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource));
*(__IO uint8_t *) CFGR_BYTE3_ADDRESS = RCC_MCOSource;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* HID class driver callback function for the processing of HID reports from the host. */ | void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize) | /* HID class driver callback function for the processing of HID reports from the host. */
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize) | {
uint8_t* Data = (uint8_t*)ReportData;
uint8_t NewLEDMask = LEDS_NO_LEDS;
if (Data[0])
NewLEDMask |= LEDS_LED1;
if (Data[1])
NewLEDMask |= LEDS_LED2;
if (Data[2])
NewLEDMask |= LEDS_LED3;
if (Data[3])
NewLEDMask |= LEDS_LED4;
LEDs_SetAllLEDs(NewLEDMask);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Reverses the effect of usb_hcd_omap_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ | static void usb_hcd_omap_remove(struct usb_hcd *hcd, struct platform_device *pdev) | /* Reverses the effect of usb_hcd_omap_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
static void usb_hcd_omap_remove(struct usb_hcd *hcd, struct platform_device *pdev) | {
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
usb_remove_hcd(hcd);
if (ohci->transceiver) {
(void) otg_set_host(ohci->transceiver, 0);
put_device(ohci->transceiver->dev);
}
if (machine_is_omap_osk())
gpio_free(9);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
clk_put(usb_dc_ck);
clk_put(usb_host_ck);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* XXX - This may be possible with iconv or similar */ | static int iseries_UNICODE_to_ASCII(guint8 *buf, guint bytes) | /* XXX - This may be possible with iconv or similar */
static int iseries_UNICODE_to_ASCII(guint8 *buf, guint bytes) | {
guint i;
guint8 *bufptr;
bufptr = buf;
for (i = 0; i < bytes; i++)
{
switch (buf[i])
{
case 0xFE:
case 0xFF:
case 0x00:
break;
default:
*bufptr = buf[i];
bufptr++;
}
if (buf[i] == 0x0A)
return i;
}
return i;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Wait for a period for the RTC to be ready. */ | EFI_STATUS RtcWaitToUpdate(UINTN Timeout) | /* Wait for a period for the RTC to be ready. */
EFI_STATUS RtcWaitToUpdate(UINTN Timeout) | {
RTC_REGISTER_A RegisterA;
RTC_REGISTER_D RegisterD;
RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D);
if (RegisterD.Bits.Vrt == 0) {
return EFI_DEVICE_ERROR;
}
Timeout = (Timeout / 10) + 1;
RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A);
while (RegisterA.Bits.Uip == 1 && Timeout > 0) {
MicroSecondDelay (10);
RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A);
Timeout--;
}
RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D);
if ((Timeout == 0) || (RegisterD.Bits.Vrt == 0)) {
return EFI_DEVICE_ERROR;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* handle remote file deletion by discarding the callback promise */ | static void afs_vnode_deleted_remotely(struct afs_vnode *vnode) | /* handle remote file deletion by discarding the callback promise */
static void afs_vnode_deleted_remotely(struct afs_vnode *vnode) | {
struct afs_server *server;
_enter("{%p}", vnode->server);
set_bit(AFS_VNODE_DELETED, &vnode->flags);
server = vnode->server;
if (server) {
if (vnode->cb_promised) {
spin_lock(&server->cb_lock);
if (vnode->cb_promised) {
rb_erase(&vnode->cb_promise,
&server->cb_promises);
vnode->cb_promised = false;
}
spin_unlock(&server->cb_lock);
}
spin_lock(&server->fs_lock);
rb_erase(&vnode->server_rb, &server->fs_vnodes);
spin_unlock(&server->fs_lock);
vnode->server = NULL;
afs_put_server(server);
} else {
ASSERT(!vnode->cb_promised);
}
_leave("");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1 is returned and errno will be set. */ | gint g_mkstemp(gchar *tmpl) | /* Returns: A file handle (as from open()) to the file opened for reading and writing. The file is opened in binary mode on platforms where there is a difference. The file handle should be closed with close(). In case of errors, -1 is returned and errno will be set. */
gint g_mkstemp(gchar *tmpl) | {
return g_mkstemp_full (tmpl, O_RDWR | O_BINARY, 0600);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Try and send the packet on the end of the data and other data queues. Other data gets priority over data, and if we retransmit a packet we reduce the window by dividing it in two. */ | void dn_nsp_output(struct sock *sk) | /* Try and send the packet on the end of the data and other data queues. Other data gets priority over data, and if we retransmit a packet we reduce the window by dividing it in two. */
void dn_nsp_output(struct sock *sk) | {
struct dn_scp *scp = DN_SK(sk);
struct sk_buff *skb;
unsigned reduce_win = 0;
if ((skb = skb_peek(&scp->other_xmit_queue)) != NULL)
reduce_win = dn_nsp_clone_and_send(skb, GFP_ATOMIC);
if (reduce_win || (scp->flowrem_sw != DN_SEND))
goto recalc_window;
if ((skb = skb_peek(&scp->data_xmit_queue)) != NULL)
reduce_win = dn_nsp_clone_and_send(skb, GFP_ATOMIC);
recalc_window:
if (reduce_win) {
scp->snd_window >>= 1;
if (scp->snd_window < NSP_MIN_WINDOW)
scp->snd_window = NSP_MIN_WINDOW;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize the control hot-key with the specified items. */ | EFI_STATUS ControlHotKeyInit(IN MENU_ITEM_FUNCTION *Items) | /* Initialize the control hot-key with the specified items. */
EFI_STATUS ControlHotKeyInit(IN MENU_ITEM_FUNCTION *Items) | {
ControlBasedMenuFunctions = Items;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The next group of settings selects the source for the DIVSCLK. */ | void SysCtlClockOutConfig(uint32_t ui32Config, uint32_t ui32Div) | /* The next group of settings selects the source for the DIVSCLK. */
void SysCtlClockOutConfig(uint32_t ui32Config, uint32_t ui32Div) | {
ASSERT(ui32Div != 0);
ASSERT((ui32Config & ~(SYSCTL_CLKOUT_EN | SYSCTL_CLKOUT_DIS |
SYSCTL_CLKOUT_SYSCLK | SYSCTL_CLKOUT_PIOSC |
SYSCTL_CLKOUT_MOSC)) == 0);
HWREG(SYSCTL_DIVSCLK) = ui32Config | ((ui32Div - 1) &
SYSCTL_DIVSCLK_DIV_M);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* tlsv1_server_established - Check whether connection has been established @conn: TLSv1 server connection data from tlsv1_server_init() Returns: 1 if connection is established, 0 if not */ | int tlsv1_server_established(struct tlsv1_server *conn) | /* tlsv1_server_established - Check whether connection has been established @conn: TLSv1 server connection data from tlsv1_server_init() Returns: 1 if connection is established, 0 if not */
int tlsv1_server_established(struct tlsv1_server *conn) | {
return conn->state == ESTABLISHED;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Maximum duration is the maximum time of an over threshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */ | int32_t lsm6dso_tap_shock_set(lsm6dso_ctx_t *ctx, uint8_t val) | /* Maximum duration is the maximum time of an over threshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */
int32_t lsm6dso_tap_shock_set(lsm6dso_ctx_t *ctx, uint8_t val) | {
lsm6dso_int_dur2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t*)®, 1);
if (ret == 0) {
reg.shock = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t*)®, 1);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ | int main(void) | /* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void) | {
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
Keyboard_HID_Task();
Mouse_HID_Task();
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Put a page from RAM to the framebuffer. */ | void gfx_mono_framebuffer_put_page(gfx_mono_color_t *data, gfx_coord_t page, gfx_coord_t column, gfx_coord_t width) | /* Put a page from RAM to the framebuffer. */
void gfx_mono_framebuffer_put_page(gfx_mono_color_t *data, gfx_coord_t page, gfx_coord_t column, gfx_coord_t width) | {
gfx_mono_color_t *data_pt = data;
gfx_coord_t *framebuffer_pt = fbpointer +
((page * GFX_MONO_LCD_WIDTH) + column);
do {
*framebuffer_pt++ = *data_pt++;
} while (--width > 0);
} | memfault/zero-to-main | C++ | null | 200 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ | UINT64 EFIAPI S3MmioAndThenOr64(IN UINTN Address, IN UINT64 AndData, IN UINT64 OrData) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI S3MmioAndThenOr64(IN UINTN Address, IN UINT64 AndData, IN UINT64 OrData) | {
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioAndThenOr64 (Address, AndData, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* NAND_NCE: bit 0 - don't care NAND_CLE: bit 1 - address bit 2 NAND_ALE: bit 2 - address bit 3 */ | static void h1910_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) | /* NAND_NCE: bit 0 - don't care NAND_CLE: bit 1 - address bit 2 NAND_ALE: bit 2 - address bit 3 */
static void h1910_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) | {
struct nand_chip *chip = mtd->priv;
if (cmd != NAND_CMD_NONE)
writeb(cmd, chip->IO_ADDR_W | ((ctrl & 0x6) << 1));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This access is abstracted from the PCD services to enforce that the PCD be FixedAtBuild in the Standalone MM build of this driver. */ | UINT32 GetCpuMaxLogicalProcessorNumber(VOID) | /* This access is abstracted from the PCD services to enforce that the PCD be FixedAtBuild in the Standalone MM build of this driver. */
UINT32 GetCpuMaxLogicalProcessorNumber(VOID) | {
return FixedPcdGet32 (PcdCpuMaxLogicalProcessorNumber);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* close a DMA channel and its associated interrupt */ | void frv_dma_close(int dma) | /* close a DMA channel and its associated interrupt */
void frv_dma_close(int dma) | {
struct frv_dma_channel *channel = &frv_dma_channels[dma];
unsigned long flags;
write_lock_irqsave(&frv_dma_channels_lock, flags);
free_irq(channel->irq, channel);
frv_dma_stop(dma);
channel->flags &= ~FRV_DMA_FLAGS_INUSE;
write_unlock_irqrestore(&frv_dma_channels_lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the Check sum for a short name. */ | UINT8 FatCheckSum(IN CHAR8 *ShortNameString) | /* Get the Check sum for a short name. */
UINT8 FatCheckSum(IN CHAR8 *ShortNameString) | {
UINTN ShortNameLen;
UINT8 Sum;
Sum = 0;
for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
}
return Sum;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the DMA Tx Desc padding for frame shorter than 64 bytes. */ | void ETH_EnableDmaTxDescShortFramePadding(ETH_DMADescType *DMATxDesc, FunctionalState Cmd) | /* Enables or disables the DMA Tx Desc padding for frame shorter than 64 bytes. */
void ETH_EnableDmaTxDescShortFramePadding(ETH_DMADescType *DMATxDesc, FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DMATxDesc->CtrlOrBufSize &= (~(uint32_t)ETH_DMA_TX_DESC_DP);
}
else
{
DMATxDesc->CtrlOrBufSize |= ETH_DMA_TX_DESC_DP;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the error status of the I2C Master module. */ | unsigned long I2CMasterErr(unsigned long ulBase) | /* Gets the error status of the I2C Master module. */
unsigned long I2CMasterErr(unsigned long ulBase) | {
unsigned long ulErr;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
ulErr = xHWREG(ulBase + I2C_CSR);
if(ulErr & (I2C_CSR_ARBLOS | I2C_CSR_RXNACK | I2C_CSR_BUSERR))
{
return(ulErr & (I2C_CSR_ARBLOS | I2C_CSR_RXNACK | I2C_CSR_BUSERR));
}
else
{
return(I2C_MASTER_ERR_NONE);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Registers the event callback functions that should be called by the CAN interface. */ | static void PCanUsbRegisterEvents(tCanEvents const *events) | /* Registers the event callback functions that should be called by the CAN interface. */
static void PCanUsbRegisterEvents(tCanEvents const *events) | {
assert(events != NULL);
if (events != NULL)
{
pCanUsbEventsList = realloc(pCanUsbEventsList,
(sizeof(tCanEvents) * (pCanUsbEventsEntries + 1)));
assert(pCanUsbEventsList != NULL);
if (pCanUsbEventsList != NULL)
{
pCanUsbEventsEntries++;
pCanUsbEventsList[pCanUsbEventsEntries - 1] = *events;
}
else
{
pCanUsbEventsEntries = 0;
}
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.