OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* M* }5 ?4 D) F7 ]1 _+ T
  1. [code]EDMA sample test application
    / y, m4 A2 ^6 M
  2. /*
    # \( S: H3 ?0 W9 ^4 ^- |3 I
  3. * edma_test.c2 B  Y7 U& ]! f/ x9 s% P' U
  4. *
    0 F! T1 F" r7 X. i8 C2 m$ I3 k
  5. * brief  EDMA3 Test Application6 Q+ x' Z9 a7 _! S2 b5 K
  6. *) d( {. R# v, {( v9 I) M1 a
  7. *   This file contains EDMA3 Test code.
    - @) `" S- r' T+ P
  8. *% W7 X4 n$ c/ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 P2 ?6 l- r* J# ^$ G  `9 W0 D* ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R( P6 M! |! V/ Y; z6 F
  11. *         TO CHANGE.
    8 _7 H4 I8 `/ P3 b4 _& l. r( X* Q
  12. *
    " M3 n7 b: \4 s2 ~7 c/ u/ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # v* f5 o6 S! v% D0 f6 b
  14. *& ]7 d/ F4 |: _9 P& K# p5 b
  15. * This program is free software; you can redistribute it and/or! C5 P. K: }$ Z, [" P
  16. * modify it under the terms of the GNU General Public License as4 n4 p# B) T+ A9 L" w
  17. * published by the Free Software Foundation version 2.* z5 P# [- H+ \; i" U4 n
  18. *
    9 Q) Y0 _1 m- b" B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      i* V4 a  j9 W" D5 E
  20. * kind, whether express or implied; without even the implied warranty' a, K" [) e$ Q: l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 j0 E  p: h( b0 [
  22. * GNU General Public License for more details.! f  ~. K3 C6 S( m2 C# o
  23. */5 P) w) `  ~- D; P$ _

  24. 2 y2 {+ r: T  G; K& @; `
  25. #include <linux/module.h>
    , H! }* ?* r) a! s+ K3 z3 n
  26. #include <linux/init.h>$ A7 U% W: \- f9 `1 y+ X
  27. #include <linux/errno.h>3 U' l% H4 l8 w# ~
  28. #include <linux/types.h>; b. B% X4 u; X3 F+ P; j0 }
  29. #include <linux/interrupt.h>& b/ K) Y/ s. G% X* V
  30. #include <asm/io.h>
    $ v" U; U" j1 b
  31. #include <linux/moduleparam.h>5 J8 V3 X* [4 s! }* ~# P6 {
  32. #include <linux/sysctl.h>7 ^3 \7 e; o" \( ?, ?8 X
  33. #include <linux/mm.h>
    & p7 T, Y" G$ S8 d2 C0 p
  34. #include <linux/dma-mapping.h>
    9 F" g  y1 ^7 s! F/ f5 |2 y
  35. * {: c% ^! l% c2 w( `: Q
  36. #include <mach/memory.h>3 U% C0 `3 A3 t6 P& F$ _6 p6 P) Z
  37. #include <mach/hardware.h>) h% k- S/ O! l4 j$ i; f! _6 {( h
  38. #include <mach/irqs.h>
    % l5 a5 F4 E* P( @' ?
  39. #include <asm/hardware/edma.h>. [( j" c8 e& B( l. I
  40. & g) Z; \/ z$ W: m/ }
  41. #undef EDMA3_DEBUG4 a7 z5 I' D, x7 F
  42. /*#define EDMA3_DEBUG*/5 H: u8 x; R" F( D( ~
  43. 5 k1 C( T+ t6 l# m' p+ J$ b2 g
  44. #ifdef EDMA3_DEBUG
    3 h! h+ b' b! d' K3 b, B) @" E# ^1 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), v" ?# v2 I1 Y) |# R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 K0 R6 D4 F  P% {8 ?3 S5 K- l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " O; O/ l( c9 v; I
  48. #else1 ]" Q3 Y+ ~: |. u# F: @
  49. #define DMA_PRINTK( x... )( o" i7 w7 E( }6 ]
  50. #define DMA_FN_IN
    ; `8 p  \9 ?9 l
  51. #define DMA_FN_OUT
    4 _' U* c! r( `. ^
  52. #endif. ~; J1 X* o: q$ d

  53. , o# \6 a& ~( j  [  ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ]) k. j' U  c, I- o
  55. #define STATIC_SHIFT                30 @0 m. E9 R7 C
  56. #define TCINTEN_SHIFT               203 ?$ J( X# J5 d  J0 d! b2 m/ V3 s
  57. #define ITCINTEN_SHIFT              21
    : ], o& {2 A+ \( p( c' Q+ {8 @" N! r
  58. #define TCCHEN_SHIFT                221 J* W5 ]  @5 f% p" x) L
  59. #define ITCCHEN_SHIFT               23
    " f; @! J4 H5 U) a" [

  60. / K: u$ H6 g) N6 `( w- ^* X; H: [
  61. static volatile int irqraised1 = 0;$ r( ]5 W" p1 w0 a: k1 ~
  62. static volatile int irqraised2 = 0;
    6 ?7 i6 @0 [% U/ d% q; u/ h
  63. , X! _8 A9 z/ W4 A" {1 X. i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y+ w7 R' P( g1 H- r8 }" |) m+ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F7 l2 {. t1 o) v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 e/ _$ ~% p/ ?$ L3 E8 X% ]

  67. , A2 q" n6 I9 F/ }  z$ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    * f- l5 w- D/ n2 O$ P: G
  69. dma_addr_t dmaphyssrc2 = 0;1 ]2 I5 b" `8 D% d: n8 b
  70. dma_addr_t dmaphysdest1 = 0;
    " t" ^* q/ e7 u$ A# X
  71. dma_addr_t dmaphysdest2 = 0;
    % N' Q) O  z; f

  72. . T7 Q8 x: K6 N/ P8 j2 D" ]" _
  73. char *dmabufsrc1 = NULL;
    0 L- q) Q0 F* P: e7 d
  74. char *dmabufsrc2 = NULL;/ \: P3 R7 H6 V( B* B
  75. char *dmabufdest1 = NULL;$ Z5 f9 L" `* b- ^/ g
  76. char *dmabufdest2 = NULL;
    - r6 c. P, V. `0 _* y# e" W
  77. - ?" ]; C9 g# W9 C
  78. static int acnt = 512;
    2 Q6 w6 n: ?, {3 l
  79. static int bcnt = 8;
    4 r, v) l* M+ H, O  A$ E& b. |
  80. static int ccnt = 8;
    6 E& |5 u7 ~( |( F

  81. # E1 j7 [1 R  a+ |
  82. module_param(acnt, int, S_IRUGO);- g2 ~* O  c- L
  83. module_param(bcnt, int, S_IRUGO);
    ( Q: o* ?' k  J4 m, z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: y3 a7 M# I" \3 B
4 y  I3 `) i% _# ]" }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 L; w0 @/ H* ]0 o% p$ V$ R9 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 |' G! k7 t3 r$ S$ z# ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' y1 {6 c6 e( O" X2 i4 Y# X9 k/ w
7 o/ p8 t1 }! J4 L- Z+ @! d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 11:26 , Processed in 0.042520 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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