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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B! q- Z. @! c: n* {+ }4 P7 b1 I2 t
  1. [code]EDMA sample test application. k1 a0 A) P4 T; r- ^
  2. /*
    " v9 `" y; Q( Z. S
  3. * edma_test.c9 O- f; p( ~! R# @
  4. *
    + A) a4 x  m+ J: A
  5. * brief  EDMA3 Test Application' S" Z$ D( x' v3 j$ l% A0 a
  6. *
    ' e- v7 \! P( i$ n+ a& ~0 z
  7. *   This file contains EDMA3 Test code.* ^; n! E1 x- ]- |6 m
  8. */ J1 h" P. U  A, [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # f2 X+ V+ N! q# W/ h6 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ^! z6 O6 ]8 u* e  y* U3 j
  11. *         TO CHANGE., i' i3 Y. L4 i& e3 K2 p
  12. *
    4 @1 }' N# |+ z3 a4 V. E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 e9 o4 {" J) V0 I( a5 n
  14. *" H  v( i2 Z3 ]( f0 A
  15. * This program is free software; you can redistribute it and/or7 Q  g( p- e9 K& E$ H
  16. * modify it under the terms of the GNU General Public License as
    . E+ u0 R& b: E+ V; B- @# V
  17. * published by the Free Software Foundation version 2.
    4 S5 Y5 y. r4 }" J
  18. *
    % i- u7 |, w" }( E+ C- g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & D9 N4 o4 N$ |. T& p! T
  20. * kind, whether express or implied; without even the implied warranty( y5 ?! i4 ^& W* u( ~9 ]% s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 e4 ?: W" A+ B( c
  22. * GNU General Public License for more details." o* [4 X' P/ S7 j% _! D+ R. X
  23. */  f- {' _4 q7 g( ~
  24. ( \3 G6 k7 `, {9 d
  25. #include <linux/module.h>
    5 `5 q1 o& i3 e7 J, X$ v* e
  26. #include <linux/init.h>) S$ v( x/ ]5 t6 Z0 `1 ?
  27. #include <linux/errno.h>
    4 i( f) B; v7 d2 Z  X& c
  28. #include <linux/types.h>( a, b9 Y1 H5 V: q! E
  29. #include <linux/interrupt.h>; k% g* E6 Y$ E& D4 P. L; ]
  30. #include <asm/io.h>
    * E' O+ H' v( b9 n' K
  31. #include <linux/moduleparam.h>
    # u* v5 E2 W2 _# n2 }. _$ O2 W
  32. #include <linux/sysctl.h>" S, C1 b& B/ M: t
  33. #include <linux/mm.h>, \1 b  s( w- K- k# f+ D* E
  34. #include <linux/dma-mapping.h>
    % C( e" b* ~. |0 A0 y- k4 |
  35. & e! K9 S: O$ X) |' ^
  36. #include <mach/memory.h>- V# F0 z3 l" G- q9 d
  37. #include <mach/hardware.h>$ L8 N5 H* z/ H9 P2 j4 ]  ^
  38. #include <mach/irqs.h>
    " U9 ?. d8 q- O7 r8 H4 @
  39. #include <asm/hardware/edma.h>
    % U9 r  ^  m. H! M2 B% W
  40. % p. Z& ^* ~* ~& `9 S8 H& g( O
  41. #undef EDMA3_DEBUG6 \4 z: j) X2 V  o+ H
  42. /*#define EDMA3_DEBUG*/* P. k5 U% w: v4 A) T
  43. ) y6 @( c% v$ h. v% H
  44. #ifdef EDMA3_DEBUG
    * E/ W7 p" l5 O: K- V' g6 i. V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 \7 E$ c* A( Y! _7 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  h' E* H  c( h4 W& R" k4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B: B  C& {- ?2 K+ M! L
  48. #else
    & ^  w0 j5 f$ B# b
  49. #define DMA_PRINTK( x... )8 H- r& O5 y4 R, l$ q# K+ d/ `
  50. #define DMA_FN_IN, A- f3 g: I$ r" L* Z: _6 S1 R' s3 G
  51. #define DMA_FN_OUT5 P' I! _- i+ H0 C, W
  52. #endif, ]: \0 u2 i) U
  53. & o4 z% H  I% g) {/ g7 j; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% s$ S; [1 M, Q5 E0 h
  55. #define STATIC_SHIFT                3
    # j! u, {/ c. @# u7 H6 H) Y
  56. #define TCINTEN_SHIFT               20
    . X9 z/ @6 m& X! Q' h' @9 Q/ Z: N
  57. #define ITCINTEN_SHIFT              21
    - q8 C, G- q$ A$ V
  58. #define TCCHEN_SHIFT                22
    ! u6 v9 R1 ?1 Y% Z* S$ d
  59. #define ITCCHEN_SHIFT               23
      E# b3 L4 T# |- `# g

  60.   @# {5 U- e) i- C
  61. static volatile int irqraised1 = 0;4 B5 d% m1 }  V. x. r% a
  62. static volatile int irqraised2 = 0;4 u* ^7 j* b6 i# @% b" z! z, M/ f4 z

  63. : }+ ?7 R2 Y" @8 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S; R5 H8 h! s7 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X( C, ^' i/ {$ c6 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z! b  K/ l0 S0 F/ p* U
  67. % }2 w5 ], r1 T1 Z+ y, M! _
  68. dma_addr_t dmaphyssrc1 = 0;
    - b0 `5 Y4 L4 Y6 i; U( ]! ]0 O9 E
  69. dma_addr_t dmaphyssrc2 = 0;# r' @4 ?* G' F- x
  70. dma_addr_t dmaphysdest1 = 0;3 K+ G" i8 P1 v- q. `& [' m  O5 P/ a
  71. dma_addr_t dmaphysdest2 = 0;
    . S' _* {5 J, D

  72. 5 Z0 z9 O2 o1 j
  73. char *dmabufsrc1 = NULL;
    0 j" H: q4 q4 W/ P# R! H
  74. char *dmabufsrc2 = NULL;; Z8 z, P8 V4 [$ y0 n# f# q
  75. char *dmabufdest1 = NULL;
    - C/ ?0 P: i% d6 g$ f9 N$ x- ^
  76. char *dmabufdest2 = NULL;
    # K$ P" v1 m) B+ C$ P- `( g. s$ Q
  77. 6 v$ _- D4 x  G' `
  78. static int acnt = 512;
    ( d7 @& J2 L  h4 `2 V
  79. static int bcnt = 8;% |2 Q+ t; v! Z4 B: }6 B
  80. static int ccnt = 8;2 P# I+ `, _+ g6 R
  81. 4 k  H- F& j7 k$ i9 y
  82. module_param(acnt, int, S_IRUGO);
      o- I+ Q7 Q& m$ \  {7 X
  83. module_param(bcnt, int, S_IRUGO);
    , K1 U2 o6 @: X: E- p, R* z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ }( r) S5 `& |- D7 t! r* o

) f" A) x+ w5 t2 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 j9 i- [  k& P. m4 V  m7 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% u  b: }0 G& r0 B4 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' X7 n+ `* d& Y6 y6 b5 r2 h# y
. t6 B& ^; V0 P9 d
' c; u" v7 o/ n3 A* [+ |6 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 12:27 , Processed in 0.039200 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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