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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ~! o+ ~0 S+ V
  1. [code]EDMA sample test application* U+ K% n4 k$ W: r4 }1 V2 U
  2. /*/ J2 j2 F4 M7 ]. r- M
  3. * edma_test.c2 w6 v  r- T" L- [+ ]# ^
  4. *
    6 ^: D& D% N; ^6 T
  5. * brief  EDMA3 Test Application5 \2 l7 A" B0 O% }
  6. ** j9 }- x: R; \% g
  7. *   This file contains EDMA3 Test code.) |" y9 j; O$ N+ A
  8. *  t$ E  y' A1 q$ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 @2 i: ?$ D3 z# e5 R' ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V9 O, l4 _3 l; f4 w! X
  11. *         TO CHANGE.: s4 }; G. s$ z: D2 m
  12. *
    6 u4 U  Y+ |3 [9 h  I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" h0 v( }: e: n& A$ p& M5 t3 ]
  14. *
    ; U4 m7 V/ [5 i$ B
  15. * This program is free software; you can redistribute it and/or6 v0 t, A$ X! q2 d: [; x3 p9 W
  16. * modify it under the terms of the GNU General Public License as4 D& W8 W& f0 o/ G9 h
  17. * published by the Free Software Foundation version 2.
    7 `$ K) h6 _; T/ j5 V: L
  18. *2 X1 I! P6 R! I% p3 y6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^5 v) f, e7 E4 u8 d
  20. * kind, whether express or implied; without even the implied warranty& T; |* R9 I8 r! f( Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 i, P5 ?2 u) ^, O6 K
  22. * GNU General Public License for more details.9 }9 x) }: r# ^
  23. */+ x" W! c" R. H( g  s. |/ _
  24. 5 d9 ^) R: y; S7 x
  25. #include <linux/module.h>
    4 u! ?! A4 P! R$ c
  26. #include <linux/init.h>+ c& b, r  R  k# p  R# o
  27. #include <linux/errno.h>9 i' a" t" d" V+ V. K8 J7 c
  28. #include <linux/types.h>) x* x$ f1 x2 ^6 t! A# r
  29. #include <linux/interrupt.h>, d3 I# z- a, e! P( u
  30. #include <asm/io.h>
    & T. c; ]. o; W- s8 j( m
  31. #include <linux/moduleparam.h>4 J5 Z2 {: [  Q6 W) `) _6 q
  32. #include <linux/sysctl.h>
    9 |, R- a' C1 C; K2 \, _1 [
  33. #include <linux/mm.h>
    # o; |" ?) V. @0 N. n1 a3 w. ]
  34. #include <linux/dma-mapping.h>! V7 T( _. k. x( R4 _$ i: u6 c. \

  35. , Y  q1 x* e5 ^7 x0 z2 w: {
  36. #include <mach/memory.h>; L# H& }4 n# K2 {- f/ @- d
  37. #include <mach/hardware.h>7 u8 {( h" W( D: @& ^
  38. #include <mach/irqs.h>7 Z$ W. a+ B1 M4 T0 q
  39. #include <asm/hardware/edma.h>+ _+ L3 m) t% ?% a  U

  40. 9 o: B4 I% T1 C2 O$ Q5 V( d9 x% z% ~
  41. #undef EDMA3_DEBUG
    : F( P$ X  l) R8 {- v
  42. /*#define EDMA3_DEBUG*/
    ! |2 W1 _# _# o# a
  43. $ q, t7 W9 G. ^# V- d( a1 p
  44. #ifdef EDMA3_DEBUG
    ; @$ i3 }7 U7 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 i& q' \/ u9 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 r" U; K6 q, [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 V( N5 s6 {3 D* [
  48. #else1 C) F% q! B9 Y, N
  49. #define DMA_PRINTK( x... )7 Y# h! Y+ u$ X( i# V. p: O/ k
  50. #define DMA_FN_IN# B+ g3 ?% S( R0 ^7 q
  51. #define DMA_FN_OUT
    0 P. N+ f2 c9 o" ]! D
  52. #endif
    2 }% \6 D% Y; ^2 Q! \: m

  53. # }$ A9 J. D1 h' d  M" z6 E8 E5 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 r$ [. u6 A) B" d' ^1 {
  55. #define STATIC_SHIFT                3
    4 ~0 k" ^4 F7 \1 ^9 X: [. c
  56. #define TCINTEN_SHIFT               20
    2 m& h( u7 A" ^3 M
  57. #define ITCINTEN_SHIFT              21
    ! ]$ x# p2 z% K, y
  58. #define TCCHEN_SHIFT                22
    " J/ h" y9 x+ ?( E6 @9 l
  59. #define ITCCHEN_SHIFT               23
    9 {/ b, C  R# t# V5 M
  60. . \9 t# E& Y) l6 a+ N
  61. static volatile int irqraised1 = 0;
    * s6 U! {6 D& ~# m- E. s& d
  62. static volatile int irqraised2 = 0;9 A/ W% f3 m8 A. v( o

  63. 0 ]8 p, G3 S% H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 C: T& Q5 x% `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |+ `) |* L* u9 U5 ^  j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z  R1 P" Y; ?3 [- U% f
  67. # |0 z4 l- h) o- [- R
  68. dma_addr_t dmaphyssrc1 = 0;
    % Z6 U2 D. q+ W! a! h  a
  69. dma_addr_t dmaphyssrc2 = 0;2 b: b' C. I$ L9 Q1 P" @, K: U- H
  70. dma_addr_t dmaphysdest1 = 0;
    5 {& ]4 R$ [' j$ H
  71. dma_addr_t dmaphysdest2 = 0;% Z9 `( \, T& I# g( q4 B

  72. ( q3 Y9 Q% Q. U! h) E8 E9 u
  73. char *dmabufsrc1 = NULL;& A: e! @4 h# c- B
  74. char *dmabufsrc2 = NULL;7 b6 Q2 i* a3 N! d) p4 `0 S! J4 l$ v, X
  75. char *dmabufdest1 = NULL;* ?) X+ F2 {( Q. H, ?7 n+ I% k# Z
  76. char *dmabufdest2 = NULL;
    . j  c$ O8 h. e6 u8 w! x
  77. 1 V6 n7 d3 D" |, v9 |# C% a
  78. static int acnt = 512;& a6 r; ~/ f0 |# L' R" y
  79. static int bcnt = 8;
    % v+ S: S4 R" n# B
  80. static int ccnt = 8;
    . W# N1 {' x$ W0 a0 ]
  81. ; X* t4 o0 F& ~
  82. module_param(acnt, int, S_IRUGO);
    6 F$ ^" l6 T2 f
  83. module_param(bcnt, int, S_IRUGO);7 Q  l  N% s7 p- v6 C4 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 Q6 Q' ?+ G3 I0 q) b

- q' a# Q# a3 y, H( F. u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A  b: y$ ?- ^/ y- S' C/ j
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 @" y, G+ R/ B1 y' Q/ T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: M+ q: _4 \2 X+ M& V

1 B8 n2 w$ _& I4 w1 x
0 Z* Z9 o6 p) l) \2 ^' s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 22:38 , Processed in 0.055956 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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