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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @/ H. b: M% Q; l
  1. [code]EDMA sample test application6 W8 P- Q* e5 i8 o# y
  2. /*6 G! W6 I! j) U, A2 ^3 v
  3. * edma_test.c
    * _( Z! U& t* C/ n) x
  4. *
    / i; s. [' x7 J' t" \. a# z
  5. * brief  EDMA3 Test Application. I, z3 b" R3 W) k; q
  6. *6 }  a9 t9 H6 |! c
  7. *   This file contains EDMA3 Test code.
    ; Z; `" y  n4 p
  8. ** ~- C5 A. n4 Y' ^- O" B  N8 o0 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + e3 G( U0 l* Y5 `0 I0 {+ ]; }8 G+ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 T$ y9 l5 h% M  f
  11. *         TO CHANGE.
    # {; T8 |: o2 I" R1 D$ l; ]
  12. *
    7 O& ?/ ?3 d- ?3 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      h8 y/ d$ O  ?+ @- F) i; Q# R" v
  14. *+ m2 }' K( k0 S8 s
  15. * This program is free software; you can redistribute it and/or! M  E( W8 A+ u* o7 ^/ @
  16. * modify it under the terms of the GNU General Public License as
    4 H: A3 l4 `& g7 n" G
  17. * published by the Free Software Foundation version 2.+ E5 Y" Z) G5 G- x' T$ s/ A
  18. *8 a: V# T7 P( F! O  w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( a" u% i2 }: c; x5 Q, J
  20. * kind, whether express or implied; without even the implied warranty
    % v% ~* ]# M  Y# h4 p1 s7 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / x( _  O& g! S  g- u# t; S7 c9 o
  22. * GNU General Public License for more details.
    0 b, B' `5 f5 w+ ]
  23. */
    1 Y9 x3 R" q& ?1 J5 [2 ~

  24. % R9 s' P; y& A( K0 ^: ~
  25. #include <linux/module.h>$ j# J% X7 @+ I
  26. #include <linux/init.h>
    6 k! C% E4 D1 w9 e" @" f
  27. #include <linux/errno.h>
    # f& z+ |  O4 B
  28. #include <linux/types.h>
    : e. U* J& I: \; v3 [! p7 v
  29. #include <linux/interrupt.h>
    , s9 I: C* D. h& @
  30. #include <asm/io.h>& u( h) J9 U- |0 g& l
  31. #include <linux/moduleparam.h>
    & [! H! E% U& s5 J1 {
  32. #include <linux/sysctl.h>" |+ K! Z( ]) s
  33. #include <linux/mm.h>9 x; j4 u7 A9 X5 s+ q
  34. #include <linux/dma-mapping.h>
    $ W, R; ?% [& v+ `( k5 ~! q

  35. 8 b3 j) I9 n* U5 p. M9 |# D
  36. #include <mach/memory.h>
    . D2 C- X, h5 n0 y* H) q8 }
  37. #include <mach/hardware.h>, I# n8 R1 S; ~# T
  38. #include <mach/irqs.h>& V' O5 \7 t" W9 R
  39. #include <asm/hardware/edma.h>
    / U% g3 ~" r* D# h2 }
  40. " s0 S+ n0 `! f2 ]4 L
  41. #undef EDMA3_DEBUG* ^" X2 l2 ]- }1 u1 |0 v
  42. /*#define EDMA3_DEBUG*/- D  ^  _1 K* t$ O

  43. 9 G. O: m  h; Q
  44. #ifdef EDMA3_DEBUG7 a$ j( a2 ]0 L8 }8 }8 P) k8 `) V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ u- [) `' ]3 a7 N3 f/ j! m; j7 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , M7 c6 q2 G* l2 ?* |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 B  m3 ]) q; z8 Q
  48. #else0 h: S' N1 e+ m& I" l1 ?  ^5 X
  49. #define DMA_PRINTK( x... )
    5 a2 [/ S0 N. X' C
  50. #define DMA_FN_IN
    / O. R$ N  S& \' P
  51. #define DMA_FN_OUT
    9 h9 `# z6 r/ e& L3 r* L! ?& P# e
  52. #endif
    ! d$ n4 p- S% K5 T2 `( q( g$ M
  53. * n; T6 I5 v( H0 }2 F- x) {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# b7 x% T  Y: x( ^1 Z
  55. #define STATIC_SHIFT                3
    2 ^* M9 H! M4 P# K" D/ X
  56. #define TCINTEN_SHIFT               20
    : S; u& k: R! C4 {/ J' U
  57. #define ITCINTEN_SHIFT              217 z+ a) N" d  f
  58. #define TCCHEN_SHIFT                22
    6 O) A) s2 j% p) v, z! l' _3 s
  59. #define ITCCHEN_SHIFT               23
    - A( ]- n: X1 A5 W  h) p

  60. 8 |% u, \: E/ O4 D
  61. static volatile int irqraised1 = 0;
    ! L6 P, X2 ~3 z' X5 }3 s
  62. static volatile int irqraised2 = 0;) Z+ I6 y" G' k# s6 z
  63. ; L% T7 n7 B4 |/ A3 i* f0 f' M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      y' G* O: K4 g  ^/ w0 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _( s, U) y7 W4 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * _, J: S: E9 f/ u) v

  67. 7 b0 x- N8 ^! u) b+ ?( K
  68. dma_addr_t dmaphyssrc1 = 0;
    6 r6 n" k4 d0 F- R& d- G" n
  69. dma_addr_t dmaphyssrc2 = 0;
    3 \% O, G7 ~9 }; D' V1 K
  70. dma_addr_t dmaphysdest1 = 0;/ k, o# C- T! n6 U9 T& a8 w% t3 T- q
  71. dma_addr_t dmaphysdest2 = 0;7 N, w8 K9 q0 \
  72. 0 B! W: L) p# g  X
  73. char *dmabufsrc1 = NULL;
    & f3 [. G3 E8 f3 B4 r) S4 q
  74. char *dmabufsrc2 = NULL;( z4 U9 U- Q# D# j$ }
  75. char *dmabufdest1 = NULL;
    4 z+ s2 l' v0 t6 y# \0 \
  76. char *dmabufdest2 = NULL;! k8 \5 k/ P6 H. {
  77. 3 n2 @# a, c5 g4 ^$ p
  78. static int acnt = 512;
    , B+ N6 |! \% R3 i  H/ D/ Y# G; I
  79. static int bcnt = 8;
    # j0 m  \4 @3 O7 Z; T  r* b
  80. static int ccnt = 8;4 }- [; I$ H$ K7 O

  81. % |* l( V4 \2 O! b! Y& \$ l: E4 X+ _
  82. module_param(acnt, int, S_IRUGO);
    & a" |) A# Y5 T6 c0 N3 A% R* t
  83. module_param(bcnt, int, S_IRUGO);
    . `- x* @# N, V/ U( K- l6 a7 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# w6 _+ s& ~1 M" q" ^9 c% _" ]
/ v( ]! q  B3 Z* Q! ]& S, q7 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  }2 M9 _6 n& D: `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# D. J2 j. P2 o. W3 a8 N" C. I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 x1 [0 E& u, e- p; W+ r
% t; P% f% y, \7 Y
1 `% q8 V+ u- ?8 M7 K' K8 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 02:45 , Processed in 0.039959 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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