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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Q1 x0 a  j5 {- e( g6 }. s
  1. [code]EDMA sample test application! M6 Q/ g, D' g' X+ D
  2. /*
    $ H7 V  J6 x( ]8 Y; z
  3. * edma_test.c
      |- w4 c! j( S& u
  4. *
    9 Q# x( ]0 E  |# R
  5. * brief  EDMA3 Test Application2 z5 F6 K$ ~  K* b+ Z
  6. *3 h! S6 L1 B% H) r+ R" b3 x! v; O. V
  7. *   This file contains EDMA3 Test code.2 f0 d2 ]- e! M; @5 B
  8. *
    ( D  M/ C) w- f! `1 [( j! d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 s+ t# N& t" C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ^1 p2 N9 r& i2 K/ G+ G# _3 F
  11. *         TO CHANGE.
    5 d6 Y( ^8 u& E: }: S7 `# Z6 x
  12. *
    * n( j& a1 t, e& |! _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 w  L% R) I- b
  14. *
    - n" U, }2 r6 n, b  f1 J& q3 `' k# `) _
  15. * This program is free software; you can redistribute it and/or
    0 {0 L% X: X$ |
  16. * modify it under the terms of the GNU General Public License as
    * @5 Q7 {# }, N* r& N
  17. * published by the Free Software Foundation version 2.
    / R" l- q' U. z
  18. *% a: o' A' `9 r, b5 k# y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  |+ O3 G" B+ \% A8 r6 q* P
  20. * kind, whether express or implied; without even the implied warranty* e) y% o! D8 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 G. _  N3 q# x. M( _+ b. x! u& ^9 [
  22. * GNU General Public License for more details.
    $ q  r! L+ }5 L" R
  23. */) V( m  F4 P  i) @* ?( L' B
  24. % J# l* Z8 w8 l
  25. #include <linux/module.h>
    4 v' Y( y- L. s! r' G2 q
  26. #include <linux/init.h>
    8 q4 z8 ^% w- p0 B  s0 f3 h- A( @
  27. #include <linux/errno.h>. p" {. F$ G0 @+ G% F$ t
  28. #include <linux/types.h>2 S9 k" u4 D; I; u
  29. #include <linux/interrupt.h>9 o8 Q, e9 ^9 q
  30. #include <asm/io.h>5 G: Z# g9 N% J7 \
  31. #include <linux/moduleparam.h>
    6 Q' _1 `& B6 M
  32. #include <linux/sysctl.h>
    % [9 G4 Z# n. f5 `
  33. #include <linux/mm.h>4 H/ P  G/ T9 ~( _7 X
  34. #include <linux/dma-mapping.h>
    ; M" {& ~1 [1 ^! b$ r" G2 r% d* r
  35. 7 n/ n9 A8 H+ S: A
  36. #include <mach/memory.h># n, A. c: R3 e+ Z- ^
  37. #include <mach/hardware.h>
    ; @# F* y$ |4 x  ^& D# ^( @' ?
  38. #include <mach/irqs.h>
    2 g( ~$ v, k; [, B2 E
  39. #include <asm/hardware/edma.h>
    ' ^0 n8 x9 \0 V: m+ P
  40. ! t0 ]8 U3 o$ ^! l, l4 J
  41. #undef EDMA3_DEBUG
      @( B' a4 y& h8 u8 Q$ `
  42. /*#define EDMA3_DEBUG*/* X8 w- P/ i  N6 q

  43. : ?. F+ K7 ^1 W& R" Z5 c
  44. #ifdef EDMA3_DEBUG
    & \; K" A2 \; x7 f8 e$ Y% g' E  u* x4 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , S3 }/ A. ^- d* z+ u( x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), N0 [/ z8 H4 M5 j6 x$ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# `3 j7 w- h8 W4 r3 l1 G/ \
  48. #else
    6 ?7 [  v" d6 s7 P
  49. #define DMA_PRINTK( x... )
      ~# N. P0 s$ t; Z1 [1 W
  50. #define DMA_FN_IN
    5 m  M* J% D* ?. R) d9 i
  51. #define DMA_FN_OUT
    ' A5 D, X& J) g( {6 J9 @+ J) @
  52. #endif
    1 L2 o! r9 c- g
  53. & L; U! k7 h$ [  @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - L) U" W3 e, O  @7 m$ N4 L% U& p
  55. #define STATIC_SHIFT                3
    . A+ v; u  P5 j5 E
  56. #define TCINTEN_SHIFT               20
    1 B4 V; H4 ?4 `: z
  57. #define ITCINTEN_SHIFT              215 T9 m, B- @1 \
  58. #define TCCHEN_SHIFT                22  |! B2 v) G5 K; s+ h3 o
  59. #define ITCCHEN_SHIFT               23
    - ^1 L& U2 @, N. T
  60. " t1 d5 o4 F, Z! ^! d6 V; p
  61. static volatile int irqraised1 = 0;
    * e! f. c/ @+ b' P1 t
  62. static volatile int irqraised2 = 0;
    / M$ S2 I: L- F+ D1 p, E

  63. / g5 p5 v" Z" H+ M% e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . h* \# x* W, `0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: y# D( U; f% `8 q& g' ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . _5 L" b8 c* b# Z
  67. ! J5 h. B3 Z3 y# \
  68. dma_addr_t dmaphyssrc1 = 0;
    9 v; B4 ~$ b7 c8 L" v4 w
  69. dma_addr_t dmaphyssrc2 = 0;
    4 H( b1 Z  @/ {9 }3 D
  70. dma_addr_t dmaphysdest1 = 0;( Q( W. C: |. K7 i. R1 F+ r* o/ `: k
  71. dma_addr_t dmaphysdest2 = 0;
    - p6 T8 D. ?! e) Z0 Q- x3 F# `
  72. 2 S. I6 ?* w6 K' y
  73. char *dmabufsrc1 = NULL;
    - k- g( e9 p( s; l+ |" t, }
  74. char *dmabufsrc2 = NULL;
    1 S, h, E3 }8 h6 x' s5 W/ n
  75. char *dmabufdest1 = NULL;
    4 C+ z4 e) P) x9 Y9 y6 {
  76. char *dmabufdest2 = NULL;- A. S6 W$ Z9 n9 v

  77. # q+ _' d5 W' @  U: O
  78. static int acnt = 512;1 y8 R* B/ L, G( e7 g7 n1 j3 S) C6 W
  79. static int bcnt = 8;
    + A0 X2 b( K) |; [1 |- G
  80. static int ccnt = 8;
    ) e8 ^; h0 {% @6 r
  81. & l: {3 C. {0 h4 \, Q9 G
  82. module_param(acnt, int, S_IRUGO);. A" Q, O+ F3 k8 F) W3 m8 I5 h7 [
  83. module_param(bcnt, int, S_IRUGO);
    ' U8 i6 F2 [# z- m' f" Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; f" J# a- q' H, y4 K4 ]* l8 t2 q
+ W! Z2 _5 B& r& O: A! F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, }" d  `$ S" z  x! Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ?# G5 n9 C* N) n3 o/ h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R' ]5 z' Q" o1 O( J! J
9 `$ U0 U  V8 Z6 f5 {

. _. x% U: d: z- @2 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 04:12 , Processed in 0.040825 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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