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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 W/ y3 V1 R$ V( g
  1. [code]EDMA sample test application
    % t2 p7 h& X* v) T' x3 L9 @
  2. /*
    4 }# @! H2 R" G  U
  3. * edma_test.c8 ]: G. j+ O; r8 L# |- I
  4. *5 G0 _& K1 Z9 [
  5. * brief  EDMA3 Test Application
    , I$ V2 v9 h' _) J- Q% d
  6. *
    / w& T" @* `( @  X) G5 o
  7. *   This file contains EDMA3 Test code.) ~; ]8 r9 n& B+ {5 Q
  8. *
    ; \8 b5 n3 Y2 Y* D/ W1 s8 t4 s; t; F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 @9 @) j  Q, n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ b. F- W/ i- R, E4 q; b
  11. *         TO CHANGE.
    ( y3 _7 j" i2 k( o$ s5 E- J% M" N0 }
  12. *0 m( d& F+ o: e' f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: i( J! e8 d& R9 e
  14. *3 X. k* ]/ }& ?1 d
  15. * This program is free software; you can redistribute it and/or' v$ Z. Z& w- e
  16. * modify it under the terms of the GNU General Public License as
    : l* d) |; g+ w: f6 u0 J! f+ h$ |
  17. * published by the Free Software Foundation version 2.
    / h" a0 S! f2 }' F+ k% ~0 t6 l5 ?/ l
  18. *2 q7 q, {3 `8 {. Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ p' x3 J' ?5 \8 W2 K5 Q
  20. * kind, whether express or implied; without even the implied warranty+ m9 E+ |0 A1 p! _* I6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: B3 {- `' ]# U: _7 G; D9 p
  22. * GNU General Public License for more details.) y* Y1 U9 j% {4 [
  23. */2 V( S+ j/ |  P! B! [

  24. + @/ {2 @$ V) s; g9 n! Q  m! ^* l
  25. #include <linux/module.h>
    4 H4 q! X+ U$ ~
  26. #include <linux/init.h>
    4 D: K( n4 ?7 Q% ~9 {* z4 H5 I% v& \
  27. #include <linux/errno.h>2 {* s! |, O: j$ `
  28. #include <linux/types.h>
    8 ^9 P# }8 O& T! I4 c
  29. #include <linux/interrupt.h>
    # m  a* q1 n+ _
  30. #include <asm/io.h>
    9 l! M" K5 j& `
  31. #include <linux/moduleparam.h>) c3 m* H2 }1 ^" ]! h- g
  32. #include <linux/sysctl.h>
    % P* o7 Y+ W1 i/ a8 X
  33. #include <linux/mm.h>
    ( v- C+ V+ K4 K  ^8 H# n- U
  34. #include <linux/dma-mapping.h>
    4 P% [  v2 d: ~0 X. `" ?$ B  v
  35. 8 {' {" \+ L. G- p
  36. #include <mach/memory.h>. Q1 f6 p% ~* v: s* m8 q
  37. #include <mach/hardware.h>  E* K9 w) T# q- V: E( s4 z
  38. #include <mach/irqs.h>
    1 a, V9 f, l( y/ i2 l" d/ ]
  39. #include <asm/hardware/edma.h>
    ( v0 o+ a) z% }7 t
  40. ' m$ l: Y  v7 Y
  41. #undef EDMA3_DEBUG
    6 ^7 [1 k2 E% f7 c1 n2 m, p$ b" f
  42. /*#define EDMA3_DEBUG*/' X& y, ]2 j% X
  43. 3 `0 D  g) j( J% _; l% O6 X9 s# v
  44. #ifdef EDMA3_DEBUG
    " L+ @. Q( b" S$ _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% |* e' U8 m- {. l& C: l4 B7 z, C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : ^" C' L+ w# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( |4 ]% [( G; \
  48. #else
    4 v: e  p# O9 D- @: I" H  f' M6 [
  49. #define DMA_PRINTK( x... )9 }2 T* b* [3 i! Z( X+ H
  50. #define DMA_FN_IN
    2 o! w3 c: F1 J
  51. #define DMA_FN_OUT
    8 N: `) e/ C8 N) x6 ~- W8 t+ q
  52. #endif
    - ]3 y/ E8 i) z7 b- ]$ I4 `! W

  53. ! @( B+ e  j7 b/ m- u/ C0 i5 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 L5 Z1 s* a5 B$ l% k1 G; I
  55. #define STATIC_SHIFT                3
    9 d- q; q* Z7 p7 z! y, m
  56. #define TCINTEN_SHIFT               20
    / F. W' _) {7 m: u: x  a3 ]: c
  57. #define ITCINTEN_SHIFT              21" F) J1 v, G2 s* i+ P" I
  58. #define TCCHEN_SHIFT                22) L( h  [/ J# ~
  59. #define ITCCHEN_SHIFT               23" M  w' [6 Y9 K, C3 H

  60. 9 `& c# g' [; k) q5 K% [3 e
  61. static volatile int irqraised1 = 0;
    # y3 x' p2 W, `/ l* ?2 `4 w- Y
  62. static volatile int irqraised2 = 0;/ o$ `2 R# S& D4 O9 X
  63. + N/ {/ s# Q- l* h+ `' M6 ]: R4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E& _. ?7 ?6 n' ~9 q& C0 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ F9 ~* _8 p2 Y; s0 S+ q. Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A- p& M) C. A1 w
  67. $ L1 g5 u  J# x+ O- @  K
  68. dma_addr_t dmaphyssrc1 = 0;( L, }+ y% P- ?5 x0 K
  69. dma_addr_t dmaphyssrc2 = 0;
    , m- r+ L, m1 t/ F8 n
  70. dma_addr_t dmaphysdest1 = 0;
    / W' @8 w( A9 P+ }; [6 S3 ?; K. q
  71. dma_addr_t dmaphysdest2 = 0;- _' X0 y  _5 V; h! q

  72. $ b9 R6 R7 D4 F
  73. char *dmabufsrc1 = NULL;( x5 y' I% x( y. W( W  ~1 i6 Y
  74. char *dmabufsrc2 = NULL;
    , x7 R) O5 d, C$ P
  75. char *dmabufdest1 = NULL;( a+ U& u( c% |. L. ^+ l
  76. char *dmabufdest2 = NULL;
    / k0 O4 A, y( N0 {. ?
  77. - x; V$ D/ F: _: S
  78. static int acnt = 512;
    ! N/ p, z0 p) S
  79. static int bcnt = 8;
    4 ~- A9 u' p4 Y# l9 d+ C3 [, L: w
  80. static int ccnt = 8;& R  N9 _# [$ v: x, A+ E

  81. + ]* v5 `2 ^0 N
  82. module_param(acnt, int, S_IRUGO);- P  X9 s& A- w
  83. module_param(bcnt, int, S_IRUGO);
    3 G4 z7 ^& r: m6 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 s8 H4 o) C+ t3 Y
, W, Q$ ~% k4 a5 Z; q9 t0 n# F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) j' f6 R, i, W3 |  @& x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 K' K" y* ?) A6 _/ @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ~( ?1 P; h1 ]9 n& U9 @5 E6 k% v0 z: J. i/ g3 T

" o: A' }* s% u5 ~5 L( L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 01:02 , Processed in 0.038640 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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