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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 t3 L0 \) e- Y0 ?" [7 T% s
  1. [code]EDMA sample test application: A( w1 A2 T& c' I, o
  2. /*
    7 |  P  C# C* P3 ^( F) s* k/ ~! \, J
  3. * edma_test.c
    5 K' r& N( R1 w( ~# _6 N* c1 s
  4. *
    ! |8 ~3 S0 N1 n9 U8 P: w! g
  5. * brief  EDMA3 Test Application0 W, D# I4 N9 Q! T8 y
  6. *
    $ ~9 Z9 W) _, v2 J/ O
  7. *   This file contains EDMA3 Test code.
    + b7 w+ q# o) E
  8. *
    6 o$ |8 s) ^8 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' R& b6 _: [: P6 o" `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k0 Q& D/ Y/ D9 A. P0 t6 D* A
  11. *         TO CHANGE.
    1 C2 `- o1 n# g" p8 a: w
  12. *
    7 w* {2 g3 [2 q" f  j( f' {# F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" V& G8 g& M1 ]  @& p6 j
  14. *
    0 e. r8 Q0 K1 u' w/ z3 e
  15. * This program is free software; you can redistribute it and/or
    % }+ J0 w8 R6 m( y3 m
  16. * modify it under the terms of the GNU General Public License as
    7 |4 |1 h! {2 b7 l( G6 A2 A
  17. * published by the Free Software Foundation version 2.0 E9 P: h9 k- V& F( Y
  18. *
    ' O! Y: v% L" n+ c" Z8 M9 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 z/ I; p/ g7 C' |
  20. * kind, whether express or implied; without even the implied warranty
    ! U0 d, w2 M  B: V$ {1 a0 I: r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. H' x" E6 `% d8 E
  22. * GNU General Public License for more details.
    9 u9 M: e. t' Z' G* K; K
  23. */% T: k2 K; j/ b3 A( y

  24. # a  X8 b% F. V; c5 k9 G
  25. #include <linux/module.h>- U) e$ Q' d( g5 ~) p
  26. #include <linux/init.h>
    - D1 E% R" k% N% ]  i1 w
  27. #include <linux/errno.h>
      d8 x# V" E, F/ t/ K5 m
  28. #include <linux/types.h>5 G+ q- M8 x3 d6 L4 o# _! `6 M6 |
  29. #include <linux/interrupt.h>0 j, k5 B# R" c8 S' t
  30. #include <asm/io.h>; s& Y# s+ M  P' F  i& R7 x2 j
  31. #include <linux/moduleparam.h>
    % M5 t$ M: O6 \/ c4 a
  32. #include <linux/sysctl.h>
    1 b' }1 i- b9 N% {9 ?7 G
  33. #include <linux/mm.h>2 ?* w* h7 X, n
  34. #include <linux/dma-mapping.h>! N2 B5 w) `4 g% \! p& `
  35. / J% o$ Q* Z7 p0 Z' c( B2 m' U  w
  36. #include <mach/memory.h>5 \: Q+ B3 z, j7 @; Y
  37. #include <mach/hardware.h>
    + a2 y" D* Q! u+ s. h3 [$ \
  38. #include <mach/irqs.h>8 a6 R+ A' e( d
  39. #include <asm/hardware/edma.h>
    ; S0 X4 ?/ `+ R6 o' N+ n

  40. ) `7 s& W* A+ k. V) Y4 b) E8 W, S! y# C
  41. #undef EDMA3_DEBUG2 t# h% v$ r; x/ f2 l7 C* l$ n
  42. /*#define EDMA3_DEBUG*/2 E; a5 p8 ~, ~$ u3 w

  43. & z" {, F3 @4 d5 @4 c3 x1 O
  44. #ifdef EDMA3_DEBUG+ r1 p" w5 d* ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; w- F' K9 P2 m( L8 Y8 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K& w4 \+ Z* ?1 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / _; b8 C: G3 {& L
  48. #else
    ; `' `0 E, d" _' ~
  49. #define DMA_PRINTK( x... )
    , j) G/ O0 J/ w4 ?0 }9 z
  50. #define DMA_FN_IN0 c7 {4 X+ m. a* Q& h& I
  51. #define DMA_FN_OUT& V& Y$ U3 L% ?
  52. #endif
    6 N8 J! u( e1 h8 w9 }

  53. : K2 [" s% j) b* `5 G3 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- i4 F0 Q! \- ^' A( B: y2 g' v+ e9 O
  55. #define STATIC_SHIFT                3" R; w- v+ ], a5 d
  56. #define TCINTEN_SHIFT               203 \) y) s8 f/ {" Z7 m
  57. #define ITCINTEN_SHIFT              21
    7 t6 f2 L9 _0 [5 G; x! C" l/ G; ?
  58. #define TCCHEN_SHIFT                22  P% q# p6 u7 G+ _
  59. #define ITCCHEN_SHIFT               23* w+ [$ @) C5 Y0 d& @4 ^
  60. 1 `# s1 }' h) B  W  V
  61. static volatile int irqraised1 = 0;5 J/ q6 Y2 u6 I! A) M# {6 U
  62. static volatile int irqraised2 = 0;
    " ^' Q# d- N) R! e. T9 {

  63. + }; u( |  n4 L% z+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * b9 o1 J8 Z% b2 A4 G, G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ^0 }; b. B0 L6 y) k( w' O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / O, g, B) x" C' K7 ]& {

  67. 6 V: K0 U/ q, O/ M2 J
  68. dma_addr_t dmaphyssrc1 = 0;" `4 F9 {5 {& I- W
  69. dma_addr_t dmaphyssrc2 = 0;  t/ @$ F8 e! y
  70. dma_addr_t dmaphysdest1 = 0;
    8 J0 }6 R" J6 V( r: X# X# ~
  71. dma_addr_t dmaphysdest2 = 0;
    4 x! D/ r( I! m* g5 A; R

  72. 4 t  Q( B+ G1 _/ x' `
  73. char *dmabufsrc1 = NULL;
    7 r7 p/ ~+ k: G
  74. char *dmabufsrc2 = NULL;
    + H% |3 E7 J3 T/ G# o
  75. char *dmabufdest1 = NULL;, k/ B8 Z  ^2 u1 h
  76. char *dmabufdest2 = NULL;, ?8 ?  Z: Q1 F/ T- I. M

  77. 6 N' U, X, r* Z! [7 S
  78. static int acnt = 512;5 k# e+ w+ [7 \- C+ z# v2 N  ^1 Q
  79. static int bcnt = 8;
    0 p9 [9 x) v1 ~9 [1 c" J' C1 [
  80. static int ccnt = 8;
    $ t* y! }! U3 z- H, C/ q
  81. 2 ^! _: [5 j: Y( [
  82. module_param(acnt, int, S_IRUGO);
    1 I" k8 P$ U+ J! ]& I. f
  83. module_param(bcnt, int, S_IRUGO);" P* _9 T# l+ X! ~$ ~, \3 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& B- D5 W' _3 C* V6 J& k* n) O% L& X+ W# W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' o7 G4 L5 ^1 j! W- f5 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  J( \0 D4 H$ S. b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Z5 g4 |" l/ v& O  g9 T1 J) N
, U! p! S3 n: Y- u# r( [, ~( t2 |# s8 ^1 d' }( q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 06:40 , Processed in 0.046441 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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