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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 p8 o$ _% J( Q# ~7 v# g
  1. [code]EDMA sample test application& [0 T7 t  @- `. r
  2. /*
    5 r1 a$ ^2 D# R, N& l6 @
  3. * edma_test.c
    ! j+ m6 h7 a1 l
  4. *
    - b5 X. I0 |+ E
  5. * brief  EDMA3 Test Application
    ( V( f8 [+ A2 X- y
  6. *) ^" X8 t! J" X% W$ C. l9 L
  7. *   This file contains EDMA3 Test code.
    : [: C. P) a, g8 K
  8. *4 `. l, c- ]. h: k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * Q# B% N( I% K4 ^, M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 _/ x& g4 Z% f4 S$ c- u4 `! ~( R" X
  11. *         TO CHANGE.( p$ E' `) F3 o
  12. *# l0 J0 @: V3 p$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 A! S) \# Y) I- S/ ]: S
  14. *6 S. @/ m& h& c2 N5 t7 Z
  15. * This program is free software; you can redistribute it and/or
    - b0 E% Y- F6 Z  x
  16. * modify it under the terms of the GNU General Public License as
    $ j; s- [: }9 S! `8 B5 L
  17. * published by the Free Software Foundation version 2.: P0 T, q& {0 c$ m- `- @& x* [' w
  18. *! f& G" W2 k8 }* e/ j& w, A# }" f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ O2 e7 F* P: g1 ~! g
  20. * kind, whether express or implied; without even the implied warranty
    # f' W; K9 r3 Q  ]' b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 \8 x& h! r4 H4 e" Y9 j. j+ ~
  22. * GNU General Public License for more details.. K- |3 b+ W8 ~9 c4 R2 [5 X
  23. */
    ( F; }9 V' q+ a6 u5 {0 I" u+ \+ z
  24. * t+ ?& P( Y7 ~' G0 E, c' `
  25. #include <linux/module.h>
      T) ~) }2 |! j' ?. s! C9 F) K, Q
  26. #include <linux/init.h>
    4 F: l2 S8 O: f! ?% }" j  [  ]* [5 S
  27. #include <linux/errno.h>8 H4 D/ b8 L6 }6 B* g: P& T: N
  28. #include <linux/types.h>9 g( I( T9 n+ V, R. S) k, P$ C
  29. #include <linux/interrupt.h>  V: X! P/ J# }$ |. V
  30. #include <asm/io.h>6 f! ]% |" N* q* P  q
  31. #include <linux/moduleparam.h>; j5 C# B7 f  `/ [' I/ n! [
  32. #include <linux/sysctl.h>
    8 F! e2 H6 ]7 \+ M
  33. #include <linux/mm.h>
    - H4 L1 @. R2 ]
  34. #include <linux/dma-mapping.h>
    * W5 i+ n3 ^1 F% E/ {
  35. 9 O3 t% h1 J( Q8 R. K: g/ e
  36. #include <mach/memory.h>
    5 G9 w6 H9 K4 o% _: j- l$ e
  37. #include <mach/hardware.h>
    $ N4 [: `0 U! U  `0 }$ ]6 ]
  38. #include <mach/irqs.h>0 h# Y3 @! i1 }7 T
  39. #include <asm/hardware/edma.h>
    . y# i* O8 `& i
  40. . G, X8 T1 x- }0 C1 V
  41. #undef EDMA3_DEBUG7 ]9 e4 L3 |2 e/ K. e, U
  42. /*#define EDMA3_DEBUG*/
    3 j  L, T" ^) u

  43. 8 g" A. @$ g3 h5 c8 x! f
  44. #ifdef EDMA3_DEBUG
    + o: L1 f* S8 s: ]2 f# h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 w7 c, `5 s( g; e0 ]+ y* `$ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& H- }- D$ J. c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B+ E7 v# j* z; d6 W/ a
  48. #else
    0 i: u" s4 t9 m/ ~7 ~
  49. #define DMA_PRINTK( x... )" ]) l$ b9 _3 E: o/ S' P$ {
  50. #define DMA_FN_IN5 G0 ~2 p9 _0 I; {" Y' r
  51. #define DMA_FN_OUT
    6 E4 P* D3 [: i: Z8 e; u: P4 d
  52. #endif7 }3 ?% i0 E, t7 z, y. E

  53. ' N2 J9 f4 ]# B# h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): O* X7 L* }6 z- I  n: [' [
  55. #define STATIC_SHIFT                3: s# h2 e( g  q1 z# s
  56. #define TCINTEN_SHIFT               20
    1 o  E9 _# ^1 }  G# E* v6 S
  57. #define ITCINTEN_SHIFT              21  u) U7 T0 F: v8 h, q& I6 W1 B
  58. #define TCCHEN_SHIFT                22
    ) W  e+ T5 z" k6 m" @% U5 J3 G
  59. #define ITCCHEN_SHIFT               230 Q, Z  [' c) n, r% b8 L. j
  60. / M" o( {& s( [$ [3 O$ V1 o; q# M
  61. static volatile int irqraised1 = 0;+ V2 F0 H- v3 e- q; l0 Z+ q& ]
  62. static volatile int irqraised2 = 0;, b8 k+ |) a! ]

  63. ) p* r) `8 a% Y( j2 A7 g- {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + u: J+ t: j& U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?% k8 Y& \3 I. v  j2 n9 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C5 b. N9 q6 e: s! j

  67. - z, r3 e( z' K& }
  68. dma_addr_t dmaphyssrc1 = 0;
    8 R7 e- u0 j# @9 v; L4 h9 V
  69. dma_addr_t dmaphyssrc2 = 0;0 G" R/ K% E( Q7 S/ D  U/ k) L
  70. dma_addr_t dmaphysdest1 = 0;+ U1 C6 G5 k/ L9 ?. z- k; u" _7 \
  71. dma_addr_t dmaphysdest2 = 0;. q) I; s/ r* t+ J' w0 q4 e, z

  72. ( w. N* {% E! t2 q
  73. char *dmabufsrc1 = NULL;3 Q6 x6 ?6 c6 a6 N& j
  74. char *dmabufsrc2 = NULL;) E5 }: ^; K% b
  75. char *dmabufdest1 = NULL;
    2 J3 r8 ~' n: |# `5 E
  76. char *dmabufdest2 = NULL;" m2 k. Q  S! K6 e& s; `

  77. 2 D8 U# d1 C* |/ d$ G0 {( [1 G
  78. static int acnt = 512;
    9 A- P6 W" X  S. E1 r2 {3 H
  79. static int bcnt = 8;
    0 h) v' q) m3 l
  80. static int ccnt = 8;
    5 j: |5 @; h" m7 q& w
  81. 1 e, Q$ H' i/ U* M$ q" v9 ^
  82. module_param(acnt, int, S_IRUGO);
    2 |9 W0 j: |, Y- e
  83. module_param(bcnt, int, S_IRUGO);
    3 p: E- D1 d! w) C3 }, F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ^/ }7 i4 o% |) f- R& }- f+ {* ?2 u* [; }9 _: J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 I1 t8 {0 ?- `  O/ D1 f3 Y& k. m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, q7 m% P8 v0 A# Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 g1 a4 e4 U" ]1 L+ J

  I/ Z$ S: R& S/ P$ U/ f' S. [5 ^" b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 22:45 , Processed in 0.038920 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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