OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" G' P) `) k1 S5 w/ A
  1. [code]EDMA sample test application* `' ^0 d) P1 g
  2. /*4 p) K+ g3 |& G. L
  3. * edma_test.c7 v2 I* S  j% g: l5 ^$ x
  4. *
    9 {& B; z6 X3 W- A1 u# X, v
  5. * brief  EDMA3 Test Application; N) T- @5 a7 K0 i9 ]
  6. *
    7 P9 S; L% Z8 r( O
  7. *   This file contains EDMA3 Test code.7 |/ c% i, W3 g/ V/ H
  8. *
    : I0 I) {2 i% |8 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ J2 ~1 B0 Q, S. j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! K4 ^. |# p. P  z" G- [
  11. *         TO CHANGE." S1 s6 p* S* A+ T
  12. *
    ( x, W% R8 Y$ g/ r7 X% r, o1 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 o9 F5 `- Q- P) t
  14. *; t. `- i1 a* B% s6 c% f0 H5 w
  15. * This program is free software; you can redistribute it and/or
    5 E* T& c  d- }& h4 }
  16. * modify it under the terms of the GNU General Public License as
    & _5 m( y. t; Z4 i/ I  W
  17. * published by the Free Software Foundation version 2.
    ! S% m, \' ?  E/ S1 x, N4 {# y
  18. *0 r. I  y& Y/ D5 m3 n; |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ C, C7 m* g6 n/ t9 k
  20. * kind, whether express or implied; without even the implied warranty
    , ?/ B- E0 T- P* h2 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, X* |* E1 t4 r9 U! K, z" [3 ?: V: r
  22. * GNU General Public License for more details./ B; H3 Q/ z0 P1 L8 T3 V
  23. */3 a& s& q) N) y; @6 [. j! i6 X

  24. 1 A: Q& A& V+ I
  25. #include <linux/module.h>' ~* T  `6 F& a, g
  26. #include <linux/init.h>
    . O* O. [) j, l# e( l" ^* Q
  27. #include <linux/errno.h>
    5 L' m: A3 f7 t4 j
  28. #include <linux/types.h>
    $ Y, G/ V. n7 t9 |* v) v) J& [2 U$ i
  29. #include <linux/interrupt.h>" E; K2 e, j7 d; Q  @
  30. #include <asm/io.h>$ u6 ]3 z2 s$ n8 F
  31. #include <linux/moduleparam.h>
    9 v5 {' Z: ?3 y+ F3 ]; B+ d
  32. #include <linux/sysctl.h>
    " u, g( z! d8 A$ B  c5 N9 t
  33. #include <linux/mm.h>
    2 \# s8 p% b% s. m- Q; N/ n! k" b' y
  34. #include <linux/dma-mapping.h>1 I; G) x# ?: h2 Q+ \2 d. P# I! X

  35. / |5 J% U" J  y3 ]4 U' h  J
  36. #include <mach/memory.h>' q$ }- e  n2 f
  37. #include <mach/hardware.h>$ r) O! b0 O# s' i' v" v0 S
  38. #include <mach/irqs.h>" q. v1 G! {% b6 u
  39. #include <asm/hardware/edma.h>% i$ i; [6 W& X
  40. ' d- {, m0 o+ u$ ?# `& p
  41. #undef EDMA3_DEBUG/ B) `' `5 B1 Z, h0 K  H9 S+ i, d
  42. /*#define EDMA3_DEBUG*/
    , J& O8 j9 Q) @# x
  43. ) r% F4 A* z1 u; a* j' y. H' G
  44. #ifdef EDMA3_DEBUG
    ( i- q% H& G( G4 n4 G7 O5 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ~" t, |( f  ~  V  `- a. K( i; T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" Z0 }* z$ T% K: `7 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : p  x0 r5 U3 k  d& u& x# K" M
  48. #else/ L) H6 s% B# H: u+ W! I/ j2 Z
  49. #define DMA_PRINTK( x... )
    8 {, K% y5 C) F: d! E, p: e/ c
  50. #define DMA_FN_IN
    5 P. Y/ j5 d0 k
  51. #define DMA_FN_OUT  S8 n& E8 i, Y; S. p% D
  52. #endif
    ! f5 X) |  F' P+ x! }

  53. ' _0 f* O+ k# I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 @$ P+ C9 r, j  f
  55. #define STATIC_SHIFT                3( j3 C6 T. o1 P
  56. #define TCINTEN_SHIFT               202 @4 X5 E1 L( [7 |: j
  57. #define ITCINTEN_SHIFT              21. U. c$ b, N- D" Y+ f
  58. #define TCCHEN_SHIFT                22
    1 e7 l" }& @) I5 u4 V
  59. #define ITCCHEN_SHIFT               23
    8 S+ j# m2 B+ H& o2 b4 U; ~
  60. 3 u- T& ?8 k, y" t$ c
  61. static volatile int irqraised1 = 0;4 [4 F3 y  q6 u6 `; J
  62. static volatile int irqraised2 = 0;
    ( b8 G: z# i0 l, j
  63. " H7 P$ R3 m) @7 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `) N+ S* s4 m5 C6 V! ^0 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & |! E& a; M; u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 l' b. G3 t* B4 ~( A

  67. 0 L; @# Z& u; z6 c: u, m
  68. dma_addr_t dmaphyssrc1 = 0;
    8 v) G4 S/ a8 M
  69. dma_addr_t dmaphyssrc2 = 0;& ^( B- h- c2 D) F4 M% h7 q" t
  70. dma_addr_t dmaphysdest1 = 0;# h( L2 \3 T. k5 W- l; p- R) y
  71. dma_addr_t dmaphysdest2 = 0;9 U8 P0 J% Z% ?' Q* Z/ r' T, v
  72. 7 R' n+ P4 R7 B1 `0 c0 c
  73. char *dmabufsrc1 = NULL;
    - T0 y: Z: L/ k4 @/ ^5 x0 \" ^
  74. char *dmabufsrc2 = NULL;" y+ z$ p3 b$ b
  75. char *dmabufdest1 = NULL;
    8 _7 m, Y2 y6 B1 h3 p1 U4 w: Y
  76. char *dmabufdest2 = NULL;
    9 a" J7 p  H: v9 }/ g+ V* @& G5 Q/ X

  77. ; E6 ?3 ^' Z7 A' _9 f# p! p/ P) y
  78. static int acnt = 512;0 R" y8 ^2 ]3 s, W
  79. static int bcnt = 8;% c6 k4 ~  G/ ]9 K% b% k3 `
  80. static int ccnt = 8;
    7 D# ?8 h7 F5 ?/ w$ u

  81. + K; @% b5 F" t% G% j: H+ G) o
  82. module_param(acnt, int, S_IRUGO);
    , Q1 n" K3 Y" V' P
  83. module_param(bcnt, int, S_IRUGO);
    4 k$ r3 u7 M3 j6 o  m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! j" I+ r; G& u2 H

  [1 R4 K9 ^# U: @- w/ ^. |/ i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 k/ b5 X: O2 I: G+ @, U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: x3 r6 ]- y3 O5 {: |* Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. A: g9 x# b, }$ D, z" ~8 k2 [1 e! T1 w4 x( {) R

4 E# R3 y3 }9 G, v2 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 18:24 , Processed in 0.036295 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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