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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K& j& ^. M' L' }) `4 B+ [9 n
  1. [code]EDMA sample test application
    / b9 }. a2 Y% B& S' f) z2 ^
  2. /*" D- P4 \* T$ |6 A! l
  3. * edma_test.c
    5 k; O7 a- ^; Y" ?2 ]) u
  4. *
    + |4 N( x4 ^* j0 W( L& q2 \& ?
  5. * brief  EDMA3 Test Application' H  R5 A# \) M# p/ s
  6. */ k- Z% r2 p1 S
  7. *   This file contains EDMA3 Test code., U: S8 h1 P; m8 Y& ?1 P4 `
  8. *7 j9 [# g$ P, |  _5 p3 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 S7 n4 I6 e) Z" f) g2 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! q7 f3 D& p& j; b% P. l  I
  11. *         TO CHANGE.  u5 y- x5 k0 T1 e6 x
  12. *! ~- @- l8 J0 M4 H& v9 {, s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! }& K2 v* k( [, Z* _( T
  14. *  P& c' a& V; z/ x- M, N0 R2 x' Z
  15. * This program is free software; you can redistribute it and/or0 Z* V; }9 K% H) k) `) U
  16. * modify it under the terms of the GNU General Public License as6 [  R* w8 \( ^; p* U$ Q' l) H$ t; P
  17. * published by the Free Software Foundation version 2.
    : M: |% `9 Z$ i
  18. */ s; |3 I( t+ m' k6 h  i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f  b$ r: Q& T" {
  20. * kind, whether express or implied; without even the implied warranty
    . P$ n! P7 `7 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 `) l2 p. W8 m7 D$ D0 O
  22. * GNU General Public License for more details.
    # a2 c) [! C1 W- `3 G
  23. */
    7 f* S- O4 p/ a1 b: t- m
  24. 4 V# T# {% ^0 Y/ t
  25. #include <linux/module.h>
    2 {* `" l# b2 @7 }
  26. #include <linux/init.h>
    1 V  X, r* z6 F
  27. #include <linux/errno.h>" u- Y0 Q8 ~; u" {% ~! [
  28. #include <linux/types.h>
    : b1 p9 c8 n! P' _& ?2 n
  29. #include <linux/interrupt.h>
    - a% e: C2 o% R3 N3 p
  30. #include <asm/io.h>
    9 n$ v  z& L9 d
  31. #include <linux/moduleparam.h>
    # G* C( P+ O' H6 o( }3 e* K
  32. #include <linux/sysctl.h>, N5 n# v' o0 y! S
  33. #include <linux/mm.h>
      ?# }/ n% E9 L1 `: ~, [) S
  34. #include <linux/dma-mapping.h>
    6 n% i" V3 W6 d4 d( X% f) N  |

  35. 9 X7 A- A( F+ O& z8 V
  36. #include <mach/memory.h>( ~3 m8 d* h; |3 U4 l* N
  37. #include <mach/hardware.h>
    5 w, y" f  a$ s
  38. #include <mach/irqs.h>6 z8 n7 [4 P) d
  39. #include <asm/hardware/edma.h>
    1 H! A5 B2 z9 H5 f/ O0 W
  40. ; |( m' |  _3 g: J/ }% t
  41. #undef EDMA3_DEBUG
      n* [# E$ }, n4 Q/ w' [
  42. /*#define EDMA3_DEBUG*/: v2 c' |3 R) }+ i! o3 V
  43. 2 ~! Z% ^6 i1 T8 ~  t- U
  44. #ifdef EDMA3_DEBUG
    % W6 r0 K' o0 M/ ~# L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 Q7 u) E" a- q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& F: D8 V: }7 Z$ u2 U2 P% P% b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 U# S, L8 ^* w9 m, h' V
  48. #else
    0 i& Z. G$ h3 n! Y1 \$ N( n
  49. #define DMA_PRINTK( x... )3 z; T. s9 G/ v& ]
  50. #define DMA_FN_IN
    + \- a. j" O# {7 H$ A; {% ~
  51. #define DMA_FN_OUT
    8 g. M- X" F4 L6 h
  52. #endif
    8 C1 O) D9 N6 p. t. w1 Y; J; H, [

  53. % G' g. D* t6 H; X9 t1 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ]" m( {( O7 P+ b, c! a/ U, L& U( H  k
  55. #define STATIC_SHIFT                3: x. Y, W* b6 Y& S# R) W
  56. #define TCINTEN_SHIFT               20* U3 B% G9 l. ^# O; |+ o0 ^0 R8 P
  57. #define ITCINTEN_SHIFT              21
    3 g/ ^+ k8 e# d! }
  58. #define TCCHEN_SHIFT                22
    7 k2 X! Z$ ^4 E2 @% q. z  O
  59. #define ITCCHEN_SHIFT               23
    . ]  m. M' l+ q: _, U  j

  60. # c. B+ g  ?% o4 m8 ]
  61. static volatile int irqraised1 = 0;6 `) u$ E4 d# O; Q4 D
  62. static volatile int irqraised2 = 0;7 ]( R$ P' z9 a( G! n, {
  63. , R% s/ O2 P+ j4 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M! a3 X& Z3 y2 Z; ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i1 J# X+ d2 S/ F1 S  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m8 i4 ]2 o6 j9 w8 e( t
  67. : J, D) g1 x2 c8 g( P, ?; p
  68. dma_addr_t dmaphyssrc1 = 0;4 t7 `2 j" a, p4 {
  69. dma_addr_t dmaphyssrc2 = 0;1 X& l$ [( y+ k
  70. dma_addr_t dmaphysdest1 = 0;
    / B* S- g1 I7 \4 T+ _2 u$ |
  71. dma_addr_t dmaphysdest2 = 0;
    ; r9 t4 D" ]0 X3 e

  72. ; V2 \' ]# v# n$ M; l  Q
  73. char *dmabufsrc1 = NULL;4 j6 g  V0 Z, u  B! U: W
  74. char *dmabufsrc2 = NULL;
    + o+ g- ~3 @3 n0 l  Z
  75. char *dmabufdest1 = NULL;" Q8 G, I5 \8 W( T- ~; ^* @- V
  76. char *dmabufdest2 = NULL;& H1 a' G: D0 I, ^
  77. - t4 i+ ]' U- o
  78. static int acnt = 512;8 `. F/ J/ J. o: z
  79. static int bcnt = 8;
    . t( E, F2 R& Y6 y  r! L6 `
  80. static int ccnt = 8;
    : h$ }: C7 r7 O9 }' B/ Q

  81. 9 t0 S( ], t/ n+ E/ w
  82. module_param(acnt, int, S_IRUGO);
    ' T( m- O  q& t0 r+ `
  83. module_param(bcnt, int, S_IRUGO);
    ' K/ L/ \6 w- N' t3 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( V3 n9 ^  y$ Q' E) @

( U& {0 Y+ `; G4 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. ?) t. s" Q! Y: @4 @/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 j7 G+ [: Q" u% `5 Y' _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b* @& {3 w* D" W% G6 j
9 M. e0 E0 Z& I$ D! X0 E! _0 i' ]
- E! p$ K  ]' o( ?  C. L) L0 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 17:07 , Processed in 0.037970 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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