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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 d+ `  {; n2 @
  1. [code]EDMA sample test application
    1 d6 m2 n. s0 y+ t/ C2 P: j
  2. /*4 P" S& H$ {3 g4 f6 t6 S
  3. * edma_test.c
    + m# l" ?8 \" @* c" h
  4. *
    5 b8 I, r5 {1 K0 a$ C
  5. * brief  EDMA3 Test Application
    , J. c1 A- [) z/ m6 T" C
  6. *, k5 D5 |! ?0 D4 @6 o. j5 p
  7. *   This file contains EDMA3 Test code.
    & p0 c+ ^$ B$ w; S1 y/ q9 p
  8. *
    $ @4 a1 o8 l! n: m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * x8 j8 R, x0 b2 K& w$ u& |4 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # h# J: d1 e" C$ e
  11. *         TO CHANGE.
    , u: V  T) e+ O% l4 y4 U/ I$ {
  12. *5 y0 }/ c- @* i3 q# Z7 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 o! _' [! `( z  @
  14. *" |8 I  U7 C% O! U: ]
  15. * This program is free software; you can redistribute it and/or
    , E9 \3 b, }9 J' S) W
  16. * modify it under the terms of the GNU General Public License as
    + t% B1 j$ q  n( i. M
  17. * published by the Free Software Foundation version 2.
    % E$ b1 l+ g9 Y! I# }) {
  18. *
    - F5 ^- X9 L. s; O( }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 @* I$ F, b, a/ Z+ a
  20. * kind, whether express or implied; without even the implied warranty
    3 m- Z+ G% L* `2 P% V3 }; V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; p- ]! T' g4 a' Y* r
  22. * GNU General Public License for more details.3 w, ]: O% L$ {
  23. */
    7 I/ v: ^1 C/ I$ c" j

  24. / z2 V* R# I% }$ h
  25. #include <linux/module.h>, l3 P$ e, i% q/ ?: [0 c
  26. #include <linux/init.h>3 g1 k8 p4 f& a
  27. #include <linux/errno.h>
    # J1 K: [5 v' N4 C! c
  28. #include <linux/types.h>
    7 G3 B' u. Z$ i* F% V% j
  29. #include <linux/interrupt.h>
    8 F) i3 R$ p: a' R' i% b
  30. #include <asm/io.h>( f6 ?# w8 W7 l6 v1 b" k% b3 K
  31. #include <linux/moduleparam.h>
    " g, C" c$ O- ], d' C! u$ a- ?
  32. #include <linux/sysctl.h>
    & u3 G, s8 V7 K
  33. #include <linux/mm.h>) R6 ]' w: V' P
  34. #include <linux/dma-mapping.h>
    . a9 k; Q! \0 d4 Z& o

  35. # d# r% a, P7 `; Q
  36. #include <mach/memory.h>
    ' I. G1 x3 M7 s) b! z
  37. #include <mach/hardware.h>
    + r2 d: ?" J* V
  38. #include <mach/irqs.h>3 S9 X+ ~6 l" ?  N( d" `
  39. #include <asm/hardware/edma.h>
    2 }; M/ ^  E. H
  40. ; J6 o2 Z# W8 J  @) W7 W% d& C
  41. #undef EDMA3_DEBUG( ?( X" B; x  f* c  s$ t
  42. /*#define EDMA3_DEBUG*/3 R7 f9 P: R: P2 S0 v
  43. ) `, z8 b& k7 c! V: j2 ]
  44. #ifdef EDMA3_DEBUG
    " I: W4 H6 _3 @- L! M; s; V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 E" [: d9 \. U0 b9 T  T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 N6 D  N0 S7 M! ]. j; i& n+ K0 [- }8 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); P# v4 c" R, X3 E
  48. #else+ l8 M" s$ {% b* |4 O
  49. #define DMA_PRINTK( x... )# Q& F7 P0 T- ^1 m. w: g; s
  50. #define DMA_FN_IN: {5 U/ H5 z/ g% A  W$ F5 E0 |
  51. #define DMA_FN_OUT$ w" m8 R/ U' U3 `% X
  52. #endif, ~6 L& U( M4 K0 _

  53. # G$ g7 ~/ k2 \/ a. B( q+ Z  ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + a1 k/ }. p1 {# A
  55. #define STATIC_SHIFT                3
    9 |% {- \1 H- P' T' w1 F! F
  56. #define TCINTEN_SHIFT               20$ G1 F2 P9 w5 g0 t6 V$ a
  57. #define ITCINTEN_SHIFT              219 s4 P+ d; N. u* r5 G
  58. #define TCCHEN_SHIFT                22
    $ k/ M% y* {5 ]& r
  59. #define ITCCHEN_SHIFT               234 B- j) I1 r$ U% ]( k4 q
  60. * _8 i# J# G) s; O6 l/ m4 x1 s3 u
  61. static volatile int irqraised1 = 0;2 N9 J1 z+ w4 J5 L" o8 H
  62. static volatile int irqraised2 = 0;
    % C/ Y" |. h3 z! R/ F: M7 }

  63. . s$ h- }( J5 l; e! G: h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 k- C- O7 o$ X6 g! E( a& `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P. b& Z. s5 [$ I3 j) y3 e) n( [! a  x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n  v5 C' S- W
  67. : K* v9 v( S7 {/ Z
  68. dma_addr_t dmaphyssrc1 = 0;
      M6 Z3 a2 \8 E! d9 H
  69. dma_addr_t dmaphyssrc2 = 0;
    1 N( E' \9 T8 R, w# T3 a2 y
  70. dma_addr_t dmaphysdest1 = 0;, B/ Z  c# S$ h, ]
  71. dma_addr_t dmaphysdest2 = 0;: S0 v1 P& R( C! o

  72. - o( {4 d3 |$ r! l
  73. char *dmabufsrc1 = NULL;7 o7 `' N0 ]4 Y( a0 U
  74. char *dmabufsrc2 = NULL;. }4 ^$ M6 V$ Y
  75. char *dmabufdest1 = NULL;
    0 M; y5 B% @1 P$ q% {
  76. char *dmabufdest2 = NULL;
    ) Y. v$ d. Y5 Q7 _) o2 r4 |- Q
  77. & M1 X) w! u5 `3 \9 g
  78. static int acnt = 512;& ^7 i0 n9 C3 [+ s+ s1 v
  79. static int bcnt = 8;
    0 H; M9 i& m; M. G, g( o0 T+ d: S2 h
  80. static int ccnt = 8;
    & f+ u, _6 `* \+ i0 g% [, W

  81. / |( e4 u) a8 N1 q
  82. module_param(acnt, int, S_IRUGO);
    9 e7 f/ ]$ t; q1 m/ Z
  83. module_param(bcnt, int, S_IRUGO);
      b( `3 O4 m" L! e; i+ q4 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! K, R# j  u8 f( ^. {# B* r$ ~+ X9 [4 s' c3 e: z- @7 R, w; u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: }4 B0 y( H3 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' y0 N7 j2 l$ ~& t  T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! U/ J6 c% G3 C5 G% B

" @; u# Q; c" H7 f+ ?
" h. t/ m0 v' ?* U  X: Q* F- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 09:28 , Processed in 0.039862 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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