Open source GPL/LGPL release

This commit is contained in:
svcmobrel-release
2025-12-19 15:25:44 -08:00
commit 9fc87a7ec7
2261 changed files with 576825 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
.SUFFIXES:
OBJS = posix-circbuf.o
MODULE = posix-circbuf
include ../../Makefile.units

View File

@@ -0,0 +1,35 @@
################################### tell Emacs this is a -*- makefile-gmake -*-
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# tmake for SW Mobile component makefile
#
###############################################################################
NVGPU_UNIT_NAME=posix-circbuf
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.interface.tmk
# Local Variables:
# indent-tabs-mode: t
# tab-width: 8
# End:
# vi: set tabstop=8 noexpandtab:

View File

@@ -0,0 +1,35 @@
################################### tell Emacs this is a -*- makefile-gmake -*-
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# tmake for SW Mobile component makefile
#
###############################################################################
NVGPU_UNIT_NAME=posix-circbuf
include $(NV_COMPONENT_DIR)/../../Makefile.units.common.tmk
# Local Variables:
# indent-tabs-mode: t
# tab-width: 8
# End:
# vi: set tabstop=8 noexpandtab:

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include <unit/io.h>
#include <unit/unit.h>
#include <nvgpu/circ_buf.h>
#include "posix-circbuf.h"
#define BUFFER_SIZE 16UL
int test_circbufcnt(struct unit_module *m,
struct gk20a *g, void *args)
{
unsigned int i;
unsigned long head, tail, size, ret;
head = 0;
tail = 0;
size = BUFFER_SIZE;
for (i = 0; i < BUFFER_SIZE; i++) {
head = i;
ret = CIRC_CNT(head, tail, size);
if (ret != i) {
unit_return_fail(m, "CIRC_CNT failed %ld\n", ret);
}
}
head = BUFFER_SIZE - 1;
for (i = 0; i < BUFFER_SIZE; i++) {
tail = (BUFFER_SIZE - 1) - i;
ret = CIRC_CNT(head, tail, size);
if (ret != i) {
unit_return_fail(m, "CIRC_CNT failed %ld\n", ret);
}
}
head = BUFFER_SIZE/2;
tail = BUFFER_SIZE/2;
ret = CIRC_CNT(head, tail, size);
if (ret) {
unit_return_fail(m, "CIRC_CNT failed %ld\n", ret);
}
return UNIT_SUCCESS;
}
int test_circbufspace(struct unit_module *m,
struct gk20a *g, void *args)
{
unsigned int i;
unsigned long head, tail, size, ret;
tail = BUFFER_SIZE;
size = BUFFER_SIZE;
for (i = 0; i < BUFFER_SIZE; i++) {
head = i;
ret = CIRC_SPACE(head, tail, size);
if (ret != ((BUFFER_SIZE - 1) - i)) {
unit_return_fail(m, "CIRC_SPACE failed %ld\n", ret);
}
}
return UNIT_SUCCESS;
}
struct unit_module_test posix_circbuf_tests[] = {
UNIT_TEST(circbufcnt, test_circbufcnt, NULL, 0),
UNIT_TEST(circbufspace, test_circbufspace, NULL, 0),
};
UNIT_MODULE(posix_circbuf, posix_circbuf_tests, UNIT_PRIO_POSIX_TEST);

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/**
* @addtogroup SWUTS-posix-circbuf
* @{
*
* Software Unit Test Specification for posix-circbuf
*/
#ifndef UNIT_POSIX_CIRCBUF_H
#define UNIT_POSIX_CIRCBUF_H
/**
* Test specification for test_circbufcnt
*
* Description: Test the buffer count implementation.
*
* Test Type: Feature
*
* Targets: CIRC_CNT
*
* Inputs: None
*
* Steps:
* 1) Invoke CIRC_CNT in loop with head assigned with loop index value and
* tail as zero.
* 2) Check if the return value of buffer count is equal to loop index. Else
* return fail.
* 3) Invoke CIRC_CNT in loop with head assigned as maximum index and tail
* decreased according to the loop index value.
* 4) Check if the return value of buffer count is equal to loop index. Else
* return fail.
* 5) Invoke CIRC_CNT with both head and tail assigned with same value.
* 6) Check if the return value is equal to zero, else return fail.
* 7) Return PASS.
*
* Output:
* The test returns PASS if all the invocations of CIRC_CNT returns the
* expected value as buffer count. Otherwise, test returns FAIL.
*/
int test_circbufcnt(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for test_circbufspace
*
* Description: Test the buffer space check implementation.
*
* Test Type: Feature
*
* Targets: CIRC_SPACE
*
* Inputs: None
*
* Steps:
* 1) Invoke CIRC_SPACE in loop with head assigned as loop index and
* tail as buffer size.
* 2) Check if the return value of buffer space is equal to the maximum
* entries that the buffer can hold minus loop index. Else
* return fail.
* 3) Return PASS.
*
* Output:
* The test returns PASS if all the invocations of CIRC_SPACE returns the
* expected value as available buffer space. Otherwise, test returns FAIL.
*/
int test_circbufspace(struct unit_module *m, struct gk20a *g, void *args);
#endif /* UNIT_POSIX_CIRCBUF_H */