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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 Z6 r+ ~; m1 D+ f
  1. [code]EDMA sample test application+ E5 K) A; D" h. c3 h8 ?3 R* }
  2. /*2 u" P  e2 |/ t! v: J4 K& e
  3. * edma_test.c
    5 t$ G5 ]" p- ?: Q" Q$ l
  4. *
    # y- Z4 I! Q$ \- ~6 B# d
  5. * brief  EDMA3 Test Application  K+ k/ O0 {) x4 ~7 \
  6. *
    - d& A7 s2 ^2 {1 j: T; m
  7. *   This file contains EDMA3 Test code.
    ) ]* p  w3 g2 b3 f* t! T
  8. *
    / m! Z1 @3 A2 ^* \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H, j# f9 Y! v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / {* Y6 U7 [7 p5 L; L7 h0 p
  11. *         TO CHANGE.- y# I  p4 ?6 u9 _. w
  12. *, a! k9 [/ o1 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% S1 m% ~) F6 ~( k
  14. *+ d6 k% y8 }& P1 R+ T
  15. * This program is free software; you can redistribute it and/or
    % `) M/ M# A  }) l
  16. * modify it under the terms of the GNU General Public License as2 D/ U9 I& X2 K8 n2 Q
  17. * published by the Free Software Foundation version 2.
    , H6 m* q/ I2 u3 R
  18. *4 M% r# _2 G3 L+ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 k3 p: I1 {7 {6 K) _, F: o
  20. * kind, whether express or implied; without even the implied warranty
    ) Q, ?; }3 h/ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 j4 F2 b- r6 ?9 t5 x. D9 b
  22. * GNU General Public License for more details.! y9 x: _; C) M$ p/ w
  23. */
    $ S6 M5 K" ?: G+ m, R3 _

  24. . H! ^  k7 W' ~. i2 h
  25. #include <linux/module.h>9 K' S9 |2 U5 A1 E2 {
  26. #include <linux/init.h>
    6 V+ e# Z3 Z1 x" s
  27. #include <linux/errno.h>
    - U# f; h1 m; x( V  I$ g
  28. #include <linux/types.h>
    , J: U' a* f2 x% ]
  29. #include <linux/interrupt.h>
    % \, W) b4 h; F& w
  30. #include <asm/io.h>- C4 V2 q# {" y8 U. K& C
  31. #include <linux/moduleparam.h>
    * P& S1 W) v8 b
  32. #include <linux/sysctl.h>$ c0 |1 P, s# L- C
  33. #include <linux/mm.h>
    ; E' K8 M. @8 ^( J0 @
  34. #include <linux/dma-mapping.h>8 y0 Y2 v4 p! ~9 i2 v5 Q
  35. , [" L( v0 P8 X( O0 M; \
  36. #include <mach/memory.h>
    % a  F+ s- {% w, _: l
  37. #include <mach/hardware.h>
    6 y3 a0 B3 K$ M! K6 g9 _
  38. #include <mach/irqs.h>
    . g, f! V8 v% e  ]5 }4 i7 x6 }
  39. #include <asm/hardware/edma.h>+ K$ b( a$ V$ m

  40. 3 Q; v7 p: t% e1 x. n
  41. #undef EDMA3_DEBUG, p! T+ i% X1 n4 X
  42. /*#define EDMA3_DEBUG*/
    2 s# ?3 \& R3 C" o, {/ ~

  43. # m/ Q$ @' U0 K! w1 S8 I# Z
  44. #ifdef EDMA3_DEBUG! t, n3 o, }$ o# y- L* S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! L% {  J9 |, g! C# H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ?: l' U: x6 D7 ~! W. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): d! t4 Q- |& ^, {
  48. #else
    7 O  n3 A6 A- b* V/ o1 p
  49. #define DMA_PRINTK( x... )
    ; [2 l; i1 [# `/ J
  50. #define DMA_FN_IN
    & j* F+ g: Y/ ?6 S6 g
  51. #define DMA_FN_OUT
    3 R: x8 G+ g) J5 K7 B* N# ^
  52. #endif0 |- \" e0 _$ D1 B5 y1 w
  53. ! V& X, d# ^' |, C, b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& e9 ]$ w& o% X( ~2 A" H8 {! }( O
  55. #define STATIC_SHIFT                3
    7 x; S  j, z% g! n. A' u& n# u. p* k
  56. #define TCINTEN_SHIFT               204 h! i* _- a, H
  57. #define ITCINTEN_SHIFT              219 h1 @0 {# I9 o% N3 I! M( [
  58. #define TCCHEN_SHIFT                22
    ( X8 C5 H: s' t* |; Y
  59. #define ITCCHEN_SHIFT               23
    ; y$ O7 N4 e6 H0 j* _+ }

  60. - R! O5 T. w$ `3 n0 O3 P* Q
  61. static volatile int irqraised1 = 0;1 p  l) s2 I4 F) j& J1 a
  62. static volatile int irqraised2 = 0;3 Q. |! H+ h. `1 U. t! {

  63. 9 r# F' k2 }( n9 ~, `, o& X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z' O! }) J5 D- J3 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : O( A% t7 k) j; o% \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " A3 D: ]! W8 J9 {, L; M$ U
  67. 0 o$ `' H: R! O5 {7 c4 Z
  68. dma_addr_t dmaphyssrc1 = 0;% Y3 o% }, j! Q9 B
  69. dma_addr_t dmaphyssrc2 = 0;( C. o; x; g6 x9 E. I; e1 S
  70. dma_addr_t dmaphysdest1 = 0;* \# B! U: K6 u1 ]6 E) e
  71. dma_addr_t dmaphysdest2 = 0;2 y9 ^( i& e% u- ^1 `; O
  72. & Q5 [! @8 L0 k0 H
  73. char *dmabufsrc1 = NULL;
    & E) o3 r9 l; k
  74. char *dmabufsrc2 = NULL;+ D7 ?( {7 S7 N% k6 ^& `, K
  75. char *dmabufdest1 = NULL;* t6 L: s" m8 \: C
  76. char *dmabufdest2 = NULL;
    & K/ g) |9 W$ c6 N& C! k2 P6 j: Z

  77. * n. U6 Z7 c- d3 i" S! r2 l
  78. static int acnt = 512;
    ! Z; e! @; [: r1 C5 D$ R
  79. static int bcnt = 8;
    5 N7 N7 y! s' @% c
  80. static int ccnt = 8;
    + `3 x: I' |+ {7 g

  81.   x9 K  H+ c) N- u5 y
  82. module_param(acnt, int, S_IRUGO);
    1 E  k4 D4 X8 X- h  O
  83. module_param(bcnt, int, S_IRUGO);0 s7 v# t& y  [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  ]  s6 Z  |, l& G6 V- S: i3 d8 j7 f/ @7 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ |+ `2 V; b9 g/ k) }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ H/ b/ g6 y3 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' E% S3 v( V! n: ~. H+ l" f1 V. R1 ~" A# d, r  P5 z% f
- d+ C* v0 a& H0 A3 f' t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 11:22 , Processed in 0.043055 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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