specific.c
来自「bootloader源代码」· C语言 代码 · 共 116 行
C
116 行
/***************************************** Copyright (c) 2001-2002 Sigma Designs, Inc. All Rights Reserved Proprietary and Confidential *****************************************//* This is file is part of the Jasper DVD boot loader */#include "config.h" #ifdef SUPPORT_BOOT_FROM_CD#include "specific.h"#include "atapi.h"#include "uart.h"unsigned char ATA_READ_UCHAR (IOPORT port){ unsigned char c; c = (unsigned char) *(volatile unsigned char * const)port; DELAY(10); return c;}void ATA_WRITE_UCHAR (IOPORT port, unsigned char data){ *(volatile unsigned char * const)port = data; DELAY(10); }unsigned short ATA_READ_USHORT (IOPORT port){ unsigned short s; s = (unsigned short) *(volatile unsigned short * const)port; DELAY(10); return s;}void ATA_WRITE_USHORT (IOPORT port, unsigned short data){ *(volatile unsigned short * const)port = data; DELAY(10);}unsigned long ATA_READ_ULONG (IOPORT port){ unsigned long ul; ul = (unsigned long) *(volatile unsigned long * const)port; DELAY(10); return ul;}void ATA_WRITE_ULONG (IOPORT port, unsigned long data){ *(volatile unsigned long * const)port = data; DELAY(10);}void ATA_READ_USHORT_STRING (IOPORT port, short *data, int len){ while (len--) { *data++ = *(volatile unsigned short * const)port; DELAY(10); }// PrintUart("\r\n",4);// unsigned long *p;// p = (unsigned long *)data;// len = len / 2;// while (len--)// {// *p++ = *(volatile unsigned long * const)port; // }}void ATA_WRITE_USHORT_STRING (IOPORT port, short *data, int len){ while (len--) { *(volatile unsigned short * const)port = *data++; DELAY(10); }// unsigned long *p;// p = (unsigned long *)data;// len = len / 2;// while (len--)// {// *(volatile unsigned long * const)port = *p++;// }}void ATA_READ_ULONG_STRING (IOPORT port, long *data, int len){ while (len--){ *data++ = *(volatile unsigned long * const)port; DELAY(10); }}void ATA_WRITE_ULONG_STRING (IOPORT port, long *data, int len){ while (len--) { *(volatile unsigned long * const)port = *data++; DELAY(10); }}#endif // SUPPORT_BOOT_FROM_CDvoid DELAY (int us){ // one loop is about 3 cycles // @150Mhz 50 loops are about 1 microsecond unsigned long i; for (i=0; i<50*us; i++);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?