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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 p6 L( X4 c1 \8 `- F1 z' v
  1. [code]EDMA sample test application4 d+ Y6 e! ]- d5 A9 v8 ?; t
  2. /*9 L  v& _( ]  `
  3. * edma_test.c6 J! A3 X7 I, y8 v
  4. *1 I$ Q6 Z, p0 w' j  p1 [
  5. * brief  EDMA3 Test Application
    % F' x4 U3 h6 X( W0 p( D3 d
  6. *
    % C) Z! y6 f8 W3 L; ?0 c5 G% Y! d
  7. *   This file contains EDMA3 Test code.
    ' y/ D* \1 t9 K/ r! n3 L
  8. *
    ! O0 t. N. B. |7 J9 |! N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 d4 S  I7 R7 _% m; m% H/ x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- o8 ?2 _! M" {* Z8 G+ F4 q
  11. *         TO CHANGE.
    ; _( u% ^1 q9 p& @7 ^
  12. *
    # K/ _4 S% ~. K2 G3 d/ n: b# j2 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- E& u4 x+ a" D7 X+ p' s
  14. *
    ; _% P/ Z3 g( U; Y3 S
  15. * This program is free software; you can redistribute it and/or
    $ ^2 @: H  R1 l3 y: x* n: s
  16. * modify it under the terms of the GNU General Public License as* V, g  L% b* J: L% R8 u
  17. * published by the Free Software Foundation version 2.
    . _  z* K* V8 k2 F
  18. *3 ^! o, k% f8 L6 ]- G6 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 }0 F1 B. c2 o/ g7 q9 @5 _( c
  20. * kind, whether express or implied; without even the implied warranty" N0 P8 g2 i. D# ]  k2 V6 I! k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! t# w* Z$ d9 d- J6 d: r  Y
  22. * GNU General Public License for more details.& G" b" d9 V1 X/ W1 ?
  23. */
    + i4 d% u$ E4 J+ R6 S: `1 o3 [
  24. , X8 S. Q( t$ L2 ]/ j
  25. #include <linux/module.h>  t# S' W4 K  E% H
  26. #include <linux/init.h>$ N' H* T% l- N4 ]2 U& }5 D  }
  27. #include <linux/errno.h>; y" u3 v5 s8 o+ c
  28. #include <linux/types.h>
    . }' V3 Z, }+ h- U& `0 W0 W' m
  29. #include <linux/interrupt.h>
    3 O( W& x, {6 A) m$ n# p
  30. #include <asm/io.h>
    9 D. g1 c  c) A  I0 L
  31. #include <linux/moduleparam.h>
    8 W) l, w1 x6 }. j9 ?9 S- c
  32. #include <linux/sysctl.h>
    , g; G+ }* {, }
  33. #include <linux/mm.h>
    8 T' c& A" h" r3 T) z+ V8 K
  34. #include <linux/dma-mapping.h>5 t  l8 L3 H$ P8 e! i. M& C% P5 V
  35. ( h4 T3 ]" f/ E6 Q6 |
  36. #include <mach/memory.h>
    ' S* o# n% L9 W/ q
  37. #include <mach/hardware.h>
    1 F* G. G0 c. S# e, H
  38. #include <mach/irqs.h>
    + c: i1 L0 ?7 z* ^9 ~* F
  39. #include <asm/hardware/edma.h>
    - L* {, C7 Y- s, I% c
  40. - {' |2 g8 y* d- ~7 R8 B
  41. #undef EDMA3_DEBUG! `: @7 t% c3 p% T
  42. /*#define EDMA3_DEBUG*/
    1 ?0 A, a% L- ~0 y5 W0 J/ ~6 M4 v
  43. # ^5 j. L- f8 y
  44. #ifdef EDMA3_DEBUG
    . @5 [4 }' a- Z  T- K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  i5 b7 O; D1 W+ i' G5 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ \" n0 d' L/ k- _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 \0 _$ Z" R2 Z. P
  48. #else: _3 A5 S6 n& {  s7 O: U; t+ H
  49. #define DMA_PRINTK( x... )$ i# u% D6 A: c( X( q4 Q5 o; z
  50. #define DMA_FN_IN
    ' L: R# y& |0 D  u2 N
  51. #define DMA_FN_OUT- ~' x2 V$ c- [- D
  52. #endif
    1 {+ {5 ~4 a, T/ h  ?# ]8 J

  53. : c9 O  ~2 {7 n" l: A; J! C. w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# E# T- G9 Q; Z# R; m
  55. #define STATIC_SHIFT                3
    : v9 Z) T" Z, a% Q+ z' I8 i
  56. #define TCINTEN_SHIFT               20# Z) I4 L# T2 h$ M1 M
  57. #define ITCINTEN_SHIFT              21
    + [  S% o7 `1 ]: ]
  58. #define TCCHEN_SHIFT                222 k% D- u" D  b, |* p
  59. #define ITCCHEN_SHIFT               23
    % |! l5 e4 n5 x9 b: g8 H

  60. # [& \! ^( U6 P6 i6 {' l
  61. static volatile int irqraised1 = 0;: g% V8 ^; M" C* R/ I! T; a
  62. static volatile int irqraised2 = 0;/ ?- O6 |/ N' E! B2 f  K
  63. ; K1 n" \& m  C) d+ @- ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i' X& }. Y% t' k$ `" |0 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x" O1 h7 G) A5 H; k8 _& C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F$ f; r8 Z1 j$ r( n  i

  67. . l) E- J0 V1 P2 p
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ^0 O9 u& n% @
  69. dma_addr_t dmaphyssrc2 = 0;1 `' M2 @! }& X5 d
  70. dma_addr_t dmaphysdest1 = 0;
    $ k3 {! U+ E. R$ N
  71. dma_addr_t dmaphysdest2 = 0;
    . t8 Y$ \3 S: i5 @4 u- q$ w

  72. 1 U: Y1 N. @* P3 a
  73. char *dmabufsrc1 = NULL;4 Z/ p$ I, {3 M: F6 ^
  74. char *dmabufsrc2 = NULL;, x! `' @5 V. N. T
  75. char *dmabufdest1 = NULL;
    / C1 ^$ L& z# p2 @) u: G& M+ B: n: A
  76. char *dmabufdest2 = NULL;
    , X" d* A" k2 X  _& d9 h

  77. ; K$ `  H* w1 N4 O
  78. static int acnt = 512;% b9 P3 D9 G& l  e. e, u' x
  79. static int bcnt = 8;
    ' J5 G0 F8 K" G" z" l9 E" R+ z
  80. static int ccnt = 8;% R. L  _& ^" k( P. K
  81. ; V/ M) w+ I4 h9 A' }# N1 _
  82. module_param(acnt, int, S_IRUGO);
    * a0 f3 F5 J5 _8 f- t3 q+ S
  83. module_param(bcnt, int, S_IRUGO);
    / E9 u9 z- m' i, g4 d$ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 N  b9 E+ X2 }+ Z) z

: G0 P* v' y- F% f5 M7 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 p  F  H9 J  n" carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  J  Q2 L4 g9 X% X6 _  E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) b/ [1 [: N% x2 a8 @7 V( M6 h
7 x+ U3 ?$ U* T

' _. b# f. K( [9 W" T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 16:22 , Processed in 0.040790 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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