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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K% G9 q) o, }- ?8 U9 c
  1. [code]EDMA sample test application
    3 o# u3 s6 z+ U3 K, t+ V
  2. /*
    , T+ M5 h& r; w% u5 j
  3. * edma_test.c
    % F# x% F; E' J0 d' `+ F0 G# g
  4. *
    $ v4 S, x( w4 {* x
  5. * brief  EDMA3 Test Application
    % p+ |+ j- \8 E. e7 B6 [8 g/ `
  6. *
    " h7 F' M  o+ _& o) k$ ?
  7. *   This file contains EDMA3 Test code.
    , M& v8 f" @# F5 w) o( J5 |) d
  8. *4 _# Q' ^; X+ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ^5 ^& t6 C" q8 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Y5 _) z* w, t: ]
  11. *         TO CHANGE.
    % P" U7 y( i$ @# j, O9 J
  12. *! h' e' I+ ]* k3 Q0 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 Z/ I0 C6 [6 b/ h: c/ Z! l
  14. *& F3 |% y! y. }( t
  15. * This program is free software; you can redistribute it and/or9 L! x/ P4 u: s5 ?$ l6 G
  16. * modify it under the terms of the GNU General Public License as
    ; {$ Y7 ?( |3 |
  17. * published by the Free Software Foundation version 2.3 S5 h3 N5 s6 _0 R% p5 R# ^6 s) F
  18. *+ U6 P) S0 U/ [$ \5 N$ m8 t+ F9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 |& j; ^' m# A5 e
  20. * kind, whether express or implied; without even the implied warranty2 }3 r7 Z: k' o- v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 y7 w) ~& v; `2 \
  22. * GNU General Public License for more details.
    * i% W" }  v4 u' W7 ?
  23. */% U9 R2 H6 `4 X2 x9 x5 }. ?& b0 `+ g
  24. % ?7 s7 u4 R9 A- F; z) R2 X
  25. #include <linux/module.h>
    8 T- V4 ?0 B- o" R! }/ c5 T
  26. #include <linux/init.h>
    # |+ y& z# F/ s$ l! A
  27. #include <linux/errno.h>4 O  h: ^! Y; a0 _  K; v- ], a& J* W
  28. #include <linux/types.h>
    3 s: X" W4 C3 V2 U$ Y. W
  29. #include <linux/interrupt.h>
    ' b+ M7 ^6 H' ~& A: g5 n! P
  30. #include <asm/io.h>
    7 n7 I+ ^$ q1 o/ @, Z% c
  31. #include <linux/moduleparam.h>. W  ]" \( c& C0 p! v1 d2 R! Y
  32. #include <linux/sysctl.h>8 {- V6 v# h2 ^
  33. #include <linux/mm.h>" ]* ^9 S0 u- h/ N( y% `
  34. #include <linux/dma-mapping.h>' B) M: W) [/ C& y7 w( U% C

  35. $ h3 u( R- N1 R/ V1 ~6 d
  36. #include <mach/memory.h>
    : i3 q6 J8 v* S" B
  37. #include <mach/hardware.h>
    9 B# Q1 M; @* t- Q( F9 A1 z
  38. #include <mach/irqs.h>5 {4 ]$ l5 Z/ F0 w6 J! p
  39. #include <asm/hardware/edma.h>
    + K; y; l2 _* V( q2 Z, ~) R

  40. ! [% C* b- P% |, t- }( s5 L; g
  41. #undef EDMA3_DEBUG6 S" t6 Y0 X. l2 S' j- }% z
  42. /*#define EDMA3_DEBUG*/8 D/ t& ]/ N' k' [
  43. ; v& e1 A; |" ~) A2 Y
  44. #ifdef EDMA3_DEBUG
    2 m8 y3 z. O2 Y* u# @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ @+ W4 h$ X, Z" Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- }$ j- d0 n0 Q, `& k# Y) H1 b6 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" |6 k& `7 k- U) [6 O
  48. #else
    + L! k$ |2 Y6 ?" k+ C! @
  49. #define DMA_PRINTK( x... )9 l7 Q% b3 Q# S, R) V6 n  ^) j% B
  50. #define DMA_FN_IN
    8 g6 k2 n' F/ L1 y) j" N
  51. #define DMA_FN_OUT
    1 ~+ I, |+ {" d2 N
  52. #endif
    + \" V9 s5 J% z7 G: J# `

  53.   n. B# \! M( @  g) A" J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; z0 ]  Z$ J" {- G; g& F
  55. #define STATIC_SHIFT                3
    - V* u- \) z4 d  r' I* p9 [! N: f
  56. #define TCINTEN_SHIFT               20; [6 R' I2 t) ^. g: q: D# C9 Z+ ^
  57. #define ITCINTEN_SHIFT              21
    " V( P) l+ |& o. [
  58. #define TCCHEN_SHIFT                22
    - U  |9 P# O9 Q, e, ^! L+ z# x
  59. #define ITCCHEN_SHIFT               23
    - X1 ]7 f% w2 n* h+ p
  60. ( Z) S/ U2 w$ j, D9 |# n8 B1 ^; ~
  61. static volatile int irqraised1 = 0;
    + Z8 ?2 y* V' Z3 [5 ^
  62. static volatile int irqraised2 = 0;
    - R* G5 E8 `1 @6 w' |5 v

  63. 7 L, R: j- U! v5 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 r: D8 W- E: j6 ~& _8 g" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! q6 m: V$ |& O9 C6 Z# q7 B% N7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P+ K# B" S2 g

  67. & U- d& r) _" i
  68. dma_addr_t dmaphyssrc1 = 0;/ M4 x- t: {2 ]! M% D5 l4 @: n  a
  69. dma_addr_t dmaphyssrc2 = 0;# G0 _9 I9 ~# E% I5 T. W$ K
  70. dma_addr_t dmaphysdest1 = 0;$ [9 \+ `8 ?; X/ ?
  71. dma_addr_t dmaphysdest2 = 0;3 z5 J7 P. d* V/ i3 Q0 `

  72. . C0 P* T7 u$ l% h+ J! s
  73. char *dmabufsrc1 = NULL;
    + ?: V9 f3 G: H. I2 @! q6 D
  74. char *dmabufsrc2 = NULL;- ?9 f. O1 M8 X- I
  75. char *dmabufdest1 = NULL;
    6 R8 g7 a& Q9 D9 R0 ]4 O3 x
  76. char *dmabufdest2 = NULL;3 D6 a: B1 T; }( C. _: r8 M

  77. , G- _, e, `/ t+ s
  78. static int acnt = 512;
    " ?1 b- g! y* m! q- S- P
  79. static int bcnt = 8;
    + r8 P' y( ^4 J
  80. static int ccnt = 8;
    0 ^; x% X* J3 D2 h6 |! Z/ x! o
  81. 0 X3 |# M0 j) W* t3 A: [
  82. module_param(acnt, int, S_IRUGO);
    9 b. E) a" E. x0 l, F
  83. module_param(bcnt, int, S_IRUGO);
    & s" h& L0 q6 b; ^) g6 J# l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- S, G! s+ f, G

9 k+ v- U0 w, B8 n5 O: F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( S) a; Q/ X& @; \0 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! X& ^; e. m6 p$ d/ g" H* v8 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r/ A! q* x1 I8 i7 ~1 R
% @4 t: o4 E7 E
# U0 h0 Q' J6 m5 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 07:24 , Processed in 0.040630 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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