docstring
stringlengths 22
576
| signature
stringlengths 9
317
| prompt
stringlengths 57
886
| code
stringlengths 20
1.36k
| repository
stringclasses 49
values | language
stringclasses 2
values | license
stringclasses 9
values | stars
int64 15
21.3k
|
|---|---|---|---|---|---|---|---|
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints that the LDO tracking mode will be enabled in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */
|
void PMU_GPCEnableLdoTrackingMode(pmu_ldo_name_t name, uint32_t setpointMap)
|
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints that the LDO tracking mode will be enabled in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */
void PMU_GPCEnableLdoTrackingMode(pmu_ldo_name_t name, uint32_t setpointMap)
|
{
assert(name > kPMU_PllLdo);
assert(name < kPMU_SnvsDigLdo);
uint32_t ldoTrackingEnableRegArray[] = PMU_LDO_TRACKING_EN_SETPOINT_REGISTERS;
(*(volatile uint32_t *)ldoTrackingEnableRegArray[(uint8_t)name]) = setpointMap;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
|
void delay_us(uint32_t nus)
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void delay_us(uint32_t nus)
|
{
uint32_t i,j;
for(i = 0; i < nus; i++)
{
j=51;
while(j--)
{
__NOP();
}
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Calls a read-characteristic proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
|
static int ble_gattc_read_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr)
|
/* Calls a read-characteristic proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_read_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr)
|
{
int rc;
BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task());
BLE_HS_DBG_ASSERT(attr != NULL || status != 0);
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != 0 && status != BLE_HS_EDONE) {
STATS_INC(ble_gattc_stats, read_fail);
}
if (proc->read.cb == NULL) {
rc = 0;
} else {
rc = proc->read.cb(proc->conn_handle,
ble_gattc_error(status, att_handle), attr,
proc->read.cb_arg);
}
return rc;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Interrupt handler for TC00. Record the number of bytes received, and then restart a read transfer on the USART if the transfer was stopped. */
|
void TC00_Handler(void)
|
/* Interrupt handler for TC00. Record the number of bytes received, and then restart a read transfer on the USART if the transfer was stopped. */
void TC00_Handler(void)
|
{
static int32_t input_data = 0;
static int32_t cnt = 0;
tc_get_status(TC0, 0);
ioport_toggle_pin_level(PIN_PCCK_INPUT);
cnt++;
if (cnt == 1) {
place_data_to_port(input_data++);
if (input_data == BUFFER_SIZE ) {
input_data = 0;
}
} else if (cnt == 2) {
cnt =0;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Set a trigger on the rising edge of the reset pin, and measure the delay between the rising edge of reset and the rising edge of GPIO 2.1. */
|
int main(void)
|
/* Set a trigger on the rising edge of the reset pin, and measure the delay between the rising edge of reset and the rising edge of GPIO 2.1. */
int main(void)
|
{
SCB_SYSAHBCLKCTRL |= (SCB_SYSAHBCLKCTRL_GPIO);
GPIO_GPIO2DIR |= (1 << 1);
GPIO_GPIO2DATA |= (1 << 1);
while(1)
{
}
return 0;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* LCD Interrupt Handler, triggers on frame counter, every n'th frame. */
|
void LCD_IRQHandler(void)
|
/* LCD Interrupt Handler, triggers on frame counter, every n'th frame. */
void LCD_IRQHandler(void)
|
{
LCD_TypeDef *lcd = LCD;
lcd->IFC = 0xFFFFFFFF;
frameCounter++;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Calculates the largest ACL payload that the controller can accept. */
|
static uint16_t ble_hs_hci_max_acl_payload_sz(struct ble_hs_conn *conn)
|
/* Calculates the largest ACL payload that the controller can accept. */
static uint16_t ble_hs_hci_max_acl_payload_sz(struct ble_hs_conn *conn)
|
{
return conn->tx_ll_mtu;
if(conn->supported_feat&BLE_HS_HCI_LE_FEAT_DATA_PACKET_LENGTH_EXT)
{
return ble_hs_hci_buf_sz;
}else
{
return 27;
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* param base ACMP peripheral base address. param enable True to enable the ACMP. */
|
void ACMP_Enable(CMP_Type *base, bool enable)
|
/* param base ACMP peripheral base address. param enable True to enable the ACMP. */
void ACMP_Enable(CMP_Type *base, bool enable)
|
{
if (enable)
{
base->C0 = ((base->C0 | CMP_C0_EN_MASK) & ~CMP_C0_CFx_MASK);
}
else
{
base->C0 &= ~(CMP_C0_EN_MASK | CMP_C0_CFx_MASK);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* MCAN pinmux initialization function.
Set each required pin to MCAN functionality */
|
void CAN_0_PORT_init(void)
|
/* MCAN pinmux initialization function.
Set each required pin to MCAN functionality */
void CAN_0_PORT_init(void)
|
{
gpio_set_pin_function(PC12, MUX_PC12C_MCAN1_CANRX1);
gpio_set_pin_function(PC14, MUX_PC14C_MCAN1_CANTX1);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* calculates the b-field value in G based on the sensor value
After the calculation, the value is scaled to Gauss (1 G == 0.1 mT). */
|
static void tmag5273_channel_b_field_convert(int64_t raw_value, const uint16_t range, struct sensor_value *b_field)
|
/* calculates the b-field value in G based on the sensor value
After the calculation, the value is scaled to Gauss (1 G == 0.1 mT). */
static void tmag5273_channel_b_field_convert(int64_t raw_value, const uint16_t range, struct sensor_value *b_field)
|
{
raw_value *= (range << 1) * CONV_FACTOR_MT_TO_GS;
b_field->val1 = raw_value / (1 << 16);
const int64_t raw_dec_part = b_field->val1 * (1 << 16);
b_field->val2 = ((raw_value - raw_dec_part) * 1000000) / (1 << 16);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Our user interface is designed in terms of nanoseconds, while the hardware measures total times in its own unit. */
|
static u64 time_to_nsec(u32 value)
|
/* Our user interface is designed in terms of nanoseconds, while the hardware measures total times in its own unit. */
static u64 time_to_nsec(u32 value)
|
{
return ((u64)value) * 128000ull;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API is used to get the status of fifo mode in the register 0x3E bit 6 and 7. */
|
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_mode(u8 *v_fifo_mode_u8)
|
/* This API is used to get the status of fifo mode in the register 0x3E bit 6 and 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_mode(u8 *v_fifo_mode_u8)
|
{
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_FIFO_CGF0_ADDR_MODE__REG, &v_data_u8,
BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_fifo_mode_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_FIFO_CGF0_ADDR_MODE);
}
return comres;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function finds the udp instance by the specified <Address, Port> pair. */
|
BOOLEAN Udp4FindInstanceByPort(IN LIST_ENTRY *InstanceList, IN EFI_IPv4_ADDRESS *Address, IN UINT16 Port)
|
/* This function finds the udp instance by the specified <Address, Port> pair. */
BOOLEAN Udp4FindInstanceByPort(IN LIST_ENTRY *InstanceList, IN EFI_IPv4_ADDRESS *Address, IN UINT16 Port)
|
{
LIST_ENTRY *Entry;
UDP4_INSTANCE_DATA *Instance;
EFI_UDP4_CONFIG_DATA *ConfigData;
NET_LIST_FOR_EACH (Entry, InstanceList) {
Instance = NET_LIST_USER_STRUCT (Entry, UDP4_INSTANCE_DATA, Link);
ConfigData = &Instance->ConfigData;
if (!Instance->Configured || ConfigData->AcceptAnyPort) {
continue;
}
if (EFI_IP4_EQUAL (&ConfigData->StationAddress, Address) &&
(ConfigData->StationPort == Port))
{
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialize DMA non-sequence mode config structure. Fill each pstcDmaInit with default value. */
|
int32_t DMA_NonSeqStructInit(stc_dma_nonseq_init_t *pstcDmaNonSeqInit)
|
/* Initialize DMA non-sequence mode config structure. Fill each pstcDmaInit with default value. */
int32_t DMA_NonSeqStructInit(stc_dma_nonseq_init_t *pstcDmaNonSeqInit)
|
{
int32_t i32Ret = LL_OK;
if (NULL == pstcDmaNonSeqInit) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
pstcDmaNonSeqInit->u32Mode = DMA_NON_SEQ_NONE;
pstcDmaNonSeqInit->u32SrcCount = 0x00UL;
pstcDmaNonSeqInit->u32SrcOffset = 0x00UL;
pstcDmaNonSeqInit->u32DestCount = 0x00UL;
pstcDmaNonSeqInit->u32DestOffset = 0x00UL;
}
return i32Ret;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function reset both transmit and receive FIFO of specified smartcard module. */
|
void SC_ClearFIFO(SC_T *sc)
|
/* This function reset both transmit and receive FIFO of specified smartcard module. */
void SC_ClearFIFO(SC_T *sc)
|
{
while(sc->ALTCTL & SC_ALTCTL_SYNC_Msk)
{
;
}
sc->ALTCTL |= (SC_ALTCTL_TXRST_Msk | SC_ALTCTL_RXRST_Msk);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT8 EFIAPI S3MmioOr8(IN UINTN Address, IN UINT8 OrData)
|
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3MmioOr8(IN UINTN Address, IN UINT8 OrData)
|
{
return InternalSaveMmioWrite8ValueToBootScript (Address, MmioOr8 (Address, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
|
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
|
{
if(hspi->Instance==SPI1)
{
__HAL_RCC_SPI1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* 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 ;
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Calculates 32 bits CRC value of given data. */
|
uint32_t mss_mac_crc32(uint32_t value, const uint8_t *data, uint32_t data_length)
|
/* Calculates 32 bits CRC value of given data. */
uint32_t mss_mac_crc32(uint32_t value, const uint8_t *data, uint32_t data_length)
|
{
uint32_t a;
for(a=0; a<data_length; a++) {
value = crc32_table[(value ^ data[a]) & 0xff] ^ (value >> 8);
}
return value;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* hvc_put_chars: send characters to firmware for denoted vterm adapter @vtermno: The vtermno or unit_address of the adapter from which the data originated. @buf: The character buffer that contains the character data to send to firmware. @count: Send this number of characters. */
|
int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
|
/* hvc_put_chars: send characters to firmware for denoted vterm adapter @vtermno: The vtermno or unit_address of the adapter from which the data originated. @buf: The character buffer that contains the character data to send to firmware. @count: Send this number of characters. */
int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
|
{
unsigned long *lbuf = (unsigned long *) buf;
long ret;
if (count > MAX_VIO_PUT_CHARS)
count = MAX_VIO_PUT_CHARS;
ret = plpar_hcall_norets(H_PUT_TERM_CHAR, vtermno, count, lbuf[0],
lbuf[1]);
if (ret == H_SUCCESS)
return count;
if (ret == H_BUSY)
return 0;
return -EIO;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enables or disables the Analog filter of I2C peripheral. */
|
void I2C_AnalogFilterCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
/* Enables or disables the Analog filter of I2C peripheral. */
void I2C_AnalogFilterCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
{
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->FLTR &= (uint16_t)~((uint16_t)I2C_FLTR_ANOFF);
}
else
{
I2Cx->FLTR |= I2C_FLTR_ANOFF;
}
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. */
|
BOOLEAN EFIAPI X509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
|
/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. */
BOOLEAN EFIAPI X509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
|
{
X509 *X509Cert;
CONST UINT8 *Temp;
if ((Cert == NULL) || (SingleX509Cert == NULL) || (CertSize > INT_MAX)) {
return FALSE;
}
Temp = Cert;
X509Cert = d2i_X509 (NULL, &Temp, (long)CertSize);
if (X509Cert == NULL) {
return FALSE;
}
*SingleX509Cert = (UINT8 *)X509Cert;
return TRUE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Free the route cache entry. It is reference counted. */
|
VOID Ip4FreeRouteCacheEntry(IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry)
|
/* Free the route cache entry. It is reference counted. */
VOID Ip4FreeRouteCacheEntry(IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry)
|
{
ASSERT (RtCacheEntry->RefCnt > 0);
if (--RtCacheEntry->RefCnt == 0) {
FreePool (RtCacheEntry);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This exists as a separate routine to allow for special locking etc. It's used for both the full cleanup on exit, as well as the normal setup and teardown. */
|
static void ipath_ht_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr, u32 type, unsigned long pa)
|
/* This exists as a separate routine to allow for special locking etc. It's used for both the full cleanup on exit, as well as the normal setup and teardown. */
static void ipath_ht_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr, u32 type, unsigned long pa)
|
{
if (!dd->ipath_kregbase)
return;
if (pa != dd->ipath_tidinvalid) {
if (unlikely((pa & ~INFINIPATH_RT_ADDR_MASK))) {
dev_info(&dd->pcidev->dev,
"physaddr %lx has more than "
"40 bits, using only 40!!!\n", pa);
pa &= INFINIPATH_RT_ADDR_MASK;
}
if (type == RCVHQ_RCV_TYPE_EAGER)
pa |= dd->ipath_tidtemplate;
else {
u64 lenvalid = PAGE_SIZE >> 2;
lenvalid <<= INFINIPATH_RT_BUFSIZE_SHIFT;
pa |= lenvalid | INFINIPATH_RT_VALID;
}
}
writeq(pa, tidptr);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* s2io_rem_nic - Free the PCI device @pdev: structure containing the PCI related information of the device. Description: This function is called by the Pci subsystem to release a PCI device and free up all resource held up by the device. This could be in response to a Hot plug event or when the driver is to be removed from memory. */
|
static void __devexit s2io_rem_nic(struct pci_dev *pdev)
|
/* s2io_rem_nic - Free the PCI device @pdev: structure containing the PCI related information of the device. Description: This function is called by the Pci subsystem to release a PCI device and free up all resource held up by the device. This could be in response to a Hot plug event or when the driver is to be removed from memory. */
static void __devexit s2io_rem_nic(struct pci_dev *pdev)
|
{
struct net_device *dev =
(struct net_device *)pci_get_drvdata(pdev);
struct s2io_nic *sp;
if (dev == NULL) {
DBG_PRINT(ERR_DBG, "Driver Data is NULL!!\n");
return;
}
flush_scheduled_work();
sp = netdev_priv(dev);
unregister_netdev(dev);
free_shared_mem(sp);
iounmap(sp->bar0);
iounmap(sp->bar1);
pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL);
free_netdev(dev);
pci_disable_device(pdev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Send an Ack Message to the TFTP Server. */
|
static int send_ack(int sock, struct tftphdr_ack *ackhdr)
|
/* Send an Ack Message to the TFTP Server. */
static int send_ack(int sock, struct tftphdr_ack *ackhdr)
|
{
LOG_DBG("Client acking block number: %d", ntohs(ackhdr->block));
return send(sock, ackhdr, sizeof(struct tftphdr_ack), 0);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* libc/string/strnlen.c Determine the length of a fixed-size string */
|
size_t strnlen(const char *s, size_t n)
|
/* libc/string/strnlen.c Determine the length of a fixed-size string */
size_t strnlen(const char *s, size_t n)
|
{
const char * sc;
for (sc = s; n-- && *sc != '\0'; ++sc);
return sc - s;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Set the SysTick Clock Source.
The clock source can be either the AHB clock or the same clock divided by 8. */
|
void systick_set_clocksource(uint8_t clocksource)
|
/* Set the SysTick Clock Source.
The clock source can be either the AHB clock or the same clock divided by 8. */
void systick_set_clocksource(uint8_t clocksource)
|
{
STK_CSR = (STK_CSR & ~STK_CSR_CLKSOURCE) |
(clocksource ? STK_CSR_CLKSOURCE : 0);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Configures the transceiver.
This function is called to configure the transceiver after reset. */
|
static void trx_config(void)
|
/* Configures the transceiver.
This function is called to configure the transceiver after reset. */
static void trx_config(void)
|
{
pal_trx_bit_write(SR_PAD_IO_CLKM, PAD_CLKM_2_MA);
pal_trx_bit_write(SR_CLKM_SHA_SEL, CLKM_SHA_DISABLE);
pal_trx_bit_write(SR_CLKM_CTRL, CLKM_1MHZ);
pal_trx_bit_write(SR_AACK_SET_PD, SET_PD);
pal_trx_bit_write(SR_RX_SAFE_MODE, RX_SAFE_MODE_ENABLE);
pal_trx_bit_write(SR_IRQ_MASK_MODE, IRQ_MASK_MODE_ON);
pal_trx_reg_write(RG_IRQ_MASK, TRX_IRQ_DEFAULT);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Description : 初始化urb Arguments : @urb : Returns : 无 Notes : */
|
void usb_init_urb(struct urb *urb)
|
/* Description : 初始化urb Arguments : @urb : Returns : 无 Notes : */
void usb_init_urb(struct urb *urb)
|
{
if (urb == NULL)
{
hal_log_err("ERR: urb is NULL");
return;
}
memset(urb, 0, sizeof(struct urb));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Clean any dirty buffers in the blockdev mapping which alias newly-created file blocks. Only called for S_ISREG files - blockdevs do not set buffer_new */
|
static void clean_blockdev_aliases(struct dio *dio)
|
/* Clean any dirty buffers in the blockdev mapping which alias newly-created file blocks. Only called for S_ISREG files - blockdevs do not set buffer_new */
static void clean_blockdev_aliases(struct dio *dio)
|
{
unsigned i;
unsigned nblocks;
nblocks = dio->map_bh.b_size >> dio->inode->i_blkbits;
for (i = 0; i < nblocks; i++) {
unmap_underlying_metadata(dio->map_bh.b_bdev,
dio->map_bh.b_blocknr + i);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* struct qnet6_kif_disconnect { guint16 msgtype; // qnet6_kif_DISCONNECT guint16 size; // Size of message gint32 server_id; // Handle returned in qnet6_kif_connect_success }; */
|
static void display_channel_id(guint32 chid, proto_item *ti)
|
/* struct qnet6_kif_disconnect { guint16 msgtype; // qnet6_kif_DISCONNECT guint16 size; // Size of message gint32 server_id; // Handle returned in qnet6_kif_connect_success }; */
static void display_channel_id(guint32 chid, proto_item *ti)
|
{
if (chid & QNX_NTO_GLOBAL_CHANNEL)
{
proto_item_append_text(ti, " _NTO_GLOBAL_CHANNEL|%" G_GUINT32_FORMAT, chid & ~QNX_NTO_GLOBAL_CHANNEL);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Notification service to be called when gEmuThunkPpiGuid is installed. */
|
EFI_STATUS EFIAPI PeiServicesTablePointerNotifyCallback(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
|
/* Notification service to be called when gEmuThunkPpiGuid is installed. */
EFI_STATUS EFIAPI PeiServicesTablePointerNotifyCallback(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
|
{
gPeiServices = (CONST EFI_PEI_SERVICES **)PeiServices;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the specified I2C dual addressing mode. */
|
void I2C_DualAddressCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
/* Enables or disables the specified I2C dual addressing mode. */
void I2C_DualAddressCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
{
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->IC_TAR |= IC_TAR_ENDUAL_Set;
}
else
{
I2Cx->IC_TAR &= IC_TAR_ENDUAL_Reset;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Puts a data element into the SSI transmit FIFO. */
|
int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
|
/* Puts a data element into the SSI transmit FIFO. */
int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
|
{
ASSERT(_SSIBaseValid(ui32Base));
ASSERT((ui32Data & (0xfffffffe << (HWREG(ui32Base + SSI_O_CR0) &
SSI_CR0_DSS_M))) == 0);
if(HWREG(ui32Base + SSI_O_SR) & SSI_SR_TNF)
{
HWREG(ui32Base + SSI_O_DR) = ui32Data;
return(1);
}
else
{
return(0);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Deinitializes the Alternate Functions (remap and EXTI configuration) registers to their default reset values. */
|
void SYSCFG_DeInit(void)
|
/* Deinitializes the Alternate Functions (remap and EXTI configuration) registers to their default reset values. */
void SYSCFG_DeInit(void)
|
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, DISABLE);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* The R_ETHER_CheckWrite() function verifies that data transmission has completed. */
|
ether_return_t R_ETHER_CheckWrite(uint32_t channel)
|
/* The R_ETHER_CheckWrite() function verifies that data transmission has completed. */
ether_return_t R_ETHER_CheckWrite(uint32_t channel)
|
{
ether_return_t ret;
volatile struct st_edmac R_BSP_EVENACCESS_SFR * pedmac_adr;
const ether_control_t * pether_ch;
uint32_t phy_access;
if (ETHER_CHANNEL_MAX <= channel)
{
ret = ETHER_ERR_INVALID_CHAN;
}
else
{
pether_ch = g_eth_control_ch[channel].pether_control;
phy_access = g_eth_control_ch[channel].phy_access;
pedmac_adr = pether_ch[phy_access].pedmac;
while (0 != pedmac_adr->EDTRR.BIT.TR)
{
}
ret = ETHER_SUCCESS;
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* We arrive here after the ROM bootloader finished loading this second stage bootloader from flash. The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset. We do have a stack, so we can do the initialization in C. */
|
void __attribute__((noreturn))
|
/* We arrive here after the ROM bootloader finished loading this second stage bootloader from flash. The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset. We do have a stack, so we can do the initialization in C. */
void __attribute__((noreturn))
|
{
if (bootloader_init() != ESP_OK) {
bootloader_reset();
}
bootloader_state_t bs = { 0 };
int boot_index = select_partition_number(&bs);
if (boot_index == INVALID_INDEX) {
bootloader_reset();
}
bootloader_utility_load_boot_image(&bs, boot_index);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* retrieves the STP blocking state of a port */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
|
/* retrieves the STP blocking state of a port */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
|
{
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
IX_ETH_DB_CHECK_REFERENCE(blocked);
*blocked = ixEthDBPortInfo[portID].stpBlocked;
return IX_ETH_DB_SUCCESS;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Move 'size' bytes from card to PC. (Shouldn't be interrupted) */
|
static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest, int size)
|
/* Move 'size' bytes from card to PC. (Shouldn't be interrupted) */
static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest, int size)
|
{
wl3501_switch_page(this, (src & 0x8000) ? WL3501_BSS_SPAGE1 :
WL3501_BSS_SPAGE0);
wl3501_outb(src & 0xff, this->base_addr + WL3501_NIC_LMAL);
wl3501_outb((src >> 8) & 0x7f, this->base_addr + WL3501_NIC_LMAH);
insb(this->base_addr + WL3501_NIC_IODPA, dest, size);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Demultiple the packet. the packet delivery is processed in two passes. The first pass will enqueue a shared copy of the packet to each IP4 child that accepts the packet. The second pass will deliver a non-shared copy of the packet to each IP4 child that has pending receive requests. Data is copied if more than one child wants to consume the packet because each IP child needs its own copy of the packet to make changes. */
|
EFI_STATUS Ip4Demultiplex(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet, IN UINT8 *Option, IN UINT32 OptionLen)
|
/* Demultiple the packet. the packet delivery is processed in two passes. The first pass will enqueue a shared copy of the packet to each IP4 child that accepts the packet. The second pass will deliver a non-shared copy of the packet to each IP4 child that has pending receive requests. Data is copied if more than one child wants to consume the packet because each IP child needs its own copy of the packet to make changes. */
EFI_STATUS Ip4Demultiplex(IN IP4_SERVICE *IpSb, IN IP4_HEAD *Head, IN NET_BUF *Packet, IN UINT8 *Option, IN UINT32 OptionLen)
|
{
LIST_ENTRY *Entry;
IP4_INTERFACE *IpIf;
INTN Enqueued;
Enqueued = 0;
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link);
if (IpIf->Configured) {
Enqueued += Ip4InterfaceEnquePacket (
IpSb,
Head,
Packet,
Option,
OptionLen,
IpIf
);
}
}
NetbufFree (Packet);
if (Enqueued == 0) {
return EFI_NOT_FOUND;
}
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link);
if (IpIf->Configured) {
Ip4InterfaceDeliverPacket (IpSb, IpIf);
}
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Parameters: ch FEC channel duplex enet_MII_FULL_DUPLEX or enet_MII_HALF_DUPLEX */
|
void enet_duplex(int ch, ENET_DUPLEX duplex)
|
/* Parameters: ch FEC channel duplex enet_MII_FULL_DUPLEX or enet_MII_HALF_DUPLEX */
void enet_duplex(int ch, ENET_DUPLEX duplex)
|
{
switch (duplex)
{
case MII_HDX:
ENET_RCR |= ENET_RCR_DRT_MASK;
ENET_TCR &= (uint32_t)~ENET_TCR_FDEN_MASK;
break;
case MII_FDX:
default:
ENET_RCR &= ~ENET_RCR_DRT_MASK;
ENET_TCR |= ENET_TCR_FDEN_MASK;
break;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Wait for a flash operation to complete by polling the status register. */
|
static int flash_wait_op(struct adapter *adapter, int attempts, int delay)
|
/* Wait for a flash operation to complete by polling the status register. */
static int flash_wait_op(struct adapter *adapter, int attempts, int delay)
|
{
int ret;
u32 status;
while (1) {
if ((ret = sf1_write(adapter, 1, 1, SF_RD_STATUS)) != 0 ||
(ret = sf1_read(adapter, 1, 0, &status)) != 0)
return ret;
if (!(status & 1))
return 0;
if (--attempts == 0)
return -EAGAIN;
if (delay)
msleep(delay);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ibmvscsi_free-event_struct: - Changes status of event to "free" @pool: event_pool that contains the event @evt: srp_event_struct to be modified */
|
static void free_event_struct(struct event_pool *pool, struct srp_event_struct *evt)
|
/* ibmvscsi_free-event_struct: - Changes status of event to "free" @pool: event_pool that contains the event @evt: srp_event_struct to be modified */
static void free_event_struct(struct event_pool *pool, struct srp_event_struct *evt)
|
{
if (!valid_event_struct(pool, evt)) {
dev_err(evt->hostdata->dev, "Freeing invalid event_struct %p "
"(not in pool %p)\n", evt, pool->events);
return;
}
if (atomic_inc_return(&evt->free) != 1) {
dev_err(evt->hostdata->dev, "Freeing event_struct %p "
"which is not in use!\n", evt);
return;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets the RTC BCD calendar month value.
Requires unlocking the RTC write-protection (RTC_WPR) */
|
void rtc_calendar_set_month(uint8_t month)
|
/* Sets the RTC BCD calendar month value.
Requires unlocking the RTC write-protection (RTC_WPR) */
void rtc_calendar_set_month(uint8_t month)
|
{
uint8_t bcd_month = _rtc_dec_to_bcd(month);
RTC_DR &= ~(RTC_DR_MT_MASK << RTC_DR_MT_SHIFT | RTC_DR_MU_MASK << RTC_DR_MU_SHIFT);
RTC_DR |= (((bcd_month >> 4) & RTC_DR_MT_MASK) << RTC_DR_MT_SHIFT) |
((bcd_month & RTC_DR_MU_MASK) << RTC_DR_MU_SHIFT);
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Configure the XOSC32K external 32KHz oscillator clock source.
Configures the external 32KHz oscillator clock source with the given configuration settings. */
|
void system_clock_source_xosc32k_set_config(struct system_clock_source_xosc32k_config *const config)
|
/* Configure the XOSC32K external 32KHz oscillator clock source.
Configures the external 32KHz oscillator clock source with the given configuration settings. */
void system_clock_source_xosc32k_set_config(struct system_clock_source_xosc32k_config *const config)
|
{
SYSCTRL_XOSC32K_Type temp = SYSCTRL->XOSC32K;
temp.bit.STARTUP = config->startup_time;
if (config->external_clock == SYSTEM_CLOCK_EXTERNAL_CRYSTAL) {
temp.bit.XTALEN = 1;
} else {
temp.bit.XTALEN = 0;
}
temp.bit.AAMPEN = config->auto_gain_control;
temp.bit.EN1K = config->enable_1khz_output;
temp.bit.EN32K = config->enable_32khz_output;
temp.bit.ONDEMAND = config->on_demand;
temp.bit.RUNSTDBY = config->run_in_standby;
temp.bit.WRTLOCK = config->write_once;
_system_clock_inst.xosc32k.frequency = config->frequency;
SYSCTRL->XOSC32K = temp;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Change Logs: Date Author Notes SummerGift first version */
|
void rt_hw_systick_init(void)
|
/* Change Logs: Date Author Notes SummerGift first version */
void rt_hw_systick_init(void)
|
{
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
NVIC_SetPriority(SysTick_IRQn, 0xFF);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called by hardware module {bas,ser,usb}_gigaset when user data has been successfully received, for passing to the LL. Warning: skb must not be accessed anymore! */
|
void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb)
|
/* Called by hardware module {bas,ser,usb}_gigaset when user data has been successfully received, for passing to the LL. Warning: skb must not be accessed anymore! */
void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb)
|
{
isdn_if *iif = bcs->cs->iif;
iif->rcvcallb_skb(bcs->cs->myid, bcs->channel, skb);
bcs->trans_down++;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: Number of bytes needed to distinguish b from a. */
|
size_t __bt_defpfx(DBT *a, DBT *b) const
|
/* Returns: Number of bytes needed to distinguish b from a. */
size_t __bt_defpfx(DBT *a, DBT *b) const
|
{
register u_char *p1, *p2;
register size_t cnt, len;
cnt = 1;
len = MIN(a->size, b->size);
for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2, ++cnt)
if (*p1 != *p2)
return (cnt);
return (a->size < b->size ? a->size + 1 : a->size);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* If RealModeBufferSize is NULL, then ASSERT(). If ExtraStackSize is NULL, then ASSERT(). */
|
VOID EFIAPI AsmGetThunk16Properties(OUT UINT32 *RealModeBufferSize, OUT UINT32 *ExtraStackSize)
|
/* If RealModeBufferSize is NULL, then ASSERT(). If ExtraStackSize is NULL, then ASSERT(). */
VOID EFIAPI AsmGetThunk16Properties(OUT UINT32 *RealModeBufferSize, OUT UINT32 *ExtraStackSize)
|
{
ASSERT (RealModeBufferSize != NULL);
ASSERT (ExtraStackSize != NULL);
*RealModeBufferSize = m16Size;
*ExtraStackSize = sizeof (IA32_DWORD_REGS) + 8;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* De-initialises an PWM interface, Turns off an PWM hardware interface */
|
int32_t hal_pwm_finalize(pwm_dev_t *pwm)
|
/* De-initialises an PWM interface, Turns off an PWM hardware interface */
int32_t hal_pwm_finalize(pwm_dev_t *pwm)
|
{
pwmout_free(pwm->priv);
return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Remove a device from the list of MTD devices present in the system, and notify each currently active MTD 'user' of its departure. Returns zero on success or 1 on failure, which currently will happen if the requested device does not appear to be present in the list. */
|
int del_mtd_device(struct mtd_info *mtd)
|
/* Remove a device from the list of MTD devices present in the system, and notify each currently active MTD 'user' of its departure. Returns zero on success or 1 on failure, which currently will happen if the requested device does not appear to be present in the list. */
int del_mtd_device(struct mtd_info *mtd)
|
{
int ret;
if (mtd_table[mtd->index] != mtd) {
ret = -ENODEV;
} else if (mtd->usecount) {
printk(KERN_NOTICE "Removing MTD device #%d (%s)"
" with use count %d\n",
mtd->index, mtd->name, mtd->usecount);
ret = -EBUSY;
} else {
mtd_table[mtd->index] = NULL;
ret = 0;
}
return ret;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Some touchscreens need hsync information from the video driver to function correctly. We export it here. */
|
unsigned long w100fb_get_hsynclen(struct device *dev)
|
/* Some touchscreens need hsync information from the video driver to function correctly. We export it here. */
unsigned long w100fb_get_hsynclen(struct device *dev)
|
{
struct fb_info *info = dev_get_drvdata(dev);
struct w100fb_par *par=info->par;
if (par->blanked)
return 0;
else
return par->hsync_len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
|
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
|
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
|
{
uint32_t tmpreg = 0;
assert_param(IS_RCC_HSI_CALIBRATION_VALUE(HSICalibrationValue));
tmpreg = RCC->CR;
tmpreg &= ~RCC_CR_HSITRIM;
tmpreg |= (uint32_t)HSICalibrationValue << 3;
RCC->CR = tmpreg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configure one DMA channel using the configuration structure */
|
int XAxiVdma_DmaConfig(XAxiVdma *InstancePtr, u16 Direction, XAxiVdma_DmaSetup *DmaConfigPtr)
|
/* Configure one DMA channel using the configuration structure */
int XAxiVdma_DmaConfig(XAxiVdma *InstancePtr, u16 Direction, XAxiVdma_DmaSetup *DmaConfigPtr)
|
{
XAxiVdma_Channel *Channel;
Channel = XAxiVdma_GetChannel(InstancePtr, Direction);
if (!Channel) {
return XST_INVALID_PARAM;
}
if (Channel->IsValid) {
return XAxiVdma_ChannelConfig(Channel,
(XAxiVdma_ChannelSetup *)DmaConfigPtr);
}
else {
return XST_DEVICE_NOT_FOUND;
}
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Enables or disables the selected DAC channel wave generation. */
|
void DAC_WaveGenerationEnable(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState Cmd)
|
/* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationEnable(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState Cmd)
|
{
__IO uint32_t tmp = 0;
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_DAC_WAVE(DAC_Wave));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
tmp=DAC->CTRL;
tmp&=~(3<<(DAC_Channel+6));
if (Cmd != DISABLE)
{
tmp |= DAC_Wave << DAC_Channel;
}
else
{
tmp &=~(3<<(DAC_Channel+6));
}
DAC->CTRL = tmp;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* See "mss_ace.h" for details of how to use this function. */
|
void ACE_disable_comp_fall_irq(comparator_id_t comp_id)
|
/* See "mss_ace.h" for details of how to use this function. */
void ACE_disable_comp_fall_irq(comparator_id_t comp_id)
|
{
ASSERT( comp_id < NB_OF_COMPARATORS );
ACE->COMP_IRQ_EN &= ~(FIRST_FALL_IRQ_MASK << (uint32_t)comp_id);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Use property name to get a CRDeclaration from the declaration list. Returns #CRDeclaration with property name a_prop, or NULL if not found. */
|
CRDeclaration* cr_declaration_get_by_prop_name(CRDeclaration *a_this, const guchar *a_prop)
|
/* Use property name to get a CRDeclaration from the declaration list. Returns #CRDeclaration with property name a_prop, or NULL if not found. */
CRDeclaration* cr_declaration_get_by_prop_name(CRDeclaration *a_this, const guchar *a_prop)
|
{
CRDeclaration *cur = NULL;
g_return_val_if_fail (a_this, NULL);
g_return_val_if_fail (a_prop, NULL);
for (cur = a_this; cur; cur = cur->next) {
if (cur->property
&& cur->property->stryng
&& cur->property->stryng->str) {
if (!strcmp (cur->property->stryng->str,
a_prop)) {
return cur;
}
}
}
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enable one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
|
static void gpio_irq_enable(gpio_pin_handle_t pin)
|
/* Enable one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
static void gpio_irq_enable(gpio_pin_handle_t pin)
|
{
dw_gpio_pin_priv_t *gpio_pin_priv = pin;
dw_gpio_priv_t *port_handle = &gpio_handle[gpio_pin_priv->portidx];
dw_gpio_control_reg_t *gpio_control_reg = (dw_gpio_control_reg_t *)(port_handle->base + 0x30);
uint32_t offset = gpio_pin_priv->idx;
uint32_t val = gpio_control_reg->INTEN;
val |= (1 << offset);
gpio_control_reg->INTEN = val;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Board-specific function to access the device ready signal. */
|
static int kb9202_nand_ready(struct mtd_info *mtd)
|
/* Board-specific function to access the device ready signal. */
static int kb9202_nand_ready(struct mtd_info *mtd)
|
{
return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Function used to pretty print status of the PPC. */
|
static int print_status(const struct device *dev)
|
/* Function used to pretty print status of the PPC. */
static int print_status(const struct device *dev)
|
{
printk("PPC %s:\n", dev->name);
printk(" Dead battery: %d\n", ppc_is_dead_battery_mode(dev));
printk(" Is sourcing: %d\n", ppc_is_vbus_source(dev));
printk(" Is sinking: %d\n", ppc_is_vbus_sink(dev));
printk(" Is VBUS present: %d\n", ppc_is_vbus_present(dev));
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Clear the I2C time out flag of the specified I2C port.
The */
|
void I2CTimeoutFlagClear(unsigned long ulBase)
|
/* Clear the I2C time out flag of the specified I2C port.
The */
void I2CTimeoutFlagClear(unsigned long ulBase)
|
{
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_TOC) |= I2C_TOC_TIF;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Configures EXTI line 0 (connected to PA.00 pin) in interrupt mode. */
|
static void EXTI0_IRQHandler_Config(void)
|
/* Configures EXTI line 0 (connected to PA.00 pin) in interrupt mode. */
static void EXTI0_IRQHandler_Config(void)
|
{
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_0;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
HAL_NVIC_SetPriority(EXTI0_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* This function calculates the checksum for the Packet, utilizing the pre-calculated pseudo HeadSum to reduce some overhead. */
|
UINT16 Udp4Checksum(IN NET_BUF *Packet, IN UINT16 HeadSum)
|
/* This function calculates the checksum for the Packet, utilizing the pre-calculated pseudo HeadSum to reduce some overhead. */
UINT16 Udp4Checksum(IN NET_BUF *Packet, IN UINT16 HeadSum)
|
{
UINT16 Checksum;
Checksum = NetbufChecksum (Packet);
Checksum = NetAddChecksum (Checksum, HeadSum);
Checksum = NetAddChecksum (Checksum, HTONS ((UINT16)Packet->TotalSize));
return (UINT16) ~Checksum;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the temperature sensor and Vrefint channel. */
|
void ADC_TempSensorVrefintCmd(FunctionalState NewState)
|
/* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_TempSensorVrefintCmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
ADC1->CR2 |= ADC_CR2_TSVREFE;
}
else
{
ADC1->CR2 &= (uint32_t) (~ADC_CR2_TSVREFE);
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* This API reads the burst data length of Mag set in the sensor. */
|
uint16_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev)
|
/* This API reads the burst data length of Mag set in the sensor. */
uint16_t bma4_get_mag_burst(uint8_t *mag_burst, 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_AUX_IF_CONF_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
*mag_burst = BMA4_GET_BITS_POS_0(data, BMA4_MAG_BURST);
}
return rslt;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Emit code for binary expressions that "produce values" over two registers. */
|
static void codebinexpval(FuncState *fs, OpCode op, expdesc *e1, expdesc *e2, int line)
|
/* Emit code for binary expressions that "produce values" over two registers. */
static void codebinexpval(FuncState *fs, OpCode op, expdesc *e1, expdesc *e2, int line)
|
{
int v2 = luaK_exp2anyreg(fs, e2);
lua_assert(OP_ADD <= op && op <= OP_SHR);
finishbinexpval(fs, e1, e2, op, v2, 0, line, OP_MMBIN,
cast(TMS, (op - OP_ADD) + TM_ADD));
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* compute root r of a degree 1 polynomial over GF(2^m) (returned as log(1/r)) */
|
static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots)
|
/* compute root r of a degree 1 polynomial over GF(2^m) (returned as log(1/r)) */
static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly, unsigned int *roots)
|
{
int n = 0;
if (poly->c[0])
roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
bch->a_log_tab[poly->c[1]]);
return n;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* function handling both READ_6/WRITE_6 (non-scatter/gather mode) commands. Added S.Eranian */
|
static void simscsi_readwrite6(struct scsi_cmnd *sc, int mode)
|
/* function handling both READ_6/WRITE_6 (non-scatter/gather mode) commands. Added S.Eranian */
static void simscsi_readwrite6(struct scsi_cmnd *sc, int mode)
|
{
unsigned long offset;
offset = (((sc->cmnd[1] & 0x1f) << 16) | (sc->cmnd[2] << 8) | sc->cmnd[3])*512;
simscsi_sg_readwrite(sc, mode, offset);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Allocate a circular buffer and all associated memory. */
|
static struct oti6858_buf * oti6858_buf_alloc(unsigned int size)
|
/* Allocate a circular buffer and all associated memory. */
static struct oti6858_buf * oti6858_buf_alloc(unsigned int size)
|
{
struct oti6858_buf *pb;
if (size == 0)
return NULL;
pb = kmalloc(sizeof(struct oti6858_buf), GFP_KERNEL);
if (pb == NULL)
return NULL;
pb->buf_buf = kmalloc(size, GFP_KERNEL);
if (pb->buf_buf == NULL) {
kfree(pb);
return NULL;
}
pb->buf_size = size;
pb->buf_get = pb->buf_put = pb->buf_buf;
return pb;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns bus frequency (IPS on MPC512x, IPB on MPC52xx), or 0 if the bus frequency cannot be found. */
|
unsigned int mpc5xxx_get_bus_frequency(struct device_node *node)
|
/* Returns bus frequency (IPS on MPC512x, IPB on MPC52xx), or 0 if the bus frequency cannot be found. */
unsigned int mpc5xxx_get_bus_frequency(struct device_node *node)
|
{
struct device_node *np;
const unsigned int *p_bus_freq = NULL;
of_node_get(node);
while (node) {
p_bus_freq = of_get_property(node, "bus-frequency", NULL);
if (p_bus_freq)
break;
np = of_get_parent(node);
of_node_put(node);
node = np;
}
if (node)
of_node_put(node);
return p_bus_freq ? *p_bus_freq : 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The QP s_lock should be held and interrupts disabled. */
|
static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
|
/* The QP s_lock should be held and interrupts disabled. */
static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
|
{
struct ipath_ibdev *dev;
qp->s_len = restart_sge(&qp->s_sge, wqe, qp->s_psn,
ib_mtu_enum_to_int(qp->path_mtu));
dev = to_idev(qp->ibqp.device);
spin_lock(&dev->pending_lock);
if (list_empty(&qp->timerwait))
list_add_tail(&qp->timerwait,
&dev->pending[dev->pending_index]);
spin_unlock(&dev->pending_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* imm cannot deal with highmem, so this causes all IO pages for this host to reside in low memory (hence mapped) */
|
static int imm_adjust_queue(struct scsi_device *device)
|
/* imm cannot deal with highmem, so this causes all IO pages for this host to reside in low memory (hence mapped) */
static int imm_adjust_queue(struct scsi_device *device)
|
{
blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Wrapper for xdr_string that can be called directly from routines like clnt_call */
|
bool_t xdr_wrapstring(XDR *xdrs, char **cpp)
|
/* Wrapper for xdr_string that can be called directly from routines like clnt_call */
bool_t xdr_wrapstring(XDR *xdrs, char **cpp)
|
{
if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
return (TRUE);
}
return (FALSE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If warn is true, then emit a warning if the page is not uptodate and has not been truncated. */
|
static void __set_page_dirty(struct page *page, struct address_space *mapping, int warn)
|
/* If warn is true, then emit a warning if the page is not uptodate and has not been truncated. */
static void __set_page_dirty(struct page *page, struct address_space *mapping, int warn)
|
{
spin_lock_irq(&mapping->tree_lock);
if (page->mapping) {
WARN_ON_ONCE(warn && !PageUptodate(page));
account_page_dirtied(page, mapping);
radix_tree_tag_set(&mapping->page_tree,
page_index(page), PAGECACHE_TAG_DIRTY);
}
spin_unlock_irq(&mapping->tree_lock);
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
|
static void EFIAPI efi_copy_mem(void *destination, const void *source, size_t length)
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
static void EFIAPI efi_copy_mem(void *destination, const void *source, size_t length)
|
{
EFI_ENTRY("%p, %p, %ld", destination, source, (unsigned long)length);
memmove(destination, source, length);
EFI_EXIT(EFI_SUCCESS);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Copy a page in the request to/from the userspace buffer. Must be done atomically */
|
static int fuse_copy_page(struct fuse_copy_state *cs, struct page *page, unsigned offset, unsigned count, int zeroing)
|
/* Copy a page in the request to/from the userspace buffer. Must be done atomically */
static int fuse_copy_page(struct fuse_copy_state *cs, struct page *page, unsigned offset, unsigned count, int zeroing)
|
{
if (page && zeroing && count < PAGE_SIZE) {
void *mapaddr = kmap_atomic(page, KM_USER1);
memset(mapaddr, 0, PAGE_SIZE);
kunmap_atomic(mapaddr, KM_USER1);
}
while (count) {
if (!cs->len) {
int err = fuse_copy_fill(cs);
if (err)
return err;
}
if (page) {
void *mapaddr = kmap_atomic(page, KM_USER1);
void *buf = mapaddr + offset;
offset += fuse_copy_do(cs, &buf, &count);
kunmap_atomic(mapaddr, KM_USER1);
} else
offset += fuse_copy_do(cs, NULL, &count);
}
if (page && !cs->write)
flush_dcache_page(page);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Filter the valid mode list according to our own specific rules, in this case the list of discovered valid modes obtained by ACPI probing */
|
static unsigned long pacpi_mode_filter(struct ata_device *adev, unsigned long mask)
|
/* Filter the valid mode list according to our own specific rules, in this case the list of discovered valid modes obtained by ACPI probing */
static unsigned long pacpi_mode_filter(struct ata_device *adev, unsigned long mask)
|
{
struct pata_acpi *acpi = adev->link->ap->private_data;
return ata_bmdma_mode_filter(adev, mask & acpi->mask[adev->devno]);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, struct ath9k_channel *chan)
|
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, struct ath9k_channel *chan)
|
{
int i;
for (i = 0; i < ARRAY_SIZE(ah->ani); i++) {
if (ah->ani[i].c &&
ah->ani[i].c->channel == chan->channel)
return i;
if (ah->ani[i].c == NULL) {
ah->ani[i].c = chan;
return i;
}
}
ath_print(ath9k_hw_common(ah), ATH_DBG_ANI,
"No more channel states left. Using channel 0\n");
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ZigBee ZCL Fan Control cluster dissector for wireshark. */
|
static int dissect_zbee_zcl_fan_control(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
|
/* ZigBee ZCL Fan Control cluster dissector for wireshark. */
static int dissect_zbee_zcl_fan_control(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
|
{
return tvb_captured_length(tvb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* gfs2_unfreeze - reallow writes to the filesystem @sb: the VFS structure for the filesystem */
|
static int gfs2_unfreeze(struct super_block *sb)
|
/* gfs2_unfreeze - reallow writes to the filesystem @sb: the VFS structure for the filesystem */
static int gfs2_unfreeze(struct super_block *sb)
|
{
gfs2_unfreeze_fs(sb->s_fs_info);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Un-Register the Service E and all its Characteristics... */
|
void service_e_2_remove(void)
|
/* Un-Register the Service E and all its Characteristics... */
void service_e_2_remove(void)
|
{
bt_gatt_service_unregister(&service_e_2_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Adds command line options for setting serial port and baud rate for each uart device. */
|
static void native_tty_add_serial_options(void)
|
/* Adds command line options for setting serial port and baud rate for each uart device. */
static void native_tty_add_serial_options(void)
|
{
static struct args_struct_t opts[] = {
DT_INST_FOREACH_STATUS_OKAY(NATIVE_TTY_COMMAND_LINE_OPTS) ARG_TABLE_ENDMARKER};
native_add_command_line_opts(opts);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enables/Disable OIS chain DRDY on INT2 pin. This setting has priority over all other INT2 settings.. */
|
int32_t lsm6dso_aux_drdy_on_int2_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Enables/Disable OIS chain DRDY on INT2 pin. This setting has priority over all other INT2 settings.. */
int32_t lsm6dso_aux_drdy_on_int2_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dso_int_ois_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_OIS, (uint8_t *)®, 1);
if (ret == 0) {
reg.int2_drdy_ois = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_OIS, (uint8_t *)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Prepend the transport header to a block of data and send. */
|
STATIC VOID EFIAPI BhyveFwCtl_MsgSend(IN UINT32 OpCode, IN BIO_VEC Data[])
|
/* Prepend the transport header to a block of data and send. */
STATIC VOID EFIAPI BhyveFwCtl_MsgSend(IN UINT32 OpCode, IN BIO_VEC Data[])
|
{
BIO_VEC hIov[4];
UINT32 Hdr[3];
UINT32 i;
for (i = 0; i < 3; i++) {
hIov[i].Base = &Hdr[i];
hIov[i].Len = sizeof (Hdr[0]);
}
hIov[i].Base = NULL;
hIov[i].Len = 0;
Hdr[0] = BIov_WLen (hIov) + BIov_WLen (Data);
Hdr[1] = (UINT32)OpCode;
Hdr[2] = mBhyveFwCtlTxid;
BIov_SendAll (hIov);
BIov_SendAll (Data);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the proper CF_* direction based on CDB. */
|
static uint16_t qla2x00_get_cmd_direction(srb_t *sp)
|
/* Returns the proper CF_* direction based on CDB. */
static uint16_t qla2x00_get_cmd_direction(srb_t *sp)
|
{
uint16_t cflags;
cflags = 0;
if (sp->cmd->sc_data_direction == DMA_TO_DEVICE) {
cflags = CF_WRITE;
sp->fcport->vha->hw->qla_stats.output_bytes +=
scsi_bufflen(sp->cmd);
} else if (sp->cmd->sc_data_direction == DMA_FROM_DEVICE) {
cflags = CF_READ;
sp->fcport->vha->hw->qla_stats.input_bytes +=
scsi_bufflen(sp->cmd);
}
return (cflags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* When balance_dirty_pages decides that the caller needs to perform some non-background writeback, this is how many pages it will attempt to write. It should be somewhat larger than dirtied pages to ensure that reasonably large amounts of I/O are submitted. */
|
static long sync_writeback_pages(unsigned long dirtied)
|
/* When balance_dirty_pages decides that the caller needs to perform some non-background writeback, this is how many pages it will attempt to write. It should be somewhat larger than dirtied pages to ensure that reasonably large amounts of I/O are submitted. */
static long sync_writeback_pages(unsigned long dirtied)
|
{
if (dirtied < ratelimit_pages)
dirtied = ratelimit_pages;
return dirtied + dirtied / 2;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get instance number for DMA.
Static table of descriptors. */
|
static uint32_t DMA_GetInstance(DMA_Type *base)
|
/* Get instance number for DMA.
Static table of descriptors. */
static uint32_t DMA_GetInstance(DMA_Type *base)
|
{
int32_t instance;
for (instance = 0; instance < ARRAY_SIZE(s_dmaBases); instance++)
{
if (s_dmaBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_dmaBases));
return instance;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Updates inode attribute information by retrieving the data from the server. */
|
int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
/* Updates inode attribute information by retrieving the data from the server. */
int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
{
if (!(NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATTR)
&& !nfs_attribute_timeout(inode))
return NFS_STALE(inode) ? -ESTALE : 0;
return __nfs_revalidate_inode(server, inode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API is used to get the enable status of spi3 in the register 0x34 bit 0. */
|
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_spi3(u8 *spi3_u8)
|
/* This API is used to get the enable status of spi3 in the register 0x34 bit 0. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_spi3(u8 *spi3_u8)
|
{
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_ENABLE_SPI_MODE_3_REG,
&data_u8, BMA2x2_GEN_READ_WRITE_LENGTH);
*spi3_u8 = BMA2x2_GET_BITSLICE
(data_u8, BMA2x2_ENABLE_SPI_MODE_3);
}
return com_rslt;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* DMA Stream Set Peripheral Burst Configuration.
Ensure that the stream is disabled otherwise the setting will not be changed. */
|
void dma_set_peripheral_burst(uint32_t dma, uint8_t stream, uint32_t burst)
|
/* DMA Stream Set Peripheral Burst Configuration.
Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_set_peripheral_burst(uint32_t dma, uint8_t stream, uint32_t burst)
|
{
uint32_t reg32 = (DMA_SCR(dma, stream) & ~DMA_SxCR_PBURST_MASK);
DMA_SCR(dma, stream) = (reg32 | burst);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Changes: YOSHIFUJI Hideaki @USAGI Split up af-specific portion Derek Atkins */
|
int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb)
|
/* Changes: YOSHIFUJI Hideaki @USAGI Split up af-specific portion Derek Atkins */
int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb)
|
{
return xfrm4_extract_header(skb);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
|
BOOLEAN EFIAPI EcGroupGetCurve(IN CONST VOID *EcGroup, OUT VOID *BnPrime, OUT VOID *BnA, OUT VOID *BnB, IN VOID *BnCtx)
|
/* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
BOOLEAN EFIAPI EcGroupGetCurve(IN CONST VOID *EcGroup, OUT VOID *BnPrime, OUT VOID *BnA, OUT VOID *BnB, IN VOID *BnCtx)
|
{
return (BOOLEAN)EC_GROUP_get_curve (EcGroup, BnPrime, BnA, BnB, BnCtx);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Create an empty route table, includes its internal route cache */
|
IP4_ROUTE_TABLE* Ip4CreateRouteTable(VOID)
|
/* Create an empty route table, includes its internal route cache */
IP4_ROUTE_TABLE* Ip4CreateRouteTable(VOID)
|
{
IP4_ROUTE_TABLE *RtTable;
UINT32 Index;
RtTable = AllocatePool (sizeof (IP4_ROUTE_TABLE));
if (RtTable == NULL) {
return NULL;
}
RtTable->RefCnt = 1;
RtTable->TotalNum = 0;
for (Index = 0; Index <= IP4_MASK_MAX; Index++) {
InitializeListHead (&(RtTable->RouteArea[Index]));
}
RtTable->Next = NULL;
Ip4InitRouteCache (&RtTable->Cache);
return RtTable;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* For further information see John C. Bellamy's Digital Telephony, 1982, John Wiley & Sons, pps 98-111 and 472-476. */
|
static unsigned char linear2ulaw(int pcm_val)
|
/* For further information see John C. Bellamy's Digital Telephony, 1982, John Wiley & Sons, pps 98-111 and 472-476. */
static unsigned char linear2ulaw(int pcm_val)
|
{
int mask;
int seg;
unsigned char uval;
if (pcm_val < 0) {
pcm_val = BIAS - pcm_val;
mask = 0x7F;
} else {
pcm_val += BIAS;
mask = 0xFF;
}
if (pcm_val > 0x7FFF)
pcm_val = 0x7FFF;
seg = val_seg(pcm_val);
uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0xF);
return uval ^ mask;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Run all early native_posix initialization steps, including command line parsing and CPU start, until we are ready to let the HW models run via hwm_one_event() */
|
void posix_init(int argc, char *argv[])
|
/* Run all early native_posix initialization steps, including command line parsing and CPU start, until we are ready to let the HW models run via hwm_one_event() */
void posix_init(int argc, char *argv[])
|
{
setvbuf(stdout, NULL, _IOLBF, 512);
setvbuf(stderr, NULL, _IOLBF, 512);
run_native_tasks(_NATIVE_PRE_BOOT_1_LEVEL);
native_handle_cmd_line(argc, argv);
run_native_tasks(_NATIVE_PRE_BOOT_2_LEVEL);
hwm_init();
run_native_tasks(_NATIVE_PRE_BOOT_3_LEVEL);
posix_boot_cpu();
run_native_tasks(_NATIVE_FIRST_SLEEP_LEVEL);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Initializes the CAN interface. Note that this module assumes that the CAN device was already properly configured and brought online on the Linux system. Terminal command "ip addr" can be used to verify this. */
|
static void SocketCanInit(tCanSettings const *settings)
|
/* Initializes the CAN interface. Note that this module assumes that the CAN device was already properly configured and brought online on the Linux system. Terminal command "ip addr" can be used to verify this. */
static void SocketCanInit(tCanSettings const *settings)
|
{
char * canDeviceName;
socketCanEventsList = NULL;
socketCanEventsEntries = 0;
socketCanErrorDetected = false;
socketCanSettings.devicename = "";
socketCanSettings.channel = 0;
socketCanSettings.baudrate = CAN_BR500K;
socketCanSettings.code = 0x00000000u;
socketCanSettings.mask = 0x00000000u;
UtilCriticalSectionInit();
assert(settings != NULL);
if (settings != NULL)
{
socketCanSettings = *settings;
assert(settings->devicename != NULL);
if (settings->devicename != NULL)
{
canDeviceName = malloc(strlen(settings->devicename) + 1);
assert(canDeviceName != NULL);
if (canDeviceName != NULL)
{
strcpy(canDeviceName, settings->devicename);
socketCanSettings.devicename = canDeviceName;
}
}
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Un-Register the Service A and all its Characteristics... */
|
void service_a_3_remove(void)
|
/* Un-Register the Service A and all its Characteristics... */
void service_a_3_remove(void)
|
{
bt_gatt_service_unregister(&service_a_3_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Return true if an RCU grace period is in progress. The ACCESS_ONCE()s permit this function to be invoked without holding the root rcu_node structure's ->lock, but of course results can be subject to change. */
|
static int rcu_gp_in_progress(struct rcu_state *rsp)
|
/* Return true if an RCU grace period is in progress. The ACCESS_ONCE()s permit this function to be invoked without holding the root rcu_node structure's ->lock, but of course results can be subject to change. */
static int rcu_gp_in_progress(struct rcu_state *rsp)
|
{
return ACCESS_ONCE(rsp->completed) != ACCESS_ONCE(rsp->gpnum);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* dissect_packetid is a utility function which calculates the packets Packet ID from the data. Packet ID is a field located in the datagram header. */
|
static guint32 dissect_packetid(tvbuff_t *buffer, int offset, proto_tree *tree)
|
/* dissect_packetid is a utility function which calculates the packets Packet ID from the data. Packet ID is a field located in the datagram header. */
static guint32 dissect_packetid(tvbuff_t *buffer, int offset, proto_tree *tree)
|
{
guint32 packetid;
packetid = tvb_get_guint8(buffer, offset+2) << 14;
packetid += tvb_get_guint8(buffer, offset+1) << 6;
packetid += tvb_get_guint8(buffer, offset) & 63;
proto_tree_add_uint(tree, hf_knet_packetid, buffer, 0, 3, packetid);
return packetid;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.