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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * H0 o3 ?( Q+ @( d+ \
  1. [code]EDMA sample test application
    3 U% J/ [. Q0 O1 j6 Y# @! @+ D$ a
  2. /*0 n" G5 {( t  Z+ G4 e) M8 {% Y
  3. * edma_test.c
    , N. Q4 F3 ]" x. v- [) J7 o3 w6 _
  4. *
    9 f5 u! z& ~! b3 `
  5. * brief  EDMA3 Test Application
    ; X  B6 F. m; u2 E/ ~6 x; |. R
  6. *
    4 ^' t3 g1 g$ F8 l0 D8 @
  7. *   This file contains EDMA3 Test code.
    $ n6 w# X* k8 P8 A/ O8 `0 S, }5 V
  8. *
    0 h  k8 o  k* q3 T$ d) I+ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) v" d  ~3 y$ ~4 ]1 X- M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 A0 I- C4 C: a' ]5 d
  11. *         TO CHANGE., @/ p4 H: M7 O& f; b0 i% r
  12. *% w9 w* z! A2 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 m5 V$ m1 @1 S/ g8 m3 o! y$ D
  14. *- V- _& H3 [$ d* ]4 H) B: x
  15. * This program is free software; you can redistribute it and/or5 j, R/ y9 F* ^- {7 g
  16. * modify it under the terms of the GNU General Public License as: y6 |1 Q& n$ \3 M% j# l/ B
  17. * published by the Free Software Foundation version 2.
    3 [! t' G4 u6 J$ V  H3 S
  18. *1 C& O# Q% o% I/ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! a7 i: }! X. b
  20. * kind, whether express or implied; without even the implied warranty
    ' m0 W/ f7 j$ {) t/ ]/ \$ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ H, u* ]' g1 t8 J8 K
  22. * GNU General Public License for more details.. d1 X- ~8 Y4 L' _8 L' U6 x/ E
  23. */
    : @( X3 @( f2 K: B7 D- R. W

  24. 3 f6 |$ R5 B! |/ @% p; D
  25. #include <linux/module.h>
    ) L4 Y9 b% I( q
  26. #include <linux/init.h>5 b! B0 x. S# f& p$ F! F; R/ V9 Q
  27. #include <linux/errno.h>1 g  j* Z; Z3 M' C6 ]
  28. #include <linux/types.h>& t1 |( Y- O& J- ~" v# C
  29. #include <linux/interrupt.h>
    9 f% Y4 @: x7 t& G" S
  30. #include <asm/io.h>" Q( Y1 {& b! V- \
  31. #include <linux/moduleparam.h>
    6 I8 k0 Q$ {' [3 D6 u
  32. #include <linux/sysctl.h>
    1 n6 @* f! e/ \8 z; `8 y
  33. #include <linux/mm.h>
    : T! a& Z0 {) ]
  34. #include <linux/dma-mapping.h>( r; J/ i, H+ O' {' M
  35. * b; y) R+ y: o5 o$ |- K7 w
  36. #include <mach/memory.h>
    7 H8 g0 a/ N2 X, @# R4 }
  37. #include <mach/hardware.h>: o9 C$ T9 {8 C9 r5 h3 o  s
  38. #include <mach/irqs.h>3 a4 Q& U; t% l/ ?, s- h/ U
  39. #include <asm/hardware/edma.h>9 p" ]( s( D( W" n: S9 ?( M8 J

  40. 8 t, n  g8 x  l# `4 V- E
  41. #undef EDMA3_DEBUG
    % e- v8 h2 V) @6 d, I4 D
  42. /*#define EDMA3_DEBUG*/
    % `- C3 f3 i" E' w

  43. ! w0 B3 O* W; m; S: U1 i
  44. #ifdef EDMA3_DEBUG6 `. _3 [# _& D5 ]2 e0 k+ X! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): V3 ]4 n' X6 h5 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 E$ |4 ~7 c" S+ _: h( d, u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o( D3 T/ \7 R/ s5 s
  48. #else
    - ?3 ?/ m, T7 o: m2 d- }8 O) S
  49. #define DMA_PRINTK( x... )
    ! l  e  K/ Z' y3 S3 ^0 }6 D# K6 U8 B
  50. #define DMA_FN_IN
    / y# v8 b" W1 W
  51. #define DMA_FN_OUT
    ' k7 W8 j# B, f/ W
  52. #endif7 X/ P1 O# @% ?' j- b

  53. % X2 x6 u# j+ {" H3 l1 m$ Y! M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + Z. p  P$ }* M, w
  55. #define STATIC_SHIFT                3: W. O0 P& E3 I" r7 ~  {
  56. #define TCINTEN_SHIFT               20
    7 z  S$ U* `7 {; V. E8 ?
  57. #define ITCINTEN_SHIFT              21+ f, l5 P' q6 _! L0 V% O
  58. #define TCCHEN_SHIFT                22
    ' t& _6 ^- u) D7 ]' o* J0 {
  59. #define ITCCHEN_SHIFT               23
    4 C6 ?. U& y' _2 l6 p5 y7 ~
  60. ! x/ h+ b# m# a8 I# S4 X$ Z
  61. static volatile int irqraised1 = 0;; }7 O+ x2 X" A( s
  62. static volatile int irqraised2 = 0;
    7 i& c1 B' l9 Q7 k1 b

  63. 0 v9 v4 L$ b/ G- Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E3 F; o. A; r( T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^' Q& c7 P: R) e+ h, n" l( o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y5 R9 Y4 H" r( w, L  H4 s- J

  67. 8 o( T- }5 T) L- x4 Z. z, r
  68. dma_addr_t dmaphyssrc1 = 0;, G- |% ?( V- D( K  y
  69. dma_addr_t dmaphyssrc2 = 0;
    ; n4 v* ^1 l2 E2 f9 N! K
  70. dma_addr_t dmaphysdest1 = 0;( Y9 V) y7 p8 `# o  ~7 A
  71. dma_addr_t dmaphysdest2 = 0;/ U7 Z+ ~8 n  H6 J* n* o

  72. , X1 K' c4 J/ i% f
  73. char *dmabufsrc1 = NULL;& b% L+ [, C% [& d6 {
  74. char *dmabufsrc2 = NULL;
    & Q' Q: U/ z! n9 K0 `1 J" ?, k
  75. char *dmabufdest1 = NULL;
    $ U- W, A0 ?: k6 C
  76. char *dmabufdest2 = NULL;: ], c4 O2 e' R2 S4 Y

  77. 5 O- k6 W0 j" j+ x
  78. static int acnt = 512;7 A6 L+ F5 ]4 T5 D% o  U  G
  79. static int bcnt = 8;  q# P$ S  L1 K, O
  80. static int ccnt = 8;
    % c( c5 Z; B# ]* m; m
  81. 2 v+ B$ ~! c: I! J3 `: W
  82. module_param(acnt, int, S_IRUGO);
    % B  x6 K) ]+ K
  83. module_param(bcnt, int, S_IRUGO);
    : L' a7 P' s6 `. |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& U" v! w/ g' Z* R
5 A+ W1 T: \2 o! l  d& }/ K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Y" b; D& W& Y* Y# o: earm-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 X; E8 ^( B) r( C; S4 H6 z+ ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ y: m8 K' q2 H, X+ a- k" x
4 {9 {- ]' r5 }* M* R1 J; F( p

) }6 ~4 q: q( Q" I0 d4 q) t2 h4 Q6 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 03:59 , Processed in 0.039717 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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