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
|
|---|---|---|---|---|---|---|---|
/* This function is called with the hbalock held to post a hbq buffer to the firmware. If the function finds an empty slot in the HBQ, it will post the buffer. The function will return pointer to the hbq entry if it successfully post the buffer else it will return NULL. */
|
static int lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, struct hbq_dmabuf *hbq_buf)
|
/* This function is called with the hbalock held to post a hbq buffer to the firmware. If the function finds an empty slot in the HBQ, it will post the buffer. The function will return pointer to the hbq entry if it successfully post the buffer else it will return NULL. */
static int lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, struct hbq_dmabuf *hbq_buf)
|
{
return phba->lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function adds the CA certificate to the list of CAs when requesting Server or Client authentication for the chosen TLS connection. */
|
EFI_STATUS EFIAPI CryptoServiceTlsSetCaCertificate(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
/* This function adds the CA certificate to the list of CAs when requesting Server or Client authentication for the chosen TLS connection. */
EFI_STATUS EFIAPI CryptoServiceTlsSetCaCertificate(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
{
return CALL_BASECRYPTLIB (TlsSet.Services.CaCertificate, TlsSetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* adi_read() reads the data packet and decodes it. */
|
static int adi_read(struct adi_port *port)
|
/* adi_read() reads the data packet and decodes it. */
static int adi_read(struct adi_port *port)
|
{
int i;
int result = 0;
adi_read_packet(port);
adi_move_bits(port, port->adi[0].length);
for (i = 0; i < 2; i++)
if (port->adi[i].length)
result |= adi_decode(port->adi + i);
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialize LZW encoder. Please set s->clear_code, s->end_code and s->maxbits before run. */
|
void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize, int maxbits, enum FF_LZW_MODES mode, void(*lzw_put_bits)(PutBitContext *, int, unsigned))
|
/* Initialize LZW encoder. Please set s->clear_code, s->end_code and s->maxbits before run. */
void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize, int maxbits, enum FF_LZW_MODES mode, void(*lzw_put_bits)(PutBitContext *, int, unsigned))
|
{
s->clear_code = 256;
s->end_code = 257;
s->maxbits = maxbits;
init_put_bits(&s->pb, outbuf, outsize);
s->bufsize = outsize;
assert(s->maxbits >= 9 && s->maxbits <= LZW_MAXBITS);
s->maxcode = 1 << s->maxbits;
s->output_bytes = 0;
s->last_code = LZW_PREFIX_EMPTY;
s->bits = 9;
s->mode = mode;
s->put_bits = lzw_put_bits;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* free range of receive DMA buffers (i to last) */
|
static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last)
|
/* free range of receive DMA buffers (i to last) */
static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last)
|
{
int done = 0;
while(!done) {
info->rbufs[i].status = 0;
set_desc_count(info->rbufs[i], info->rbuf_fill_level);
if (i == last)
done = 1;
if (++i == info->rbuf_count)
i = 0;
}
info->rbuf_current = i;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This file is part of the Simba project. */
|
int mbedtls_hardware_poll(void *data_p, unsigned char *output_p, size_t len, size_t *olen)
|
/* This file is part of the Simba project. */
int mbedtls_hardware_poll(void *data_p, unsigned char *output_p, size_t len, size_t *olen)
|
{
uint32_t random;
uint32_t *u32_output_p;
int full;
int rest;
int i;
full = (len / 4);
rest = (len % 4);
u32_output_p = (uint32_t *)output_p;
for (i = 0; i < full; i++) {
*u32_output_p++ = random_read();
}
if (rest > 0) {
output_p = (unsigned char *)u32_output_p;
random = random_read();
for (i = 0; i < rest; i++) {
*output_p++ = (unsigned char)random;
random >>= 8;
}
}
*olen = len;
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* The function enables the Event mode or Continuous mode in the sequencer mode. */
|
void XAdcPs_SetSequencerEvent(XAdcPs *InstancePtr, int IsEventMode)
|
/* The function enables the Event mode or Continuous mode in the sequencer mode. */
void XAdcPs_SetSequencerEvent(XAdcPs *InstancePtr, int IsEventMode)
|
{
u32 RegValue;
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertVoid((IsEventMode == 0x1) || (IsEventMode == 0x0));
RegValue = XAdcPs_ReadInternalReg(InstancePtr,
XADCPS_CFR0_OFFSET) &
(~XADCPS_CFR0_EC_MASK);
if (IsEventMode == 0x1) {
RegValue |= XADCPS_CFR0_EC_MASK;
} else {
RegValue &= ~XADCPS_CFR0_EC_MASK;
}
XAdcPs_WriteInternalReg(InstancePtr, XADCPS_CFR0_OFFSET,
RegValue);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Programs the FLASH User Option Byte: IWDG_SW, RST_STOP, RST_STDBY, BOOT1 and VDDA ANALOG monitoring. */
|
FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER)
|
/* Programs the FLASH User Option Byte: IWDG_SW, RST_STOP, RST_STDBY, BOOT1 and VDDA ANALOG monitoring. */
FLASH_Status FLASH_OB_WriteUser(uint8_t OB_USER)
|
{
FLASH_Status status = FLASH_COMPLETE;
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
FLASH->CR |= FLASH_CR_OPTPG;
OB->USER = OB_USER | 0x88;
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status != FLASH_TIMEOUT)
{
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
return status;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Link is down, awaiting LINK UP event from port. This is also the first state at fabric creation. */
|
static void bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event)
|
/* Link is down, awaiting LINK UP event from port. This is also the first state at fabric creation. */
static void bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event)
|
{
bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
bfa_trc(fabric->fcs, event);
switch (event) {
case BFA_FCS_FABRIC_SM_LINK_UP:
bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
bfa_fcs_fabric_login(fabric);
break;
case BFA_FCS_FABRIC_SM_RETRY_OP:
break;
case BFA_FCS_FABRIC_SM_DELETE:
bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
bfa_fcs_fabric_delete(fabric);
break;
default:
bfa_sm_fault(fabric->fcs, event);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Note that the resulting size also contains bytes needed for alignment padding as well as padding to ensure that data structures don't cross a 4k-boundary where required. */
|
size_t itcw_calc_size(int intrg, int max_tidaws, int intrg_max_tidaws)
|
/* Note that the resulting size also contains bytes needed for alignment padding as well as padding to ensure that data structures don't cross a 4k-boundary where required. */
size_t itcw_calc_size(int intrg, int max_tidaws, int intrg_max_tidaws)
|
{
size_t len;
len = sizeof(struct itcw);
len += sizeof(struct tcw) + TCCB_MAX_SIZE + sizeof(struct tsb) + max_tidaws * sizeof(struct tidaw);
if (intrg) {
len += sizeof(struct tcw) + TCCB_MAX_SIZE + sizeof(struct tsb) + intrg_max_tidaws * sizeof(struct tidaw);
}
len += 63 + 7;
if ((max_tidaws > 0) || (intrg_max_tidaws > 0))
len += max(max_tidaws, intrg_max_tidaws) *
sizeof(struct tidaw) - 1;
return len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Create a new window title string with user-defined title preference. (Or ignore it if unspecified). */
|
gchar* create_user_window_title(const gchar *caption)
|
/* Create a new window title string with user-defined title preference. (Or ignore it if unspecified). */
gchar* create_user_window_title(const gchar *caption)
|
{
if (caption == NULL)
return g_strdup("");
if ((prefs.gui_window_title == NULL) || (*prefs.gui_window_title == '\0'))
return g_strdup(caption);
return g_strdup_printf("%s [%s]", caption, prefs.gui_window_title);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
{
return PciExpressBitFieldOr8 (Address, StartBit, EndBit, OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */
|
EFI_STATUS EFIAPI TlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */
EFI_STATUS EFIAPI TlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
{
return TlsSetHostPrivateKeyEx (Tls, Data, DataSize, NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT64 EFIAPI BitFieldOr64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 OrData)
|
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI BitFieldOr64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 OrData)
|
{
UINT64 Value1;
UINT64 Value2;
ASSERT (EndBit < 64);
ASSERT (StartBit <= EndBit);
ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1));
Value1 = LShiftU64 (OrData, StartBit);
Value2 = LShiftU64 ((UINT64)-2, EndBit);
return Operand | (Value1 & ~Value2);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Called by fabric for base port when fabric login is complete. Called by vport for virtual ports when FDISC is complete. */
|
void bfa_fcs_port_online(struct bfa_fcs_port_s *port)
|
/* Called by fabric for base port when fabric login is complete. Called by vport for virtual ports when FDISC is complete. */
void bfa_fcs_port_online(struct bfa_fcs_port_s *port)
|
{
bfa_sm_send_event(port, BFA_FCS_PORT_SM_ONLINE);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* bind the read only socket file description into the SSL */
|
int SSL_set_rfd(SSL *ssl, int fd)
|
/* bind the read only socket file description into the SSL */
int SSL_set_rfd(SSL *ssl, int fd)
|
{
SSL_ASSERT1(ssl);
SSL_ASSERT1(fd >= 0);
SSL_METHOD_CALL(set_fd, ssl, fd, 0);
return 1;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Emit code to go through if 'e' is true, jump otherwise. */
|
void luaK_goiftrue(FuncState *fs, expdesc *e)
|
/* Emit code to go through if 'e' is true, jump otherwise. */
void luaK_goiftrue(FuncState *fs, expdesc *e)
|
{
case VJMP: {
negatecondition(fs, e);
pc = e->u.info;
break;
}
case VK: case VKFLT: case VKINT: case VKSTR: case VTRUE: {
pc = NO_JUMP;
break;
}
default: {
pc = jumponcond(fs, e, 0);
break;
}
}
luaK_concat(fs, &e->f, pc);
luaK_patchtohere(fs, e->t);
e->t = NO_JUMP;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Step an edge by any amount (including negative values) */
|
PIXMAN_EXPORT void pixman_edge_step(pixman_edge_t *e, int n)
|
/* Step an edge by any amount (including negative values) */
PIXMAN_EXPORT void pixman_edge_step(pixman_edge_t *e, int n)
|
{
pixman_fixed_48_16_t ne;
e->x += n * e->stepx;
ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
if (n >= 0)
{
if (ne > 0)
{
int nx = (ne + e->dy - 1) / e->dy;
e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
e->x += nx * e->signdx;
}
}
else
{
if (ne <= -e->dy)
{
int nx = (-ne) / e->dy;
e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
e->x -= nx * e->signdx;
}
}
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Remove this QTD from the QH list and free its memory. If this QTD isn't the last one than remove also his successor(s). Returns the QTD which is part of an new URB and should be enqueued. */
|
static struct isp1760_qtd* clean_up_qtdlist(struct isp1760_qtd *qtd)
|
/* Remove this QTD from the QH list and free its memory. If this QTD isn't the last one than remove also his successor(s). Returns the QTD which is part of an new URB and should be enqueued. */
static struct isp1760_qtd* clean_up_qtdlist(struct isp1760_qtd *qtd)
|
{
struct isp1760_qtd *tmp_qtd;
int last_one;
do {
tmp_qtd = qtd->hw_next;
last_one = qtd->status & URB_COMPLETE_NOTIFY;
list_del(&qtd->qtd_list);
isp1760_qtd_free(qtd);
qtd = tmp_qtd;
} while (!last_one && qtd);
return qtd;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ADC Software Triggered Conversion on Injected Channels.
Special F1 Note this is a software trigger and requires triggering to be enabled and the trigger source to be set appropriately otherwise conversion will not start. This is not the same as the ADC start conversion operation. */
|
void adc_start_conversion_injected(uint32_t adc)
|
/* ADC Software Triggered Conversion on Injected Channels.
Special F1 Note this is a software trigger and requires triggering to be enabled and the trigger source to be set appropriately otherwise conversion will not start. This is not the same as the ADC start conversion operation. */
void adc_start_conversion_injected(uint32_t adc)
|
{
ADC_CR2(adc) |= ADC_CR2_JSWSTART;
while (ADC_CR2(adc) & ADC_CR2_JSWSTART);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Refresh the style of all children of an object. (Called recursively) */
|
static void report_style_change_core(void *style, lv_obj_t *obj)
|
/* Refresh the style of all children of an object. (Called recursively) */
static void report_style_change_core(void *style, lv_obj_t *obj)
|
{
uint32_t i;
for(i = 0; i < obj->style_cnt; i++) {
if(style == NULL || obj->styles[i].style == style) {
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY);
break;
}
}
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) {
report_style_change_core(style, obj->spec_attr->children[i]);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Checks whether the FLASH Prefetch Buffer status is set or not. */
|
FlagStatus FLASH_GetPrefetchBufSTS(void)
|
/* Checks whether the FLASH Prefetch Buffer status is set or not. */
FlagStatus FLASH_GetPrefetchBufSTS(void)
|
{
FlagStatus bitstatus = RESET;
if ((FLASH->AC & AC_PRFTBS_MSK) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* ADC Software Triggered Conversion on Regular Channels.
This starts conversion on a set of defined regular channels. It is cleared by hardware once conversion starts. */
|
void adc_start_conversion_regular(uint32_t adc)
|
/* ADC Software Triggered Conversion on Regular Channels.
This starts conversion on a set of defined regular channels. It is cleared by hardware once conversion starts. */
void adc_start_conversion_regular(uint32_t adc)
|
{
ADC_CR(adc) |= ADC_CR_ADSTART;
while (ADC_CR(adc) & ADC_CR_ADSTART);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Checks whether 2 effects can be combined together */
|
static int check_effects_compatible(struct ff_effect *e1, struct ff_effect *e2)
|
/* Checks whether 2 effects can be combined together */
static int check_effects_compatible(struct ff_effect *e1, struct ff_effect *e2)
|
{
return e1->type == e2->type &&
(e1->type != FF_PERIODIC ||
e1->u.periodic.waveform == e2->u.periodic.waveform);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Delete a lock and then free it. Wake up processes that are blocked waiting for this lock, notify the FS that the lock has been cleared and finally free the lock. */
|
static void locks_delete_lock(struct file_lock **thisfl_p)
|
/* Delete a lock and then free it. Wake up processes that are blocked waiting for this lock, notify the FS that the lock has been cleared and finally free the lock. */
static void locks_delete_lock(struct file_lock **thisfl_p)
|
{
struct file_lock *fl = *thisfl_p;
*thisfl_p = fl->fl_next;
fl->fl_next = NULL;
list_del_init(&fl->fl_link);
fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
if (fl->fl_fasync != NULL) {
printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
fl->fl_fasync = NULL;
}
if (fl->fl_nspid) {
put_pid(fl->fl_nspid);
fl->fl_nspid = NULL;
}
locks_wake_up_blocks(fl);
locks_free_lock(fl);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns AmlByteEncoding according to OpCode Byte. */
|
AML_BYTE_ENCODING* AmlSearchByOpByte(IN UINT8 *OpByteBuffer)
|
/* This function returns AmlByteEncoding according to OpCode Byte. */
AML_BYTE_ENCODING* AmlSearchByOpByte(IN UINT8 *OpByteBuffer)
|
{
UINT8 OpCode;
UINT8 SubOpCode;
UINTN Index;
OpCode = OpByteBuffer[0];
if (OpCode == AML_EXT_OP) {
SubOpCode = OpByteBuffer[1];
} else {
SubOpCode = 0;
}
for (Index = 0; Index < sizeof (mAmlByteEncoding)/sizeof (mAmlByteEncoding[0]); Index++) {
if ((mAmlByteEncoding[Index].OpCode == OpCode) && (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
return &mAmlByteEncoding[Index];
}
}
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* fc_fcp_lport_queue_ready() - Determine if the lport and it's queue is ready @lport: The local port to be checked */
|
static int fc_fcp_lport_queue_ready(struct fc_lport *lport)
|
/* fc_fcp_lport_queue_ready() - Determine if the lport and it's queue is ready @lport: The local port to be checked */
static int fc_fcp_lport_queue_ready(struct fc_lport *lport)
|
{
return (lport->state == LPORT_ST_READY) &&
lport->link_up && !lport->qfull;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function flushes cache over QH for particular endpoint. */
|
static void ci_flush_qh(int ep_num)
|
/* This function flushes cache over QH for particular endpoint. */
static void ci_flush_qh(int ep_num)
|
{
struct ept_queue_head *head = ci_get_qh(ep_num, 0);
const unsigned long start = (unsigned long)head;
const unsigned long end = start + 2 * sizeof(*head);
flush_dcache_range(start, end);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Try to find if this argument is in the list (and it is not manual) if it does, try to parse it, set its dest accordingly, and return true if it is not found, return false */
|
bool nsi_cmd_parse_one_arg(char *argv, struct args_struct_t args_struct[])
|
/* Try to find if this argument is in the list (and it is not manual) if it does, try to parse it, set its dest accordingly, and return true if it is not found, return false */
bool nsi_cmd_parse_one_arg(char *argv, struct args_struct_t args_struct[])
|
{
int count = 0;
int ret;
if (nsi_cmd_is_help_option(argv)) {
nsi_cmd_print_long_help(args_struct);
nsi_exit(0);
}
while (args_struct[count].option != NULL) {
if (args_struct[count].manual) {
count++;
continue;
}
ret = nsi_cmd_is_option(argv, args_struct[count].option,
!args_struct[count].is_switch);
if (ret) {
nsi_cmd_handle_this_matched_arg(argv,
ret,
&args_struct[count]);
return true;
}
count++;
}
return false;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Indicates whether or not the I2C bus is busy. */
|
tBoolean I2CMasterBusBusy(unsigned long ulBase)
|
/* Indicates whether or not the I2C bus is busy. */
tBoolean I2CMasterBusBusy(unsigned long ulBase)
|
{
ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));
if(HWREG(ulBase + I2C_O_MCS) & I2C_MCS_BUSBSY)
{
return(true);
}
else
{
return(false);
}
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Calculate how much is left in device This method is called by the upper tty layer. #according to sources N_TTY.c it expects a value >= 0 and does not check for negative values. */
|
static int ntty_write_room(struct tty_struct *tty)
|
/* Calculate how much is left in device This method is called by the upper tty layer. #according to sources N_TTY.c it expects a value >= 0 and does not check for negative values. */
static int ntty_write_room(struct tty_struct *tty)
|
{
struct port *port = tty->driver_data;
int room = 0;
const struct nozomi *dc = get_dc_by_tty(tty);
if (!dc || !port)
return 0;
if (!mutex_trylock(&port->tty_sem))
return 0;
if (!port->port.count)
goto exit;
room = port->fifo_ul.size - kfifo_len(&port->fifo_ul);
exit:
mutex_unlock(&port->tty_sem);
return room;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
|
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
/* param base CSI peripheral base address. param fifo The FIFO DMA reques to enable or disable. param enable True to enable, false to disable. */
void CSI_EnableFifoDmaRequest(CSI_Type *base, csi_fifo_t fifo, bool enable)
|
{
uint32_t cr3 = 0U;
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_RxFifo))
{
cr3 |= CSI_CR3_DMA_REQ_EN_RFF_MASK;
}
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_StatFifo))
{
cr3 |= CSI_CR3_DMA_REQ_EN_SFF_MASK;
}
if (enable)
{
CSI_REG_CR3(base) |= cr3;
}
else
{
CSI_REG_CR3(base) &= ~cr3;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Setup the input buffer state to scan a string. The next call to zconflex() will scan from a */
|
YY_BUFFER_STATE zconf_scan_string(yyconst char *yy_str)
|
/* Setup the input buffer state to scan a string. The next call to zconflex() will scan from a */
YY_BUFFER_STATE zconf_scan_string(yyconst char *yy_str)
|
{
return zconf_scan_bytes(yystr,strlen(yystr) );
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Writes a Half-word buffer to the FSMC SRAM memory. */
|
void SRAM_WriteBuffer(uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
|
/* Writes a Half-word buffer to the FSMC SRAM memory. */
void SRAM_WriteBuffer(uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
|
{
for(; NumHalfwordToWrite != 0; NumHalfwordToWrite--)
{
*(uint16_t *) (Bank1_SRAM3_ADDR + WriteAddr) = *pBuffer++;
WriteAddr += 2;
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result)
|
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnMult(IN UINTN Multiplicand, IN UINTN Multiplier, OUT UINTN *Result)
|
{
UINT64 IntermediateResult;
if (sizeof (UINTN) == sizeof (UINT32)) {
IntermediateResult = ((UINT64)Multiplicand) *((UINT64)Multiplier);
return SafeUint64ToUintn (IntermediateResult, Result);
}
return SafeUint64Mult ((UINT64)Multiplicand, (UINT64)Multiplier, (UINT64 *)Result);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Convert a netlink message received from a netlink socket to a nl_msg */
|
struct nl_msg* nlmsg_convert(struct nlmsghdr *hdr)
|
/* Convert a netlink message received from a netlink socket to a nl_msg */
struct nl_msg* nlmsg_convert(struct nlmsghdr *hdr)
|
{
struct nl_msg *nm;
nm = __nlmsg_alloc(NLMSG_ALIGN(hdr->nlmsg_len));
if (!nm)
goto errout;
memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len);
return nm;
errout:
nlmsg_free(nm);
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Description: Extract DIF parameters from the command if possible. Otherwise, use default parameters. */
|
static void lpfc_get_cmd_dif_parms(struct scsi_cmnd *sc, uint16_t *apptagmask, uint16_t *apptagval, uint32_t *reftag)
|
/* Description: Extract DIF parameters from the command if possible. Otherwise, use default parameters. */
static void lpfc_get_cmd_dif_parms(struct scsi_cmnd *sc, uint16_t *apptagmask, uint16_t *apptagval, uint32_t *reftag)
|
{
struct scsi_dif_tuple *spt;
unsigned char op = scsi_get_prot_op(sc);
unsigned int protcnt = scsi_prot_sg_count(sc);
static int cnt;
if (protcnt && (op == SCSI_PROT_WRITE_STRIP ||
op == SCSI_PROT_WRITE_PASS)) {
cnt++;
spt = page_address(sg_page(scsi_prot_sglist(sc))) +
scsi_prot_sglist(sc)[0].offset;
*apptagmask = 0;
*apptagval = 0;
*reftag = cpu_to_be32(spt->ref_tag);
} else {
*reftag = (uint32_t) (0xffffffff & scsi_get_lba(sc));
*apptagmask = 0;
*apptagval = 0;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if the CRC of a MODBUS message is correct. */
|
int32_t modbus_check_crc(uint8_t *msg, uint8_t msg_length)
|
/* Check if the CRC of a MODBUS message is correct. */
int32_t modbus_check_crc(uint8_t *msg, uint8_t msg_length)
|
{
int32_t ret = 0;
uint16_t crc_calculated, crc_received;
uint8_t crc_hi, crc_lo;
if(msg_length < 2)
return -1;
modbus_crc16(msg, msg_length - 2, &crc_hi, &crc_lo);
crc_calculated = ((uint16_t)crc_hi << 8) | (uint16_t)crc_lo;
crc_received = ((uint16_t)msg[msg_length - 1] << 8) |
(uint16_t)msg[msg_length - 2];
if(crc_calculated == crc_received)
ret = msg_length;
else
ret = -1;
return ret;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Cache the DHCPv6 proxy offer packet according to the received order. */
|
EFI_STATUS PxeBcCopyDhcp6Proxy(IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
|
/* Cache the DHCPv6 proxy offer packet according to the received order. */
EFI_STATUS PxeBcCopyDhcp6Proxy(IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
|
{
EFI_PXE_BASE_CODE_MODE *Mode;
EFI_DHCP6_PACKET *Offer;
EFI_STATUS Status;
ASSERT (OfferIndex < Private->OfferNum);
ASSERT (OfferIndex < PXEBC_OFFER_MAX_NUM);
Mode = Private->PxeBc.Mode;
Offer = &Private->OfferBuffer[OfferIndex].Dhcp6.Packet.Offer;
Status = PxeBcCacheDhcp6Packet (&Private->ProxyOffer.Dhcp6.Packet.Offer, Offer);
if (EFI_ERROR (Status)) {
return Status;
}
PxeBcParseDhcp6Packet (&Private->ProxyOffer.Dhcp6);
CopyMem (&Mode->ProxyOffer.Dhcpv6, &Offer->Dhcp6, Offer->Length);
Mode->ProxyOfferReceived = TRUE;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function: MX25_FASTREAD Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: The FASTREAD instruction is for quickly reading data out. Return Message: FlashAddressInvalid, FlashOperationSuccess */
|
ReturnMsg MX25_FASTREAD(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
|
/* Function: MX25_FASTREAD Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: The FASTREAD instruction is for quickly reading data out. Return Message: FlashAddressInvalid, FlashOperationSuccess */
ReturnMsg MX25_FASTREAD(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
|
{
uint32_t index;
uint8_t addr_4byte_mode;
uint8_t dc;
if( flash_address > FlashSize ) return FlashAddressInvalid;
if( IsFlash4Byte() )
addr_4byte_mode = TRUE;
else
addr_4byte_mode = FALSE;
dc = GetDummyCycle( DUMMY_CONF_FASTREAD );
CS_Low();
SendByte( FLASH_CMD_FASTREAD, SIO );
SendFlashAddr( flash_address, SIO, addr_4byte_mode );
InsertDummyCycle ( dc );
for( index=0; index < byte_length; index++ )
{
*(target_address + index) = GetByte( SIO );
}
CS_High();
return FlashOperationSuccess;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Enables or disables the RTC registers write protection. */
|
void RTC_EnableWriteProtection(FunctionalState Cmd)
|
/* Enables or disables the RTC registers write protection. */
void RTC_EnableWriteProtection(FunctionalState Cmd)
|
{
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
RTC->WRP = 0xFF;
}
else
{
RTC->WRP = 0xCA;
RTC->WRP = 0x53;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* The function is used to set BOD reset or Interrupt selection. */
|
void SysCtlBODFunctionSelect(unsigned long ulBodFunction)
|
/* The function is used to set BOD reset or Interrupt selection. */
void SysCtlBODFunctionSelect(unsigned long ulBodFunction)
|
{
xASSERT((ulBodFunction == PWRCU_LVDCSR_BODRST) ||
(ulBodFunction == PWRCU_LVDCSR_BODINT)
);
xHWREG(PWRCU_LVDCSR) |= ulBodFunction;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* static void _genie_lpm_io_wakeup_timer_init(void) { aos_timer_new(&genie_lpm_ctx.io_wakeup_timer, _genie_lpm_io_wakeup_timer_irq_handler, NULL, 10, 0); aos_timer_stop(&genie_lpm_ctx.io_wakeup_timer); } */
|
static void _genie_lpm_wakeup_timer_init(void)
|
/* static void _genie_lpm_io_wakeup_timer_init(void) { aos_timer_new(&genie_lpm_ctx.io_wakeup_timer, _genie_lpm_io_wakeup_timer_irq_handler, NULL, 10, 0); aos_timer_stop(&genie_lpm_ctx.io_wakeup_timer); } */
static void _genie_lpm_wakeup_timer_init(void)
|
{
aos_timer_new(&genie_lpm_ctx.wakeup_timer, _genie_lpm_timer_irq_handler, NULL, genie_lpm_ctx.p_config.delay_sleep_time, 0);
aos_timer_stop(&genie_lpm_ctx.wakeup_timer);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Zero the heap and initialize start, end and lowest-free */
|
void mem_init(void)
|
/* Zero the heap and initialize start, end and lowest-free */
void mem_init(void)
|
{
struct mem *mem;
LWIP_ASSERT("Sanity check alignment",
(SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0);
ram = LWIP_MEM_ALIGN(ram_heap);
mem = (struct mem *)ram;
mem->next = MEM_SIZE_ALIGNED;
mem->prev = 0;
mem->used = 0;
ram_end = (struct mem *)&ram[MEM_SIZE_ALIGNED];
ram_end->used = 1;
ram_end->next = MEM_SIZE_ALIGNED;
ram_end->prev = MEM_SIZE_ALIGNED;
mem_sem = sys_sem_new(1);
lfree = (struct mem *)ram;
MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Resets any host-side endpoint state such as the toggle bit, sequence number or current window. */
|
void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr)
|
/* Resets any host-side endpoint state such as the toggle bit, sequence number or current window. */
void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr)
|
{
unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK;
struct usb_host_endpoint *ep;
if (usb_endpoint_out(epaddr))
ep = dev->ep_out[epnum];
else
ep = dev->ep_in[epnum];
if (ep)
usb_hcd_reset_endpoint(dev, ep);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If the received packet is Rate 1/4 a further sanity check is made of the codebook gain. */
|
static int codebook_sanity_check_for_rate_quarter(const uint8_t *cbgain)
|
/* If the received packet is Rate 1/4 a further sanity check is made of the codebook gain. */
static int codebook_sanity_check_for_rate_quarter(const uint8_t *cbgain)
|
{
int i, diff, prev_diff=0;
for(i=1; i<5; i++)
{
diff = cbgain[i] - cbgain[i-1];
if(FFABS(diff) > 10)
return -1;
else if(FFABS(diff - prev_diff) > 12)
return -1;
prev_diff = diff;
}
return 0;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* If NextNode is not NULL, return the next node. */
|
STATIC EFI_STATUS EFIAPI AmlIteratorGetNextLinear(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **NextNode)
|
/* If NextNode is not NULL, return the next node. */
STATIC EFI_STATUS EFIAPI AmlIteratorGetNextLinear(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **NextNode)
|
{
AML_TREE_ITERATOR_INTERNAL *InternalIterator;
InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator;
if ((InternalIterator == NULL) ||
(InternalIterator->Mode != EAmlIteratorLinear) ||
!IS_AML_NODE_VALID (InternalIterator->InitialNode) ||
!IS_AML_NODE_VALID (InternalIterator->CurrentNode))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
InternalIterator->CurrentNode = AmlGetNextNode (
InternalIterator->CurrentNode
);
if (NextNode != NULL) {
*NextNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode;
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If Name is NULL, then a list of all environment variable names is returned. Each is a NULL terminated string with a double NULL terminating the list. */
|
CONST CHAR16* EFIAPI EfiShellGetEnv(IN CONST CHAR16 *Name)
|
/* If Name is NULL, then a list of all environment variable names is returned. Each is a NULL terminated string with a double NULL terminating the list. */
CONST CHAR16* EFIAPI EfiShellGetEnv(IN CONST CHAR16 *Name)
|
{
return (EfiShellGetEnvEx (Name, NULL));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Handles an incoming ATT error response for the specified discover-service-by-uuid proc. */
|
static void ble_gattc_disc_svc_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
|
/* Handles an incoming ATT error response for the specified discover-service-by-uuid proc. */
static void ble_gattc_disc_svc_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
|
{
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status == BLE_HS_ATT_ERR(BLE_ATT_ERR_ATTR_NOT_FOUND)) {
status = BLE_HS_EDONE;
}
ble_gattc_disc_svc_uuid_cb(proc, status, att_handle, NULL);
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Note we don't actually enable the device many times if we call this function repeatedly (we just increment the count). */
|
int pci_enable_device(struct pci_dev *dev)
|
/* Note we don't actually enable the device many times if we call this function repeatedly (we just increment the count). */
int pci_enable_device(struct pci_dev *dev)
|
{
return __pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Handle various control requests related to the msc storage interface. */
|
bool usbd_msc_setup_ep0(usbd_msc *ms, const struct usb_setup_data *setup_data)
|
/* Handle various control requests related to the msc storage interface. */
bool usbd_msc_setup_ep0(usbd_msc *ms, const struct usb_setup_data *setup_data)
|
{
usbd_device *dev = ms->dev;
const uint8_t mask = USB_REQ_TYPE_TYPE | USB_REQ_TYPE_RECIPIENT;
const uint8_t value = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE;
if ((setup_data->bmRequestType & mask) == value) {
switch (setup_data->bRequest) {
case USB_MSC_REQ_BULK_ONLY_RESET:
usbd_ep0_transfer(dev, setup_data, NULL, 0, NULL);
return true;
case USB_MSC_REQ_GET_MAX_LUN: {
static const uint8_t res = 0;
usbd_ep0_transfer(dev, setup_data, (void *) &res,
sizeof(res), NULL);
return true;
}}
}
return false;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* EFI_SUCCESS - GPIO state returned in Value EFI_INVALID_PARAMETER - Value is NULL pointer or Gpio pin is out of range */
|
EFI_STATUS EFIAPI Get(IN EMBEDDED_GPIO *This, IN EMBEDDED_GPIO_PIN Gpio, OUT UINTN *Value)
|
/* EFI_SUCCESS - GPIO state returned in Value EFI_INVALID_PARAMETER - Value is NULL pointer or Gpio pin is out of range */
EFI_STATUS EFIAPI Get(IN EMBEDDED_GPIO *This, IN EMBEDDED_GPIO_PIN Gpio, OUT UINTN *Value)
|
{
EFI_STATUS Status;
UINTN Index, Offset, RegisterBase;
Status = PL061Locate (Gpio, &Index, &Offset, &RegisterBase);
ASSERT_EFI_ERROR (Status);
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
if (PL061GetPins (RegisterBase, GPIO_PIN_MASK (Offset)) != 0) {
*Value = 1;
} else {
*Value = 0;
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz. */
|
uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
|
/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz. */
uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
|
{
uint64_t gain = s_spdif_gain[((base->SRPC & SPDIF_SRPC_GAINSEL_MASK) >> SPDIF_SRPC_GAINSEL_SHIFT)];
uint32_t measure = 0;
uint32_t sampleRate = 0;
uint64_t temp = 0;
while ((base->SRPC & SPDIF_SRPC_LOCK_MASK) == 0U)
{
}
measure = base->SRFM;
temp = (uint64_t)measure * (uint64_t)clockSourceFreq_Hz;
temp /= 1024U * 1024U * 128U * gain;
sampleRate = (uint32_t)temp;
return sampleRate;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* We only have comparison registers RTC1-4 currently available per node. RTC0 is used by SAL. */
|
static int mmtimer_int_pending(int comparator)
|
/* We only have comparison registers RTC1-4 currently available per node. RTC0 is used by SAL. */
static int mmtimer_int_pending(int comparator)
|
{
if (HUB_L((unsigned long *)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED)) &
SH_EVENT_OCCURRED_RTC1_INT_MASK << comparator)
return 1;
else
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set SLCD character mapping.
Set Character mode amd SEG line per digit. */
|
void slcd_character_map_set(enum slcd_automated_char_order order, uint8_t seg_line_num)
|
/* Set SLCD character mapping.
Set Character mode amd SEG line per digit. */
void slcd_character_map_set(enum slcd_automated_char_order order, uint8_t seg_line_num)
|
{
SLCD->CMCFG.reg = SLCD_CMCFG_NSEG(seg_line_num)
| (order << SLCD_CMCFG_DEC_Pos);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Sort Uart handles array with Acpi->UID from low to high. */
|
VOID SortedUartHandle(IN EFI_HANDLE *Handles, IN UINTN NoHandles)
|
/* Sort Uart handles array with Acpi->UID from low to high. */
VOID SortedUartHandle(IN EFI_HANDLE *Handles, IN UINTN NoHandles)
|
{
UINTN Index1;
UINTN Index2;
UINTN Position;
UINT32 AcpiUid1;
UINT32 AcpiUid2;
UINT32 TempAcpiUid;
EFI_HANDLE TempHandle;
for (Index1 = 0; Index1 < NoHandles-1; Index1++) {
if (!RetrieveUartUid (Handles[Index1], &AcpiUid1)) {
continue;
}
TempHandle = Handles[Index1];
Position = Index1;
TempAcpiUid = AcpiUid1;
for (Index2 = Index1+1; Index2 < NoHandles; Index2++) {
if (!RetrieveUartUid (Handles[Index2], &AcpiUid2)) {
continue;
}
if (AcpiUid2 < TempAcpiUid) {
TempAcpiUid = AcpiUid2;
TempHandle = Handles[Index2];
Position = Index2;
}
}
Handles[Position] = Handles[Index1];
Handles[Index1] = TempHandle;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Display the baseline value used in calculating relative ratio. */
|
int32_t cn0503_baseline_get(struct cn0503_dev *dev, uint8_t *arg)
|
/* Display the baseline value used in calculating relative ratio. */
int32_t cn0503_baseline_get(struct cn0503_dev *dev, uint8_t *arg)
|
{
extern uint8_t uart_current_line[100];
int8_t i;
uint8_t buff[20];
if (uart_current_line[3] != '?' || uart_current_line[4] != 0)
return SUCCESS;
i = uart_current_line[2] - 0x30;
if ((i < 0) || (i >= 8))
return SUCCESS;
sprintf((char *)buff, "%.5f", dev->ratb[i]);
cli_write_string(dev->cli_handler,
(uint8_t *)"RESP: RZ");
uart_write(dev->cli_handler->uart_device, &uart_current_line[2], 1);
cli_write_string(dev->cli_handler, (uint8_t *)"?=");
cli_write_string(dev->cli_handler, buff);
cli_write_string(dev->cli_handler, (uint8_t *)"\n");
return SUCCESS;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Enables the desired interrupts.
ui32Interrupt should be a logical or of the following: */
|
void am_hal_uart_int_enable(uint32_t ui32Module, uint32_t ui32Interrupt)
|
/* Enables the desired interrupts.
ui32Interrupt should be a logical or of the following: */
void am_hal_uart_int_enable(uint32_t ui32Module, uint32_t ui32Interrupt)
|
{
AM_REGn(UART, ui32Module, IER) |= ui32Interrupt;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* IMPROVE: It would be best to choose the block with the most deleted sectors, because if we fill that one up first it'll have the most chance of having the least live sectors at reclaim. */
|
static int find_free_block(struct partition *part)
|
/* IMPROVE: It would be best to choose the block with the most deleted sectors, because if we fill that one up first it'll have the most chance of having the least live sectors at reclaim. */
static int find_free_block(struct partition *part)
|
{
int block, stop;
block = part->current_block == -1 ?
jiffies % part->total_blocks : part->current_block;
stop = block;
do {
if (part->blocks[block].free_sectors &&
block != part->reserved_block)
return block;
if (part->blocks[block].state == BLOCK_UNUSED)
erase_block(part, block);
if (++block >= part->total_blocks)
block = 0;
} while (block != stop);
return -1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Note that the source address is modified during the DMA transfer according to edma_set_src_index(). */
|
void edma_set_src(unsigned slot, dma_addr_t src_port, enum address_mode mode, enum fifo_width width)
|
/* Note that the source address is modified during the DMA transfer according to edma_set_src_index(). */
void edma_set_src(unsigned slot, dma_addr_t src_port, enum address_mode mode, enum fifo_width width)
|
{
unsigned ctlr;
ctlr = EDMA_CTLR(slot);
slot = EDMA_CHAN_SLOT(slot);
if (slot < edma_info[ctlr]->num_slots) {
unsigned int i = edma_parm_read(ctlr, PARM_OPT, slot);
if (mode) {
i = (i & ~(EDMA_FWID)) | (SAM | ((width & 0x7) << 8));
} else {
i &= ~SAM;
}
edma_parm_write(ctlr, PARM_OPT, slot, i);
edma_parm_write(ctlr, PARM_SRC, slot, src_port);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Disable the clock via the Power Control for Peripherals register */
|
static void local_clk_disable(struct clk *clk)
|
/* Disable the clock via the Power Control for Peripherals register */
static void local_clk_disable(struct clk *clk)
|
{
lpc178x_periph_enable(clk->pconp_mask, 0);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function toggles the value of a check box. If it is not selected, it will be set to a selected/checked state, and vice versa. The graphics will be updated if the box is visible. */
|
void wtk_check_box_toggle(struct wtk_check_box *check_box)
|
/* This function toggles the value of a check box. If it is not selected, it will be set to a selected/checked state, and vice versa. The graphics will be updated if the box is visible. */
void wtk_check_box_toggle(struct wtk_check_box *check_box)
|
{
Assert(check_box);
check_box->selected = !check_box->selected;
win_redraw(check_box->container);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* returns SUCCESS if it successfuly read message from buffer */
|
static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
|
/* returns SUCCESS if it successfuly read message from buffer */
static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
|
{
s32 err;
u16 i;
err = e1000_obtain_mbx_lock_vf(hw);
if (err)
goto out_no_read;
for (i = 0; i < size; i++)
msg[i] = array_er32(VMBMEM(0), i);
ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_ACK);
hw->mbx.stats.msgs_rx++;
out_no_read:
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function changes volume table record @idx. If @vtbl_rec is NULL, empty volume table record is written. The caller does not have to calculate CRC of the record as it is done by this function. Returns zero in case of success and a negative error code in case of failure. */
|
int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, struct ubi_vtbl_record *vtbl_rec)
|
/* This function changes volume table record @idx. If @vtbl_rec is NULL, empty volume table record is written. The caller does not have to calculate CRC of the record as it is done by this function. Returns zero in case of success and a negative error code in case of failure. */
int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, struct ubi_vtbl_record *vtbl_rec)
|
{
int err;
uint32_t crc;
ubi_assert(idx >= 0 && idx < ubi->vtbl_slots);
if (!vtbl_rec)
vtbl_rec = &empty_vtbl_record;
else {
crc = crc32(UBI_CRC32_INIT, vtbl_rec, UBI_VTBL_RECORD_SIZE_CRC);
vtbl_rec->crc = cpu_to_be32(crc);
}
memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record));
err = ubi_update_layout_vol(ubi);
self_vtbl_check(ubi);
return err ? err : 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Checks if a Tx buffer cancellation request has been finished or not. */
|
uint32_t CANFD_IsTxBufCancelFin(CANFD_T *psCanfd, uint32_t u32TxBufIdx)
|
/* Checks if a Tx buffer cancellation request has been finished or not. */
uint32_t CANFD_IsTxBufCancelFin(CANFD_T *psCanfd, uint32_t u32TxBufIdx)
|
{
return ((CANFD_ReadReg(&psCanfd->TXBCR) & (0x1ul << u32TxBufIdx)) >> u32TxBufIdx);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ipath_free_lkey - free an lkey @rkt: table from which to free the lkey @lkey: lkey id to free */
|
void ipath_free_lkey(struct ipath_lkey_table *rkt, u32 lkey)
|
/* ipath_free_lkey - free an lkey @rkt: table from which to free the lkey @lkey: lkey id to free */
void ipath_free_lkey(struct ipath_lkey_table *rkt, u32 lkey)
|
{
unsigned long flags;
u32 r;
if (lkey == 0)
return;
r = lkey >> (32 - ib_ipath_lkey_table_size);
spin_lock_irqsave(&rkt->lock, flags);
rkt->table[r] = NULL;
spin_unlock_irqrestore(&rkt->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks if @date1 is less than or equal to @date2, and swap the values if this is not the case. */
|
void g_date_order(GDate *date1, GDate *date2)
|
/* Checks if @date1 is less than or equal to @date2, and swap the values if this is not the case. */
void g_date_order(GDate *date1, GDate *date2)
|
{
g_return_if_fail (g_date_valid (date1));
g_return_if_fail (g_date_valid (date2));
if (g_date_compare (date1, date2) > 0)
{
GDate tmp = *date1;
*date1 = *date2;
*date2 = tmp;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Writes a chunk of an IRouter packet (or other system controller data) to the system controller. */
|
static int write_status_check(struct subch_data_s *sd, int count)
|
/* Writes a chunk of an IRouter packet (or other system controller data) to the system controller. */
static int write_status_check(struct subch_data_s *sd, int count)
|
{
return ia64_sn_irtr_send(sd->sd_nasid, sd->sd_subch, sd->sd_wb, count);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Queue an URB to the ASL or PZL */
|
static int whc_urb_enqueue(struct usb_hcd *usb_hcd, struct urb *urb, gfp_t mem_flags)
|
/* Queue an URB to the ASL or PZL */
static int whc_urb_enqueue(struct usb_hcd *usb_hcd, struct urb *urb, gfp_t mem_flags)
|
{
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct whc *whc = wusbhc_to_whc(wusbhc);
int ret;
switch (usb_pipetype(urb->pipe)) {
case PIPE_INTERRUPT:
ret = pzl_urb_enqueue(whc, urb, mem_flags);
break;
case PIPE_ISOCHRONOUS:
dev_err(&whc->umc->dev, "isochronous transfers unsupported\n");
ret = -ENOTSUPP;
break;
case PIPE_CONTROL:
case PIPE_BULK:
default:
ret = asl_urb_enqueue(whc, urb, mem_flags);
break;
};
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the clock source which is used as system clock. */
|
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
|
/* Returns the clock source which is used as system clock. */
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
|
{
RCM_SYSCLK_SEL_T sysClock;
sysClock = (RCM_SYSCLK_SEL_T)RCM->CFG_B.SCLKSWSTS;
return sysClock;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Permit another loop in the controller thread (prio_recv_thread)
Execution context: ULL mayfly */
|
void ll_rx_sched(void)
|
/* Permit another loop in the controller thread (prio_recv_thread)
Execution context: ULL mayfly */
void ll_rx_sched(void)
|
{
k_sem_give(sem_recv);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* See README and COPYING for more details. aes_128_cbc_encrypt - AES-128 CBC encryption @key: Encryption key @iv: Encryption IV for CBC mode (16 bytes) @data: Data to encrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */
|
int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
|
/* See README and COPYING for more details. aes_128_cbc_encrypt - AES-128 CBC encryption @key: Encryption key @iv: Encryption IV for CBC mode (16 bytes) @data: Data to encrypt in-place @data_len: Length of data in bytes (must be divisible by 16) Returns: 0 on success, -1 on failure */
int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
|
{
void *ctx;
u8 cbc[AES_BLOCK_SIZE];
u8 *pos = data;
int i, j, blocks;
ctx = aes_encrypt_init(key, 16);
if (ctx == NULL)
return -1;
os_memcpy(cbc, iv, AES_BLOCK_SIZE);
blocks = data_len / AES_BLOCK_SIZE;
for (i = 0; i < blocks; i++) {
for (j = 0; j < AES_BLOCK_SIZE; j++)
cbc[j] ^= pos[j];
aes_encrypt(ctx, cbc, cbc);
os_memcpy(pos, cbc, AES_BLOCK_SIZE);
pos += AES_BLOCK_SIZE;
}
aes_encrypt_deinit(ctx);
return 0;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* If Status is not an EFI_ERROR(), then TRUE is returned. If Status is an EFI_ERROR(), then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */
|
BOOLEAN EFIAPI UnitTestAssertNotEfiError(IN EFI_STATUS Status, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description)
|
/* If Status is not an EFI_ERROR(), then TRUE is returned. If Status is an EFI_ERROR(), then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */
BOOLEAN EFIAPI UnitTestAssertNotEfiError(IN EFI_STATUS Status, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description)
|
{
CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_NOT_EFI_ERROR(%s:%p)", Description, (void *)Status);
_assert_true (!EFI_ERROR (Status), TempStr, FileName, (INT32)LineNumber);
return !EFI_ERROR (Status);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Sets the wake-up inputs when in backup mode. */
|
void SUPC_SetWakeUpInputs(unsigned int inputs)
|
/* Sets the wake-up inputs when in backup mode. */
void SUPC_SetWakeUpInputs(unsigned int inputs)
|
{
SANITY_CHECK((inputs & ~0xFFFF) == 0);
AT91C_BASE_SUPC->SUPC_WUIR &= ~0xFFFF;
AT91C_BASE_SUPC->SUPC_WUIR |= inputs;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Allocate link cache and fill in all configured links. */
|
int rtnl_link_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
|
/* Allocate link cache and fill in all configured links. */
int rtnl_link_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
|
{
return nl_cache_alloc_and_fill(&rtnl_link_ops, sk, result);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciSegmentAnd32(IN UINT64 Address, IN UINT32 AndData)
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentAnd32(IN UINT64 Address, IN UINT32 AndData)
|
{
return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* note This is an internal used function, upper layer should not use. */
|
void FLEXIO_MCULCD_ClearMultiBeatsReadConfig(FLEXIO_MCULCD_Type *base)
|
/* note This is an internal used function, upper layer should not use. */
void FLEXIO_MCULCD_ClearMultiBeatsReadConfig(FLEXIO_MCULCD_Type *base)
|
{
uint8_t i;
uint32_t statusFlags = 0U;
base->flexioBase->TIMCTL[base->timerIndex] = 0U;
base->flexioBase->TIMCFG[base->timerIndex] = 0U;
base->flexioBase->TIMSTAT = (1U << base->timerIndex);
for (i = base->rxShifterStartIndex; i <= base->rxShifterEndIndex; i++)
{
base->flexioBase->SHIFTCTL[i] = 0U;
base->flexioBase->SHIFTCFG[i] = 0U;
statusFlags |= (1U << i);
}
base->flexioBase->SHIFTSTAT = statusFlags;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enable the PWM interrupt of the PWM module.
//! The */
|
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
/* Enable the PWM interrupt of the PWM module.
//! The */
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1));
if (ulIntType == PWM_INT_UEV1)
{
xHWREG(ulBase + TIMER_ICTR) |= PWM_INT_UEV1;
}
else
{
xHWREG(ulBase + TIMER_ICTR) |= (PWM_INT_CHXCC << ulChannelTemp);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Remove all addresses that were added to the destination device by dev_unicast_sync(). This function is intended to be called from the dev->stop function of layered software devices. */
|
void dev_unicast_unsync(struct net_device *to, struct net_device *from)
|
/* Remove all addresses that were added to the destination device by dev_unicast_sync(). This function is intended to be called from the dev->stop function of layered software devices. */
void dev_unicast_unsync(struct net_device *to, struct net_device *from)
|
{
if (to->addr_len != from->addr_len)
return;
netif_addr_lock_bh(from);
netif_addr_lock(to);
__hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
netif_addr_unlock_bh(from);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Starts the Low Level portion of the Host driver. */
|
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost)
|
/* Starts the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost)
|
{
HAL_HCD_Start(phost->pData);
return USBH_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Event handler for events from the peer_database module. */
|
static void pdb_evt_handler(pdb_evt_t const *p_event)
|
/* Event handler for events from the peer_database module. */
static void pdb_evt_handler(pdb_evt_t const *p_event)
|
{
if ((p_event->evt_id == PDB_EVT_WRITE_BUF_STORED) && (p_event->data_id == PM_PEER_DATA_ID_BONDING))
{
smd_evt_t evt =
{
.evt_id = SMD_EVT_BONDING_INFO_STORED,
.conn_handle = im_conn_handle_get(p_event->peer_id),
.params = {.bonding_info_stored =
{
.peer_id = p_event->peer_id,
}}
};
evt_send(&evt);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
|
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
{
register long res __asm__("er0");
register char *const *_c __asm__("er3") = envp;
register char *const *_b __asm__("er2") = argv;
register const char * _a __asm__("er1") = filename;
__asm__ __volatile__ ("mov.l %1,er0\n\t"
"trapa #0\n\t"
: "=r" (res)
: "g" (__NR_execve),
"g" (_a),
"g" (_b),
"g" (_c)
: "cc", "memory");
return res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Does an input register write and a channel update. */
|
int32_t ad5770r_pmdz_set_chan(struct ad5770r_pmdz_dev *dev, uint8_t *arg)
|
/* Does an input register write and a channel update. */
int32_t ad5770r_pmdz_set_chan(struct ad5770r_pmdz_dev *dev, uint8_t *arg)
|
{
int32_t ret;
ret = ad5770r_pmdz_set_in_reg(dev, arg);
if(ret != SUCCESS)
return ret;
return ad5770r_pmdz_update_out(dev, NULL);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* libc/string/strpbrk.c Finds in a string the first occurrence of a byte/wchar_t in a set */
|
char* strpbrk(const char *s1, const char *s2)
|
/* libc/string/strpbrk.c Finds in a string the first occurrence of a byte/wchar_t in a set */
char* strpbrk(const char *s1, const char *s2)
|
{
const char * sc1, * sc2;
for (sc1 = s1; *sc1 != '\0'; ++sc1)
{
for (sc2 = s2; *sc2 != '\0'; ++sc2)
{
if (*sc1 == *sc2)
return (char *)sc1;
}
}
return NULL;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Temperature data output register (r). L and H registers together express a 16-bit word in two’s complement.. */
|
int32_t lsm6dso_temperature_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
/* Temperature data output register (r). L and H registers together express a 16-bit word in two’s complement.. */
int32_t lsm6dso_temperature_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
{
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_OUT_TEMP_L, buff, 2);
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* put_device - decrement reference count. @dev: device in question. */
|
void put_device(struct device *dev)
|
/* put_device - decrement reference count. @dev: device in question. */
void put_device(struct device *dev)
|
{
if (dev)
kobject_put(&dev->kobj);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Specifies the hard trigger for the specified ADC sequence. */
|
void ADC_TriggerConfig(CM_ADC_TypeDef *ADCx, uint8_t u8Seq, uint16_t u16TriggerSel)
|
/* Specifies the hard trigger for the specified ADC sequence. */
void ADC_TriggerConfig(CM_ADC_TypeDef *ADCx, uint8_t u8Seq, uint16_t u16TriggerSel)
|
{
DDL_ASSERT(IS_ADC_UNIT(ADCx));
DDL_ASSERT(IS_ADC_SEQ(u8Seq));
DDL_ASSERT(IS_ADC_HARDTRIG(u16TriggerSel));
u8Seq *= ADC_TRGSR_TRGSELB_POS;
MODIFY_REG16(ADCx->TRGSR, (uint32_t)ADC_TRGSR_TRGSELA << u8Seq, (uint32_t)u16TriggerSel << u8Seq);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This is called when a dentry is about to become negative and the timeout is unknown (unlink, rmdir, rename and in some cases lookup) */
|
void fuse_invalidate_entry_cache(struct dentry *entry)
|
/* This is called when a dentry is about to become negative and the timeout is unknown (unlink, rmdir, rename and in some cases lookup) */
void fuse_invalidate_entry_cache(struct dentry *entry)
|
{
fuse_dentry_settime(entry, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
|
void Vector16_handler(void)
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector16_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (16 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* NOTE: we currently only send this event when we have a reason to send it; not when it fails. */
|
void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t reason)
|
/* NOTE: we currently only send this event when we have a reason to send it; not when it fails. */
void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t reason)
|
{
struct ble_hci_ev_disconn_cmp *ev;
struct ble_hci_ev *hci_ev;
if (ble_ll_hci_is_event_enabled(BLE_HCI_EVCODE_DISCONN_CMP)) {
hci_ev = (void *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
if (hci_ev) {
hci_ev->opcode = BLE_HCI_EVCODE_DISCONN_CMP;
hci_ev->length = sizeof(*ev);
ev = (void *) hci_ev->data;
ev->status = BLE_ERR_SUCCESS;
ev->conn_handle = htole16(connsm->conn_handle);
ev->reason = reason;
ble_ll_hci_event_send(hci_ev);
}
}
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* EC Point addition. EcPointResult = EcPointA + EcPointB. */
|
BOOLEAN EFIAPI EcPointAdd(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
|
/* EC Point addition. EcPointResult = EcPointA + EcPointB. */
BOOLEAN EFIAPI EcPointAdd(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPointA, IN CONST VOID *EcPointB, IN VOID *BnCtx)
|
{
return (BOOLEAN)EC_POINT_add (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Stops the WUSB channel and removes the cluster reservation. */
|
void wusbhc_stop(struct wusbhc *wusbhc)
|
/* Stops the WUSB channel and removes the cluster reservation. */
void wusbhc_stop(struct wusbhc *wusbhc)
|
{
wusbhc_mmc_stop(wusbhc);
wusbhc_sec_stop(wusbhc);
wusbhc_devconnect_stop(wusbhc);
wusbhc_rsv_terminate(wusbhc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get interrupt flag accumulator interrupt of selected channel. */
|
uint32_t EPWM_GetAccInt(EPWM_T *epwm, uint32_t u32ChannelNum)
|
/* Get interrupt flag accumulator interrupt of selected channel. */
uint32_t EPWM_GetAccInt(EPWM_T *epwm, uint32_t u32ChannelNum)
|
{
return (((epwm)->AINTSTS & (1UL << (u32ChannelNum))) ? 1UL : 0UL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The bit positions 0 through @bits are valid positions in @buf. */
|
static int bitmap_ord_to_pos(const unsigned long *buf, int ord, int bits)
|
/* The bit positions 0 through @bits are valid positions in @buf. */
static int bitmap_ord_to_pos(const unsigned long *buf, int ord, int bits)
|
{
int pos = 0;
if (ord >= 0 && ord < bits) {
int i;
for (i = find_first_bit(buf, bits);
i < bits && ord > 0;
i = find_next_bit(buf, bits, i + 1))
ord--;
if (i < bits && ord == 0)
pos = i;
}
return pos;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Determines whether the AD converter is busy or not. */
|
xtBoolean ADCBusy(unsigned long ulBase)
|
/* Determines whether the AD converter is busy or not. */
xtBoolean ADCBusy(unsigned long ulBase)
|
{
xASSERT(ulBase == ADC0_BASE);
return ((xHWREG(ulBase + ADC_STATUS0) & ADC_STATUS0_BUSY) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* The EISA_INT bit in CSITPEND is high active, all others are low active. */
|
static void pcimt_hwint1(void)
|
/* The EISA_INT bit in CSITPEND is high active, all others are low active. */
static void pcimt_hwint1(void)
|
{
u8 pend = *(volatile char *)PCIMT_CSITPEND;
unsigned long flags;
if (pend & IT_EISA) {
int irq;
irq = i8259_irq();
if (unlikely(irq < 0))
return;
do_IRQ(irq);
}
if (!(pend & IT_SCSI)) {
flags = read_c0_status();
clear_c0_status(ST0_IM);
do_IRQ(PCIMT_IRQ_SCSI);
write_c0_status(flags);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Converts a text device path node to SATA device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSata(CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to SATA device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSata(CHAR16 *TextDeviceNode)
|
{
SATA_DEVICE_PATH *Sata;
CHAR16 *Param1;
CHAR16 *Param2;
CHAR16 *Param3;
Param1 = GetNextParamStr (&TextDeviceNode);
Param2 = GetNextParamStr (&TextDeviceNode);
Param3 = GetNextParamStr (&TextDeviceNode);
Sata = (SATA_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SATA_DP,
(UINT16) sizeof (SATA_DEVICE_PATH)
);
Sata->HBAPortNumber = (UINT16) Strtoi (Param1);
if (*Param2 == L'\0' ) {
Sata->PortMultiplierPortNumber = 0xFFFF;
} else {
Sata->PortMultiplierPortNumber = (UINT16) Strtoi (Param2);
}
Sata->Lun = (UINT16) Strtoi (Param3);
return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return read-only GIRQ result register. Result is bit-wise and of source and enable registers. */
|
uint32_t mchp_xec_ecia_girq_result(uint8_t girq_num)
|
/* Return read-only GIRQ result register. Result is bit-wise and of source and enable registers. */
uint32_t mchp_xec_ecia_girq_result(uint8_t girq_num)
|
{
if ((girq_num < MCHP_FIRST_GIRQ) || (girq_num > MCHP_LAST_GIRQ)) {
return 0U;
}
struct ecia_regs *regs = ECIA_XEC_REG_BASE;
return regs->GIRQ[girq_num - MCHP_FIRST_GIRQ].RESULT;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* The pin is 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 GPIOPinTypePECIRx(uint32_t ui32Port, uint8_t ui8Pins)
|
/* The pin is 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 GPIOPinTypePECIRx(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_ANALOG);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* returns 0 for success or < 0 for error */
|
int ipath_tempsense_write(struct ipath_devdata *dd, u8 regnum, u8 data)
|
/* returns 0 for success or < 0 for error */
int ipath_tempsense_write(struct ipath_devdata *dd, u8 regnum, u8 data)
|
{
int ret;
if (regnum > 15 || !((1 << regnum) & VALID_TS_WR_REG_MASK))
return -EINVAL;
ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
if (!ret) {
ret = ipath_tempsense_internal_write(dd, regnum, data);
mutex_unlock(&dd->ipath_eep_lock);
}
return ret;
}
|
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.