4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Copyright (C) 2005-2006 Texas Instruments, Inc.
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 * ======== regce.c ========
21 * Provide registry functions.
36 /* ----------------------------------- Host OS */
37 #include <dspbridge/host_os.h>
39 /* ----------------------------------- DSP/BIOS Bridge */
40 #include <dspbridge/std.h>
41 #include <dspbridge/dbdefs.h>
42 #include <dspbridge/errbase.h>
44 /* ----------------------------------- Trace & Debug */
45 #include <dspbridge/dbc.h>
46 #include <dspbridge/gt.h>
48 /* ----------------------------------- OS Adaptation Layer */
49 #include <dspbridge/csl.h>
50 #include <dspbridge/mem.h>
52 /* ----------------------------------- Others */
53 #include <dspbridge/dbreg.h>
55 /* ----------------------------------- This */
56 #include <dspbridge/reg.h>
60 struct GT_Mask REG_debugMask = { NULL, NULL }; /* GT trace var. */
64 * ======== REG_DeleteValue ========
65 * Deletes a registry entry value. NOTE: A registry entry value is not the
66 * same as * a registry key.
68 DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
69 IN CONST char *pstrValue)
72 DBC_Require(pstrSubkey && pstrValue);
73 DBC_Require(phKey == NULL);
74 DBC_Require(strlen(pstrSubkey) < REG_MAXREGPATHLENGTH);
75 DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
77 GT_0trace(REG_debugMask, GT_ENTER, "REG_DeleteValue: entered\n");
79 /* Note that we don't use phKey */
80 if (regsupDeleteValue(pstrSubkey, pstrValue) == DSP_SOK)
89 * ======== REG_EnumValue ========
90 * Enumerates a registry key and retrieve values stored under the key.
91 * We will assume the input pdwValueSize is smaller than
92 * REG_MAXREGPATHLENGTH for implementation purposes.
94 DSP_STATUS REG_EnumValue(IN HANDLE *phKey, IN u32 dwIndex,
95 IN CONST char *pstrKey, IN OUT char *pstrValue,
96 IN OUT u32 *pdwValueSize, IN OUT char *pstrData,
97 IN OUT u32 *pdwDataSize)
101 DBC_Require(pstrKey && pstrValue && pdwValueSize && pstrData &&
103 DBC_Require(*pdwValueSize <= REG_MAXREGPATHLENGTH);
104 DBC_Require(phKey == NULL);
105 DBC_Require(strlen(pstrKey) < REG_MAXREGPATHLENGTH);
107 GT_0trace(REG_debugMask, GT_ENTER, "REG_EnumValue: entered\n");
109 status = regsupEnumValue(dwIndex, pstrKey, pstrValue, pdwValueSize,
110 pstrData, pdwDataSize);
116 * ======== REG_Exit ========
117 * Discontinue usage of the REG module.
121 GT_0trace(REG_debugMask, GT_5CLASS, "REG_Exit\n");
127 * ======== REG_GetValue ========
128 * Retrieve a value from the registry.
130 DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
131 IN CONST char *pstrValue, OUT u8 *pbData,
132 IN OUT u32 *pdwDataSize)
136 DBC_Require(pstrSubkey && pstrValue && pbData);
137 DBC_Require(phKey == NULL);
138 DBC_Require(strlen(pstrSubkey) < REG_MAXREGPATHLENGTH);
139 DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
141 GT_0trace(REG_debugMask, GT_ENTER, "REG_GetValue: entered\n");
143 /* We need to use regsup calls... */
144 /* ...for now we don't need the key handle or */
145 /* the subkey, all we need is the value to lookup. */
146 if (regsupGetValue((char *)pstrValue, pbData, pdwDataSize) == DSP_SOK)
155 * ======== REG_Init ========
156 * Initialize the REG module's private state.
162 GT_create(®_debugMask, "RG"); /* RG for ReG */
164 fInit = regsupInit();
166 GT_0trace(REG_debugMask, GT_5CLASS, "REG_Init\n");
172 * ======== REG_SetValue ========
173 * Set a value in the registry.
175 DSP_STATUS REG_SetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
176 IN CONST char *pstrValue, IN CONST u32 dwType,
177 IN u8 *pbData, IN u32 dwDataSize)
181 DBC_Require(pstrValue && pbData);
182 DBC_Require(phKey == NULL);
183 DBC_Require(dwDataSize > 0);
184 DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
186 /* We need to use regsup calls... */
187 /* ...for now we don't need the key handle or */
188 /* the subkey, all we need is the value to lookup. */
189 if (regsupSetValue((char *)pstrValue, pbData, dwDataSize) == DSP_SOK)