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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' R% t2 y3 n. N. \# e) m
  1. [code]EDMA sample test application
    ) x5 m0 v8 R7 t" n2 Q" i
  2. /*
    . C# C7 I9 [! o9 u! Q1 T7 s
  3. * edma_test.c: F( h7 `% X% g: x1 D
  4. *3 P, J( \$ e9 h5 e# Y3 ]
  5. * brief  EDMA3 Test Application& J9 `& m4 a5 T2 O
  6. *
    : i+ K7 O! O: w" G3 [" Z8 ?
  7. *   This file contains EDMA3 Test code.
    ( T0 t+ r) Z  y4 Y' t
  8. *, z- s" u; X+ \/ N4 F+ ~6 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & Z1 z% E+ y6 |. t1 R  a4 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Y- q& R; }9 a; [5 \. f# |1 E
  11. *         TO CHANGE.
    - N6 c, W, h+ B# o! B/ G
  12. *2 d. X) e! o9 X8 k, ?' ~% c3 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( z0 e7 v# F8 ^& a6 z) n* l
  14. *
      z- d; C! `& G: J5 S2 E  A
  15. * This program is free software; you can redistribute it and/or
    9 l+ J# J! B1 b# t4 N/ K% m
  16. * modify it under the terms of the GNU General Public License as
    0 V5 f2 t' n2 C5 ?; E' B) \
  17. * published by the Free Software Foundation version 2.7 G3 ?  E  J5 |- j$ J- W$ ^
  18. *; e- F0 w% h# b$ N+ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- S& @+ Z  Z. I, q; h/ o0 H7 r, F
  20. * kind, whether express or implied; without even the implied warranty; F  ]  o* r. b8 y' c: y; Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! z2 B) o  o: n8 [% Z
  22. * GNU General Public License for more details.) _2 y; g# t2 e  S0 C
  23. */  ^5 L* g5 ~! S2 Y! M) v
  24. - C6 z3 B( I# q+ o  {
  25. #include <linux/module.h>  @1 Y  K) L8 E7 u6 J% `  T8 i: g
  26. #include <linux/init.h>
    & P: v; r% D/ t
  27. #include <linux/errno.h>) J8 ~0 O( _. d3 O' W3 Z# D+ N! V
  28. #include <linux/types.h>
    0 U5 g6 _! y! {7 A% ^" ?
  29. #include <linux/interrupt.h>2 \; y1 Y9 Q8 d0 [7 S" v: M
  30. #include <asm/io.h>* [# {0 ~% a0 w9 W
  31. #include <linux/moduleparam.h>1 I* v6 e* {, }* O
  32. #include <linux/sysctl.h>5 |0 F  o9 V" k: b
  33. #include <linux/mm.h>  J& l* z& L2 ~0 A# [/ A
  34. #include <linux/dma-mapping.h>" u) J+ b" ~9 O. Q! u

  35. , _. n) O* j7 M* s! K- f, u
  36. #include <mach/memory.h>* q/ ~: s. W2 P0 U2 ]- w; K
  37. #include <mach/hardware.h>
    1 F3 e& [. W1 N
  38. #include <mach/irqs.h>
    1 w( K% b! z" S  K- p
  39. #include <asm/hardware/edma.h>" f0 A  s+ }6 {3 S5 q6 q

  40. % `6 H. G+ f8 [/ K0 z% ?* T
  41. #undef EDMA3_DEBUG# N+ x7 A8 B; N
  42. /*#define EDMA3_DEBUG*/
    $ E2 }2 K: W7 {9 [& l
  43. * ]2 D) S" I2 F8 M9 L6 K
  44. #ifdef EDMA3_DEBUG
    5 w/ _5 a+ O$ n9 `3 S/ g! Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      U0 G: R1 p4 ^' q# ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; @' d. q: ?( [  ]9 O6 Q6 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 a3 V5 B' K! }3 R8 \
  48. #else- T2 a3 L% E- N* ?* P0 X
  49. #define DMA_PRINTK( x... )9 ]* x4 A* p- l& K; D6 a2 j
  50. #define DMA_FN_IN1 S6 P: D3 O1 h0 w. v9 B
  51. #define DMA_FN_OUT- N  `  D4 ^3 V" c2 U- p
  52. #endif
    5 K! `' C4 n; z& D) K
  53. / j; [' K1 R" M1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); e3 G- [" X" y$ _4 @
  55. #define STATIC_SHIFT                3
    9 A: D: v: N) O- k5 Q
  56. #define TCINTEN_SHIFT               205 C9 R' y" Y( x$ ~; x' S
  57. #define ITCINTEN_SHIFT              214 P. f( `8 s8 o9 {( t% ?; _
  58. #define TCCHEN_SHIFT                229 N8 Y: H9 H' Y8 u% B
  59. #define ITCCHEN_SHIFT               23
    5 K: w& ?& w0 V4 n

  60. ! w0 [$ v, n9 M3 X# h" j
  61. static volatile int irqraised1 = 0;
    ) g6 v! n/ K3 p7 M+ @9 t7 w
  62. static volatile int irqraised2 = 0;
    & I+ J5 k# V# |& D2 s

  63. 1 O  F; ~" u; b' r4 D) h+ P1 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H& _) L" K& g+ M' ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q  W9 v. i" ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ~% A# Z8 V1 F4 p; x6 m  W$ Z

  67. / g9 ]4 B8 \+ b4 p
  68. dma_addr_t dmaphyssrc1 = 0;( F  l. R; X: x; V3 P
  69. dma_addr_t dmaphyssrc2 = 0;
    + K0 B% i  S) E1 k3 Q' X0 Q
  70. dma_addr_t dmaphysdest1 = 0;
    ; q2 F0 h& R7 r$ y. ~, u  h) Z
  71. dma_addr_t dmaphysdest2 = 0;
    4 i( G; a3 `7 D3 C& c% q
  72. : W- Q7 l+ y# ^: C# t
  73. char *dmabufsrc1 = NULL;3 i. d7 `0 ]' b2 O% t
  74. char *dmabufsrc2 = NULL;0 ~( Y/ y* m' F$ Z: b; [+ M
  75. char *dmabufdest1 = NULL;" S4 _6 {: Q) \  S' C3 U" w# n
  76. char *dmabufdest2 = NULL;
    ' p9 s2 s0 v, c6 ~6 L" U
  77. % p# m; j1 [# G, f
  78. static int acnt = 512;5 @) D5 B- A  k
  79. static int bcnt = 8;; z8 G% v+ j  l. S6 Z! s0 {" y1 f
  80. static int ccnt = 8;
    ) K" V) G6 U& Z; Y5 w' n

  81. 1 u+ _0 h# a+ g) L3 M6 _; ~
  82. module_param(acnt, int, S_IRUGO);
    % [( g, w, X" n; t
  83. module_param(bcnt, int, S_IRUGO);! B) E- ]: U' ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 u  ^! v0 {$ c% H2 o* ~" ?+ O
9 a8 s, E0 [9 I$ v/ L# B8 Q4 \( s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y7 f$ n8 G" T- K  G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ \" H, z" I3 ]; S3 x( ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. n1 u$ j/ G+ K# E+ _
6 N+ ^+ Q6 [" V- u
& I1 Z  w" Y7 M# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 10:07 , Processed in 0.040842 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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