nomali_test0.c revision 10915
12SN/A/*
21762SN/A * Copyright (c) 2014-2015 ARM Limited
32SN/A * All rights reserved
42SN/A *
52SN/A * Licensed under the Apache License, Version 2.0 (the "License");
62SN/A * you may not use this file except in compliance with the License.
72SN/A * You may obtain a copy of the License at
82SN/A *
92SN/A *     http://www.apache.org/licenses/LICENSE-2.0
102SN/A *
112SN/A * Unless required by applicable law or agreed to in writing, software
122SN/A * distributed under the License is distributed on an "AS IS" BASIS,
132SN/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142SN/A * See the License for the specific language governing permissions and
152SN/A * limitations under the License.
162SN/A *
172SN/A * Authors: Andreas Sandberg
182SN/A */
192SN/A
202SN/A#include <libnomali/nomali.h>
212SN/A#include <inttypes.h>
222SN/A
232SN/A#include "nomali_test_helpers.h"
242SN/A#include "../lib/mali_midg_regmap.h"
252SN/A
262SN/Aint
272665Ssaidi@eecs.umich.edumain(int argc, char **argv)
282665Ssaidi@eecs.umich.edu{
292665Ssaidi@eecs.umich.edu    const nomali_config_t cfg = {
302665Ssaidi@eecs.umich.edu        .type = NOMALI_GPU_T60X,
312SN/A        .ver_maj = 0,
322SN/A        .ver_min = 1,
332SN/A        .ver_status = 0,
342SN/A    };
352SN/A    nomali_handle_t h;
362SN/A    nomali_error_t error = NOMALI_E_OK;
3775SN/A    uint32_t value;
382SN/A
392439SN/A    E_NOMALI_TEST("nomali_create", nomali_create(&h, &cfg));
402439SN/A    if (error != NOMALI_E_OK)
41603SN/A        test_bail("Failed to create NoMail instance!");
42603SN/A
432520SN/A    E_NOMALI_TEST("reg_read(GPU_ID)",
442378SN/A                  nomali_reg_read(h, &value, GPU_CONTROL_REG(GPU_ID)));
452378SN/A    if (value != ((GPU_ID_PI_T60X << 16) | 0x10)) {
46722SN/A        test_fail("GPU_ID");
472521SN/A    } else
482378SN/A        test_ok("GPU_ID");
49312SN/A
501634SN/A    E_NOMALI_TEST("nomali_destroy", nomali_destroy(h));
512680Sktlim@umich.edu
521634SN/A    return 0;
532521SN/A}
542378SN/A