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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 k' j" K0 `- b$ t) g# a5 q
  1. [code]EDMA sample test application5 R6 Q/ c. [- H# k7 j  y9 m
  2. /*1 J1 ~& Y) X% i4 A
  3. * edma_test.c
    ! d8 o- T  z8 U6 S1 P
  4. *
    + B  n: B9 d* H! T1 @
  5. * brief  EDMA3 Test Application
    2 V% _& B) `9 B/ @1 ^- c! T
  6. *9 c* `( ?4 l; e$ T* f
  7. *   This file contains EDMA3 Test code.
    3 m8 b  ~8 y1 O
  8. *
    9 @4 s+ g! G1 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 w: e! O6 e! z; k( f" n' \# u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 y6 d( k: N+ m2 D
  11. *         TO CHANGE." F4 _& a. L/ s# P4 l  M
  12. *
    2 s7 @3 X& A; P1 f, V$ ~) C* Q0 `8 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 g6 H' _7 c: c
  14. *3 p/ U9 e' t' C5 W! C" ~
  15. * This program is free software; you can redistribute it and/or2 `1 f  m+ f3 G( Y
  16. * modify it under the terms of the GNU General Public License as4 H. ^2 c3 h* C4 I4 r
  17. * published by the Free Software Foundation version 2.' J8 C3 r, Q7 }7 f! J
  18. *5 G# ?' o4 ^8 h, f' [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o& m7 y) `7 \! U) b1 E" H2 S
  20. * kind, whether express or implied; without even the implied warranty& n* r4 o4 W" v( U1 g7 H" A  d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 \# F  x6 Q9 _  o
  22. * GNU General Public License for more details.- R! F" {4 G2 ^; {2 h  ]5 D
  23. */
    6 `6 T& K$ H& r" b$ I5 s/ D: F) \

  24. 4 @, |/ P! ~/ H- e
  25. #include <linux/module.h>
    2 D9 e4 _6 D) U0 J
  26. #include <linux/init.h>; A* `0 M2 y+ m& o4 {
  27. #include <linux/errno.h>
    9 k/ X% ]" j4 V" V
  28. #include <linux/types.h>
    8 l9 s* r9 y, }, ~
  29. #include <linux/interrupt.h>* y' u5 @5 N8 P" X( J
  30. #include <asm/io.h>& \' x$ j$ V) F1 A9 g6 q7 Q6 W
  31. #include <linux/moduleparam.h>
    9 t* s3 Q+ m, b/ I; Q
  32. #include <linux/sysctl.h>
    5 ?7 b6 \8 Y) P# Y
  33. #include <linux/mm.h>
    $ C9 n0 z5 x) A9 A* t; d8 N! m
  34. #include <linux/dma-mapping.h>! J( V& ^8 C9 ]! I1 B
  35. 1 r  s* {; m/ P2 B' H
  36. #include <mach/memory.h>
    " G, h" ^$ P) ?
  37. #include <mach/hardware.h>: D- X( v7 O6 N, U6 h
  38. #include <mach/irqs.h>
    # g' a  ~8 Q2 M: F+ j
  39. #include <asm/hardware/edma.h>
    9 S! o0 |, F( k, t0 C- s. A

  40. ! N4 J# q) M5 j# ]9 F
  41. #undef EDMA3_DEBUG
    " m& d. S" W( a1 h) y% r. Z
  42. /*#define EDMA3_DEBUG*/: \3 ?" `2 e6 T% Q+ D

  43. 8 ^* u' n  I# }5 ~- ~8 H
  44. #ifdef EDMA3_DEBUG
    5 `7 C* l! k. _% c9 g+ v% l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + d! j/ K1 N" Q- l. H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 A1 ~* G! e" |% u: U5 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ l* [1 o# M$ F  }" g6 R8 c
  48. #else+ N3 t  R( T7 }8 I+ C7 |! w
  49. #define DMA_PRINTK( x... )
    - C. T3 B5 }  C/ {$ O6 h/ R
  50. #define DMA_FN_IN5 `2 V, a: G/ D* |3 ]# L
  51. #define DMA_FN_OUT& z/ V) G1 h$ C) ^1 v( q# q
  52. #endif( `$ s$ S+ ?. v4 H% T- {
  53. 6 {' f7 B! q: G5 O$ b8 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" p, T/ U, U6 X! s! C$ \
  55. #define STATIC_SHIFT                3
    ( L. P) [0 N- J- N4 w0 D5 e' R$ s
  56. #define TCINTEN_SHIFT               20) l$ A6 D- V' g8 y' W
  57. #define ITCINTEN_SHIFT              21; n) g* P/ `* S5 n
  58. #define TCCHEN_SHIFT                229 H- d0 J2 u5 l5 R8 @. c9 b% ~+ b
  59. #define ITCCHEN_SHIFT               239 h, @" w5 e. p7 z$ y

  60. $ g" f8 {. X5 m
  61. static volatile int irqraised1 = 0;3 T. X2 ]( x( [. G& T
  62. static volatile int irqraised2 = 0;
    # n% D" ]: `' C5 z4 Q. Z- Q$ K
  63. 7 f% x' K; z' A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t6 x1 q* ~5 z2 S7 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' z" S1 A  z# ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , x1 q$ P* i& t1 p% ~) U4 r+ X
  67. $ Q3 r" v1 x. f) b
  68. dma_addr_t dmaphyssrc1 = 0;" `, ^3 J; @* L* S( D: v$ ?  a* `) k
  69. dma_addr_t dmaphyssrc2 = 0;
    ) H4 ?, P; e, c+ M+ V- R8 z
  70. dma_addr_t dmaphysdest1 = 0;
      g/ B) q! p0 J" [+ @2 [& ^& ?
  71. dma_addr_t dmaphysdest2 = 0;
    6 w  S; L% _0 r8 O) l

  72. 0 c+ W- T2 a6 N+ U
  73. char *dmabufsrc1 = NULL;3 w9 x5 K3 @1 P- K8 _- c
  74. char *dmabufsrc2 = NULL;- @; F% Y, p, N. O* h+ d+ O( \7 L
  75. char *dmabufdest1 = NULL;# L+ L; `% u8 w2 [3 _3 i# N
  76. char *dmabufdest2 = NULL;% r" F$ A/ E" g4 Y& O

  77. $ ^# @2 V+ O6 [+ R! L4 `
  78. static int acnt = 512;
    3 s' o5 Y6 }1 S5 a, n: N3 H' ?
  79. static int bcnt = 8;
    # D8 Y5 b: ?) p7 H9 j) o/ [! `
  80. static int ccnt = 8;
    6 {) g2 z6 |+ e7 i
  81. + u0 q* i2 A& y5 v+ R( P% s1 w
  82. module_param(acnt, int, S_IRUGO);; C+ l* j5 i; d( j9 u! T- f
  83. module_param(bcnt, int, S_IRUGO);. S+ B2 O2 p& B; E4 s+ c' w4 G( p% A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ N% E+ r. k2 J% p5 e. ^9 `, Z
" _, @; d- [; L6 i' @& C- u5 }! r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 A, U( V* M" G. Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% n! O' A( d. s5 U! p, f! `: \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 \& D$ U+ B) i3 `- m* o) l4 A* Q9 E4 l

3 K' @0 Y9 k( }6 c6 }6 |) w3 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-12 05:14 , Processed in 0.040545 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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