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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ }4 ?: B! G7 ]' @
  1. [code]EDMA sample test application, V" ?- {) k+ Z
  2. /*/ t1 |# P2 S& _
  3. * edma_test.c
      C7 v3 d* y. l1 n% @. a2 \& ^& {
  4. *
    & l0 c' C- B- r. S% Y8 j# i
  5. * brief  EDMA3 Test Application
    0 i( H9 p9 M1 g
  6. *; u; n! R3 r- m6 b6 l& [2 p
  7. *   This file contains EDMA3 Test code.7 c9 x: [+ H1 r5 F1 p- \
  8. *
    , y! `3 ~4 b) @/ v8 `# Q% d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + z' m4 @. ^  `2 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " M2 Y9 ^: D: d+ _) Q* z6 J
  11. *         TO CHANGE.
    + A# ?- y  Y0 g; l/ \9 a
  12. *' E6 _8 {' t4 P% R  ~. ^  D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # c  m$ ?3 y. M- L8 K
  14. *
    " C" T# i9 x" ^4 \. g- W
  15. * This program is free software; you can redistribute it and/or; _8 @! e4 H' }# r6 m5 Q6 c$ o+ c
  16. * modify it under the terms of the GNU General Public License as
    0 b1 j! X) a4 c8 l8 r4 p
  17. * published by the Free Software Foundation version 2.8 Y5 L( s" k: E1 S+ B
  18. *0 t" n: \/ `. \* R' k# q  O( u4 l, I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# R+ p: x- [" f) \( [5 n" C
  20. * kind, whether express or implied; without even the implied warranty6 [# n9 {4 m# M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, q( X- U6 h+ O! W- M  {
  22. * GNU General Public License for more details.. |7 {) v0 B# z0 R; E5 ?
  23. */
    8 w/ h9 q% {. ~8 G# k9 J
  24. 0 r/ k: w  I5 r% q. }
  25. #include <linux/module.h>$ @8 T' I/ t0 |( s2 z& _
  26. #include <linux/init.h>
    ; G- b2 Z4 ~/ F
  27. #include <linux/errno.h>
    * `4 B, p/ d  U
  28. #include <linux/types.h>
    / V+ L5 v& G) c
  29. #include <linux/interrupt.h>. i2 }! B& ]/ b, t+ c  o
  30. #include <asm/io.h>
    1 a! j( F8 \+ G8 \$ q# m
  31. #include <linux/moduleparam.h>
    / @  ]$ ]. t# p* T9 a9 l
  32. #include <linux/sysctl.h>4 p4 u# s1 e* {0 o, P  k/ @. y
  33. #include <linux/mm.h>
    4 Y0 D! S( o8 Y5 t/ E& Y/ T
  34. #include <linux/dma-mapping.h>
    # e6 w" a, W% s. {+ q8 l

  35. : h+ ?* y& ^8 z/ b' e
  36. #include <mach/memory.h>
    + m) ^& f9 ~' K) x# B8 J
  37. #include <mach/hardware.h>3 B8 E0 @4 Y$ k) R3 i: M. Y% ]  N
  38. #include <mach/irqs.h>
    7 _0 V7 ]# l1 r$ T  M' Y( u
  39. #include <asm/hardware/edma.h>$ [7 c+ d3 C7 c' u

  40. * ]8 S) }& q; C$ p% q" ?1 y
  41. #undef EDMA3_DEBUG8 M9 g; N9 R, v8 h
  42. /*#define EDMA3_DEBUG*/
    3 a6 H( a) d* j4 \
  43. ; l2 S# @" ?* a8 \0 h
  44. #ifdef EDMA3_DEBUG8 b. `' J6 ~* R: l' y4 h* n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P/ B' d* P- M" `' W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! x1 g0 ]: f' O( E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 I. F+ U  {) F# G
  48. #else$ W; t' D; i5 C0 B. Z9 k
  49. #define DMA_PRINTK( x... )/ P; k  v1 W  y
  50. #define DMA_FN_IN
    8 C( R) ]) E& T
  51. #define DMA_FN_OUT  s9 o- g( s  u1 W  \- M
  52. #endif
    ( }; q% }! `9 W* F2 X$ ~

  53. ) A" e6 y9 I& {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - K4 {! `, N* B/ m! \2 `+ h' x
  55. #define STATIC_SHIFT                3. N7 M/ a7 V) m* L2 y2 Z9 z2 o
  56. #define TCINTEN_SHIFT               20
    6 {- f0 @( q# ?
  57. #define ITCINTEN_SHIFT              21
    9 X% o+ K" J: V. Q4 t
  58. #define TCCHEN_SHIFT                22
    7 B/ I+ S& G: T$ A
  59. #define ITCCHEN_SHIFT               23) h9 [7 v9 C' M3 c
  60. : L5 V9 I/ n" X" l; ]7 E7 E
  61. static volatile int irqraised1 = 0;
    8 Z7 O# K! o4 ^9 i* F1 \
  62. static volatile int irqraised2 = 0;
    ' Q/ G* e5 f: T' m
  63. / n7 @( y8 N. z5 }5 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~0 n; p- ]: M* a7 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p5 ^/ b" [7 S) z- W: Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~! Y+ R& n- B1 q: w
  67. 5 _; S3 p1 e* L* z$ y
  68. dma_addr_t dmaphyssrc1 = 0;( e: U+ P$ [8 ^; B, f2 U) C
  69. dma_addr_t dmaphyssrc2 = 0;* I. N$ C9 i# W4 [/ ^1 s8 t
  70. dma_addr_t dmaphysdest1 = 0;
    : {' t4 }0 m$ z! M. J
  71. dma_addr_t dmaphysdest2 = 0;# \0 `2 S2 l3 |1 ~
  72. ( c$ x: _0 V4 l9 P" z
  73. char *dmabufsrc1 = NULL;  E2 ^% v* M4 }+ {& E! O* _
  74. char *dmabufsrc2 = NULL;1 v  ~( c# e' z5 U! [/ u
  75. char *dmabufdest1 = NULL;' T3 {' j) {4 N7 a- N
  76. char *dmabufdest2 = NULL;+ ]2 R9 u; C( I% o# g2 F

  77. ) Z$ Z$ o4 v/ O" f3 h/ K
  78. static int acnt = 512;
      h* e, ~' `1 |, q; Q# k6 p
  79. static int bcnt = 8;: C* l2 }* y0 Q* O
  80. static int ccnt = 8;
    , J! f4 z9 O% K) j; r' E. b
  81. 8 T6 ~5 r1 [# f+ M; P* V
  82. module_param(acnt, int, S_IRUGO);
    9 \" _7 Y( e0 _# y$ m
  83. module_param(bcnt, int, S_IRUGO);
    ! |5 F" q! X8 L6 M& y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 V: s# `3 V- A- g7 z" F- v1 `0 }8 t0 G" ]6 Q) J0 r- e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) z5 y" d) l  Y: D1 v) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C, `) E) b/ d, ]' A% d5 W/ p/ e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 z: Q8 y( c' Y, o5 V: c" I
9 n8 E. D9 V3 P+ A( `/ {
; y6 \! f) e6 F& J8 o) z" g) f$ m. g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 00:47 , Processed in 0.038201 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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