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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# r. K2 |# U" l
  1. [code]EDMA sample test application& z: N4 v% ^8 a5 o' i* i- ?
  2. /*0 y' x  t; |. R
  3. * edma_test.c0 n' `) {5 Y+ u8 }
  4. *
    6 E$ m1 |8 E4 B+ o2 G& D9 |
  5. * brief  EDMA3 Test Application1 L- V  s0 S7 v4 Q: ]
  6. *8 v: t' p* o( H- f# t1 }$ F, s7 N
  7. *   This file contains EDMA3 Test code.
    ; Y2 b/ H2 e7 U3 \8 f$ m7 a8 W
  8. *
    / t4 r# F5 C) l! |% |  h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 b( h* \# y, }; k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ p. `+ K$ A5 t6 O3 Q3 K9 N
  11. *         TO CHANGE.
    1 z( q* l% |; Q! h
  12. *
    " e$ X* D; F8 W8 b* O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + R  {& G9 q, j$ J" u+ G9 Z
  14. *7 M& j" O/ t; w9 g2 }9 k
  15. * This program is free software; you can redistribute it and/or6 d5 `; D+ q( @1 q3 F3 m
  16. * modify it under the terms of the GNU General Public License as8 K. ?9 p) b) b* _. ]/ M
  17. * published by the Free Software Foundation version 2.
    8 n. R2 ]7 v+ ?9 B# H
  18. *
    3 ?. j- Y$ o- N  x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ x5 c. }1 V' \' N6 S
  20. * kind, whether express or implied; without even the implied warranty
    6 k8 G- [- S  |/ q" _( r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' H2 Z1 P% f; I5 b. S4 ]5 K
  22. * GNU General Public License for more details.
    1 \. Q5 Q4 A" N0 n
  23. */
    ! T( v& s0 D' J& k2 E+ b

  24. $ }6 g9 i- C5 r: B/ m  n* i# {/ Y
  25. #include <linux/module.h>: x+ p" G' ^' g& |, Q
  26. #include <linux/init.h>
    5 n& h. x1 w3 x: V- R* a  M
  27. #include <linux/errno.h>
    ; x' h5 w& b$ F& e* T7 W
  28. #include <linux/types.h># t& q  t0 o3 M6 D4 y
  29. #include <linux/interrupt.h>
    # t: [3 w0 @: x5 L$ ^
  30. #include <asm/io.h>' }; `5 t. g7 c4 j: q0 V& U5 T" l4 O
  31. #include <linux/moduleparam.h>
    " f. |3 x9 {; Z% R# \
  32. #include <linux/sysctl.h>
    . o. q3 H9 N" V& y! l
  33. #include <linux/mm.h>& X$ C/ e$ y3 k3 H
  34. #include <linux/dma-mapping.h>  [( v9 E- Y- \: h, t5 H0 x

  35. 6 O5 A- n& O3 O
  36. #include <mach/memory.h>; F" o1 @$ f! q9 l8 m- a$ F* E4 o
  37. #include <mach/hardware.h>
    1 O; B" t& f' ^) x& y0 J4 G
  38. #include <mach/irqs.h>; d" n$ o) o& g2 r
  39. #include <asm/hardware/edma.h>
      m. W0 ~' r" h' M
  40. ; x6 D% S; g- r9 J3 v3 b1 H3 i
  41. #undef EDMA3_DEBUG
    1 v' b8 b$ q7 F8 L  C  {
  42. /*#define EDMA3_DEBUG*/1 z5 c, M2 h7 M/ e: S; p

  43. , g+ M( e6 s+ [! t: `: u
  44. #ifdef EDMA3_DEBUG5 y9 v5 k: f$ {4 i  f# Q' |* c" G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). b# }! H8 u( J) @/ e2 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 h) H! J/ K7 @- I) W9 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 F8 V7 e' l1 O8 d: q
  48. #else1 e. h3 b5 S4 j
  49. #define DMA_PRINTK( x... )
    0 Q/ c1 R- f, R6 h  m
  50. #define DMA_FN_IN
    2 v( f  D1 n# c8 a0 S1 ]
  51. #define DMA_FN_OUT
    8 Z6 K. l0 Z2 n& {
  52. #endif. E! ~! z4 E4 A* u$ l  _

  53. $ f7 }, P0 |% x& R6 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' O+ I. C8 D8 b" l) }. z
  55. #define STATIC_SHIFT                3
    9 e3 c7 c3 e' G" Z
  56. #define TCINTEN_SHIFT               20# R% i8 c) E9 l& I$ D, C9 ]1 b- k$ [
  57. #define ITCINTEN_SHIFT              21) ]3 {  ]' M0 Z* X. }6 F* r3 Z5 o! M% `
  58. #define TCCHEN_SHIFT                22  e+ ^0 w) e4 h7 a
  59. #define ITCCHEN_SHIFT               23
    ' Q8 c# t8 p' d% C* Z; D4 T) \
  60. % ?% X7 i' E! H. {/ }
  61. static volatile int irqraised1 = 0;
    8 ?$ ]) W4 J: V& r2 u1 ^, o. A
  62. static volatile int irqraised2 = 0;- U: V2 S# m0 j- r. l
  63. - p+ K' f) M9 t- {1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " \, x3 C! _5 w  ^- F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( o$ G2 j2 N$ ]* _8 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c/ r: b; Z+ _% F3 d( |

  67. . [+ e/ I4 g8 J  `9 `- |3 q
  68. dma_addr_t dmaphyssrc1 = 0;
    ( e2 J- N" z% ?: _: w7 W2 W
  69. dma_addr_t dmaphyssrc2 = 0;6 z, o" c2 v) `1 b7 ^9 P3 X9 ~
  70. dma_addr_t dmaphysdest1 = 0;/ `+ I8 ^1 {* t0 M/ w8 l2 B2 R5 h
  71. dma_addr_t dmaphysdest2 = 0;5 Q+ t( _5 m1 j/ U+ u
  72. $ Y( @) Z' p5 V5 n9 i0 R/ [0 ^
  73. char *dmabufsrc1 = NULL;
    ( ~8 {: l& b7 W  R3 ]& y- E4 J) x
  74. char *dmabufsrc2 = NULL;( ~  b7 o; {4 `, q1 d
  75. char *dmabufdest1 = NULL;
    9 e  t3 `1 \" q2 h5 ~. X. J
  76. char *dmabufdest2 = NULL;$ P  u7 x3 y, s" R

  77. 7 k' X6 e# c" B. v+ t. [
  78. static int acnt = 512;
    : B5 I- \) {- m- W9 D) ~4 D2 o
  79. static int bcnt = 8;
    9 `5 P$ M- t/ u: x; |- F
  80. static int ccnt = 8;1 x) \+ p. s4 \3 m3 A
  81. $ e% t: i, U# P; A( Y% `! L
  82. module_param(acnt, int, S_IRUGO);# l2 \' T, T, U* E- s. D/ |
  83. module_param(bcnt, int, S_IRUGO);
    ( N2 }- c& n- o+ s0 Y' `% G1 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! q# N! A6 z* k8 N! j. Q- \
% V/ @# e# [; C! K/ ?- ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 B2 u- O5 W8 J8 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X8 y5 p1 w" a7 }* w$ S0 m% v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t2 k% F6 [& o+ E! Q2 ~! P, C& j  ~5 }! E! `' ^, K* C. u9 F
5 x1 c: O1 z* P9 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 21:26 , Processed in 0.039696 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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