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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) b3 K  f& p3 k3 N1 o2 W
  1. [code]EDMA sample test application# x. \7 P" O, Q# F) @) B6 S* [
  2. /*
    5 d- T, F0 Z5 d2 U+ G
  3. * edma_test.c
    : i4 g0 u. _" \$ g) b
  4. *
    $ E- G/ I0 q+ [3 |
  5. * brief  EDMA3 Test Application
    7 k7 F6 ?% B* Q  H# X
  6. *
    9 x9 i. ^( c% h0 X0 d" E( V0 Q0 S
  7. *   This file contains EDMA3 Test code.( m) ~& G9 Q) _% d# a
  8. *' J1 x1 f- y# y/ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ?- m0 ]  K" R* N6 q0 f$ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: d' ]# }4 @2 d7 l3 k; r
  11. *         TO CHANGE.' u0 ?# g$ o7 E. ]+ Y
  12. *
    8 x5 D. o3 }. O4 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 v4 @) i0 G( a, T& h# U
  14. *
    3 i( a7 C1 Z+ M+ |
  15. * This program is free software; you can redistribute it and/or
    $ D+ s: e, M! q. `
  16. * modify it under the terms of the GNU General Public License as
    : T1 u* x  N  |# k9 H4 B" O
  17. * published by the Free Software Foundation version 2.
    ! e9 v! [, H( O) N$ u' y7 q
  18. *: J  L8 x5 R. S% q7 Y4 ~# {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 e" A2 Q1 L5 C% a
  20. * kind, whether express or implied; without even the implied warranty
    : s( O: [2 a8 G. O; D3 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) o# d0 }& ]8 X# u8 g. o6 W
  22. * GNU General Public License for more details.
    " s: [0 {8 X7 i8 P: X. v: v8 d
  23. */
    8 {" U- G" H" S) H* k  ]7 p

  24. / t1 z. a/ F8 K8 q& z$ x; o
  25. #include <linux/module.h>$ w$ @* N( p0 g" C8 V5 v5 ~
  26. #include <linux/init.h>  L2 y. U5 d8 @
  27. #include <linux/errno.h>
    4 t# W" h0 D+ h& Z
  28. #include <linux/types.h>+ [9 H" p' i1 M9 g* v; @2 E% F
  29. #include <linux/interrupt.h>; b' c# v! ?$ W" m% W/ k/ s
  30. #include <asm/io.h>
    % e# n; R# z; Z" L# u. r( ]1 b
  31. #include <linux/moduleparam.h>" R( g0 C- `/ y6 r
  32. #include <linux/sysctl.h>
    - L5 m: K2 ?0 k# z/ N: E* y  `
  33. #include <linux/mm.h>
    . @( y8 i1 ~/ e2 s# }8 p) K
  34. #include <linux/dma-mapping.h>
    ; c8 y2 R% U$ x" J) L: ^1 X

  35. % ^+ k  ?9 L0 y
  36. #include <mach/memory.h>
    3 ?% ?7 d0 e2 a7 w4 w
  37. #include <mach/hardware.h>
    6 e& Y/ k+ W7 _( I
  38. #include <mach/irqs.h>/ x( A8 N: o% c3 ]4 O
  39. #include <asm/hardware/edma.h>
    ( d) V, z8 P& G/ q: }* [9 D0 m- u

  40. ' n  i4 y, V/ H1 y" H
  41. #undef EDMA3_DEBUG  S6 v/ b! g5 U" B/ A* b4 R( Y
  42. /*#define EDMA3_DEBUG*/
    $ w+ g- ^9 P9 `* }7 ^, L' O

  43. 6 P1 @, X1 C; q5 y! C
  44. #ifdef EDMA3_DEBUG
    4 T- w- F0 m: j( O$ B0 g+ r! O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 M. b! y7 q# S1 o" B% k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 |' g/ |/ p! S+ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): v" `1 Z  i6 _6 d- O- F( L: e
  48. #else5 ]4 H  p' {9 Q/ Z  B. n2 W
  49. #define DMA_PRINTK( x... )/ t$ E7 j/ B; w+ l9 P
  50. #define DMA_FN_IN  }, V* I: m. V2 A/ p# d% \
  51. #define DMA_FN_OUT, U! ]) t# y: H
  52. #endif( ]( n7 J5 n( n8 @( P" h
  53. % J  L/ E, M, Y/ p# Z  A( x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . x. }5 k2 s+ {  [+ L+ a7 O
  55. #define STATIC_SHIFT                3
    * ]+ O& d/ ]" Q, `/ Z
  56. #define TCINTEN_SHIFT               20# V" O, ]" S$ _& G  P0 }' b% S
  57. #define ITCINTEN_SHIFT              21) n, H( _, z% J& a  E1 {
  58. #define TCCHEN_SHIFT                22
    ' Y0 m# }' |( j' r8 z( k" H: n- P
  59. #define ITCCHEN_SHIFT               23, c* n+ \8 g: D0 N9 o0 W

  60. ; A7 _) x- Z) H
  61. static volatile int irqraised1 = 0;: M, M" {+ W% D+ b" q, E( H" G
  62. static volatile int irqraised2 = 0;2 O- P2 G& k* Y% H

  63. 4 b# F4 @  ?( q6 \0 ^& @+ [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q2 f) U1 o. _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + P3 }6 @- }7 K* _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) F2 v- c, x4 d7 v- K) _6 F( K

  67. 7 c) x% `9 A) N$ i0 L7 h: d5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    0 ]2 W! }2 _# M; h
  69. dma_addr_t dmaphyssrc2 = 0;) u1 z) R' X: k0 d9 T1 `  M
  70. dma_addr_t dmaphysdest1 = 0;/ F9 N9 l7 [  {! A. A  A" W
  71. dma_addr_t dmaphysdest2 = 0;$ B+ a" Z* b5 W7 f8 T% F* P* Q
  72. : f  R4 c9 l( q! M. O
  73. char *dmabufsrc1 = NULL;
      i4 I8 n& G# S! e  D+ ^6 \
  74. char *dmabufsrc2 = NULL;
    ( F: i+ v- m  p/ M  |/ g6 u) C
  75. char *dmabufdest1 = NULL;6 p/ H: @- n) T3 H6 k  ]) ~9 A
  76. char *dmabufdest2 = NULL;- K( A. f$ B) e( m+ ]! P# _$ K
  77. ' [- t: A& o; c' H; `5 K0 ^6 E4 w
  78. static int acnt = 512;
    2 F2 X0 R+ p- R8 n  K- _, D
  79. static int bcnt = 8;
    # e% Z  V0 d" r. s
  80. static int ccnt = 8;
    0 L  E* I$ U- V/ L; S! d4 K

  81. 5 q$ \) j2 q( ^! K2 d: O" ?- L
  82. module_param(acnt, int, S_IRUGO);
    $ e7 ^; o. M" b  ~2 b  `
  83. module_param(bcnt, int, S_IRUGO);
    ! V4 O4 }& S8 M' f6 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 {! X/ }/ b4 T  ?2 X" I  m% b$ a% q) b8 B% j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& U7 \, }5 c. @% H) Z2 q. o( S" darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 `9 S7 c* d1 u  W& V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. V; Z1 x4 C: {! w, e/ T+ L
  @& r9 ~3 r: i
1 V3 a/ |1 ]! ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 12:00 , Processed in 0.038139 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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