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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # X/ w2 @' N% W* V
  1. [code]EDMA sample test application
    . g; h% [* Z; |. r4 h
  2. /*8 w* D  J: O/ d
  3. * edma_test.c
    % C$ s9 _: z1 u* S. C
  4. *6 n$ p% `1 N* H. t- @
  5. * brief  EDMA3 Test Application
    2 J: R. i: P8 L8 u3 F1 {' V7 b0 j
  6. *+ s, \: {) k2 _7 s0 V" s# k1 P
  7. *   This file contains EDMA3 Test code.5 p8 R* F! [6 O
  8. *
    . N9 d7 {2 Z+ x( D5 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) o7 V4 G7 D& k7 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* J$ D- q( X, I0 H. R1 f
  11. *         TO CHANGE.- G. Z- c( ?3 \1 q
  12. *
    8 Z' x' M1 f* y# T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      v9 L) E5 c, J/ ]7 Z3 U
  14. *8 {& R+ J* u9 Q
  15. * This program is free software; you can redistribute it and/or% y8 c* w6 d' _/ J* _" q) i
  16. * modify it under the terms of the GNU General Public License as
    2 j* n2 z+ u2 M6 V' P
  17. * published by the Free Software Foundation version 2.5 i$ i  [, U$ }* k( x
  18. *
    . x8 \, o1 s' V6 j- F8 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; z/ v, T$ R& @* i) f
  20. * kind, whether express or implied; without even the implied warranty
    3 V# @. T# K1 p& j. `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 H! i+ B" F$ P
  22. * GNU General Public License for more details.
    & P1 y1 o* `% {. h! B4 D% y8 @
  23. */
    5 K; o% b8 Q1 \% [; O6 a. n( h
  24. 5 J2 c* W% [9 |! j* C. Y
  25. #include <linux/module.h>) ^, R0 u$ X: ^: ?" R% e
  26. #include <linux/init.h>3 n8 Y3 f/ ^1 |( x6 w% s: c
  27. #include <linux/errno.h>
    . d* x( i, N& Z+ T% I4 j
  28. #include <linux/types.h>- |% D, k" ]  t/ O' x& r
  29. #include <linux/interrupt.h>
    / s' l" i: @! R2 X2 [/ n6 J+ V
  30. #include <asm/io.h>
    $ K( d0 f6 m" D+ v4 e+ K2 k
  31. #include <linux/moduleparam.h>8 V* b5 y; e) g. y/ d+ Y
  32. #include <linux/sysctl.h>
    # Y  h3 b7 d+ ]9 w4 c
  33. #include <linux/mm.h>* p6 N( S! g. u; o7 V8 P- g
  34. #include <linux/dma-mapping.h>
    " ], @1 Z- J/ G6 S- g/ t5 _5 ]

  35. . L! i4 y& ]9 n
  36. #include <mach/memory.h>1 W7 j$ j- ^7 \; a, R: j+ `
  37. #include <mach/hardware.h>
    ( w1 c$ f- _& L
  38. #include <mach/irqs.h>
    & P5 _7 g; V1 V. M
  39. #include <asm/hardware/edma.h>
    " i$ l( D( _) G2 }' p
  40. - ?6 H2 {1 M2 L/ {$ G
  41. #undef EDMA3_DEBUG
    " V2 m9 _& w6 w& S1 c
  42. /*#define EDMA3_DEBUG*/
    : Q2 S1 b! w2 a4 e. ]
  43. - x5 D" h0 Q8 Q% ]! r
  44. #ifdef EDMA3_DEBUG
    4 _$ B- V, P& e! t6 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" i/ h  p% ?: U- ^1 F$ d8 A# y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! s# y. |9 r& a: s7 A6 D7 c- t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - k6 o' E+ ~0 b
  48. #else
    . t3 r& H) \/ L, z7 r
  49. #define DMA_PRINTK( x... )2 @0 s+ p7 F% q" ?
  50. #define DMA_FN_IN! p) M8 l, d) Z+ P2 a0 L
  51. #define DMA_FN_OUT; [% L5 M- s: e; O" z9 {- f
  52. #endif2 Z" G. ]" n# y; }, [  B$ P

  53. : [6 y7 @+ I5 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . F. |- k' W0 |+ V! L3 M  C
  55. #define STATIC_SHIFT                37 _+ J7 h# I! ?) B; G* y
  56. #define TCINTEN_SHIFT               20* G, [* F8 ?; b: b) b' v
  57. #define ITCINTEN_SHIFT              21
    ! d' u: ^& a# Z3 ~9 A
  58. #define TCCHEN_SHIFT                22( h% A* u2 Y3 W, Q; Q6 n: _8 a
  59. #define ITCCHEN_SHIFT               23
    % P1 u9 x8 {/ s& L8 v! c
  60. 6 F8 X; R) m+ j6 O: h5 D3 D
  61. static volatile int irqraised1 = 0;
    # N6 P; H. h5 e) d& [5 `  B
  62. static volatile int irqraised2 = 0;
    , N0 y, X5 r' g! E1 Z! @
  63. 8 F/ Y4 v5 m# u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G' W$ c. j" Y: o" N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ^) }4 X& L) e- A6 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ?- ^- l3 n% f$ J
  67. 2 R) N  h1 l3 P9 S7 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    7 @7 ~* ~  E! u& g1 _# m
  69. dma_addr_t dmaphyssrc2 = 0;
    " o. M0 ^3 b& |+ N& _' g# m6 x; U
  70. dma_addr_t dmaphysdest1 = 0;
    ! W6 |1 q6 c8 V; k
  71. dma_addr_t dmaphysdest2 = 0;; O* K' C  R' R+ B3 p$ N! V

  72. - q# }  Y/ S' H( \( A4 A3 M& k3 D
  73. char *dmabufsrc1 = NULL;9 C2 N; M4 h5 R/ J: d- K/ m
  74. char *dmabufsrc2 = NULL;, a+ h9 y1 R4 u- v, Z7 F8 u
  75. char *dmabufdest1 = NULL;
    + m: Z( w! }4 g( z/ m. I- a0 Y
  76. char *dmabufdest2 = NULL;
    " L1 T8 T, o, }9 ?
  77. 6 E' ?  A( l4 z+ ~$ o
  78. static int acnt = 512;* N" R- Q3 q+ [9 M0 b
  79. static int bcnt = 8;: g* E1 E" q2 h- o
  80. static int ccnt = 8;0 @; t9 d$ P) }. ?& k% G( ^6 F

  81. $ p) Z! P2 D' A
  82. module_param(acnt, int, S_IRUGO);
    1 l8 ?% n& B3 o# n. }( }4 Y0 ]
  83. module_param(bcnt, int, S_IRUGO);5 S8 g" T" ~8 g- S6 f( A& J- H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ F+ A. d. F. J* j8 }
; O* N" c9 O  Z' A2 K4 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% \$ m: l% i. Q9 [6 h. Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ `; j  A2 g- n* q( h) J# I+ u' J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b% Z4 M) w, o5 ~$ P! A
* C  j: }2 W  D+ i3 n5 q6 k

& R0 n; f0 ^6 M, \* A  h5 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-30 04:34 , Processed in 0.044874 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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