;
; icss_learning_asm.s
;
;
; Copyright (c) 2012 Texas Instruments Incorporated ALL RIGHTS RESERVED
;
;


 .global hashFuncGPMAC_asm
hashFuncGPMAC_asm:
	;Store the context
	STMFD   SP!,{R2-R12, LR}
	;for(i = 0;i < 6; i++) {
	;	mac[i] = (uint8_t)(macId >> (8*i)) & 0xFF;
	;}
	MOV R2, #0xff  ;get the mask in place
	;extract all bytes
	AND R3, R2, R0            ; mac[0]
	AND R4, R2, R0, LSR #8    ; mac[1]
	AND R5, R2, R0, LSR #16   ; mac[2]
	AND R6, R2, R0, LSR #24   ; mac[3]
	AND R7, R2, R1			  ; mac[4]
	AND R8, R2, R1, LSR #8    ; mac[5]
	 
	;key = mac[0] ^ mac[1] ^ mac[2] ^ mac[3] ^ mac[4] ^ mac[5]; 
	EOR R9, R3, R4
	EOR R10, R5, R6
	EOR R11, R7, R8	
	EOR R9, R9, R10
	
	EOR R0, R9, R11           ;return key
	
    ;pop the context
	LDMFD   SP!,{R2-R12, PC}
    ;MOV PC, LR                ;return from function
  
; End of the file
;
 .end