freemyipod r723 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r722‎ | r723 | r724 >
Date:23:42, 4 July 2011
Author:theseven
Status:new
Tags:
Comment:
Fix red from r721: Add missing file
Modified paths:
  • /emcore/trunk/target/ipodnano4g/hwkeyaes.c (added) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano4g/hwkeyaes.c
@@ -0,0 +1,59 @@
 2+//
 3+//
 4+// Copyright 2010 TheSeven
 5+//
 6+//
 7+// This file is part of emCORE.
 8+//
 9+// emCORE is free software: you can redistribute it and/or
 10+// modify it under the terms of the GNU General Public License as
 11+// published by the Free Software Foundation, either version 2 of the
 12+// License, or (at your option) any later version.
 13+//
 14+// emCORE is distributed in the hope that it will be useful,
 15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 17+// See the GNU General Public License for more details.
 18+//
 19+// You should have received a copy of the GNU General Public License along
 20+// with emCORE. If not, see <http://www.gnu.org/licenses/>.
 21+//
 22+//
 23+
 24+
 25+#include "global.h"
 26+#include "hwkeyaes.h"
 27+#include "s5l8720.h"
 28+#include "thread.h"
 29+
 30+
 31+struct mutex hwkeyaes_mutex;
 32+
 33+
 34+void hwkeyaes(enum hwkeyaes_direction direction, uint32_t keyidx, void* data, uint32_t size)
 35+{
 36+ int i;
 37+ mutex_lock(&hwkeyaes_mutex, TIMEOUT_BLOCK);
 38+ clockgate_enable(7, true);
 39+ for (i = 0; i < 4; i++) AESIV[i] = 0;
 40+ AESUNKREG0 = 1;
 41+ AESUNKREG0 = 0;
 42+ AESCONTROL = 1;
 43+ AESUNKREG1 = 0;
 44+ AESTYPE = keyidx;
 45+ AESTYPE2 = ~AESTYPE;
 46+ AESUNKREG2 = 0;
 47+ AESKEYLEN = direction == HWKEYAES_ENCRYPT ? 0xf : 0xe;
 48+ AESOUTSIZE = size;
 49+ AESOUTADDR = data;
 50+ AESINSIZE = size;
 51+ AESINADDR = data;
 52+ AESAUXSIZE = size;
 53+ AESAUXADDR = data;
 54+ AESSIZE3 = size;
 55+ invalidate_dcache();
 56+ AESGO = 1;
 57+ while (!(AESSTATUS & 0xf)) sleep(MIN(10000, size >> 4));
 58+ clockgate_enable(7, false);
 59+ mutex_unlock(&hwkeyaes_mutex);
 60+}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r721emCORE: iPod Nano 4G: Implement hwkeyaes kernel APItheseven23:40, 4 July 2011