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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E4 ~& O- F! p4 v" ~7 D
  1. [code]EDMA sample test application
    . i2 }( b' F% a* m
  2. /*
    : s% t) L7 ]# _4 P# J6 F3 J& e
  3. * edma_test.c5 s  y3 w  R* {5 J9 O  t, q" x, J
  4. *
    3 l! _# ~  E: Z9 K% T6 b& a6 O$ {
  5. * brief  EDMA3 Test Application3 A! X. p/ {  P+ M$ w: ^( _/ o
  6. *
    & f8 Y' |- H5 q  f% W, W
  7. *   This file contains EDMA3 Test code.0 t0 H9 B4 r/ |! o0 ?
  8. *. t) g" r* D, i. v3 }" K0 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - H7 y4 b0 q5 ~' H' B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" C4 Z: O) m) ^" x$ ]
  11. *         TO CHANGE.) s. N/ g, n4 o6 f
  12. *
    8 x  g9 K1 s9 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & J5 [* I* w# @( X; i7 e, }1 [
  14. *, c3 S4 Q& c0 d# |2 C/ O$ k
  15. * This program is free software; you can redistribute it and/or
    9 D; \  M# _: U. J, n% l
  16. * modify it under the terms of the GNU General Public License as
    4 t* H8 T8 R/ y5 B
  17. * published by the Free Software Foundation version 2.3 i4 r( v$ z. [4 ^, w; e
  18. *. w+ g  p+ _  p3 d: Y) ?, ~. d: I( e* c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 N1 r& V$ R. P7 w
  20. * kind, whether express or implied; without even the implied warranty0 X: r( s6 Z7 q- E! Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* x6 Z5 ^: F/ t0 I; x6 _
  22. * GNU General Public License for more details.3 x0 T# F1 x6 w' A' Z
  23. */8 Y9 t% k2 I+ w: |

  24. ! x% X' {7 s9 f+ }8 j" r6 G3 K
  25. #include <linux/module.h>+ n6 `5 a3 N; }/ {
  26. #include <linux/init.h>0 _/ T  }1 O2 m* k1 o; |
  27. #include <linux/errno.h>* e+ S# h+ L* m9 F1 F9 p
  28. #include <linux/types.h>
    . F+ t% g# o$ G. {; i. B
  29. #include <linux/interrupt.h>
    1 j3 n3 o4 P4 O
  30. #include <asm/io.h>
    $ j( k& t! O3 f; ^! v
  31. #include <linux/moduleparam.h>
    ) }: n3 a* i* B: x% X; B* W  w- ^' H
  32. #include <linux/sysctl.h>
    - G5 u; }1 w- T/ Y) `
  33. #include <linux/mm.h>
    , O* K+ }# ~& p0 A4 R8 F
  34. #include <linux/dma-mapping.h>
    - p3 B- s% C8 |0 ~6 H8 w

  35. ( ?/ ?! K7 [' q
  36. #include <mach/memory.h>0 }" M  x4 K! F3 Q6 ]- J7 M3 C
  37. #include <mach/hardware.h>, ~2 E( K4 l, x. q& G% p7 G' S
  38. #include <mach/irqs.h>
    0 C3 G$ B. Z7 y+ _+ U* n* @; C% s
  39. #include <asm/hardware/edma.h>9 J5 O1 S1 X" U3 ]
  40. ; I3 k6 @5 K3 G( \( O4 @  J
  41. #undef EDMA3_DEBUG" I& M3 x/ e  `" [# ^: b
  42. /*#define EDMA3_DEBUG*/& Y, A( b0 Z5 A$ X! Q! q1 U

  43. % m0 e$ S, e( c! M7 q' p  ~
  44. #ifdef EDMA3_DEBUG9 W: D5 B4 ^0 T5 w& E/ K* M0 p0 r; c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ^. L& N0 }' Y5 o" p. ]  c3 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & k* r" z/ S. m8 `, J  g' k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 o" n3 s8 Z) b7 ?" T& ^
  48. #else( m" p0 B$ Z% A/ _" g% C
  49. #define DMA_PRINTK( x... )' i9 z( d$ f# s, }
  50. #define DMA_FN_IN
    4 y# n' {3 v: a" k2 R5 z6 W
  51. #define DMA_FN_OUT
    0 V. D' ]  O4 f( ?7 c
  52. #endif9 ~' R9 ^) c; D0 D
  53. ! U! k" Q" R  q  Q8 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  Q3 T5 H6 ]0 U/ w  q  C
  55. #define STATIC_SHIFT                39 e: C' S6 S1 G6 a: P
  56. #define TCINTEN_SHIFT               20
    ) N7 Z; Y' Q5 |" [, H1 C
  57. #define ITCINTEN_SHIFT              21* |6 I* x1 |: B/ e; R( F0 X
  58. #define TCCHEN_SHIFT                22+ N0 z0 h8 h" V7 p, Y6 W. n
  59. #define ITCCHEN_SHIFT               23+ Z) K1 b0 J6 f# Z7 W4 N% j
  60. 8 g* p0 t* U7 o4 ~% B8 j
  61. static volatile int irqraised1 = 0;8 d2 G3 F8 H: }
  62. static volatile int irqraised2 = 0;
    " F: E+ f4 G* q! W9 r& K- W

  63. # i9 Z- ?* {; M9 R$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) s2 y7 b% o! S2 C  m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i2 @! a7 F6 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % e' V* e( w2 t' S. j5 {- s0 j

  67. 1 d: G- M: T+ V7 V5 v) |: V
  68. dma_addr_t dmaphyssrc1 = 0;! @4 J2 _9 i$ a: V) \0 _
  69. dma_addr_t dmaphyssrc2 = 0;! u, P0 b, V7 }  V& \
  70. dma_addr_t dmaphysdest1 = 0;/ h+ ^% @" ?& y& h5 U* A
  71. dma_addr_t dmaphysdest2 = 0;% Z  T# P  T% P0 s. S9 D; `7 i9 X: i8 _

  72. ) B' F5 M+ p3 ?9 W- W. s
  73. char *dmabufsrc1 = NULL;
    % z3 {) c+ D( D& E% Q7 Q, s
  74. char *dmabufsrc2 = NULL;5 s" R; E& c( ?  a0 s
  75. char *dmabufdest1 = NULL;
    3 r, o$ E3 A5 H5 _, m
  76. char *dmabufdest2 = NULL;
    - ?! r0 Q8 \3 ?$ ~4 N
  77.   Q* c$ N  y9 {5 Q9 P) m9 ^
  78. static int acnt = 512;
    6 A% [+ _  f: `3 u0 Q; S
  79. static int bcnt = 8;$ C6 U% k/ b0 N5 w
  80. static int ccnt = 8;4 K, M5 v. l( w& m

  81. 6 n+ g" O( v! M) g7 ~
  82. module_param(acnt, int, S_IRUGO);; i# E* r0 Z# B; M  ~# W
  83. module_param(bcnt, int, S_IRUGO);* P3 U8 o* h8 W: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 r: s$ S# c! [) A' s% O- X4 ~; ], p* }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ]# Z8 h6 s7 ]! G/ m6 a' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ?) p* z- @- a' W8 Q- D. K3 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' f! f3 ~2 }, M* p

/ I$ @, F8 ]% r- h$ {  |: U( o: \* O5 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 11:18 , Processed in 0.040430 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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