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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E& D; c" h3 v, }: h. F0 a
  1. [code]EDMA sample test application# i6 r/ f" W3 G2 i
  2. /*
    $ S/ T# e! W8 Y# Z+ H# j' u' q
  3. * edma_test.c
    " y1 e! }+ R2 z6 ^" H
  4. *
    % M7 j+ `( o$ j2 X2 |
  5. * brief  EDMA3 Test Application
    2 Y6 y. {4 V, l& ^9 o
  6. *( D* t/ x2 s: h5 b$ {
  7. *   This file contains EDMA3 Test code.( F9 y7 C4 `1 L
  8. *4 q# d" Z8 y3 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ L( p2 T/ A" T0 T) A- M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ C3 B' b4 M0 L1 m0 W& j' X1 x# Q" l1 o
  11. *         TO CHANGE.
    6 H' c4 \- s# I
  12. *
    7 H9 Z! Y& `: n. a9 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: g6 p! K# T9 N" n. P6 F
  14. *" n0 X, N2 ^/ S$ `; v
  15. * This program is free software; you can redistribute it and/or
    ) }7 A# |2 a5 U
  16. * modify it under the terms of the GNU General Public License as. g+ j; z  y% K* S6 H- i- O* p
  17. * published by the Free Software Foundation version 2.
    / J* ~, x6 K7 u
  18. */ A2 O: i, ^6 P  ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! X: k7 c" S9 I1 n# C2 U3 G) _
  20. * kind, whether express or implied; without even the implied warranty# @+ d4 g. Z. m+ X: w$ D/ j  N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 @) w. U- r9 t
  22. * GNU General Public License for more details.- o2 D8 z" U7 M! r8 |/ N
  23. */" V& B0 F2 C/ F1 M
  24. 5 m5 p. r% P( B' U9 Y; l
  25. #include <linux/module.h>
    : F7 k+ q; p. X
  26. #include <linux/init.h>
    ) X8 D( k& h$ R
  27. #include <linux/errno.h>
    9 b- J! T) A1 R1 r0 Q8 h7 x
  28. #include <linux/types.h>9 f+ h# q  |; L
  29. #include <linux/interrupt.h>( {) f* [; t, `& i: E- y% ^
  30. #include <asm/io.h>9 h0 H+ Q8 S, b: [( O
  31. #include <linux/moduleparam.h>' ^, ]& `5 \( H
  32. #include <linux/sysctl.h>% x, l: M0 D; M
  33. #include <linux/mm.h>
    ' ^1 u: L3 d9 D3 @1 N/ V1 c7 N- T& ^
  34. #include <linux/dma-mapping.h>
    6 ?: h$ p: ?6 J
  35. 0 v4 i, o# X+ v
  36. #include <mach/memory.h>
    8 ?+ Z9 ~+ G2 y+ _9 u
  37. #include <mach/hardware.h>
    . B  V9 Z& y0 N9 @3 L
  38. #include <mach/irqs.h>
    3 [& {0 l) `7 H7 _. F- A3 P$ j
  39. #include <asm/hardware/edma.h>5 F& }) N# _  L, q4 K

  40. ! z' T3 H9 C3 r
  41. #undef EDMA3_DEBUG; k- D# O# Q4 C3 D, P2 |* X. v& P
  42. /*#define EDMA3_DEBUG*/
    . r4 ]  ?  L+ Z5 g) Y+ {: w# b3 C
  43. 3 L& q$ B: O" X
  44. #ifdef EDMA3_DEBUG
    3 Y7 M' Q# E2 q) W# U2 U7 W+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 B: t% ~4 Z3 C$ F% ^! @# p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 f+ k6 G% i+ Y! f' I5 r* a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z0 a6 E! b3 W* Q
  48. #else
    ( L1 c: d$ f5 k. `4 s; E" m( W3 n
  49. #define DMA_PRINTK( x... )
    : ?& ~) K9 J! L' x' a3 o
  50. #define DMA_FN_IN) n' G& T$ G/ m6 r8 C& _
  51. #define DMA_FN_OUT; l5 q5 _- I4 Y. S) g
  52. #endif
    6 I* e3 T8 g% |1 R) c* }/ S
  53.   |; [5 z8 [& z: p# \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 L  F/ R0 }" P/ p4 s, X0 K( I( G
  55. #define STATIC_SHIFT                3
    % Y  Y7 ]' Q1 l; F/ H1 u+ e
  56. #define TCINTEN_SHIFT               20/ |$ D3 N1 Y/ b: ]
  57. #define ITCINTEN_SHIFT              21
    ( b  e2 B% n- ?0 D7 q
  58. #define TCCHEN_SHIFT                22
    . ^& R' Y! e7 M6 R: J
  59. #define ITCCHEN_SHIFT               23+ r2 \. m- Y; Z# I$ {$ W9 J7 c
  60. . e5 l3 N. y9 l' l9 r
  61. static volatile int irqraised1 = 0;% `4 ]* p7 h% r: y! W/ {
  62. static volatile int irqraised2 = 0;
      r" V0 p5 B: ~! z/ o( `
  63. 4 p  T5 F* O8 r$ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s- c5 a( L1 f- |2 z, c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E9 @3 C, U" U8 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' o5 U- A  i0 |; L3 i5 ^
  67. % B: }  f0 M7 f) A) `7 }
  68. dma_addr_t dmaphyssrc1 = 0;
    5 b; P. r' f$ p: }+ D. k" l
  69. dma_addr_t dmaphyssrc2 = 0;) I' f+ d+ G2 E
  70. dma_addr_t dmaphysdest1 = 0;
    , U3 r# i) q& u$ l9 I% h
  71. dma_addr_t dmaphysdest2 = 0;
    3 ?4 l0 U$ h6 \

  72. # }0 R: {! G4 X7 W) Y
  73. char *dmabufsrc1 = NULL;2 d) q  z5 h' r$ {# ]1 w  b
  74. char *dmabufsrc2 = NULL;' _" ~0 ?& u$ o7 w
  75. char *dmabufdest1 = NULL;
    0 G8 @5 ]! T6 `+ n, V# m4 @% m
  76. char *dmabufdest2 = NULL;- M# z; {; U4 S8 J/ \1 D

  77. 8 `! v  U  t7 q, T% y' z) b  ]* E. J
  78. static int acnt = 512;4 R) G; m- B* O
  79. static int bcnt = 8;
    ( _4 p& R0 d6 O/ I3 p  S, R
  80. static int ccnt = 8;2 z& o7 U, E3 L7 s. k/ S" g
  81. , s4 }, M- {3 n( I4 w/ ^
  82. module_param(acnt, int, S_IRUGO);9 A: ]* T1 u$ Q3 P- F2 h6 N5 H& Q1 B! q/ n
  83. module_param(bcnt, int, S_IRUGO);+ {+ K8 [- |' `' x/ d) j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# O* u. U2 q" W

0 ]5 n% L7 c. Y1 u2 c8 b( S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 O* n: ]! c  l0 }% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ^! [, b7 C$ F$ T: P5 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- O2 D# P6 b/ E. b$ [
$ ]$ y. b2 z0 c% G) ^: K+ h" r9 w0 d( p, ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 20:14 , Processed in 0.049036 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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