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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 [9 y9 h/ c9 S* t/ v7 T& h' i
  1. [code]EDMA sample test application
    8 c! [- \  r- H! X  g; [' B( j
  2. /*
    / h/ J  F% C! T1 |6 _6 }5 C
  3. * edma_test.c% _% F* Y( k' b5 {
  4. *6 D# f- ], F* o! b
  5. * brief  EDMA3 Test Application
    & Z; p* p: u4 g9 ^
  6. ** a% `8 ^( h2 c* ?2 P
  7. *   This file contains EDMA3 Test code.
    0 y: T2 d) |6 J$ J1 R/ I1 o( ?" s
  8. *7 G& N: o/ H' q1 a' n# E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 P; z6 _1 p: J0 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" X" D# F9 |" _$ z
  11. *         TO CHANGE., z. N' K6 d3 m* I( ~
  12. *! f8 ~/ `  H  p" r# x% k4 ]9 E( A* o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% v' G  g% X/ C$ a  b
  14. *0 O* n' Y$ S+ i. r7 X  `, u& n
  15. * This program is free software; you can redistribute it and/or+ J4 N9 G0 R, Z
  16. * modify it under the terms of the GNU General Public License as) [# }# ?5 v3 R8 A# l& q
  17. * published by the Free Software Foundation version 2./ A. T; N5 u6 @0 L& v4 p, s
  18. *5 A2 N3 e4 S. X1 x/ M( v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E6 e+ e) v9 W/ y* S
  20. * kind, whether express or implied; without even the implied warranty: X: Y; M/ N8 c4 S0 A# t8 P5 l* m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* x& Q; z/ I- T5 x) g7 o
  22. * GNU General Public License for more details.4 h) W' {8 k+ o" \. ^
  23. */
    * @* q0 G4 v2 }# w$ j* ?6 C
  24. 4 e" U6 I9 [7 f; B
  25. #include <linux/module.h>
    * ^8 o; K. D) }* ^  T
  26. #include <linux/init.h>7 e5 B/ i/ c$ w7 e9 F# v: c
  27. #include <linux/errno.h>1 S2 [4 ^/ c. W, V
  28. #include <linux/types.h>
    5 H8 v# [% x; K, j
  29. #include <linux/interrupt.h>
    ! c$ s. U7 F- O5 j' R8 f: ]5 a' J
  30. #include <asm/io.h>
    - A" H- y1 r' P: ?6 z! B# \2 v
  31. #include <linux/moduleparam.h>4 r& H5 S9 |  p* g
  32. #include <linux/sysctl.h>1 b5 Y* P0 h' e" M/ J
  33. #include <linux/mm.h>5 {' X! @8 L5 C8 ?+ S( E' u. H. i
  34. #include <linux/dma-mapping.h>9 L& e9 H% Y1 L5 y. l; S

  35. ! S, A( v! }7 f# s3 L
  36. #include <mach/memory.h>
    8 m- m9 E/ {& n
  37. #include <mach/hardware.h>& ?- Y5 Y, U: j* o
  38. #include <mach/irqs.h>
    ; Z% f. W. ~5 P' Z1 W$ D' m
  39. #include <asm/hardware/edma.h>4 }2 T- J, c7 T3 m: ^* c

  40.   n) M* P" g( x5 \7 L/ A: S9 h
  41. #undef EDMA3_DEBUG  V/ I6 g( v8 ]  F
  42. /*#define EDMA3_DEBUG*/
      q2 h  Y/ w7 U/ U* j+ N7 O, M

  43. 9 G% J3 o( a$ D, }  B+ K) A
  44. #ifdef EDMA3_DEBUG
    , E8 b6 m! Y; z( C& |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 w' u6 a, W2 F- Y" l8 O9 w3 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 D" y8 M1 |4 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : u% }- ]/ }. d7 ~4 t7 Y
  48. #else
    8 Z: c3 j" i& \2 y9 i1 H6 `2 _" y$ E
  49. #define DMA_PRINTK( x... )
    , o7 k3 v; a( k2 O: m
  50. #define DMA_FN_IN. m% K: t6 u% M8 C; }  R- M
  51. #define DMA_FN_OUT
    $ v8 V3 f8 N+ k: W3 |6 H! E
  52. #endif
    $ D1 m5 K1 @- j
  53. ' K1 M- [( x0 j: l8 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ^3 R! |6 I; V
  55. #define STATIC_SHIFT                3
    3 _! J/ K- E# G3 a: H
  56. #define TCINTEN_SHIFT               207 Q) [2 y+ ~6 w& ]/ N6 [) f
  57. #define ITCINTEN_SHIFT              21! ~, X+ M/ Y8 T/ `9 E3 z. o
  58. #define TCCHEN_SHIFT                22/ H( C6 r$ ^; \. l7 ^/ w
  59. #define ITCCHEN_SHIFT               23) }$ o4 ]9 Y9 G7 b9 g: S8 ]7 }

  60. * o! q1 i1 g. J* S
  61. static volatile int irqraised1 = 0;
    . l( k& F  r& A- Z4 y! ^
  62. static volatile int irqraised2 = 0;
      A+ v$ O, L6 V# @# u

  63. ; f  w7 @8 O# G6 g5 C# L# G8 D" B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q9 N8 o: X1 m1 t5 q# b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C$ X# b! \( z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `' f# ^" L- I! C0 d

  67. # I" _$ k' B$ T' W/ N% i1 J2 }
  68. dma_addr_t dmaphyssrc1 = 0;
    ! y- q  I8 E% Z! o: ^7 H% {
  69. dma_addr_t dmaphyssrc2 = 0;
    0 i- E/ @/ l7 O9 j" \" B; V
  70. dma_addr_t dmaphysdest1 = 0;: s( M; ?- H% c# T. }& U
  71. dma_addr_t dmaphysdest2 = 0;
      D) F9 L" f3 f9 H3 S

  72. & R. b9 U5 u+ Q$ i' s! m
  73. char *dmabufsrc1 = NULL;# K+ X0 I) v" H' D* ^
  74. char *dmabufsrc2 = NULL;
    ' D/ u- e0 M/ J" k; s! \
  75. char *dmabufdest1 = NULL;7 Y" d  f" W$ ]- p* }" x, J* A8 n
  76. char *dmabufdest2 = NULL;
      F$ \; d7 r/ I
  77. , m4 p% m8 K# ^, s" p
  78. static int acnt = 512;5 h! E$ b0 n% s- ]& F7 ?  G2 ^5 B& E
  79. static int bcnt = 8;
    ! B" n. c# O8 H5 J7 A7 N
  80. static int ccnt = 8;* _' O3 _  L9 J- b+ u5 Z5 t
  81. . i$ G( \' Q( m7 e7 ]
  82. module_param(acnt, int, S_IRUGO);& R# z" ]" @. k8 x0 O9 Q
  83. module_param(bcnt, int, S_IRUGO);
    % Y6 M" H0 n$ z1 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 t* [2 H; v7 q0 `  W0 {2 u
3 ?2 P- q) u  d4 ~( {! ?! Y3 i( \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C3 B) x( I: a4 Jarm-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 u4 a& u1 Y, O' o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. a3 k8 m3 v) u. ]" S& u9 N- n5 T) c9 `  s. J4 r$ G/ M+ t

+ ?! U2 S/ y4 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 22:01 , Processed in 0.040715 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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