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
|
|---|---|---|---|---|---|---|---|
/* Get the LPS22HH pressure data ready bit value. */
|
int32_t LPS22HH_PRESS_Get_DRDY_Status(LPS22HH_Object_t *pObj, uint8_t *Status)
|
/* Get the LPS22HH pressure data ready bit value. */
int32_t LPS22HH_PRESS_Get_DRDY_Status(LPS22HH_Object_t *pObj, uint8_t *Status)
|
{
if (lps22hh_press_flag_data_ready_get(&(pObj->Ctx), Status) != LPS22HH_OK)
{
return LPS22HH_ERROR;
}
return LPS22HH_OK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Derive SHA384 HMAC-based Extract-and-Expand Key Derivation Function (HKDF). */
|
BOOLEAN EFIAPI HkdfSha384ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
|
/* Derive SHA384 HMAC-based Extract-and-Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha384ExtractAndExpand(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
|
{
return HkdfMdExtractAndExpand (MBEDTLS_MD_SHA384, Key, KeySize, Salt, SaltSize, Info, InfoSize, Out, OutSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is called during driver unload. We do the pci_disable_msi here, not in generic code, because it isn't used for the HT chips. If we do end up needing pci_enable_msi at some point in the future for HT, we'll move the call back into the main init_one code. */
|
static void ipath_setup_pe_cleanup(struct ipath_devdata *dd)
|
/* This is called during driver unload. We do the pci_disable_msi here, not in generic code, because it isn't used for the HT chips. If we do end up needing pci_enable_msi at some point in the future for HT, we'll move the call back into the main init_one code. */
static void ipath_setup_pe_cleanup(struct ipath_devdata *dd)
|
{
dd->ipath_msi_lo = 0;
pci_disable_msi(dd->pcidev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Receive a piece of data for ECSPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
|
static void ECSPI_ReceiveTransfer(ECSPI_Type *base, ecspi_master_handle_t *handle)
|
/* Receive a piece of data for ECSPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
static void ECSPI_ReceiveTransfer(ECSPI_Type *base, ecspi_master_handle_t *handle)
|
{
assert(base);
uint32_t dataCounts = 0U;
dataCounts =
(ECSPI_GetRxFifoCount(base) < handle->rxRemainingBytes) ? ECSPI_GetRxFifoCount(base) : handle->rxRemainingBytes;
ECSPI_ReadNonBlocking(base, handle->rxData, dataCounts);
if (NULL != handle->rxData)
{
handle->rxData += dataCounts;
}
handle->rxRemainingBytes -= dataCounts;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Checks whether the FLASH Read out Protection Status is set or not. */
|
FlagStatus FLASH_OB_GetRDP(void)
|
/* Checks whether the FLASH Read out Protection Status is set or not. */
FlagStatus FLASH_OB_GetRDP(void)
|
{
FlagStatus readstatus = RESET;
if ((uint8_t)(FLASH->OBR) != (uint8_t)OB_RDP_Level_0)
{
readstatus = SET;
}
else
{
readstatus = RESET;
}
return readstatus;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Called on file .release to update the default rules with a complete new policy. Once updated, the policy is locked, no additional rules can be added to the policy. */
|
void ima_update_policy(void)
|
/* Called on file .release to update the default rules with a complete new policy. Once updated, the policy is locked, no additional rules can be added to the policy. */
void ima_update_policy(void)
|
{
const char *op = "policy_update";
const char *cause = "already exists";
int result = 1;
int audit_info = 0;
if (ima_measure == &measure_default_rules) {
ima_measure = &measure_policy_rules;
cause = "complete";
result = 0;
}
integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL,
NULL, op, cause, result, audit_info);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Work out how many blocks we need to proceed with the next chunk of a truncate transaction. */
|
static unsigned long blocks_for_truncate(struct inode *inode)
|
/* Work out how many blocks we need to proceed with the next chunk of a truncate transaction. */
static unsigned long blocks_for_truncate(struct inode *inode)
|
{
unsigned long needed;
needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9);
if (needed < 2)
needed = 2;
if (needed > EXT3_MAX_TRANS_DATA)
needed = EXT3_MAX_TRANS_DATA;
return EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + needed;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return value 0 in case of success, otherwise non-zero */
|
static int pmcraid_setup_chrdev(struct pmcraid_instance *pinstance)
|
/* Return value 0 in case of success, otherwise non-zero */
static int pmcraid_setup_chrdev(struct pmcraid_instance *pinstance)
|
{
int minor;
int error;
minor = pmcraid_get_minor();
cdev_init(&pinstance->cdev, &pmcraid_fops);
pinstance->cdev.owner = THIS_MODULE;
error = cdev_add(&pinstance->cdev, MKDEV(pmcraid_major, minor), 1);
if (error)
pmcraid_release_minor(minor);
else
device_create(pmcraid_class, NULL, MKDEV(pmcraid_major, minor),
NULL, "pmcsas%u", minor);
return error;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the HTS221 humidity data ready bit value. */
|
int32_t HTS221_HUM_Get_DRDY_Status(HTS221_Object_t *pObj, uint8_t *Status)
|
/* Get the HTS221 humidity data ready bit value. */
int32_t HTS221_HUM_Get_DRDY_Status(HTS221_Object_t *pObj, uint8_t *Status)
|
{
if (hts221_hum_data_ready_get(&(pObj->Ctx), Status) != HTS221_OK)
{
return HTS221_ERROR;
}
return HTS221_OK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* fc_exch_mgr_list_clone() - Share all exchange manager objects @src: Source lport to clone exchange managers from @dst: New lport that takes references to all the exchange managers */
|
int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst)
|
/* fc_exch_mgr_list_clone() - Share all exchange manager objects @src: Source lport to clone exchange managers from @dst: New lport that takes references to all the exchange managers */
int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst)
|
{
struct fc_exch_mgr_anchor *ema, *tmp;
list_for_each_entry(ema, &src->ema_list, ema_list) {
if (!fc_exch_mgr_add(dst, ema->mp, ema->match))
goto err;
}
return 0;
err:
list_for_each_entry_safe(ema, tmp, &dst->ema_list, ema_list)
fc_exch_mgr_del(ema);
return -ENOMEM;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 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();
puts_P(PSTR(ESC_FG_CYAN "Mouse Host/Device Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
if (USB_CurrentMode == USB_MODE_Host)
{
MouseHost_Task();
HID_Host_USBTask(&Mouse_HID_Host_Interface);
}
else
{
HID_Device_USBTask(&Mouse_HID_Device_Interface);
}
USB_USBTask();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* finds the end of the current frame in the bitstream. */
|
static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
|
/* finds the end of the current frame in the bitstream. */
static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
|
{
for(i=0; i<buf_size; i++){
state= (state<<8) | buf[i];
if(state == 0xFFD8){
i++;
vop_found=1;
break;
}
}
}
if(vop_found){
if (buf_size == 0)
return 0;
for(; i<buf_size; i++){
state= (state<<8) | buf[i];
if(state == 0xFFD8){
pc->frame_start_found=0;
pc->state=0;
return i-1;
}
}
}
pc->frame_start_found= vop_found;
pc->state= state;
return END_NOT_FOUND;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Set the current calendar time to desired time.
Sets the time provided to the calendar. */
|
void rtc_calendar_set_time(struct rtc_module *const module, const struct rtc_calendar_time *const time)
|
/* Set the current calendar time to desired time.
Sets the time provided to the calendar. */
void rtc_calendar_set_time(struct rtc_module *const module, const struct rtc_calendar_time *const time)
|
{
Assert(module);
Assert(module->hw);
Rtc *const rtc_module = module->hw;
uint32_t register_value = rtc_calendar_time_to_register_value(module, time);
while (rtc_calendar_is_syncing(module)) {
}
rtc_module->MODE2.CLOCK.reg = register_value;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* This function handles external line 13 interrupt request. */
|
void USER_BUTTON_IRQHANDLER(void)
|
/* This function handles external line 13 interrupt request. */
void USER_BUTTON_IRQHANDLER(void)
|
{
if(LL_EXTI_IsActiveFlag_0_31(USER_BUTTON_EXTI_LINE) != RESET)
{
LL_EXTI_ClearFlag_0_31(USER_BUTTON_EXTI_LINE);
UserButton_Callback();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* NOT IMPLEMENTED configure_dma - It configures the DMA pipes for DMA transfers @data: SSP driver's private data structure */
|
static int configure_dma(void *data)
|
/* NOT IMPLEMENTED configure_dma - It configures the DMA pipes for DMA transfers @data: SSP driver's private data structure */
static int configure_dma(void *data)
|
{
struct pl022 *pl022 = data;
dev_dbg(&pl022->adev->dev, "configure DMA\n");
return -ENOTSUPP;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function does not create any image files. */
|
void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top)
|
/* This function does not create any image files. */
void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top)
|
{
bdrv_swap(bs_new, bs_top);
bs_top->backing_hd = bs_new;
bs_top->open_flags &= ~BDRV_O_NO_BACKING;
pstrcpy(bs_top->backing_file, sizeof(bs_top->backing_file),
bs_new->filename);
pstrcpy(bs_top->backing_format, sizeof(bs_top->backing_format),
bs_new->drv ? bs_new->drv->format_name : "");
}
|
ve3wwg/teensy3_qemu
|
C
|
Other
| 15
|
/* Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice */
|
double tan(double x)
|
/* Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice */
double tan(double x)
|
{
double y[2],z=0.0;
int32_t n, ix;
GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff;
if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1);
else if (ix>=0x7ff00000) return x-x;
else {
n = __ieee754_rem_pio2(x,y);
return __kernel_tan(y[0],y[1],1-((n&1)<<1));
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* 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)
|
{
status = SD_NOT_PRESENT;
}
return status;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Reset ACMP to same state as after a HW reset. */
|
void ACMP_Reset(ACMP_TypeDef *acmp)
|
/* Reset ACMP to same state as after a HW reset. */
void ACMP_Reset(ACMP_TypeDef *acmp)
|
{
EFM_ASSERT(ACMP_REF_VALID(acmp));
acmp->CTRL = _ACMP_CTRL_RESETVALUE;
acmp->INPUTSEL = _ACMP_INPUTSEL_RESETVALUE;
acmp->IEN = _ACMP_IEN_RESETVALUE;
acmp->IFC = _ACMP_IF_MASK;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* DAC Channel Output Mode.
Each DAC channel can be configured in Normal mode or Sample and hold mode. The output buffer can be enabled to allow a high drive capability. Before enabling output buffer, the voltage offset needs to be calibrated. This calibration is performed at the factory (loaded after reset) and can be adjusted by software during application operation. */
|
void dac_set_mode(uint32_t dac, uint32_t mode)
|
/* DAC Channel Output Mode.
Each DAC channel can be configured in Normal mode or Sample and hold mode. The output buffer can be enabled to allow a high drive capability. Before enabling output buffer, the voltage offset needs to be calibrated. This calibration is performed at the factory (loaded after reset) and can be adjusted by software during application operation. */
void dac_set_mode(uint32_t dac, uint32_t mode)
|
{
DAC_MCR(dac) |= mode;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* General errors are reported with an console message in TShark. */
|
static void failure_message(const char *msg_format, va_list ap)
|
/* General errors are reported with an console message in TShark. */
static void failure_message(const char *msg_format, va_list ap)
|
{
fprintf(stderr, "tshark: ");
vfprintf(stderr, msg_format, ap);
fprintf(stderr, "\n");
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Draws a string inside a LCD buffer, at the given coordinates. Line breaks will be honored. */
|
void LCDD_DrawString(void *pBuffer, unsigned int x, unsigned int y, const char *pString, unsigned int color)
|
/* Draws a string inside a LCD buffer, at the given coordinates. Line breaks will be honored. */
void LCDD_DrawString(void *pBuffer, unsigned int x, unsigned int y, const char *pString, unsigned int color)
|
{
unsigned xorg = x;
while (*pString != 0) {
if (*pString == '\n') {
y += gFont.height + 2;
x = xorg;
}
else {
LCDD_DrawChar(pBuffer, x, y, *pString, color);
x += gFont.width + 2;
}
pString++;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Handle write events to the control point cccd. */
|
static void on_ctrl_pt_cccd_write(ble_lns_t *p_lns, ble_gatts_evt_write_t const *p_evt_write)
|
/* Handle write events to the control point cccd. */
static void on_ctrl_pt_cccd_write(ble_lns_t *p_lns, ble_gatts_evt_write_t const *p_evt_write)
|
{
if (p_evt_write->len == BLE_CCCD_VALUE_LEN)
{
if (p_lns->evt_handler != NULL)
{
ble_lns_evt_t evt;
if (ble_srv_is_indication_enabled(p_evt_write->data))
{
evt.evt_type = BLE_LNS_CTRLPT_EVT_INDICATION_ENABLED;;
}
else
{
evt.evt_type = BLE_LNS_CTRLPT_EVT_INDICATION_DISABLED;;
}
p_lns->evt_handler(p_lns, &evt);
}
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* qstring_destroy_obj(): Free all memory allocated by a QString object */
|
static void qstring_destroy_obj(QObject *obj)
|
/* qstring_destroy_obj(): Free all memory allocated by a QString object */
static void qstring_destroy_obj(QObject *obj)
|
{
QString *qs;
assert(obj != NULL);
qs = qobject_to_qstring(obj);
g_free(qs->string);
g_free(qs);
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Enable smartcard module UART mode and set baudrate.
HIDDEN_SYMBOLS */
|
uint32_t SCUART_Open(SC_T *sc, uint32_t u32Baudrate)
|
/* Enable smartcard module UART mode and set baudrate.
HIDDEN_SYMBOLS */
uint32_t SCUART_Open(SC_T *sc, uint32_t u32Baudrate)
|
{
uint32_t u32ClkFreq = SCUART_GetClock(sc), u32Div;
u32Div = (u32ClkFreq + (u32Baudrate >> 1) - 1UL) / u32Baudrate - 1UL;
sc->CTL = SC_CTL_SCEN_Msk | SC_CTL_NSB_Msk;
sc->UARTCTL = SCUART_CHAR_LEN_8 | SCUART_PARITY_NONE | SC_UARTCTL_UARTEN_Msk;
sc->ETUCTL = u32Div;
return (u32ClkFreq / (u32Div + 1UL));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disables LIN Function mode on the specified UART. */
|
void UARTLINDisable(unsigned long ulBase)
|
/* Disables LIN Function mode on the specified UART. */
void UARTLINDisable(unsigned long ulBase)
|
{
xASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) ||
(ulBase == UART2_BASE) );
xHWREGB(ulBase + UART_012_S2) &= (unsigned char)(~UART_012_S2_LBKDE);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Returns TRUE is interrupts are currently enabled. Otherwise returns FALSE. */
|
BOOLEAN EFIAPI GetInterruptState(VOID)
|
/* Returns TRUE is interrupts are currently enabled. Otherwise returns FALSE. */
BOOLEAN EFIAPI GetInterruptState(VOID)
|
{
IA32_EFLAGS32 EFlags;
EFlags.UintN = AsmReadEflags ();
return (BOOLEAN)(1 == EFlags.Bits.IF);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Insert an entry into the cache. Taken from print-nfs.c */
|
static void rx_cache_insert(netdissect_options *, const u_char *, const struct ip *, int)
|
/* Insert an entry into the cache. Taken from print-nfs.c */
static void rx_cache_insert(netdissect_options *, const u_char *, const struct ip *, int)
|
{
struct rx_cache_entry *rxent;
const struct rx_header *rxh = (const struct rx_header *) bp;
if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t)))
return;
rxent = &rx_cache[rx_cache_next];
if (++rx_cache_next >= RX_CACHE_SIZE)
rx_cache_next = 0;
rxent->callnum = EXTRACT_32BITS(&rxh->callNumber);
UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t));
UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t));
rxent->dport = dport;
rxent->serviceId = EXTRACT_32BITS(&rxh->serviceId);
rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns the number of Tx descriptors needed for the given offload packet. These packets are already fully constructed. */
|
static unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
|
/* Returns the number of Tx descriptors needed for the given offload packet. These packets are already fully constructed. */
static unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
|
{
unsigned int flits, cnt;
if (skb->len <= WR_LEN)
return 1;
flits = skb_transport_offset(skb) / 8;
cnt = skb_shinfo(skb)->nr_frags;
if (skb->tail != skb->transport_header)
cnt++;
return flits_to_desc(flits + sgl_len(cnt));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* PCNT register synchronization freeze control.
Some PCNT registers require synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled). */
|
void PCNT_FreezeEnable(PCNT_TypeDef *pcnt, bool enable)
|
/* PCNT register synchronization freeze control.
Some PCNT registers require synchronization into the low frequency (LF) domain. The freeze feature allows for several such registers to be modified before passing them to the LF domain simultaneously (which takes place when the freeze mode is disabled). */
void PCNT_FreezeEnable(PCNT_TypeDef *pcnt, bool enable)
|
{
EFM_ASSERT(PCNT_REF_VALID(pcnt));
if (enable)
{
while (pcnt->SYNCBUSY)
;
pcnt->FREEZE = PCNT_FREEZE_REGFREEZE;
}
else
{
pcnt->FREEZE = 0;
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Attempt to release the private state associated with a page */
|
static int nfs_release_page(struct page *page, gfp_t gfp)
|
/* Attempt to release the private state associated with a page */
static int nfs_release_page(struct page *page, gfp_t gfp)
|
{
dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
if ((gfp & GFP_KERNEL) == GFP_KERNEL)
nfs_wb_page(page->mapping->host, page);
if (PagePrivate(page))
return 0;
return nfs_fscache_release_page(page, gfp);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enables or disables the specified I2C general call feature. */
|
void I2C_GeneralCallCmd(I2C_TypeDef *i2c, FunctionalState state)
|
/* Enables or disables the specified I2C general call feature. */
void I2C_GeneralCallCmd(I2C_TypeDef *i2c, FunctionalState state)
|
{
(state) ? (i2c->IC_TAR |= I2C_TAR_SPECIAL) : (i2c->IC_TAR &= ~I2C_TAR_SPECIAL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get Transmission buffering mode @rmtoll CR TXMODE LL_SWPMI_GetTransmissionMode. */
|
uint32_t LL_SWPMI_GetTransmissionMode(SWPMI_TypeDef *SWPMIx)
|
/* Get Transmission buffering mode @rmtoll CR TXMODE LL_SWPMI_GetTransmissionMode. */
uint32_t LL_SWPMI_GetTransmissionMode(SWPMI_TypeDef *SWPMIx)
|
{
return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_TXMODE));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Zero counters in a service or all services */
|
static int ip_vs_zero_service(struct ip_vs_service *svc)
|
/* Zero counters in a service or all services */
static int ip_vs_zero_service(struct ip_vs_service *svc)
|
{
struct ip_vs_dest *dest;
write_lock_bh(&__ip_vs_svc_lock);
list_for_each_entry(dest, &svc->destinations, n_list) {
ip_vs_zero_stats(&dest->stats);
}
ip_vs_zero_stats(&svc->stats);
write_unlock_bh(&__ip_vs_svc_lock);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Internal callback function for the system timer.
Internal function that is called from the system timer. It gets our parameter from timer data and sends it to user function. */
|
static void app_timer_callback(TimerHandle_t xTimer)
|
/* Internal callback function for the system timer.
Internal function that is called from the system timer. It gets our parameter from timer data and sends it to user function. */
static void app_timer_callback(TimerHandle_t xTimer)
|
{
app_timer_info_t * pinfo = (app_timer_info_t*)(pvTimerGetTimerID(xTimer));
ASSERT(pinfo->osHandle == xTimer);
ASSERT(pinfo->func != NULL);
if(pinfo->active)
pinfo->func(pinfo->argument);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* This function returns UBI device description object for UBI device number @ubi_num, or NULL if the device does not exist. This function increases the device reference count to prevent removal of the device. In other words, the device cannot be removed if its reference count is not zero. */
|
struct ubi_device* ubi_get_device(int ubi_num)
|
/* This function returns UBI device description object for UBI device number @ubi_num, or NULL if the device does not exist. This function increases the device reference count to prevent removal of the device. In other words, the device cannot be removed if its reference count is not zero. */
struct ubi_device* ubi_get_device(int ubi_num)
|
{
struct ubi_device *ubi;
spin_lock(&ubi_devices_lock);
ubi = ubi_devices[ubi_num];
if (ubi) {
ubi_assert(ubi->ref_count >= 0);
ubi->ref_count += 1;
get_device(&ubi->dev);
}
spin_unlock(&ubi_devices_lock);
return ubi;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Checks if RF Field is present in front of the ST25DV. */
|
int32_t ST25DV_GetRFField_Dyn(ST25DV_Object_t *pObj, ST25DV_FIELD_STATUS *const pRF_Field)
|
/* Checks if RF Field is present in front of the ST25DV. */
int32_t ST25DV_GetRFField_Dyn(ST25DV_Object_t *pObj, ST25DV_FIELD_STATUS *const pRF_Field)
|
{
int32_t status;
uint8_t reg_value = 0;
status = st25dv_get_eh_ctrl_dyn_field_on(&(pObj->Ctx), ®_value );
if( status == ST25DV_OK )
{
if( reg_value )
{
*pRF_Field = ST25DV_FIELD_ON;
}
else
{
*pRF_Field = ST25DV_FIELD_OFF;
}
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* yaffs_get_handle Increase use of handle when reading/writing a file Also gets the file descriptor. */
|
static int yaffsfs_GetHandle(int handle)
|
/* yaffs_get_handle Increase use of handle when reading/writing a file Also gets the file descriptor. */
static int yaffsfs_GetHandle(int handle)
|
{
struct yaffsfs_Handle *h = yaffsfs_HandleToPointer(handle);
if (h && h->useCount > 0) {
h->useCount++;
return 0;
}
return -1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Return: 0 if all went ok, else return appropriate error */
|
static int k3_arm64_start(struct udevice *dev)
|
/* Return: 0 if all went ok, else return appropriate error */
static int k3_arm64_start(struct udevice *dev)
|
{
struct k3_arm64_privdata *rproc = dev_get_priv(dev);
int ret;
dev_dbg(dev, "%s\n", __func__);
ret = power_domain_on(&rproc->gtc_pwrdmn);
if (ret) {
dev_err(dev, "power_domain_on() failed: %d\n", ret);
return ret;
}
writel(GTC_CNTR_EN, rproc->gtc_base + GTC_CNTCR_REG);
ret = power_domain_on(&rproc->rproc_pwrdmn);
if (ret) {
dev_err(dev, "power_domain_on() failed: %d\n", ret);
return ret;
}
return ti_sci_proc_release(&rproc->tsp);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
|
void DAC_Init(DAC_InitType *DAC_InitStruct)
|
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(DAC_InitType *DAC_InitStruct)
|
{
uint32_t tmpreg1 = 0, tmpreg2 = 0;
assert_param(IS_DAC_TRIGGER(DAC_InitStruct->Trigger));
assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->WaveGen));
assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->LfsrUnMaskTriAmp));
assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->BufferOutput));
tmpreg1 = DAC->CTRL;
tmpreg1 &= ~(CTRL_CLEAR_MASK );
tmpreg2 = (DAC_InitStruct->Trigger | DAC_InitStruct->WaveGen | DAC_InitStruct->LfsrUnMaskTriAmp
| DAC_InitStruct->BufferOutput);
tmpreg1 |= tmpreg2 ;
DAC->CTRL = tmpreg1;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Initiates a write packet operation without sending a STOP condition when done.
This is the non-blocking equivalent of i2c_master_write_packet_wait_no_stop. */
|
enum status_code i2c_master_write_packet_job_no_stop(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
|
/* Initiates a write packet operation without sending a STOP condition when done.
This is the non-blocking equivalent of i2c_master_write_packet_wait_no_stop. */
enum status_code i2c_master_write_packet_job_no_stop(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
|
{
Assert(module);
Assert(module->hw);
Assert(packet);
if (module->buffer_remaining > 0) {
return STATUS_BUSY;
}
module->no_stop = true;
return _i2c_master_write_packet(module, packet);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI X509GetVersion(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Version)
|
/* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI X509GetVersion(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Version)
|
{
CALL_CRYPTO_SERVICE (X509GetVersion, (Cert, CertSize, Version), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read data from FIFO and thow it away */
|
static void fifo_read_and_throw(usbd_device *dev, unsigned bytes)
|
/* Read data from FIFO and thow it away */
static void fifo_read_and_throw(usbd_device *dev, unsigned bytes)
|
{
register uint32_t tmp __attribute__((unused));
while (bytes >= 4) {
tmp = REBASE(DWC_OTG_FIFO, 0);
bytes -= 4;
}
if (bytes) {
tmp = REBASE(DWC_OTG_FIFO, 0);
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* XXX Keep a usecount in the clockdomain code */
|
int omap_hwmod_add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
|
/* XXX Keep a usecount in the clockdomain code */
int omap_hwmod_add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
|
{
return _add_initiator_dep(oh, init_oh);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Find and reuse, or create if it does not exist, an upvalue at the given level. */
|
UpVal* luaF_findupval(lua_State *L, StkId level)
|
/* Find and reuse, or create if it does not exist, an upvalue at the given level. */
UpVal* luaF_findupval(lua_State *L, StkId level)
|
{
lua_assert(!isdead(G(L), p));
if (uplevel(p) == level)
return p;
pp = &p->u.open.next;
}
return newupval(L, 0, level, pp);
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This function enables the pressure sensor and temperature sensor */
|
static int drv_baro_bosch_bmp380_enable_pressure_temp(i2c_dev_t *drv)
|
/* This function enables the pressure sensor and temperature sensor */
static int drv_baro_bosch_bmp380_enable_pressure_temp(i2c_dev_t *drv)
|
{
int ret = 0;
uint8_t value = 0x00;
ret = sensor_i2c_read(drv, BMP380_PWR_CTRL_ADDR, &value, I2C_DATA_LEN, I2C_OP_RETRIES);
if (unlikely(ret) != 0) {
return ret;
}
value = BMP380_SET_BITSLICE(value,BMP380_PRESS_EN,BMP380_PRESS_ENABLED);
value = BMP380_SET_BITSLICE(value,BMP380_TEMP_EN,BMP380_TEMP_ENABLED);
ret = sensor_i2c_write(drv, BMP380_PWR_CTRL_ADDR, &value, I2C_DATA_LEN, I2C_OP_RETRIES);
aos_msleep(2);
if (unlikely(ret) != 0) {
return ret;
}
return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Because our performance depends on our ability to do write combining mmio writes in the most efficient way, we need to know if we are on an Intel or AMD x86_64 processor. AMD x86_64 processors flush WC buffers out in the order completed, and so no special flushing is required to get correct ordering. Intel processors, however, will flush write buffers out in "random" orders, and so explicit ordering is needed at times. */
|
int ipath_unordered_wc(void)
|
/* Because our performance depends on our ability to do write combining mmio writes in the most efficient way, we need to know if we are on an Intel or AMD x86_64 processor. AMD x86_64 processors flush WC buffers out in the order completed, and so no special flushing is required to get correct ordering. Intel processors, however, will flush write buffers out in "random" orders, and so explicit ordering is needed at times. */
int ipath_unordered_wc(void)
|
{
return boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the size of buffer if the buffer is found, or zero if not found. */
|
size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
|
/* Returns the size of buffer if the buffer is found, or zero if not found. */
size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
|
{
struct snd_mem_list *mem;
if (WARN_ON(!dmab))
return 0;
mutex_lock(&list_mutex);
list_for_each_entry(mem, &mem_list_head, list) {
if (mem->id == id &&
(mem->buffer.dev.dev == NULL || dmab->dev.dev == NULL ||
! memcmp(&mem->buffer.dev, &dmab->dev, sizeof(dmab->dev)))) {
struct device *dev = dmab->dev.dev;
list_del(&mem->list);
*dmab = mem->buffer;
if (dmab->dev.dev == NULL)
dmab->dev.dev = dev;
kfree(mem);
mutex_unlock(&list_mutex);
return dmab->bytes;
}
}
mutex_unlock(&list_mutex);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and stops the library USB task management process. */
|
void EVENT_USB_Host_DeviceUnattached(void)
|
/* Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and stops the library USB task management process. */
void EVENT_USB_Host_DeviceUnattached(void)
|
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Increase the offset of the firmware configuration item without transferring bytes between the item and a caller-provided buffer. Subsequent read, write or skip operations will commence at the increased offset. */
|
VOID EFIAPI QemuFwCfgSkipBytes(IN UINTN Size)
|
/* Increase the offset of the firmware configuration item without transferring bytes between the item and a caller-provided buffer. Subsequent read, write or skip operations will commence at the increased offset. */
VOID EFIAPI QemuFwCfgSkipBytes(IN UINTN Size)
|
{
if (QemuFwCfgIsAvailable ()) {
InternalQemuFwCfgSkipBytes (Size);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Convert char to special encode format (GBK, UNICODE, ...) */
|
uint16_t char_convert(uint16_t src_char, uint32_t type)
|
/* Convert char to special encode format (GBK, UNICODE, ...) */
uint16_t char_convert(uint16_t src_char, uint32_t type)
|
{
uint16_t dst_char;
if(src_char < 0x80)
{
STRING_CONVERT_LOGI("%s ascii %d\n", __func__, src_char);
return src_char;
}
switch(type)
{
case UNICODE_TO_GBK:
dst_char = unicode_to_gbk(src_char);
break;
case GBK_TO_UNICODE:
default:
dst_char = 0;
break;
}
STRING_CONVERT_LOGI("%s ascii %d\n", __func__, dst_char);
return dst_char;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Note that g_signal_emit_by_name() resets the return value to the default if no handlers are connected, in contrast to g_signal_emitv(). */
|
void g_signal_emit_by_name(gpointer instance, const gchar *detailed_signal,...)
|
/* Note that g_signal_emit_by_name() resets the return value to the default if no handlers are connected, in contrast to g_signal_emitv(). */
void g_signal_emit_by_name(gpointer instance, const gchar *detailed_signal,...)
|
{
GQuark detail = 0;
guint signal_id;
GType itype;
g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));
g_return_if_fail (detailed_signal != NULL);
itype = G_TYPE_FROM_INSTANCE (instance);
SIGNAL_LOCK ();
signal_id = signal_parse_name (detailed_signal, itype, &detail, TRUE);
SIGNAL_UNLOCK ();
if (signal_id)
{
va_list var_args;
va_start (var_args, detailed_signal);
g_signal_emit_valist (instance, signal_id, detail, var_args);
va_end (var_args);
}
else
g_warning ("%s: signal name '%s' is invalid for instance '%p' of type '%s'",
G_STRLOC, detailed_signal, instance, g_type_name (itype));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==LPUART1)
{
__HAL_RCC_LPUART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, LPUART1_TX_Pin|LPUART1_RX_Pin);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI CryptoServiceHmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize)
|
/* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize)
|
{
return CALL_BASECRYPTLIB (HmacSha256.Services.Update, HmacSha256Update, (HmacSha256Context, Data, DataSize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Starts final checksum computation.
Configures the CRC module for the specified CRC protocol. */
|
static void CRC_SetProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig)
|
/* Starts final checksum computation.
Configures the CRC module for the specified CRC protocol. */
static void CRC_SetProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig)
|
{
crc_module_config_t moduleConfig;
moduleConfig.polynomial = protocolConfig->polynomial;
moduleConfig.seed = protocolConfig->seed;
moduleConfig.readTranspose = CRC_GetTransposeTypeFromReflectOut(protocolConfig->reflectOut);
moduleConfig.writeTranspose = CRC_GetTransposeTypeFromReflectIn(protocolConfig->reflectIn);
moduleConfig.complementChecksum = protocolConfig->complementChecksum;
moduleConfig.crcBits = protocolConfig->crcBits;
CRC_ConfigureAndStart(base, &moduleConfig);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Search the state->lock_states for an existing lock_owner that is compatible with current->files */
|
static struct nfs4_lock_state* __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
|
/* Search the state->lock_states for an existing lock_owner that is compatible with current->files */
static struct nfs4_lock_state* __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
|
{
struct nfs4_lock_state *pos;
list_for_each_entry(pos, &state->lock_states, ls_locks) {
if (pos->ls_owner != fl_owner)
continue;
atomic_inc(&pos->ls_count);
return pos;
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* look find the first ordered struct that has this offset, otherwise the first one less than this offset */
|
static struct rb_node* tree_search(struct btrfs_ordered_inode_tree *tree, u64 file_offset)
|
/* look find the first ordered struct that has this offset, otherwise the first one less than this offset */
static struct rb_node* tree_search(struct btrfs_ordered_inode_tree *tree, u64 file_offset)
|
{
struct rb_root *root = &tree->tree;
struct rb_node *prev;
struct rb_node *ret;
struct btrfs_ordered_extent *entry;
if (tree->last) {
entry = rb_entry(tree->last, struct btrfs_ordered_extent,
rb_node);
if (offset_in_entry(entry, file_offset))
return tree->last;
}
ret = __tree_search(root, file_offset, &prev);
if (!ret)
ret = prev;
if (ret)
tree->last = ret;
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */
|
UINTN EFIAPI Sha256GetContextSize(VOID)
|
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */
UINTN EFIAPI Sha256GetContextSize(VOID)
|
{
return (UINTN)(sizeof (SHA256_CTX));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* SECTION: external block device operations (request queue handling, open, release, etc.) Dasd request queue function. Called from ll_rw_blk.c */
|
static void do_dasd_request(struct request_queue *queue)
|
/* SECTION: external block device operations (request queue handling, open, release, etc.) Dasd request queue function. Called from ll_rw_blk.c */
static void do_dasd_request(struct request_queue *queue)
|
{
struct dasd_block *block;
block = queue->queuedata;
spin_lock(&block->queue_lock);
__dasd_process_request_queue(block);
__dasd_block_start_head(block);
spin_unlock(&block->queue_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Spawn thread with a delay.
Create a user thread with delay and check if the thread entry function is executed only after the timeout occurs. */
|
ZTEST_USER(threads_lifecycle, test_threads_spawn_delay)
|
/* Spawn thread with a delay.
Create a user thread with delay and check if the thread entry function is executed only after the timeout occurs. */
ZTEST_USER(threads_lifecycle, test_threads_spawn_delay)
|
{
tp2 = 10;
k_thread_create(&tdata, tstack, STACK_SIZE, thread_entry_delay,
NULL, NULL, NULL, 0, K_USER, K_MSEC(120));
k_msleep(100);
zassert_true(tp2 == 10);
k_msleep(100);
zassert_true(tp2 == 100);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Because sparse isn't smart enough to know about conditional lock return status, we need to help it get it right by annotating the path that does not release the lock. */
|
void* xfs_mru_cache_lookup(xfs_mru_cache_t *mru, unsigned long key)
|
/* Because sparse isn't smart enough to know about conditional lock return status, we need to help it get it right by annotating the path that does not release the lock. */
void* xfs_mru_cache_lookup(xfs_mru_cache_t *mru, unsigned long key)
|
{
xfs_mru_cache_elem_t *elem;
ASSERT(mru && mru->lists);
if (!mru || !mru->lists)
return NULL;
spin_lock(&mru->lock);
elem = radix_tree_lookup(&mru->store, key);
if (elem) {
list_del(&elem->list_node);
_xfs_mru_cache_list_insert(mru, elem);
__release(mru_lock);
} else
spin_unlock(&mru->lock);
return elem ? elem->value : NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Registers the passed in @drv, while updating the bus type. Devices with matching function IDs will be automatically probed. */
|
int maple_driver_register(struct maple_driver *drv)
|
/* Registers the passed in @drv, while updating the bus type. Devices with matching function IDs will be automatically probed. */
int maple_driver_register(struct maple_driver *drv)
|
{
if (!drv)
return -EINVAL;
drv->drv.bus = &maple_bus_type;
return driver_register(&drv->drv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialize new opaque EC Point object. This object represents an EC point within the given EC group (curve). */
|
VOID* EFIAPI CryptoServiceEcPointInit(IN CONST VOID *EcGroup)
|
/* Initialize new opaque EC Point object. This object represents an EC point within the given EC group (curve). */
VOID* EFIAPI CryptoServiceEcPointInit(IN CONST VOID *EcGroup)
|
{
return CALL_BASECRYPTLIB (Ec.Services.PointInit, EcPointInit, (EcGroup), NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base CDOG peripheral base address param reload reload value param start start value */
|
void CDOG_Start(CDOG_Type *base, uint32_t reload, uint32_t start)
|
/* param base CDOG peripheral base address param reload reload value param start start value */
void CDOG_Start(CDOG_Type *base, uint32_t reload, uint32_t start)
|
{
base->RELOAD = reload;
base->START = start;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* \This function use extern interrupt to wake up mcu from sleep mode */
|
void WakeUpFromPowerDown(void)
|
/* \This function use extern interrupt to wake up mcu from sleep mode */
void WakeUpFromPowerDown(void)
|
{
xIntEnable(INT_EINT1);
xIntPrioritySet(INT_EINT1, 1);
GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_15,GPIO_DIR_MODE_IN);
GPIOPinIntEnable(GPIO_PORTB_BASE, GPIO_PIN_15,GPIO_FALLING_EDGE);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* param base SEMA4 peripheral base address. param gateNum Gate number to lock. param procNum Current processor number. */
|
void SEMA4_Lock(SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
|
/* param base SEMA4 peripheral base address. param gateNum Gate number to lock. param procNum Current processor number. */
void SEMA4_Lock(SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
|
{
while (kStatus_Success != SEMA4_TryLock(base, gateNum, procNum))
{
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This will fill in the given, pre-initialised hpsb_packet with the current information from the node entry (host, node ID, bus generation number). */
|
void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)
|
/* This will fill in the given, pre-initialised hpsb_packet with the current information from the node entry (host, node ID, bus generation number). */
void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)
|
{
packet->host = ne->host;
packet->generation = ne->generation;
smp_rmb();
packet->node_id = ne->nodeid;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will return a 32-bit address in the desired channel and rank. */
|
uint32_t get_addr(uint8_t channel, uint8_t rank)
|
/* This function will return a 32-bit address in the desired channel and rank. */
uint32_t get_addr(uint8_t channel, uint8_t rank)
|
{
uint32_t offset = 32 * 1024 * 1024;
if (channel > 0) {
DPF(D_ERROR, "ILLEGAL CHANNEL\n");
DEAD_LOOP();
}
if (rank > 1) {
DPF(D_ERROR, "ILLEGAL RANK\n");
DEAD_LOOP();
}
offset += rank * (256 * 1024 * 1024);
return offset;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* motor moves in backward direction, with duty cycle = duty % */
|
static void brushed_motor_backward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, float duty_cycle)
|
/* motor moves in backward direction, with duty cycle = duty % */
static void brushed_motor_backward(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, float duty_cycle)
|
{
mcpwm_set_signal_low(mcpwm_num, timer_num, MCPWM_OPR_A);
mcpwm_set_duty(mcpwm_num, timer_num, MCPWM_OPR_B, duty_cycle);
mcpwm_set_duty_type(mcpwm_num, timer_num, MCPWM_OPR_B, MCPWM_DUTY_MODE_0);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Initiates a graceful shutdown of the TCP socket by calling the equivalent of shutdown(SHUT_WR); */
|
static void xs_tcp_shutdown(struct rpc_xprt *xprt)
|
/* Initiates a graceful shutdown of the TCP socket by calling the equivalent of shutdown(SHUT_WR); */
static void xs_tcp_shutdown(struct rpc_xprt *xprt)
|
{
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
struct socket *sock = transport->sock;
if (sock != NULL)
kernel_sock_shutdown(sock, SHUT_WR);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns BLE controller manufacturer and version information.
This API is used to get the BLE device manufacturer and version information */
|
ADI_BLER_RESULT adi_radio_GetControllerVersion(ADI_BLER_CONT_VERSION *const pControllerVersion)
|
/* Returns BLE controller manufacturer and version information.
This API is used to get the BLE device manufacturer and version information */
ADI_BLER_RESULT adi_radio_GetControllerVersion(ADI_BLER_CONT_VERSION *const pControllerVersion)
|
{
ADI_BLER_RESULT bleResult;
ASSERT(pControllerVersion != NULL);
ADI_BLE_LOGEVENT(LOGID_CMD_BLEM_GET_CONTR_VER);
ADI_BLE_RADIO_CMD_START(CMD_BLEM_GET_CONTR_VER);
bleResult = bler_process_cmd(CMD_BLEM_GET_CONTR_VER, 0u, pControllerVersion, 4u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* The anonymous transport class contains both a transport class and a container. The idea of an anonymous class is that it never actually has any device attributes associated with it (and thus saves on container storage). So it can only be used for triggering events. Use prezero and then use DECLARE_ANON_TRANSPORT_CLASS() to initialise the anon transport class storage. */
|
int anon_transport_class_register(struct anon_transport_class *atc)
|
/* The anonymous transport class contains both a transport class and a container. The idea of an anonymous class is that it never actually has any device attributes associated with it (and thus saves on container storage). So it can only be used for triggering events. Use prezero and then use DECLARE_ANON_TRANSPORT_CLASS() to initialise the anon transport class storage. */
int anon_transport_class_register(struct anon_transport_class *atc)
|
{
int error;
atc->container.class = &atc->tclass.class;
attribute_container_set_no_classdevs(&atc->container);
error = attribute_container_register(&atc->container);
if (error)
return error;
atc->tclass.setup = anon_transport_dummy_function;
atc->tclass.remove = anon_transport_dummy_function;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function for checking if given slot_no is an EID slot. */
|
static bool is_eid(uint8_t slot_no, const uint8_t *p_eid_slots_configured, uint8_t num_eid_slots_configured)
|
/* Function for checking if given slot_no is an EID slot. */
static bool is_eid(uint8_t slot_no, const uint8_t *p_eid_slots_configured, uint8_t num_eid_slots_configured)
|
{
for (uint32_t i = 0; i < num_eid_slots_configured; ++i)
{
if (slot_no == p_eid_slots_configured[i])
{
return true;
}
}
return false;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function handles the control transfer out status phase */
|
static int ctrlreq_out_status_phase(struct usb_device *dev)
|
/* This function handles the control transfer out status phase */
static int ctrlreq_out_status_phase(struct usb_device *dev)
|
{
u16 csr;
int result;
csr = readw(&musbr->txcsr);
csr |= (MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY |
MUSB_CSR0_H_STATUSPKT);
writew(csr, &musbr->txcsr);
result = wait_until_ep0_ready(dev, MUSB_CSR0_TXPKTRDY);
return result;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
|
void USBD_Connect(BOOL con)
|
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
void USBD_Connect(BOOL con)
|
{
if (con) {
USB0->CTL |= USB_CTL_USBENSOFEN_MASK;
USB0->CONTROL = USB_CONTROL_DPPULLUPNONOTG_MASK;
} else {
USB0->CTL &= ~USB_CTL_USBENSOFEN_MASK;
USB0->CONTROL &= ~USB_CONTROL_DPPULLUPNONOTG_MASK;
}
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* The function stores the filter as a comma-separated list of z/VM user IDs in @buffer. Typically, sysfs routines call this function for attr show. */
|
static int param_get_vmidfilter(char *buffer, struct kernel_param *kp)
|
/* The function stores the filter as a comma-separated list of z/VM user IDs in @buffer. Typically, sysfs routines call this function for attr show. */
static int param_get_vmidfilter(char *buffer, struct kernel_param *kp)
|
{
int rc;
size_t index, len;
void *start, *end;
if (!MACHINE_IS_VM || !hvc_iucv_devices)
return -ENODEV;
rc = 0;
read_lock_bh(&hvc_iucv_filter_lock);
for (index = 0; index < hvc_iucv_filter_size; index++) {
start = hvc_iucv_filter + (8 * index);
end = memchr(start, ' ', 8);
len = (end) ? end - start : 8;
memcpy(buffer + rc, start, len);
rc += len;
buffer[rc++] = ',';
}
read_unlock_bh(&hvc_iucv_filter_lock);
if (rc)
buffer[--rc] = '\0';
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns 0 on success, on failure the CRYPTO_TFM_RES_BAD_KEY_LEN flag in tfm is set. The function uses crypto_aes_expand_key() to expand the key. &crypto_aes_ctx */
|
int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
|
/* Returns 0 on success, on failure the CRYPTO_TFM_RES_BAD_KEY_LEN flag in tfm is set. The function uses crypto_aes_expand_key() to expand the key. &crypto_aes_ctx */
int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
|
{
struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm);
u32 *flags = &tfm->crt_flags;
int ret;
ret = crypto_aes_expand_key(ctx, in_key, key_len);
if (!ret)
return 0;
*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Note, that while we protect the global llext list while searching, we release the lock before returning the found extension to the caller. Therefore it's a responsibility of the caller to protect against races with a freeing context when calling this function. */
|
struct llext* llext_by_name(const char *name)
|
/* Note, that while we protect the global llext list while searching, we release the lock before returning the found extension to the caller. Therefore it's a responsibility of the caller to protect against races with a freeing context when calling this function. */
struct llext* llext_by_name(const char *name)
|
{
k_mutex_lock(&llext_lock, K_FOREVER);
for (sys_snode_t *node = sys_slist_peek_head(&_llext_list);
node != NULL;
node = sys_slist_peek_next(node)) {
struct llext *ext = CONTAINER_OF(node, struct llext, _llext_list);
if (strncmp(ext->name, name, sizeof(ext->name)) == 0) {
k_mutex_unlock(&llext_lock);
return ext;
}
}
k_mutex_unlock(&llext_lock);
return NULL;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Airpcap wrapper, used to get the decryption enabling of an airpcap driver */
|
gboolean airpcap_if_get_driver_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState PEnable)
|
/* Airpcap wrapper, used to get the decryption enabling of an airpcap driver */
gboolean airpcap_if_get_driver_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState PEnable)
|
{
if (!AirpcapLoaded || (g_PAirpcapGetDriverDecryptionState==NULL)) return FALSE;
return g_PAirpcapGetDriverDecryptionState(ah,PEnable);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Move cache entry to end of LRU list */
|
static void lru_put_end(struct svc_cacherep *rp)
|
/* Move cache entry to end of LRU list */
static void lru_put_end(struct svc_cacherep *rp)
|
{
list_move_tail(&rp->c_lru, &lru_head);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT64 EFIAPI MmioRead64(IN UINTN Address)
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI MmioRead64(IN UINTN Address)
|
{
ASSERT ((Address & 7) == 0);
return (UINT64)MmioReadWorker (Address, SMM_IO_UINT64);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
|
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
{
uint32_t cr3 = 0U;
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_RxFifo))
{
cr3 |= CSI_CSICR3_DMA_REQ_EN_RFF_MASK;
}
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_StatFifo))
{
cr3 |= CSI_CSICR3_DMA_REQ_EN_SFF_MASK;
}
if (enable)
{
base->CSICR3 |= cr3;
}
else
{
base->CSICR3 &= ~cr3;
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions */
|
static bool indev_reset_check(lv_indev_proc_t *proc)
|
/* Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions */
static bool indev_reset_check(lv_indev_proc_t *proc)
|
{
if(proc->reset_query) {
indev_obj_act = NULL;
}
return proc->reset_query ? true : false;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Note: The CWR is considered a Control chunk. */
|
struct sctp_chunk* sctp_make_cwr(const struct sctp_association *asoc, const __u32 lowest_tsn, const struct sctp_chunk *chunk)
|
/* Note: The CWR is considered a Control chunk. */
struct sctp_chunk* sctp_make_cwr(const struct sctp_association *asoc, const __u32 lowest_tsn, const struct sctp_chunk *chunk)
|
{
struct sctp_chunk *retval;
sctp_cwrhdr_t cwr;
cwr.lowest_tsn = htonl(lowest_tsn);
retval = sctp_make_chunk(asoc, SCTP_CID_ECN_CWR, 0,
sizeof(sctp_cwrhdr_t));
if (!retval)
goto nodata;
retval->subh.ecn_cwr_hdr =
sctp_addto_chunk(retval, sizeof(cwr), &cwr);
if (chunk)
retval->transport = chunk->transport;
nodata:
return retval;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Encapsulate access to the itm structure for SMP. */
|
void ia64_cpu_local_tick(void)
|
/* Encapsulate access to the itm structure for SMP. */
void ia64_cpu_local_tick(void)
|
{
int cpu = smp_processor_id();
unsigned long shift = 0, delta;
ia64_set_itv(IA64_TIMER_VECTOR);
delta = local_cpu_data->itm_delta;
if (cpu) {
unsigned long hi = 1UL << ia64_fls(cpu);
shift = (2*(cpu - hi) + 1) * delta/hi/2;
}
local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
ia64_set_itm(local_cpu_data->itm_next);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Deallocates the memory needed for the UART descriptor. */
|
static void free_desc_mem(struct uart_desc *desc)
|
/* Deallocates the memory needed for the UART descriptor. */
static void free_desc_mem(struct uart_desc *desc)
|
{
struct aducm_uart_desc *aducm_desc = desc->extra;
free((void *)((uint32_t)aducm_desc->adi_uart_buffer -
aducm_desc->adi_uart_buffer_offset));
aducm_desc->adi_uart_buffer = NULL;
aducm_desc->adi_uart_buffer_offset = 0;
free(desc->extra);
free(desc);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* If desired, disconnect the pull-up resistor on CD/DAT (pin 1) of the card. This may be required on certain setups of boards, controllers and embedded sdio device which do not need the card's pull-up. As a result, card detection is disabled and power is saved. */
|
static int sdio_disable_cd(struct mmc_card *card)
|
/* If desired, disconnect the pull-up resistor on CD/DAT (pin 1) of the card. This may be required on certain setups of boards, controllers and embedded sdio device which do not need the card's pull-up. As a result, card detection is disabled and power is saved. */
static int sdio_disable_cd(struct mmc_card *card)
|
{
int ret;
u8 ctrl;
if (!card->cccr.disable_cd)
return 0;
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
if (ret)
return ret;
ctrl |= SDIO_BUS_CD_DISABLE;
return mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Walk all the element of the first from first to last and apply the walker function to it */
|
void xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user)
|
/* Walk all the element of the first from first to last and apply the walker function to it */
void xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user)
|
{
if((walker(lk->data, user)) == 0)
break;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Read BMA150 device ID and revision numbers.
This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */
|
static bool bma150_device_id(sensor_hal_t *hal, sensor_data_t *data)
|
/* Read BMA150 device ID and revision numbers.
This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */
static bool bma150_device_id(sensor_hal_t *hal, sensor_data_t *data)
|
{
data->device.id = sensor_bus_get(hal, BMA150_CHIP_ID);
data->device.version = sensor_bus_get(hal, BMA150_CHIP_VERSION);
return true;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeUintnToUint32(IN UINTN Operand, OUT UINT32 *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToUint32(IN UINTN Operand, OUT UINT32 *Result)
|
{
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
*Result = (UINT32)Operand;
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Specialize custom 64-bit implementation for speed improvements. Workaround for DJGPP to find uint8_t, uint16_t, etc. */
|
static void fastlz_memmove(uint8_t *dest, const uint8_t *src, uint32_t count)
|
/* Specialize custom 64-bit implementation for speed improvements. Workaround for DJGPP to find uint8_t, uint16_t, etc. */
static void fastlz_memmove(uint8_t *dest, const uint8_t *src, uint32_t count)
|
{
memmove(dest, src, count);
} else {
switch (count) {
default:
do {
*dest++ = *src++;
} while (--count);
break;
case 3:
*dest++ = *src++;
case 2:
*dest++ = *src++;
case 1:
*dest++ = *src++;
case 0:
break;
}
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Description: This should be set to the lowest possible block size that the storage device can address. The default of 512 covers most hardware. */
|
void blk_queue_logical_block_size(struct request_queue *q, unsigned short size)
|
/* Description: This should be set to the lowest possible block size that the storage device can address. The default of 512 covers most hardware. */
void blk_queue_logical_block_size(struct request_queue *q, unsigned short size)
|
{
q->limits.logical_block_size = size;
if (q->limits.physical_block_size < size)
q->limits.physical_block_size = size;
if (q->limits.io_min < q->limits.physical_block_size)
q->limits.io_min = q->limits.physical_block_size;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
|
static void refresh_children_style(lv_obj_t *obj)
|
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
static void refresh_children_style(lv_obj_t *obj)
|
{
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
lv_obj_invalidate(child);
lv_event_send(child, LV_EVENT_STYLE_CHANGED, NULL);
lv_obj_invalidate(child);
refresh_children_style(child);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Performs a timer tick. In this simple case all we do is count down with protection against underflow and wrapping at the low end. */
|
static void SerialTimeoutTick(ISP_ENVIRONMENT *IspEnvironment)
|
/* Performs a timer tick. In this simple case all we do is count down with protection against underflow and wrapping at the low end. */
static void SerialTimeoutTick(ISP_ENVIRONMENT *IspEnvironment)
|
{
if (IspEnvironment->serial_timeout_count <= 1)
{
IspEnvironment->serial_timeout_count = 0;
}
else
{
IspEnvironment->serial_timeout_count--;
}
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* This function retrieves the period of timer interrupts in 100 ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */
|
EFI_STATUS EFIAPI TimerDriverGetTimerPeriod(IN EFI_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
|
/* This function retrieves the period of timer interrupts in 100 ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */
EFI_STATUS EFIAPI TimerDriverGetTimerPeriod(IN EFI_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
|
{
if (TimerPeriod == NULL) {
return EFI_INVALID_PARAMETER;
}
*TimerPeriod = mTimerPeriod;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is part of Video 4 Linux API. The procedure handles ioctl() calls. */
|
static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *vc)
|
/* This is part of Video 4 Linux API. The procedure handles ioctl() calls. */
static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *vc)
|
{
struct usb_usbvision *usbvision = video_drvdata(file);
strlcpy(vc->driver, "USBVision", sizeof(vc->driver));
strlcpy(vc->card,
usbvision_device_data[usbvision->DevModel].ModelString,
sizeof(vc->card));
usb_make_path(usbvision->dev, vc->bus_info, sizeof(vc->bus_info));
vc->version = USBVISION_DRIVER_VERSION;
vc->capabilities = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_AUDIO |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING |
(usbvision->have_tuner ? V4L2_CAP_TUNER : 0);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Decode a 10-bit algebraic codebook index from a 10.2 kbit/s frame. */
|
static void decode_10bit_pulse(int code, int pulse_position[8], int i1, int i2, int i3)
|
/* Decode a 10-bit algebraic codebook index from a 10.2 kbit/s frame. */
static void decode_10bit_pulse(int code, int pulse_position[8], int i1, int i2, int i3)
|
{
const uint8_t *positions = base_five_table[code >> 3];
pulse_position[i1] = (positions[2] << 1) + ( code & 1);
pulse_position[i2] = (positions[1] << 1) + ((code >> 1) & 1);
pulse_position[i3] = (positions[0] << 1) + ((code >> 2) & 1);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Toggles the LED at a fixed time interval. */
|
void LedToggle(void)
|
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
|
{
static unsigned char led_toggle_state = 0;
static unsigned long timer_counter_last = 0;
unsigned long timer_counter_now;
timer_counter_now = TimerGet();
if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS)
{
return;
}
if (led_toggle_state == 0)
{
led_toggle_state = 1;
GPIOPinWrite(GPIO_PORTF_BASE, 0x01, 1);
}
else
{
led_toggle_state = 0;
GPIOPinWrite(GPIO_PORTF_BASE, 0x01, 0);
}
timer_counter_last = timer_counter_now;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Enable Peripheral Clock in running mode.
Enable the clock on particular peripheral. */
|
void cmu_periph_clock_enable(enum cmu_periph_clken clken)
|
/* Enable Peripheral Clock in running mode.
Enable the clock on particular peripheral. */
void cmu_periph_clock_enable(enum cmu_periph_clken clken)
|
{
_CMU_REG(clken) |= _CMU_BIT(clken);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
|
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
{
uint32_t cr3 = 0U;
if ((uint32_t)fifo & (uint32_t)kCSI_RxFifo)
{
cr3 |= CSI_CSICR3_DMA_REQ_EN_RFF_MASK;
}
if ((uint32_t)fifo & (uint32_t)kCSI_StatFifo)
{
cr3 |= CSI_CSICR3_DMA_REQ_EN_SFF_MASK;
}
if (enable)
{
base->CSICR3 |= cr3;
}
else
{
base->CSICR3 &= ~cr3;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.