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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . t, l' Q& ?; u
  1. [code]EDMA sample test application% R6 ?5 h! O9 V0 i' @4 ~9 G7 e: g
  2. /*
    1 A, D+ s+ I( ]( y
  3. * edma_test.c
    , z8 Z6 ]+ M2 Q; l
  4. *+ \6 ]& [, ^/ X: |9 @- ]; y
  5. * brief  EDMA3 Test Application
    ! y# g- }3 y$ O. B& I9 Y
  6. *
    7 x, K2 r% @  H0 H$ X
  7. *   This file contains EDMA3 Test code.
    7 W. v: g$ l8 M
  8. *
    4 |  o0 _( Y* v! q, G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % S5 }  V8 `1 L7 V% n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! g9 P1 W  e( Q" J5 h8 J
  11. *         TO CHANGE.8 e" c" ?0 J/ t; [7 g
  12. ** G' l+ X( U5 w; S) O: j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) o4 G4 J; J( N* W; h
  14. *2 D6 L* A0 p9 c( l2 w- o  d( _4 p
  15. * This program is free software; you can redistribute it and/or
    * Z6 H3 [- _! D+ _( y
  16. * modify it under the terms of the GNU General Public License as
    6 s1 g; l" v& w2 k8 [0 r
  17. * published by the Free Software Foundation version 2.' m1 M6 u# k# n) S  q
  18. *. c' Y7 A( {+ V7 u( _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 M% {6 v% u- @/ H4 L) i3 f0 L8 {
  20. * kind, whether express or implied; without even the implied warranty
    0 T9 I$ b: t$ F- g! n: N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 _9 ^; q1 `* C* J1 e+ t0 }" k1 z
  22. * GNU General Public License for more details.
    ( r0 y- n# [& y5 v% h- b
  23. */
    ) x- `" V* T9 t3 N

  24. ! e. a+ c' J: h7 d3 U/ M5 q: d! i
  25. #include <linux/module.h>
    $ Z% l( G8 B5 T4 N7 v/ X6 T
  26. #include <linux/init.h>4 ^$ R% s, ?+ F6 g9 s/ b
  27. #include <linux/errno.h>
    # U, o6 [' x$ x
  28. #include <linux/types.h>
    2 n  Y% A+ S2 i* [! Q- d# j9 P9 h
  29. #include <linux/interrupt.h>& h+ S$ N: a, X
  30. #include <asm/io.h>5 L! b' V7 R3 \4 D+ \. P& L$ U3 c
  31. #include <linux/moduleparam.h>
    / Y/ a! n  b3 _5 l" q$ G" N! q& P
  32. #include <linux/sysctl.h>4 M4 K  a, o0 ~/ O
  33. #include <linux/mm.h>
    % H1 i- |' A6 `
  34. #include <linux/dma-mapping.h>9 E( o0 P! J. W" {5 v) b0 W  N
  35. 8 |  _$ ~' H1 Q+ ^: J
  36. #include <mach/memory.h># p1 K$ M: [" U  P, @1 ]
  37. #include <mach/hardware.h>9 m9 R3 N2 n$ d( B0 }, }
  38. #include <mach/irqs.h>
    , [! e; x4 I+ B
  39. #include <asm/hardware/edma.h>
    9 b' c: U3 W; Y6 e, b
  40. 4 z( X) |" N3 V" _/ S/ C7 M2 B
  41. #undef EDMA3_DEBUG7 \3 h4 A3 {& E, g) x+ `! I$ E
  42. /*#define EDMA3_DEBUG*/  o+ U# p2 j; U& Y

  43. * |7 Z& T# n% K  @9 ^* N
  44. #ifdef EDMA3_DEBUG
    0 {$ |7 z# V! P# t! Q+ G" [+ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 W/ {- s" n7 l& V% H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( ^- S, S" }& r8 u7 n9 h+ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 W' \9 g& L/ k& k9 [
  48. #else& d) M% ^) }; X% @! Q& F1 y2 _5 W3 L
  49. #define DMA_PRINTK( x... ), _% U) c; M# ^% D+ N' R6 m
  50. #define DMA_FN_IN: [! H- n( R  d; Q7 K1 H2 Q
  51. #define DMA_FN_OUT
    $ h( e7 Q. K5 Z. w: S
  52. #endif- o0 `6 V; I0 B1 d1 V0 ]& s; Z

  53. , E3 y! o2 l' [$ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! L( ~: s( x! ~# R" g! B
  55. #define STATIC_SHIFT                33 b% s7 V7 x: `. V9 ^
  56. #define TCINTEN_SHIFT               20
    # C* }0 O  r6 W6 Q- }/ W" j
  57. #define ITCINTEN_SHIFT              21
    4 a8 H0 e+ [) M7 r, e( }/ i! W
  58. #define TCCHEN_SHIFT                22
    1 J( v1 j' J# s% H2 m' \
  59. #define ITCCHEN_SHIFT               23  V' K3 q3 m' X% a$ u% }' t
  60. 9 m' Z* H2 k& d6 D* c) J
  61. static volatile int irqraised1 = 0;8 h6 w+ C& t1 _# K' [& m
  62. static volatile int irqraised2 = 0;
    3 Q# @. D  q0 R& ], {1 [* J7 a1 g8 D
  63. 2 q) a' `1 Q- V6 z, R+ J  [# k) d4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j/ B; p" D- N" q) A. d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X2 C( `: b0 Y# b. J4 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \$ P+ X! t8 f. p. |* j
  67. # P. {4 p& g4 H/ T/ j
  68. dma_addr_t dmaphyssrc1 = 0;
    . M. c/ B2 y" W) i. w
  69. dma_addr_t dmaphyssrc2 = 0;
    ) {( r  r2 [( {+ h) l$ e- h9 P, v
  70. dma_addr_t dmaphysdest1 = 0;
    , e7 }9 N* y0 S. K$ G" y" J+ e6 b
  71. dma_addr_t dmaphysdest2 = 0;4 g3 M6 X, [$ D6 X

  72. ' a- g3 ~1 j' P6 A8 A
  73. char *dmabufsrc1 = NULL;
      |7 R" t  Z" _& w/ R
  74. char *dmabufsrc2 = NULL;
    + C. ?& u3 U* x" D9 X
  75. char *dmabufdest1 = NULL;& Y1 V/ h( x7 i# Z4 N4 r) H
  76. char *dmabufdest2 = NULL;6 K+ h5 M2 f  k# B% D
  77. - p$ b+ T) C6 Z5 m/ W
  78. static int acnt = 512;6 M# |$ T, _- W* x% u
  79. static int bcnt = 8;0 O: e( h# ~  u4 X9 M; h& ^
  80. static int ccnt = 8;
    . |: i1 T4 F8 b; @7 M# L8 x
  81. ! S$ o( z% a* D
  82. module_param(acnt, int, S_IRUGO);; B1 }8 \% Y' ^, {# J
  83. module_param(bcnt, int, S_IRUGO);
    5 z1 \7 D) ]3 z1 x4 V" R5 p, U& O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% E6 y' ]- a9 f4 `3 A
/ v0 B  z; Y# j% H2 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  M) N2 A1 m! Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. o& @, S1 s% {0 h  [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L: H2 _- B# s) E4 {
1 r8 A1 V1 x4 q! H1 v9 J, y
" B- |* F3 e/ z7 H  k- ?9 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 14:42 , Processed in 0.038645 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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