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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . u. ~5 T$ P# ]7 k' ^& ]  s8 |
  1. [code]EDMA sample test application7 V; }' C( k. a& u, v4 X! y0 ]: J
  2. /*0 m! n; j/ D7 s7 `
  3. * edma_test.c+ F6 z! S7 Z9 `2 p3 m4 f
  4. *2 A$ N. O) C9 B+ P
  5. * brief  EDMA3 Test Application
    9 ]# d: M  V! Z0 ?) j+ C3 l
  6. *: L! ]  @( i$ |% d, ]0 u% C, e
  7. *   This file contains EDMA3 Test code.5 y7 U, p0 ^2 e. m) J4 A7 D0 i' Y
  8. *$ z3 J: o4 }* z1 g7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  r# J  t$ K' i4 |+ |; C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% m+ d5 d( N  L) H
  11. *         TO CHANGE.& f5 N, x4 S) f
  12. *
    & X7 O1 Z$ v% x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 {2 }. r$ I2 L
  14. *
    7 g6 n# L5 l- q0 N; _
  15. * This program is free software; you can redistribute it and/or- \$ G, X, J+ ^: p; d
  16. * modify it under the terms of the GNU General Public License as
    7 e" W" T& l7 f' e# J: a3 _$ P. X
  17. * published by the Free Software Foundation version 2.
    6 k- C+ s$ R) S7 j
  18. *
    + A+ G" [2 t% b+ P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 t: O: @( z* q0 v. U+ z
  20. * kind, whether express or implied; without even the implied warranty+ B* F5 q: T* t: m2 J4 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 }0 k6 P9 o; M( G& a( Q/ e
  22. * GNU General Public License for more details.
    - U: M4 O" w: W8 f$ v
  23. */
    4 ^: D! {- H$ R9 M
  24. + f$ ?9 D3 S1 _" V' b8 Q0 s
  25. #include <linux/module.h>4 o: g8 e9 i' V$ Y6 }
  26. #include <linux/init.h>- J- k; [) B/ @) e3 v1 H
  27. #include <linux/errno.h>/ G, y. @2 L7 @- x! J$ _
  28. #include <linux/types.h>* k- t* X/ B2 z( h9 o
  29. #include <linux/interrupt.h>; @- v& r5 n/ [4 `" [, Z2 t
  30. #include <asm/io.h>! w) L) n% X- P& |5 R
  31. #include <linux/moduleparam.h>
    7 Y, b1 b. ?9 k# N" {* b
  32. #include <linux/sysctl.h>1 ?8 v0 S& c! U
  33. #include <linux/mm.h>! D; G' k* J: C- p
  34. #include <linux/dma-mapping.h>
    4 o0 m9 O) m' }8 u
  35. 1 H: d% u9 A% y6 {( }* D, a6 \
  36. #include <mach/memory.h>
    ' A6 Q: L9 C5 N
  37. #include <mach/hardware.h>  f2 l. B; b+ Y$ X
  38. #include <mach/irqs.h>
    6 J# ~# b$ C9 c
  39. #include <asm/hardware/edma.h>+ ], l0 }. K, p! ]; q4 O* x  D

  40. . X9 E+ L5 E3 Z9 i0 z- @% Q* W
  41. #undef EDMA3_DEBUG. R0 Z5 C4 ]$ t) o
  42. /*#define EDMA3_DEBUG*/" s: B# w/ u% h. z

  43. 8 c' d. L8 `3 x$ b
  44. #ifdef EDMA3_DEBUG
    : @  p* l. A  @; J0 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @8 z/ z$ K) G# v) }6 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ [0 K6 M; k6 N) q$ u1 o2 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; q$ t! f+ h+ _3 k4 m
  48. #else: s8 k9 r: L4 ~  S+ Z, D5 h. w1 J
  49. #define DMA_PRINTK( x... )
    ! C$ e5 M6 j4 y8 D
  50. #define DMA_FN_IN
    ! q  |* l7 B' D# s2 z+ K
  51. #define DMA_FN_OUT
    1 K1 g3 R5 z, R0 c
  52. #endif" C9 e) s$ G0 T' ]9 p

  53. $ g6 K) V- J. w6 ?( U$ p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' U3 M4 s: @/ R: L0 J$ i$ |
  55. #define STATIC_SHIFT                33 `# t- [0 j  W3 `* f, F. S
  56. #define TCINTEN_SHIFT               20! v% {) |/ E. ^& p0 D  f; e0 g( |# \0 j
  57. #define ITCINTEN_SHIFT              21! V2 X7 \$ m8 j; K/ z% t1 z1 z
  58. #define TCCHEN_SHIFT                227 K+ B: d% t% k
  59. #define ITCCHEN_SHIFT               23/ ~+ o! p) c1 b; Y9 [
  60. ; {0 q) ~* M" P* f. T
  61. static volatile int irqraised1 = 0;
      H5 |' J  v7 R1 \. x
  62. static volatile int irqraised2 = 0;8 U3 m- v6 g& E2 y
  63. - A! u  Q3 i+ j" O2 S- Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ?2 W% k" W1 U5 V4 E7 [8 H, Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 q0 h* r6 @- s) T' \3 l$ z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r3 y: s1 f) q' q
  67. ) b% i6 N9 x; \' i( `, o1 d. ]
  68. dma_addr_t dmaphyssrc1 = 0;& F2 \- t6 s$ ?! g5 v! v
  69. dma_addr_t dmaphyssrc2 = 0;
      a5 U% \& k/ k
  70. dma_addr_t dmaphysdest1 = 0;
    # C2 k5 P1 c; i9 B
  71. dma_addr_t dmaphysdest2 = 0;
    3 k. t) Q3 z5 o
  72. 4 X. d( H: v; ^* x  G' K
  73. char *dmabufsrc1 = NULL;% C6 J) a7 ~- l
  74. char *dmabufsrc2 = NULL;* ?  I/ ]$ O; v1 x7 _% n+ [9 b4 R
  75. char *dmabufdest1 = NULL;( g! d7 R2 J# W
  76. char *dmabufdest2 = NULL;) B8 ~/ m( Z+ l
  77. - E0 j$ ^2 W! I
  78. static int acnt = 512;: z2 ^! K9 f0 F( |
  79. static int bcnt = 8;
    ' J0 ?5 H- |$ R% B, A
  80. static int ccnt = 8;7 F1 r) o: C; ]: q9 u" \9 d5 Q

  81. 4 d; C0 ]9 `6 Q( h
  82. module_param(acnt, int, S_IRUGO);* }4 `- C3 J3 {9 P9 }( O
  83. module_param(bcnt, int, S_IRUGO);
      `# {1 [* l6 P. P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  E" i# M9 _0 f# @6 _' B0 e- j- `
  S1 o, Q' y: I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X6 B( P" P! ?5 p2 _5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' P" ^  D8 C1 Y# y( C5 w4 o3 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  s" R9 [* D6 ]

. m' K/ D7 N- }; }( d
6 |% W7 I! `3 I" g! |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 15:22 , Processed in 0.042272 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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