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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ^: d* L+ y; T& J1 f
  1. [code]EDMA sample test application
    # E  ?6 z# U% V
  2. /*
    6 R7 z+ T: q% \
  3. * edma_test.c
    ( G' B. z4 f! c: Q
  4. *. Y) W4 y) o# Q" y" N
  5. * brief  EDMA3 Test Application$ ]  S0 c& {! x2 n& x/ [1 G- C; v
  6. *
    3 q# h& x) T7 P, X5 Y3 g8 E% w7 D( Z
  7. *   This file contains EDMA3 Test code.
    0 U. V) ]* L% l1 s+ _, ]
  8. *" g+ A6 [2 Y6 s: D3 T) v# U: A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      e. K, l/ }7 S! p* U5 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * z# e1 i6 F5 M, D0 W
  11. *         TO CHANGE.: s* t0 a) [: z0 J7 q
  12. *
    7 y. O# K7 n% q6 \, u4 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  [2 }3 b& b# V/ H" i& F" P: w
  14. *
    ! T6 a# R; f6 d
  15. * This program is free software; you can redistribute it and/or2 `3 d) L' T& L
  16. * modify it under the terms of the GNU General Public License as/ D) \# V6 N) m. \6 s9 d2 K" Y5 r
  17. * published by the Free Software Foundation version 2.
    3 a/ J7 [# |# m# s0 s) j
  18. *
    * p4 g! `8 u8 {0 L$ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ H6 n; [6 d2 _1 ~; r+ ]
  20. * kind, whether express or implied; without even the implied warranty# E# x" X4 u* j: {" N4 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . {/ D: K7 }  t8 z
  22. * GNU General Public License for more details.
    * m2 t+ ^$ w) O5 E2 P9 y
  23. */+ p9 F! b/ p9 m/ N  Z2 B) H

  24. . {  [" i7 p: d
  25. #include <linux/module.h>$ w0 g9 K: f( Z# t7 T+ h
  26. #include <linux/init.h>! W+ u2 n* e' ^5 x# L
  27. #include <linux/errno.h>
    5 L$ l% |- g' H  l
  28. #include <linux/types.h>- S3 Q( W/ p' u6 E' L
  29. #include <linux/interrupt.h>! v% B. T! H; p# k
  30. #include <asm/io.h>/ S* n8 R' _; b
  31. #include <linux/moduleparam.h># f0 h2 q0 n# u' |9 h3 ?# B% V( i
  32. #include <linux/sysctl.h>4 C. S) |% `: E; ~
  33. #include <linux/mm.h>* g& N' M. l2 @2 }
  34. #include <linux/dma-mapping.h>3 I9 o, B2 Y/ j) \" Z% G2 h+ y
  35. ; R; ]% {1 N# j+ \
  36. #include <mach/memory.h>6 n  M* z4 ?& ^/ L- h1 M) ]
  37. #include <mach/hardware.h>7 j4 u1 c0 X: f& N# H. q; L
  38. #include <mach/irqs.h>+ ~" h6 ]3 S) R: d  O
  39. #include <asm/hardware/edma.h>2 z& m8 t* [2 @) A0 s. |
  40. ; x+ p+ t6 N, q4 U" g5 t. C
  41. #undef EDMA3_DEBUG! i2 y0 v" S$ c" m/ C
  42. /*#define EDMA3_DEBUG*/
      j. ]& [1 }( |1 o4 A3 P
  43. : X) ^8 g  b# B2 a3 e  g
  44. #ifdef EDMA3_DEBUG: r( u! f- l0 [: N% y9 \* o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 X* |8 E3 e, c% E1 Z& A  B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & }  W4 W# i6 k2 O6 t% ?4 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; H* ]3 A! {' Z% l: h" O
  48. #else
    6 d9 F+ l8 o# ?$ g4 M
  49. #define DMA_PRINTK( x... )
    3 Q8 C. H; @2 J6 f; g# o: ]
  50. #define DMA_FN_IN+ g0 c  O& P; A2 V2 ~
  51. #define DMA_FN_OUT) h( w: C5 w6 p. \+ F2 [5 N
  52. #endif  }9 `- |, ^  K5 _9 i& A
  53. . [3 N6 H% M% c) x) p) k- {, e% P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' ]- _9 y' Z, d
  55. #define STATIC_SHIFT                3  n% A3 _& {- \1 Z
  56. #define TCINTEN_SHIFT               209 }& Q3 D# \4 D- E, T
  57. #define ITCINTEN_SHIFT              214 W7 J& Z" Z. K4 n% R7 k$ R
  58. #define TCCHEN_SHIFT                22
    % `( @+ s+ p$ j: l  f2 {
  59. #define ITCCHEN_SHIFT               23
    / C" C; A5 G  t* G( M
  60. + a' i0 F8 B9 f. [& ~
  61. static volatile int irqraised1 = 0;
    / ]2 Q9 y' b  {4 r6 s
  62. static volatile int irqraised2 = 0;. L& |1 R# \3 H( }% Y1 _' C

  63. 1 V$ @% y/ ?+ k/ u$ h3 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 X! I$ a9 x6 V1 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T: G( O5 E' U/ I. d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y. T7 P6 U% v

  67. 9 V1 o6 J1 O. ?. E5 Q% E5 d
  68. dma_addr_t dmaphyssrc1 = 0;
    1 M! o4 f' s" G& G3 P& g+ E) B
  69. dma_addr_t dmaphyssrc2 = 0;( G2 u# O3 f% I  H! A4 U
  70. dma_addr_t dmaphysdest1 = 0;, L! c6 V: J! v3 p* o" k
  71. dma_addr_t dmaphysdest2 = 0;: J  U$ `" x# V. A& D% |% u
  72. : E6 V1 _2 v0 c7 V1 g. }
  73. char *dmabufsrc1 = NULL;; G  d% j( o9 _( l2 _/ @
  74. char *dmabufsrc2 = NULL;+ U; }3 q1 P. y0 s6 K9 @. T
  75. char *dmabufdest1 = NULL;
    ! R* u( ?1 h9 _9 Q( ~0 M9 h1 J
  76. char *dmabufdest2 = NULL;$ k6 x1 ]# \2 X: R

  77. ( _1 B$ }; G5 X) }
  78. static int acnt = 512;% F$ `7 ]- f4 p  z, b1 w* G4 t' a' U
  79. static int bcnt = 8;* b. S! I. p4 _: u7 {9 v4 U
  80. static int ccnt = 8;
    : B: ?% M& p9 d6 k
  81. / V5 K; T3 d9 E( C% ~. n+ ]5 h
  82. module_param(acnt, int, S_IRUGO);
    , v9 ^2 z" A& b5 V4 Z; _" Q
  83. module_param(bcnt, int, S_IRUGO);  ~& @% a+ U+ n/ H% X" d+ L. C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ^+ w9 z& @: q% f! [% [% F4 K: t8 S& f  g; v$ Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \3 t" j! i) c8 }0 d% \" X( i1 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?& g! q" K: c5 ?" r8 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 k( e& m% f: s/ f% r* a2 i& H+ K6 h( `9 w. ?
# E1 B0 ^6 y1 x  ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 09:13 , Processed in 0.039682 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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