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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 o; R! ]8 l9 N, r* N" z( N0 a7 }
  1. [code]EDMA sample test application
    . f$ `% |3 r* k  a) a' j% F
  2. /*' s  ?. A9 D! M( I8 b- _
  3. * edma_test.c
    ! ]! B/ S3 G1 z: R
  4. *2 L, z) i% o+ K+ L
  5. * brief  EDMA3 Test Application
    1 u. V# o- i3 y2 H0 Y2 z- S
  6. *8 Z3 @1 R6 a/ ?3 Q, V7 Y# `
  7. *   This file contains EDMA3 Test code.- J: i7 r( t  O. \5 }: c2 j
  8. *
    3 {5 g9 c$ Q  R) o! @! D$ O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 H0 p# m% P( y* |2 Y3 \, U1 P1 Y& a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d% N/ b; o& G! ]
  11. *         TO CHANGE.$ e* l: R3 Z: u5 P
  12. *0 W) V& P* `7 L' s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & d% y  \/ @8 \2 B3 I
  14. *
    7 s1 |% p% u+ H8 ^0 m( K
  15. * This program is free software; you can redistribute it and/or6 a* O- N6 Q/ j1 [3 k; f8 `* W
  16. * modify it under the terms of the GNU General Public License as
    . F1 S* C6 X% D8 F, f; J
  17. * published by the Free Software Foundation version 2.# f3 K+ T6 p9 M% i3 F
  18. *
    0 [8 z: ^8 ]1 B+ W: w! X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" T' `! U  i  d4 v! s" M
  20. * kind, whether express or implied; without even the implied warranty4 E7 J! S3 t% @+ H  [! Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' w: [8 ?; [( j) l8 l& R  _
  22. * GNU General Public License for more details.0 B. M, F2 v- S/ O" A1 G4 H
  23. */
      `$ O8 U: P7 h  P

  24. ) q1 S8 S8 k* \0 m" n1 A
  25. #include <linux/module.h>
    : g# L& N) E+ I7 _
  26. #include <linux/init.h>
    $ X2 s4 k" c- u% U0 S  Q6 t( P
  27. #include <linux/errno.h>
    ' M2 d' j0 S* _4 U
  28. #include <linux/types.h>
    5 Z9 ]5 B$ `. D+ U, `4 c( L
  29. #include <linux/interrupt.h>
    ; q8 Z6 E4 W" d- i4 m; m+ T3 W
  30. #include <asm/io.h>- x; y, g& |9 k" X
  31. #include <linux/moduleparam.h>
    : h0 u" b1 I( v. J
  32. #include <linux/sysctl.h># P+ w) s1 X, w1 O6 r7 D
  33. #include <linux/mm.h>
      C9 i* w$ {0 q
  34. #include <linux/dma-mapping.h>
    - P9 L8 q- r4 T! y/ P# _

  35. 9 f7 T! u0 e' V! |/ d' E9 B
  36. #include <mach/memory.h>" [* B. c( p$ F. g( ?! r
  37. #include <mach/hardware.h>( n( ~+ J. Y2 g6 j* E
  38. #include <mach/irqs.h>+ p9 ^* q+ A( M# o' l1 K( j) F
  39. #include <asm/hardware/edma.h>
    2 L7 N. V& o, @# [

  40. # o% X/ \6 O3 i* m- p
  41. #undef EDMA3_DEBUG, @9 q. ~8 m0 u: L
  42. /*#define EDMA3_DEBUG*/: g. v1 P! G$ K3 g" S" Z* J6 ^( t

  43. 9 I) x9 e7 b, }  I: Y  K( P% _
  44. #ifdef EDMA3_DEBUG
    " C3 j4 E4 u% A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z+ n$ p/ a9 l# a& H" v! M( P# v! j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / F% m- p+ x; r4 F) q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" t1 `, _  V/ M. i* Y
  48. #else
    9 i1 J5 q0 T) V% S& r4 m. c4 r+ t
  49. #define DMA_PRINTK( x... )% F8 p) V0 a* x2 f# J; @  Q
  50. #define DMA_FN_IN
    $ B1 g) h, t. Q# I2 Q5 V
  51. #define DMA_FN_OUT. L, x, \! y4 H5 [+ J. j0 p4 w
  52. #endif
    8 i  B" W* P5 N

  53. 8 s( i6 b3 P3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 V( s8 s, _; S
  55. #define STATIC_SHIFT                36 }! a  }" T1 q0 P( L$ v' ~
  56. #define TCINTEN_SHIFT               20
    0 G' q; y. e8 H
  57. #define ITCINTEN_SHIFT              21: Y! {0 E9 n* k, q6 W5 g
  58. #define TCCHEN_SHIFT                22
    4 U1 Z8 P) n+ {- _' _4 \
  59. #define ITCCHEN_SHIFT               23
    $ ^& V% h3 n' u

  60. 6 }: P1 B% B, w% C$ L
  61. static volatile int irqraised1 = 0;' z: m/ \8 G0 N8 W- P( u( O
  62. static volatile int irqraised2 = 0;
    - c& i9 `1 ?7 G, f

  63. : ~# D- S5 w8 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n% X/ w: o; ?: z4 M* @9 p9 M6 W1 j5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 U) N3 q1 s% R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V6 _% G, x* F1 T6 i

  67. 2 U( h' ]8 E4 }! V- D
  68. dma_addr_t dmaphyssrc1 = 0;
    8 A1 C# |4 N1 ~! j8 ~) G( i+ Q
  69. dma_addr_t dmaphyssrc2 = 0;$ {0 J7 M, q9 J0 d9 `- I, w
  70. dma_addr_t dmaphysdest1 = 0;3 {0 m4 e! ?- B# f
  71. dma_addr_t dmaphysdest2 = 0;4 s* n, S9 w2 Q6 A
  72. & ]4 l3 D$ k' V/ V- M  a
  73. char *dmabufsrc1 = NULL;9 i. y. I$ C# A# \7 m. ~
  74. char *dmabufsrc2 = NULL;
    ' ~$ i. Y9 Q1 M; L: y4 r6 M# U: l& t3 E
  75. char *dmabufdest1 = NULL;
    ! k: s% f' r* {  M, p: E$ S) S9 z
  76. char *dmabufdest2 = NULL;
    # o3 T2 G& u3 ~' _. M3 `" A

  77. $ N( M& f& g0 f$ ~8 i
  78. static int acnt = 512;7 [- s$ m" X" A$ i/ s1 `1 c$ ~
  79. static int bcnt = 8;
    / K& T: \* B5 j/ f2 W8 P! i
  80. static int ccnt = 8;+ Y* d) I2 J/ i

  81. 0 S+ j: _& J9 q/ _, i: k: I
  82. module_param(acnt, int, S_IRUGO);
    ( _" e) V4 N! S* E5 q# j( j- w$ [
  83. module_param(bcnt, int, S_IRUGO);
    & X* f, F, H- G3 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- _  p% Y3 _( s; F4 W
" w# s5 B% R2 S# w# p3 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q- c- P8 x% {4 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. L" Q/ Y1 u. P2 T8 a  P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; t0 z& z8 u. P: _; [& ?! X, r
# ?9 s2 `. |" s$ f0 Z  w0 O: D* Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 05:53 , Processed in 0.037633 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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