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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 A1 n( w: O  t1 @8 ]
  1. [code]EDMA sample test application& p8 J& S* t' F  F9 {; \* F' e
  2. /*
    $ x  ~0 @; q+ G: w* t% C' q
  3. * edma_test.c
    . P# v$ N; f& H7 y/ i3 l3 }
  4. *7 Y, E& A( {6 }: K
  5. * brief  EDMA3 Test Application& \  g( D% O+ v9 ~2 l, q. `
  6. *
    0 u1 `- L. c, c; G0 R
  7. *   This file contains EDMA3 Test code.6 D. V- ~' |9 K; I& k' v
  8. ** M4 P# a/ N& u: q- H0 T9 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 x$ r, }3 ]" d" u8 K: X1 i, V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ~: ]5 f0 [5 C* \. e
  11. *         TO CHANGE.
    ! {8 `0 W! c4 D. v: A# a1 V
  12. *" ?7 X0 ]2 P- u3 W1 R- J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . W0 o' O1 a. I* a# R% _' h
  14. *
    4 y% {6 H( f4 [+ _2 [
  15. * This program is free software; you can redistribute it and/or
    9 w4 h0 N) C& W) n6 @: X5 F
  16. * modify it under the terms of the GNU General Public License as
    3 r4 [9 i# Q3 _2 V' W. F0 X2 D
  17. * published by the Free Software Foundation version 2.
    : x# H' @4 U! l& q. T) u
  18. *
    ! {4 {' L2 y- g# X; @4 s2 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 \( D" l7 y" P  C& l& V0 U
  20. * kind, whether express or implied; without even the implied warranty  [* |3 J# D; p7 [8 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 K$ }& L+ l1 {; s
  22. * GNU General Public License for more details.
    ( v0 w+ K  ]) z% |1 y4 }, t
  23. */
    : ^6 w- f0 S7 K1 l) e

  24. % G& q2 _. ^  f* S9 B
  25. #include <linux/module.h>
    ( s2 \; a6 S4 F3 W& G; ]" h0 n
  26. #include <linux/init.h>
    3 K3 Y0 M( g* @# T% I/ z
  27. #include <linux/errno.h>; ^6 J' Q" I2 S2 ]
  28. #include <linux/types.h>
    " O6 ^6 M5 y6 B6 `
  29. #include <linux/interrupt.h>' J! h! h7 V) ]1 T/ g+ x
  30. #include <asm/io.h>
    ! r! B- R' X$ b( U5 j
  31. #include <linux/moduleparam.h>' e: y" m- r% i& k; h; j
  32. #include <linux/sysctl.h>; u1 L7 L: \! I% b
  33. #include <linux/mm.h># F& L3 G; w2 R! t) n  F3 B
  34. #include <linux/dma-mapping.h>2 j8 K1 [" C' N. }

  35. 0 V% L# c1 o* R6 |) `
  36. #include <mach/memory.h>2 k* F/ ~9 Y- Y/ W- s7 ]" T
  37. #include <mach/hardware.h>
    ) `' g5 s# Q; j2 {
  38. #include <mach/irqs.h>
    3 n' v5 p3 I9 n" i$ ?
  39. #include <asm/hardware/edma.h>/ V% c6 D+ F- I6 w) M$ A( u; d' i

  40. 6 f$ _+ w( h5 Q; T
  41. #undef EDMA3_DEBUG
    7 d" ?  V' Z- n% o; Z; M# ]
  42. /*#define EDMA3_DEBUG*/
    , r5 h; U$ T* ~. \% w5 [- x# M

  43. 8 u( v, l9 e( ?
  44. #ifdef EDMA3_DEBUG- i0 S6 y0 G' S% g1 M0 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) S8 l. b. D2 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 l% Y% S) C2 T  J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + E2 \6 L; r7 U$ n( i7 J! X# f6 r# z
  48. #else
    % n# v; c) d+ A3 h  a
  49. #define DMA_PRINTK( x... )
    ( q3 U  g8 A: c: W. O
  50. #define DMA_FN_IN# u) p" }' J4 b" A2 K/ Z4 L9 J
  51. #define DMA_FN_OUT
    ; S- k0 D7 S2 g+ s
  52. #endif
    + X/ q7 N" C! _; P: ~4 O
  53. $ [9 f2 ~$ a" y) y  N  r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" {0 t$ f' R* V* J
  55. #define STATIC_SHIFT                3! R, s9 Z2 x- M& r, d
  56. #define TCINTEN_SHIFT               20. S8 U; M- U2 p
  57. #define ITCINTEN_SHIFT              21  R+ m7 v* _  y2 w' w" ~
  58. #define TCCHEN_SHIFT                22' n' |  X4 i. T' Q
  59. #define ITCCHEN_SHIFT               23+ b- v$ J( W# F; S/ s
  60. : ^5 e/ E0 [" g% p
  61. static volatile int irqraised1 = 0;$ F) T) Y2 j4 y1 Z  A6 d0 q6 v$ S
  62. static volatile int irqraised2 = 0;$ Q; S2 q- R7 i# [! f, f

  63. - `1 v# Q3 N! M. G  d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `4 J1 k$ b8 A. a" {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 M3 M) w; R, ]% q4 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |9 d  b; o  ~3 p' M1 r

  67. ( r; q( }5 c& g% |+ p4 }6 g
  68. dma_addr_t dmaphyssrc1 = 0;
    % t4 X# {, n/ t" B
  69. dma_addr_t dmaphyssrc2 = 0;3 B, F- G0 t6 F9 E- X3 X
  70. dma_addr_t dmaphysdest1 = 0;
    , q& c# B; x* J4 y  {9 D2 a
  71. dma_addr_t dmaphysdest2 = 0;4 {& n0 t8 Q) I+ ~, E4 v
  72. ) L. b* s8 T+ }/ n6 g* P
  73. char *dmabufsrc1 = NULL;4 n7 |% l" k7 w( @9 n" U" _$ O
  74. char *dmabufsrc2 = NULL;$ p9 B6 h$ l6 F, K
  75. char *dmabufdest1 = NULL;" {( _9 x  i2 G: \3 T. O
  76. char *dmabufdest2 = NULL;
    & V1 v. g/ {9 B: X$ o" Q
  77. & c  q* C1 i& j$ J1 u5 l
  78. static int acnt = 512;+ n( V# H) t/ ]7 Y& s$ V9 u- `3 t" i
  79. static int bcnt = 8;+ d' ~/ ^  x* E1 B
  80. static int ccnt = 8;
    & B2 W6 t! i" v0 A

  81. 7 V" l9 A: I; i- r
  82. module_param(acnt, int, S_IRUGO);
    : O% k. N9 x2 E$ ?
  83. module_param(bcnt, int, S_IRUGO);
    2 u5 c( ~9 N; u! `' a/ a& B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- C8 `0 {/ o7 ^1 {( q

% M3 C  s. M- z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( p4 L, p4 m# R& ^0 w: Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ Z; ~8 F% h% X! D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z5 G8 s* ^  q
7 d5 X$ |; M) E& n# ?) W& t
4 P  o% R% e  r! r* y, A; _* G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 21:44 , Processed in 0.038533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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