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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 S4 M; ^4 b- H$ C1 S; u4 j7 b8 y
  1. [code]EDMA sample test application" g# {$ l5 s4 O: N0 n9 X
  2. /*; N" k+ R- |8 |) q$ P2 K$ x* p9 |
  3. * edma_test.c9 n6 `: w7 Z* u2 D, D
  4. *
    8 g) }3 t" g" T% t" T
  5. * brief  EDMA3 Test Application
    4 |4 ]7 r$ I" i5 u1 t/ u
  6. *
    5 v! w  o! I0 t5 D
  7. *   This file contains EDMA3 Test code.
      W; C/ W; C" ^
  8. *  l. I5 Q. S# |9 i1 y$ E( Y2 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % F5 w; f& H4 v6 J$ o2 A4 R2 J/ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 z% f' V& a9 |# S) o8 R
  11. *         TO CHANGE.
    ( A3 q3 y1 u7 S. E3 }3 o' f4 ^" ^* M
  12. *8 O+ a4 y4 F; x2 n6 \; M/ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h8 \" P: c% N/ E
  14. *
    " R7 W/ e; ?8 [  M# u4 Y9 C( u5 y: R
  15. * This program is free software; you can redistribute it and/or7 l7 V0 Z5 n2 E' t& M" H- P
  16. * modify it under the terms of the GNU General Public License as' S: p+ i9 Q9 ?) h
  17. * published by the Free Software Foundation version 2.
    ; _: R) ?0 v2 c
  18. *  O0 S4 S" W/ D9 ~6 q* i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ F# s# C! @4 z$ X9 d( V8 s1 e1 T
  20. * kind, whether express or implied; without even the implied warranty
    $ m" E5 }& c" R) V; e' S5 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 D. e" X# M& W3 P& A1 j/ W
  22. * GNU General Public License for more details.+ Y$ s( C% i& w' I
  23. */
    & x& a% L9 p0 d9 f& ^

  24. ; j2 t+ Z& B8 x
  25. #include <linux/module.h># A3 z  }' `! b4 T. ^2 P
  26. #include <linux/init.h>) c) ]1 p4 k) [- G# Y9 c
  27. #include <linux/errno.h>
    ( p! w% k8 C2 c5 `5 E, }7 z5 `' @
  28. #include <linux/types.h>
    8 F5 P9 `" `, K8 J* I6 ~1 l
  29. #include <linux/interrupt.h>3 M/ v# w& b) B/ f: U
  30. #include <asm/io.h>' [  H4 v* n) l3 s9 U/ ^) h
  31. #include <linux/moduleparam.h>2 R$ X. q0 B( |' V- f1 ?/ A: g9 }5 D+ V
  32. #include <linux/sysctl.h>
    , I1 i$ f+ q9 ]) o6 T4 d; Z; a
  33. #include <linux/mm.h>7 ?+ n9 h; a- _( |# F
  34. #include <linux/dma-mapping.h>
    ; K% ?0 p0 E7 _' I; K) l

  35. - m& r2 m5 X+ J
  36. #include <mach/memory.h>6 k& m; h6 c( ^% s! l8 E: E. x
  37. #include <mach/hardware.h>
    " U% ]: F7 M7 J
  38. #include <mach/irqs.h>% o5 k3 }8 Q4 n. ?1 F, a# U; L
  39. #include <asm/hardware/edma.h>
    - Y; `5 E1 O5 ^0 w

  40. - d8 B, _( h9 e: R+ B
  41. #undef EDMA3_DEBUG
    0 B9 U& @6 v* J4 G
  42. /*#define EDMA3_DEBUG*/# F# l1 b4 K% R
  43. - O' o4 h4 Q& B' D9 r  K5 F
  44. #ifdef EDMA3_DEBUG
    5 N% X. K/ p; k# [& X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 s- E( h( V; T# O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 k0 [2 U3 o1 m$ Y8 F& \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T' R) ^8 p! }7 \0 w: r  f1 u, i" ?
  48. #else
    6 U4 b( M: g2 E  v
  49. #define DMA_PRINTK( x... )
    $ W7 k/ U' X, ~! O$ V9 K9 L
  50. #define DMA_FN_IN0 h( g# [: a; Y. R4 P! H
  51. #define DMA_FN_OUT- \! G$ I' n- j) M' K1 J
  52. #endif! ~% m5 z# |6 I( V
  53. 4 W8 }8 U7 N- D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- W" P, \( q+ \; Y% \6 B0 I) m
  55. #define STATIC_SHIFT                3+ a! d! x0 }2 F4 P: W
  56. #define TCINTEN_SHIFT               20
    ' o, V! q" q$ Q, c* L6 T7 n
  57. #define ITCINTEN_SHIFT              21
    4 H  @- r1 r3 P1 W- o0 p3 p: d
  58. #define TCCHEN_SHIFT                22
    3 @3 n6 k$ Y) `+ H. D/ a- d
  59. #define ITCCHEN_SHIFT               23
    " L3 x6 b/ H# O# D/ R

  60. 7 E8 R% Y$ P# ?6 S
  61. static volatile int irqraised1 = 0;
    : \) B7 P0 i& e  P1 p# ]
  62. static volatile int irqraised2 = 0;( o$ y5 G7 `8 Q

  63. - v- ~7 o' C4 L8 [+ c- ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d3 L0 `1 [* X$ h1 b0 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y7 y1 @4 y; D+ y/ o* s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " M8 A; ~) V7 @4 W- o

  67. 3 ]( d" I% _$ A4 d9 ~' ~# U7 o
  68. dma_addr_t dmaphyssrc1 = 0;% X+ @. m; m4 S3 J  n
  69. dma_addr_t dmaphyssrc2 = 0;0 }, N) m& ^; B1 I
  70. dma_addr_t dmaphysdest1 = 0;5 \" P4 Z; s9 ~6 u
  71. dma_addr_t dmaphysdest2 = 0;% p7 I* R; c- v: y" }! _
  72. 3 W7 w# ?: x0 ]3 z% |; o9 M
  73. char *dmabufsrc1 = NULL;- t$ a$ I5 m& ~7 K2 U% U
  74. char *dmabufsrc2 = NULL;
    2 _( d) y- g* K+ g6 U
  75. char *dmabufdest1 = NULL;
    ' b; _4 l  _( S$ k, `
  76. char *dmabufdest2 = NULL;
    0 v, X9 F: y" R. v

  77. . ?# f$ ?: U$ x$ e
  78. static int acnt = 512;0 c" M6 n, j- C8 N* t: v
  79. static int bcnt = 8;) \! c( g: T6 G) K6 S  t  J8 I
  80. static int ccnt = 8;6 t* p4 y: w$ K1 I' W

  81. $ z. i- j5 j" h( w
  82. module_param(acnt, int, S_IRUGO);
    ( p! [9 E4 l: Q8 G% ?
  83. module_param(bcnt, int, S_IRUGO);
    . }5 ^. n( K2 D% v+ c1 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 O! I/ R) ^4 p/ D" o- X" s

  _4 @% U$ g% S1 s& f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 n  w8 d1 Q/ O4 Y- o, `5 _6 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [5 A! [9 K% `& f7 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% @0 s4 [5 x/ E8 F8 F  b
8 P/ ^. p6 V7 H4 ~% @( O2 N
6 h( r% {) e' A: m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 21:30 , Processed in 0.040105 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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