SAM9263 Shutdown in user mode

This forum is for users of Atmel's SAM Series and who are interested in using WinCE OS.

Moderator: nferre

bob
Posts: 44
Joined: Fri Jan 16, 2009 10:46 pm

SAM9263 Shutdown in user mode

Fri Jan 16, 2009 11:00 pm

Hi to everybody,
I need to put the SAM9263 in shutdown mode from an user application.

I have implemented the shutdown is implemented as a KernelIoControl.
The source code used to invoked the function call in my subproject is as following:
if (!KernelIoControl(IOCTL_HAL_SHUTDOWN, NULL, 0, NULL, 0, NULL))
wsprintf (szDbg, TEXT ("Failed to IOCTL_HAL_SHUTDOWN.\r\n"));
else
wsprintf (szDbg, TEXT ("Succeed in IOCTL_HAL_SHUTDOWN.\r\n"));

but the system call doesn’t work.

I have checked the file /public/common/oak/oalicotl/oalioctl.cpp and the system call
for the shutdown IOCTL_HAL_SHUTDOWN seems not be specified:

switch (dwIoControlCode) {
case IOCTL_HAL_GET_CACHE_INFO:
case IOCTL_HAL_GET_DEVICE_INFO:
case IOCTL_HAL_GET_DEVICEID:
case IOCTL_HAL_GET_UUID:
case IOCTL_PROCESSOR_INFORMATION:
// request is to service the ioctl - forward the call to OAL code

// OAL code will set the last error if there is a failure

fRet = (*g_pfnExtOALIoctl)(dwIoControlCode, pInBuf, nInBufSize, pOutBuf, nOutBufSize, pBytesReturned);

break;

default:

SetLastError(ERROR_NOT_SUPPORTED);

break;

...and the KernelIOControl fails because IOCTL_HAL_SHUTDOWN is not supported.

somebody has already faced this problem?

many thanks in advance
bob
Adeneo
Contact:
Location: France - USA
Posts: 183
Joined: Fri May 14, 2004 9:58 am

Re: SAM9263 Shutdown in user mode

Mon Jan 19, 2009 9:53 am

Hi,

You cannot use a KernelIoControl directly from an user application because your application doesn't have the access right.

You'll need to clone oemioctl.dll, modify it to add your desired ioctls, and
use that one in your image. oemioctl.dll is the gatekeeper that determines
which kernel ioctls are allowed to be called from user mode.

Regards,
Adeneo Support Team
bob
Posts: 44
Joined: Fri Jan 16, 2009 10:46 pm

Re: SAM9263 Shutdown in user mode

Mon Jan 19, 2009 4:55 pm

Thanks a lot for your reply.
Sorry if I boring you but I have just another question about this issue:
if I create a new device driver embedded in the kernel and in the Device driver xxx_IOCONTROL I call the KernelIoControl(IOCTL_HAL_SHUTDOWN, NULL, 0, NULL, 0, NULL), is this function properly works?
Of course my application will use that driver to control the shutdown.
Thanks
Adeneo
Contact:
Location: France - USA
Posts: 183
Joined: Fri May 14, 2004 9:58 am

Re: SAM9263 Shutdown in user mode

Tue Jan 20, 2009 6:09 pm

Hi,

Every device driver have kernel mode right access, so your solution is viable.

Regards,
Adeneo Support Team
bob
Posts: 44
Joined: Fri Jan 16, 2009 10:46 pm

Re: SAM9263 Shutdown in user mode

Thu Jan 22, 2009 3:48 pm

many thanks!

Return to “WinCE”

Who is online

Users browsing this forum: No registered users and 1 guest