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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 C3 s. m  ~: S" s) Q, d6 G
  1. [code]EDMA sample test application; l5 {! [  p) k. r; G
  2. /*/ Z6 `4 I5 E" `, ~9 G
  3. * edma_test.c
    8 ]5 ]' E. k: a2 O8 `" S/ W9 ^9 Z
  4. *7 G5 x( M3 O6 d% z8 K
  5. * brief  EDMA3 Test Application
    8 }6 M: e$ ?( U7 U. L' }9 {
  6. *
    & N* E+ L& q4 }0 M2 t) |
  7. *   This file contains EDMA3 Test code.
    2 t- u" ~! h1 Z+ d4 U
  8. *
    4 Z: W2 N$ v! \" a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 {% ~3 k3 y, G9 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( N5 S5 C8 ?* C1 \
  11. *         TO CHANGE./ F' h! j; o6 n& ?) Q$ J3 j
  12. *! p4 ]# Z1 n: i7 g- B# i& w! Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " _  K; R! A7 N6 {" b. S. }4 ]
  14. ** m" \. _- \; v4 K8 ~
  15. * This program is free software; you can redistribute it and/or
    7 o2 g( }- {4 F* _6 s. F
  16. * modify it under the terms of the GNU General Public License as: C* g0 V: ]% e# @1 M# N; i+ N2 a
  17. * published by the Free Software Foundation version 2.
    ( B, C( U+ S+ N3 g: L2 Q! y
  18. *) c" n" i% s# l; V! N, H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) V% S; w( P) L1 F$ n7 t4 U9 O+ e
  20. * kind, whether express or implied; without even the implied warranty8 e5 B; p; T& r4 }/ |9 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 q' m+ ~* s5 j" ]
  22. * GNU General Public License for more details.
    $ D+ I5 J' M0 a$ ^8 O+ ~
  23. */5 V! A7 C3 X" n: ?) r0 s

  24. ; C8 o; y8 ?! w
  25. #include <linux/module.h>
    " ~8 x* F. ]$ Q  v3 I, w8 Q; E0 s6 d: u
  26. #include <linux/init.h>
    - g8 ~7 t4 _% v' w8 a0 e% W
  27. #include <linux/errno.h>
    # @5 ]& |; y7 f9 B& k1 h; U
  28. #include <linux/types.h>0 ^, m' P9 R; F" L5 T
  29. #include <linux/interrupt.h>3 l* `" |+ O) H7 l( Y) L
  30. #include <asm/io.h>. E6 J: t9 L# R; {$ `
  31. #include <linux/moduleparam.h>2 |9 S2 z8 W3 ]  G! ~2 F
  32. #include <linux/sysctl.h>
      j( v3 d8 ?! A" i3 T
  33. #include <linux/mm.h>
    / z: d; y  f$ q4 N  N$ |/ w3 C( F
  34. #include <linux/dma-mapping.h>5 g" [. H& a/ `# W% a! v; s0 X

  35. % {9 ?, X5 v( U
  36. #include <mach/memory.h>( l( [/ j; u/ z2 b0 p& D
  37. #include <mach/hardware.h>! U* B. P; ]% x/ j3 J2 S/ M
  38. #include <mach/irqs.h>7 j  }# P3 Y( K% I, x( M; D
  39. #include <asm/hardware/edma.h>
    6 Y4 |( S# o; d& Z
  40. % l9 L7 l( [8 S$ ^0 L0 C
  41. #undef EDMA3_DEBUG
    2 [: V, ]/ ?: E2 s) ?$ [
  42. /*#define EDMA3_DEBUG*/
    " q. C- D9 H& P0 E; I( ~

  43. 1 R2 Q* k& v; d7 j" c. `
  44. #ifdef EDMA3_DEBUG
    % M5 l& R" B; }: h1 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * l& ~" \3 N/ b1 T5 e4 X: X  ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), x1 }& s6 C; W7 X: p$ T" e7 i3 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 b2 T' |# b9 a: o
  48. #else
    5 q% ]8 g# F0 v0 Y6 q
  49. #define DMA_PRINTK( x... )
    $ ?7 @# H$ k( D# u8 L7 V. F: t
  50. #define DMA_FN_IN
    ) c- `" b  ~. K0 E6 x
  51. #define DMA_FN_OUT/ V( o* z% ~, d# e$ P9 S9 K
  52. #endif2 R. I! n5 A, {) ^$ d: U1 g, ^+ C# V
  53. 2 J, z% U$ W: M  I. |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ S& l0 }6 C: l% ]9 w7 Y/ ?' E
  55. #define STATIC_SHIFT                3
    ( u9 K% i+ `; N; K7 Q+ n! w
  56. #define TCINTEN_SHIFT               20, ~9 B  _5 v: u8 \: M' f
  57. #define ITCINTEN_SHIFT              21' _$ Z. d) K* {6 t$ f6 A* a: P- `
  58. #define TCCHEN_SHIFT                22
    5 R: w  k, [1 K
  59. #define ITCCHEN_SHIFT               23) }# T! V1 }( k
  60. & v0 ]# m! V  Y) N8 {
  61. static volatile int irqraised1 = 0;
    * A* S/ \, K% h( L# r/ q% ^5 O
  62. static volatile int irqraised2 = 0;( I' U- t% `1 x1 C
  63. % L: e& m+ s% a+ n  g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M6 N) E- U& s6 x9 f7 ]) H4 q1 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R7 v3 ~8 E  z0 U, W! B! p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % p( N1 S4 c% v+ I* Y0 l; Z
  67. / }# e6 ^  q/ D/ V9 |9 o4 p
  68. dma_addr_t dmaphyssrc1 = 0;
    ! p7 A% ~$ k# R4 J0 N* |. y
  69. dma_addr_t dmaphyssrc2 = 0;, C1 v" E" w5 b! K, k
  70. dma_addr_t dmaphysdest1 = 0;& k, ^- c, D3 t9 K0 O
  71. dma_addr_t dmaphysdest2 = 0;
    . G1 G7 T" f1 i" b, y4 A$ u- S
  72. " h( b) _1 f, @; W" b( P6 B
  73. char *dmabufsrc1 = NULL;. I- y; y- h4 r- r
  74. char *dmabufsrc2 = NULL;
    8 h( C' X8 T" c$ @( r) O
  75. char *dmabufdest1 = NULL;% C0 J" v% y: m/ H+ y* _9 q8 ]. e
  76. char *dmabufdest2 = NULL;8 @: B4 }5 b8 H( |- K. m9 s8 m0 \

  77. 9 u8 _& p! c) u# s
  78. static int acnt = 512;* a: H  P, @. x' q. w) D
  79. static int bcnt = 8;
    2 h4 U% {* h  w! i3 P* v( Y) ?
  80. static int ccnt = 8;$ F0 {) s+ x. i

  81. 5 w; V( ^, E" I. t
  82. module_param(acnt, int, S_IRUGO);# t3 Z" D8 V; ~3 Y9 K, z. }1 }! r: K* ~  S$ T
  83. module_param(bcnt, int, S_IRUGO);' S( R# j! E, M3 t5 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 P7 X2 n! l0 a, x

+ r+ P6 a: F$ R. X8 X. c7 X* N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g0 `5 l6 {1 Q) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 s; c0 ^1 @. H6 O! g( R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' M1 ]6 `) F8 E: o7 E

$ W# v7 ?/ {5 m& s  w. j! N/ `) D( H* w) Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 14:34 , Processed in 0.041001 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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