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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Y: _+ |. i( b# i3 R
  1. [code]EDMA sample test application2 y- ?4 s  j7 y6 J
  2. /*( r$ B7 h3 ?2 B
  3. * edma_test.c
    ' K) U3 \' g& M, h( N- G! R) a
  4. *  b7 R6 s' }. A1 q' N; R
  5. * brief  EDMA3 Test Application
    ' t) Z. C; G5 g( p/ P" G6 \, q4 x
  6. *; i/ l' x/ [7 k3 z1 O
  7. *   This file contains EDMA3 Test code.' f4 d3 W* d6 |% S
  8. *
    7 r2 }, P( X0 l+ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / o; ^0 K& ~: G. v& f0 `2 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( K0 ?) l( t& ^
  11. *         TO CHANGE.
    5 M+ I+ T0 @; e5 d4 O
  12. *
    ) ]8 L) q, @( F5 L) y5 @5 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( @; z* O( U* p  P& [
  14. *
    & k1 o/ M2 a) U8 M
  15. * This program is free software; you can redistribute it and/or2 C9 q! J/ M% K- a( F! w( ?
  16. * modify it under the terms of the GNU General Public License as
    & v/ S4 N% I. u; Z
  17. * published by the Free Software Foundation version 2.
      f+ X4 b8 M% d5 g7 W! H5 \
  18. *" Y, h+ Y* B8 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 F' F' }. G& p
  20. * kind, whether express or implied; without even the implied warranty
    . u" S9 Y' ~$ P& M* o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ |# P- L, n3 D3 S8 I
  22. * GNU General Public License for more details.
    + X$ J: W  a* [$ s: N! G
  23. */; I' {8 j5 k) w3 S2 s$ k

  24. 1 f9 M$ A" ^2 G5 s" E/ P. x
  25. #include <linux/module.h>
    # g. n6 P! f4 U8 N5 c
  26. #include <linux/init.h>: C8 n9 c# H! g9 d
  27. #include <linux/errno.h>* n4 l4 f8 `& `4 J0 j  ^
  28. #include <linux/types.h>
    % r' o4 i6 _( H; b# P; _: U9 F
  29. #include <linux/interrupt.h>8 H% |0 K" }" ?+ ]
  30. #include <asm/io.h>8 N* Z: |3 f) j9 C$ {1 v. o1 P( [
  31. #include <linux/moduleparam.h>
    $ j+ j2 P" N, H% y
  32. #include <linux/sysctl.h>, E* P* U) [. {' n6 z
  33. #include <linux/mm.h>
    # d7 v1 R5 f7 v9 b! J! ~$ h2 T. z
  34. #include <linux/dma-mapping.h>; x3 U9 f/ n% B: o0 {! w# J! f

  35. % E+ `/ q/ _& h/ ]- p
  36. #include <mach/memory.h>$ W( [8 V9 o" Q% H  w
  37. #include <mach/hardware.h>
    ) T4 [: a6 F* q8 Z2 C. Z( X) F/ J
  38. #include <mach/irqs.h>- A, w( C. E% D; v9 }* y
  39. #include <asm/hardware/edma.h>
    & j$ v0 e( B. Z: W, p) c
  40. ; V4 Q% f' _( l5 |  ]
  41. #undef EDMA3_DEBUG! h( d5 g2 Q% e" j
  42. /*#define EDMA3_DEBUG*/4 K5 r, \6 B  v4 P6 Y+ M% S
  43. , T: F7 m3 r$ h9 @4 q7 C
  44. #ifdef EDMA3_DEBUG
    ( i) Q1 b" J$ x& t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 q; g9 P+ h# ]& ?9 N* N6 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 H! V# v: B. S8 ^2 p% F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / l* Q0 H6 W1 R6 t$ a4 r% O
  48. #else. l+ U/ J+ `7 W, z
  49. #define DMA_PRINTK( x... )% ~, S9 @" Z7 ~/ I( G
  50. #define DMA_FN_IN
    4 s3 I  u* `& a2 n2 y( ]$ r
  51. #define DMA_FN_OUT. M- E- z2 x5 I3 Z" x3 M# N
  52. #endif& d0 G0 R! W. O4 o

  53. ! }: r, G0 ?5 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 N' I+ u& }* l! O" F5 ]
  55. #define STATIC_SHIFT                3
    " m: {' m3 t0 ^5 `% |
  56. #define TCINTEN_SHIFT               20
    . L3 I& P# d# C4 a
  57. #define ITCINTEN_SHIFT              21% T! C) H; ]  Q8 _2 H2 e% c1 f9 q
  58. #define TCCHEN_SHIFT                220 [- K" I1 K* C
  59. #define ITCCHEN_SHIFT               23
    + P: K2 x+ i+ L5 N9 R

  60. ' j7 b/ e+ D3 @" A% x& O. h
  61. static volatile int irqraised1 = 0;+ S* V! W+ ?: o2 h0 v4 j- V% \0 \
  62. static volatile int irqraised2 = 0;5 J! R  a/ r* `, ]" |9 e, w

  63. # y' P6 ^1 S5 [5 {& a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * U/ Z! C. i2 j# ]+ T; e8 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 z: M9 e6 }) C5 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B1 l7 Z- b$ V+ F4 F

  67. 4 u. j6 z$ k7 Z1 B- o
  68. dma_addr_t dmaphyssrc1 = 0;
    + X+ G: f0 u8 N  i- i
  69. dma_addr_t dmaphyssrc2 = 0;
    $ P! [3 m, k, t% Z
  70. dma_addr_t dmaphysdest1 = 0;6 ]2 [5 c- d" r9 C) U
  71. dma_addr_t dmaphysdest2 = 0;
    / k$ q& b# z7 ?  B

  72. + o' M$ Q* }" x, n1 N
  73. char *dmabufsrc1 = NULL;7 J8 y9 r0 l4 [; l7 I) Y
  74. char *dmabufsrc2 = NULL;6 E* y  N' U, Q! o8 T3 d" \$ a
  75. char *dmabufdest1 = NULL;
    6 W% _" F4 O; R0 N
  76. char *dmabufdest2 = NULL;; i8 N+ r* {/ L. K, D
  77. ' i- S' P  g- \6 U+ W5 Z3 h" W/ \
  78. static int acnt = 512;
    : k; H1 O  o. G6 A( T0 N$ X) L
  79. static int bcnt = 8;
    : B$ Y+ O3 \8 p# U) P" e: J
  80. static int ccnt = 8;8 a6 n5 F+ [! N# y

  81. 8 N: r* M' g$ U: i
  82. module_param(acnt, int, S_IRUGO);
    ' y0 J4 X- g# H
  83. module_param(bcnt, int, S_IRUGO);* A: h2 V/ U2 U4 T4 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* h, b+ k7 h  ~' U% _9 G) C# G: q
2 t/ X" @, N* c" y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 o" U- j% P& b) Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 @# m5 g& f- d" {% u1 f/ \1 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g: F9 V8 ?1 J, L0 K$ H

4 M3 G2 L) P! \# C/ e  ]: ?( a4 p8 }0 R2 W) g8 x" [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 19:12 , Processed in 0.040487 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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