OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10234|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 [/ x4 _1 x6 L+ i
  1. [code]EDMA sample test application
    ) e% c1 U+ v& p8 N0 g
  2. /*
    & e3 v: I" p; |9 r) {! f3 ]
  3. * edma_test.c
    ' g5 f( H4 J9 q. q8 |8 Y/ q
  4. *
    2 g% T* n/ B: S% r  Z
  5. * brief  EDMA3 Test Application5 t. M. I- T$ a5 N. W
  6. *$ I! z: `: T) f2 @3 q
  7. *   This file contains EDMA3 Test code.
    * X. Z1 {" }) r( d! l- d
  8. *
    - l- d' H/ Q3 W6 {5 n9 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( w$ b. C: d0 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      r2 Y# p5 s( |, x
  11. *         TO CHANGE.
    1 r  L7 h: e) e6 ?' p7 m. q
  12. *# o& y( Z' Z! P+ D, D! M5 M' p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " x: C7 w0 s+ [5 Q9 q, f# e
  14. *! P+ J0 `" w6 |
  15. * This program is free software; you can redistribute it and/or
    7 ^2 [8 I8 J& F( R2 `% G" d$ \: R
  16. * modify it under the terms of the GNU General Public License as
    . [& _2 E, V2 @: a
  17. * published by the Free Software Foundation version 2.! B$ r$ {# w% l3 S5 V& ~
  18. *7 M; C9 G* r- r! t- i1 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q0 O, b9 B4 G3 d5 c2 [
  20. * kind, whether express or implied; without even the implied warranty( i- T) _+ R. ^4 M# w8 m- J$ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- |8 t; c3 v) y% c! {; T
  22. * GNU General Public License for more details.
    ! @1 W2 T" N8 I0 Q" I
  23. */3 |' b" x* U" r1 t# M  J$ N' V

  24. # n8 o' O/ C( F7 F, Z4 S
  25. #include <linux/module.h>  R7 P; a* l* i" R
  26. #include <linux/init.h>0 S$ r8 ~: e  d  J- O1 Y; s& t
  27. #include <linux/errno.h>+ f5 v- y+ i. p
  28. #include <linux/types.h>
    6 @0 o# \  V' C% n+ h/ t/ L
  29. #include <linux/interrupt.h>- G2 l3 I$ {; e( Q' r
  30. #include <asm/io.h>
    % j+ }, q  x1 f
  31. #include <linux/moduleparam.h>
    9 Z" E; l* q# w# y9 K0 u
  32. #include <linux/sysctl.h>1 C6 I* F4 T4 q0 H3 ]' P8 \
  33. #include <linux/mm.h>. ~8 e1 `$ G3 {# H' Q
  34. #include <linux/dma-mapping.h>
    2 u$ w( u9 U* m" A* F# |$ B0 s
  35. 3 d" Q2 I1 Z0 _; a% h( y
  36. #include <mach/memory.h>0 I: V6 o$ ]  ?; W: f' `
  37. #include <mach/hardware.h>( B# c# G* j6 f4 N
  38. #include <mach/irqs.h>
    - g( W; K- f! @/ a8 R' s& Q
  39. #include <asm/hardware/edma.h>
    5 ]+ J! d: K) J! @7 x0 y. Q

  40. , n; a0 P! S: c# O1 X4 S
  41. #undef EDMA3_DEBUG% ^" m) J- G, p) F+ ?( i
  42. /*#define EDMA3_DEBUG*/
    8 k1 E# S) m, }2 y* D+ B7 F

  43. + F. r% t- e6 _: d
  44. #ifdef EDMA3_DEBUG
    / [1 ]* K; I. @. G: _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : f. c9 g. u9 ]  u# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _9 j* `( j4 }4 Z+ Q3 T+ \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 ~3 ?4 I7 V. P' |
  48. #else0 e4 k/ X$ v' F4 R8 ^$ E7 n' [# O
  49. #define DMA_PRINTK( x... )2 G5 p" M" r% Y$ \" Z4 R
  50. #define DMA_FN_IN
    ( N  r: H; o8 t
  51. #define DMA_FN_OUT
    0 t1 W9 B& t) L" D# k+ o
  52. #endif
    3 k5 p$ k+ O( p% }4 b0 q+ i& K" E
  53. . R$ [* j( ]8 O- M( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - W9 o" T3 k+ F9 {& u
  55. #define STATIC_SHIFT                3
    : c5 ^/ }9 V+ q2 G# U; ~- m
  56. #define TCINTEN_SHIFT               20" k" t+ b+ \" n0 m9 {5 Z
  57. #define ITCINTEN_SHIFT              21
    5 x* P3 u5 c9 D; U& N
  58. #define TCCHEN_SHIFT                22: t2 Y; n+ {& y2 N) j9 _
  59. #define ITCCHEN_SHIFT               239 V# |" j  d9 b0 ]+ n" Q
  60. 7 S$ g) A- f5 L
  61. static volatile int irqraised1 = 0;
    6 E( _4 X, ]# f
  62. static volatile int irqraised2 = 0;, j6 M; ~( y& b9 m/ P% ]  H3 m4 f1 ?
  63. " n# l( b1 d% _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % o; r5 [  u6 e7 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) L  t# |% c3 U/ z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' {3 P/ H6 ?  s' ]  p

  67. - k" E- R: |% Y6 O2 j
  68. dma_addr_t dmaphyssrc1 = 0;
    ' W3 a" K7 T  q) g3 R
  69. dma_addr_t dmaphyssrc2 = 0;8 D; I' V! z( m% F6 @
  70. dma_addr_t dmaphysdest1 = 0;
    ) o2 t+ F0 e+ f, x( c; g  u
  71. dma_addr_t dmaphysdest2 = 0;! {1 u$ }- ?7 ~1 {/ B( d7 ]

  72. " L4 x3 S- Q+ z2 V3 m! o
  73. char *dmabufsrc1 = NULL;& `8 O# H: m1 i$ C+ ?: \; y# z7 m
  74. char *dmabufsrc2 = NULL;
    # O4 p5 c, b+ v8 O* h! {; L
  75. char *dmabufdest1 = NULL;" V- O6 W) M1 i- L9 u$ M
  76. char *dmabufdest2 = NULL;9 Y+ T  {' N- w1 M0 w( v1 B" {* F

  77. 2 h3 l9 `8 n( |4 k
  78. static int acnt = 512;
    ! R! H. S9 \* J* J/ b" A
  79. static int bcnt = 8;2 T4 e$ D$ ?# ~9 N& E
  80. static int ccnt = 8;
    , t& s% {- {9 E5 L* q. f
  81. 2 Q; @! A# ^" o  d+ k
  82. module_param(acnt, int, S_IRUGO);
    ' C& d1 ]3 U1 b6 f
  83. module_param(bcnt, int, S_IRUGO);, R( ^! D9 ?& f0 @% X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# V3 B3 ~5 @4 W

- A, |* P# c2 B2 u2 n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 O; l, J* U8 j4 S: k: F
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 r8 C" T) {! e7 z! r9 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 c* ^! u! b2 q, i# a
6 S& w( b3 y$ W; r

- o* `& y3 C: P* J5 S; w2 A! ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-19 14:19 , Processed in 0.048326 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表