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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , J7 {9 v& N8 r3 r% C! s
  1. [code]EDMA sample test application( {, a! P% {# d$ X5 C$ N
  2. /*% j  A" K7 N) X
  3. * edma_test.c& @9 z4 K% d8 }, L# |+ ~( A
  4. *
    $ P% M9 ~4 n# E; L! c! T$ {& d! R
  5. * brief  EDMA3 Test Application- y" _( W2 i1 [( q
  6. *- [+ w5 p0 z! Z0 N, i
  7. *   This file contains EDMA3 Test code.
    ' {$ k1 q# z/ m8 K
  8. *
    / G  x3 m9 o3 O! s1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( c4 C) [7 N4 C  s7 C" u" @% R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o: C$ E6 B7 n) H  y
  11. *         TO CHANGE.
    9 n/ h$ I$ j/ @8 T
  12. *% b: P) Z& o0 `2 k5 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # j/ P1 m, G6 d6 k; _* M& Q0 A
  14. *4 \+ M! q2 Y$ {3 k2 ~& x( E5 w
  15. * This program is free software; you can redistribute it and/or
    ) U# Y4 w! A6 k0 i  G. z9 c( p
  16. * modify it under the terms of the GNU General Public License as
    3 e4 o/ M& T; x: Z8 i
  17. * published by the Free Software Foundation version 2.6 R& K& P" s  [+ y. @
  18. *3 k: p* Q2 w* g5 ^% [. G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * N' D- T5 b6 D% F+ a
  20. * kind, whether express or implied; without even the implied warranty4 i; O* E5 O" ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . A4 d1 M$ b0 e4 ?" f# z. L/ l
  22. * GNU General Public License for more details.( I2 U! h% D7 U$ {
  23. */
    0 @# L* I; s  \) L9 O& C( Y% h5 F
  24. % d2 a5 H  [, s- s9 X
  25. #include <linux/module.h>" \3 x( `; Z" b! z8 e) K9 C
  26. #include <linux/init.h>
    2 K6 n$ u/ Z2 G4 r9 c" r$ f& J( N1 S
  27. #include <linux/errno.h>
    & r+ U$ s! D5 D& S
  28. #include <linux/types.h>6 @1 v; P5 z* J0 W7 {
  29. #include <linux/interrupt.h>. d! ^! B6 t# Z7 m1 ?- \. ~) K) G
  30. #include <asm/io.h>$ I3 S! m" b* H
  31. #include <linux/moduleparam.h>
    , g, Z& R: L8 V+ o
  32. #include <linux/sysctl.h>1 M# p  z/ m7 x# W8 e6 U6 _
  33. #include <linux/mm.h>
    8 R) ~5 o. L' m% C3 e! }
  34. #include <linux/dma-mapping.h>
    3 f. E% E) X7 Z6 a* I; f7 S6 z
  35. / [) w* O' ^: G3 t/ L( v
  36. #include <mach/memory.h>, S) o' C2 P8 d- v2 n) }' {
  37. #include <mach/hardware.h>/ B, u7 r) q% R# I& S# r. s. d) y/ y
  38. #include <mach/irqs.h>! `+ ~+ m1 K; H6 L
  39. #include <asm/hardware/edma.h>0 k6 W$ L  |% w1 r9 B% t& I

  40. " q9 Z# m! G. D, p/ N3 l5 R+ Q
  41. #undef EDMA3_DEBUG
    ( H, g' h( j) Q5 \( P
  42. /*#define EDMA3_DEBUG*/! `7 H" |8 \8 I; X- `
  43. % B, }" P0 w/ [# D$ S
  44. #ifdef EDMA3_DEBUG' j8 ~% j% D, r  D6 [" h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 l* k6 b2 b! ?1 `4 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ~) F8 P& U: O. D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % n* }4 G- Q4 s& a* Q$ Q& k
  48. #else; V5 A* Y0 `! [8 [3 H2 u% |" q" T
  49. #define DMA_PRINTK( x... )) Y( Y' g" v3 z2 t$ v! J4 K1 N
  50. #define DMA_FN_IN* x9 U% S0 {9 [9 X" ]2 T
  51. #define DMA_FN_OUT
    $ Q  a3 D9 s7 }* h$ d2 t8 t/ }
  52. #endif7 W  @% p) e5 _4 u. V! S

  53. 9 G# s7 b9 R* v/ T/ D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . E6 B$ L3 m# y" b& q1 ?; ^" q3 O
  55. #define STATIC_SHIFT                3
    ! [; A6 U& ?6 a; {  B
  56. #define TCINTEN_SHIFT               20( m7 r/ y$ b7 w/ m6 B) Q  w" p
  57. #define ITCINTEN_SHIFT              21& J( l3 X3 q( c6 t, m: L1 @
  58. #define TCCHEN_SHIFT                22
    5 @- x4 l6 P; b5 T# x# n+ M
  59. #define ITCCHEN_SHIFT               23! a) F5 E+ K8 |+ V

  60. * T# H5 [& U" w" A( \
  61. static volatile int irqraised1 = 0;% n" n$ L% N* ~8 S: _  u5 f
  62. static volatile int irqraised2 = 0;
    6 M# {3 j/ D! Y6 q. R) d: }8 a

  63. 8 N8 ], P% b9 G3 B. R! Y/ U. S! n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* \+ T7 {$ Z( J( X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W/ \; T+ C" U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G9 U4 L& d3 I5 l! A* [! L1 {$ D

  67. 5 D, s  W9 h- O$ E  O6 y
  68. dma_addr_t dmaphyssrc1 = 0;
    4 h: X. M+ J; Q* q) O. l
  69. dma_addr_t dmaphyssrc2 = 0;  l; \! r2 w, J& f) @# a
  70. dma_addr_t dmaphysdest1 = 0;; V, ]$ f2 S; b1 z% v
  71. dma_addr_t dmaphysdest2 = 0;8 f6 r9 G' Q1 t# K+ E5 R3 o! T/ ~4 e

  72. # s3 O" }2 n# ~$ U; p, A( O0 B
  73. char *dmabufsrc1 = NULL;. S2 d( }( n: T) w
  74. char *dmabufsrc2 = NULL;
    , _) `& X/ P8 F
  75. char *dmabufdest1 = NULL;
    4 n5 p0 ?0 L  R
  76. char *dmabufdest2 = NULL;
    - a6 f& v- c: v: h5 N

  77. 6 }2 o# q+ r* f
  78. static int acnt = 512;& f% ]* b9 u) N9 N) [; q
  79. static int bcnt = 8;' ?4 w# R  W% L+ a
  80. static int ccnt = 8;9 J0 w  M% U- x" p( k
  81. 3 q4 {0 f) }$ W! c% d+ Q6 K- M
  82. module_param(acnt, int, S_IRUGO);+ P- `8 i, c9 s1 A
  83. module_param(bcnt, int, S_IRUGO);- u3 n8 p$ R. w  y$ {. q6 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 E; N* z3 S  o+ b; _( o7 o  y8 @: S3 {: T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 C$ @5 _0 a# e3 c) m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% w4 x3 B$ x) D8 [& D7 u. M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* M/ @/ P) C% U8 V9 @8 l
2 P: v& i9 @1 S6 j( V0 o( ^+ k, O: B8 i4 B  Y+ |6 N6 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 07:43 , Processed in 0.041268 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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