Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/libsaio/saio_internal.h

Source at commit 429 created 13 years 9 months ago.
By meklort, Updated module system. Hooks can now be used within modules when cetaion functions are called in chameleon. Note that onle two hooks currently exist, more need to be added. I also updated the HelloWorld module to use a hook instead of print out right away.
1/*
2 * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 2.0 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24
25#ifndef __LIBSAIO_SAIO_INTERNAL_H
26#define __LIBSAIO_SAIO_INTERNAL_H
27
28#include "saio_types.h"
29
30/* asm.s */
31extern void real_to_prot(void);
32extern void prot_to_real(void);
33extern void halt(void);
34extern void startprog(unsigned int address, void *arg);
35extern void loader(UInt32 code, UInt32 cmdptr);
36
37/* bios.s */
38extern void bios(biosBuf_t *bb);
39
40/* biosfn.c */
41#ifdef EISA_SUPPORT
42extern bool eisa_present(void);
43#endif
44extern int bgetc(void);
45extern int biosread(int dev, int cyl, int head, int sec, int num);
46extern int ebiosread(int dev, unsigned long long sec, int count);
47extern int ebioswrite(int dev, long sec, int count);
48extern int get_drive_info(int drive, struct driveInfo *dp);
49extern int ebiosEjectMedia(int biosdev);
50extern void putc(int ch);
51extern void putca(int ch, int attr, int repeat);
52extern int getc(void);
53extern void pause();
54extern int readKeyboardStatus(void);
55extern int readKeyboardShiftFlags(void);
56extern unsigned int time18(void);
57extern void delay(int ms);
58extern unsigned int get_diskinfo(int dev);
59#if APM_SUPPORT
60extern int APMPresent(void);
61extern int APMConnect32(void);
62#endif
63extern int memsize(int i);
64extern void video_mode(int mode);
65extern void setCursorPosition(int x, int y, int page);
66extern void setCursorType(int type);
67extern void getCursorPositionAndType(int *x, int *y, int *type);
68extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);
69extern void clearScreenRows(int y1, int y2);
70extern void setActiveDisplayPage( int page );
71extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount,
72 unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);
73extern unsigned long getExtendedMemorySize();
74extern unsigned long getConventionalMemorySize();
75extern void sleep(int n);
76
77/* bootstruct.c */
78extern void initKernBootStruct(void);
79extern void reserveKernBootStruct(void);
80extern void copyKernBootStruct(void);
81extern void finalizeBootStruct(void);
82
83/* cache.c */
84extern void CacheReset();
85extern void CacheInit(CICell ih, long blockSize);
86extern long CacheRead(CICell ih, char *buffer, long long offset,
87 long length, long cache);
88
89/* console.c */
90extern bool gVerboseMode;
91extern bool gErrors;
92extern void putchar(int ch);
93extern int getchar(void);
94extern int printf(const char *format, ...);
95extern int error(const char *format, ...);
96extern int verbose(const char *format, ...);
97extern void stop(const char *format, ...);
98
99/* disk.c */
100extern void rescanBIOSDevice(int biosdev);
101extern struct DiskBVMap* diskResetBootVolumes(int biosdev);
102extern void diskFreeMap(struct DiskBVMap *map);
103extern int testBiosread( int biosdev, unsigned long long secno );
104extern BVRef diskScanBootVolumes(int biosdev, int *count);
105extern void diskSeek(BVRef bvr, long long position);
106extern int diskRead(BVRef bvr, long addr, long length);
107extern int diskIsCDROM(BVRef bvr);
108extern int biosDevIsCDROM(int biosdev);
109extern BVRef getBVChainForBIOSDev(int biosdev);
110extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
111extern int freeFilteredBVChain(const BVRef chain);
112extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
113extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
114extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
115extern void turnOffFloppy(void);
116extern int testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );
117
118/* hfs_compare.c */
119extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,
120 u_int16_t *uniStr2, u_int32_t len2, int byte_order);
121extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,
122 u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
123extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,
124 u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
125
126/* load.c */
127extern bool gHaveKernelCache;
128extern long ThinFatFile(void **binary, unsigned long *length);
129extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
130
131/* memory.c */
132long AllocateKernelMemory( long inSize );
133long AllocateMemoryRange(char * rangeName, long start, long length, long type);
134
135/* misc.c */
136extern void enableA20(void);
137extern int checkForSupportedHardware();
138extern int isLaptop();
139extern void getPlatformName(char *nameBuf);
140
141/* nbp.c */
142extern UInt32 nbpUnloadBaseCode();
143extern BVRef nbpScanBootVolumes(int biosdev, int *count);
144
145/* stringTable.c */
146extern char * newStringFromList(char **list, int *size);
147extern int stringLength(const char *table, int compress);
148extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);
149extern bool removeKeyFromTable(const char *key, char *table);
150extern char * newStringForStringTableKey(config_file_t *config, char *key);
151extern char * newStringForKey(char *key, config_file_t *configBuff);
152extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);
153extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);
154extern const char * getStringForKey(const char * key, config_file_t *config);
155extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);
156extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);
157extern bool getColorForKey(const char *key, unsigned int *val, config_file_t *configBuff);
158extern bool getDimensionForKey( const char *key, unsigned int *value, config_file_t *config, unsigned int dimension_max, unsigned int object_size );
159extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
160extern int loadSystemConfig(config_file_t *configBuff);
161extern int loadHelperConfig(config_file_t *configBuff);
162extern int loadOverrideConfig(config_file_t *configBuff);
163extern char * newString(const char *oldString);
164extern char * getNextArg(char ** ptr, char * val);
165extern int ParseXMLFile( char * buffer, TagPtr * dict );
166
167/* sys.c */
168extern BVRef getBootVolumeRef( const char * path, const char ** outPath );
169extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);
170extern long LoadFile(const char *fileSpec);
171extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);
172extern long LoadThinFatFile(const char *fileSpec, void **binary);
173extern long GetDirEntry(const char *dirSpec, long *dirIndex, const char **name,
174 long *flags, long *time);
175extern long GetFileInfo(const char *dirSpec, const char *name,
176 long *flags, long *time);
177extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
178extern long GetFSUUID(char *spec, char *uuidStr);
179extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
180extern int openmem(char *buf, int len);
181extern int open(const char *str, int how);
182extern int open_bvdev(const char *bvd, const char *path, int flags);
183extern int close(int fdesc);
184extern int file_size(int fdesc);
185extern int read(int fdesc, char *buf, int count);
186extern int b_lseek(int fdesc, int addr, int ptr);
187extern int tell(int fdesc);
188extern const char * systemConfigDir(void);
189extern struct dirstuff * opendir(const char *path);
190extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);
191extern int closedir(struct dirstuff *dirp);
192extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
193extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,
194 long * time, FinderInfo *finderInfo, long *infoValid);
195extern void flushdev(void);
196extern void scanBootVolumes(int biosdev, int *count);
197extern void scanDisks(int biosdev, int *count);
198extern BVRef selectBootVolume(BVRef chain);
199extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
200extern void setRootVolume(BVRef volume);
201extern void setBootGlobals(BVRef chain);
202
203extern int gBIOSDev;
204extern int gBootFileType;
205extern BVRef gBootVolume;
206extern BVRef gBIOSBootVolume;
207
208// Function pointer to be filled in if ramdisks are available
209extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
210extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno,
211 unsigned int byteoff,
212 unsigned int byteCount, void * buffer );
213
214#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
215

Archive Download this file

Revision: 429