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
|
|---|---|---|---|---|---|---|---|
/* NOTE: We disable all GT64120 timers, and use MIPS processor internal timer as the source of kernel clock tick. */
|
void __init plat_time_init(void)
|
/* NOTE: We disable all GT64120 timers, and use MIPS processor internal timer as the source of kernel clock tick. */
void __init plat_time_init(void)
|
{
GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
GT_WRITE(GT_TC0_OFS, 0x00);
GT_WRITE(GT_TC1_OFS, 0x00);
GT_WRITE(GT_TC2_OFS, 0x00);
GT_WRITE(GT_TC3_OFS, 0x00);
mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Note that the Host always prefers that the Guest speak in physical addresses rather than virtual addresses, so we use __pa() here. */
|
static void lguest_power_off(void)
|
/* Note that the Host always prefers that the Guest speak in physical addresses rather than virtual addresses, so we use __pa() here. */
static void lguest_power_off(void)
|
{
kvm_hypercall2(LHCALL_SHUTDOWN, __pa("Power down"),
LGUEST_SHUTDOWN_POWEROFF);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Turn on the peripheral and set output color mode, this only needs to be done once */
|
void lv_draw_n9h30_ge2d_ctx_init(lv_disp_drv_t *drv, lv_draw_ctx_t *draw_ctx)
|
/* Turn on the peripheral and set output color mode, this only needs to be done once */
void lv_draw_n9h30_ge2d_ctx_init(lv_disp_drv_t *drv, lv_draw_ctx_t *draw_ctx)
|
{
lv_draw_sw_init_ctx(drv, draw_ctx);
lv_draw_n9h30_ge2d_ctx_t *ge2d_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
ge2d_draw_ctx->blend = lv_draw_n9h30_ge2d_blend;
ge2d_draw_ctx->base_draw.wait_for_finish = lv_gpu_n9h30_ge2d_wait_cb;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* All the pointers in the Index'th NET_BLOCK and NET_BLOCK_OP are set to the bulk's head and tail respectively. So, this function alone can't be used by NetbufAlloc. */
|
VOID NetbufSetBlock(IN OUT NET_BUF *Nbuf, IN UINT8 *Bulk, IN UINT32 Len, IN UINT32 Index)
|
/* All the pointers in the Index'th NET_BLOCK and NET_BLOCK_OP are set to the bulk's head and tail respectively. So, this function alone can't be used by NetbufAlloc. */
VOID NetbufSetBlock(IN OUT NET_BUF *Nbuf, IN UINT8 *Bulk, IN UINT32 Len, IN UINT32 Index)
|
{
NET_BLOCK_OP *BlockOp;
NET_BLOCK *Block;
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
NET_CHECK_SIGNATURE (Nbuf->Vector, NET_VECTOR_SIGNATURE);
ASSERT (Index < Nbuf->BlockOpNum);
Block = &(Nbuf->Vector->Block[Index]);
BlockOp = &(Nbuf->BlockOp[Index]);
Block->Len = Len;
Block->Bulk = Bulk;
BlockOp->BlockHead = Bulk;
BlockOp->BlockTail = Bulk + Len;
BlockOp->Head = Bulk;
BlockOp->Tail = Bulk + Len;
BlockOp->Size = Len;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* brief Return Frequency of FRO 12MHz return Frequency of FRO 12MHz */
|
static uint32_t GetFro12MFreq(void)
|
/* brief Return Frequency of FRO 12MHz return Frequency of FRO 12MHz */
static uint32_t GetFro12MFreq(void)
|
{
return ((ANACTRL->FRO192M_CTRL & ANACTRL_FRO192M_CTRL_ENA_12MHZCLK_MASK) != 0UL) ? 12000000U : 0U;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Stops transmission. Function will wait until transmit operation enters stop state. */
|
static int32_t MAC_stop_receiving(void)
|
/* Stops transmission. Function will wait until transmit operation enters stop state. */
static int32_t MAC_stop_receiving(void)
|
{
int32_t retval = MAC_OK;
MAC_set_time_out( (uint16_t)STATE_CHANGE_TIME_OUT );
while( (((MAC->CSR5 & CSR5_RS_MASK) >> CSR5_RS_SHIFT) != CSR5_RS_STOPPED)
&& (retval == MAC_OK) )
{
MAC_BITBAND->CSR6_SR = 0u;
if( MAC_get_time_out() == 0u ) {
retval = MAC_TIME_OUT;
}
}
return retval;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Reports the name of the source file and the source line number where the HAL_ASSERT error has occurred. */
|
__WEAK void HAL_AssertFailed(const char *file, uint32_t line)
|
/* Reports the name of the source file and the source line number where the HAL_ASSERT error has occurred. */
__WEAK void HAL_AssertFailed(const char *file, uint32_t line)
|
{
HAL_DBG_ERR("assert failed at %s %lu\n", file, line);
while (1) {
;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Allocates an mbuf suitable for an HCI ACL data packet. */
|
struct os_mbuf* ble_hs_mbuf_acl_pkt(void)
|
/* Allocates an mbuf suitable for an HCI ACL data packet. */
struct os_mbuf* ble_hs_mbuf_acl_pkt(void)
|
{
return ble_hs_mbuf_gen_pkt(BLE_HCI_DATA_HDR_SZ);
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This function destroys journal data structures including those that may have been created by recovery functions. */
|
static void destroy_journal(struct ubifs_info *c)
|
/* This function destroys journal data structures including those that may have been created by recovery functions. */
static void destroy_journal(struct ubifs_info *c)
|
{
while (!list_empty(&c->unclean_leb_list)) {
struct ubifs_unclean_leb *ucleb;
ucleb = list_entry(c->unclean_leb_list.next,
struct ubifs_unclean_leb, list);
list_del(&ucleb->list);
kfree(ucleb);
}
while (!list_empty(&c->old_buds)) {
struct ubifs_bud *bud;
bud = list_entry(c->old_buds.next, struct ubifs_bud, list);
list_del(&bud->list);
kfree(bud);
}
ubifs_destroy_idx_gc(c);
ubifs_destroy_size_tree(c);
ubifs_tnc_close(c);
free_buds(c);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if the given string is a protocol supported by libcurl */
|
int check_protocol(const char *str)
|
/* Check if the given string is a protocol supported by libcurl */
int check_protocol(const char *str)
|
{
const char * const *pp;
const curl_version_info_data *curlinfo = curl_version_info(CURLVERSION_NOW);
if(!str)
return PARAM_REQUIRES_PARAMETER;
for(pp = curlinfo->protocols; *pp; pp++) {
if(curl_strequal(*pp, str))
return PARAM_OK;
}
return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Set lptimer period.
Set the timer period in the auto-reload register. Must only be set with timer enabled. */
|
void lptimer_set_period(uint32_t lptimer_peripheral, uint16_t period_value)
|
/* Set lptimer period.
Set the timer period in the auto-reload register. Must only be set with timer enabled. */
void lptimer_set_period(uint32_t lptimer_peripheral, uint16_t period_value)
|
{
LPTIM_ARR(lptimer_peripheral) = period_value;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Build a synchronous negotiation message in our message buffer based on the input parameters. */
|
static void ahd_construct_sdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int period, u_int offset)
|
/* Build a synchronous negotiation message in our message buffer based on the input parameters. */
static void ahd_construct_sdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int period, u_int offset)
|
{
if (offset == 0)
period = AHD_ASYNC_XFER_PERIOD;
ahd->msgout_index += spi_populate_sync_msg(
ahd->msgout_buf + ahd->msgout_index, period, offset);
ahd->msgout_len += 5;
if (bootverbose) {
printf("(%s:%c:%d:%d): Sending SDTR period %x, offset %x\n",
ahd_name(ahd), devinfo->channel, devinfo->target,
devinfo->lun, period, offset);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Calculates a clock divider (
Baud rate calculation: */
|
static int usart_set_sync_master_baudrate(volatile avr32_usart_t *usart, unsigned int baudrate, unsigned long pba_hz)
|
/* Calculates a clock divider (
Baud rate calculation: */
static int usart_set_sync_master_baudrate(volatile avr32_usart_t *usart, unsigned int baudrate, unsigned long pba_hz)
|
{
unsigned int cd = (pba_hz + baudrate / 2) / baudrate;
if (cd < 1 || cd > (1 << AVR32_USART_BRGR_CD_SIZE) - 1)
return USART_INVALID_INPUT;
usart->mr = (usart->mr & ~AVR32_USART_MR_USCLKS_MASK) |
AVR32_USART_MR_USCLKS_MCK << AVR32_USART_MR_USCLKS_OFFSET |
AVR32_USART_MR_SYNC_MASK;
usart->brgr = cd << AVR32_USART_BRGR_CD_OFFSET;
return USART_SUCCESS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Do a full copy of the bigint object. */
|
bigint* ICACHE_FLASH_ATTR bi_clone(BI_CTX *ctx, const bigint *bi)
|
/* Do a full copy of the bigint object. */
bigint* ICACHE_FLASH_ATTR bi_clone(BI_CTX *ctx, const bigint *bi)
|
{
bigint *biR = alloc(ctx, bi->size);
check(bi);
memcpy(biR->comps, bi->comps, bi->size*COMP_BYTE_SIZE);
return biR;
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* dccp_insert_option_mandatory - Mandatory option (5.8.2) Note that since we are using skb_push, this function needs to be called */
|
int dccp_insert_option_mandatory(struct sk_buff *skb)
|
/* dccp_insert_option_mandatory - Mandatory option (5.8.2) Note that since we are using skb_push, this function needs to be called */
int dccp_insert_option_mandatory(struct sk_buff *skb)
|
{
if (DCCP_SKB_CB(skb)->dccpd_opt_len >= DCCP_MAX_OPT_LEN)
return -1;
DCCP_SKB_CB(skb)->dccpd_opt_len++;
*skb_push(skb, 1) = DCCPO_MANDATORY;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Stop receiving - port is in process of being closed. */
|
static void atmel_stop_rx(struct uart_port *port)
|
/* Stop receiving - port is in process of being closed. */
static void atmel_stop_rx(struct uart_port *port)
|
{
if (atmel_use_dma_rx(port)) {
UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);
UART_PUT_IDR(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
} else
UART_PUT_IDR(port, ATMEL_US_RXRDY);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* It does not appear from the datasheet that the GPIO pins are open drain. So a we set a low value by setting the direction to output and a high value by setting the direction to input and relying on the required I2C pullup. The data value is initialized to 0 in via_init() and never changed. */
|
static void bit_via_setscl(void *data, int state)
|
/* It does not appear from the datasheet that the GPIO pins are open drain. So a we set a low value by setting the direction to output and a high value by setting the direction to input and relying on the required I2C pullup. The data value is initialized to 0 in via_init() and never changed. */
static void bit_via_setscl(void *data, int state)
|
{
outb(state ? inb(I2C_DIR) & ~I2C_SCL : inb(I2C_DIR) | I2C_SCL, I2C_DIR);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API reads the ASIC status from the sensor. The status information is mentioned in the below table. */
|
uint16_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev)
|
/* This API reads the ASIC status from the sensor. The status information is mentioned in the below table. */
uint16_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev)
|
{
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_INTERNAL_ERROR, &data, 1, dev);
if (rslt == BMA4_OK) {
asic_status->sleep = (data & 0x01);
asic_status->irq_ovrn = ((data & 0x02) >> 0x01);
asic_status->wc_event = ((data & 0x04) >> 0x02);
asic_status->stream_transfer_active = ((data & 0x08) >> 0x03);
}
}
return rslt;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Poll the Tangent type cards to see if we have work. */
|
static void cops_poll(unsigned long ltdev)
|
/* Poll the Tangent type cards to see if we have work. */
static void cops_poll(unsigned long ltdev)
|
{
int ioaddr, status;
int boguscount = 0;
struct net_device *dev = (struct net_device *)ltdev;
del_timer(&cops_timer);
if(dev == NULL)
return;
ioaddr = dev->base_addr;
do {
status=inb(ioaddr+TANG_CARD_STATUS);
if(status & TANG_RX_READY)
cops_rx(dev);
if(status & TANG_TX_READY)
netif_wake_queue(dev);
status = inb(ioaddr+TANG_CARD_STATUS);
} while((++boguscount < 20) && (status&(TANG_RX_READY|TANG_TX_READY)));
cops_timer.expires = jiffies + HZ/20;
add_timer(&cops_timer);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This sets the string that #GIOChannel uses to determine where in the file a line break occurs. */
|
void g_io_channel_set_line_term(GIOChannel *channel, const gchar *line_term, gint length)
|
/* This sets the string that #GIOChannel uses to determine where in the file a line break occurs. */
void g_io_channel_set_line_term(GIOChannel *channel, const gchar *line_term, gint length)
|
{
g_return_if_fail (channel != NULL);
g_return_if_fail (line_term == NULL || length != 0);
if (line_term == NULL)
length = 0;
else if (length < 0)
length = strlen (line_term);
g_free (channel->line_term);
channel->line_term = line_term ? g_memdup (line_term, length) : NULL;
channel->line_term_len = length;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* bsec_SW_lock() - manage SW lock (Write in Shadow) @base: base address of bsec IP @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: true if locked else false */
|
static bool bsec_read_SW_lock(u32 base, u32 otp)
|
/* bsec_SW_lock() - manage SW lock (Write in Shadow) @base: base address of bsec IP @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: true if locked else false */
static bool bsec_read_SW_lock(u32 base, u32 otp)
|
{
return bsec_read_lock(base + BSEC_SWLOCK_OFF, otp);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns A newly allocated string with the substitution done. The caller must deallocate it ! */
|
xmlChar* xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3)
|
/* Returns A newly allocated string with the substitution done. The caller must deallocate it ! */
xmlChar* xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3)
|
{
if ((ctxt == NULL) || (str == NULL)) return(NULL);
return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what,
end, end2, end3));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* These changes are either USB devices or busses being added or removed. */
|
void usb_register_notify(struct notifier_block *nb)
|
/* These changes are either USB devices or busses being added or removed. */
void usb_register_notify(struct notifier_block *nb)
|
{
blocking_notifier_chain_register(&usb_notifier_list, nb);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @key: Key containing modulus to subtract @num: Number to subtract modulus from, as little endian word array */
|
static void subtract_modulus(const struct rsa_public_key *key, uint32_t num[])
|
/* @key: Key containing modulus to subtract @num: Number to subtract modulus from, as little endian word array */
static void subtract_modulus(const struct rsa_public_key *key, uint32_t num[])
|
{
int64_t acc = 0;
uint i;
for (i = 0; i < key->len; i++) {
acc += (uint64_t)num[i] - key->modulus[i];
num[i] = (uint32_t)acc;
acc >>= 32;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns: (array zero-terminated=1) (transfer full): a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it. Since: 2.6 */
|
gchar** g_key_file_get_groups(GKeyFile *key_file, gsize *length)
|
/* Returns: (array zero-terminated=1) (transfer full): a newly-allocated NULL-terminated array of strings. Use g_strfreev() to free it. Since: 2.6 */
gchar** g_key_file_get_groups(GKeyFile *key_file, gsize *length)
|
{
GList *group_node;
gchar **groups;
gsize i, num_groups;
g_return_val_if_fail (key_file != NULL, NULL);
num_groups = g_list_length (key_file->groups);
g_return_val_if_fail (num_groups > 0, NULL);
group_node = g_list_last (key_file->groups);
g_return_val_if_fail (((GKeyFileGroup *) group_node->data)->name == NULL, NULL);
groups = g_new (gchar *, num_groups);
i = 0;
for (group_node = group_node->prev;
group_node != NULL;
group_node = group_node->prev)
{
GKeyFileGroup *group;
group = (GKeyFileGroup *) group_node->data;
g_warn_if_fail (group->name != NULL);
groups[i++] = g_strdup (group->name);
}
groups[i] = NULL;
if (length)
*length = i;
return groups;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns the current interrupt status of the DES module. */
|
uint32_t DESIntStatus(uint32_t ui32Base, bool bMasked)
|
/* Returns the current interrupt status of the DES module. */
uint32_t DESIntStatus(uint32_t ui32Base, bool bMasked)
|
{
uint32_t ui32Status, ui32Enable;
ASSERT(ui32Base == DES_BASE);
ui32Status = HWREG(ui32Base + DES_O_IRQSTATUS);
if(bMasked)
{
ui32Enable = HWREG(ui32Base + DES_O_IRQENABLE);
return((ui32Status & ui32Enable) |
(HWREG(ui32Base + DES_O_DMAMIS) << 16));
}
else
{
return(ui32Status | (HWREG(ui32Base + DES_O_DMARIS) << 16));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check the status of the Tx buffer of the specified SPI port. */
|
xtBoolean SPIIsTxEmpty(unsigned long ulBase)
|
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxEmpty(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_EMPTY)? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* The interrupt handler for DMA interrupts from the memory channel. */
|
void DMA2IntHandler(void)
|
/* The interrupt handler for DMA interrupts from the memory channel. */
void DMA2IntHandler(void)
|
{
unsigned long ulEvent = 0;
ulEvent = xHWREG(DMA0_BASE + DMA_DSR_BCR) & 0x71000000;
xHWREG(DMA2_BASE + DMA_DSR_BCR) |= DMA_DSR_BCR_DONE;
if(g_psDMAChannelAssignTable[2].pfnDMAChannelHandlerCallback != 0)
{
g_psDMAChannelAssignTable[2].pfnDMAChannelHandlerCallback(0,0,ulEvent,0);
}}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Initialize media with default check file list. If boot file name is not set, the listed files will be checked. */
|
void media_init(const char **list, const uint32_t list_size)
|
/* Initialize media with default check file list. If boot file name is not set, the listed files will be checked. */
void media_init(const char **list, const uint32_t list_size)
|
{
uint32_t i;
dbg_print("media: init ...\r\n");
file_names[0] = 0;
file_list = (char**)list;
file_list_size = list_size;
if (list) {
dbg_print("media: boot list (priority high ~ low)\r\n");
for (i = 0; i < list_size; i ++) {
dbg_print(" #%u : %s\r\n", (unsigned)i, file_list[i]);
}
}
for (i = 0; i < MEDIA_NUM_MAX; i ++) {
if (medias[i].init) {
medias[i].init();
}
}
dbg_print("media: init ... done\r\n");
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */
|
unsigned long PWMGenPeriodGet(unsigned long ulBase, unsigned long ulGen)
|
/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */
unsigned long PWMGenPeriodGet(unsigned long ulBase, unsigned long ulGen)
|
{
ASSERT(ulBase == PWM_BASE);
ASSERT(PWMGenValid(ulGen));
ulGen = PWM_GEN_BADDR(ulBase, ulGen);
if(HWREG(ulGen + PWM_O_X_CTL) & PWM_X_CTL_MODE)
{
return(HWREG(ulGen + PWM_O_X_LOAD) * 2);
}
else
{
return(HWREG(ulGen + PWM_O_X_LOAD) + 1);
}
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* equivalent of memset() for early boot usage
Architectures that can't safely use the regular (optimized) memset very early during boot because e.g. hardware isn't yet sufficiently initialized may override this with their own safe implementation. */
|
__boot_func void __weak z_early_memset(void *dst, int c, size_t n)
|
/* equivalent of memset() for early boot usage
Architectures that can't safely use the regular (optimized) memset very early during boot because e.g. hardware isn't yet sufficiently initialized may override this with their own safe implementation. */
__boot_func void __weak z_early_memset(void *dst, int c, size_t n)
|
{
(void) memset(dst, c, n);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Initial function for ECDSA key generator for Key Store. */
|
int32_t RNG_ECDSA_Init(uint32_t u32KeySize, uint32_t au32ECC_N[18])
|
/* Initial function for ECDSA key generator for Key Store. */
int32_t RNG_ECDSA_Init(uint32_t u32KeySize, uint32_t au32ECC_N[18])
|
{
int32_t i;
if (RNG_Open())
return -1;
for (i = 0; i < 18; i++)
CRPT->ECC_N[i] = au32ECC_N[i];
CRPT->PRNG_KSCTL = (KS_OWNER_ECC << CRPT_PRNG_KSCTL_OWNER_Pos) |
CRPT_PRNG_KSCTL_ECDSA_Msk |
(CRPT_PRNG_KSCTL_WDST_Msk) |
(KS_SRAM << CRPT_PRNG_KSCTL_WSDST_Pos);
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Code accessing dma_async_is_complete() in a tight loop may give problems. If slaves are relying on interrupts to signal completion this function must not be called with interrupts disabled. */
|
static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate)
|
/* Code accessing dma_async_is_complete() in a tight loop may give problems. If slaves are relying on interrupts to signal completion this function must not be called with interrupts disabled. */
static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate)
|
{
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
enum dma_status ret;
ret = dma_cookie_status(chan, cookie, txstate);
if (ret == DMA_SUCCESS)
return ret;
dma_set_residue(txstate, pl08x_getbytes_chan(plchan));
if (plchan->state == PL08X_CHAN_PAUSED)
return DMA_PAUSED;
return DMA_IN_PROGRESS;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* release_slot - free up the memory used by a slot @hotplug_slot: slot to free */
|
static void release_slot(struct hotplug_slot *hotplug_slot)
|
/* release_slot - free up the memory used by a slot @hotplug_slot: slot to free */
static void release_slot(struct hotplug_slot *hotplug_slot)
|
{
struct slot *slot = hotplug_slot->private;
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, hotplug_slot_name(hotplug_slot));
kfree(hotplug_slot->ops);
kfree(hotplug_slot->info);
kfree(hotplug_slot);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Remove and return an HDLC buffer from the head of the specified HDLC buffer list. Returns a pointer to HDLC buffer if available, otherwise NULL. */
|
static struct n_hdlc_buf * n_hdlc_buf_get(struct n_hdlc_buf_list *list)
|
/* Remove and return an HDLC buffer from the head of the specified HDLC buffer list. Returns a pointer to HDLC buffer if available, otherwise NULL. */
static struct n_hdlc_buf * n_hdlc_buf_get(struct n_hdlc_buf_list *list)
|
{
unsigned long flags;
struct n_hdlc_buf *buf;
spin_lock_irqsave(&list->spinlock,flags);
buf = list->head;
if (buf) {
list->head = buf->link;
(list->count)--;
}
if (!list->head)
list->tail = NULL;
spin_unlock_irqrestore(&list->spinlock,flags);
return buf;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* SC_Itf_T0Apdu Class Specific Request from the host to provide supported data rates This is Optional function & user implementable. */
|
uint8_t SC_Itf_T0Apdu(uint8_t bmChanges, uint8_t bClassGetResponse, uint8_t bClassEnvelope)
|
/* SC_Itf_T0Apdu Class Specific Request from the host to provide supported data rates This is Optional function & user implementable. */
uint8_t SC_Itf_T0Apdu(uint8_t bmChanges, uint8_t bClassGetResponse, uint8_t bClassEnvelope)
|
{
UNUSED(bClassEnvelope);
UNUSED(bClassGetResponse);
if (bmChanges == 0U)
{
return SLOT_NO_ERROR;
}
return SLOTERROR_CMD_NOT_SUPPORTED;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* IO is completed, waiting resource free from firmware. */
|
static void bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
|
/* IO is completed, waiting resource free from firmware. */
static void bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
|
{
bfa_trc(ioim->bfa, ioim->iotag);
bfa_trc(ioim->bfa, event);
switch (event) {
case BFA_IOIM_SM_FREE:
bfa_sm_set_state(ioim, bfa_ioim_sm_uninit);
bfa_ioim_free(ioim);
bfa_cb_ioim_resfree(ioim->bfa->bfad);
break;
case BFA_IOIM_SM_CLEANUP:
bfa_ioim_notify_cleanup(ioim);
break;
case BFA_IOIM_SM_HWFAIL:
break;
default:
bfa_assert(0);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The freeze request is sent by setting the tasks's TIF_FREEZE flag and either sending a fake signal to it or waking it up, depending on whether or not it has PF_FREEZER_NOSIG set. If @sig_only is set and the task has PF_FREEZER_NOSIG set (ie. it is a typical kernel thread), its TIF_FREEZE flag will not be set. */
|
bool freeze_task(struct task_struct *p, bool sig_only)
|
/* The freeze request is sent by setting the tasks's TIF_FREEZE flag and either sending a fake signal to it or waking it up, depending on whether or not it has PF_FREEZER_NOSIG set. If @sig_only is set and the task has PF_FREEZER_NOSIG set (ie. it is a typical kernel thread), its TIF_FREEZE flag will not be set. */
bool freeze_task(struct task_struct *p, bool sig_only)
|
{
if (!freezing(p)) {
rmb();
if (frozen(p))
return false;
if (!sig_only || should_send_signal(p))
set_freeze_flag(p);
else
return false;
}
if (should_send_signal(p)) {
if (!signal_pending(p))
fake_signal_wake_up(p);
} else if (sig_only) {
return false;
} else {
wake_up_state(p, TASK_INTERRUPTIBLE);
}
return true;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If Length is not aligned on a 64-bit boundary, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
|
UINT64* EFIAPI MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer)
|
/* If Length is not aligned on a 64-bit boundary, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64* EFIAPI MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer)
|
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length != 0) {
*(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
{
if(htim_base->Instance==TIM1)
{
__HAL_RCC_TIM1_CLK_ENABLE();
}
else if(htim_base->Instance==TIM4)
{
__HAL_RCC_TIM4_CLK_ENABLE();
}
else if(htim_base->Instance==TIM14)
{
__HAL_RCC_TIM14_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculate ATH value for given frequency. Borrowed from Lame. */
|
static av_cold float ath(float f, float add)
|
/* Calculate ATH value for given frequency. Borrowed from Lame. */
static av_cold float ath(float f, float add)
|
{
f /= 1000.0f;
return 3.64 * pow(f, -0.8)
- 6.8 * exp(-0.6 * (f - 3.4) * (f - 3.4))
+ 6.0 * exp(-0.15 * (f - 8.7) * (f - 8.7))
+ (0.6 + 0.04 * add) * 0.001 * f * f * f * f;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This function writes a char in the LCD RAM. */
|
void LCD_GLASS_DisplayString(uint8_t *ptr)
|
/* This function writes a char in the LCD RAM. */
void LCD_GLASS_DisplayString(uint8_t *ptr)
|
{
uint32_t i = 0x00;
while(LCD_GetFlagStatus(LCD_FLAG_UDR) != RESET)
{
}
while ((*ptr != 0) & (i < 8))
{
LCD_GLASS_WriteChar(ptr, POINT_OFF, APOSTROPHE_OFF, i);
ptr++;
i++;
}
LCD_UpdateDisplayRequest();
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Set the second slave address of the specified I2C port.
The */
|
void I2CSlaveSecondAddressSet(unsigned long ulBase, unsigned char ucSlaveAddr)
|
/* Set the second slave address of the specified I2C port.
The */
void I2CSlaveSecondAddressSet(unsigned long ulBase, unsigned char ucSlaveAddr)
|
{
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_SMB) |= (I2C_SMB_SIICAEN);
xHWREGB(ulBase + I2C_A2) = ((ucSlaveAddr << 1));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Stops the data acquision It should be safe to call this function from any context */
|
static int usbduxsub_unlink_InURBs(struct usbduxsub *usbduxsub_tmp)
|
/* Stops the data acquision It should be safe to call this function from any context */
static int usbduxsub_unlink_InURBs(struct usbduxsub *usbduxsub_tmp)
|
{
int i = 0;
int err = 0;
if (usbduxsub_tmp && usbduxsub_tmp->urbIn) {
for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) {
if (usbduxsub_tmp->urbIn[i]) {
usb_kill_urb(usbduxsub_tmp->urbIn[i]);
}
dev_dbg(&usbduxsub_tmp->interface->dev,
"comedi: usbdux: unlinked InURB %d, err=%d\n",
i, err);
}
}
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* reads the first character of file 'f' and skips an optional BOM mark in its beginning plus its first line if it starts with '#'. Returns true if it skipped the first line. In any case, '*cp' has the first "valid" character of the file (after the optional BOM and a first-line comment). */
|
static int skipcomment(LoadF *lf, int *cp)
|
/* reads the first character of file 'f' and skips an optional BOM mark in its beginning plus its first line if it starts with '#'. Returns true if it skipped the first line. In any case, '*cp' has the first "valid" character of the file (after the optional BOM and a first-line comment). */
static int skipcomment(LoadF *lf, int *cp)
|
{
do {
c = getc(lf->f);
} while (c != EOF && c != '\n');
*cp = getc(lf->f);
return 1;
}
else return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* An insecure source has sent us a dentry, here we verify it and dget() it. This is used by ncpfs in its readdir implementation. Zero is returned in the dentry is invalid. */
|
int d_validate(struct dentry *dentry, struct dentry *dparent)
|
/* An insecure source has sent us a dentry, here we verify it and dget() it. This is used by ncpfs in its readdir implementation. Zero is returned in the dentry is invalid. */
int d_validate(struct dentry *dentry, struct dentry *dparent)
|
{
struct hlist_head *base;
struct hlist_node *lhp;
if (!kmem_ptr_validate(dentry_cache, dentry))
goto out;
if (dentry->d_parent != dparent)
goto out;
spin_lock(&dcache_lock);
base = d_hash(dparent, dentry->d_name.hash);
hlist_for_each(lhp,base) {
if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
__dget_locked(dentry);
spin_unlock(&dcache_lock);
return 1;
}
}
spin_unlock(&dcache_lock);
out:
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads the ST25DV ITtime duration for the GPO pulses. */
|
int32_t ST25DV_ReadITPulse(ST25DV_Object_t *pObj, ST25DV_PULSE_DURATION *const pITtime)
|
/* Reads the ST25DV ITtime duration for the GPO pulses. */
int32_t ST25DV_ReadITPulse(ST25DV_Object_t *pObj, ST25DV_PULSE_DURATION *const pITtime)
|
{
uint8_t reg_value;
int32_t status;
status = st25dv_get_ittime_delay( &(pObj->Ctx), ®_value);
if( status == ST25DV_OK )
{
*pITtime = (ST25DV_PULSE_DURATION)reg_value;
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Fills each TIM_BDTRInitStruct member with its default value. */
|
void TIM_InitBkdtStruct(TIM_BDTRInitType *TIM_BDTRInitStruct)
|
/* Fills each TIM_BDTRInitStruct member with its default value. */
void TIM_InitBkdtStruct(TIM_BDTRInitType *TIM_BDTRInitStruct)
|
{
TIM_BDTRInitStruct->OssrState = TIM_OSSR_STATE_DISABLE;
TIM_BDTRInitStruct->OssiState = TIM_OSSI_STATE_DISABLE;
TIM_BDTRInitStruct->LockLevel = TIM_LOCK_LEVEL_OFF;
TIM_BDTRInitStruct->DeadTime = 0x00;
TIM_BDTRInitStruct->Break = TIM_BREAK_IN_DISABLE;
TIM_BDTRInitStruct->BreakPolarity = TIM_BREAK_POLARITY_LOW;
TIM_BDTRInitStruct->AutomaticOutput = TIM_AUTO_OUTPUT_DISABLE;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory. */
|
void flash_erase_all_pages(void)
|
/* Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory. */
void flash_erase_all_pages(void)
|
{
flash_wait_for_last_operation();
FLASH_CR |= FLASH_CR_MER1 | FLASH_CR_MER2;
FLASH_CR |= FLASH_CR_START;
flash_wait_for_last_operation();
FLASH_CR &= ~FLASH_CR_MER1 & ~FLASH_CR_MER2;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Calls a Remote CPU function with 1 optional parameter and an optional return value. */
|
uint16_t IPCLiteLtoRFunctionCall(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulParam, uint32_t ulStatusFlag)
|
/* Calls a Remote CPU function with 1 optional parameter and an optional return value. */
uint16_t IPCLiteLtoRFunctionCall(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulParam, uint32_t ulStatusFlag)
|
{
uint16_t returnStatus;
if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag))
{
returnStatus = STATUS_FAIL;
}
else
{
IpcRegs.IPCSENDCOM = IPC_FUNC_CALL;
IpcRegs.IPCSENDADDR = ulAddress;
IpcRegs.IPCSENDDATA = ulParam;
IpcRegs.IPCSET.all |= (ulFlag | ulStatusFlag);
returnStatus = STATUS_PASS;
}
return returnStatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Registers the Zigbee Device Profile dissector with Wireshark. */
|
void proto_reg_handoff_zbee_zdp(void)
|
/* Registers the Zigbee Device Profile dissector with Wireshark. */
void proto_reg_handoff_zbee_zdp(void)
|
{
dissector_handle_t zdp_handle;
zdp_handle = find_dissector("zbee_zdp");
dissector_add_uint("zbee.profile", ZBEE_ZDP_PROFILE, zdp_handle);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Power down the USB PLL.
USERCC2 must have been set by a call to */
|
void rcc_usb_pll_off(void)
|
/* Power down the USB PLL.
USERCC2 must have been set by a call to */
void rcc_usb_pll_off(void)
|
{
SYSCTL_RCC2 |= SYSCTL_RCC2_USBPWRDN;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* There may be a fourth controller type. The S and D versions use the Winbond chip, and I think the E version does also. */
|
static void sub22(char b, char c)
|
/* There may be a fourth controller type. The S and D versions use the Winbond chip, and I think the E version does also. */
static void sub22(char b, char c)
|
{
int i;
for(i = 0; i < 3; ++i) {
inb(0x3f6);
outb_p(b,0xb0);
inb(0x3f6);
outb_p(c,0xb4);
inb(0x3f6);
if(inb(0xb4) == c) {
outb_p(7,0xb0);
inb(0x3f6);
return;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables or disables the Internal Multi Speed oscillator (MSI). */
|
void RCC_MSICmd(FunctionalState NewState)
|
/* Enables or disables the Internal Multi Speed oscillator (MSI). */
void RCC_MSICmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
*(__IO uint32_t *) CR_MSION_BB = (uint32_t)NewState;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Produce the Dynamic Command Protocol to handle the "varpolicy" command. */
|
EFI_STATUS EFIAPI VariablePolicyDynamicCommandEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* Produce the Dynamic Command Protocol to handle the "varpolicy" command. */
EFI_STATUS EFIAPI VariablePolicyDynamicCommandEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
mVarPolicyShellCommandHiiHandle = InitializeHiiPackage (ImageHandle);
if (mVarPolicyShellCommandHiiHandle == NULL) {
return EFI_ABORTED;
}
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEfiShellDynamicCommandProtocolGuid,
EFI_NATIVE_INTERFACE,
&mVarPolicyDynamicCommand
);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* These routines are used to access the registers of the DZ */
|
static u16 dz_in(struct dz_port *dport, unsigned offset)
|
/* These routines are used to access the registers of the DZ */
static u16 dz_in(struct dz_port *dport, unsigned offset)
|
{
void __iomem *addr = dport->port.membase + offset;
return readw(addr);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */
|
void SNVS_LP_SRTC_GetAlarm(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */
void SNVS_LP_SRTC_GetAlarm(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
{
assert(datetime != NULL);
uint32_t alarmSeconds = 0U;
alarmSeconds = base->LPTAR;
SNVS_LP_ConvertSecondsToDatetime(alarmSeconds, datetime);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* If @check_resume is set and there's a resume request pending when __pm_runtime_disable() is called and power.disable_depth is zero, the function will wake up the device before disabling its run-time PM. */
|
void __pm_runtime_disable(struct device *dev, bool check_resume)
|
/* If @check_resume is set and there's a resume request pending when __pm_runtime_disable() is called and power.disable_depth is zero, the function will wake up the device before disabling its run-time PM. */
void __pm_runtime_disable(struct device *dev, bool check_resume)
|
{
spin_lock_irq(&dev->power.lock);
if (dev->power.disable_depth > 0) {
dev->power.disable_depth++;
goto out;
}
if (check_resume && dev->power.request_pending
&& dev->power.request == RPM_REQ_RESUME) {
pm_runtime_get_noresume(dev);
__pm_runtime_resume(dev, false);
pm_runtime_put_noidle(dev);
}
if (!dev->power.disable_depth++)
__pm_runtime_barrier(dev);
out:
spin_unlock_irq(&dev->power.lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will set MCU RTC time to a new value. */
|
int32_t hal_rtc_set_time(rtc_dev_t *rtc, const rtc_time_t *time)
|
/* This function will set MCU RTC time to a new value. */
int32_t hal_rtc_set_time(rtc_dev_t *rtc, const rtc_time_t *time)
|
{
int ret = 0;
ret = rx8130ce_set_time(time, sizeof(rtc_time_t));
if(ret)
{
printf("board rtc set time fail\r\n");
return -1;
}
return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeIntnToUint8(IN INTN Operand, OUT UINT8 *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUint8(IN INTN Operand, OUT UINT8 *Result)
|
{
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if ((Operand >= 0) && (Operand <= MAX_UINT8)) {
*Result = (UINT8)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initiate a pairing procedure.
Initiate a pairing procedure with the remote device connected. The local device will become the "initiator" and the remote device will be the "responder" */
|
ADI_BLER_RESULT adi_radio_InitiatePairing(const uint16_t nConnHandle, const uint8_t nBond)
|
/* Initiate a pairing procedure.
Initiate a pairing procedure with the remote device connected. The local device will become the "initiator" and the remote device will be the "responder" */
ADI_BLER_RESULT adi_radio_InitiatePairing(const uint16_t nConnHandle, const uint8_t nBond)
|
{
ADI_BLER_RESULT bleResult;
ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_INIT_PAIRING);
ADI_BLE_RADIO_CMD_START(CMD_BLESMP_INIT_PAIRING);
memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], &nConnHandle, 2u);
memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN + 2], &nBond, 1u);
bleResult = bler_process_cmd(CMD_BLESMP_INIT_PAIRING, 3u, NULL, 0u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_EVENT_COMPLETE,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */
|
void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
|
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */
void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
|
{
return;
}
if (ep_type == USB_ENDPOINT_TYPE_ISOCHRONOUS) {
return;
}
if (ep_max_len > 64U) {
ep_max_len = 64U;
}
ep_config[ep_dir][ep_num].max_packet_size = ep_max_len;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Declares that the system memory buffer specified by MemoryBegin and MemoryLength as permanent memory that may be used for general purpose use by software. The amount of memory available to software may be less than MemoryLength if published memory has alignment restrictions. If MemoryLength is 0, then ASSERT(). If MemoryLength is greater than (MAX_ADDRESS - MemoryBegin + 1), then ASSERT(). */
|
RETURN_STATUS EFIAPI PublishSystemMemory(IN PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength)
|
/* Declares that the system memory buffer specified by MemoryBegin and MemoryLength as permanent memory that may be used for general purpose use by software. The amount of memory available to software may be less than MemoryLength if published memory has alignment restrictions. If MemoryLength is 0, then ASSERT(). If MemoryLength is greater than (MAX_ADDRESS - MemoryBegin + 1), then ASSERT(). */
RETURN_STATUS EFIAPI PublishSystemMemory(IN PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength)
|
{
EFI_STATUS Status;
ASSERT (MemoryLength > 0);
ASSERT (MemoryLength <= (MAX_ADDRESS - MemoryBegin + 1));
Status = PeiServicesInstallPeiMemory (MemoryBegin, MemoryLength);
return (RETURN_STATUS)Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is used to get I2S source clock frequency. */
|
static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
|
/* This function is used to get I2S source clock frequency. */
static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
|
{
(void)i2s;
uint32_t u32Freq, u32ClkSrcSel;
u32ClkSrcSel = CLK_GetModuleClockSource(I2S0_MODULE) << CLK_CLKSEL3_I2S0SEL_Pos;
switch(u32ClkSrcSel)
{
case CLK_CLKSEL3_I2S0SEL_HXT:
u32Freq = __HXT;
break;
case CLK_CLKSEL3_I2S0SEL_PLL:
u32Freq = CLK_GetPLLClockFreq();
break;
case CLK_CLKSEL3_I2S0SEL_HIRC:
u32Freq = __HIRC;
break;
case CLK_CLKSEL3_I2S0SEL_PCLK0:
u32Freq = CLK_GetPCLK0Freq();
break;
default:
u32Freq = CLK_GetPCLK0Freq();
break;
}
return u32Freq;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base LPUART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */
|
void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
|
/* param base LPUART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */
void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
|
{
assert(data);
while (length--)
{
while (!(base->STAT & LPUART_STAT_TDRE_MASK))
{
}
base->DATA = *(data++);
}
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Read data from serial device and save the data in buffer. */
|
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
|
/* Read data from serial device and save the data in buffer. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
|
{
return PL011UartRead ((UINTN)PcdGet64 (PcdSerialRegisterBase), Buffer, NumberOfBytes);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read Vital Product Data (VPD) from the Serial EPROM attached to the Intel bridge. */
|
int i2155x_read_vpd(int offset, int size, unsigned char *data)
|
/* Read Vital Product Data (VPD) from the Serial EPROM attached to the Intel bridge. */
int i2155x_read_vpd(int offset, int size, unsigned char *data)
|
{
int i, n;
u16 val16;
for (i = 0; i < size; i++) {
pci_write_config_word(i2155x.devno, I2155X_VPD_ADDR,
offset + i - I2155X_VPD_START);
for (n = 10000; n > 0; n--) {
pci_read_config_word(i2155x.devno, I2155X_VPD_ADDR, &val16);
if ((val16 & 0x8000) != 0)
break;
udelay(100);
}
if (n == 0) {
printf("i2155x_read_vpd: TIMEOUT\n");
return -1;
}
pci_read_config_byte(i2155x.devno, I2155X_VPD_DATA, &data[i]);
}
return i;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* REVISIT: generalize as clk_will_be_available(clk)? Other platforms have the very same problem (but not using at91 main_clk), and it'd be better to add one generic API rather than lots of platform-specific ones. */
|
int at91_suspend_entering_slow_clock(void)
|
/* REVISIT: generalize as clk_will_be_available(clk)? Other platforms have the very same problem (but not using at91 main_clk), and it'd be better to add one generic API rather than lots of platform-specific ones. */
int at91_suspend_entering_slow_clock(void)
|
{
return (target_state == PM_SUSPEND_MEM);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Deinitializes the RTC registers to their default reset values. */
|
uint8_t RTC_Config(RTC_Config_T *rtcConfig)
|
/* Deinitializes the RTC registers to their default reset values. */
uint8_t RTC_Config(RTC_Config_T *rtcConfig)
|
{
RTC_DisableWriteProtection();
if (RTC_EnableInit() == ERROR)
{
RTC_EnableWriteProtection();
return ERROR;
}
else
{
RTC->CTRL_B.TIMEFCFG = (rtcConfig->format);
RTC->PSC_B.SPSC = (rtcConfig->synchPrediv);
RTC->PSC_B.APSC = (rtcConfig->asynchPrediv);
RTC_DisableInit();
RTC_EnableWriteProtection();
return SUCCESS;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Erase a Page of FLASH.
Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */
|
void flash_erase_page(uint32_t page_address)
|
/* Erase a Page of FLASH.
Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */
void flash_erase_page(uint32_t page_address)
|
{
flash_wait_for_last_operation();
if ((desig_get_flash_size() > 512)
&& (page_address >= FLASH_BASE+0x00080000)) {
FLASH_CR2 |= FLASH_CR_PER;
FLASH_AR2 = page_address;
FLASH_CR2 |= FLASH_CR_STRT;
} else {
FLASH_CR |= FLASH_CR_PER;
FLASH_AR = page_address;
FLASH_CR |= FLASH_CR_STRT;
}
flash_wait_for_last_operation();
if ((desig_get_flash_size() > 512)
&& (page_address >= FLASH_BASE+0x00080000)) {
FLASH_CR2 &= ~FLASH_CR_PER;
} else {
FLASH_CR &= ~FLASH_CR_PER;
}
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Get the flag indicating whether we're running from a build directory. */
|
gboolean running_in_build_directory(void)
|
/* Get the flag indicating whether we're running from a build directory. */
gboolean running_in_build_directory(void)
|
{
return running_in_build_directory_flag;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns 0 for success or negative error code otherwise. */
|
static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
|
/* Returns 0 for success or negative error code otherwise. */
static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
|
{
struct mtd_info *mtd = nand_to_mtd(chip);
int ret;
if (!chip->setup_data_interface || !chip->data_interface)
return 0;
if (chip->onfi_version) {
u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
chip->onfi_timing_mode_default,
};
ret = chip->onfi_set_features(mtd, chip,
ONFI_FEATURE_ADDR_TIMING_MODE,
tmode_param);
if (ret)
goto err;
}
ret = chip->setup_data_interface(mtd, chipnr, chip->data_interface);
err:
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* 32-bit rotation. The C compiler is supposed to recognize it as a rotation and use the local architecture rotation opcode (if available). */
|
static uint32_t rotl(uint32_t x, int n)
|
/* 32-bit rotation. The C compiler is supposed to recognize it as a rotation and use the local architecture rotation opcode (if available). */
static uint32_t rotl(uint32_t x, int n)
|
{
return (x << n) | (x >> (32 - n));
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */
|
void LCDIDDCommandWrite(uint32_t ui32Base, uint32_t ui32CS, uint16_t ui16Cmd)
|
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */
void LCDIDDCommandWrite(uint32_t ui32Base, uint32_t ui32CS, uint16_t ui16Cmd)
|
{
uint32_t ui32Reg;
ASSERT(ui32Base == LCD0_BASE);
ASSERT((ui32CS == 0) || (ui32CS == 1));
ui32Reg = ui32CS ? LCD_O_LIDDCS1ADDR : LCD_O_LIDDCS0ADDR;
HWREG(ui32Base + ui32Reg) = ui16Cmd;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno. */
|
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
|
/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno. */
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
|
{
if (regno < 16) {
red >>= 8;
green >>= 8;
blue >>= 8;
((u32*)(info->pseudo_palette))[regno] = (red << 16) |
(green << 8) | blue;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks if a uDMA channel is enabled for operation. */
|
bool uDMAChannelIsEnabled(uint32_t ui32ChannelNum)
|
/* Checks if a uDMA channel is enabled for operation. */
bool uDMAChannelIsEnabled(uint32_t ui32ChannelNum)
|
{
ASSERT((ui32ChannelNum & 0xffff) < 32);
return ((HWREG(UDMA_ENASET) & (1 << (ui32ChannelNum & 0x1f))) ? true :
false);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is the entry point for the DXE Core. This function is required to call ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return. The DXE Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI System Table and the image handle for the DXE Core itself have been established. If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. */
|
VOID EFIAPI _ModuleEntryPoint(IN VOID *HobStart)
|
/* This function is the entry point for the DXE Core. This function is required to call ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return. The DXE Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI System Table and the image handle for the DXE Core itself have been established. If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. */
VOID EFIAPI _ModuleEntryPoint(IN VOID *HobStart)
|
{
gHobList = HobStart;
ProcessModuleEntryPointList (HobStart);
ASSERT (FALSE);
CpuDeadLoop ();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disable counting by a PMC. Note that the pmc argument is 0-based here, not 1-based. */
|
static void mpc7450_disable_pmc(unsigned int pmc, unsigned long mmcr[])
|
/* Disable counting by a PMC. Note that the pmc argument is 0-based here, not 1-based. */
static void mpc7450_disable_pmc(unsigned int pmc, unsigned long mmcr[])
|
{
if (pmc <= 1)
mmcr[0] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]);
else
mmcr[1] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Compute the lock range associated with the given address range. */
|
static void compute_lock_range(uint32_t ul_start, uint32_t ul_end, uint32_t *pul_actual_start, uint32_t *pul_actual_end)
|
/* Compute the lock range associated with the given address range. */
static void compute_lock_range(uint32_t ul_start, uint32_t ul_end, uint32_t *pul_actual_start, uint32_t *pul_actual_end)
|
{
uint32_t ul_actual_start, ul_actual_end;
ul_actual_start = ul_start - (ul_start % IFLASH_LOCK_REGION_SIZE);
ul_actual_end = ul_end - (ul_end % IFLASH_LOCK_REGION_SIZE) +
IFLASH_LOCK_REGION_SIZE - 1;
if (pul_actual_start) {
*pul_actual_start = ul_actual_start;
}
if (pul_actual_end) {
*pul_actual_end = ul_actual_end;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Sets or clears the selected data port bit. */
|
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
|
/* Sets or clears the selected data port bit. */
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
|
{
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
assert_param(IS_GPIO_BIT_ACTION(BitVal));
if (BitVal != Bit_RESET)
{
GPIOx->BSRR = GPIO_Pin;
}
else
{
GPIOx->BRR = GPIO_Pin;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Helper to get the register bit shift for the execution engines.
The engine with the highest index is placed on the lowest two bits in the OP_MODE and ENABLE registers. */
|
static int lp5562_get_engine_reg_shift(enum lp5562_led_sources engine, uint8_t *shift)
|
/* Helper to get the register bit shift for the execution engines.
The engine with the highest index is placed on the lowest two bits in the OP_MODE and ENABLE registers. */
static int lp5562_get_engine_reg_shift(enum lp5562_led_sources engine, uint8_t *shift)
|
{
switch (engine) {
case LP5562_SOURCE_ENGINE_1:
*shift = 4U;
break;
case LP5562_SOURCE_ENGINE_2:
*shift = 2U;
break;
case LP5562_SOURCE_ENGINE_3:
*shift = 0U;
break;
default:
return -EINVAL;
}
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
|
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
|
{
if(hsd->Instance==SDMMC1)
{
__HAL_RCC_SDMMC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
|
EFI_STATUS EFIAPI PcRtcEfiGetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL)
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
EFI_STATUS EFIAPI PcRtcEfiGetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL)
|
{
return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* do_bad_fiq handles the impossible case in the Fiq vector. */
|
void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
|
/* do_bad_fiq handles the impossible case in the Fiq vector. */
void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
|
{
efi_restore_gd();
printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
show_regs(pt_regs);
show_efi_loaded_images(pt_regs);
panic("Resetting CPU ...\n");
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Attribute write call back for the Long descriptor V2D3 attribute. */
|
static ssize_t write_long_des_v2d3_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
|
/* Attribute write call back for the Long descriptor V2D3 attribute. */
static ssize_t write_long_des_v2d3_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
|
{
uint8_t *value = attr->user_data;
if (offset >= sizeof(long_des_v2d3_2_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(long_des_v2d3_2_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
memcpy(value + offset, buf, len);
return len;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
|
static bool bma222_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
|
/* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool bma222_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
|
{
sensor_hal_t *const hal = sensor->hal;
switch (type) {
case SENSOR_READ_ACCELERATION:
return bma222_get_accel(hal, data);
case SENSOR_READ_TEMPERATURE:
return bma222_get_temperature(hal, data);
case SENSOR_READ_ID:
return bma222_device_id(hal, data);
default:
sensor->err = SENSOR_ERR_FUNCTION;
return false;
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* param base XRDC2 peripheral base address. param mem The memory region to operate. param The domain ID of the lock owner. */
|
uint8_t XRDC2_GetMemExclAccessLockDomainOwner(XRDC2_Type *base, xrdc2_mem_t mem)
|
/* param base XRDC2 peripheral base address. param mem The memory region to operate. param The domain ID of the lock owner. */
uint8_t XRDC2_GetMemExclAccessLockDomainOwner(XRDC2_Type *base, xrdc2_mem_t mem)
|
{
uint32_t mrc = XRDC2_GET_MRC((uint32_t)mem);
uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem);
return (uint8_t)((base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W5 & XRDC2_MRC_MRGD_W5_EALO_MASK) >>
XRDC2_MRC_MRGD_W5_EALO_SHIFT);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins)
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD_WPU);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Hinnant's algorithm to calculate the number of days offset from the epoch. */
|
static uint32_t hinnant(int y, int m, int d)
|
/* Hinnant's algorithm to calculate the number of days offset from the epoch. */
static uint32_t hinnant(int y, int m, int d)
|
{
unsigned yoe;
unsigned doy;
unsigned doe;
int era;
y -= (m <= 2);
era = ((y >= 0) ? y : (y - 399)) / 400;
yoe = y - era * 400;
doy = (153 * (m + ((m > 2) ? -3 : 9)) + 2)/5 + d - 1;
doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
return era * 146097 + ((int) doe) - 719468;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Taking an interrupt in FIQ mode is death, so both these functions disable irqs for the duration. Note - these functions are almost entirely coded in assembly. */
|
void __naked set_fiq_regs(struct pt_regs *regs)
|
/* Taking an interrupt in FIQ mode is death, so both these functions disable irqs for the duration. Note - these functions are almost entirely coded in assembly. */
void __naked set_fiq_regs(struct pt_regs *regs)
|
{
register unsigned long tmp;
asm volatile (
"mov ip, sp\n\
stmfd sp!, {fp, ip, lr, pc}\n\
sub fp, ip, #4\n\
mrs %0, cpsr\n\
msr cpsr_c, %2 @ select FIQ mode\n\
mov r0, r0\n\
ldmia %1, {r8 - r14}\n\
msr cpsr_c, %0 @ return to SVC mode\n\
mov r0, r0\n\
ldmfd sp, {fp, sp, pc}"
: "=&r" (tmp)
: "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ixgbe_atr_set_vlan_id_82599 - Sets the VLAN id in the ATR input stream @input: input stream to modify @vlan: the VLAN id to load */
|
s32 ixgbe_atr_set_vlan_id_82599(struct ixgbe_atr_input *input, u16 vlan)
|
/* ixgbe_atr_set_vlan_id_82599 - Sets the VLAN id in the ATR input stream @input: input stream to modify @vlan: the VLAN id to load */
s32 ixgbe_atr_set_vlan_id_82599(struct ixgbe_atr_input *input, u16 vlan)
|
{
input->byte_stream[IXGBE_ATR_VLAN_OFFSET + 1] = vlan >> 8;
input->byte_stream[IXGBE_ATR_VLAN_OFFSET] = vlan & 0xff;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets a general-purpose fuse bit with the appropriate erase and write operations. */
|
void flashcalw_set_gp_fuse_bit(uint32_t gp_fuse_bit, bool value)
|
/* Sets a general-purpose fuse bit with the appropriate erase and write operations. */
void flashcalw_set_gp_fuse_bit(uint32_t gp_fuse_bit, bool value)
|
{
if (value) {
flashcalw_erase_gp_fuse_bit(gp_fuse_bit, false);
} else {
flashcalw_write_gp_fuse_bit(gp_fuse_bit, false);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Returns: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values. */
|
gboolean g_signal_parse_name(const gchar *detailed_signal, GType itype, guint *signal_id_p, GQuark *detail_p, gboolean force_detail_quark)
|
/* Returns: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values. */
gboolean g_signal_parse_name(const gchar *detailed_signal, GType itype, guint *signal_id_p, GQuark *detail_p, gboolean force_detail_quark)
|
{
SignalNode *node;
GQuark detail = 0;
guint signal_id;
g_return_val_if_fail (detailed_signal != NULL, FALSE);
g_return_val_if_fail (G_TYPE_IS_INSTANTIATABLE (itype) || G_TYPE_IS_INTERFACE (itype), FALSE);
SIGNAL_LOCK ();
signal_id = signal_parse_name (detailed_signal, itype, &detail, force_detail_quark);
SIGNAL_UNLOCK ();
node = signal_id ? LOOKUP_SIGNAL_NODE (signal_id) : NULL;
if (!node || node->destroyed ||
(detail && !(node->flags & G_SIGNAL_DETAILED)))
return FALSE;
if (signal_id_p)
*signal_id_p = signal_id;
if (detail_p)
*detail_p = detail;
return TRUE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function handles USB-On-The-Go FS global interrupt request. */
|
void OTG_FS_IRQHandler(void)
|
/* This function handles USB-On-The-Go FS global interrupt request. */
void OTG_FS_IRQHandler(void)
|
{
HAL_HCD_IRQHandler(&hhcd_FS);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Check if media is changed according to sense data. */
|
BOOLEAN IsMediaChange(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
/* Check if media is changed according to sense data. */
BOOLEAN IsMediaChange(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
{
ATAPI_REQUEST_SENSE_DATA *SensePtr;
UINTN Index;
BOOLEAN MediaChange;
MediaChange = FALSE;
SensePtr = SenseData;
for (Index = 0; Index < SenseCounts; Index++) {
switch (SensePtr->sense_key) {
case ATA_SK_UNIT_ATTENTION:
switch (SensePtr->addnl_sense_code) {
case ATA_ASC_MEDIA_CHANGE:
MediaChange = TRUE;
break;
default:
break;
}
break;
default:
break;
}
SensePtr++;
}
return MediaChange;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Update the E2PROM by wrting any changes into the E2PROM chip, rewriting the checksum. */
|
static void initio_se2_update_all(unsigned long base)
|
/* Update the E2PROM by wrting any changes into the E2PROM chip, rewriting the checksum. */
static void initio_se2_update_all(unsigned long base)
|
{
int i;
u16 chksum = 0;
u16 *np, *np1;
i91unvramp = &i91unvram;
np = (u16 *) i91udftNvRam;
for (i = 0; i < 31; i++)
chksum += *np++;
*np = chksum;
initio_se2_ew_en(base);
np = (u16 *) i91udftNvRam;
np1 = (u16 *) i91unvramp;
for (i = 0; i < 32; i++, np++, np1++) {
if (*np != *np1)
initio_se2_wr(base, i, *np);
}
initio_se2_ew_ds(base);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* TCC callback of SW timer.
This function performs to the increasing the tick count. */
|
void sw_timer_get_config_defaults(struct sw_timer_config *const config)
|
/* TCC callback of SW timer.
This function performs to the increasing the tick count. */
void sw_timer_get_config_defaults(struct sw_timer_config *const config)
|
{
Assert(config);
config->accuracy = 100;
config->tcc_dev = 0;
config->tcc_callback_channel = 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Called when a BLE connection ends. Frees all GATT resources associated with the connection and cancels all relevant pending and in-progress GATT procedures. */
|
void ble_gattc_connection_broken(uint16_t conn_handle)
|
/* Called when a BLE connection ends. Frees all GATT resources associated with the connection and cancels all relevant pending and in-progress GATT procedures. */
void ble_gattc_connection_broken(uint16_t conn_handle)
|
{
ble_gattc_fail_procs(conn_handle, BLE_GATT_OP_NONE, BLE_HS_ENOTCONN);
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Advance the current position (read in new data if needed). Delete outdated string info. Find a match string for current position. */
|
STATIC VOID GetNextMatch()
|
/* Advance the current position (read in new data if needed). Delete outdated string info. Find a match string for current position. */
STATIC VOID GetNextMatch()
|
{
INT32 n;
mRemainder--;
if (++mPos == WNDSIZ * 2) {
memmove(&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
n = FreadCrc(&mText[WNDSIZ + MAXMATCH], WNDSIZ);
mRemainder += n;
mPos = WNDSIZ;
}
DeleteNode();
InsertNode();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Block input and output are easy on shared memory ethercards, the only complication is when the ring buffer wraps. The count will already be rounded up to a doubleword value via es_get_8390_hdr() above. */
|
static void es_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
|
/* Block input and output are easy on shared memory ethercards, the only complication is when the ring buffer wraps. The count will already be rounded up to a doubleword value via es_get_8390_hdr() above. */
static void es_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
|
{
void __iomem *xfer_start = ei_status.mem + ring_offset - ES_START_PG*256;
if (ring_offset + count > ES_STOP_PG*256) {
int semi_count = ES_STOP_PG*256 - ring_offset;
memcpy_fromio(skb->data, xfer_start, semi_count);
count -= semi_count;
memcpy_fromio(skb->data + semi_count, ei_status.mem, count);
} else {
memcpy_fromio(skb->data, xfer_start, count);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.