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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]3 H; B3 o/ j1 Y6 q/ _
  1. [code]EDMA sample test application9 c- g; E# n4 u, \6 D  y& V$ c
  2. /*
    0 V3 n  w) t$ F$ c# y" X
  3. * edma_test.c. a1 i2 C' C7 W+ Y
  4. *
    , J2 H; J3 ^/ ^3 o
  5. * brief  EDMA3 Test Application
    9 y; S6 M6 v* {  Y- N( b7 u
  6. *$ k$ o1 }" _9 y
  7. *   This file contains EDMA3 Test code.
    8 N& _- Z4 c  @4 y3 Z
  8. *
    % g' `1 g  F+ B3 U! O+ m; J- Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! Y& |: }' u  M! G- @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . N* [# L; x/ V5 i+ T- m
  11. *         TO CHANGE.% ?: s! V& D/ G% b
  12. *: w. E, S7 M6 p6 X7 [' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % [0 l3 m( O( G  E, x  w2 C
  14. *; z( G0 Q4 a# f! \, i
  15. * This program is free software; you can redistribute it and/or' W9 \5 Q+ R0 F; n) D5 g( y( C
  16. * modify it under the terms of the GNU General Public License as
    % @/ M$ \; |5 A, \( \1 t1 i2 a
  17. * published by the Free Software Foundation version 2.
    . e+ M2 a! f- R  F4 ~3 s
  18. */ O& a1 _  M# Y, ], P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! `6 i/ t( \& ?; w0 t( B; ~  R
  20. * kind, whether express or implied; without even the implied warranty+ c7 a* D# {5 }5 B8 l4 J! R/ ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ G) M8 b7 P# q% l" r: O
  22. * GNU General Public License for more details.
    6 @( I) k9 E0 T/ k4 Z
  23. */
      P& R- D" p1 `8 x/ }

  24. 6 Z4 U9 c5 a( K3 T6 `1 x
  25. #include <linux/module.h>
    # i! `3 r% ?# j! L! O9 H
  26. #include <linux/init.h>3 z) o' c( \4 A# N7 v
  27. #include <linux/errno.h>
    5 R# i6 [' P* Q! q
  28. #include <linux/types.h>2 |5 T! r6 h( W/ W
  29. #include <linux/interrupt.h>4 |% W4 A! H  u
  30. #include <asm/io.h>
    & a; Q& T  c0 ]% v( h2 t
  31. #include <linux/moduleparam.h>0 `( `$ k5 Y. S1 A. L, I8 M; }) H
  32. #include <linux/sysctl.h>* L& D: B% `! L: M* r. Z6 [
  33. #include <linux/mm.h>
    5 V1 i( A! m! a5 z# e( w# `& \  Z
  34. #include <linux/dma-mapping.h>
    % V# F1 B0 E) V, z9 |. t
  35. 9 Z8 l3 P; B+ H5 _
  36. #include <mach/memory.h>
    + J, c5 r  ~9 ?
  37. #include <mach/hardware.h>
    ! J7 ~$ b2 Y6 r) o' N# d
  38. #include <mach/irqs.h># \& L& u6 \; C  @$ [/ c- [) ~0 v
  39. #include <asm/hardware/edma.h>
    7 I% O9 s) ]1 H8 I! F7 {1 p' T

  40. , C7 _  N' N, d! b
  41. #undef EDMA3_DEBUG5 [( I+ U3 H4 d: C
  42. /*#define EDMA3_DEBUG*/
    # Q' M9 j' D; _# |+ w* q+ ]# @

  43. & b# x/ u- j- ]1 ^' w$ ]
  44. #ifdef EDMA3_DEBUG
    + \) L( p  z; b& y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 N4 _; G1 M4 k" ]  g/ M2 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% l  O# u9 ~, A: f7 ]7 j& z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 L# U1 B- w! N  G# |! y
  48. #else
    % q& n* ]9 e/ t
  49. #define DMA_PRINTK( x... )
    3 N: {- s/ s3 M) L- a, u
  50. #define DMA_FN_IN
    $ l1 T$ W/ C' W) H5 M- A( A4 y
  51. #define DMA_FN_OUT3 x" S- |6 V) {* ?3 T0 d
  52. #endif% \$ O/ W! z) r% n

  53. 1 B/ ^4 S. h, C2 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- i( z. j, K- w
  55. #define STATIC_SHIFT                36 @, w- b6 C7 ?+ q
  56. #define TCINTEN_SHIFT               20
    ; I: d) k; s9 \7 V& w
  57. #define ITCINTEN_SHIFT              21
    # ~) {$ H: t1 k
  58. #define TCCHEN_SHIFT                22
      N+ ^1 V1 G, a* _2 M
  59. #define ITCCHEN_SHIFT               231 u0 j' h) u- l$ E" v: {

  60. " {. H  _" y, Q4 Y$ h
  61. static volatile int irqraised1 = 0;
    $ ?/ C- ?6 K$ Q* k- _
  62. static volatile int irqraised2 = 0;
    ! G4 ~4 k9 b+ q
  63. & n/ x& C% [6 k2 Z8 W$ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N' J, O& {7 Z* a, V9 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q" [8 m3 I& x' f; _. r1 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % z8 N8 O. P; J; ?8 ?" ?

  67. % x( t' j4 g+ L# L/ h
  68. dma_addr_t dmaphyssrc1 = 0;0 T' X: n) p2 u' B; l
  69. dma_addr_t dmaphyssrc2 = 0;
    : C( o) a3 y- ]3 e% t
  70. dma_addr_t dmaphysdest1 = 0;
    + U- G% e- i, S% h
  71. dma_addr_t dmaphysdest2 = 0;
    2 r7 |* }* K$ @& G

  72. . V( Y6 R3 O$ X, Y. A# k9 O4 x, f* d; ?
  73. char *dmabufsrc1 = NULL;
    - s' _" A4 ^2 ]* g2 }  P
  74. char *dmabufsrc2 = NULL;
    3 j" s* m. W6 v. W1 X$ R/ R& c4 L
  75. char *dmabufdest1 = NULL;
    ( O: f  K1 B- F  ?
  76. char *dmabufdest2 = NULL;% O* r+ s- q) `$ i) O
  77. 8 _. R# V, K0 F, d6 i9 J
  78. static int acnt = 512;
    3 L1 x. T' ?( e
  79. static int bcnt = 8;4 `' W/ {2 L1 s6 N7 u
  80. static int ccnt = 8;$ R8 k. _5 w) Q0 ^$ _9 h/ V6 a
  81. $ }$ B, h6 ^6 E5 n3 u5 l% m* n9 b
  82. module_param(acnt, int, S_IRUGO);# F- n2 X! F  q1 d3 n5 H$ e
  83. module_param(bcnt, int, S_IRUGO);
    # b! Y2 R8 e9 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. O& b0 O" m- n
; x' A& Z1 G5 N# z6 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: t0 m% k6 b; b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! ?0 @. d; M1 s7 Z8 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w) _, e) u+ i  z5 F, b2 g! z% G- m
* B' f5 c8 k, I& x3 f2 j0 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 18:39 , Processed in 0.037289 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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