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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) w7 E6 }6 ?1 S# T- l, ^
  1. [code]EDMA sample test application8 k' o) c6 |+ b) c, D1 Q/ K0 r
  2. /*2 e  {3 \( b8 ^% `2 v% K
  3. * edma_test.c; X4 ]2 |; \0 B: P" c+ [
  4. *
    9 i+ w8 i4 G1 F! P; H! g9 L+ w6 l
  5. * brief  EDMA3 Test Application
    5 i3 Q5 [, p' f6 r* A' E
  6. */ }3 a5 ^& B1 U4 w) P
  7. *   This file contains EDMA3 Test code.
    # F( {! I8 {9 \  `
  8. *
    6 b3 H6 W5 _$ ]% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 h0 \+ M8 o2 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 n  j. D8 L  X0 M8 Z
  11. *         TO CHANGE.7 N) G2 M8 ~! `% x
  12. *6 g0 L, P- A4 |/ u8 t5 J5 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; A0 `! h! _- ~6 @
  14. *
    , d# s% Q+ ]( i. v  d* e: [
  15. * This program is free software; you can redistribute it and/or& T% U( e, e2 r& D7 q
  16. * modify it under the terms of the GNU General Public License as
    % }4 D& L" d  I
  17. * published by the Free Software Foundation version 2.
    $ ~+ G- E3 v3 F# C5 X6 m
  18. *
    7 r- [8 c& b( e% c6 x; r8 G  i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ^: }( K( V6 z
  20. * kind, whether express or implied; without even the implied warranty7 e7 V! f# h( Z3 R) y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 J/ V2 P8 A' E+ L8 p, {' t
  22. * GNU General Public License for more details.6 D* E3 j: J1 r0 z: ^
  23. */
    & N( c7 M& M/ ]  N4 U4 {2 m
  24. 8 N: S+ S4 C5 D& |( P# w
  25. #include <linux/module.h>
      e; M0 W' ?# E# @5 h
  26. #include <linux/init.h>
    $ v) Q* j4 H7 M
  27. #include <linux/errno.h>
    $ G3 E2 D: @2 {* K. C
  28. #include <linux/types.h>/ l2 x4 j4 \8 {: e1 M: _7 G
  29. #include <linux/interrupt.h>! }- ^# o5 I8 d: }" V
  30. #include <asm/io.h>
    . l* ?& j% _  t$ R- H
  31. #include <linux/moduleparam.h>$ B! v) Q+ h/ v7 m% z: n" o
  32. #include <linux/sysctl.h>
    # {: p/ W$ n5 P2 N, i  g) J
  33. #include <linux/mm.h>' _; e2 z  {1 |1 d
  34. #include <linux/dma-mapping.h>) P% m. U( f- M$ C
  35. ; ^" j. F5 C! [
  36. #include <mach/memory.h>
    + K/ M/ n8 z2 s, C1 M+ K' a/ y9 F9 P
  37. #include <mach/hardware.h>+ H- ~. I( j7 u( r6 y2 H
  38. #include <mach/irqs.h>7 Q2 [! B5 `, y
  39. #include <asm/hardware/edma.h>; @% }: ~, P% ?- }3 d5 X
  40. 1 K/ w" l& D7 I( ?% p7 N
  41. #undef EDMA3_DEBUG$ w" T' Y4 u9 w
  42. /*#define EDMA3_DEBUG*/5 e: {4 u' Y* Y1 a( l8 b

  43. 4 U- F1 c1 V2 S6 k
  44. #ifdef EDMA3_DEBUG/ i+ W9 N4 ~0 l# V2 Y1 m1 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . j! d& h5 K0 m& c% A, Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X' _7 o3 u% q5 X; L8 o4 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% J0 R& J  r. \0 n2 B8 @1 E
  48. #else
    , j$ F; Y% v" m" u
  49. #define DMA_PRINTK( x... )
    # s5 e6 W0 V; s8 R& t# f$ i* r0 ?
  50. #define DMA_FN_IN
    * w9 v- }) Y# m/ N9 d, R0 `+ z1 p' }5 I
  51. #define DMA_FN_OUT
    7 v/ {3 U/ e$ R, v) j& w& ?/ v, @
  52. #endif
    - u% }" l% b6 C, i

  53. " P' h0 H: {7 C6 T2 H+ n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- z6 a: e* J1 n1 y
  55. #define STATIC_SHIFT                3: i' ^7 T( ^* n) @5 M
  56. #define TCINTEN_SHIFT               203 M1 y% `1 _4 S$ L& _3 W
  57. #define ITCINTEN_SHIFT              21- \5 [& Q7 O) M5 D7 U4 T. Q
  58. #define TCCHEN_SHIFT                22# W  o- w: }$ W0 i' W
  59. #define ITCCHEN_SHIFT               23
    - y3 J: G3 w. T; K. V

  60. 4 p9 F9 r& g$ o1 y% `/ v
  61. static volatile int irqraised1 = 0;) r: }' Z, K3 K5 b
  62. static volatile int irqraised2 = 0;
    . a' o7 e4 a% x, E( ^$ `2 g
  63. 8 c+ h# {2 F1 T6 A" e0 m! c! `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f& R% x4 @% X. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]6 P7 l$ T5 Q' P2 D" D! Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S! @3 J( N" [% b! d
  67. : ]9 p" F- L; U! v$ G
  68. dma_addr_t dmaphyssrc1 = 0;2 w& N; b, x# `0 a' `8 s- z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! A; U7 E( o6 n$ k2 A! [7 N
  70. dma_addr_t dmaphysdest1 = 0;
    ) b2 u8 Q( C9 X' [. o+ ?1 E
  71. dma_addr_t dmaphysdest2 = 0;
    ; r/ @0 o$ k0 `, G
  72. ; ]% `9 T  W/ p1 s% Z
  73. char *dmabufsrc1 = NULL;* ^0 U' D5 V1 S  F$ ?4 t( l. Q% @; y
  74. char *dmabufsrc2 = NULL;
    ' o" ?% V# `# `( Y7 I
  75. char *dmabufdest1 = NULL;
    5 G% O6 b/ O5 r2 L" q) W1 J
  76. char *dmabufdest2 = NULL;
    5 E- ?" t1 k7 d/ J7 b

  77.   K8 y' t5 L8 N
  78. static int acnt = 512;
    ' C1 t6 e; x. T% n- ], `; M6 `  C
  79. static int bcnt = 8;
    ( `8 @9 M' h) w) e3 N: l
  80. static int ccnt = 8;
    # O. Q+ u) c, V( ]' l7 R1 w$ Y8 D
  81. 8 Y: v& |! B: A+ n
  82. module_param(acnt, int, S_IRUGO);
    $ T$ r& Y+ @$ ?; {4 N  u/ s
  83. module_param(bcnt, int, S_IRUGO);" q6 B8 `. x3 T6 a# n. S7 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 _( J( b3 I5 h6 a# Q
, \* i/ f/ h' l% h8 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ d$ U3 a4 O8 ?) B9 a7 l8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) w( Z, `* O' O  l- F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, b- k. L6 ~$ @0 a& e* o
; D9 t$ w* O& x3 B) Y% {
! g' _  [: w. R8 T  m: M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 12:20 , Processed in 0.041035 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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