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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* z4 C8 B" ?. R: M$ C# _
  1. [code]EDMA sample test application
    : g4 K# _- a" Y  g0 e
  2. /*) Q- q2 A# l7 T+ e' w
  3. * edma_test.c' C; {1 ]7 P, \8 W3 z% Q- }2 M
  4. *
    ! Q9 O0 |# o8 @! f( J& ^! W
  5. * brief  EDMA3 Test Application
    ; ~  T3 {$ S( R. r. o0 l2 O6 T
  6. *: e" c( V& g" \
  7. *   This file contains EDMA3 Test code.# L( e+ H1 W* D8 }+ u8 [7 C
  8. *
    ! N# ?# ^" i' O, j- i# R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 v: q% c# ]1 b8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! H9 W( ~0 y2 ^+ }( n/ p, D' ]
  11. *         TO CHANGE.
    & Y- S5 W1 C3 L1 v
  12. *
    4 E' ^) x7 y* C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! x; _9 p2 _  Z3 F0 o% c4 `: [
  14. *  f1 y4 c( U. Q
  15. * This program is free software; you can redistribute it and/or
    0 f) N/ T- \9 Q- l# q8 U( u6 J
  16. * modify it under the terms of the GNU General Public License as
    8 k# L7 U1 ^5 V1 P1 @. s$ k
  17. * published by the Free Software Foundation version 2.
    0 c3 X, J' R' I1 B; p
  18. *1 }. r& p3 m3 @( q0 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 r' r& T' Y, m3 q' B6 x/ _
  20. * kind, whether express or implied; without even the implied warranty) Q) W" [0 m5 R9 B& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# |9 ~" X! b- J" Z! b3 a: V8 t  U
  22. * GNU General Public License for more details.
    / h9 T' Z9 r7 b. e" }4 q: A
  23. */
    ) [# s  \. O  u$ t$ c! y
  24. # U& ?1 K. H+ V$ d8 q) M
  25. #include <linux/module.h>0 ~% b' B9 u* `/ j6 W- M; B
  26. #include <linux/init.h>
    * @1 V/ S* ?2 W) I! @9 }- V
  27. #include <linux/errno.h>  g$ @$ w9 Y' j8 w  @" u
  28. #include <linux/types.h>
    ' Z$ q3 ?+ R- }/ s
  29. #include <linux/interrupt.h>5 G$ Y1 A; d7 G$ \9 V3 w0 k2 h
  30. #include <asm/io.h>/ J; i; ~& \* J9 E, O
  31. #include <linux/moduleparam.h>
    # }, r1 S$ J# w( j/ n2 h
  32. #include <linux/sysctl.h>- g; s# h" x7 P9 d7 ~) s
  33. #include <linux/mm.h>
    , G/ |1 L3 k: \
  34. #include <linux/dma-mapping.h>
    % r: m5 u9 b% K. i8 r! c: l8 K

  35. 6 T  l. D' @6 S6 m0 m: d0 }) `& a
  36. #include <mach/memory.h>
    , a' \; w& @/ y& u# ]6 t5 {; u# X
  37. #include <mach/hardware.h>
    2 j# Q, X4 K  K7 b: F! x9 x
  38. #include <mach/irqs.h>
    3 s& B8 X- A6 u6 N
  39. #include <asm/hardware/edma.h>  {3 o/ g! J* r0 M* e& k! F# K$ K8 b
  40. 3 ]% r8 o2 m; L% s
  41. #undef EDMA3_DEBUG
    ! A5 f2 i0 F" e# M+ A3 S
  42. /*#define EDMA3_DEBUG*/
    ! H3 e' h# K; o9 H5 ]3 F- \9 @6 H

  43. & W* B$ P; U" Q6 |- b
  44. #ifdef EDMA3_DEBUG; c6 n7 o3 R/ z% k+ K3 [  W% g' i0 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 H: s* Q7 F" Z9 ?6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! x! I) y& T6 |% Z8 X* @+ k" V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . o" D* b- n. _( k8 `* i! l
  48. #else' ]* ~: `5 L) e/ s  Z& H7 R$ u
  49. #define DMA_PRINTK( x... )" P8 P& Q0 E- ~8 [
  50. #define DMA_FN_IN+ O" F! T0 a2 ?5 o+ v1 d* x
  51. #define DMA_FN_OUT) {( h. g1 e! L  D. S8 o" g
  52. #endif# h0 g2 k! l# P* l
  53. . p# s3 ?0 o- {( ~- D6 X! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) @, [& t" Y, Y; H( T+ _* z& ?
  55. #define STATIC_SHIFT                3
    9 `$ R7 P, _/ V# T7 \" j
  56. #define TCINTEN_SHIFT               201 K- b( W% }  F6 C% R/ v
  57. #define ITCINTEN_SHIFT              21; ^0 |  e# o/ W* F& u# V
  58. #define TCCHEN_SHIFT                220 y1 a1 k% T. @9 U* v
  59. #define ITCCHEN_SHIFT               23  n2 B3 J; g% U7 y5 _8 ?  J7 K

  60. " }0 z. I3 D3 X
  61. static volatile int irqraised1 = 0;6 N) a: B6 R) M- K, P( w
  62. static volatile int irqraised2 = 0;( o- \. h0 i- T5 ~( N' D% R

  63. , ^6 l- Y: ^; D6 A) [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M3 o7 u: f6 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f( ^% B& p' b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P5 @7 `. M) \/ y5 t! H* w) S/ u& @; s

  67. % C# A: m! |* H: U: D
  68. dma_addr_t dmaphyssrc1 = 0;6 r  j6 m4 h5 H
  69. dma_addr_t dmaphyssrc2 = 0;% d% r: a2 S% j
  70. dma_addr_t dmaphysdest1 = 0;) L6 s3 G9 k9 Q
  71. dma_addr_t dmaphysdest2 = 0;6 u) X; z" K) @( Z% a

  72. 4 R/ @' n- E3 ?+ z
  73. char *dmabufsrc1 = NULL;+ c1 t% S9 `9 t
  74. char *dmabufsrc2 = NULL;* b( B! A7 e( W, B1 e$ {
  75. char *dmabufdest1 = NULL;. D1 `' t1 b8 [+ D8 `' c: X/ r- m
  76. char *dmabufdest2 = NULL;7 A, Z  E$ \9 l. y  @$ ^4 H4 I

  77. * l/ ?/ g6 S( q, x: \* S" ?
  78. static int acnt = 512;
    / U' J2 x5 r  h. `+ u9 U
  79. static int bcnt = 8;
    + p4 x+ D! y: R) M  Q1 x
  80. static int ccnt = 8;
    8 b7 F) P1 h$ ~9 O9 b- n" i& w

  81. ! l5 |7 a# [0 H$ Z0 n
  82. module_param(acnt, int, S_IRUGO);
    4 p# S" ^! \9 G, e' v( W& ]+ L
  83. module_param(bcnt, int, S_IRUGO);& J/ K9 h# u: v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ \+ ]% k% e- ~, ^- m6 Q3 S4 y4 B! m8 p) ^( n1 N" {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~! v1 e& K/ l; H- l3 A9 N9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- g* D* |2 r# b/ x, b5 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ d0 a. h) @) u5 s. G& K
& S' k) X; u8 D  m9 O( k% f9 Q& \
2 v4 B3 {; M& }. J0 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-20 23:18 , Processed in 0.041505 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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