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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P1 f' h0 J. H1 d
  1. [code]EDMA sample test application
    ) J& u) Z' Q: G, G) r! b3 [
  2. /*
    7 W; }' g( H7 I
  3. * edma_test.c
    1 Q1 M% c% k+ i  u9 A, P5 D
  4. *
    6 Y9 @/ T. v2 Z& L4 L& g9 B
  5. * brief  EDMA3 Test Application$ X" x5 _2 d2 Q. ~, q5 D
  6. ** h" U( f4 H0 a" S
  7. *   This file contains EDMA3 Test code.
    + e: f0 {! N. F# B4 E1 u
  8. *
    ; G" {% V3 v8 y( T- s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 V/ E( T0 }; _; J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g3 B# ]4 P8 p% N' E5 {: M+ H+ @4 S
  11. *         TO CHANGE.9 z# X8 |" J  D. A0 u
  12. *% _) [2 T8 F& T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: |8 h1 G& {& x% q' Z* x
  14. *9 T: J8 K: I* }% {' H+ {# V; D. u
  15. * This program is free software; you can redistribute it and/or
    ; ~0 `0 X& m3 h9 c
  16. * modify it under the terms of the GNU General Public License as  t6 h% W8 \$ f4 Q" d, ?
  17. * published by the Free Software Foundation version 2.
    - o9 ~) Q7 o2 |: m7 S+ S6 N
  18. *
    9 F2 c+ P$ b. p! |4 \$ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O$ ?' e' t% z6 X0 ^7 B" n8 A
  20. * kind, whether express or implied; without even the implied warranty
    # I2 ~  D. [1 k. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' J3 }; q+ d6 `  T% t
  22. * GNU General Public License for more details.* P; i# t8 f/ @8 S/ c8 H  a
  23. */
    6 s$ ?" m) _4 J& M4 n4 H
  24. 1 r% k7 c; K. D  X9 ~
  25. #include <linux/module.h>
    1 N9 V* J5 p/ R0 [! w- }7 A
  26. #include <linux/init.h>
    ; [9 f+ k+ f7 c
  27. #include <linux/errno.h>
    - F1 c. ^$ X$ E+ h
  28. #include <linux/types.h>. s/ Z  K( [: @& [
  29. #include <linux/interrupt.h>
    / Q' f. l' X: p: G6 K
  30. #include <asm/io.h>
    + t0 a: v3 G  N& S+ x' ^8 D
  31. #include <linux/moduleparam.h>" X( l" f" W) d! ^: y
  32. #include <linux/sysctl.h>
    ' ?7 y. t( A2 {% O1 o
  33. #include <linux/mm.h>7 k! d# S9 ?6 [! b( @4 @
  34. #include <linux/dma-mapping.h>. m. F$ J4 z% i/ V% s. B) |

  35. # |0 x; t) ^, n; r) i  [
  36. #include <mach/memory.h>
    * d( g/ C# c: \" a+ w
  37. #include <mach/hardware.h>9 F2 H1 K3 F2 P5 {
  38. #include <mach/irqs.h>. F) k% R# Y" q
  39. #include <asm/hardware/edma.h>
    , ~2 x6 z6 k( B5 }* F9 ]5 F# @
  40. ( m, ~  T% b6 }5 g3 m+ x* C( m
  41. #undef EDMA3_DEBUG
    ) a; Z& y. [) x! g# `( x
  42. /*#define EDMA3_DEBUG*/
    ( K( u2 }& q& k& Y" b9 Q+ e6 N; W

  43. ( F/ _9 T" E4 N# z' F) u3 W8 W
  44. #ifdef EDMA3_DEBUG8 J# ~. D, Z# j8 v, M; H, U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % Z" D9 w: W+ B6 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" k: X  p7 V8 z: i& W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 b! B6 _: f1 X* O# c" T9 y
  48. #else
    8 j' d1 O. r6 N6 `; J7 _, S  E
  49. #define DMA_PRINTK( x... )% \3 F7 A8 x5 e. D6 x! T& c' W4 K3 w
  50. #define DMA_FN_IN) J& c% A) e% C, v) ]& Y
  51. #define DMA_FN_OUT
    : H, {$ q. Q% ?: }- N6 j  ~0 j
  52. #endif- t! m. F& u# Z4 V

  53. 8 A2 L) w: g# B% a% n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Q+ |/ Z3 O* N' [. f
  55. #define STATIC_SHIFT                3* m, X9 M" b2 q
  56. #define TCINTEN_SHIFT               20* p1 M( K* x1 e0 b$ Q& j+ l! z
  57. #define ITCINTEN_SHIFT              21  b+ ~2 F: j  G/ W  F3 k) Z* U/ ]
  58. #define TCCHEN_SHIFT                22* a$ s6 j0 \) P2 g. l0 o# _6 {
  59. #define ITCCHEN_SHIFT               23
    ( a* ~! d' }8 z0 L# U( Y  u

  60. . l. x) T2 R$ P6 `  c5 N
  61. static volatile int irqraised1 = 0;
    , t  s2 y* n0 ?3 H: T. s
  62. static volatile int irqraised2 = 0;/ Z1 s' Z! z: d/ o, a& {

  63. + o* b" k; l" L" H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y9 k# f8 L: K7 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?" x6 [5 j7 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e# j' ~$ S6 \3 s5 n
  67. # a: ]3 w+ k: o4 M8 \. J
  68. dma_addr_t dmaphyssrc1 = 0;8 J% I  @/ q/ Q4 p
  69. dma_addr_t dmaphyssrc2 = 0;3 z6 I: i  |, [2 Z: a" q
  70. dma_addr_t dmaphysdest1 = 0;
    , \- y( Z" u4 _
  71. dma_addr_t dmaphysdest2 = 0;
    7 A. E9 H/ Q9 o9 M( r6 P/ e0 U6 I

  72. 6 V1 z- r! [- a0 ?
  73. char *dmabufsrc1 = NULL;
    1 ^# H: b2 R) g$ g7 a
  74. char *dmabufsrc2 = NULL;
    # `3 y4 b# `1 B. H0 w
  75. char *dmabufdest1 = NULL;
    $ M/ m5 O7 r- m+ e7 B! P* N8 q8 \( c
  76. char *dmabufdest2 = NULL;/ r( o! a4 }# _- h. {

  77. ; a, r% j: z, t# b/ U2 x/ w! c8 b
  78. static int acnt = 512;8 i% ^5 I6 N& z; e& P- {
  79. static int bcnt = 8;+ S" {5 K- b) c7 T! Y
  80. static int ccnt = 8;
    , P# j6 Z% [) w+ ?, V
  81. 5 d/ }% H: s+ [$ t+ F# E' @! D3 g
  82. module_param(acnt, int, S_IRUGO);5 Q6 w) a. S" C3 g/ s# H- s3 h8 F
  83. module_param(bcnt, int, S_IRUGO);
    3 J( l9 B8 @, I/ |: }" `0 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( U4 ^: t7 k- `* k
; c- }) ]& V8 C, G# L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! G7 `6 {, K. ]' H% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p6 f3 Q; Q9 k5 _7 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" T) K. C: Z) _. \' L9 Z2 A* T
. ^) J1 w/ w% F& x9 t/ ^( V  w) H7 Z) V, {/ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-2 20:16 , Processed in 0.049724 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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