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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 T9 V4 i2 B2 h+ t/ F0 b
  1. [code]EDMA sample test application
    - J* i7 |% Q$ x* T+ A
  2. /*
    0 r( v3 g% M- v4 o! Q! v6 z& b
  3. * edma_test.c
    , U7 x. ?- _% @# H* ~- c4 Y
  4. *
    # D1 h  l8 I3 H1 O; s( B6 R
  5. * brief  EDMA3 Test Application' S% S3 m0 G/ P! [$ H# o+ |
  6. *
    ( J9 V# |& b! \. Z3 ?% O# _
  7. *   This file contains EDMA3 Test code., X, i7 |5 h5 F: n/ r: V% x
  8. *
    - U" f4 Z# F; |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / l* Y. l8 U6 v* I2 S* c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 e1 A; N0 J% O
  11. *         TO CHANGE.
    9 _: W) ~+ \3 I) C; ?
  12. *- \# A' S# Z* L- F/ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 s$ ^; x6 h8 B  V* w1 [
  14. *7 G% q4 S* |5 ~' o6 z4 y: v
  15. * This program is free software; you can redistribute it and/or
    - P( g: F; [9 R5 m* [4 X; P$ M
  16. * modify it under the terms of the GNU General Public License as; Z2 X6 ^$ S; [. O$ T& l3 o
  17. * published by the Free Software Foundation version 2.; l4 V3 ~! F% v7 Y
  18. *3 z! W4 U% k. h# j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % A2 K# ^5 b4 h4 p
  20. * kind, whether express or implied; without even the implied warranty. a& z1 O5 J8 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' w6 J! c9 d3 O; H
  22. * GNU General Public License for more details.) J4 _1 r, u/ x+ z: c8 Q
  23. */( P* K  L$ C" o& M

  24. 7 Q7 o  a, E  A7 L7 i
  25. #include <linux/module.h>
    2 n0 [4 A  @& D- h6 P
  26. #include <linux/init.h>% k. z' O# }5 U
  27. #include <linux/errno.h>& B( F6 Y: x4 w2 C$ c0 x! l
  28. #include <linux/types.h>. {% g- |6 d4 W( o3 d0 B
  29. #include <linux/interrupt.h>7 A! P& z% Z& k. {+ R! z! H
  30. #include <asm/io.h>
    / p" m. ~4 l6 P& E. k
  31. #include <linux/moduleparam.h>$ J- M5 U% P  T3 p/ ]2 B7 K- t/ N- l
  32. #include <linux/sysctl.h>
    ( z$ @. D- F. g  h# a4 u
  33. #include <linux/mm.h>
    " \, |! W& l! {) C% ~. n/ E/ f8 r
  34. #include <linux/dma-mapping.h>
    9 P- u! Z# V5 ^8 V. {0 X8 U
  35. . V! B; D8 R8 `2 c  F9 w+ Q8 O8 l
  36. #include <mach/memory.h>
    2 }/ J. X; [7 s3 d
  37. #include <mach/hardware.h>
    ; L1 l0 l! N4 X; Y, m+ w, v/ m- v
  38. #include <mach/irqs.h>
    + {/ q/ S( ]' U9 v' G, @( x- ~
  39. #include <asm/hardware/edma.h>
    2 p# ~7 C- H( m2 W% d$ q  b$ E
  40. ( |  H$ }% X/ q4 l1 i
  41. #undef EDMA3_DEBUG$ }. r+ i- R+ V+ f
  42. /*#define EDMA3_DEBUG*/
    7 T2 g5 a- j, c) ?0 P/ l
  43.   m' c/ I4 E8 @, |5 _0 S
  44. #ifdef EDMA3_DEBUG+ B, o6 b  k1 j! P! t* V! A3 O0 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ n: h! R4 F3 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # a/ {" H; T* r# W! e! L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A$ E: g" F; L2 ~, y3 d3 o
  48. #else
    ! N0 J/ L/ D4 `
  49. #define DMA_PRINTK( x... )
    & I4 T1 Q( r! l& Y# x. S
  50. #define DMA_FN_IN0 l; k9 \% Z3 A& a5 p1 X
  51. #define DMA_FN_OUT: s: _) X/ Z. \3 O6 d1 b; Z2 Y
  52. #endif
    8 P. R, H/ Y+ b- e1 A/ W

  53. 0 t# l+ L6 ?( k* o* S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 H! ?, ]- s6 x
  55. #define STATIC_SHIFT                3$ S0 A% f1 m4 }. `" C
  56. #define TCINTEN_SHIFT               203 N7 R  O" @" X; H  d/ L$ B
  57. #define ITCINTEN_SHIFT              21
    5 l1 A, q: q" S9 h9 ]
  58. #define TCCHEN_SHIFT                22
    # }( H9 ^9 Y2 H2 m, L( K. W4 M
  59. #define ITCCHEN_SHIFT               230 a) T3 C. D7 G- I3 \% Y+ s

  60. ; V4 ]5 P& ?% ~8 D" G5 R: Y+ s
  61. static volatile int irqraised1 = 0;5 k& @' M  _' b" [* v" W( x/ E
  62. static volatile int irqraised2 = 0;
    6 o8 a* Q! r5 M3 t3 K' r# \. H
  63. ( s0 N; H1 x4 x' x! P; {# V) L: M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 v3 n. Z+ V8 j: F* e8 R+ g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 {# G! ]7 ^* V  s; e& N" d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E6 K6 `7 h* c
  67.   }/ ?% j. Q/ G) z& V' S+ @
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ?. v' R9 j# e- E" E
  69. dma_addr_t dmaphyssrc2 = 0;! l/ a! _  \* C3 F6 A5 `
  70. dma_addr_t dmaphysdest1 = 0;
    " T3 j" A; y  O$ B, _2 _5 ~7 x, D2 R
  71. dma_addr_t dmaphysdest2 = 0;' g! a, A; ~( u  V) H& h
  72. ; F9 A5 X# A0 c
  73. char *dmabufsrc1 = NULL;4 K) ~% G$ q/ U% y
  74. char *dmabufsrc2 = NULL;
    , V; L4 a. n  [9 R1 k  ~' R
  75. char *dmabufdest1 = NULL;5 h5 F6 `- r, C% Z- c' {/ S4 @7 S
  76. char *dmabufdest2 = NULL;  u' `) v+ b% c3 H; V) u5 @/ \
  77. 6 q# @1 V3 g# p. o, V1 G0 f
  78. static int acnt = 512;1 u! x5 k7 Q4 B* p. `' r! a! F
  79. static int bcnt = 8;
    " C" T* C/ w5 a7 j% `) o
  80. static int ccnt = 8;2 y! D4 ]# k/ e" J. Q7 L' h5 g, C/ u

  81. 8 U5 v4 e( }/ B9 \
  82. module_param(acnt, int, S_IRUGO);( o9 k7 Y. a. g2 O
  83. module_param(bcnt, int, S_IRUGO);
    6 m7 v' t6 |* u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ?7 D( n$ Y: ^  P

8 j: ?9 D' h7 U0 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* r9 B0 {! C9 l9 x. n% h& e! d/ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 T" b0 q8 U$ F) a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ]6 }0 M  Z5 j, ]- [, X2 J" n/ `5 [/ A/ n

" D- W3 l2 c/ i9 i6 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 13:39 , Processed in 0.042211 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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