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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 M* V" n+ J  R
  1. [code]EDMA sample test application
    . W4 _( r2 W: c* e) [
  2. /*. p5 f1 C( I& y" ?0 }
  3. * edma_test.c/ |% ?/ a4 ?) U
  4. *8 g; P) \8 A4 o  k! z- Y
  5. * brief  EDMA3 Test Application
    7 K6 e# }# C9 k$ R& D4 G0 Y
  6. *
    0 g. E' q" t" X5 H+ @
  7. *   This file contains EDMA3 Test code." M; }; R, u5 G" n1 M% N' k1 R
  8. *& E. p" |' a( D1 t. }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 U/ C) C- I2 e* H0 g6 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : k( \: Y; g& _3 M5 U  Z
  11. *         TO CHANGE.
    / A: ]6 M1 p: G+ w
  12. *. p/ r( c1 e0 t2 o. l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o6 d) x( ^0 t5 A
  14. *0 V: @8 U( I( j. M9 ?- q$ c% ~
  15. * This program is free software; you can redistribute it and/or
    : {8 _, C( R* c! l1 p8 `, c
  16. * modify it under the terms of the GNU General Public License as% f& k  S+ Y+ ?& \+ b8 |2 _
  17. * published by the Free Software Foundation version 2.
      z4 v1 l( r% a7 O/ _/ W
  18. *
    , T8 e( \" N; D7 t. k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , l4 F7 N$ k' r2 u! E5 p. }5 O) f
  20. * kind, whether express or implied; without even the implied warranty+ {) h% I7 U0 k& L: o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) L* [& O3 l/ r3 ?0 m% T
  22. * GNU General Public License for more details." i7 S* s8 M# U$ b
  23. */
    : ~) N- t0 ^8 J

  24.   S3 n, L* O; ~9 Q& j! D: _
  25. #include <linux/module.h>
    7 F; p1 R- R& S/ X6 ?
  26. #include <linux/init.h>$ e+ ?! s: L( o5 U3 W! Q+ e) a
  27. #include <linux/errno.h>! m3 N. D  y7 Q  w
  28. #include <linux/types.h>
    6 Q3 U, G& G  R: }) R9 J
  29. #include <linux/interrupt.h>
    4 r# h! t4 U8 k+ b+ @& [! G
  30. #include <asm/io.h>
    : z/ j: H' X: @' F5 j
  31. #include <linux/moduleparam.h>
    " w7 \  N3 r6 v$ F) \
  32. #include <linux/sysctl.h>
    1 p' p" J9 g+ @4 B. ?- w
  33. #include <linux/mm.h>  p1 O" t& W0 A" `" B- |
  34. #include <linux/dma-mapping.h># t2 [! c" N4 W8 I( E7 D
  35. 4 e3 l- x1 O0 I: O( ]
  36. #include <mach/memory.h>
    7 D" d# R& q% R( W1 ~6 f1 T7 }
  37. #include <mach/hardware.h>
    * `  W- M% s2 ~* B% x2 c, Y1 s
  38. #include <mach/irqs.h>6 ~" t8 r; m7 U$ y
  39. #include <asm/hardware/edma.h>
    6 l8 f$ t6 A! S
  40. 9 Q7 b6 m$ a0 @8 ~- O. d
  41. #undef EDMA3_DEBUG3 B- }3 p6 N: u
  42. /*#define EDMA3_DEBUG*/
    + d* T' P) N* u1 k; n
  43. 1 ?" l" @" r; P0 t$ V
  44. #ifdef EDMA3_DEBUG
    ; @( Y$ b9 V1 G, o: Z  A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {; F9 m8 N; F0 i4 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Y7 g/ I$ }9 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . Z  a/ A$ p9 t! g: z7 @) {) ^( K
  48. #else! T# _2 R1 X5 x
  49. #define DMA_PRINTK( x... )$ d% R5 P/ t. D& V
  50. #define DMA_FN_IN
    2 i7 [* T9 U6 M3 H( ]
  51. #define DMA_FN_OUT! X2 {4 D4 S' c2 H; o4 h6 y
  52. #endif7 O8 b! G. w7 h( v
  53. 7 W7 P; V/ G9 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# [; q! |! E, F" M3 \
  55. #define STATIC_SHIFT                36 ~$ B) m/ [; G) _
  56. #define TCINTEN_SHIFT               20
    / c4 h. g* p2 |. ~& K9 B
  57. #define ITCINTEN_SHIFT              215 j, W* X6 V- I$ @' s7 @
  58. #define TCCHEN_SHIFT                22- a- g6 s. L# R. m
  59. #define ITCCHEN_SHIFT               233 ^4 R& ], V5 J+ d4 c. [" ~
  60. % o% s9 n4 d! [' L; R  l* T# {
  61. static volatile int irqraised1 = 0;9 d3 ^' u- j3 j* s. D
  62. static volatile int irqraised2 = 0;, G3 q& }# z. H+ q
  63. ! ?3 V8 W3 T9 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 C$ L1 d, z% r4 W" R% W- K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 F* Z  d7 z4 ~) r: W! S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  o$ }; ~$ i5 P: y( L! ~. U. o
  67. 5 s: D8 d+ S6 T
  68. dma_addr_t dmaphyssrc1 = 0;
    1 s" A7 x; |7 J7 G
  69. dma_addr_t dmaphyssrc2 = 0;* E. c: D2 `9 j0 }* C; N& V& E
  70. dma_addr_t dmaphysdest1 = 0;; {3 R5 D# B3 U* i% Q
  71. dma_addr_t dmaphysdest2 = 0;
    & `8 a8 G( S/ f/ E: Y
  72. . l' `1 D% f. b3 e" l5 T  k
  73. char *dmabufsrc1 = NULL;
    7 I8 X; H, U, d2 p
  74. char *dmabufsrc2 = NULL;
    % I4 P. |" f; a8 F5 Z' z) \! P5 U' X
  75. char *dmabufdest1 = NULL;
    ) r8 T# ?3 P& @5 s) O) p5 Y( y
  76. char *dmabufdest2 = NULL;
    - y9 s# U5 \; a+ Z) q
  77. 5 h7 A9 d# W3 I; \$ F
  78. static int acnt = 512;
    - P5 Z- ]& {6 H0 c: r) p6 D
  79. static int bcnt = 8;8 ~0 o2 Z! s1 Y. x$ n
  80. static int ccnt = 8;
    ) I* l( {: V* R( e3 W; |8 a
  81. 6 A3 y8 p# g* f9 h
  82. module_param(acnt, int, S_IRUGO);. T, ~* a0 ]) E
  83. module_param(bcnt, int, S_IRUGO);
      ^: Y" y* D2 }4 t1 o! s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 a( j6 O- o$ S! h$ _( N; b9 q; s( k/ U! q4 E+ j8 A' Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. J+ }  l( W7 I7 O5 H& s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* C2 o& j$ g/ K0 f- ~8 V0 |' M2 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 X+ p; @% s# H+ s! ]4 n! k- N$ ^
9 X6 I2 t4 z2 P( t$ |
0 q$ M5 x9 l0 i; ], d# _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 13:11 , Processed in 0.040198 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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