OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l% D  r$ [% K7 m6 f( j$ W6 k0 t
  1. [code]EDMA sample test application
    1 [' ]- \# v. y  c5 ?
  2. /*
    8 F# p5 {- n9 C6 M4 t6 f. A1 d
  3. * edma_test.c
    ! ]% N6 V! m& q/ T* G
  4. *
    . K, |4 [- |$ n7 c& w
  5. * brief  EDMA3 Test Application
    5 E/ T' ^2 D0 P/ [3 x  Y* _
  6. *
    6 H( s/ a8 ?4 g  d% C7 w- J
  7. *   This file contains EDMA3 Test code.0 e" N0 _  X5 Y" E+ \/ s
  8. *% O# |2 I- I9 a1 o  T' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* t, q3 _3 E% z5 c4 F3 V  s) p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 m# n. j; r+ ]; X" v$ d: ?
  11. *         TO CHANGE.
    4 [3 b7 a+ C) [% B3 _$ w
  12. ** j. u2 R5 S% K8 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 }8 u: @( h8 q1 `
  14. *& s, y0 C( m5 X% z; I; {( c
  15. * This program is free software; you can redistribute it and/or1 u0 \1 ?1 _2 _/ @; N; u( |- s
  16. * modify it under the terms of the GNU General Public License as) s' z3 s6 n- Y) R
  17. * published by the Free Software Foundation version 2.( w7 A4 U5 c0 F  _
  18. *2 u1 \, k5 A3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % C" D4 @% V2 o9 ^
  20. * kind, whether express or implied; without even the implied warranty$ S: `9 K& x) `/ m8 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y. [* k1 d+ c. V- B% M
  22. * GNU General Public License for more details.
    ' ?" @7 x' G% R7 P: h  A& u. B0 H2 F
  23. */
    0 x6 r! p5 m2 J7 Z2 e1 J' q

  24. 2 V: W- @2 C6 `* W2 J5 a3 z
  25. #include <linux/module.h>
    ; w  ^4 A1 G3 D, Z3 H
  26. #include <linux/init.h>
    & v0 u) ?! {. ~+ v
  27. #include <linux/errno.h>" e- S9 x8 B+ |- C2 B- C- ^; N
  28. #include <linux/types.h>6 {0 `# \  s4 _& n
  29. #include <linux/interrupt.h>+ G  D: b5 F+ [; I, M* l
  30. #include <asm/io.h>! I* q! n4 K0 k; Y6 h8 W2 n
  31. #include <linux/moduleparam.h>, n" g9 M+ B" R
  32. #include <linux/sysctl.h>; f; G, Q; h1 l& o7 M3 q
  33. #include <linux/mm.h>
    ! ?' A( i: @4 y
  34. #include <linux/dma-mapping.h>* \( K" x# L" ^: [) Z% R" k4 |
  35. 2 G5 K* V/ i6 w+ l/ T% Z9 E
  36. #include <mach/memory.h>/ U! o4 h( f" h" o5 Z) V' ]
  37. #include <mach/hardware.h>
    % Z) U/ D3 K- O8 x4 v) c
  38. #include <mach/irqs.h>0 c4 Q+ b- [% b7 f6 z
  39. #include <asm/hardware/edma.h>
    " J* i' ^, S( p% ]+ p9 @2 V6 y( s4 {

  40. . ?" ]$ c7 E" v. T2 i4 Q$ W, L
  41. #undef EDMA3_DEBUG
    + j  `- d! s7 b8 v7 L
  42. /*#define EDMA3_DEBUG*/9 [  b4 {6 o, @4 i1 q) X# e
  43. 9 q/ v% O* q6 Y& G
  44. #ifdef EDMA3_DEBUG
    # \) ~; F2 d3 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & a, Z4 L/ V2 x% L$ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). c5 m, z! i6 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" h  h* j# ?. \& i9 n" U
  48. #else
    6 ^) I& m) M5 z) ^3 q( X2 {& p
  49. #define DMA_PRINTK( x... )
    . a. i; H# ]! D; ^2 {
  50. #define DMA_FN_IN
    6 K: P) V7 b% |1 W! Y6 E
  51. #define DMA_FN_OUT/ V: U8 ]* u0 g
  52. #endif' o" a7 w& H5 g# y- I
  53. $ H% U% L" _7 N, _/ C: H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 U1 [* g( j3 \3 ~* g$ ?
  55. #define STATIC_SHIFT                3/ ]! {6 Z( j9 L6 Q6 C! M6 i4 t
  56. #define TCINTEN_SHIFT               20
    9 ?9 _2 d4 a% h
  57. #define ITCINTEN_SHIFT              21
    0 C% h, ]% B( k/ d0 _3 t! a: {
  58. #define TCCHEN_SHIFT                22
    ' e( D. E# b# H, F
  59. #define ITCCHEN_SHIFT               23% \3 ]2 T8 `& g$ h

  60. 1 [" ]; J- s9 c$ F( G0 h9 ?2 Y4 x
  61. static volatile int irqraised1 = 0;3 J2 c: c& n# b: c7 W. A0 u
  62. static volatile int irqraised2 = 0;: r4 V% U* A2 d5 I& D0 \& c

  63. 8 q. s  B6 j" }+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I5 h" c) [; C0 r; B& P: W! ^- }- M, T$ R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % b4 Q8 l' i- P. I5 J. x4 Q! E" }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V: e% J# m) i% G" X

  67. 9 _2 `1 t+ b+ w3 J, G! X
  68. dma_addr_t dmaphyssrc1 = 0;. j& g* W+ n9 z0 C; g
  69. dma_addr_t dmaphyssrc2 = 0;; q0 l! T& M5 |& Q4 H* o/ i% ?  ~
  70. dma_addr_t dmaphysdest1 = 0;! n: T( e" }' S/ Y0 F
  71. dma_addr_t dmaphysdest2 = 0;
    ) X+ O8 v* t9 g0 Y" X  y

  72. 7 v' b6 M: ]0 W  P4 y# S, t8 w
  73. char *dmabufsrc1 = NULL;" D% Z8 O3 I3 V! p0 ]# A
  74. char *dmabufsrc2 = NULL;
    % E# q9 n* }8 a
  75. char *dmabufdest1 = NULL;' X% |, b* z4 M4 i; Z
  76. char *dmabufdest2 = NULL;1 N! t  [- {) T

  77.   H3 u4 s# u0 w0 R% R2 r
  78. static int acnt = 512;( W: e& u1 r( z" l
  79. static int bcnt = 8;
    3 v/ j5 k9 `# n3 m3 i
  80. static int ccnt = 8;" r( m4 F9 F2 d( Q' i+ g8 h8 A
  81. % e# e" w& f' k3 z, |
  82. module_param(acnt, int, S_IRUGO);
    % E( I; O8 `$ _
  83. module_param(bcnt, int, S_IRUGO);- `: b: _$ E/ F! @' N" d- b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. t. y3 C9 Z# z: M1 z/ |! b4 z2 K' ?. v( v* \5 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* w- _% B* N( B, G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J  p- `) \; i6 W. B2 X. g) I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e( I7 H6 l4 x7 c3 T
7 p- ^6 g& W7 {. q9 Z6 i0 R8 X$ ^% s% `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 18:30 , Processed in 0.045462 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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