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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; g, }# u: D, Q# x% }/ e2 {
  1. [code]EDMA sample test application
    3 t4 c( ]: _0 g& \; h0 O
  2. /*2 o1 ?& R1 U% _
  3. * edma_test.c
    / ^; s2 a+ R* m5 w) {
  4. *
    6 D( n! H2 ~8 m/ X7 @+ T
  5. * brief  EDMA3 Test Application% ]3 b0 E+ l2 {7 f6 r
  6. *. Y" `$ S7 ^7 e% D, w+ }& X+ W
  7. *   This file contains EDMA3 Test code.
    8 r  b$ z' A% Q4 ~) G: l
  8. *+ A& L6 K7 c0 K% Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # H' G; I! U/ d' `- B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! S/ H2 K$ S6 N2 V
  11. *         TO CHANGE.1 ]9 ^8 j/ `! `. H: ?
  12. *
    2 e/ s' X0 I- {8 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 a) s( r9 {# g* F6 d% W" l5 D
  14. *% G: N! `  _! M" [4 p+ C
  15. * This program is free software; you can redistribute it and/or4 z' q7 x% X  M" o2 N
  16. * modify it under the terms of the GNU General Public License as9 t. L& l1 G, L% i- t3 c) l% h
  17. * published by the Free Software Foundation version 2.3 a% V0 {. L9 i% b& z2 t
  18. *
    : ~# z8 D/ B9 K& [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 r- H9 m% j% M, _* z6 J; g! _9 o
  20. * kind, whether express or implied; without even the implied warranty
    ; Y$ ~$ r5 W6 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- E9 U  {0 V% ]% K
  22. * GNU General Public License for more details.- [! s; m) F  _: W& Z. m, j) {
  23. */
    4 x1 R5 G& u) Q; c5 V
  24. 2 ]; O  B( X( g
  25. #include <linux/module.h>
    2 E+ D: p' }8 i9 G
  26. #include <linux/init.h>
    7 c. A8 A9 _4 @" M+ _6 M
  27. #include <linux/errno.h>
    , P9 q; J' t0 B5 T6 e
  28. #include <linux/types.h>2 r6 A! v$ e3 W: A3 B+ y
  29. #include <linux/interrupt.h>" S8 n6 r- G5 r# l3 o1 o1 v* F
  30. #include <asm/io.h>; Z+ T$ u3 g% F  Q
  31. #include <linux/moduleparam.h>
    ) `9 c# b/ a: J" G/ Z' e. K4 q1 _  |
  32. #include <linux/sysctl.h>, u! n) z, s4 W7 I( I: h  |& g7 ^
  33. #include <linux/mm.h># T! B/ ^, D' Y" |9 A
  34. #include <linux/dma-mapping.h>" `$ v" z6 s' Q2 {% E" y3 _2 N( ?$ ~
  35. $ q% [* F& n9 |- g6 g8 U
  36. #include <mach/memory.h>
      T0 K' p% B+ g0 O3 V5 n' r
  37. #include <mach/hardware.h>
    $ r+ o+ o9 o% T7 ~( G" e
  38. #include <mach/irqs.h>. S3 P* [& Q  _  [% F2 p
  39. #include <asm/hardware/edma.h>/ r3 m$ k6 A* m$ Z( F

  40. " I) Q* q7 \/ h4 v* ~% C) b
  41. #undef EDMA3_DEBUG, ~% W1 ~9 b( ]% r, `' t- y
  42. /*#define EDMA3_DEBUG*/
    1 I# o+ y, C; [2 \# t. f6 |0 S. l

  43. ; n- u8 s; h: v. t+ }" L
  44. #ifdef EDMA3_DEBUG& I2 {; m+ k: T+ l, B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 Z. U/ N+ ?4 @/ C+ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 h9 Y8 o5 S6 u6 H' ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 H/ m% Q. ]: Y+ M5 e
  48. #else
    6 V' r. c7 C/ p" _% M' X3 i' J
  49. #define DMA_PRINTK( x... )% l  m; p0 C- f$ Z
  50. #define DMA_FN_IN
    4 _: L2 o8 G. _) T  p- V- ]. S' j
  51. #define DMA_FN_OUT
    7 _4 i* G& T# W+ U
  52. #endif
    * |, @. U: k$ |6 Y; p# N

  53. 8 k8 C# b0 H$ c/ I' I& N$ g/ B- Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 C  I  u3 w: i$ K1 z7 o
  55. #define STATIC_SHIFT                36 Y0 F, l" U% ~& C7 L
  56. #define TCINTEN_SHIFT               20
    % }' s# ]2 i0 y7 d
  57. #define ITCINTEN_SHIFT              21+ T" t9 T% u6 U0 A% l
  58. #define TCCHEN_SHIFT                22
    ; O! `+ a& B; w( P( {0 f
  59. #define ITCCHEN_SHIFT               23
    " K3 t. q! _- {9 ~1 u

  60. # A/ ^: O1 g5 F/ p0 c7 o5 s7 X
  61. static volatile int irqraised1 = 0;2 n7 r, p4 T) }% x* L9 O2 v
  62. static volatile int irqraised2 = 0;
    9 a$ @! ~$ l5 U3 `/ h
  63. 5 [3 @0 I5 M* A  p+ L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F+ \% Q! e+ K5 u! T5 s# z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - k/ M3 `8 K, l- I6 D% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  `+ m% V9 U+ l. r2 G9 B1 [
  67. * B& k! {- m# \2 p
  68. dma_addr_t dmaphyssrc1 = 0;+ Z3 s- q. [* |2 P8 L
  69. dma_addr_t dmaphyssrc2 = 0;5 `* Y% p5 S9 ]* |( j4 F( s% d' M1 p5 q
  70. dma_addr_t dmaphysdest1 = 0;
    " ]6 K) h% }2 K1 U. j) T3 g1 F
  71. dma_addr_t dmaphysdest2 = 0;
    7 r/ R  q- j* H! ~3 f& L& _
  72. + m# S1 K9 T4 _2 p
  73. char *dmabufsrc1 = NULL;# k# w4 |' ?9 R: R. o2 Q3 A6 x* d$ c
  74. char *dmabufsrc2 = NULL;
    * I& q) ]. ]/ l! K2 k
  75. char *dmabufdest1 = NULL;
    5 \; A2 q: p3 _& a2 u
  76. char *dmabufdest2 = NULL;* l: D2 y! w# _1 V, V$ @
  77. ) s' P9 ^# B5 ^" ^% S+ c- e
  78. static int acnt = 512;
    % W; z1 S0 V2 b
  79. static int bcnt = 8;! p' D" l/ Y' w& A7 z6 Y
  80. static int ccnt = 8;
    1 N# P* ~) |$ W: ^

  81. " h; ~0 a, }, C1 W! ^  m
  82. module_param(acnt, int, S_IRUGO);
    ' O$ M. a# t1 H% M, [
  83. module_param(bcnt, int, S_IRUGO);& O: ~, V- P1 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  [+ u% O5 F) _! h; l" T; e- @4 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! {6 c$ p) L7 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 [  y: p% e6 x) S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( c0 i! X( X# m/ `3 O

& m2 M' d7 N! k! e& T1 y: V0 z
, ?4 m: ?$ J& v% q6 r$ R: o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 01:00 , Processed in 0.038721 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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