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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 l+ n& R, }# o( Y
  1. [code]EDMA sample test application6 U( j& ~$ r7 X! M
  2. /*# A% J+ U* l% \: i. B
  3. * edma_test.c5 [* |4 g8 H$ X. |2 D1 i! l; o
  4. *
    , M: m) I7 @2 @8 r& X: I1 ~& `
  5. * brief  EDMA3 Test Application
    : P% Z+ W7 |4 K6 ~, e0 e  J
  6. *
    ( N) t5 g) v9 |4 J
  7. *   This file contains EDMA3 Test code.1 A/ `5 k! i2 Z+ N8 t
  8. *
    8 r  t! d: S3 s" a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 M, l$ P* c$ z! `! N! M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 w* a& S$ {, v# \* L+ m
  11. *         TO CHANGE.( k1 M" D2 Y1 \
  12. *) L$ Y: Y2 h' J# k9 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ l% k1 k& @  J6 b- o4 h$ f; U/ a' G
  14. *! Z; b$ U8 p# [
  15. * This program is free software; you can redistribute it and/or
    , J4 p3 y+ ^$ @
  16. * modify it under the terms of the GNU General Public License as
    ( T7 w; j( t2 D& P' G2 b
  17. * published by the Free Software Foundation version 2.
    : n! A# o0 J8 Y# }3 y
  18. *
    ) _  M; j& @5 D, G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ K7 e* u, H2 H# n! a6 J
  20. * kind, whether express or implied; without even the implied warranty! t+ r/ v' i; }( e4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 L& D! l* i, n' @
  22. * GNU General Public License for more details.- l1 }9 v7 v2 h% Y
  23. */) f/ U; U( G9 m3 Q; \; j- Z

  24. 0 {( A! F* u! d' _& ]* U
  25. #include <linux/module.h>5 q+ m$ h. g2 T- h/ i: ~
  26. #include <linux/init.h>
    : I8 O9 ~9 i2 C1 T7 Y- B
  27. #include <linux/errno.h>( @) {3 y: [! K6 G% d2 {4 l
  28. #include <linux/types.h>
    . N- j+ Z# L6 b4 K" Y% |* ^
  29. #include <linux/interrupt.h>
    3 v7 s# k& F! V$ ?$ I/ `2 `
  30. #include <asm/io.h>5 b* k0 h2 ^" L3 I
  31. #include <linux/moduleparam.h>7 b! M1 s- m% ?% N1 r5 X
  32. #include <linux/sysctl.h>* G5 m" ~5 F- m" m# ]/ q0 z
  33. #include <linux/mm.h>" u  {# i$ i$ b, m
  34. #include <linux/dma-mapping.h>' a2 U2 C" y4 m6 u, x* t0 Q5 ]! R

  35. 3 z8 a+ y; v1 L( k4 _- {# e: n7 q: f
  36. #include <mach/memory.h>
    0 N) B4 b5 O- h9 }+ A  h- i
  37. #include <mach/hardware.h>
    6 L9 j% c! Q9 @# Y
  38. #include <mach/irqs.h>
      x# e5 U# A* P+ b$ x
  39. #include <asm/hardware/edma.h>
    % E  g, ~% h/ M! g4 h9 N! L: _

  40. / c! b' Y) L  Y
  41. #undef EDMA3_DEBUG
    9 a5 O1 K8 m- P) {+ t& {& |( C
  42. /*#define EDMA3_DEBUG*/2 T0 z; l" U$ \
  43. 2 F4 m5 \2 G  M2 T
  44. #ifdef EDMA3_DEBUG4 r0 G0 ?( b! b* D' j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 B: p6 [) R& U) U: S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 g$ x- t. x0 G3 b- {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; |* Q/ G0 `5 N" i  b6 I7 ]
  48. #else8 {; Q. I3 N7 M  v; B
  49. #define DMA_PRINTK( x... )
    ; ?# a5 D' f4 h/ r
  50. #define DMA_FN_IN* ?' T/ T% g0 |8 n# _4 P
  51. #define DMA_FN_OUT$ z7 a% @$ [: x: A, v4 x
  52. #endif
    5 K1 g1 R7 }7 ~3 I

  53. 1 j1 Q, h, O8 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & M+ t  K* x3 x9 v! h, [
  55. #define STATIC_SHIFT                3
    " b# y' ?! ~8 e" E3 W# h, z
  56. #define TCINTEN_SHIFT               20
    ! ^9 g$ ?2 F4 N: I) \2 C4 y1 p
  57. #define ITCINTEN_SHIFT              21
    9 [2 \, O! l* @4 F( I2 H2 P* p2 c/ v
  58. #define TCCHEN_SHIFT                224 A4 K+ y* N* F) k: m3 E. j
  59. #define ITCCHEN_SHIFT               23
    ' O4 F: G0 Y: R( h- |2 P8 W

  60. . z+ n% K$ r. H
  61. static volatile int irqraised1 = 0;
    4 w4 l- v  c& }; @
  62. static volatile int irqraised2 = 0;! Q. I  w' ?$ R" Q' R; r, r

  63. , K, o; _. y1 I% `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v, U# p& S/ M( J: k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 z7 Q' @8 U. N4 L0 H% b& Q2 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 E7 M, t. u% b3 L* _& X

  67.   D/ q0 W$ p5 T2 H* Y
  68. dma_addr_t dmaphyssrc1 = 0;
    3 N3 r0 x8 {8 I) `
  69. dma_addr_t dmaphyssrc2 = 0;3 ~  M9 T# |  `4 o
  70. dma_addr_t dmaphysdest1 = 0;
    : y0 r6 m* x1 D% w* K9 A* P
  71. dma_addr_t dmaphysdest2 = 0;5 Z1 f* U* T8 E! X% m3 l) \0 Q7 G
  72. # B: |) O4 n2 c2 `0 [; R3 r
  73. char *dmabufsrc1 = NULL;, n# V9 V1 {* U4 v2 x* P3 z+ y: _. ^# U2 L3 l
  74. char *dmabufsrc2 = NULL;8 Y4 b/ d% U# f
  75. char *dmabufdest1 = NULL;8 m  t/ N( N: g$ a
  76. char *dmabufdest2 = NULL;: X; @, B) u0 R4 a
  77. $ c" R# Z2 K0 W$ Y' ~$ r: d3 e, ~' J
  78. static int acnt = 512;6 Z2 ]9 B& b) n
  79. static int bcnt = 8;
    ! V/ {; {2 H, k" j; w& f
  80. static int ccnt = 8;
    ) m: f7 _) Q# d
  81.   e/ E% D2 X: H. A! z
  82. module_param(acnt, int, S_IRUGO);
    3 L% ~0 x% T8 k5 t- P2 q
  83. module_param(bcnt, int, S_IRUGO);$ b! v& v$ y" L/ R* z  ^% C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ D' K. |: x3 l7 `8 H" m- z

% a( _, H, y; _8 Y* ~3 n  }) W" p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K! [/ [  Q4 d2 D5 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- m3 }  s6 O/ M6 O  a' y( {, W# l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ?6 J2 B7 m) G, o1 V
2 s% t1 q: ^( p/ ~+ f  `
, V" e9 a" u5 E3 K) S2 L/ }7 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-28 17:18 , Processed in 0.038872 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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