|
|
1.1 ! root 1: \ ***************************************************************************** ! 2: \ * Copyright (c) 2004, 2008 IBM Corporation ! 3: \ * All rights reserved. ! 4: \ * This program and the accompanying materials ! 5: \ * are made available under the terms of the BSD License ! 6: \ * which accompanies this distribution, and is available at ! 7: \ * http://www.opensource.org/licenses/bsd-license.php ! 8: \ * ! 9: \ * Contributors: ! 10: \ * IBM Corporation - initial implementation ! 11: \ ****************************************************************************/ ! 12: ! 13: ! 14: \ Atmel TPM. ! 15: ! 16: new-device 500 1 set-unit ! 17: ! 18: s" tpm" 2dup device-name device-type ! 19: ! 20: s" AT97SC3201" compatible ! 21: ! 22: \ 2 bytes of ISA I/O space ! 23: my-unit encode-int rot encode-int+ 2 encode-int+ s" reg" property ! 24: ! 25: : >tpm 4e io-c! ; ! 26: : tpm@ >tpm 4f io-c@ ; ! 27: : tpm! >tpm 4f io-c! ; ! 28: ! 29: : dump-tpm 11 0 DO cr i 2 .r space i tpm@ 2 0.r LOOP ; ! 30: ! 31: my-address wbsplit 9 tpm! 8 tpm! \ set base address ! 32: 0 a tpm! \ disable serint ! 33: ! 34: \ Now we need to execute TPM_Startup. ! 35: CREATE startup-cmd ! 36: 0 c, c1 c, ! 37: 0 c, 0 c, 0 c, c c, ! 38: 0 c, 0 c, 0 c, 99 c, \ TPM_ORD_Startup ! 39: 0 c, 1 c, \ TCPA_ST_CLEAR ! 40: ! 41: : send ( addr len -- ) bounds ?DO i c@ 500 io-c! LOOP ; ! 42: : wait-for-ready ( -- ) BEGIN 501 io-c@ 3 and 2 = UNTIL ; ! 43: : recv-verbose ( -- ) ! 44: cr ." TPM result: " ! 45: 500 io-c@ 2 0.r 500 io-c@ 2 0.r space ! 46: 500 io-c@ 500 io-c@ 500 io-c@ 500 io-c@ ! 47: bljoin lbflip 6 - dup 8 0.r space 0 ! 48: ?DO 500 io-c@ . LOOP ! 49: ; ! 50: ! 51: : recv ( -- ) ! 52: 500 io-c@ drop 500 io-c@ drop ! 53: 500 io-c@ 500 io-c@ 500 io-c@ 500 io-c@ ! 54: bljoin lbflip 6 - 0 ! 55: ?DO 500 io-c@ drop LOOP ! 56: ; ! 57: ! 58: startup-cmd c send wait-for-ready recv ! 59: ! 60: : open true ; ! 61: : close ; ! 62: ! 63: finish-device
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.