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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i3 x3 j3 r5 D( }* S- g: a! R
  1. [code]EDMA sample test application/ U; C( v2 u+ E# f  y* o; d
  2. /*7 J. m# L# u5 I& \$ S; ^8 V" j
  3. * edma_test.c% ^5 R6 `( }8 u8 p9 r
  4. *
    ( q$ y5 q% [: m" v+ e
  5. * brief  EDMA3 Test Application. O: ?0 V6 E! B  a3 _$ J
  6. *: j- w! L  a4 v% d6 h- v
  7. *   This file contains EDMA3 Test code.$ u, W9 m( h. `
  8. *
    3 x# R/ f0 y* L- W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 a- D$ W8 f: H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% W; E8 h- `7 j8 K" J6 k
  11. *         TO CHANGE.: V; \! j! X2 p5 \/ W+ g4 @1 X2 j
  12. *
    ' d6 J2 h) F% N* _6 k& i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 m- b2 c( j7 _- X0 O2 Z% ~
  14. *
    2 e2 G- u9 y4 [+ A/ v% [0 l
  15. * This program is free software; you can redistribute it and/or* `; G" z: P  U- ]3 U
  16. * modify it under the terms of the GNU General Public License as+ _0 w" d" g# W" [9 R
  17. * published by the Free Software Foundation version 2.
    $ ~$ {$ O! a' O% j+ c
  18. *' V! P' x$ Q5 I- T2 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" w: j! I8 M2 l. T  v
  20. * kind, whether express or implied; without even the implied warranty6 g' t; J( u' w: ]& s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 I$ [% z( `( u/ Y/ k
  22. * GNU General Public License for more details.: u: y# y. t! ?9 b
  23. */) Q( `$ j( {% v
  24. - w2 R/ s( w7 J2 H4 j  ^
  25. #include <linux/module.h>
    ! j6 }3 X( ~5 S3 {) X7 |7 h( S
  26. #include <linux/init.h>
    ; \+ L0 ~% _8 q% i
  27. #include <linux/errno.h>
    1 p: {1 B9 |% y0 D2 g# k8 P/ ]
  28. #include <linux/types.h>
    ' k+ |7 P; f0 Z4 |  r
  29. #include <linux/interrupt.h>, x9 T2 n9 a2 u0 J4 K, l" w
  30. #include <asm/io.h>! d4 \% z. \1 l! k0 |1 ~! j) O8 t
  31. #include <linux/moduleparam.h>
    / n- [' F. I( b, V
  32. #include <linux/sysctl.h>2 y. A, D1 _+ E# m' J% R1 q) p
  33. #include <linux/mm.h>. F) J+ f1 R$ G$ R
  34. #include <linux/dma-mapping.h># t7 _8 ?& {6 J5 Z" z; {# k( V

  35. & ]) j& z0 `3 K1 k
  36. #include <mach/memory.h>
    ) r+ u, ]- n) U4 I" D
  37. #include <mach/hardware.h>
    8 _0 e1 f2 Q+ m* V6 G' ~3 c; o3 r
  38. #include <mach/irqs.h>
    ; i6 ?* o, R; s; h8 r. w
  39. #include <asm/hardware/edma.h>4 G: R' {+ N9 @
  40. 8 x0 a# t5 v' \' U9 ?: j
  41. #undef EDMA3_DEBUG7 W: m$ {. D; g: F6 W( V) w
  42. /*#define EDMA3_DEBUG*/$ U$ Y& E; v  }
  43. 3 M2 `7 m0 ]# o) g3 c
  44. #ifdef EDMA3_DEBUG
    . h/ W3 H2 e" {  P1 V( ~4 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 [3 e. e( Z" x3 n& @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 n* |, W% z+ x  u4 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  X* m: \# ^6 C; q9 @6 J3 ?! N7 L
  48. #else" k, i, Y/ ?1 j& O( C+ V/ }9 ~
  49. #define DMA_PRINTK( x... )
    % A8 Y+ K+ W: w1 f& s
  50. #define DMA_FN_IN- S5 A: e2 K' ~) f: i# M
  51. #define DMA_FN_OUT
    7 x- N5 W3 S; d4 Z
  52. #endif$ P7 T$ R+ c3 G' ^3 ?4 P- C, I. e" Y

  53. 0 a2 X2 l; t8 F+ ?  m. |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 s# z8 V$ z( u9 O7 e- O% q1 T
  55. #define STATIC_SHIFT                33 {4 @: |6 o7 P/ ^' N. G& Z
  56. #define TCINTEN_SHIFT               208 h* L7 \- N" Q' D0 O
  57. #define ITCINTEN_SHIFT              21/ s& e; N: B- [/ a  d. |. e
  58. #define TCCHEN_SHIFT                22
    8 O! o6 t$ Y) c, I. c! |( s
  59. #define ITCCHEN_SHIFT               23
    9 c; l1 P* d# O) L
  60. 1 Q8 s4 k* P7 [' r( b5 l
  61. static volatile int irqraised1 = 0;
    . E% z, [0 ^* o' Q$ U
  62. static volatile int irqraised2 = 0;& H' `: D, Y+ [' p* ]

  63. , I: y: C  P3 O8 p5 Q7 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k' T$ a: `3 A! l; A. n6 v! W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 D( l  v5 r/ n) n) P: G; T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E. w$ X) Q. e/ Q

  67. / i; V6 y2 B# R& Y% ?
  68. dma_addr_t dmaphyssrc1 = 0;' }! O7 a# D) |! W  N2 |
  69. dma_addr_t dmaphyssrc2 = 0;1 `9 r0 F% z/ u( ^9 g3 W. \
  70. dma_addr_t dmaphysdest1 = 0;' a; G+ v# b2 b
  71. dma_addr_t dmaphysdest2 = 0;
    % d- c$ y- i. P1 A7 y0 X
  72. - p$ ~$ ~! w3 `/ L
  73. char *dmabufsrc1 = NULL;) R  M4 B7 H# G! y) b  P4 v: v
  74. char *dmabufsrc2 = NULL;
    8 `. \% t8 y  B& u* {
  75. char *dmabufdest1 = NULL;- T, C  S/ e9 \. o* B
  76. char *dmabufdest2 = NULL;. h9 y" a: M5 d2 W& `0 h0 ]) R$ U+ b
  77. ! j) w* Q1 g) Q7 G
  78. static int acnt = 512;$ Z( T. o. S: w
  79. static int bcnt = 8;" e% C& u- U( t3 `, s
  80. static int ccnt = 8;1 B% ^( l1 [4 g" m

  81. : k7 F# Z- \& `, O
  82. module_param(acnt, int, S_IRUGO);) }8 i2 b. ]. ?
  83. module_param(bcnt, int, S_IRUGO);
    4 O# ~5 I/ d/ x  F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ^3 k( J$ D# d9 K
/ P7 C# L2 n" T$ G  b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l" t( R" Y$ }. d( @" `+ v+ uarm-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 t" U3 m6 U8 D$ \$ L9 L) S4 n4 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" L6 Z8 u8 {; h- [" a$ n. d! A- I- \; @- A5 Y6 O
7 t! f( S% \) x/ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-29 03:17 , Processed in 0.039090 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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