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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * _% k! \( S- [& e2 A4 s! p
  1. [code]EDMA sample test application
    / Z5 b% f, i+ a
  2. /*9 Y' l- X- v/ d
  3. * edma_test.c
    7 \6 ~) U7 X- F+ P- |5 u% a
  4. *, \4 `8 F2 U+ o% X. t; k3 v( v
  5. * brief  EDMA3 Test Application
    9 D4 J5 _3 N0 w
  6. *
    ( T5 [( l" v& y0 M- C- T
  7. *   This file contains EDMA3 Test code.
    ! o( X# H1 |1 X4 ?9 f2 L
  8. *
    % u9 e+ E5 j3 n" U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 B3 L5 \* S) }$ h4 X0 F. P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; B2 H( X9 Y: v  e6 m
  11. *         TO CHANGE.
    4 ^5 b( S" i0 f: [3 s
  12. *
      h! q6 d& R. W4 w/ w, d. U  `* q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _: r/ K- V. J# x0 G
  14. *
    - ?& M2 G  X( Q
  15. * This program is free software; you can redistribute it and/or5 A4 g  P2 _' C1 Z, g5 \9 i
  16. * modify it under the terms of the GNU General Public License as
    4 W; E8 z# V9 j: M
  17. * published by the Free Software Foundation version 2.
    6 Q1 n( v8 X5 {% }1 [. f/ A2 D. \
  18. *, U9 q, E7 y4 w; J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ E- U2 Z) M2 R" {' o% ?
  20. * kind, whether express or implied; without even the implied warranty8 ?+ ^$ u0 n0 {. k* w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! m  Q- U4 I' i$ T* H
  22. * GNU General Public License for more details.# f& q& M( v9 M
  23. */
    1 ^- Z; y# X1 g7 I

  24. 6 X$ A" u0 M. x/ t2 Q/ C6 }% Z
  25. #include <linux/module.h>* o& P1 c) c9 y+ w# B+ Y: f  s
  26. #include <linux/init.h>9 r& v  M0 E; Z1 c- ?2 x
  27. #include <linux/errno.h>$ s9 l; Q3 ?; f# {7 g
  28. #include <linux/types.h>
    , O- O, O# o& V
  29. #include <linux/interrupt.h>
    ; p: o* }4 s) Y1 X7 P
  30. #include <asm/io.h>! F) |3 A8 [! `1 L/ I! m. f" p
  31. #include <linux/moduleparam.h>
    ) q, n+ u2 H0 C4 g2 Z
  32. #include <linux/sysctl.h>
    ! p3 |' T/ D4 s. F
  33. #include <linux/mm.h>
    , G7 ^5 s3 W- L
  34. #include <linux/dma-mapping.h>" i: m! |" n. P+ J9 P. B

  35. $ J! d' ^2 N2 s
  36. #include <mach/memory.h>9 z4 k% ~  v( E, \
  37. #include <mach/hardware.h>
    , d0 t9 D& _" x: i! t
  38. #include <mach/irqs.h>
    0 X* R( N( |) x! S- L
  39. #include <asm/hardware/edma.h>8 ]. ^* H0 K$ O
  40. + _6 R: R- `" w, f) d9 [* ~$ `# _- O# J
  41. #undef EDMA3_DEBUG
    9 q% H3 o, B! h! ?% R
  42. /*#define EDMA3_DEBUG*/9 p: e# }! |8 i

  43. ! a' K7 X0 l2 e& y3 q
  44. #ifdef EDMA3_DEBUG% {! q- s& @1 v$ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ?0 M/ I/ L% k2 k& L  n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      B* V( J" g) r2 U4 N+ U9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 r& N& t4 z$ f4 \3 D* a0 T
  48. #else6 U' u& S& e( p3 ~1 G
  49. #define DMA_PRINTK( x... )
    6 C% B0 `! J+ o; |, x/ U& p5 Z- f0 i7 ]
  50. #define DMA_FN_IN/ }2 L' P1 _: |! w5 R7 E
  51. #define DMA_FN_OUT
    : z; H' [* q  V9 c. [
  52. #endif
    ! {1 v# r" ~7 V: I' [/ N8 }8 G
  53. - M, H; N/ V2 s9 ]* G0 I" f3 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): D9 \+ d2 G; F7 j8 q% ?
  55. #define STATIC_SHIFT                3* j6 W/ S0 i7 ~5 \
  56. #define TCINTEN_SHIFT               20& H+ f, A( g% ^; M
  57. #define ITCINTEN_SHIFT              21
    ; C) U( d& E3 b6 f
  58. #define TCCHEN_SHIFT                22) H$ ^1 z- }% z# n
  59. #define ITCCHEN_SHIFT               23
    ! E7 ]3 N) e/ ?4 D5 N  {5 q0 L1 H3 r

  60. ' h7 v* ^8 @5 W* D
  61. static volatile int irqraised1 = 0;
    & m0 J% n! K+ i+ j) A
  62. static volatile int irqraised2 = 0;
    9 S2 u: `9 ^( T+ G! _

  63. 2 v; N" [! A3 ?/ _+ [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      R( }! Z4 E+ k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - b& o) [% D0 \4 l) e( M% V# y$ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ |& ^. a# x6 a$ C, o
  67. 3 S+ Z) u  U" }  S( _9 |" x
  68. dma_addr_t dmaphyssrc1 = 0;
    6 L7 X6 w8 d# z5 X. W/ t: a
  69. dma_addr_t dmaphyssrc2 = 0;7 n8 K( U$ t9 C7 i( r2 V( a. J( S
  70. dma_addr_t dmaphysdest1 = 0;" n" ^- [- x' [) l4 p
  71. dma_addr_t dmaphysdest2 = 0;6 }. n" b1 v+ c3 Q- X  `9 o  ?

  72. / A; e) ~8 y9 x0 }
  73. char *dmabufsrc1 = NULL;
    3 @' g) w! q& e) p$ W$ o% S8 V0 k
  74. char *dmabufsrc2 = NULL;
    ) K. J( \1 a# g7 X1 P0 v( }7 ^: O
  75. char *dmabufdest1 = NULL;$ I2 |2 P+ X; A' P; R( K1 @7 W
  76. char *dmabufdest2 = NULL;: c1 l8 U  ~* p* V* r( z

  77. # ?) `1 c. F0 T6 g/ j2 w- B! c
  78. static int acnt = 512;! e& T( F% ^% b0 H9 v( ^9 b
  79. static int bcnt = 8;/ I" |. W! ?( i
  80. static int ccnt = 8;- j$ |$ i. Y4 f6 U8 Y

  81. - t1 V( j2 w3 Z5 g; v
  82. module_param(acnt, int, S_IRUGO);. n2 v, b# }' Z8 M, b
  83. module_param(bcnt, int, S_IRUGO);
    2 o7 t. ~3 s# v) Q. E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* p0 x& H3 @( r

4 J$ h( t2 m/ x7 G. S+ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q) k% R7 i( J' narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! e$ D* w9 y' ?6 a4 K- r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E6 H! L* _( a9 K/ M" C. C5 o- @  _( z+ p0 S, R

9 J) N' k: V' z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 23:21 , Processed in 0.039154 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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