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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W0 `. t. J7 y6 g+ q
  1. [code]EDMA sample test application
    ) i: s/ F* _  N9 f
  2. /*
    ! o1 G# }" ]7 K/ S! Q2 C
  3. * edma_test.c; Y6 A0 l2 z9 S% x1 z" r
  4. *
    ! R+ |$ O' D6 Z$ [
  5. * brief  EDMA3 Test Application
    ! b2 e+ u% q/ M$ w
  6. *; b6 D1 Z" f  h5 D
  7. *   This file contains EDMA3 Test code.
    8 _: V6 I8 O/ \+ n+ J  i
  8. *
    9 j  M' C2 ?% r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. `6 z8 z0 j# s2 N+ Z8 x& R! i6 ~2 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^6 x- |  R1 }9 c+ e- g8 I. R
  11. *         TO CHANGE.; N6 b9 w: b( {# R
  12. *
    0 s6 o# t: s) N  f: _$ q) W, ]) o+ j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 V, b' B8 X1 |4 k
  14. *  v% f  Z3 Y- Q, H+ n0 \: U
  15. * This program is free software; you can redistribute it and/or4 h, m/ A% ^7 \7 p0 x
  16. * modify it under the terms of the GNU General Public License as( N7 {3 K3 e+ `
  17. * published by the Free Software Foundation version 2.  i0 W; Z3 H) \1 ^- U
  18. *
    ' h8 y9 N; |/ x+ K8 N0 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) u9 {1 _4 L' H6 x1 ]9 Y% f
  20. * kind, whether express or implied; without even the implied warranty1 T( C( c' |1 j1 g" i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! b. ?* [' m# o( ~' a# o& }
  22. * GNU General Public License for more details.
    ) q) o/ p/ k. s2 ~8 a* c' ^
  23. */5 z  B! C, \2 N3 D- ?1 Z

  24. 5 `7 S" J* M; R% W
  25. #include <linux/module.h>
    $ ^1 \+ R5 c( ~( `2 p$ @( [/ ^
  26. #include <linux/init.h>
    3 A' c* J1 R# J- X8 E& t+ U
  27. #include <linux/errno.h>
    , O  M1 y( i2 X. ]3 ~( u# K- o# y
  28. #include <linux/types.h>7 Z$ k' N) C% T' k3 n7 j8 j' \
  29. #include <linux/interrupt.h>
    / `2 n1 ~) g5 W! @* T: j2 T
  30. #include <asm/io.h>
    - z3 ?1 K% p! o7 Q2 ?6 p7 u7 D
  31. #include <linux/moduleparam.h>
    ( }( ?) V! ~  V  E% I  t  z' v
  32. #include <linux/sysctl.h>' V/ O% n* ^8 B  M  D* E  p& p
  33. #include <linux/mm.h>
    : a, J" ~; H5 ?* ~" [
  34. #include <linux/dma-mapping.h>) p; v+ J9 r8 T  ~' Y
  35. - [5 Z' P4 a8 F0 w1 Q/ B
  36. #include <mach/memory.h>
    8 p3 l+ l+ `: r7 s' |% N  B0 R1 c2 m
  37. #include <mach/hardware.h>, g. M1 d* V2 f3 x! K/ }* X
  38. #include <mach/irqs.h>
    3 s2 n8 T# D8 f5 `& Q$ O1 ~9 H9 J
  39. #include <asm/hardware/edma.h>
      P6 E+ g+ {. n. G- N! U/ f/ @2 i

  40. + G6 }3 \* ~2 q6 P
  41. #undef EDMA3_DEBUG
    . U9 C- Y6 j+ A/ d: D, H
  42. /*#define EDMA3_DEBUG*/
    $ ?' l2 r; g  G' J* p4 L* f4 r
  43. % s/ l' v) l& o8 c* H9 E) g# L8 L+ F
  44. #ifdef EDMA3_DEBUG
    ! A$ x; H8 w' E$ z/ F$ y' d1 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 O' M( D& }. o# u9 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; S2 V* L+ A( r3 P$ L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a; ]0 w% O8 J( E" h) R% E
  48. #else; C$ F, @7 ^+ B& d9 r% q
  49. #define DMA_PRINTK( x... )
    5 N) S% L* r7 Q& X( d
  50. #define DMA_FN_IN
    ) r7 z1 r. Y$ p# f! r: V
  51. #define DMA_FN_OUT% m0 w8 F' c% i
  52. #endif
      u. J& ]4 Z- d/ F

  53. 2 ^! {! w) D+ m% M1 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 o0 l7 r& I8 D/ I0 ?
  55. #define STATIC_SHIFT                3! y* U2 W  b- J% C/ \) ?) G
  56. #define TCINTEN_SHIFT               20
    & m2 p$ H" Y$ @( a& O8 h
  57. #define ITCINTEN_SHIFT              21$ W  [3 f9 p0 `7 ~  [' f1 b
  58. #define TCCHEN_SHIFT                221 b; v: H# Y8 a
  59. #define ITCCHEN_SHIFT               235 |& w5 n# k8 Y  _2 ^6 _! s& A. S5 J

  60. . m( `8 |& k6 g
  61. static volatile int irqraised1 = 0;
    5 D* P8 S3 [9 V' [% D. w' Q7 Y
  62. static volatile int irqraised2 = 0;
    ) n1 h( }6 U- ^

  63. + Z# j  _( y5 q/ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 W; A& Q& c' m$ E8 ^- _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c- r: }5 a( A! z; D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ^3 [3 x  z* I0 G1 M

  67. 9 K# [$ ^9 f% ^; z6 ^
  68. dma_addr_t dmaphyssrc1 = 0;* H# f' a/ e. t7 {; F
  69. dma_addr_t dmaphyssrc2 = 0;
    $ B. E% ?8 |7 w* E, p2 O! {/ e  l- m
  70. dma_addr_t dmaphysdest1 = 0;. \, R, T3 T: H  j
  71. dma_addr_t dmaphysdest2 = 0;
    ; n" E+ ~0 g- e# Y6 ^/ P1 a* O

  72. 6 p5 h! u/ a9 W7 N# F
  73. char *dmabufsrc1 = NULL;, c' ?6 V2 c% n: w  e1 T1 E7 o2 ~
  74. char *dmabufsrc2 = NULL;
    - Z( n- T( S' T: f# D4 a* H
  75. char *dmabufdest1 = NULL;
    % N% M1 O, b- M6 F4 U! k( i
  76. char *dmabufdest2 = NULL;
    # N; ^0 s' P6 g+ r; P& p( q7 ?1 X6 T

  77. " o; E' q% i6 l$ D$ t! S
  78. static int acnt = 512;
    - {, g" J4 i4 w
  79. static int bcnt = 8;7 V6 B: l- o) Z
  80. static int ccnt = 8;. R* ~7 N- h+ {) F7 l$ C+ u6 ?4 w4 L
  81. . @9 G7 \  }4 d( _1 E4 S7 I2 H1 ^
  82. module_param(acnt, int, S_IRUGO);
    5 _) ?% x* t7 w- |! k& }
  83. module_param(bcnt, int, S_IRUGO);
    5 L: z0 l' R% [( C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 U* g+ ?" _. @
2 O+ O! h! n$ t, ]- O- S9 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! w5 o9 P/ d6 F8 X' Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A8 B* g, t; s1 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ O4 ]) G/ D9 n9 ^* u- \
! |+ m9 \0 @8 D
+ `: X/ o/ J: R- U9 ^6 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-27 02:18 , Processed in 0.045359 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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