OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N) u2 C' Z1 g* j1 |: P, r4 S
  1. [code]EDMA sample test application
      W9 h9 T5 e7 ^0 D* t' F
  2. /*" m0 T* J, J% D: J( _" w
  3. * edma_test.c
    . b8 \- t1 Y( n; X
  4. *4 V9 N! a6 \& e4 z( e
  5. * brief  EDMA3 Test Application/ l  b1 p/ b1 ^% M: C% `' `: K& e
  6. *3 }7 i- T, ?; ]% _" z3 o6 Q, g6 y* S
  7. *   This file contains EDMA3 Test code.
    ! O. S/ c: _: i0 ]
  8. *
    % X: Q' x# \. |9 S- ^! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / B5 \+ q& M0 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ^- u/ b9 Z2 ~# d) F* {; f
  11. *         TO CHANGE.4 K9 I4 P% c# }! ^
  12. *
    2 V. |$ b9 `+ e% Q* A5 N9 ?; t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E* H$ y. O/ M( m! J8 B8 x/ p) y+ ?
  14. *
    " u, [1 K1 M* `9 A2 W, ~! ]
  15. * This program is free software; you can redistribute it and/or1 j: V6 {( r1 W6 x. h4 q
  16. * modify it under the terms of the GNU General Public License as, z& P* a& l. {8 r
  17. * published by the Free Software Foundation version 2.
    + C8 e+ {# ~: M
  18. *% e- g: M" {( ?, E% X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l; A" I% w- W# H
  20. * kind, whether express or implied; without even the implied warranty7 }8 [9 l, N  ]; Q6 A9 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; t7 a+ P4 y& j9 f* X
  22. * GNU General Public License for more details.
    ) Z; b# F" P: t9 h
  23. */
    % X% B% Z1 P. X8 e

  24. 6 z/ y) \' W( A! l
  25. #include <linux/module.h>
    0 e- A- D1 C  s' C" V; g
  26. #include <linux/init.h>
    ' Q3 K* Q4 R* Q* S
  27. #include <linux/errno.h>7 K; s! s  ?8 d
  28. #include <linux/types.h>
    - U7 l- U" B# F) B0 ~! I- g) t& S- Q
  29. #include <linux/interrupt.h>% I3 ?( ]' h7 Y( }! Y
  30. #include <asm/io.h>+ ]7 E5 w& L1 _1 K( h2 l4 l
  31. #include <linux/moduleparam.h>8 ]' j1 l- r' V
  32. #include <linux/sysctl.h>5 J# k/ Y6 W2 M8 k/ ]
  33. #include <linux/mm.h>8 r$ X: F* @2 A0 Z; ~0 w; O. ^5 T
  34. #include <linux/dma-mapping.h>7 N! m, `2 q# r4 g3 N6 H
  35. 7 R6 z6 P+ n0 Y5 j$ K* R& ^
  36. #include <mach/memory.h>) w- M4 I9 W2 s
  37. #include <mach/hardware.h>
    1 U8 E" M% ~" e9 q, w
  38. #include <mach/irqs.h>
    ; A+ ?3 T1 T- O
  39. #include <asm/hardware/edma.h>+ m) @1 O: @" M, j6 h6 \. K

  40. * O9 T8 j: w4 s: \
  41. #undef EDMA3_DEBUG
    3 v% w; ^% P8 B- h
  42. /*#define EDMA3_DEBUG*/
    7 h3 Z0 A  u7 H

  43. 8 |: k7 x) W* ?
  44. #ifdef EDMA3_DEBUG. R0 i7 f! N4 |6 d- J) }4 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q) l: Z1 W$ E, f0 |5 l* Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 K" }; w* k# D* @7 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " l* h- T2 I, R) v; p  t
  48. #else2 m4 I# p5 J/ v/ m
  49. #define DMA_PRINTK( x... )5 \% }1 G: @2 Q8 F1 f# a" Y
  50. #define DMA_FN_IN
    5 O( h' `8 a8 P. r4 w
  51. #define DMA_FN_OUT
    $ t! v4 j$ J3 T" R) [8 B% ?
  52. #endif9 \8 D* p/ j0 C. h! _

  53. $ F. F* u# d1 U* F. t5 O  ]6 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ?- C. E6 A& ^" ~
  55. #define STATIC_SHIFT                3
    ! m8 r. g0 ^3 X6 `
  56. #define TCINTEN_SHIFT               20
    3 c1 {. V% ^, z! Q  O/ t
  57. #define ITCINTEN_SHIFT              21# \1 l) N( O% I" c3 ]! Y2 S
  58. #define TCCHEN_SHIFT                22
    - }5 T. E, X6 s: K% v# Z% |2 J
  59. #define ITCCHEN_SHIFT               23' L; Q4 Z" }+ a# f; z& S0 h7 x

  60. # l8 ^% ^( s, r
  61. static volatile int irqraised1 = 0;
    2 j' {2 O/ Q9 [
  62. static volatile int irqraised2 = 0;
    6 B( K$ N4 M; C6 F& M
  63. : j$ j! F7 s& b) k4 g0 K# [6 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n5 }  t" g% L: N: r6 _. m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; @' V+ v) _' C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 e: k, z: h9 c' v! E  s
  67. - j0 y1 a' m8 W9 k
  68. dma_addr_t dmaphyssrc1 = 0;
    # H0 [+ L  P8 z' _, [
  69. dma_addr_t dmaphyssrc2 = 0;
    ( }. S( |/ n, N% @5 w8 S
  70. dma_addr_t dmaphysdest1 = 0;
    ; R% }% G: v1 L
  71. dma_addr_t dmaphysdest2 = 0;
      t) f4 y3 M' x( x* _7 a; h6 Z" |

  72. & K0 u% h9 x" I7 v4 d, M+ `1 e  R
  73. char *dmabufsrc1 = NULL;
    " {0 d! X, |1 }+ y0 a
  74. char *dmabufsrc2 = NULL;3 X; Y% b9 b1 U6 D  ?7 B" d
  75. char *dmabufdest1 = NULL;
    % U5 i5 e/ _1 `; k5 z$ H7 W7 h
  76. char *dmabufdest2 = NULL;
    # w  Y! `) s1 Z! h; D5 A
  77. 3 c% K( |1 |4 W2 l  m
  78. static int acnt = 512;# ~) X9 L/ Q0 g0 ]
  79. static int bcnt = 8;9 J- n) s- n" E5 \8 V& H4 f
  80. static int ccnt = 8;* B; |( e5 \# n# J! q
  81. * I( L- E8 g- L# {; T# V7 L0 p. N3 e
  82. module_param(acnt, int, S_IRUGO);
    ( y+ G+ r; b1 G( n3 |( ?2 r, R+ Q
  83. module_param(bcnt, int, S_IRUGO);+ Q8 v5 @1 z% S' K6 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 y+ |7 }1 f; O  S' l

; t) }0 P% B9 S! ?" g. Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* W) X. E. a8 f5 R6 u% o9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" _+ d% [6 G' _+ J+ h# ^/ }7 E6 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b8 J. h' m1 ^
9 [4 y# U! f" \4 G- ~* u7 U

9 C: J1 m' O1 C) E, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 14:27 , Processed in 0.044935 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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