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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?& }; ?0 D( X- F- j3 M
  1. [code]EDMA sample test application/ r2 J  P( j% b+ g5 ~+ S
  2. /*# S7 y' k* q3 y8 T% T, S2 B; A
  3. * edma_test.c  @: W# f3 k) P
  4. *
    , a( |9 H5 r; r1 m+ O# e0 t
  5. * brief  EDMA3 Test Application
    / q7 i3 j  Y1 j3 E, i
  6. *9 X) O% ]& e& }6 |
  7. *   This file contains EDMA3 Test code.' h* ]/ S) a- T9 G7 x# \1 @, ^
  8. *
    * ~& @$ {- [( N& |' t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& K4 D- o1 j# T0 h/ X5 [" ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 I) P3 k- p/ w( T8 [+ `
  11. *         TO CHANGE., a2 G% v1 ^( F, v) A( c
  12. *: q, h" s7 ~$ s* ^% L4 r; |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 x; l; r% l: Y% g4 ]# Z6 s- i
  14. *
    9 \0 d- t- ]' A: u  A
  15. * This program is free software; you can redistribute it and/or& z0 p! Q/ R8 U/ R7 X
  16. * modify it under the terms of the GNU General Public License as
    " W+ i, m. f4 `) h# C. U  l
  17. * published by the Free Software Foundation version 2.
    8 f! v9 a4 x0 v
  18. *
    ) ^8 _- ?7 s2 f9 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 Z8 \+ |" H0 E3 f- T3 X
  20. * kind, whether express or implied; without even the implied warranty
    : M1 ~- A: d' [: q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 ^2 [7 P/ W' @3 Q2 _/ c) e7 q
  22. * GNU General Public License for more details.
    , d+ `: N2 m/ @: l7 f  ^  u/ s+ D5 @
  23. */7 K+ L0 g+ v$ n8 I" g& ^1 F

  24. ! {" @% M; M+ X) J3 P% O
  25. #include <linux/module.h>
    8 Q; N7 Q$ a5 `$ h
  26. #include <linux/init.h>
    ) g# s# x; S0 r; U# x  A% Z0 U+ d! r
  27. #include <linux/errno.h>" j+ j# g0 L' H# g( R" f
  28. #include <linux/types.h>5 v0 g& W2 C: \0 H
  29. #include <linux/interrupt.h>$ d8 k, v3 x0 i" M3 P
  30. #include <asm/io.h>) m; J. d0 ?5 R1 z5 `& u" \' n6 g
  31. #include <linux/moduleparam.h>' [3 m7 p2 N9 j" H5 n
  32. #include <linux/sysctl.h>6 `$ R) X4 m- N) L
  33. #include <linux/mm.h>
    * p1 E5 u; f; r- w" i
  34. #include <linux/dma-mapping.h>: F1 R. H6 _$ G* T2 Z: R1 B/ m
  35. 2 B7 b8 C; s: \
  36. #include <mach/memory.h>( Z$ k; ]& |5 ?
  37. #include <mach/hardware.h>9 U; d# u" l0 P  K" |" I
  38. #include <mach/irqs.h>
    0 z5 P/ i* Z( i' l' g8 I
  39. #include <asm/hardware/edma.h>
    / {% F4 N1 P# l  l. B3 g
  40. 4 D3 C/ s+ p# I5 J
  41. #undef EDMA3_DEBUG
    ' E0 _1 d# b2 v  n+ {
  42. /*#define EDMA3_DEBUG*/' g; c! X8 \9 g
  43. ) g9 z* u: w: X- a7 l
  44. #ifdef EDMA3_DEBUG
    0 R1 _" y" E- C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) f8 ]) G3 z, t1 y* i4 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S4 m# U4 w! l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , S; X9 }( ~9 p
  48. #else
    ' W# [" k. X# L" R: T
  49. #define DMA_PRINTK( x... ), g1 m0 e- q/ _! Q' y8 ~
  50. #define DMA_FN_IN
    ) ]" T4 S+ R5 @
  51. #define DMA_FN_OUT
    & u& d1 o" N5 R6 k. l' H
  52. #endif
    5 U' U+ v4 P1 D2 ^9 z# s1 d. V

  53. 4 \1 p7 E* ]8 b3 M/ P8 d. e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - q) k  z# ?5 |
  55. #define STATIC_SHIFT                3
    6 h* u7 F5 `7 ~) q
  56. #define TCINTEN_SHIFT               20
    ; _4 ^) a3 d- J- H8 F0 {: W: y
  57. #define ITCINTEN_SHIFT              218 Z8 h. l* N: a$ L
  58. #define TCCHEN_SHIFT                22
    / F* Z! N  |0 e% }' o8 }
  59. #define ITCCHEN_SHIFT               23
    4 b- B5 X+ P: u
  60. ; T. d7 k8 m! w* h0 F& ?
  61. static volatile int irqraised1 = 0;
    ! Y1 @1 i0 W- ?% x  ]
  62. static volatile int irqraised2 = 0;8 \; U. O, N) a- c6 A1 a

  63. . N2 T7 s+ y( C1 u! G* d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 n/ ^" E( x! O8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `/ v; R9 M7 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p4 F: g8 k. J8 f, F' }) u; T
  67. 5 o  J8 \: Q, `2 ^( ]3 |
  68. dma_addr_t dmaphyssrc1 = 0;0 i' d2 J& m* w% j* _
  69. dma_addr_t dmaphyssrc2 = 0;+ v, y9 n) @" E5 g
  70. dma_addr_t dmaphysdest1 = 0;6 t; @8 J  u$ r7 x4 \
  71. dma_addr_t dmaphysdest2 = 0;2 q: G( y/ W: i8 A' `

  72. 2 B$ C2 _- t* C4 i2 p. x* P
  73. char *dmabufsrc1 = NULL;
    : C, a$ A! [" j4 u9 O! y
  74. char *dmabufsrc2 = NULL;) v$ N3 A# x  d
  75. char *dmabufdest1 = NULL;
    2 n/ y( |1 q4 X- j  t" A' }- K0 L* F
  76. char *dmabufdest2 = NULL;! ^7 u3 J0 s3 F. n
  77. + U6 B2 Z' S! V5 L4 e
  78. static int acnt = 512;5 N/ m7 L# h3 C' k
  79. static int bcnt = 8;/ {( R9 W- C7 w
  80. static int ccnt = 8;
    % j+ t. O" O8 [  b

  81.   w& J9 S  O2 o
  82. module_param(acnt, int, S_IRUGO);
    8 V' e6 S5 v7 |, O+ q+ q8 }7 q
  83. module_param(bcnt, int, S_IRUGO);
      Q) o; H8 c: ]: H8 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 I* B( W! `: I
8 @, o& z1 Z" ?4 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 `' w4 `, [0 t5 G6 |5 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 b# b2 c. d: y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  f: p! i2 E' x& ~
# S8 M5 b4 @- ^& V' ~# G3 [0 W. s
# i2 z% U% d# U# W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-3 14:21 , Processed in 0.042117 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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