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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + y; m: v. B$ p9 O7 U2 F2 P0 q
  1. [code]EDMA sample test application' d& V! w- s7 F9 X) P: r) k& j
  2. /*
    ! b% l# A8 a& L9 X; @$ P+ m
  3. * edma_test.c- _+ z1 Q& G. k1 V. W' h
  4. *
    6 e  U6 g0 H. O
  5. * brief  EDMA3 Test Application8 ]( {4 q6 q# c% G) @
  6. *
    7 R) m- A4 N/ L
  7. *   This file contains EDMA3 Test code.
    ( s8 z' @$ F5 x  Z" O7 ~1 Z
  8. *& m. z5 B$ S; ^) T6 Y/ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) v. G$ P7 q0 M' w8 W/ J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Y) E5 T0 s- H; C8 ?  M5 f
  11. *         TO CHANGE.
    + W5 c! Q! v' h8 n, I6 l; a; |  P
  12. *( {% c! f- G/ W' I9 F1 T1 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . ?: {; K2 e' U
  14. *
    ! W9 _% S% y2 f1 p+ `2 E  j
  15. * This program is free software; you can redistribute it and/or
    " U. G( F$ k9 G7 r6 Y$ k" \8 I
  16. * modify it under the terms of the GNU General Public License as
    , [$ p3 r, _9 u* t0 u$ ?* L
  17. * published by the Free Software Foundation version 2.
    - N8 j5 p9 o6 F* d) _- I
  18. *
    ) u# }: A# ]! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 L( c) j0 S8 r3 f& \3 \
  20. * kind, whether express or implied; without even the implied warranty
    / \$ T7 B6 s( f" v9 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ F( U+ L1 Q9 C: O; g' Z
  22. * GNU General Public License for more details.1 b2 q+ I  R4 h( r. f
  23. */
    4 f: j& y( `1 W$ T* Z' m  c  D

  24. % j. a) A+ w% Y
  25. #include <linux/module.h>' j4 ]4 e0 T1 n* g$ m
  26. #include <linux/init.h>
    6 K$ t% m& V7 B$ [
  27. #include <linux/errno.h>4 [6 |; {0 G9 f& G1 S/ a1 b
  28. #include <linux/types.h>
    8 b6 }3 N4 C; ~4 f- e6 }
  29. #include <linux/interrupt.h>
      u5 E- h* m% D
  30. #include <asm/io.h>
    6 ~- C" v, \  n/ k& g6 n
  31. #include <linux/moduleparam.h>
    % E" x1 {5 w* ]) n
  32. #include <linux/sysctl.h>1 h7 V: _2 M/ [% I' `  V
  33. #include <linux/mm.h>
    - t# [' `  l- Z5 M6 T- j0 M
  34. #include <linux/dma-mapping.h>6 r6 u* i5 t" ?3 h$ F) }5 }* F6 U4 u

  35. / C; `9 n& j# w& x
  36. #include <mach/memory.h>! X3 c  N+ K9 |4 J$ R$ m
  37. #include <mach/hardware.h>4 V3 N' `  o+ R# d- t
  38. #include <mach/irqs.h>
    # q" D" g  a- l; C6 r3 e2 T2 p
  39. #include <asm/hardware/edma.h>% N5 l6 S" ]! B

  40. 3 ~' r  Q% l5 i" O2 J. |! ?
  41. #undef EDMA3_DEBUG4 D# F, e# S. H6 x  I0 p) l- r
  42. /*#define EDMA3_DEBUG*/
    7 M, N* f3 V; B3 e! S! t  V
  43. * h  Q) R9 _& s
  44. #ifdef EDMA3_DEBUG
    " N0 S( z' q8 O- M6 ]6 r; w2 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : q+ y  [$ v# W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). |1 O2 ~9 A1 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . A/ J( U+ H9 c, B, u1 W  y
  48. #else
    5 [) B9 n. d. M
  49. #define DMA_PRINTK( x... )
    ; N/ x8 j+ R* {# s0 U% Y% ]
  50. #define DMA_FN_IN
    * f: K( C( s# `" P, O: m) c
  51. #define DMA_FN_OUT
    - U$ z; Z$ E; w0 [
  52. #endif. }+ O- P# P* z- N' }9 C6 k

  53. . j/ |! z% ?0 p$ }$ V/ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). _6 C6 ^) g; C
  55. #define STATIC_SHIFT                3/ Z: z" u+ Y7 v+ _
  56. #define TCINTEN_SHIFT               20$ L6 @. y# ?% H5 D
  57. #define ITCINTEN_SHIFT              21
    9 p" _7 B0 G( J; ?: ]
  58. #define TCCHEN_SHIFT                22) A  g2 l4 R8 p
  59. #define ITCCHEN_SHIFT               23! r0 T* }" d* E
  60. 6 o2 D) C1 U3 @
  61. static volatile int irqraised1 = 0;. g  b* j: a6 x  y7 |; X
  62. static volatile int irqraised2 = 0;
    ( H1 `: P6 R+ @& Y+ y
  63. # ~7 {8 a2 u6 E9 L1 S) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: }- F; y2 y0 T% B  N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& c" t- j* |. n. q- {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _6 f/ f. S1 l4 O0 I& P

  67. 7 I! b: A) u3 e7 s' y! c
  68. dma_addr_t dmaphyssrc1 = 0;
    9 Z0 X/ M' _$ |  {2 m# U/ K
  69. dma_addr_t dmaphyssrc2 = 0;
    - q. I! O1 o; t( V
  70. dma_addr_t dmaphysdest1 = 0;. a9 b6 s  O( b
  71. dma_addr_t dmaphysdest2 = 0;
    ; j7 C7 X' A/ t
  72.   o: ?$ e2 e" `/ M  N! m
  73. char *dmabufsrc1 = NULL;
    # q$ N! |( a6 C' K- x. q: y
  74. char *dmabufsrc2 = NULL;+ [6 Z$ @5 n3 u9 s+ K
  75. char *dmabufdest1 = NULL;" o1 j) I; J, Z4 q$ d* f
  76. char *dmabufdest2 = NULL;# K* K' E5 F( @- v, ~8 t

  77. , n8 h1 h. l5 w1 f
  78. static int acnt = 512;* y% v) f5 E5 A$ A" Q
  79. static int bcnt = 8;" N0 h( a8 D" ^0 t2 a7 O$ |7 |3 k
  80. static int ccnt = 8;
    ; \% p2 n& T" ?- g' T+ Q$ z

  81. ) ]0 P0 `4 m( A# R4 V, M
  82. module_param(acnt, int, S_IRUGO);. O5 {3 z# ?0 F5 N
  83. module_param(bcnt, int, S_IRUGO);
    ( Z# \1 U& N* ?0 b7 ~2 u: Z% g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- I1 G" {6 ], J1 A; e% X4 [
7 M7 C" G2 |% r8 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p9 Z' k$ v+ p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 O2 j- Y2 x8 Q+ d: _) a' ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( `# K1 ?6 W  W  n, ]- i- f$ V

6 I2 L% O7 J' k& X# |
& H! m# I) ]+ e+ l% R* o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 03:15 , Processed in 0.040336 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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