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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + }( u; D$ Z) L8 J
  1. [code]EDMA sample test application
    8 J/ _7 d$ K) r$ s
  2. /*7 k; b. C- ~& p6 E% X  A- J
  3. * edma_test.c$ Q9 k& D& Q" Y6 E- ?3 P
  4. *) ?9 T1 I5 [" s! a! [7 s( g1 [
  5. * brief  EDMA3 Test Application/ Q7 w! d5 _. m) E
  6. *' q2 f3 g2 Z/ `  T
  7. *   This file contains EDMA3 Test code.
    9 V3 G# ~4 o# ?1 l7 P
  8. *
    , ?6 _  G" b) K4 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 z+ v9 m" x& k" Q' P- o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 I* P+ U" K6 ~, H5 s  M
  11. *         TO CHANGE.
    " [: N" D3 `0 H; U1 Z
  12. *
    9 F) q7 S7 {$ u$ }+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      \9 ]8 h5 b# r  e4 S0 w
  14. ** ?* q: P/ d' j1 T
  15. * This program is free software; you can redistribute it and/or1 N1 D" R( f. ?( v% E% }6 H
  16. * modify it under the terms of the GNU General Public License as' p6 Y# B. B0 F" a* C- G  q. h
  17. * published by the Free Software Foundation version 2.
    - R7 @8 _$ e0 e0 {
  18. *, \5 E3 F/ l& a6 c: D) P) l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o1 o' u$ D5 W
  20. * kind, whether express or implied; without even the implied warranty$ B, V$ {% \; W3 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) K* b( j: o! n' y. F% n9 j
  22. * GNU General Public License for more details.
    * R" I4 |( {- Z7 ^
  23. */
    5 c# Q" q% d7 |/ o$ D
  24. 5 v2 [8 S. [) h$ m
  25. #include <linux/module.h>
    + e# g2 i& X  I; y: X
  26. #include <linux/init.h>4 v2 H# N# n$ ]
  27. #include <linux/errno.h>* y7 F6 r) h! j% t& m
  28. #include <linux/types.h>
    6 [  r6 i; P+ V
  29. #include <linux/interrupt.h># l  t& N6 c' w
  30. #include <asm/io.h>
    1 |: ^3 _* i3 H! x
  31. #include <linux/moduleparam.h>4 ?- [" g  `& I
  32. #include <linux/sysctl.h>& k7 c4 N& e0 a; u
  33. #include <linux/mm.h>
    3 ~7 s- n. Q. q8 }
  34. #include <linux/dma-mapping.h>6 L9 ]6 x' A: s& t

  35. 4 m# X! W  j5 f0 H
  36. #include <mach/memory.h>
    * k/ U2 X* O/ a- V
  37. #include <mach/hardware.h>! y% ^/ `; Q; z+ A" J! j3 U5 q
  38. #include <mach/irqs.h>
    , w  L; ^" u) K- q" V6 A$ |: N' G# v* ~
  39. #include <asm/hardware/edma.h>
    0 a7 s6 L4 {. h4 U+ n; ^: q

  40. 8 L! C! }0 I$ S- r6 |  \
  41. #undef EDMA3_DEBUG
    " L+ B: V7 w$ `0 `- ]# G+ e4 h9 o; W
  42. /*#define EDMA3_DEBUG*/# [7 d' ~- z  ]

  43. 8 l5 ]& ?# L  L( P
  44. #ifdef EDMA3_DEBUG
    : y1 r9 ^7 ^: L; U4 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 F" m& ?+ p* W4 D) N0 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 B7 q  y! F0 C4 |$ V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). b9 c% J( R; ]! K
  48. #else8 b- k) Z! s* g% g
  49. #define DMA_PRINTK( x... )1 b" Q7 `+ g% p; u' {  L
  50. #define DMA_FN_IN
    % \7 r$ l- X- B, R1 l* K
  51. #define DMA_FN_OUT
      k2 }- Y; h- S- [+ n/ I; H- I
  52. #endif
    , @5 E0 V0 l" S
  53. 8 i' q' y6 F* w4 `# t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 [' Q6 }( e0 X: G9 P
  55. #define STATIC_SHIFT                3' m! ~$ n* K, U, @. W7 x
  56. #define TCINTEN_SHIFT               20& k* C4 Z4 S$ E5 K/ ?" K. r
  57. #define ITCINTEN_SHIFT              21
    ) v9 U0 A/ B7 ?% P7 ]0 a
  58. #define TCCHEN_SHIFT                22
    4 @; I4 S) w+ _7 T6 c% i
  59. #define ITCCHEN_SHIFT               23' U( C* H6 n3 x/ L
  60. 6 d. e5 y4 e) ?
  61. static volatile int irqraised1 = 0;
    , A$ Y: Q% x9 c
  62. static volatile int irqraised2 = 0;
    * K' q# d/ P5 ^6 s

  63. , A, l% _# B- e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?. j2 I. p. O8 L0 b% u, s4 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; d% m& e5 q; D! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + q- u( K' E" `* H- C" u" C6 [/ N
  67. 6 D  P% H  C4 V
  68. dma_addr_t dmaphyssrc1 = 0;+ L8 j' W( D& K3 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    $ \0 Z7 B' [" w: o8 Z
  70. dma_addr_t dmaphysdest1 = 0;
    # l- l# d0 L$ U
  71. dma_addr_t dmaphysdest2 = 0;; n6 a9 \2 }* u, H+ Z# z
  72. : V, I! z; ^; y' I2 h& W
  73. char *dmabufsrc1 = NULL;
    ' \8 L3 J; b" W( o
  74. char *dmabufsrc2 = NULL;
    + W5 J4 b! A$ w% m  k# s* l
  75. char *dmabufdest1 = NULL;( \) b5 W* r5 v5 y
  76. char *dmabufdest2 = NULL;: F$ S9 v- s4 t$ S

  77. + e% l8 m' [5 J# T$ @" \! o
  78. static int acnt = 512;
    1 \5 Y/ q" l* I# L6 ~& ^! E1 O
  79. static int bcnt = 8;. `' H9 A; O6 ~6 ^% n
  80. static int ccnt = 8;
    ( y- v# A- j- m: S$ _
  81. 6 \9 |  }; a, K  g) j
  82. module_param(acnt, int, S_IRUGO);
      O* r/ w9 i9 f# k
  83. module_param(bcnt, int, S_IRUGO);
    7 e$ w6 d3 D7 c1 H/ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ H" S0 u. }4 {. G

/ G1 F5 Y, l* Q; m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k" ~+ |- W* I- darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# J8 ]  L& @# g& r) |) ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" q/ T  n: F- k5 t" e
4 `0 c3 Z  F8 G& V* u' H& b# g
, U. V( U! R- j) M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 21:36 , Processed in 0.039054 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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