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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : |# j' K% U' u2 J  G
  1. [code]EDMA sample test application# n( I, N$ L! P
  2. /*1 e& T( y$ K( k* ]2 `" i
  3. * edma_test.c
    4 v+ N. c- H0 J; X' Q
  4. *0 W# j0 A0 f# {. p+ z
  5. * brief  EDMA3 Test Application
    4 p3 V+ g; Q: u! [
  6. *; p) W- Z$ ?4 z# W
  7. *   This file contains EDMA3 Test code./ ?7 U% X: K: R, A' d4 y
  8. *2 Y* c( |0 ?- V# K' |+ `. n1 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ]+ G( X+ T4 O, S6 J7 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. D- B2 p" J; h, n- R
  11. *         TO CHANGE.
    * d& e0 E2 o: F: `, ~
  12. *
    * K: ]7 P) i5 Y" K' k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 n) u; [( W4 v+ {4 U0 r
  14. *0 P! ~1 _/ t9 I
  15. * This program is free software; you can redistribute it and/or: b+ O% G1 s6 N. n8 c+ d
  16. * modify it under the terms of the GNU General Public License as
    , P7 i5 y- C0 b8 T3 u' e
  17. * published by the Free Software Foundation version 2.3 {8 C" ^7 X) n6 s, ]
  18. *
    # \! E  _: M+ I& y# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# A4 e" S/ a0 O% L, l" }
  20. * kind, whether express or implied; without even the implied warranty
    5 j$ k5 [' ^0 w! l, O! ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 a* X0 J2 K2 {" N
  22. * GNU General Public License for more details.
    ! K( D1 v; w8 T/ p  H  r  Y( j
  23. */4 z* I* T- k' |1 W# O- Z' ^0 y, X
  24. * G" \  z- A# c6 f
  25. #include <linux/module.h># ^2 u1 m- Q: a; f. @
  26. #include <linux/init.h>
    1 k+ K9 k4 E* `. `) Q, L
  27. #include <linux/errno.h>
      J# V) w, d: l' z
  28. #include <linux/types.h>
    % I) O- ]. b: \. w6 ?, L" g
  29. #include <linux/interrupt.h>
    6 h- D+ U  r) a% D
  30. #include <asm/io.h>/ S, Y) g1 @. f/ B6 b  X! _
  31. #include <linux/moduleparam.h>3 _" `, u) a% m. x  [  [9 w' t
  32. #include <linux/sysctl.h>
    , I$ _6 |5 o9 y! L2 C0 r
  33. #include <linux/mm.h>
    $ u7 Z, O' [' T: P8 U
  34. #include <linux/dma-mapping.h>, `2 V1 T4 q% t  z* L

  35. . K" n) q( t0 [. m8 l
  36. #include <mach/memory.h>
    & D0 A' Y6 _. o9 z: `' _& @6 U6 ^
  37. #include <mach/hardware.h>
    2 [3 ~/ h/ i, \
  38. #include <mach/irqs.h>/ b) s1 z# U, |+ |4 D8 r
  39. #include <asm/hardware/edma.h>
    / X. O4 L1 l0 w7 t. w, Z) m

  40. & q& m6 \% H/ V3 i- x
  41. #undef EDMA3_DEBUG5 Y/ X) k0 ^3 n: b  c
  42. /*#define EDMA3_DEBUG*/
    # j; s3 x$ d1 R+ m/ g9 `% o' J
  43. , x. [; T& a, W& o. i! E% r
  44. #ifdef EDMA3_DEBUG
    4 P; {6 N% y3 c% r) f9 F7 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 B1 U% }5 ], y2 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 _8 x  ]6 L- ]' N6 D$ V- k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 `9 `) v; N) F8 z
  48. #else. u, L4 B. D; O9 U! q
  49. #define DMA_PRINTK( x... )
    # B, \4 o  v% [8 L! ~
  50. #define DMA_FN_IN' L- ?7 l# D2 `% H* g2 Q! A
  51. #define DMA_FN_OUT
    ! y8 R/ j# V" m% S" |$ j
  52. #endif) Z- j1 J, W) n6 P/ s
  53. : n5 R$ D0 V2 L9 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 o* K: _5 [; q+ `
  55. #define STATIC_SHIFT                3$ S+ f6 u/ Q, w* {4 G
  56. #define TCINTEN_SHIFT               20
    7 z: m# ]  l; T9 D& R* b8 S) ?
  57. #define ITCINTEN_SHIFT              21
    8 ~2 a- _7 A8 L) {" e
  58. #define TCCHEN_SHIFT                22
    & m2 ~0 _) ?, i9 P
  59. #define ITCCHEN_SHIFT               23! W/ v, L2 A5 C- Y: n7 q

  60. + p  i: N( ?4 [( K% F' @
  61. static volatile int irqraised1 = 0;
    3 p, K' l, a) j6 H3 ^0 {: E
  62. static volatile int irqraised2 = 0;
    * `" ^7 K5 K7 F1 \

  63. # o4 \& q0 W/ Q) R( H8 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 I8 b+ \. @, u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a. \, ]1 U! H* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( {5 ~* }6 ~9 p
  67. # f8 O2 c3 v4 S' J
  68. dma_addr_t dmaphyssrc1 = 0;7 \. h0 _) J- t9 b$ f
  69. dma_addr_t dmaphyssrc2 = 0;9 a9 K, M. b+ N' k! a
  70. dma_addr_t dmaphysdest1 = 0;2 b- d; {4 N. ~/ v7 M) {" ?
  71. dma_addr_t dmaphysdest2 = 0;# I2 S4 y- u" S1 Y
  72. 4 I/ _( A& X! X4 S" v
  73. char *dmabufsrc1 = NULL;
    7 ^* C! X( q+ n5 p1 R( c, C
  74. char *dmabufsrc2 = NULL;
    8 X: ~) w3 ^3 u/ X* i( X
  75. char *dmabufdest1 = NULL;9 [* _; n& e; X
  76. char *dmabufdest2 = NULL;7 B5 M3 M8 n  O& t4 @5 i, O

  77. # l3 X' _  f$ X8 K; [* ]- p
  78. static int acnt = 512;: Z$ o! M$ b$ s; [6 Y8 \0 }
  79. static int bcnt = 8;
    . J& U5 p) q# U& O
  80. static int ccnt = 8;
    % s$ }, t! X0 c! H  v: G6 e
  81. : c( F3 @9 n5 K0 P: J
  82. module_param(acnt, int, S_IRUGO);
    # l, n/ G4 R5 B. l7 B1 v
  83. module_param(bcnt, int, S_IRUGO);
    9 _: O1 {$ L# l  `& Q; A' V) d( ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% X( V+ ?1 Q, b$ J# g( Y) Q0 v  n  _% o: W/ C6 y8 }7 |8 T! {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 y9 G) H. P+ j( p8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ]4 Q2 ~* y7 I% h& M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 q+ C, f$ X2 ]" O9 D: O# d" i+ m
* N+ X2 A6 R( Q  b" ^  |
1 |$ T+ Z" [4 }3 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 00:07 , Processed in 0.039976 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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