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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( z6 U$ M- \- ?6 P3 c* B+ w5 C
  1. [code]EDMA sample test application
    & o4 y* y0 b9 p& ~/ ~# L; M/ f0 ?
  2. /*' ]4 s5 z+ w5 ^4 L! U9 B
  3. * edma_test.c, k  D$ `6 a5 a
  4. *
    6 k$ ~7 |* ~0 B% H0 Y* X
  5. * brief  EDMA3 Test Application
    % k" g( V. m, t3 i( m, ?& S: a6 I/ Z
  6. *
    " K: |/ ?, D) g
  7. *   This file contains EDMA3 Test code.' v3 I# |1 _4 d: f8 Z2 q' P& n
  8. *
    - o6 ?& P* B* ~1 p) i$ V+ u6 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j2 a/ a& c7 X& S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& c# [) T* O$ y( e7 n) e& @
  11. *         TO CHANGE.# y4 w% f/ j* i& G
  12. *
    # @4 t" t; y4 t6 D5 Q: d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o& {6 D4 V1 d1 S% F+ t
  14. *4 u' E2 L, p2 Y. x
  15. * This program is free software; you can redistribute it and/or1 I7 _: k, H9 s
  16. * modify it under the terms of the GNU General Public License as9 j+ e, C$ C- `: y6 A2 u$ k+ @9 t/ P
  17. * published by the Free Software Foundation version 2.
    ; X+ m4 ~- P- Q- ?4 S# f/ D# K
  18. *3 _- O, q, g/ P' c2 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% _2 J) U8 R' c3 y
  20. * kind, whether express or implied; without even the implied warranty
    " N. v0 T* j8 z" ~9 Z/ q+ ~& W- c) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 \6 b4 a3 J2 u! N; I
  22. * GNU General Public License for more details.
    ; R- \) ^. J# F4 d$ ], q7 U
  23. */# {9 D$ h* D/ Q( g; c9 j4 [
  24. . m$ x" Q6 q2 ^8 M$ _+ H* V
  25. #include <linux/module.h>5 U9 ^5 j2 d6 E2 G! N0 q6 u# E( s9 }8 E% {
  26. #include <linux/init.h>
    , K# ^9 C# T, f; Q
  27. #include <linux/errno.h>
    ) [- I/ G/ Z" r( s) F; n
  28. #include <linux/types.h>- [" Y! H8 Z- q0 Z
  29. #include <linux/interrupt.h>
    ( O& B2 X6 d$ t( }5 P
  30. #include <asm/io.h>
    6 u( n" o' |7 f; f) W
  31. #include <linux/moduleparam.h>
    7 S# v$ U: X- k; r5 ]& Y7 ^! {
  32. #include <linux/sysctl.h>
    0 R; u# E+ {! `( |9 C) _- D' ?& h* i
  33. #include <linux/mm.h>
    ( k2 S6 B9 H1 `* T& Y4 ]
  34. #include <linux/dma-mapping.h>
    8 S  S" H! c* a* \% e3 ~4 u& t
  35. & ?3 C3 r/ }' I9 Y' t# ]4 x
  36. #include <mach/memory.h>
    3 J* Z# T5 _2 C& V  A/ O& l
  37. #include <mach/hardware.h>
    ! ?# C' i6 m% {0 A
  38. #include <mach/irqs.h>
    % p1 `. C  m; Z& G: r( g* t) A
  39. #include <asm/hardware/edma.h>
    2 Q" w7 j' y% x/ y) c* {
  40. , d1 L7 j1 W; f# {+ y) V
  41. #undef EDMA3_DEBUG3 c; ?4 z8 Y6 q7 [7 T/ A. b
  42. /*#define EDMA3_DEBUG*/
      y2 K- G1 c# y2 z
  43. 1 h6 \: D, n, Z( ]( y5 X! B( ?+ D
  44. #ifdef EDMA3_DEBUG; X0 J9 Z$ ?/ G% m! H% R& A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 y$ X8 \5 D: T# C7 O$ P* L3 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ h+ x( ^& r* ?5 W2 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 l6 F) i' ~+ i2 F6 `' [7 d
  48. #else
    ; M+ X+ P$ ]: l- s* {7 B4 Q; u5 G4 G3 U
  49. #define DMA_PRINTK( x... )2 C6 J0 B) x- h* N: y7 o
  50. #define DMA_FN_IN9 k3 i2 S2 v% B: ?
  51. #define DMA_FN_OUT3 Q5 {4 @0 O' Q' i+ U
  52. #endif5 P2 l; V9 A2 R4 e, y' F
  53. + j7 I9 [6 q: {; y; Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 A5 R. G$ f( `1 A: j7 D
  55. #define STATIC_SHIFT                3- M/ P9 W2 W: E/ }1 q# o/ \
  56. #define TCINTEN_SHIFT               204 N5 @0 N/ i4 B
  57. #define ITCINTEN_SHIFT              21
    , K  E% t( `9 a. @+ \% _
  58. #define TCCHEN_SHIFT                22  B" q8 m9 J' O# z
  59. #define ITCCHEN_SHIFT               231 r) P9 x' R% {  M! F

  60. / D2 n& U+ W, `. c
  61. static volatile int irqraised1 = 0;1 E7 U5 o; j) d9 i5 o5 E
  62. static volatile int irqraised2 = 0;) I2 b/ x0 z' W8 G$ {9 N
  63. 8 c. D, \: [& @9 ^, k7 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 l; z( V1 D" r% ]) e; u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y, @9 [1 t+ j- S* ~7 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Y$ u" D7 w- p/ V$ f
  67. 9 s5 ?/ n1 q* |0 Y5 z" l0 A
  68. dma_addr_t dmaphyssrc1 = 0;
    $ a: m$ l5 w2 N* P: l
  69. dma_addr_t dmaphyssrc2 = 0;' \, Z2 K' C+ n
  70. dma_addr_t dmaphysdest1 = 0;
    $ r$ U$ Y% k; Q- I, M
  71. dma_addr_t dmaphysdest2 = 0;, b1 \3 {9 F* D* c
  72. 3 D) ^! y: m7 a4 ?1 e, V- ^  `
  73. char *dmabufsrc1 = NULL;/ m7 ^! m/ |! s& z3 \" H
  74. char *dmabufsrc2 = NULL;* P4 {3 V! l% T/ o+ C
  75. char *dmabufdest1 = NULL;. K) q" o: y+ L
  76. char *dmabufdest2 = NULL;/ T  n* q/ ~( g+ R, G6 I) {
  77. " f! n0 E6 B, n* J- Q
  78. static int acnt = 512;
    * |+ Y$ V2 n8 f4 C6 P9 b
  79. static int bcnt = 8;) ^3 {6 ^. k% E; D
  80. static int ccnt = 8;  m/ A; Y7 A! F8 h
  81. % ^2 y: W) }, y% y8 H( ?" F
  82. module_param(acnt, int, S_IRUGO);0 r6 X3 d+ x% s& M
  83. module_param(bcnt, int, S_IRUGO);
    ! X- t. V/ X9 I% W4 Z( m' T5 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 f8 q2 V+ ^, k" a  l
, z' P8 n$ t) _: D/ R' m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z. Y8 D# a7 y& x: C; @: x, Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^, I0 V( K) G8 J+ T+ k0 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]- H/ e3 S' S  j1 W: w3 H$ t5 l; N5 {1 R: J8 A
( ^5 |. l. X9 f' k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-11 20:03 , Processed in 0.040028 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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