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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( l7 `9 C9 N  l
  1. [code]EDMA sample test application
    $ g8 v6 p" {$ I) f
  2. /*7 u8 K, `2 r1 `
  3. * edma_test.c
    1 O' i0 s# B3 N  {- k
  4. *
    8 A! v! ^* p* g* v. H
  5. * brief  EDMA3 Test Application" t" t6 t6 I0 A! v7 f) Q9 u0 u
  6. *
    3 ?* S3 Q: Z* {: J3 _
  7. *   This file contains EDMA3 Test code.& e( p) w; ?$ ~: ^$ E5 c- m/ Y
  8. */ b; X2 ~5 C3 u5 @, Z2 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) M" W3 S+ f4 O( ]- Y/ a/ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % k& M3 \7 Q7 k, V8 V, y8 @% e  N
  11. *         TO CHANGE., x5 A% b. J+ w9 m3 N% f
  12. *
    ) @: p9 l5 X. `" v) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 d& v2 P# C7 m" R3 ^. ?3 c5 V
  14. *9 }7 v1 n3 x' i3 [5 P+ z9 G
  15. * This program is free software; you can redistribute it and/or
    , ?) B; i" v3 A# s" r4 c3 `
  16. * modify it under the terms of the GNU General Public License as) ]+ a" A! ]9 |+ m$ x& g" `2 |9 {
  17. * published by the Free Software Foundation version 2.
    0 z/ O, p' E3 ?# r3 c0 _
  18. *
    ( h* q' b/ ]$ y6 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # }8 L" i8 l( r, \6 J+ p
  20. * kind, whether express or implied; without even the implied warranty
    1 J, z8 ^( p! t: F6 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * g- h* i+ P7 w7 ^6 U5 S$ `7 k
  22. * GNU General Public License for more details.5 q1 n3 k4 S( E$ @2 b+ B7 V
  23. */
    7 q% {  l9 f  I, _6 q8 F

  24. ) z: r+ S4 b! c9 n
  25. #include <linux/module.h>/ l' D8 W9 I: Z1 X" d1 U* M
  26. #include <linux/init.h>9 ]: I5 K( Y2 Q! p5 Z6 D$ ^" k
  27. #include <linux/errno.h>, h1 W/ }8 [4 f7 Z1 r0 j  ^: y  f
  28. #include <linux/types.h>  v' P+ ~7 E* \% [
  29. #include <linux/interrupt.h>
    7 f; k! y9 c9 W9 ~' C
  30. #include <asm/io.h>
    4 f  Z* y/ k/ \/ D
  31. #include <linux/moduleparam.h>6 j- V( p8 s! d% M: C- p$ H
  32. #include <linux/sysctl.h>- P! k" {+ i5 y0 N( d
  33. #include <linux/mm.h>
    0 @( W; U- L0 ~. ~1 t$ P2 J* H
  34. #include <linux/dma-mapping.h>
    + t" M) R9 O" V- i* e, R# T
  35. 5 _& Z9 S: ^& L
  36. #include <mach/memory.h>$ h& M1 j, ]1 p! ^( j
  37. #include <mach/hardware.h>. y( W5 C) Q, P0 f/ n3 \
  38. #include <mach/irqs.h>: D& W% z+ F- S
  39. #include <asm/hardware/edma.h>
      H( J. l: h2 i- `* M! L
  40. + @+ W3 k+ y. u0 D
  41. #undef EDMA3_DEBUG
    * R, K  w" o5 }5 Y' ]) q
  42. /*#define EDMA3_DEBUG*/: F1 W9 Z7 ]" U- i* f2 Y4 L' l
  43. 7 J1 k2 ]& r% h4 s1 w
  44. #ifdef EDMA3_DEBUG3 g" S# z. E" n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 k, a4 ^1 L* [8 [. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 f) y" E, E- o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  V; S8 J  \, `' K! u
  48. #else
    3 z- Z/ |# b3 @6 I, {; f
  49. #define DMA_PRINTK( x... )! B4 N% p- S5 P8 k
  50. #define DMA_FN_IN
    7 `2 x  q) I4 [/ @6 Y! A
  51. #define DMA_FN_OUT
    " z. B# M7 b: c1 C% D3 }
  52. #endif0 e: Q8 \# ?( `! \/ _9 V0 G
  53. & J# }$ A& _  y! K* B4 O8 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " u$ w6 i  x/ W, h
  55. #define STATIC_SHIFT                32 [- s" ]- ^% J* P+ H& ~
  56. #define TCINTEN_SHIFT               20
    9 ~, l$ K' c! o; q7 M" D
  57. #define ITCINTEN_SHIFT              21
    " v3 O& [8 f) ~  E( k3 e
  58. #define TCCHEN_SHIFT                22
    3 F* e# u5 m: H' W1 @6 ~* F! W
  59. #define ITCCHEN_SHIFT               238 j0 N/ n/ q2 _

  60. - C3 u( V6 ]* f3 A. b
  61. static volatile int irqraised1 = 0;8 t3 j4 q# {1 |# S  W/ r
  62. static volatile int irqraised2 = 0;
    4 \4 D$ a" j) t5 O( k# f

  63. 5 P# u$ B# k* X6 `' x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ e% A0 B- |( }5 s+ I9 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * M3 P* I. d8 P4 G5 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q' Z3 i( O* o1 `2 ~* {9 n! O5 ^

  67.   W# Z- h1 U: `* @
  68. dma_addr_t dmaphyssrc1 = 0;0 G$ I9 n* }) a" C9 i! [5 N1 C. i
  69. dma_addr_t dmaphyssrc2 = 0;1 ^5 `9 @, M' A% q, h- A
  70. dma_addr_t dmaphysdest1 = 0;1 W  {1 |# {0 g6 r
  71. dma_addr_t dmaphysdest2 = 0;
    9 j9 o. T1 ~. ~. f
  72. / j0 m0 Z; ]/ I. b) U
  73. char *dmabufsrc1 = NULL;, d  f- G0 b9 f. f& ~+ d( I5 _
  74. char *dmabufsrc2 = NULL;
    ! i. i% g( y3 Q0 P. i2 b
  75. char *dmabufdest1 = NULL;
    8 y7 ~0 y- V( r2 S7 H* ?# B2 ~
  76. char *dmabufdest2 = NULL;- a7 g8 X1 }5 B+ N  I/ c

  77. ; |% L- `0 O; h5 R& B: F, z: m4 @
  78. static int acnt = 512;
    ; c2 c) w5 M5 ]
  79. static int bcnt = 8;
    9 h5 a2 m7 M# V7 @% D
  80. static int ccnt = 8;! _+ M/ E* X1 f3 z7 Q

  81. 2 V2 ~3 G. Y0 D9 \
  82. module_param(acnt, int, S_IRUGO);1 n& W# w1 A4 h, I2 C# h5 g  W" v! L
  83. module_param(bcnt, int, S_IRUGO);
    % W0 t) S1 Z* }1 ?1 I6 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' i2 M, U" D2 B3 D- n/ G0 ~/ t
1 G# G6 _, M  T6 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |; w) Y9 W+ n; _; P- E
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 f( e) o) [, ]! h% M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* e1 @  d* C( Y8 p) m$ I6 z
' I5 r" F1 B9 A& U& ^9 d: T
* t' @3 c6 |. k; {1 t! k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 05:59 , Processed in 0.037244 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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