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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A* h) ^8 b$ K4 ?' s
  1. [code]EDMA sample test application
    * u; [6 p9 B+ }) @
  2. /*
    : p8 K3 ~/ k% P. U; L. ^9 o& B: V
  3. * edma_test.c
    $ `7 H" l+ }2 }2 q  @2 G, a2 U
  4. *8 J* I4 U$ ?9 t: e7 P
  5. * brief  EDMA3 Test Application5 o) z5 Y. |) b- C, _- p. g! L
  6. *& [! u" j  a$ }9 O" ^4 j8 m+ h: u
  7. *   This file contains EDMA3 Test code.
    0 c$ A# _: [' o8 [; ~0 R
  8. *8 Q( [$ W- S2 v/ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^9 [* F+ |% F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ~, l' a, f# y* N0 {: N
  11. *         TO CHANGE.# F$ S  t3 s* L0 c
  12. *
    : Z+ H# u" l* K1 G" R, |4 r4 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Q4 D+ C+ a8 ~5 |1 S
  14. *
    8 B4 m0 X- y5 `
  15. * This program is free software; you can redistribute it and/or& b% [" G4 r8 u7 t
  16. * modify it under the terms of the GNU General Public License as* X+ i% b  Z2 G
  17. * published by the Free Software Foundation version 2./ R4 e  i2 N/ }, G  M% j  ~
  18. *) L/ g: j+ o0 ~& y# c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 S7 H9 n; c8 f' C+ i
  20. * kind, whether express or implied; without even the implied warranty
    # D7 [1 p8 _/ {. S! @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 D9 ]1 @+ O' T* h! G
  22. * GNU General Public License for more details.& ?. L0 u! r* U7 Y& Q; P
  23. */
    & Q0 I4 H: J) i: s1 U5 x

  24. ; @8 P/ v! S+ P- u8 g
  25. #include <linux/module.h>( y( U, I2 M) p, j+ {: `, Z
  26. #include <linux/init.h>' }4 o% j7 h3 U: t( Y
  27. #include <linux/errno.h>
    ! i& t) ?+ x3 W( l! @# c
  28. #include <linux/types.h>+ y$ H4 Z) ]3 l- ?
  29. #include <linux/interrupt.h>
    ( C& G( [# o  d
  30. #include <asm/io.h>
    * K2 r8 z2 `$ [4 P& j+ }
  31. #include <linux/moduleparam.h>
    + M: `4 X2 u9 k" [0 d* z6 v  i
  32. #include <linux/sysctl.h>; W1 m' q: W1 K2 o4 d8 c  r
  33. #include <linux/mm.h>  ^8 w; h1 R7 K2 @4 |$ r8 K
  34. #include <linux/dma-mapping.h>, i+ T0 }- N# M  E. t/ |
  35. . S" ]1 z$ O3 h7 a, g
  36. #include <mach/memory.h>
    - h$ }) @$ `( T( [! \
  37. #include <mach/hardware.h>
    ( R( `/ f* l/ @. G
  38. #include <mach/irqs.h>7 c3 w  D( s. R# R; i; a
  39. #include <asm/hardware/edma.h>
    0 @' g$ n5 I. [* S% J' j4 i( S
  40. & m1 y( F- V# U) z
  41. #undef EDMA3_DEBUG
    " P9 B2 c5 d# O- C' s" Z
  42. /*#define EDMA3_DEBUG*/+ m9 F) K& i0 _. |2 Q% j4 f

  43. 5 e* o! S0 D# e( M! v3 ~. g/ v8 e
  44. #ifdef EDMA3_DEBUG
    ! Q( Z; n; k1 }) t' z! @$ ^, z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # M1 R' W; i* }8 P6 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( Z9 @6 H2 h) g( c/ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) I& e8 y  {5 L$ X; Y! E0 C
  48. #else
    & {4 f3 D! b# Z* f* ]+ K1 [& D
  49. #define DMA_PRINTK( x... )5 u( U( m' }- X/ m& \3 o
  50. #define DMA_FN_IN
    ; e% \9 y9 g2 y( M/ K
  51. #define DMA_FN_OUT
    + p' }/ Y' e! c
  52. #endif
    / c  ?) j( h  F8 _! |
  53.   N, u$ B1 B; Z) E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 E8 Q' D* p3 P9 j
  55. #define STATIC_SHIFT                3) i# @" b0 i' @8 s7 Y. G0 t: p
  56. #define TCINTEN_SHIFT               208 x0 s1 o5 R) N, n. B; `8 J
  57. #define ITCINTEN_SHIFT              21) s; y# B+ @- m' C, y8 ~
  58. #define TCCHEN_SHIFT                22
    / F% j  J1 Y  y5 W( P3 k
  59. #define ITCCHEN_SHIFT               23
    3 n; @2 I) J4 Q/ C
  60. 0 \9 e: i: y) G! k- V/ P9 [
  61. static volatile int irqraised1 = 0;) Z! _# V# W8 G3 i4 ?! X; @! `
  62. static volatile int irqraised2 = 0;
      s7 _7 P, B# u9 P1 c: r
  63. 7 r. t4 [/ q# E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 d9 h2 b3 N! M! D% v2 W3 R/ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      d2 N& g6 K" h' t" m% C/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w. h- d4 [) w5 ?

  67. , Z* ]# i  N; T$ f( h
  68. dma_addr_t dmaphyssrc1 = 0;
    2 x9 D( [* s7 i/ J2 d2 z9 r/ O
  69. dma_addr_t dmaphyssrc2 = 0;
    8 P1 a& d* p: y' N# n" N' b8 z1 s  l
  70. dma_addr_t dmaphysdest1 = 0;
    3 _( |  Z) P2 [
  71. dma_addr_t dmaphysdest2 = 0;
    ! [( d/ q& o7 n! [  }& Q7 s& I: H

  72. " n  m1 H+ F9 d. j% g" b1 q2 _
  73. char *dmabufsrc1 = NULL;- C. |0 H6 c+ w6 o; d
  74. char *dmabufsrc2 = NULL;5 ^0 M6 E9 a  Q: V( w
  75. char *dmabufdest1 = NULL;
    4 {9 X& u  ]; `( j) N) N
  76. char *dmabufdest2 = NULL;
    + |4 k1 Y4 z" a( C5 ~/ \; S, b

  77. 4 H# N4 A4 x# [. m3 q* |
  78. static int acnt = 512;. w; Q: z7 g: ]1 A. g6 E  O
  79. static int bcnt = 8;
    2 W) z# Y9 |  }2 W3 t. @% W
  80. static int ccnt = 8;) j* C, t1 P$ A8 w# n3 ~
  81. ( H( ?+ w4 B' b& U4 z  h
  82. module_param(acnt, int, S_IRUGO);
    . R2 F. D4 i/ z+ u
  83. module_param(bcnt, int, S_IRUGO);
    6 s' z; H5 }1 |. V) W2 x( ^4 w. W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ y/ j0 U% Z5 I+ ^# A  h3 i
% m/ E6 M2 m" D- j* g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v, K* y3 X! `! [+ ^1 qarm-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# K0 J& q9 H  i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* q% \' g+ Y4 r. H2 Q. j- U
- x4 v# A+ `+ D" X2 [2 L% G
4 N" ~7 i# }; Q5 O4 ]" z0 _, L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 22:11 , Processed in 0.040355 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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