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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 e! J- ^+ J- I
  1. [code]EDMA sample test application
    9 ?" o# A2 }2 n9 f
  2. /*
    ' v) l, W1 a2 @" i4 R7 `- E
  3. * edma_test.c. |2 c: F6 R8 k8 [/ @- `! n; @
  4. *# v7 g8 I- C5 U3 B9 I
  5. * brief  EDMA3 Test Application
    5 r9 H: d2 d+ d* A% s# o9 W
  6. *
    ' p' x, w- `1 W8 x& f8 t  t$ {4 P3 V
  7. *   This file contains EDMA3 Test code.& d8 U5 ]% \" X) v3 o+ j7 t
  8. */ ]4 s% S7 _- t/ q( a+ Q0 K0 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v2 Q2 Y% {0 a+ c/ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ]! N3 V  V* Y
  11. *         TO CHANGE.
    / p% s5 i0 T! D, i
  12. *7 N5 A& S8 f0 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 A+ c4 }" z4 d8 m, d; |5 b' g
  14. *
    3 W  S: o2 @4 o0 f$ T6 R
  15. * This program is free software; you can redistribute it and/or
    1 D. F! H' L5 y3 E# k6 M0 `
  16. * modify it under the terms of the GNU General Public License as& q+ K5 S' s. a. c7 r6 q7 u& y
  17. * published by the Free Software Foundation version 2.
    : E8 ^) M' e5 F1 d/ O* J4 g; w
  18. *
    7 U3 ^& [/ M' p8 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Q; i" H6 p/ O) r4 i8 \
  20. * kind, whether express or implied; without even the implied warranty! k/ V% O  O  M  B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 [1 S# d) y- I! \$ v
  22. * GNU General Public License for more details.* O+ _. g* J: b3 [, C( Y, i# H
  23. */
    ) s2 W1 L  v3 O2 l# Q6 W2 y1 w
  24. / [) n' Q5 r+ U& i% H9 G% E' ^
  25. #include <linux/module.h>
    / g% e& _% Q$ |( o% ~) Y
  26. #include <linux/init.h>* M+ h( C0 `( j; P% e' G
  27. #include <linux/errno.h>9 d0 N: S4 d: F- U* S
  28. #include <linux/types.h>/ D3 F" m* ^! ?; P0 L' f7 D2 G+ S
  29. #include <linux/interrupt.h>
    7 A( a" O+ ?! p# u5 _
  30. #include <asm/io.h>2 _5 w1 r  i3 x# [3 n4 d9 |
  31. #include <linux/moduleparam.h>! {1 t# x9 ^# v1 N% A
  32. #include <linux/sysctl.h>
    " v' a6 O+ K. V) Q" P
  33. #include <linux/mm.h>8 y. p  r: z& ]7 l: a0 ^
  34. #include <linux/dma-mapping.h>9 \& {$ L) k1 F0 @+ x0 J
  35. 3 C1 q' q+ r$ G) K
  36. #include <mach/memory.h>" d$ s" N+ k+ ^  U
  37. #include <mach/hardware.h>) L; _3 \8 i" c: M
  38. #include <mach/irqs.h>$ j6 i# {' z( d& ?( Q+ N# n* q
  39. #include <asm/hardware/edma.h># a2 j: ?% Z9 m' j4 |
  40. + D. Z4 {* U- Q* X( {9 h4 \
  41. #undef EDMA3_DEBUG* `- m( j( c6 e* V; N
  42. /*#define EDMA3_DEBUG*/
    8 \+ h+ D6 f4 x
  43. 8 o" V2 \( v8 M
  44. #ifdef EDMA3_DEBUG
    ! ^5 ?1 F6 ^% I) C; I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 d/ A; K# M5 m0 m1 ?& v7 Q! e4 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( k. }6 U! g- o7 F) c1 D3 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 N$ q; u2 Z0 K( J6 a8 Q/ M
  48. #else
    $ j1 B* ~$ [: o/ m
  49. #define DMA_PRINTK( x... ). ^  t3 M; Z2 D
  50. #define DMA_FN_IN, W( O/ y8 C0 \6 X8 f5 n" J
  51. #define DMA_FN_OUT
    6 ?) X5 L% s& I/ a1 g: V& l
  52. #endif
    " P: _* J6 v, {: {' _/ [, T

  53.   d% {( C& t+ S: S7 R' z# E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      |/ \8 L7 y! N* {# n3 w
  55. #define STATIC_SHIFT                37 W$ h3 A/ a$ w1 D0 b6 g% O$ x
  56. #define TCINTEN_SHIFT               20
      i/ s; C- d# l" E- K- t3 W
  57. #define ITCINTEN_SHIFT              21
    8 D9 n4 T) B6 J* e2 h: H
  58. #define TCCHEN_SHIFT                22
    8 j1 ~/ f/ l! F. {% _
  59. #define ITCCHEN_SHIFT               23
    2 D# q. Y4 k2 s! ^$ A+ [/ S2 r9 ]
  60. 3 E# |9 U6 W& J6 Z
  61. static volatile int irqraised1 = 0;
    ' b6 D" p$ m8 |8 o( Q+ M
  62. static volatile int irqraised2 = 0;+ }5 [5 U! [% Q. A) S3 L4 Q, y
  63. : Z; j; F! s. m9 Q% s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 h  g: Q0 k1 j, B, G! ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , _+ r2 m2 M& r! e5 n5 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e( g1 j# \& }4 e' ?

  67. ; s1 l  g! n& M* C/ Y) g
  68. dma_addr_t dmaphyssrc1 = 0;
    0 G6 y" t4 Q( G0 n; [0 Q6 m
  69. dma_addr_t dmaphyssrc2 = 0;
    : K5 N/ Z6 W: ]6 P6 M
  70. dma_addr_t dmaphysdest1 = 0;
    5 O7 n. u; `$ y
  71. dma_addr_t dmaphysdest2 = 0;3 M: W- c( R; x4 L' W$ Y7 J

  72. 1 Z, x) `$ a3 r7 k! G8 b
  73. char *dmabufsrc1 = NULL;, {/ @" i7 F8 v" m# m# j
  74. char *dmabufsrc2 = NULL;
    : K& z# ]8 c/ ?
  75. char *dmabufdest1 = NULL;' M& t- j6 x* V& d& s2 ~
  76. char *dmabufdest2 = NULL;. K! l7 i1 L9 E1 k- h/ g

  77. * P3 z. i3 S# O8 f5 f
  78. static int acnt = 512;1 q8 M+ X$ l1 q, c9 q6 u1 f2 u
  79. static int bcnt = 8;
    0 D2 |8 r/ ?6 F) e) w1 _9 I
  80. static int ccnt = 8;
    ' }, T, z3 N+ d4 n3 W
  81. / Q0 I6 t$ w4 B; X6 W
  82. module_param(acnt, int, S_IRUGO);
    " G9 G' o4 `" C% o$ [& s3 c
  83. module_param(bcnt, int, S_IRUGO);
    1 o1 n; W6 S- i- l8 E2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  Y. b" D& j6 M0 v  o" J2 p: l
1 K. u3 {. V$ |' v4 ?" V1 f9 W( p. }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |( l1 ?' [4 d2 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* l! c8 F: [8 J4 f* ~5 v6 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' y% h( w/ h2 _
1 H. ]7 }% ?6 o

* ]  o: S2 [$ f0 i' d* c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 06:08 , Processed in 0.038347 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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