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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ]. P! I% ^! F) L0 W9 {
  1. [code]EDMA sample test application
    # W! j8 i7 S$ A' }* l% D6 Y6 h
  2. /*0 y* Q3 d/ m1 ?0 @+ c+ T2 ~6 Q
  3. * edma_test.c- R; ]! g2 r) i8 J& @
  4. *6 z# B" b6 W8 d! y5 V6 k
  5. * brief  EDMA3 Test Application
    $ ?) r  q) r8 j/ }! X# w0 ]
  6. *5 `- }" k" n4 a0 u
  7. *   This file contains EDMA3 Test code.
    % }, f& A1 O: f3 e1 ?) W
  8. *
    - {6 ^  B0 D8 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) \0 D1 s8 p) n/ X( D& j! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ t$ a2 A6 _. C1 R" ^/ R
  11. *         TO CHANGE.
    . c. E3 C2 ?, g# z  d- @
  12. *
    " n/ t$ n* I4 n% R8 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 X1 h$ e$ Y5 F  q
  14. *3 ]/ O, W3 b! a) a( D4 z
  15. * This program is free software; you can redistribute it and/or6 V4 t5 J' I% \, E- o+ s) x5 C
  16. * modify it under the terms of the GNU General Public License as
    $ ^: [: f( Y3 r$ E3 `; b. @
  17. * published by the Free Software Foundation version 2.# d' U8 X0 o8 j
  18. *. P7 e& b  E& l, j% F% A, j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 j. K% i& E' q; r
  20. * kind, whether express or implied; without even the implied warranty% T; |* Y0 k+ f, Z9 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. g1 T) }; y- G: @3 y
  22. * GNU General Public License for more details.- ]  P; U. B. E, [) a& o
  23. */7 Q5 _( ?: N" w- D8 k1 x8 I

  24. & k7 E/ ~% z/ a' b  n
  25. #include <linux/module.h>7 `3 E& S6 [- k  i) W" M& ~
  26. #include <linux/init.h>* o- d% Y, h! D: K- a4 \, V; K
  27. #include <linux/errno.h>2 J% t! a$ `7 G& \2 M( Q6 D! f/ w
  28. #include <linux/types.h>3 }8 K  ?' c7 p3 ^& P! z
  29. #include <linux/interrupt.h>
    ' O, t! O" \$ a/ F# P( u2 |: J. q) x
  30. #include <asm/io.h>" ]+ \; `5 g. H) {6 @+ l1 l
  31. #include <linux/moduleparam.h>
    3 s* K. e( r( ^( e2 z. w8 F) Y
  32. #include <linux/sysctl.h>
    9 _$ y, A5 r. ~; }! ]' G0 b
  33. #include <linux/mm.h>
    % G. k* e) i% F2 N$ [) A
  34. #include <linux/dma-mapping.h>- [4 e4 `6 s. x9 e  z; v* d# @
  35. " ~: b) Y: d+ a. S; O: `% J; v$ D
  36. #include <mach/memory.h>
    2 P7 h: D' x& G) z7 c
  37. #include <mach/hardware.h>$ }, j" |/ ^, d' q# @
  38. #include <mach/irqs.h>; S4 P6 S* N, h
  39. #include <asm/hardware/edma.h>
    . y6 e7 F5 A4 @- R8 {

  40. # G: r% _, [. x1 K6 ^% L
  41. #undef EDMA3_DEBUG. u( B; k  L  A$ W$ a! N
  42. /*#define EDMA3_DEBUG*/9 ^, W+ Q0 w7 {3 X0 K, |5 g, B+ `

  43. 0 H3 W# i/ |& \8 d  C
  44. #ifdef EDMA3_DEBUG
    0 ~* k4 y7 i) `; r5 z1 p( a3 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % t& M9 B2 p8 S0 @  v* V) G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      y" D/ i! s3 ]( v3 Z2 M0 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - ?" o7 E( Q# d0 c
  48. #else+ H3 H; |2 H9 _% \4 }5 {
  49. #define DMA_PRINTK( x... )
    8 a! `( `6 X$ E3 ~4 U, v6 l  N/ m$ d
  50. #define DMA_FN_IN' i, v$ @/ G8 L1 y$ `
  51. #define DMA_FN_OUT. ~8 n6 k9 G5 ]
  52. #endif
    ( |+ S# A: q/ D8 u$ R
  53. 8 C) S/ N$ d- a( N+ U& H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 u2 U& @( R* C/ ~0 k5 N: c& f
  55. #define STATIC_SHIFT                3
    5 r% q9 T* C# |! F: x7 ~; k! _, V
  56. #define TCINTEN_SHIFT               20
    + N! R4 O* `( `
  57. #define ITCINTEN_SHIFT              216 x  _/ r: b$ k+ ]. r0 g( [% k. n
  58. #define TCCHEN_SHIFT                22
    2 ]0 X9 ?0 q9 Y+ p5 Y
  59. #define ITCCHEN_SHIFT               23! B* Y+ \4 D8 n- a) t
  60. 0 _/ Y$ v0 Y! b
  61. static volatile int irqraised1 = 0;1 H7 m2 J' ~* o; l
  62. static volatile int irqraised2 = 0;! P3 P; P( [) e+ B( {; z% E
  63. % v  f: z5 `$ y8 W; M! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j( k  ~. p# K# P6 X" Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 C" H0 B0 i) N; \& z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h% K" \6 _4 ~9 L3 a: F
  67. / y+ O' |" D4 k) u$ i
  68. dma_addr_t dmaphyssrc1 = 0;
    1 d" i. Y- ^) a# [. m3 k; v9 }$ }
  69. dma_addr_t dmaphyssrc2 = 0;
      ^; Z) {0 X$ j* P$ y3 M- X
  70. dma_addr_t dmaphysdest1 = 0;
    5 l: D2 V; v& X! X
  71. dma_addr_t dmaphysdest2 = 0;
    1 V9 i* D8 q8 v' v$ `( _6 R3 a

  72. - l, B% G* W: g+ ~1 L% e
  73. char *dmabufsrc1 = NULL;
    $ L! b2 o9 k0 b. s: m
  74. char *dmabufsrc2 = NULL;
    " U' ^& ]/ u( u; i; O
  75. char *dmabufdest1 = NULL;; |5 C- h8 g$ S* [5 s6 o
  76. char *dmabufdest2 = NULL;
    1 [+ X4 c9 _( B* s7 \- g

  77. : M$ T# W. u7 V; l0 O0 a
  78. static int acnt = 512;1 t% A9 N+ h5 [7 a) X7 P
  79. static int bcnt = 8;, Y# D8 ]; h" e
  80. static int ccnt = 8;+ p# J- O1 F' {% ]5 L' }4 ]# N* T

  81. 7 M9 |- e6 ?' w& u8 _  j
  82. module_param(acnt, int, S_IRUGO);  t, X" G) W0 h; A9 p% B. O
  83. module_param(bcnt, int, S_IRUGO);- `2 j2 s# g" W& H5 r3 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. O0 ~' p7 S! D  {# p- f
/ Y) q+ R* j: s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X$ U' w3 i* {! S( D- t; ~& N/ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  }+ |8 @' B- I% X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, c4 n: W% x9 n4 v8 K
3 D9 ^9 m) ?) [$ P5 _% {9 p: {3 @4 D+ M/ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 17:10 , Processed in 0.041708 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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