1/*
2 * Copyright (c) 2014-2015 ARM Limited
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Authors: Andreas Sandberg
18 */
19
20#include <libnomali/nomali.h>
21#include <inttypes.h>
22
23#include "nomali_test_helpers.h"
24#include "../lib/mali_midg_regmap.h"
25
26int
27main(int argc, char **argv)
28{
29    const nomali_config_t cfg = {
30        .type = NOMALI_GPU_T60X,
31        .ver_maj = 0,
32        .ver_min = 1,
33        .ver_status = 0,
34    };
35    nomali_handle_t h;
36    nomali_error_t error = NOMALI_E_OK;
37    uint32_t value;
38
39    E_NOMALI_TEST("nomali_create", nomali_create(&h, &cfg));
40    if (error != NOMALI_E_OK)
41        test_bail("Failed to create NoMail instance!");
42
43    E_NOMALI_TEST("reg_read(GPU_ID)",
44                  nomali_reg_read(h, &value, GPU_CONTROL_REG(GPU_ID)));
45    if (value != ((GPU_ID_PI_T60X << 16) | 0x10)) {
46        test_fail("GPU_ID");
47    } else
48        test_ok("GPU_ID");
49
50    E_NOMALI_TEST("nomali_destroy", nomali_destroy(h));
51
52    return 0;
53}
54