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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 p/ V* ?% j8 G+ Q4 y7 f
  1. [code]EDMA sample test application
    & q8 r) M" e2 {# q. @
  2. /*4 S" c( ]! X$ K5 @  ]
  3. * edma_test.c
    2 u. Y% E2 D  R2 i% j  M1 Y, g
  4. *6 `+ v! X; k5 g' v. T  b/ z
  5. * brief  EDMA3 Test Application7 |3 ~! e8 V% N2 ?& H
  6. *9 T9 J3 K, {( l! I* W7 [
  7. *   This file contains EDMA3 Test code.
      l; D. B+ d' `  C7 j8 C  H6 E
  8. *0 R; l' |" A# h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ P' K& j& U0 a8 f  I# w8 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . S! D* q2 ]7 K- w6 I: n
  11. *         TO CHANGE.
    - |' Z6 ]& i& n3 z) u1 x6 j
  12. *
    % d9 c. f% Z9 F  K+ w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      O0 d9 O* F. ]" \, [* R/ \
  14. *
    ; w% T, S9 I% F' S1 ?
  15. * This program is free software; you can redistribute it and/or
    9 K: r) Z) J8 B7 Q7 ~, p
  16. * modify it under the terms of the GNU General Public License as6 E1 I2 `3 G7 H, N1 J) l# n% L$ t* M
  17. * published by the Free Software Foundation version 2.
    3 y9 \1 x3 A; N
  18. *- m( B4 E7 b; M3 b7 i7 |/ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( v) S6 A) P: A1 o# H6 F% e  w
  20. * kind, whether express or implied; without even the implied warranty
    9 x: L8 ?: T4 [# `5 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 l: `! m+ R8 ]/ v$ ]
  22. * GNU General Public License for more details.; c. p7 ^2 B6 Y# ^
  23. */2 Q$ X$ b8 ^0 C+ y- P
  24. # \5 e4 }4 J' V# R0 t/ \: ^
  25. #include <linux/module.h>$ o) X# Q( x8 D4 S/ [5 l
  26. #include <linux/init.h>" {& l/ q' P9 @
  27. #include <linux/errno.h>
    # I* i9 ~: t* y
  28. #include <linux/types.h>
    ' h- x; A! B7 R
  29. #include <linux/interrupt.h>
    " ?) y0 V# w, B7 c( [! N! L6 b/ |
  30. #include <asm/io.h>0 ~* _/ }9 z6 H8 Y
  31. #include <linux/moduleparam.h>; e' G, X, R' o" [, c
  32. #include <linux/sysctl.h>; B# {7 R/ q% b1 S* {6 W7 r/ K1 g
  33. #include <linux/mm.h>3 [9 D/ p2 Y* G3 O2 M, V
  34. #include <linux/dma-mapping.h>
    2 u& ^( w) k% ?: t/ O! m

  35. 7 G, P* P+ G9 h, a
  36. #include <mach/memory.h>
    " y3 c! P8 i& q  J0 ?' g
  37. #include <mach/hardware.h>9 w; @. n% j8 v3 s
  38. #include <mach/irqs.h>
    2 f8 r7 v) v" c, g# E3 V
  39. #include <asm/hardware/edma.h>
    & g0 [/ ]0 F4 D, O9 L& d
  40. * E  W. p  @. b- o) h6 r5 J3 ]
  41. #undef EDMA3_DEBUG
    ( x8 {8 k: l4 v# H, F. A8 z
  42. /*#define EDMA3_DEBUG*/" v) `2 _9 c0 j9 w  j+ D

  43. + Q3 I4 w0 v9 r2 e, ?* i( c
  44. #ifdef EDMA3_DEBUG
    + M5 T! t- W; Q  H$ D- F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 l' H0 N+ m! h  A3 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ Q( I6 A+ ~, O4 v. D# v( I4 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* j3 o6 q  m- q9 j
  48. #else
    1 M/ y( X6 p+ S0 G' x: ?4 q' O
  49. #define DMA_PRINTK( x... )
      K3 P& W. F0 ]) q6 |6 X
  50. #define DMA_FN_IN
    " p- q  b% {# M0 A' ]7 O
  51. #define DMA_FN_OUT
    ) r: i7 r+ L, z! \$ y: G
  52. #endif7 x7 s, P3 n. @2 [

  53. . F" Z  v! W0 U' T2 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , M5 U4 M1 k3 O  l; Q
  55. #define STATIC_SHIFT                3! j( j9 \2 o& B$ U7 _4 H
  56. #define TCINTEN_SHIFT               20
    8 Z/ y3 z/ J! d" Y
  57. #define ITCINTEN_SHIFT              21
    6 J9 k# T" R# e
  58. #define TCCHEN_SHIFT                22
    ! y- K9 O1 B% p, t1 N
  59. #define ITCCHEN_SHIFT               23
    / ~0 Q4 x- Y; u% y" I( \% Y

  60. - c$ _& e; j" K* j
  61. static volatile int irqraised1 = 0;
    ; X& K& `8 S% }% A, R/ X/ }
  62. static volatile int irqraised2 = 0;
    ! k2 {! }- a# C) G. ~( d

  63.   a, t: |( Q* t, P" n! e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 D# j: ?, s. T* m8 n% t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! l6 O% ]. W- N2 m% M9 n) I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 L$ ^2 P" V1 A6 H- l

  67. / |. r* E7 ^' T8 H  _
  68. dma_addr_t dmaphyssrc1 = 0;
    ' D8 |6 u, T6 W3 t- k- Z! h; K+ }
  69. dma_addr_t dmaphyssrc2 = 0;
    : \/ x' ~, z1 x9 P
  70. dma_addr_t dmaphysdest1 = 0;* q  _" m- Y! R+ c: r: a7 B* r2 s
  71. dma_addr_t dmaphysdest2 = 0;
    1 X, ]1 M6 F/ D' c1 T$ e, `) L
  72. ' e/ N( G# U( z& b/ B
  73. char *dmabufsrc1 = NULL;
    9 S% f! K4 u6 B8 L: M
  74. char *dmabufsrc2 = NULL;
    ( h0 e6 _8 B; C5 p1 N! n
  75. char *dmabufdest1 = NULL;
    & ]4 C, J$ g. Q# Y
  76. char *dmabufdest2 = NULL;
    . T, `2 T/ ^- U7 K0 j

  77. 8 \; d* u! q0 t/ J( b& w4 G
  78. static int acnt = 512;
    0 z5 f1 t- q# l% ?4 v$ J9 o0 Z1 F
  79. static int bcnt = 8;8 {2 N* _3 Z* }) v. ^9 {0 d
  80. static int ccnt = 8;& K$ x1 C+ n! J3 Z
  81. 5 _; y8 Z4 ^& Y5 `$ X* @" ?( d
  82. module_param(acnt, int, S_IRUGO);6 S9 p" Z2 {  b
  83. module_param(bcnt, int, S_IRUGO);  [" b9 O4 C5 G% U  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ r7 _/ [$ k  S- O
2 S$ X# R) \/ e- S7 ^: h4 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  I5 |1 z4 S- \8 S/ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) b: a. X+ Y3 j0 [& n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 q+ \2 R% w, z9 K& A' r) \$ H/ q& c- f
! t% u, E; C  j4 ^8 P5 D1 }% D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 11:00 , Processed in 0.045023 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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