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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?5 \* l( C/ t% Q  a3 i1 b2 [
  1. [code]EDMA sample test application/ M0 ]# W$ C1 E
  2. /*5 X6 X  R' C8 P3 W0 Z4 }, D7 C, r
  3. * edma_test.c
    2 D( O/ D7 j  ^- o0 h
  4. *
    ! @$ l2 ?. E8 U  k
  5. * brief  EDMA3 Test Application
    7 ~+ G$ c1 y% Y0 G! }' f
  6. *$ d' J; |4 R& U1 L0 `
  7. *   This file contains EDMA3 Test code.1 P; n* _( d- O4 d
  8. *
    4 x( }8 n+ P: H$ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: G7 `2 p  B/ V! Q! u5 B& l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; t* V1 _9 r# Z9 |
  11. *         TO CHANGE.
    8 L1 Z' t/ E& C0 @
  12. *
    % Y$ |+ z, q3 P9 ]3 }) D3 H( [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + g; e9 g* n* W
  14. *3 V3 S# o; a0 g# y
  15. * This program is free software; you can redistribute it and/or6 i( [: i: L0 O2 z; E
  16. * modify it under the terms of the GNU General Public License as. f4 {* a$ C8 \+ d$ u6 L
  17. * published by the Free Software Foundation version 2.
      s6 J2 y; r/ ?4 Q4 N, |9 S: Z4 N2 \8 m
  18. *1 k- K0 h7 z8 ?' e2 M' _2 c' \% s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( C+ r4 h( G- \  A' u/ x7 E
  20. * kind, whether express or implied; without even the implied warranty
    ; h6 Z$ c1 W+ @6 e* O3 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) b7 _5 a& i! d7 C; _! Z
  22. * GNU General Public License for more details.
    + D# d& w" K9 w! o5 q
  23. */& x1 c4 E4 {2 q" v

  24. + C1 r1 Y! ?! t2 {: d! R, Y' G
  25. #include <linux/module.h>
    % n1 a4 ]0 J1 T8 V" n! f/ D
  26. #include <linux/init.h>8 o- V+ M( u3 O- n
  27. #include <linux/errno.h>! c1 U" P! w2 `0 R4 F/ a7 \* C
  28. #include <linux/types.h>
    7 `6 s/ a/ \" \$ |4 K' n
  29. #include <linux/interrupt.h>
    - y. D* ]: F$ |1 w
  30. #include <asm/io.h>4 m% C2 }) w0 A9 I/ t; n
  31. #include <linux/moduleparam.h>
    ( {# U( t  q. _9 ]$ U9 K- m$ V9 L
  32. #include <linux/sysctl.h>- V4 [3 G+ u+ w6 g/ D9 x
  33. #include <linux/mm.h>7 w3 y5 ?, o4 r4 h& l
  34. #include <linux/dma-mapping.h>+ k. G! s& t+ B6 x8 R! ~6 S
  35. 8 U' `0 b+ j$ c& d& _( p2 |
  36. #include <mach/memory.h>6 X$ I* O# c, @, O- z9 l' M
  37. #include <mach/hardware.h>9 E" \  f/ r/ P, ?1 O
  38. #include <mach/irqs.h>
    # c4 J# D' R5 g4 s
  39. #include <asm/hardware/edma.h>
    " u) Z4 j2 l0 ~, {+ w

  40. / ^$ ?7 j9 s' R6 F! M# O# y
  41. #undef EDMA3_DEBUG4 Q" q7 T7 @5 m( H
  42. /*#define EDMA3_DEBUG*/( E; e1 D. S& Q/ L) V. Y( g
  43. & Y) ?" ?) l' ?( u
  44. #ifdef EDMA3_DEBUG
    ) s/ m. I- L( I# H4 R! G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" I+ }8 S9 ~; \7 Z8 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* n3 [" x0 o+ C3 v8 z( x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . s8 |0 z5 ]) C9 K: r) I! ~7 P
  48. #else) R& ~* c/ D$ [, T
  49. #define DMA_PRINTK( x... )* u5 @5 n  r! j/ c  J
  50. #define DMA_FN_IN
    + R+ X3 P& V/ b( n: ?" {
  51. #define DMA_FN_OUT. q; D+ ^/ c& ?; A" u6 t
  52. #endif
    # P" o/ X* V: d

  53. ' ], E! o. s; q9 X& L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Y8 N8 Y/ O9 j6 i4 a
  55. #define STATIC_SHIFT                3
    2 C5 }9 o( l7 J/ L2 g( H
  56. #define TCINTEN_SHIFT               20
    ( k9 a- k; ]" o7 z- `1 Q8 s. ^
  57. #define ITCINTEN_SHIFT              21
    6 {- w8 ?: z# z
  58. #define TCCHEN_SHIFT                22
    : R1 b$ f) a' t3 t2 B
  59. #define ITCCHEN_SHIFT               235 Y, l1 j6 ?- F5 U5 P+ L6 h
  60. , I9 r4 z1 @6 s& ~
  61. static volatile int irqraised1 = 0;& o* S8 u) Q$ I
  62. static volatile int irqraised2 = 0;
    , o: W! K) ?/ K) y0 D6 F

  63. ; |% E, H$ f3 T' X8 x1 R0 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D* x$ \+ u! u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L0 `2 p2 q2 e6 n6 S: s2 N2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `. P1 y* o: L4 [! Y4 {
  67. ( Y# D$ P/ J6 W  n9 h0 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    8 m% k# \# p4 v3 B+ F
  69. dma_addr_t dmaphyssrc2 = 0;
    # {7 W# z# Z0 X: A4 I0 m" [9 ^
  70. dma_addr_t dmaphysdest1 = 0;
    , R7 Z: b' r6 g8 W' }
  71. dma_addr_t dmaphysdest2 = 0;
    - {. {9 ]! ]7 f' ~9 Y: q

  72. 4 |% X( b! u% t2 F
  73. char *dmabufsrc1 = NULL;
    2 Y6 a( a+ O. X' a
  74. char *dmabufsrc2 = NULL;/ G. C+ `' g* P' B$ L
  75. char *dmabufdest1 = NULL;' u" I+ i  E$ R
  76. char *dmabufdest2 = NULL;2 V; I  T! O% Y, u. R' f( `( Q: e

  77. & \2 E# g. c* ]. O  Z
  78. static int acnt = 512;/ S# r  L+ |1 @+ Q
  79. static int bcnt = 8;. m1 S& g" ^* o
  80. static int ccnt = 8;
    ' E; t/ u! }7 a

  81. - n! U# o' c1 a) J. w
  82. module_param(acnt, int, S_IRUGO);
    6 e" u$ }7 s6 Z) U
  83. module_param(bcnt, int, S_IRUGO);! L" J: a  z# u, l  w) G( ]( d5 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- h1 p! j6 W- k, I
8 b9 {) u  W: K1 s9 A& K" P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e# z' v; G+ w% k4 Y" n4 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 t0 D0 e- q) F, Q7 p- y( I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {. d* L; R0 s4 D; z8 t

) T: H7 m; S+ Z" ]% h
! A; z* E& N' D) _2 C2 H4 ~/ ^0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 20:03 , Processed in 0.049025 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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