Subversion Repositories freemyipod

Rev

Rev 275 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 275 Rev 387
Line 25... Line 25...
25
#include "hwkeyaes.h"
25
#include "hwkeyaes.h"
26
#include "s5l8702.h"
26
#include "s5l8702.h"
27
#include "thread.h"
27
#include "thread.h"
28
 
28
 
29
 
29
 
-
 
30
struct mutex hwkeyaes_mutex;
-
 
31
 
-
 
32
 
30
void hwkeyaes(enum hwkeyaes_direction direction, uint32_t keyidx, void* data, uint32_t size)
33
void hwkeyaes(enum hwkeyaes_direction direction, uint32_t keyidx, void* data, uint32_t size)
31
{
34
{
32
    int i;
35
    int i;
-
 
36
    mutex_lock(&hwkeyaes_mutex, TIMEOUT_BLOCK);
33
    clockgate_enable(10, true);
37
    clockgate_enable(10, true);
34
    for (i = 0; i < 4; i++) AESIV[i] = 0;
38
    for (i = 0; i < 4; i++) AESIV[i] = 0;
35
    AESUNKREG0 = 1;
39
    AESUNKREG0 = 1;
36
    AESUNKREG0 = 0;
40
    AESUNKREG0 = 0;
37
    AESCONTROL = 1;
41
    AESCONTROL = 1;
Line 50... Line 54...
50
	clean_dcache();
54
	clean_dcache();
51
    AESGO = 1;
55
    AESGO = 1;
52
	invalidate_dcache();
56
	invalidate_dcache();
53
    while (!(AESSTATUS & 0xf)) sleep(100);
57
    while (!(AESSTATUS & 0xf)) sleep(100);
54
    clockgate_enable(10, false);
58
    clockgate_enable(10, false);
-
 
59
    mutex_unlock(&hwkeyaes_mutex);
55
}
60
}