Date   

Some emails from devel mailing list does arrive to my inbox

Yannis Damigos
 

Hi everyone,

is it just me or everyone does not receive some emails to their inbox
from the devel mailing list?

For example I did not receive any email for the threads:
[RFC] GPIO API changes
FRDM-K64 GPIO driver name
Zephyr SDK v0.7.2 - "rm -rf /"

If someone posts something to the devel mailing list using the web
GUI, do you receive an email?

Best regards,
Yannis


Re: [RFC] GPIO API changes

Tomasz Bursztyka
 

Hi Vinicius,

Another issue of the current API is the confusion caused by
'gpio_port_enable_callback()' and 'gpio_pin_enable_callback()'.

With the changes proposed later in this thread, you could have a
unified call:
'gpio_enable_callback(struct device *port, uint32_t pinmask)' (or something like it)
gpio_port_callback() make the callback called, whatever pins is
triggering the interrupt and enabled or not (callback wise).
So they are different (documentation could be better though)
I am just wondering that in the "old" API '_port_enable_callback()' was
a way to have the callback called with the pins expressed in a bitmask,
now the same behaviour can be achieved by running
'_pin_enable_callback(port, 0xffffffff)'. Just saying that, with the new
API, '_port_enable_callback()' adds little value.
Rethinking about that, while doing the proper patch-set. You've got good
point.
I am making it useless if the user has not set a callback through
gpio_set_callback()
(old way of doing, for a unique callback on the whole port)

Thanks,

Tomasz


Re: FRDM-K64 GPIO driver name

Idupsle <idupsle@...>
 

Hi, Reffering to my post in users, I wasn't successfully activating the
LEDs, but I got the debug output. See below

--- prj.conf ---
CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_NANO_TIMERS=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_GPIO=y
I've following settings:
CONFIG_ARM=y
CONFIG_SOC_FSL_FRDM_K64F=y
CONFIG_BOARD_FRDM_K64F=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_UART_K20=y

Now the printk/f should be to uart.


Nevertheless, I tried NXP's MQX. There I found, that activating
the LED was done by setting the output of the Pin to one and then to zero.
Maybe thats the way it is done since the cathode is, reffering to the manual,
on the processor side.


Re: FRDM-K64 GPIO driver name

Anders Dam Kofoed <adk@...>
 

Hi Thomasz,

Yesterday I tried with the following source code - but nothing happens :(
Nothing blinks. I programming it by copying the outdir/zephyr.bin onto the MBED folder. The board seems to "eat" it as it should but nothing happens - even after a reset.

GPIO out pin is Port B pin 22. Input is port B pin 9.
What puzzels me the most is that I do not get ANY debug output on the console (screen /dev/ttyACM0 in Linux). I'd really like it to just show a sign of life...

--- prj.conf ---
CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_NANO_TIMERS=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_GPIO=y

---------------
--- main.c ---
#include <zephyr.h>
#include <device.h>
#include <gpio.h>
#include <sys_clock.h>


#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define PRINT printf
#else
#include <misc/printk.h>
#define PRINT printk
#endif

#define SLEEPTICKS SECONDS(1)

#define GPIO_OUT_PIN 22
#define GPIO_INT_PIN 9
#define GPIO_NAME "GPIO_"
#define GPIO_DRV_NAME CONFIG_GPIO_K64_B_DEV_NAME

void gpio_callback(struct device *port, uint32_t pin)
{
PRINT(GPIO_NAME "%d triggered\n", pin);
}


void main(void)
{
PRINT("Hello World!\n");
printf("Hello World!\n");

struct nano_timer timer;
void *timer_data[1];
struct device *gpio_dev;
int ret;
int toggle = 0;

nano_timer_init(&timer, timer_data);

gpio_dev = device_get_binding(GPIO_DRV_NAME);
if (!gpio_dev) {
PRINT("Cannot find %s!\n", GPIO_DRV_NAME);
}

/* Setup GPIO output */
ret = gpio_pin_configure(gpio_dev, GPIO_OUT_PIN, (GPIO_DIR_OUT));
if (ret) {
PRINT("Error configuring " GPIO_NAME "%d!\n", GPIO_OUT_PIN);
}

/* Setup GPIO input, and triggers on rising edge. */
ret = gpio_pin_configure(gpio_dev, GPIO_INT_PIN,
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE
| GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE));
if (ret) {
PRINT("Error configuring " GPIO_NAME "%d!\n", GPIO_INT_PIN);
}

ret = gpio_set_callback(gpio_dev, gpio_callback);
if (ret) {
PRINT("Cannot setup callback!\n");
}

ret = gpio_pin_enable_callback(gpio_dev, GPIO_INT_PIN);
if (ret) {
PRINT("Error enabling callback!\n");
}

while (1) {
PRINT("Toggling " GPIO_NAME "%d\n", GPIO_OUT_PIN);

ret = gpio_pin_write(gpio_dev, GPIO_OUT_PIN, toggle);
if (ret) {
PRINT("Error set " GPIO_NAME "%d!\n", GPIO_OUT_PIN);
}

if (toggle) {
toggle = 0;
} else {
toggle = 1;
}

nano_timer_start(&timer, SLEEPTICKS);
nano_timer_test(&timer, TICKS_UNLIMITED);
}


}


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Maciek Borzecki <maciek.borzecki@...>
 

On Tue, Mar 15, 2016 at 3:50 AM, Nashif, Anas <anas.nashif(a)intel.com> wrote:





On 14/03/2016, 22:46, "Kalowsky, Daniel" <daniel.kalowsky(a)intel.com> wrote:

-----Original Message-----
From: Maciek Borzecki [mailto:maciek.borzecki(a)gmail.com]
Sent: Monday, March 14, 2016 5:19 AM
To: Nashif, Anas <anas.nashif(a)intel.com>; Kalowsky, Daniel
<daniel.kalowsky(a)intel.com>; Walsh, Benjamin (Wind River)
<benjamin.walsh(a)windriver.com>
Cc: Boie, Andrew P <andrew.p.boie(a)intel.com>;
users(a)lists.zephyrproject.org; devel(a)lists.zephyrproject.org
Subject: Re: [devel] [users] Re: Re: Re: Re: Re: STM32F103x port

<..snip..>


Do we have a consensus on this matter then? Did you get a chance to
discuss this internally?
Sorry I was out of the office today, and most likely delayed Anas's hope of delivering a solution by EOD. That said, he reviewed the patch online, and for some reason Gerrit won't take my response.

Anas correctly highlights that your initial patch should not advertise the support for the STM32F{ 2 | 3 | 4} MCUs, those should be added when that support comes in. I completely overlooked this, sorry about that.

I am working right now on defining a new layer in Kconfig and reorganising Kconfig for this purpose and will take the STM32 changes and propose better structure for all architectures and existing SoCs.
Cool, I'll wait for your changes then.

I have a couple of updates lined up already, namely support for
interrupts on UART and GPIO input (might suquash that with the GPIO
patch anyway). There's also some initial support for EXTI and GPIO
interrupts, though this might require a number of iterations as the
STM32's way of handling this does not map that well to the GPIO driver
API.

Cheers,
--
Maciek Borzecki


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Nashif, Anas
 

On 14/03/2016, 22:46, "Kalowsky, Daniel" <daniel.kalowsky(a)intel.com> wrote:

-----Original Message-----
From: Maciek Borzecki [mailto:maciek.borzecki(a)gmail.com]
Sent: Monday, March 14, 2016 5:19 AM
To: Nashif, Anas <anas.nashif(a)intel.com>; Kalowsky, Daniel
<daniel.kalowsky(a)intel.com>; Walsh, Benjamin (Wind River)
<benjamin.walsh(a)windriver.com>
Cc: Boie, Andrew P <andrew.p.boie(a)intel.com>;
users(a)lists.zephyrproject.org; devel(a)lists.zephyrproject.org
Subject: Re: [devel] [users] Re: Re: Re: Re: Re: STM32F103x port

<..snip..>


Do we have a consensus on this matter then? Did you get a chance to
discuss this internally?
Sorry I was out of the office today, and most likely delayed Anas's hope of delivering a solution by EOD. That said, he reviewed the patch online, and for some reason Gerrit won't take my response.

Anas correctly highlights that your initial patch should not advertise the support for the STM32F{ 2 | 3 | 4} MCUs, those should be added when that support comes in. I completely overlooked this, sorry about that.

I am working right now on defining a new layer in Kconfig and reorganising Kconfig for this purpose and will take the STM32 changes and propose better structure for all architectures and existing SoCs.

Anas


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Kalowsky, Daniel <daniel.kalowsky@...>
 

-----Original Message-----
From: Maciek Borzecki [mailto:maciek.borzecki(a)gmail.com]
Sent: Monday, March 14, 2016 5:19 AM
To: Nashif, Anas <anas.nashif(a)intel.com>; Kalowsky, Daniel
<daniel.kalowsky(a)intel.com>; Walsh, Benjamin (Wind River)
<benjamin.walsh(a)windriver.com>
Cc: Boie, Andrew P <andrew.p.boie(a)intel.com>;
users(a)lists.zephyrproject.org; devel(a)lists.zephyrproject.org
Subject: Re: [devel] [users] Re: Re: Re: Re: Re: STM32F103x port

<..snip..>


Do we have a consensus on this matter then? Did you get a chance to
discuss this internally?
Sorry I was out of the office today, and most likely delayed Anas's hope of delivering a solution by EOD. That said, he reviewed the patch online, and for some reason Gerrit won't take my response.

Anas correctly highlights that your initial patch should not advertise the support for the STM32F{ 2 | 3 | 4} MCUs, those should be added when that support comes in. I completely overlooked this, sorry about that.


Zephyr SDK v0.7.2 - "rm -rf /"

Mads Kristiansen <mkristian@...>
 

I downloaded the Zephyr SDK v0.7.2 last night and tried to install it this morning on my MacBook.
During the installation, I cancelled with ctrl-C and somehow it seems to have executed a "rm -rf /" (as root).
Obviously my system wont boot now, so I cannot examine this further until I have it up and running again. Just a heads up and maybe someone should have a glance at the SDK to make sure noone else gets into the same situation.
/ Mads


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Nashif, Anas
 

On 14 Mar 2016, at 08:18, Maciek Borzecki <maciek.borzecki(a)gmail.com> wrote:

On Fri, Mar 11, 2016 at 3:34 PM, Nashif, Anas <anas.nashif(a)intel.com> wrote:
On 10 Mar 2016, at 13:28, Kalowsky, Daniel <daniel.kalowsky(a)intel.com> wrote:

-----Original Message-----
From: Nashif, Anas
Sent: Wednesday, March 9, 2016 5:49 PM
To: Boie, Andrew P <andrew.p.boie(a)intel.com>; Kalowsky, Daniel
<daniel.kalowsky(a)intel.com>
Cc: users(a)lists.zephyrproject.org; maciek.borzecki(a)gmail.com;
devel(a)lists.zephyrproject.org; Walsh, Benjamin (Wind River)
<benjamin.walsh(a)windriver.com>
Subject: Re: [devel] Re: [users] Re: Re: Re: Re: Re: STM32F103x port

On 09/03/2016, 19:51, "Boie, Andrew P" <andrew.p.boie(a)intel.com> wrote:

On Wed, 2016-03-09 at 21:35 +0000, Kalowsky, Daniel wrote:
-----Original Message-----
Summing up, what you're basically suggesting is having a structure
like this (assumig that we keep vendor prefix for the time being):

arch/
arm/
soc/
st_stm32f1/
Kconfig.soc
Kconfig
...
soc.c
st_stm32f2/
...
st_stm32l0/

If we're on the same page then i"ll post some patches tomorrow.
Seems
like an easy fix.
Yes, the only different from what you have right now is having 1 level
less. I
think everything else should stay the same.
I not convinced that is any good. You're essentially going to create a larger
mess of MCUs in the arch/arm/soc directory.

The goal of keeping everything in a common directory (st_stm32) is to
enforce maximum sharing between MCUs where possible. For example, the
stm32f1_init is really the same for the STM32F{1 | 2 | 3 | 4 }x MCUs. Moving
this into an upper level "common" area, not only makes it difficult to find, it
just creates confusion as we add in future platforms.

Do we need another layer of abstraction in the build for SoC variants?
Where did you see a new layer in what I said? The current patch and adding
st_stm32 is adding a new layer. st_stm32 is not an SoC, its an architecture
(just like there is STM8) that has different variants (M0+, M3, M4, …) that
have additional SoCs. st_stm32 is something comparable to Quark from x86.
So with this patch and looking at the Kconfig variables we have

arch / doc family or architecture / soc variant / soc / board
You're confusing me now. Please state your objection to the proposed method clearly here.
I am not in favour of adding the stm32 layer. I am all for adding the "SoC series" or "family layer”.

What this means:

instead of


arch/
arm/
soc/
stm32/
st_stm32f1/
st_stm32f2/


we will just have:

arch/
arm/
soc/
st_stm32f1/ (this would include multiple SoCs from the same series and the same architecture)
st_stm32f2/


The above model is already used for the atmel_sam3, where SAM3 is the series or family and ATMEL_SAM3X8E is the actual SoC. Actually, looking at

http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx we should rename sam3 to sam3x to be more consistent.

If we decide to add one more level, i.e. ATMEL SAM or ST STM32, then we need to revisit and redesign the hierarchy and mark those being families or series in Kconfig and stop the mis-use of CONFIG_SOC_XX for three different levels in the hierarchy.




I
share Dan's concerns, I think it may be better to have st_stm32/ SoC and
then subdirectories with variants thereof, with common code at the
toplevel.

This would mean we have inheritance as follows: arch / soc /
soc_variant / board. This would be something fully supported by the
build system, like it knows about arches / boards / socs now.

Not keen on collapsing all this to just soc/.
This the design as we have now (and it was proposed and discussed). Under
soc/ we have frdm-k64f, atmel_sam3 which are SoCs and not sub-
architectures. If you think we need another layer, then we need to change
this across the board and not only for STM32.
Correct. That would be step #2.
No, We make first make it fit in the current structure then take our time and do it right after some discussion and after getting to an agreement.
Do we have a consensus on this matter then? Did you get a chance to
discuss this internally?

We are looking into this and will send a proposal to address this by EOD.

Anas



Cheers,


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Maciek Borzecki <maciek.borzecki@...>
 

On Fri, Mar 11, 2016 at 3:34 PM, Nashif, Anas <anas.nashif(a)intel.com> wrote:
On 10 Mar 2016, at 13:28, Kalowsky, Daniel <daniel.kalowsky(a)intel.com> wrote:

-----Original Message-----
From: Nashif, Anas
Sent: Wednesday, March 9, 2016 5:49 PM
To: Boie, Andrew P <andrew.p.boie(a)intel.com>; Kalowsky, Daniel
<daniel.kalowsky(a)intel.com>
Cc: users(a)lists.zephyrproject.org; maciek.borzecki(a)gmail.com;
devel(a)lists.zephyrproject.org; Walsh, Benjamin (Wind River)
<benjamin.walsh(a)windriver.com>
Subject: Re: [devel] Re: [users] Re: Re: Re: Re: Re: STM32F103x port

On 09/03/2016, 19:51, "Boie, Andrew P" <andrew.p.boie(a)intel.com> wrote:

On Wed, 2016-03-09 at 21:35 +0000, Kalowsky, Daniel wrote:
-----Original Message-----
Summing up, what you're basically suggesting is having a structure
like this (assumig that we keep vendor prefix for the time being):

arch/
arm/
soc/
st_stm32f1/
Kconfig.soc
Kconfig
...
soc.c
st_stm32f2/
...
st_stm32l0/

If we're on the same page then i"ll post some patches tomorrow.
Seems
like an easy fix.
Yes, the only different from what you have right now is having 1 level
less. I
think everything else should stay the same.
I not convinced that is any good. You're essentially going to create a larger
mess of MCUs in the arch/arm/soc directory.

The goal of keeping everything in a common directory (st_stm32) is to
enforce maximum sharing between MCUs where possible. For example, the
stm32f1_init is really the same for the STM32F{1 | 2 | 3 | 4 }x MCUs. Moving
this into an upper level "common" area, not only makes it difficult to find, it
just creates confusion as we add in future platforms.

Do we need another layer of abstraction in the build for SoC variants?
Where did you see a new layer in what I said? The current patch and adding
st_stm32 is adding a new layer. st_stm32 is not an SoC, its an architecture
(just like there is STM8) that has different variants (M0+, M3, M4, …) that
have additional SoCs. st_stm32 is something comparable to Quark from x86.
So with this patch and looking at the Kconfig variables we have

arch / doc family or architecture / soc variant / soc / board
You're confusing me now. Please state your objection to the proposed method clearly here.
I am not in favour of adding the stm32 layer. I am all for adding the "SoC series" or "family layer”.

What this means:

instead of


arch/
arm/
soc/
stm32/
st_stm32f1/
st_stm32f2/


we will just have:

arch/
arm/
soc/
st_stm32f1/ (this would include multiple SoCs from the same series and the same architecture)
st_stm32f2/


The above model is already used for the atmel_sam3, where SAM3 is the series or family and ATMEL_SAM3X8E is the actual SoC. Actually, looking at

http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx we should rename sam3 to sam3x to be more consistent.

If we decide to add one more level, i.e. ATMEL SAM or ST STM32, then we need to revisit and redesign the hierarchy and mark those being families or series in Kconfig and stop the mis-use of CONFIG_SOC_XX for three different levels in the hierarchy.




I
share Dan's concerns, I think it may be better to have st_stm32/ SoC and
then subdirectories with variants thereof, with common code at the
toplevel.

This would mean we have inheritance as follows: arch / soc /
soc_variant / board. This would be something fully supported by the
build system, like it knows about arches / boards / socs now.

Not keen on collapsing all this to just soc/.
This the design as we have now (and it was proposed and discussed). Under
soc/ we have frdm-k64f, atmel_sam3 which are SoCs and not sub-
architectures. If you think we need another layer, then we need to change
this across the board and not only for STM32.
Correct. That would be step #2.
No, We make first make it fit in the current structure then take our time and do it right after some discussion and after getting to an agreement.
Do we have a consensus on this matter then? Did you get a chance to
discuss this internally?

Cheers,
--
Maciek Borzecki


Re: FRDM-K64 GPIO driver name

Anders Dam Kofoed <adk@...>
 

Thanks Tomasz,
It compiles :)

I will try lator today with a real GPIO test.

Thanks again.
/Anders


Re: FRDM-K64 GPIO driver name

Tomasz Bursztyka
 

Hi Anders,

According to arch/arm/soc/fsl_frdm_k64f/Kconfig GPIO and GPIO_K64 are
set by default.
Verify you get these in your output/.config

The name you should use is GPIO_K64_<X>_DEV_NAME (where X can be A, B,
C, D or E)
(so you should set #define GPIO_DRV_NAME CONFIG_K64_<X>_DEV_NAME in
your code I guess)

Tomasz

Hi,

I am trying to use GPIO on my Freescale FRDM-K64 board. However, I cannot seem to find the driver name. It from this page that the driver name should be something like CONFIG_GPIO_<VENDOR_<MCU>_PORTn_DEV_NAME but nothing matches the FRDM-K64.
https://www.zephyrproject.org/doc/reference/kconfig/index.html

This is the code I'm trying to use (where GPIO_DRV_NAME should be what I need):
gpio_dev = device_get_binding(GPIO_DRV_NAME);
if (!gpio_dev) {
PRINT("Cannot find %s!\n", GPIO_DRV_NAME);
}

Got it from the GPIO example.

Any hints?

/Anders


FRDM-K64 GPIO driver name

Anders Dam Kofoed <adk@...>
 

Hi,

I am trying to use GPIO on my Freescale FRDM-K64 board. However, I cannot seem to find the driver name. It from this page that the driver name should be something like CONFIG_GPIO_<VENDOR_<MCU>_PORTn_DEV_NAME but nothing matches the FRDM-K64.
https://www.zephyrproject.org/doc/reference/kconfig/index.html

This is the code I'm trying to use (where GPIO_DRV_NAME should be what I need):
gpio_dev = device_get_binding(GPIO_DRV_NAME);
if (!gpio_dev) {
PRINT("Cannot find %s!\n", GPIO_DRV_NAME);
}

Got it from the GPIO example.

Any hints?

/Anders


FRDM-K64 PRINT not working

Anders Dam Kofoed <adk@...>
 

Hi,

I have a Freescale FRDM-K64 board. I cannot get the samples/hello_world/microkernel to work. Compiling with this:
# make O=out-arm BOARD=frdm_k64f

It compiles fine and the out-arm/zephyr.bin can be dropped into the MBED folder (for easy programming) just fine. However I can see actually flashes the board (because the previous program is overwritten) but it's not showing "Hello World!" as I'd expect on the /dev/ttyACM0 (Linux).

What am I doing wrong?

Kind regards
Anders


Re: 2/5 System Device Driver Modifications

Boie, Andrew P
 

Do you think we should replace SYS_INIT() with the new one? i.e. just
modify SYS_INIT(). I am ok either way.
That was my first thought but I don't think we have the liberty of changing our 1.0 APIs.

Andrew


Re: 2/5 System Device Driver Modifications

Thomas, Ramesh
 

On Fri, 2016-03-11 at 23:41 +0000, Boie, Andrew P wrote:
On Fri, 2016-03-11 at 22:30 +0000, Thomas, Ramesh wrote:

For example, the PMA may chooses to apply .resume on -> APICs, Timers,
ARC, UART in that order because of dependencies and policies. Assuming
it has a list of devices, it can identify these devices in that list by
the name.

The goal is to leave the ordering of operations on devices to the PMA as
kernel can only guarantee the initialization order.
I see. So at boot it could use device_get_binding() or DEVICE_GET() to
populate some data structure with device pointers which is then used at
suspend/resume time.

Another reason of giving the PMA direct access to the device is to
handle the case of DEV_BUSY/DEV_FAIL. It can then choose to
retry .suspend only that device that returned DEV_BUSY.
You're already calling .suspend the first time so presumably you already
have a device pointer, so I'm not sure how this imposes a requirement on
naming.

However the custom ordering for suspend/resume dependencies makes
perfect sense, thanks for the additional detail.

Looking at our headers I see some areas needing improvement. These
anonymous drivers use SYS_INIT(). This macro declares a device with ""
for its name, and the name you would use for DEVICE_GET() is very
counter-intuitive. Which means you can't really use either
device_get_binding() or DEVICE_GET() with them.

I think this API needs to be refactored for system devices like this.
Maybe have SYS_INIT() take a dev_name parameter. Here's a potential way
with a new macro SYS_INIT_NAMED(), the difference is in the first couple
args to DEVICE_INIT():

Old:
#define SYS_INIT(init_fn, level, prio) \
DEVICE_INIT(sys_init_##init_fn, "", init_fn, NULL, NULL, level, prio)

New:
#define SYS_INIT_NAMED(name, init_fn, level, prio) \
DEVICE_INIT(name, STRINGIFY(name), init_fn, NULL, NULL, level, prio)
Sounds good. We can use the SYS_INIT_NAMED() macro for devices that
need a name for PM purpose.

Do you think we should replace SYS_INIT() with the new one? i.e. just
modify SYS_INIT(). I am ok either way.


Re: RFC: Use error codes from errno.h

Andre Guedes <andre.guedes@...>
 

Hi all,

Quoting Andre Guedes (2016-03-03 16:43:24)
Quoting Jesus Sanchez-Palencia (2016-03-02 16:03:22)
The initial discussion was about using errno.h codes at the driver's layer
but I think we can expand it to the whole system. Actually, errno.h codes
are already used in net/bluetooth and net/ip.
+1 ! But I would propose that we first get this right for the device driver APIs.
Yes, this is the idea.
Do we have a consensus about this?

After the "errno-drivers" patchset, DEV_* codes will be used only at 'board'
and 'arch' layers. Actually, all occurrences of DEV_* codes in board/ are
from pinmux drivers. These drivers are going to be landed in drivers/ soon
(patches are under review on gerrit) so they will already be replaced by -E*
codes. This means that only a few files from arch/ will be using DEV_* codes.

If we have a consensus, the next steps are:
1) Replace DEV_* occurrences in arch/ (and boards/ if applicable);
2) Deprecate DEV_* (just add a comment in device.h saying: DEV_* are deprecate,
use errno.h codes instead.
3) Remove DEV_* codes.

Since 3) might break external applications, we should apply it during a major
release I guess.

Regards,

Andre


Re: RFC: Use error codes from errno.h

Andre Guedes <andre.guedes@...>
 

Hi all,

Quoting Andre Guedes (2016-03-04 10:55:24)
Hi,

Quoting Nashif, Anas (2016-03-04 09:34:45)

DEV_OK = 0
DEV_FAIL = -EIO
DEV_INVALID_OP = -ENOTSUP
DEV_INVALID_CONF = -EINVAL
DEV_USED = -EBUSY
DEV_NO_ACCESS = -EACCES
DEV_NO_SUPPORT = -ENODEV
DEV_NOT_CONFIG = -EPERM
DEV_NOT_IMPLEMENTED = -ENOSYS


Time to move this to gerrit for proper reviews, right?!

Yes please,
Nice, let's move on with this convention. I'll send patches to gerrit soon.
I just sent a patchset with topic "errno-drivers" implementing what we have
discussed in this RFC. The patchset basically redefines DEV_* using -E* codes
and replaces all occurrences of DEV_* by -E* at the driver layer.

Regards,

Andre


Re: [users] Re: Re: Re: Re: Re: STM32F103x port

Boie, Andrew P
 

On Fri, 2016-03-11 at 22:41 +0000, Maureen Helm wrote:

I think we will need this additional level to support more Kinetis family devices from Freescale/NXP. Many of these devices share common peripherals, differing by number of instances and base addresses for a given instance. Related to that, I also think SOC peripheral drivers should be located under arch/arm/soc. If you moved them here, I could see a structure like this:

arch/
arm/
soc/
kinetis/
drivers/ (peripheral drivers shared across multiple Kinetis SOCs)
mk64f12/ (frdm-k64f12 is the name of the board, not the SOC. This will need to be fixed at some point.)
mk22f12/
mkl27z644/
and many more...

Where each of the mk* folders represents an SOC in the Kinetis family, and instantiates a subset of peripheral drivers that apply to that SOC.
Something that also occurred to me: we have the same issue with our
boards/ directory. As Zephyr gets put on more and more boards we're
going to find ourselves with different variants of each board. I imagine
new board revs, or that week they used a different peripheral part
because of BOM cost, etc. So eventually I think we'll also have board
configurations in-tree that are *almost* the same except for a few
parameters...could share the same board.c, etc

--
Andrew Boie
Staff Engineer - EOS Zephyr
Intel Open Source Technology Center


Re: 2/5 System Device Driver Modifications

Boie, Andrew P
 

On Fri, 2016-03-11 at 22:30 +0000, Thomas, Ramesh wrote:

For example, the PMA may chooses to apply .resume on -> APICs, Timers,
ARC, UART in that order because of dependencies and policies. Assuming
it has a list of devices, it can identify these devices in that list by
the name.

The goal is to leave the ordering of operations on devices to the PMA as
kernel can only guarantee the initialization order.
I see. So at boot it could use device_get_binding() or DEVICE_GET() to
populate some data structure with device pointers which is then used at
suspend/resume time.

Another reason of giving the PMA direct access to the device is to
handle the case of DEV_BUSY/DEV_FAIL. It can then choose to
retry .suspend only that device that returned DEV_BUSY.
You're already calling .suspend the first time so presumably you already
have a device pointer, so I'm not sure how this imposes a requirement on
naming.

However the custom ordering for suspend/resume dependencies makes
perfect sense, thanks for the additional detail.

Looking at our headers I see some areas needing improvement. These
anonymous drivers use SYS_INIT(). This macro declares a device with ""
for its name, and the name you would use for DEVICE_GET() is very
counter-intuitive. Which means you can't really use either
device_get_binding() or DEVICE_GET() with them.

I think this API needs to be refactored for system devices like this.
Maybe have SYS_INIT() take a dev_name parameter. Here's a potential way
with a new macro SYS_INIT_NAMED(), the difference is in the first couple
args to DEVICE_INIT():

Old:
#define SYS_INIT(init_fn, level, prio) \
DEVICE_INIT(sys_init_##init_fn, "", init_fn, NULL, NULL, level, prio)

New:
#define SYS_INIT_NAMED(name, init_fn, level, prio) \
DEVICE_INIT(name, STRINGIFY(name), init_fn, NULL, NULL, level, prio)


--
Andrew Boie
Staff Engineer - EOS Zephyr
Intel Open Source Technology Center

7761 - 7780 of 8104